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EC,IACjDD,EAAE86C,WAAa,WAChB,IAAK,IAAI76C,EAAI,GAAIC,EAAI,EAAGA,EAAIyC,UAAUC,OAAQ1C,IAC5CD,EAAEC,GAAKyC,UAAUzC,GAGnB,IAAI8B,EAaJ,WACE,IAAK,IAAIhC,EAAI,GAAIC,EAAI,EAAGA,EAAI0C,UAAUC,OAAQ3C,IAC5CD,EAAEC,GAAK0C,UAAU1C,GAKnB,OAAO,IAAI60C,GAAG,aAAc90C,IAC5BgD,WAAM,EAAQ/C,GAEhB,OAAO+B,EAAE2wC,YAAc,wBAAyB,IAAI3yC,EAAEgC,IACrDhC,EAAE+6C,YAAc,WACjB,IAAK,IAAI96C,EAAI,GAAIC,EAAI,EAAGA,EAAIyC,UAAUC,OAAQ1C,IAC5CD,EAAEC,GAAKyC,UAAUzC,GAGnB,IAAI8B,EAAI,WACN,IAAK,IAAIhC,EAAI,GAAIC,EAAI,EAAGA,EAAI0C,UAAUC,OAAQ3C,IAC5CD,EAAEC,GAAK0C,UAAU1C,GAKnB,OAAO,IAAIg1C,GAAG,cAAej1C,IAC7BgD,WAAM,EAAQ/C,GAEhB,OAAO+B,EAAE2wC,YAAc,yBAA0B,IAAI3yC,EAAEgC,IACtDhC,EAAEqe,UAAY,SAAUpe,GACzB,IAAIC,EAAI,SAAUF,GAChB,OAAO,IAAIk1C,GAAG,YAAal1C,GADrB,CAENC,GAEF,OAAOC,EAAEyyC,YAAc,uBAAwB,IAAI3yC,EAAEE,IACpDF,EAAEQ,UAAU4E,QAAU,SAAUpF,GACjC,OAAOG,KAAKstC,UAAUroC,QAAQpF,EAAEytC,YAC/BztC,EAhEL","sources":["webpack://kanha-shanthi-vanam/../node_modules/@firebase/firestore/dist/esm5/prebuilt-306f43d8-45d6f0b9.js"],"sourcesContent":["import { __extends as t, __spreadArray as e, __awaiter as n, __generator as r } from \"tslib\";\nimport { getUA as i, isSafari as o, isMobileCordova as s, isReactNative as u, isElectron as a, isIE as c, isUWP as h, isBrowserExtension as f, getModularInstance as l, createMockUserToken as d } from \"@firebase/util\";\nimport { Logger as p, LogLevel as y } from \"@firebase/logger\";\nimport { XhrIo as v, EventType as m, ErrorCode as g, createWebChannelTransport as w, getStatEventTarget as b, FetchXmlHttpFactory as I, WebChannel as T, Event as E, Stat as _ } from \"@firebase/webchannel-wrapper\";\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\n/**\n * `ListenSequence` is a monotonic sequence. It is initialized with a minimum value to\n * exceed. All subsequent calls to next will return increasing values. If provided with a\n * `SequenceNumberSyncer`, it will additionally bump its next value when told of a new value, as\n * well as write out sequence numbers that it produces via `next()`.\n */\n\nvar S =\n/** @class */\nfunction () {\n function t(t, e) {\n var n = this;\n this.previousValue = t, e && (e.sequenceNumberHandler = function (t) {\n return n.t(t);\n }, this.i = function (t) {\n return e.writeSequenceNumber(t);\n });\n }\n\n return t.prototype.t = function (t) {\n return this.previousValue = Math.max(t, this.previousValue), this.previousValue;\n }, t.prototype.next = function () {\n var t = ++this.previousValue;\n return this.i && this.i(t), t;\n }, t;\n}();\n\nS.o = -1;\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\nvar N = {\n // Causes are copied from:\n // https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h\n\n /** Not an error; returned on success. */\n OK: \"ok\",\n\n /** The operation was cancelled (typically by the caller). */\n CANCELLED: \"cancelled\",\n\n /** Unknown error or an error from a different error domain. */\n UNKNOWN: \"unknown\",\n\n /**\n * Client specified an invalid argument. Note that this differs from\n * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are\n * problematic regardless of the state of the system (e.g., a malformed file\n * name).\n */\n INVALID_ARGUMENT: \"invalid-argument\",\n\n /**\n * Deadline expired before operation could complete. For operations that\n * change the state of the system, this error may be returned even if the\n * operation has completed successfully. For example, a successful response\n * from a server could have been delayed long enough for the deadline to\n * expire.\n */\n DEADLINE_EXCEEDED: \"deadline-exceeded\",\n\n /** Some requested entity (e.g., file or directory) was not found. */\n NOT_FOUND: \"not-found\",\n\n /**\n * Some entity that we attempted to create (e.g., file or directory) already\n * exists.\n */\n ALREADY_EXISTS: \"already-exists\",\n\n /**\n * The caller does not have permission to execute the specified operation.\n * PERMISSION_DENIED must not be used for rejections caused by exhausting\n * some resource (use RESOURCE_EXHAUSTED instead for those errors).\n * PERMISSION_DENIED must not be used if the caller can not be identified\n * (use UNAUTHENTICATED instead for those errors).\n */\n PERMISSION_DENIED: \"permission-denied\",\n\n /**\n * The request does not have valid authentication credentials for the\n * operation.\n */\n UNAUTHENTICATED: \"unauthenticated\",\n\n /**\n * Some resource has been exhausted, perhaps a per-user quota, or perhaps the\n * entire file system is out of space.\n */\n RESOURCE_EXHAUSTED: \"resource-exhausted\",\n\n /**\n * Operation was rejected because the system is not in a state required for\n * the operation's execution. For example, directory to be deleted may be\n * non-empty, an rmdir operation is applied to a non-directory, etc.\n *\n * A litmus test that may help a service implementor in deciding\n * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:\n * (a) Use UNAVAILABLE if the client can retry just the failing call.\n * (b) Use ABORTED if the client should retry at a higher-level\n * (e.g., restarting a read-modify-write sequence).\n * (c) Use FAILED_PRECONDITION if the client should not retry until\n * the system state has been explicitly fixed. E.g., if an \"rmdir\"\n * fails because the directory is non-empty, FAILED_PRECONDITION\n * should be returned since the client should not retry unless\n * they have first fixed up the directory by deleting files from it.\n * (d) Use FAILED_PRECONDITION if the client performs conditional\n * REST Get/Update/Delete on a resource and the resource on the\n * server does not match the condition. E.g., conflicting\n * read-modify-write on the same resource.\n */\n FAILED_PRECONDITION: \"failed-precondition\",\n\n /**\n * The operation was aborted, typically due to a concurrency issue like\n * sequencer check failures, transaction aborts, etc.\n *\n * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,\n * and UNAVAILABLE.\n */\n ABORTED: \"aborted\",\n\n /**\n * Operation was attempted past the valid range. E.g., seeking or reading\n * past end of file.\n *\n * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed\n * if the system state changes. For example, a 32-bit file system will\n * generate INVALID_ARGUMENT if asked to read at an offset that is not in the\n * range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from\n * an offset past the current file size.\n *\n * There is a fair bit of overlap between FAILED_PRECONDITION and\n * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error)\n * when it applies so that callers who are iterating through a space can\n * easily look for an OUT_OF_RANGE error to detect when they are done.\n */\n OUT_OF_RANGE: \"out-of-range\",\n\n /** Operation is not implemented or not supported/enabled in this service. */\n UNIMPLEMENTED: \"unimplemented\",\n\n /**\n * Internal errors. Means some invariants expected by underlying System has\n * been broken. If you see one of these errors, Something is very broken.\n */\n INTERNAL: \"internal\",\n\n /**\n * The service is currently unavailable. This is a most likely a transient\n * condition and may be corrected by retrying with a backoff.\n *\n * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,\n * and UNAVAILABLE.\n */\n UNAVAILABLE: \"unavailable\",\n\n /** Unrecoverable data loss or corruption. */\n DATA_LOSS: \"data-loss\"\n},\n D =\n/** @class */\nfunction (e) {\n /** @hideconstructor */\n function n(\n /**\n * The backend error code associated with this error.\n */\n t,\n /**\n * A custom error description.\n */\n n) {\n var r = this;\n return (r = e.call(this, n) || this).code = t, r.message = n,\n /** The custom name for all FirestoreErrors. */\n r.name = \"FirebaseError\", // HACK: We write a toString property directly because Error is not a real\n // class and so inheritance does not work correctly. We could alternatively\n // do the same \"back-door inheritance\" trick that FirebaseError does.\n r.toString = function () {\n return r.name + \": [code=\" + r.code + \"]: \" + r.message;\n }, r;\n }\n\n return t(n, e), n;\n}(Error),\n A = new p(\"@firebase/firestore\");\n/** An error returned by a Firestore operation. */\n// Helper methods are needed because variables can't be exported as read/write\n\n\nfunction k() {\n return A.logLevel;\n}\n/**\n * Sets the verbosity of Cloud Firestore logs (debug, error, or silent).\n *\n * @param logLevel - The verbosity you set for activity and error logging. Can\n * be any of the following values:\n *\n * \n */\n\n\nfunction C(t) {\n for (var n = [], r = 1; r < arguments.length; r++) {\n n[r - 1] = arguments[r];\n }\n\n if (A.logLevel <= y.DEBUG) {\n var i = n.map(L);\n A.debug.apply(A, e([\"Firestore (8.10.0): \" + t], i));\n }\n}\n\nfunction x(t) {\n for (var n = [], r = 1; r < arguments.length; r++) {\n n[r - 1] = arguments[r];\n }\n\n if (A.logLevel <= y.ERROR) {\n var i = n.map(L);\n A.error.apply(A, e([\"Firestore (8.10.0): \" + t], i));\n }\n}\n\nfunction R(t) {\n for (var n = [], r = 1; r < arguments.length; r++) {\n n[r - 1] = arguments[r];\n }\n\n if (A.logLevel <= y.WARN) {\n var i = n.map(L);\n A.warn.apply(A, e([\"Firestore (8.10.0): \" + t], i));\n }\n}\n/**\n * Converts an additional log parameter to a string representation.\n */\n\n\nfunction L(t) {\n if (\"string\" == typeof t) return t;\n\n try {\n return e = t, JSON.stringify(e);\n } catch (e) {\n // Converting to JSON failed, just log the object directly\n return t;\n }\n\n var e;\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/**\n * Unconditionally fails, throwing an Error with the given message.\n * Messages are stripped in production builds.\n *\n * Returns `never` and can be used in expressions:\n * @example\n * let futureVar = fail('not implemented yet');\n */\n\n\nfunction O(t) {\n void 0 === t && (t = \"Unexpected state\"); // Log the failure in addition to throw an exception, just in case the\n // exception is swallowed.\n\n var e = \"FIRESTORE (8.10.0) INTERNAL ASSERTION FAILED: \" + t; // NOTE: We don't use FirestoreError here because these are internal failures\n // that cannot be handled by the user. (Also it would create a circular\n // dependency between the error and assert modules which doesn't work.)\n\n throw x(e), new Error(e)\n /**\n * Fails if the given assertion condition is false, throwing an Error with the\n * given message if it did.\n *\n * Messages are stripped in production builds.\n */\n ;\n}\n\nfunction P(t, e) {\n t || O();\n}\n/**\n * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an\n * instance of `T` before casting.\n */\n\n\nfunction F(t, // eslint-disable-next-line @typescript-eslint/no-explicit-any\ne) {\n return t;\n}\n/**\n * @license\n * Copyright 2020 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 * Generates `nBytes` of random bytes.\n *\n * If `nBytes < 0` , an error will be thrown.\n */\n\n\nfunction M(t) {\n // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.\n var e = // eslint-disable-next-line @typescript-eslint/no-explicit-any\n \"undefined\" != typeof self && (self.crypto || self.msCrypto),\n n = new Uint8Array(t);\n if (e && \"function\" == typeof e.getRandomValues) e.getRandomValues(n);else // Falls back to Math.random\n for (var r = 0; r < t; r++) {\n n[r] = Math.floor(256 * Math.random());\n }\n return 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\nvar V =\n/** @class */\nfunction () {\n function t() {}\n\n return t.u = function () {\n for ( // Alphanumeric characters\n var t = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\", e = Math.floor(256 / t.length) * t.length, n = \"\" // The largest byte value that is a multiple of `char.length`.\n ; n.length < 20;) {\n for (var r = M(40), i = 0; i < r.length; ++i) {\n // Only accept values that are [0, maxMultiple), this ensures they can\n // be evenly mapped to indices of `chars` via a modulo operation.\n n.length < 20 && r[i] < e && (n += t.charAt(r[i] % t.length));\n }\n }\n\n return n;\n }, t;\n}();\n\nfunction q(t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n}\n/** Helper to compare arrays using isEqual(). */\n\n\nfunction U(t, e, n) {\n return t.length === e.length && t.every(function (t, r) {\n return n(t, e[r]);\n });\n}\n/**\n * Returns the immediate lexicographically-following string. This is useful to\n * construct an inclusive range for indexeddb iterators.\n */\n\n\nfunction B(t) {\n // Return the input string, with an additional NUL byte appended.\n return t + \"\\0\";\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// The earliest date supported by Firestore timestamps (0001-01-01T00:00:00Z).\n\n/**\n * A `Timestamp` represents a point in time independent of any time zone or\n * calendar, represented as seconds and fractions of seconds at nanosecond\n * resolution in UTC Epoch time.\n *\n * It is encoded using the Proleptic Gregorian Calendar which extends the\n * Gregorian calendar backwards to year one. It is encoded assuming all minutes\n * are 60 seconds long, i.e. leap seconds are \"smeared\" so that no leap second\n * table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59.999999999Z.\n *\n * For examples and further specifications, refer to the\n * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.\n */\n\n\nvar j =\n/** @class */\nfunction () {\n /**\n * Creates a new timestamp.\n *\n * @param seconds - The number of seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n * @param nanoseconds - The non-negative fractions of a second at nanosecond\n * resolution. Negative second values with fractions must still have\n * non-negative nanoseconds values that count forward in time. Must be\n * from 0 to 999,999,999 inclusive.\n */\n function t(\n /**\n * The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.\n */\n t,\n /**\n * The fractions of a second at nanosecond resolution.*\n */\n e) {\n if (this.seconds = t, this.nanoseconds = e, e < 0) throw new D(N.INVALID_ARGUMENT, \"Timestamp nanoseconds out of range: \" + e);\n if (e >= 1e9) throw new D(N.INVALID_ARGUMENT, \"Timestamp nanoseconds out of range: \" + e);\n if (t < -62135596800) throw new D(N.INVALID_ARGUMENT, \"Timestamp seconds out of range: \" + t); // This will break in the year 10,000.\n\n if (t >= 253402300800) throw new D(N.INVALID_ARGUMENT, \"Timestamp seconds out of range: \" + t);\n }\n /**\n * Creates a new timestamp with the current date, with millisecond precision.\n *\n * @returns a new timestamp representing the current date.\n */\n\n\n return t.now = function () {\n return t.fromMillis(Date.now());\n },\n /**\n * Creates a new timestamp from the given date.\n *\n * @param date - The date to initialize the `Timestamp` from.\n * @returns A new `Timestamp` representing the same point in time as the given\n * date.\n */\n t.fromDate = function (e) {\n return t.fromMillis(e.getTime());\n },\n /**\n * Creates a new timestamp from the given number of milliseconds.\n *\n * @param milliseconds - Number of milliseconds since Unix epoch\n * 1970-01-01T00:00:00Z.\n * @returns A new `Timestamp` representing the same point in time as the given\n * number of milliseconds.\n */\n t.fromMillis = function (e) {\n var n = Math.floor(e / 1e3);\n return new t(n, Math.floor(1e6 * (e - 1e3 * n)));\n },\n /**\n * Converts a `Timestamp` to a JavaScript `Date` object. This conversion\n * causes a loss of precision since `Date` objects only support millisecond\n * precision.\n *\n * @returns JavaScript `Date` object representing the same point in time as\n * this `Timestamp`, with millisecond precision.\n */\n t.prototype.toDate = function () {\n return new Date(this.toMillis());\n },\n /**\n * Converts a `Timestamp` to a numeric timestamp (in milliseconds since\n * epoch). This operation causes a loss of precision.\n *\n * @returns The point in time corresponding to this timestamp, represented as\n * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.\n */\n t.prototype.toMillis = function () {\n return 1e3 * this.seconds + this.nanoseconds / 1e6;\n }, t.prototype._compareTo = function (t) {\n return this.seconds === t.seconds ? q(this.nanoseconds, t.nanoseconds) : q(this.seconds, t.seconds);\n },\n /**\n * Returns true if this `Timestamp` is equal to the provided one.\n *\n * @param other - The `Timestamp` to compare against.\n * @returns true if this `Timestamp` is equal to the provided one.\n */\n t.prototype.isEqual = function (t) {\n return t.seconds === this.seconds && t.nanoseconds === this.nanoseconds;\n },\n /** Returns a textual representation of this Timestamp. */\n t.prototype.toString = function () {\n return \"Timestamp(seconds=\" + this.seconds + \", nanoseconds=\" + this.nanoseconds + \")\";\n },\n /** Returns a JSON-serializable representation of this Timestamp. */\n t.prototype.toJSON = function () {\n return {\n seconds: this.seconds,\n nanoseconds: this.nanoseconds\n };\n },\n /**\n * Converts this object to a primitive string, which allows Timestamp objects\n * to be compared using the `>`, `<=`, `>=` and `>` operators.\n */\n t.prototype.valueOf = function () {\n // This method returns a string of the form . where\n // is translated to have a non-negative value and both \n // and are left-padded with zeroes to be a consistent length.\n // Strings with this format then have a lexiographical ordering that matches\n // the expected ordering. The translation is done to avoid having\n // a leading negative sign (i.e. a leading '-' character) in its string\n // representation, which would affect its lexiographical ordering.\n var t = this.seconds - -62135596800; // Note: Up to 12 decimal digits are required to represent all valid\n // 'seconds' values.\n\n return String(t).padStart(12, \"0\") + \".\" + String(this.nanoseconds).padStart(9, \"0\");\n }, t;\n}(),\n K =\n/** @class */\nfunction () {\n function t(t) {\n this.timestamp = t;\n }\n\n return t.fromTimestamp = function (e) {\n return new t(e);\n }, t.min = function () {\n return new t(new j(0, 0));\n }, t.prototype.compareTo = function (t) {\n return this.timestamp._compareTo(t.timestamp);\n }, t.prototype.isEqual = function (t) {\n return this.timestamp.isEqual(t.timestamp);\n },\n /** Returns a number representation of the version for use in spec tests. */\n t.prototype.toMicroseconds = function () {\n // Convert to microseconds.\n return 1e6 * this.timestamp.seconds + this.timestamp.nanoseconds / 1e3;\n }, t.prototype.toString = function () {\n return \"SnapshotVersion(\" + this.timestamp.toString() + \")\";\n }, t.prototype.toTimestamp = function () {\n return this.timestamp;\n }, t;\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/**\n * A version of a document in Firestore. This corresponds to the version\n * timestamp, such as update_time or read_time.\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\nfunction Q(t) {\n var e = 0;\n\n for (var n in t) {\n Object.prototype.hasOwnProperty.call(t, n) && e++;\n }\n\n return e;\n}\n\nfunction G(t, e) {\n for (var n in t) {\n Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);\n }\n}\n\nfunction z(t) {\n for (var e in t) {\n if (Object.prototype.hasOwnProperty.call(t, e)) return !1;\n }\n\n return !0;\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/**\n * Path represents an ordered sequence of string segments.\n */\n\n\nvar W =\n/** @class */\nfunction () {\n function t(t, e, n) {\n void 0 === e ? e = 0 : e > t.length && O(), void 0 === n ? n = t.length - e : n > t.length - e && O(), this.segments = t, this.offset = e, this.len = n;\n }\n\n return Object.defineProperty(t.prototype, \"length\", {\n get: function get() {\n return this.len;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function (e) {\n return 0 === t.comparator(this, e);\n }, t.prototype.child = function (e) {\n var n = this.segments.slice(this.offset, this.limit());\n return e instanceof t ? e.forEach(function (t) {\n n.push(t);\n }) : n.push(e), this.construct(n);\n },\n /** The index of one past the last segment of the path. */\n t.prototype.limit = function () {\n return this.offset + this.length;\n }, t.prototype.popFirst = function (t) {\n return t = void 0 === t ? 1 : t, this.construct(this.segments, this.offset + t, this.length - t);\n }, t.prototype.popLast = function () {\n return this.construct(this.segments, this.offset, this.length - 1);\n }, t.prototype.firstSegment = function () {\n return this.segments[this.offset];\n }, t.prototype.lastSegment = function () {\n return this.get(this.length - 1);\n }, t.prototype.get = function (t) {\n return this.segments[this.offset + t];\n }, t.prototype.isEmpty = function () {\n return 0 === this.length;\n }, t.prototype.isPrefixOf = function (t) {\n if (t.length < this.length) return !1;\n\n for (var e = 0; e < this.length; e++) {\n if (this.get(e) !== t.get(e)) return !1;\n }\n\n return !0;\n }, t.prototype.isImmediateParentOf = function (t) {\n if (this.length + 1 !== t.length) return !1;\n\n for (var e = 0; e < this.length; e++) {\n if (this.get(e) !== t.get(e)) return !1;\n }\n\n return !0;\n }, t.prototype.forEach = function (t) {\n for (var e = this.offset, n = this.limit(); e < n; e++) {\n t(this.segments[e]);\n }\n }, t.prototype.toArray = function () {\n return this.segments.slice(this.offset, this.limit());\n }, t.comparator = function (t, e) {\n for (var n = Math.min(t.length, e.length), r = 0; r < n; r++) {\n var i = t.get(r),\n o = e.get(r);\n if (i < o) return -1;\n if (i > o) return 1;\n }\n\n return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;\n }, t;\n}(),\n H =\n/** @class */\nfunction (e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n\n return t(n, e), n.prototype.construct = function (t, e, r) {\n return new n(t, e, r);\n }, n.prototype.canonicalString = function () {\n // NOTE: The client is ignorant of any path segments containing escape\n // sequences (e.g. __id123__) and just passes them through raw (they exist\n // for legacy reasons and should not be used frequently).\n return this.toArray().join(\"/\");\n }, n.prototype.toString = function () {\n return this.canonicalString();\n },\n /**\n * Creates a resource path from the given slash-delimited string. If multiple\n * arguments are provided, all components are combined. Leading and trailing\n * slashes from all components are ignored.\n */\n n.fromString = function () {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n } // NOTE: The client is ignorant of any path segments containing escape\n // sequences (e.g. __id123__) and just passes them through raw (they exist\n // for legacy reasons and should not be used frequently).\n\n\n for (var r = [], i = 0, o = t; i < o.length; i++) {\n var s = o[i];\n if (s.indexOf(\"//\") >= 0) throw new D(N.INVALID_ARGUMENT, \"Invalid segment (\" + s + \"). Paths must not contain // in them.\"); // Strip leading and traling slashed.\n\n r.push.apply(r, s.split(\"/\").filter(function (t) {\n return t.length > 0;\n }));\n }\n\n return new n(r);\n }, n.emptyPath = function () {\n return new n([]);\n }, n;\n}(W),\n Y = /^[_a-zA-Z][_a-zA-Z0-9]*$/,\n $ =\n/** @class */\nfunction (e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n\n return t(n, e), n.prototype.construct = function (t, e, r) {\n return new n(t, e, r);\n },\n /**\n * Returns true if the string could be used as a segment in a field path\n * without escaping.\n */\n n.isValidIdentifier = function (t) {\n return Y.test(t);\n }, n.prototype.canonicalString = function () {\n return this.toArray().map(function (t) {\n return t = t.replace(/\\\\/g, \"\\\\\\\\\").replace(/`/g, \"\\\\`\"), n.isValidIdentifier(t) || (t = \"`\" + t + \"`\"), t;\n }).join(\".\");\n }, n.prototype.toString = function () {\n return this.canonicalString();\n },\n /**\n * Returns true if this field references the key of a document.\n */\n n.prototype.isKeyField = function () {\n return 1 === this.length && \"__name__\" === this.get(0);\n },\n /**\n * The field designating the key of a document.\n */\n n.keyField = function () {\n return new n([\"__name__\"]);\n },\n /**\n * Parses a field string from the given server-formatted string.\n *\n * - Splitting the empty string is not allowed (for now at least).\n * - Empty segments within the string (e.g. if there are two consecutive\n * separators) are not allowed.\n *\n * TODO(b/37244157): we should make this more strict. Right now, it allows\n * non-identifier path components, even if they aren't escaped.\n */\n n.fromServerFormat = function (t) {\n for (var e = [], r = \"\", i = 0, o = function o() {\n if (0 === r.length) throw new D(N.INVALID_ARGUMENT, \"Invalid field path (\" + t + \"). Paths must not be empty, begin with '.', end with '.', or contain '..'\");\n e.push(r), r = \"\";\n }, s = !1; i < t.length;) {\n var u = t[i];\n\n if (\"\\\\\" === u) {\n if (i + 1 === t.length) throw new D(N.INVALID_ARGUMENT, \"Path has trailing escape character: \" + t);\n var a = t[i + 1];\n if (\"\\\\\" !== a && \".\" !== a && \"`\" !== a) throw new D(N.INVALID_ARGUMENT, \"Path has invalid escape sequence: \" + t);\n r += a, i += 2;\n } else \"`\" === u ? (s = !s, i++) : \".\" !== u || s ? (r += u, i++) : (o(), i++);\n }\n\n if (o(), s) throw new D(N.INVALID_ARGUMENT, \"Unterminated ` in path: \" + t);\n return new n(e);\n }, n.emptyPath = function () {\n return new n([]);\n }, n;\n}(W),\n X =\n/** @class */\nfunction () {\n function t(t) {\n this.fields = t, // TODO(dimond): validation of FieldMask\n // Sort the field mask to support `FieldMask.isEqual()` and assert below.\n t.sort($.comparator)\n /**\n * Verifies that `fieldPath` is included by at least one field in this field\n * mask.\n *\n * This is an O(n) operation, where `n` is the size of the field mask.\n */\n ;\n }\n\n return t.prototype.covers = function (t) {\n for (var e = 0, n = this.fields; e < n.length; e++) {\n if (n[e].isPrefixOf(t)) return !0;\n }\n\n return !1;\n }, t.prototype.isEqual = function (t) {\n return U(this.fields, t.fields, function (t, e) {\n return t.isEqual(e);\n });\n }, t;\n}(),\n J =\n/** @class */\nfunction () {\n function t(t) {\n this.binaryString = t;\n }\n\n return t.fromBase64String = function (e) {\n return new t(atob(e));\n }, t.fromUint8Array = function (e) {\n return new t(\n /**\n * Helper function to convert an Uint8array to a binary string.\n */\n function (t) {\n for (var e = \"\", n = 0; n < t.length; ++n) {\n e += String.fromCharCode(t[n]);\n }\n\n return e;\n }(e));\n }, t.prototype.toBase64 = function () {\n return t = this.binaryString, btoa(t);\n /** Converts a binary string to a Base64 encoded string. */\n\n var t;\n /** True if and only if the Base64 conversion functions are available. */\n }, t.prototype.toUint8Array = function () {\n return function (t) {\n for (var e = new Uint8Array(t.length), n = 0; n < t.length; n++) {\n e[n] = t.charCodeAt(n);\n }\n\n return e;\n }(this.binaryString);\n }, t.prototype.approximateByteSize = function () {\n return 2 * this.binaryString.length;\n }, t.prototype.compareTo = function (t) {\n return q(this.binaryString, t.binaryString);\n }, t.prototype.isEqual = function (t) {\n return this.binaryString === t.binaryString;\n }, t;\n}();\n/**\n * A slash-separated path for navigating resources (documents and collections)\n * within Firestore.\n */\n\n\nJ.EMPTY_BYTE_STRING = new J(\"\");\nvar Z = new RegExp(/^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.(\\d+))?Z$/);\n/**\n * Converts the possible Proto values for a timestamp value into a \"seconds and\n * nanos\" representation.\n */\n\nfunction tt(t) {\n // The json interface (for the browser) will return an iso timestamp string,\n // while the proto js library (for node) will return a\n // google.protobuf.Timestamp instance.\n if (P(!!t), \"string\" == typeof t) {\n // The date string can have higher precision (nanos) than the Date class\n // (millis), so we do some custom parsing here.\n // Parse the nanos right out of the string.\n var e = 0,\n n = Z.exec(t);\n\n if (P(!!n), n[1]) {\n // Pad the fraction out to 9 digits (nanos).\n var r = n[1];\n r = (r + \"000000000\").substr(0, 9), e = Number(r);\n } // Parse the date to get the seconds.\n\n\n var i = new Date(t);\n return {\n seconds: Math.floor(i.getTime() / 1e3),\n nanos: e\n };\n }\n\n return {\n seconds: et(t.seconds),\n nanos: et(t.nanos)\n };\n}\n/**\n * Converts the possible Proto types for numbers into a JavaScript number.\n * Returns 0 if the value is not numeric.\n */\n\n\nfunction et(t) {\n // TODO(bjornick): Handle int64 greater than 53 bits.\n return \"number\" == typeof t ? t : \"string\" == typeof t ? Number(t) : 0;\n}\n/** Converts the possible Proto types for Blobs into a ByteString. */\n\n\nfunction nt(t) {\n return \"string\" == typeof t ? J.fromBase64String(t) : J.fromUint8Array(t);\n}\n/**\n * @license\n * Copyright 2020 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 * Represents a locally-applied ServerTimestamp.\n *\n * Server Timestamps are backed by MapValues that contain an internal field\n * `__type__` with a value of `server_timestamp`. The previous value and local\n * write time are stored in its `__previous_value__` and `__local_write_time__`\n * fields respectively.\n *\n * Notes:\n * - ServerTimestampValue instances are created as the result of applying a\n * transform. They can only exist in the local view of a document. Therefore\n * they do not need to be parsed or serialized.\n * - When evaluated locally (e.g. for snapshot.data()), they by default\n * evaluate to `null`. This behavior can be configured by passing custom\n * FieldValueOptions to value().\n * - With respect to other ServerTimestampValues, they sort by their\n * localWriteTime.\n */\n\n\nfunction rt(t) {\n var e, n;\n return \"server_timestamp\" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);\n}\n/**\n * Creates a new ServerTimestamp proto value (using the internal format).\n */\n\n/**\n * Returns the value of the field before this ServerTimestamp was set.\n *\n * Preserving the previous values allows the user to display the last resoled\n * value until the backend responds with the timestamp.\n */\n\n\nfunction it(t) {\n var e = t.mapValue.fields.__previous_value__;\n return rt(e) ? it(e) : e;\n}\n/**\n * Returns the local time at which this timestamp was first set.\n */\n\n\nfunction ot(t) {\n var e = tt(t.mapValue.fields.__local_write_time__.timestampValue);\n return new j(e.seconds, e.nanos);\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/** Sentinel value that sorts before any Mutation Batch ID. */\n\n/**\n * Returns whether a variable is either undefined or null.\n */\n\n\nfunction st(t) {\n return null == t;\n}\n/** Returns whether the value represents -0. */\n\n\nfunction ut(t) {\n // Detect if the value is -0.0. Based on polyfill from\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n return 0 === t && 1 / t == -1 / 0;\n}\n/**\n * Returns whether a value is an integer and in the safe integer range\n * @param value - The value to test for being an integer and in the safe range\n */\n\n\nfunction at(t) {\n return \"number\" == typeof t && Number.isInteger(t) && !ut(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;\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\nvar ct =\n/** @class */\nfunction () {\n function t(t) {\n this.path = t;\n }\n\n return t.fromPath = function (e) {\n return new t(H.fromString(e));\n }, t.fromName = function (e) {\n return new t(H.fromString(e).popFirst(5));\n },\n /** Returns true if the document is in the specified collectionId. */\n t.prototype.hasCollectionId = function (t) {\n return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;\n }, t.prototype.isEqual = function (t) {\n return null !== t && 0 === H.comparator(this.path, t.path);\n }, t.prototype.toString = function () {\n return this.path.toString();\n }, t.comparator = function (t, e) {\n return H.comparator(t.path, e.path);\n }, t.isDocumentKey = function (t) {\n return t.length % 2 == 0;\n },\n /**\n * Creates and returns a new document key with the given segments.\n *\n * @param segments - The segments of the path to the document\n * @returns A new instance of DocumentKey\n */\n t.fromSegments = function (e) {\n return new t(new H(e.slice()));\n }, t;\n}();\n/**\n * @license\n * Copyright 2020 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/** Extracts the backend's type order for the provided value. */\n\n\nfunction ht(t) {\n return \"nullValue\" in t ? 0\n /* NullValue */\n : \"booleanValue\" in t ? 1\n /* BooleanValue */\n : \"integerValue\" in t || \"doubleValue\" in t ? 2\n /* NumberValue */\n : \"timestampValue\" in t ? 3\n /* TimestampValue */\n : \"stringValue\" in t ? 5\n /* StringValue */\n : \"bytesValue\" in t ? 6\n /* BlobValue */\n : \"referenceValue\" in t ? 7\n /* RefValue */\n : \"geoPointValue\" in t ? 8\n /* GeoPointValue */\n : \"arrayValue\" in t ? 9\n /* ArrayValue */\n : \"mapValue\" in t ? rt(t) ? 4\n /* ServerTimestampValue */\n : 10\n /* ObjectValue */\n : O();\n}\n/** Tests `left` and `right` for equality based on the backend semantics. */\n\n\nfunction ft(t, e) {\n var n = ht(t);\n if (n !== ht(e)) return !1;\n\n switch (n) {\n case 0\n /* NullValue */\n :\n return !0;\n\n case 1\n /* BooleanValue */\n :\n return t.booleanValue === e.booleanValue;\n\n case 4\n /* ServerTimestampValue */\n :\n return ot(t).isEqual(ot(e));\n\n case 3\n /* TimestampValue */\n :\n return function (t, e) {\n if (\"string\" == typeof t.timestampValue && \"string\" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length) // Use string equality for ISO 8601 timestamps\n return t.timestampValue === e.timestampValue;\n var n = tt(t.timestampValue),\n r = tt(e.timestampValue);\n return n.seconds === r.seconds && n.nanos === r.nanos;\n }(t, e);\n\n case 5\n /* StringValue */\n :\n return t.stringValue === e.stringValue;\n\n case 6\n /* BlobValue */\n :\n return function (t, e) {\n return nt(t.bytesValue).isEqual(nt(e.bytesValue));\n }(t, e);\n\n case 7\n /* RefValue */\n :\n return t.referenceValue === e.referenceValue;\n\n case 8\n /* GeoPointValue */\n :\n return function (t, e) {\n return et(t.geoPointValue.latitude) === et(e.geoPointValue.latitude) && et(t.geoPointValue.longitude) === et(e.geoPointValue.longitude);\n }(t, e);\n\n case 2\n /* NumberValue */\n :\n return function (t, e) {\n if (\"integerValue\" in t && \"integerValue\" in e) return et(t.integerValue) === et(e.integerValue);\n\n if (\"doubleValue\" in t && \"doubleValue\" in e) {\n var n = et(t.doubleValue),\n r = et(e.doubleValue);\n return n === r ? ut(n) === ut(r) : isNaN(n) && isNaN(r);\n }\n\n return !1;\n }(t, e);\n\n case 9\n /* ArrayValue */\n :\n return U(t.arrayValue.values || [], e.arrayValue.values || [], ft);\n\n case 10\n /* ObjectValue */\n :\n return function (t, e) {\n var n = t.mapValue.fields || {},\n r = e.mapValue.fields || {};\n if (Q(n) !== Q(r)) return !1;\n\n for (var i in n) {\n if (n.hasOwnProperty(i) && (void 0 === r[i] || !ft(n[i], r[i]))) return !1;\n }\n\n return !0;\n }(t, e);\n\n default:\n return O();\n }\n}\n\nfunction lt(t, e) {\n return void 0 !== (t.values || []).find(function (t) {\n return ft(t, e);\n });\n}\n\nfunction dt(t, e) {\n var n = ht(t),\n r = ht(e);\n if (n !== r) return q(n, r);\n\n switch (n) {\n case 0\n /* NullValue */\n :\n return 0;\n\n case 1\n /* BooleanValue */\n :\n return q(t.booleanValue, e.booleanValue);\n\n case 2\n /* NumberValue */\n :\n return function (t, e) {\n var n = et(t.integerValue || t.doubleValue),\n r = et(e.integerValue || e.doubleValue);\n return n < r ? -1 : n > r ? 1 : n === r ? 0 : // one or both are NaN.\n isNaN(n) ? isNaN(r) ? 0 : -1 : 1;\n }(t, e);\n\n case 3\n /* TimestampValue */\n :\n return pt(t.timestampValue, e.timestampValue);\n\n case 4\n /* ServerTimestampValue */\n :\n return pt(ot(t), ot(e));\n\n case 5\n /* StringValue */\n :\n return q(t.stringValue, e.stringValue);\n\n case 6\n /* BlobValue */\n :\n return function (t, e) {\n var n = nt(t),\n r = nt(e);\n return n.compareTo(r);\n }(t.bytesValue, e.bytesValue);\n\n case 7\n /* RefValue */\n :\n return function (t, e) {\n for (var n = t.split(\"/\"), r = e.split(\"/\"), i = 0; i < n.length && i < r.length; i++) {\n var o = q(n[i], r[i]);\n if (0 !== o) return o;\n }\n\n return q(n.length, r.length);\n }(t.referenceValue, e.referenceValue);\n\n case 8\n /* GeoPointValue */\n :\n return function (t, e) {\n var n = q(et(t.latitude), et(e.latitude));\n return 0 !== n ? n : q(et(t.longitude), et(e.longitude));\n }(t.geoPointValue, e.geoPointValue);\n\n case 9\n /* ArrayValue */\n :\n return function (t, e) {\n for (var n = t.values || [], r = e.values || [], i = 0; i < n.length && i < r.length; ++i) {\n var o = dt(n[i], r[i]);\n if (o) return o;\n }\n\n return q(n.length, r.length);\n }(t.arrayValue, e.arrayValue);\n\n case 10\n /* ObjectValue */\n :\n return function (t, e) {\n var n = t.fields || {},\n r = Object.keys(n),\n i = e.fields || {},\n o = Object.keys(i); // Even though MapValues are likely sorted correctly based on their insertion\n // order (e.g. when received from the backend), local modifications can bring\n // elements out of order. We need to re-sort the elements to ensure that\n // canonical IDs are independent of insertion order.\n\n r.sort(), o.sort();\n\n for (var s = 0; s < r.length && s < o.length; ++s) {\n var u = q(r[s], o[s]);\n if (0 !== u) return u;\n var a = dt(n[r[s]], i[o[s]]);\n if (0 !== a) return a;\n }\n\n return q(r.length, o.length);\n }(t.mapValue, e.mapValue);\n\n default:\n throw O();\n }\n}\n\nfunction pt(t, e) {\n if (\"string\" == typeof t && \"string\" == typeof e && t.length === e.length) return q(t, e);\n var n = tt(t),\n r = tt(e),\n i = q(n.seconds, r.seconds);\n return 0 !== i ? i : q(n.nanos, r.nanos);\n}\n\nfunction yt(t) {\n return vt(t);\n}\n\nfunction vt(t) {\n return \"nullValue\" in t ? \"null\" : \"booleanValue\" in t ? \"\" + t.booleanValue : \"integerValue\" in t ? \"\" + t.integerValue : \"doubleValue\" in t ? \"\" + t.doubleValue : \"timestampValue\" in t ? function (t) {\n var e = tt(t);\n return \"time(\" + e.seconds + \",\" + e.nanos + \")\";\n }(t.timestampValue) : \"stringValue\" in t ? t.stringValue : \"bytesValue\" in t ? nt(t.bytesValue).toBase64() : \"referenceValue\" in t ? (n = t.referenceValue, ct.fromName(n).toString()) : \"geoPointValue\" in t ? \"geo(\" + (e = t.geoPointValue).latitude + \",\" + e.longitude + \")\" : \"arrayValue\" in t ? function (t) {\n for (var e = \"[\", n = !0, r = 0, i = t.values || []; r < i.length; r++) {\n n ? n = !1 : e += \",\", e += vt(i[r]);\n }\n\n return e + \"]\";\n }(t.arrayValue) : \"mapValue\" in t ? function (t) {\n for ( // Iteration order in JavaScript is not guaranteed. To ensure that we generate\n // matching canonical IDs for identical maps, we need to sort the keys.\n var e = \"{\", n = !0, r = 0, i = Object.keys(t.fields || {}).sort(); r < i.length; r++) {\n var o = i[r];\n n ? n = !1 : e += \",\", e += o + \":\" + vt(t.fields[o]);\n }\n\n return e + \"}\";\n }(t.mapValue) : O();\n var e, n;\n}\n\nfunction mt(t, e) {\n return {\n referenceValue: \"projects/\" + t.projectId + \"/databases/\" + t.database + \"/documents/\" + e.path.canonicalString()\n };\n}\n/** Returns true if `value` is an IntegerValue . */\n\n\nfunction gt(t) {\n return !!t && \"integerValue\" in t;\n}\n/** Returns true if `value` is a DoubleValue. */\n\n/** Returns true if `value` is an ArrayValue. */\n\n\nfunction wt(t) {\n return !!t && \"arrayValue\" in t;\n}\n/** Returns true if `value` is a NullValue. */\n\n\nfunction bt(t) {\n return !!t && \"nullValue\" in t;\n}\n/** Returns true if `value` is NaN. */\n\n\nfunction It(t) {\n return !!t && \"doubleValue\" in t && isNaN(Number(t.doubleValue));\n}\n/** Returns true if `value` is a MapValue. */\n\n\nfunction Tt(t) {\n return !!t && \"mapValue\" in t;\n}\n/** Creates a deep copy of `source`. */\n\n\nfunction Et(t) {\n if (t.geoPointValue) return {\n geoPointValue: Object.assign({}, t.geoPointValue)\n };\n if (t.timestampValue && \"object\" == typeof t.timestampValue) return {\n timestampValue: Object.assign({}, t.timestampValue)\n };\n\n if (t.mapValue) {\n var e = {\n mapValue: {\n fields: {}\n }\n };\n return G(t.mapValue.fields, function (t, n) {\n return e.mapValue.fields[t] = Et(n);\n }), e;\n }\n\n if (t.arrayValue) {\n for (var n = {\n arrayValue: {\n values: []\n }\n }, r = 0; r < (t.arrayValue.values || []).length; ++r) {\n n.arrayValue.values[r] = Et(t.arrayValue.values[r]);\n }\n\n return n;\n }\n\n return Object.assign({}, t);\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/**\n * An ObjectValue represents a MapValue in the Firestore Proto and offers the\n * ability to add and remove fields (via the ObjectValueBuilder).\n */\n\n\nvar _t =\n/** @class */\nfunction () {\n function t(t) {\n this.value = t;\n }\n\n return t.empty = function () {\n return new t({\n mapValue: {}\n });\n },\n /**\n * Returns the value at the given path or null.\n *\n * @param path - the path to search\n * @returns The value at the path or null if the path is not set.\n */\n t.prototype.field = function (t) {\n if (t.isEmpty()) return this.value;\n\n for (var e = this.value, n = 0; n < t.length - 1; ++n) {\n if (!Tt(e = (e.mapValue.fields || {})[t.get(n)])) return null;\n }\n\n return (e = (e.mapValue.fields || {})[t.lastSegment()]) || null;\n },\n /**\n * Sets the field to the provided value.\n *\n * @param path - The field path to set.\n * @param value - The value to set.\n */\n t.prototype.set = function (t, e) {\n this.getFieldsMap(t.popLast())[t.lastSegment()] = Et(e);\n },\n /**\n * Sets the provided fields to the provided values.\n *\n * @param data - A map of fields to values (or null for deletes).\n */\n t.prototype.setAll = function (t) {\n var e = this,\n n = $.emptyPath(),\n r = {},\n i = [];\n t.forEach(function (t, o) {\n if (!n.isImmediateParentOf(o)) {\n // Insert the accumulated changes at this parent location\n var s = e.getFieldsMap(n);\n e.applyChanges(s, r, i), r = {}, i = [], n = o.popLast();\n }\n\n t ? r[o.lastSegment()] = Et(t) : i.push(o.lastSegment());\n });\n var o = this.getFieldsMap(n);\n this.applyChanges(o, r, i);\n },\n /**\n * Removes the field at the specified path. If there is no field at the\n * specified path, nothing is changed.\n *\n * @param path - The field path to remove.\n */\n t.prototype.delete = function (t) {\n var e = this.field(t.popLast());\n Tt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];\n }, t.prototype.isEqual = function (t) {\n return ft(this.value, t.value);\n },\n /**\n * Returns the map that contains the leaf element of `path`. If the parent\n * entry does not yet exist, or if it is not a map, a new map will be created.\n */\n t.prototype.getFieldsMap = function (t) {\n var e = this.value;\n e.mapValue.fields || (e.mapValue = {\n fields: {}\n });\n\n for (var n = 0; n < t.length; ++n) {\n var r = e.mapValue.fields[t.get(n)];\n Tt(r) && r.mapValue.fields || (r = {\n mapValue: {\n fields: {}\n }\n }, e.mapValue.fields[t.get(n)] = r), e = r;\n }\n\n return e.mapValue.fields;\n },\n /**\n * Modifies `fieldsMap` by adding, replacing or deleting the specified\n * entries.\n */\n t.prototype.applyChanges = function (t, e, n) {\n G(e, function (e, n) {\n return t[e] = n;\n });\n\n for (var r = 0, i = n; r < i.length; r++) {\n var o = i[r];\n delete t[o];\n }\n }, t.prototype.clone = function () {\n return new t(Et(this.value));\n }, t;\n}();\n/**\n * Returns a FieldMask built from all fields in a MapValue.\n */\n\n\nfunction St(t) {\n var e = [];\n return G(t.fields, function (t, n) {\n var r = new $([t]);\n\n if (Tt(n)) {\n var i = St(n.mapValue).fields;\n if (0 === i.length) // Preserve the empty map by adding it to the FieldMask.\n e.push(r);else // For nested and non-empty ObjectValues, add the FieldPath of the\n // leaf nodes.\n for (var o = 0, s = i; o < s.length; o++) {\n var u = s[o];\n e.push(r.child(u));\n }\n } else // For nested and non-empty ObjectValues, add the FieldPath of the leaf\n // nodes.\n e.push(r);\n }), new X(e)\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 * Represents a document in Firestore with a key, version, data and whether it\n * has local mutations applied to it.\n *\n * Documents can transition between states via `convertToFoundDocument()`,\n * `convertToNoDocument()` and `convertToUnknownDocument()`. If a document does\n * not transition to one of these states even after all mutations have been\n * applied, `isValidDocument()` returns false and the document should be removed\n * from all views.\n */\n ;\n}\n\nvar Nt =\n/** @class */\nfunction () {\n function t(t, e, n, r, i) {\n this.key = t, this.documentType = e, this.version = n, this.data = r, this.documentState = i\n /**\n * Creates a document with no known version or data, but which can serve as\n * base document for mutations.\n */\n ;\n }\n\n return t.newInvalidDocument = function (e) {\n return new t(e, 0\n /* INVALID */\n , K.min(), _t.empty(), 0\n /* SYNCED */\n );\n },\n /**\n * Creates a new document that is known to exist with the given data at the\n * given version.\n */\n t.newFoundDocument = function (e, n, r) {\n return new t(e, 1\n /* FOUND_DOCUMENT */\n , n, r, 0\n /* SYNCED */\n );\n },\n /** Creates a new document that is known to not exist at the given version. */\n t.newNoDocument = function (e, n) {\n return new t(e, 2\n /* NO_DOCUMENT */\n , n, _t.empty(), 0\n /* SYNCED */\n );\n },\n /**\n * Creates a new document that is known to exist at the given version but\n * whose data is not known (e.g. a document that was updated without a known\n * base document).\n */\n t.newUnknownDocument = function (e, n) {\n return new t(e, 3\n /* UNKNOWN_DOCUMENT */\n , n, _t.empty(), 2\n /* HAS_COMMITTED_MUTATIONS */\n );\n },\n /**\n * Changes the document type to indicate that it exists and that its version\n * and data are known.\n */\n t.prototype.convertToFoundDocument = function (t, e) {\n return this.version = t, this.documentType = 1\n /* FOUND_DOCUMENT */\n , this.data = e, this.documentState = 0\n /* SYNCED */\n , this;\n },\n /**\n * Changes the document type to indicate that it doesn't exist at the given\n * version.\n */\n t.prototype.convertToNoDocument = function (t) {\n return this.version = t, this.documentType = 2\n /* NO_DOCUMENT */\n , this.data = _t.empty(), this.documentState = 0\n /* SYNCED */\n , this;\n },\n /**\n * Changes the document type to indicate that it exists at a given version but\n * that its data is not known (e.g. a document that was updated without a known\n * base document).\n */\n t.prototype.convertToUnknownDocument = function (t) {\n return this.version = t, this.documentType = 3\n /* UNKNOWN_DOCUMENT */\n , this.data = _t.empty(), this.documentState = 2\n /* HAS_COMMITTED_MUTATIONS */\n , this;\n }, t.prototype.setHasCommittedMutations = function () {\n return this.documentState = 2\n /* HAS_COMMITTED_MUTATIONS */\n , this;\n }, t.prototype.setHasLocalMutations = function () {\n return this.documentState = 1\n /* HAS_LOCAL_MUTATIONS */\n , this;\n }, Object.defineProperty(t.prototype, \"hasLocalMutations\", {\n get: function get() {\n return 1\n /* HAS_LOCAL_MUTATIONS */\n === this.documentState;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"hasCommittedMutations\", {\n get: function get() {\n return 2\n /* HAS_COMMITTED_MUTATIONS */\n === this.documentState;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"hasPendingWrites\", {\n get: function get() {\n return this.hasLocalMutations || this.hasCommittedMutations;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isValidDocument = function () {\n return 0\n /* INVALID */\n !== this.documentType;\n }, t.prototype.isFoundDocument = function () {\n return 1\n /* FOUND_DOCUMENT */\n === this.documentType;\n }, t.prototype.isNoDocument = function () {\n return 2\n /* NO_DOCUMENT */\n === this.documentType;\n }, t.prototype.isUnknownDocument = function () {\n return 3\n /* UNKNOWN_DOCUMENT */\n === this.documentType;\n }, t.prototype.isEqual = function (e) {\n return e instanceof t && this.key.isEqual(e.key) && this.version.isEqual(e.version) && this.documentType === e.documentType && this.documentState === e.documentState && this.data.isEqual(e.data);\n }, t.prototype.clone = function () {\n return new t(this.key, this.documentType, this.version, this.data.clone(), this.documentState);\n }, t.prototype.toString = function () {\n return \"Document(\" + this.key + \", \" + this.version + \", \" + JSON.stringify(this.data.value) + \", {documentType: \" + this.documentType + \"}), {documentState: \" + this.documentState + \"})\";\n }, t;\n}(),\n Dt = function Dt(t, e, n, r, i, o, s) {\n void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), void 0 === i && (i = null), void 0 === o && (o = null), void 0 === s && (s = null), this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i, this.startAt = o, this.endAt = s, this.h = null;\n};\n/**\n * Compares the value for field `field` in the provided documents. Throws if\n * the field does not exist in both documents.\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// Visible for testing\n\n/**\n * Initializes a Target with a path and optional additional query constraints.\n * Path must currently be empty if this is a collection group query.\n *\n * NOTE: you should always construct `Target` from `Query.toTarget` instead of\n * using this factory method, because `Query` provides an implicit `orderBy`\n * property.\n */\n\n\nfunction At(t, e, n, r, i, o, s) {\n return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), void 0 === i && (i = null), void 0 === o && (o = null), void 0 === s && (s = null), new Dt(t, e, n, r, i, o, s);\n}\n\nfunction kt(t) {\n var e = F(t);\n\n if (null === e.h) {\n var n = e.path.canonicalString();\n null !== e.collectionGroup && (n += \"|cg:\" + e.collectionGroup), n += \"|f:\", n += e.filters.map(function (t) {\n return function (t) {\n // TODO(b/29183165): Technically, this won't be unique if two values have\n // the same description, such as the int 3 and the string \"3\". So we should\n // add the types in here somehow, too.\n return t.field.canonicalString() + t.op.toString() + yt(t.value);\n }(t);\n }).join(\",\"), n += \"|ob:\", n += e.orderBy.map(function (t) {\n return function (t) {\n // TODO(b/29183165): Make this collision robust.\n return t.field.canonicalString() + t.dir;\n }(t);\n }).join(\",\"), st(e.limit) || (n += \"|l:\", n += e.limit), e.startAt && (n += \"|lb:\", n += jt(e.startAt)), e.endAt && (n += \"|ub:\", n += jt(e.endAt)), e.h = n;\n }\n\n return e.h;\n}\n\nfunction Ct(t, e) {\n if (t.limit !== e.limit) return !1;\n if (t.orderBy.length !== e.orderBy.length) return !1;\n\n for (var n = 0; n < t.orderBy.length; n++) {\n if (!Qt(t.orderBy[n], e.orderBy[n])) return !1;\n }\n\n if (t.filters.length !== e.filters.length) return !1;\n\n for (var r = 0; r < t.filters.length; r++) {\n if (i = t.filters[r], o = e.filters[r], i.op !== o.op || !i.field.isEqual(o.field) || !ft(i.value, o.value)) return !1;\n }\n\n var i, o;\n return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!zt(t.startAt, e.startAt) && zt(t.endAt, e.endAt);\n}\n\nfunction xt(t) {\n return ct.isDocumentKey(t.path) && null === t.collectionGroup && 0 === t.filters.length;\n}\n\nvar Rt =\n/** @class */\nfunction (e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;\n }\n /**\n * Creates a filter based on the provided arguments.\n */\n\n\n return t(n, e), n.create = function (t, e, r) {\n return t.isKeyField() ? \"in\"\n /* IN */\n === e || \"not-in\"\n /* NOT_IN */\n === e ? this.l(t, e, r) : new Lt(t, e, r) : \"array-contains\"\n /* ARRAY_CONTAINS */\n === e ? new Mt(t, r) : \"in\"\n /* IN */\n === e ? new Vt(t, r) : \"not-in\"\n /* NOT_IN */\n === e ? new qt(t, r) : \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n === e ? new Ut(t, r) : new n(t, e, r);\n }, n.l = function (t, e, n) {\n return \"in\"\n /* IN */\n === e ? new Ot(t, n) : new Pt(t, n);\n }, n.prototype.matches = function (t) {\n var e = t.data.field(this.field); // Types do not have to match in NOT_EQUAL filters.\n\n return \"!=\"\n /* NOT_EQUAL */\n === this.op ? null !== e && this.m(dt(e, this.value)) : null !== e && ht(this.value) === ht(e) && this.m(dt(e, this.value)); // Only compare types with matching backend order (such as double and int).\n }, n.prototype.m = function (t) {\n switch (this.op) {\n case \"<\"\n /* LESS_THAN */\n :\n return t < 0;\n\n case \"<=\"\n /* LESS_THAN_OR_EQUAL */\n :\n return t <= 0;\n\n case \"==\"\n /* EQUAL */\n :\n return 0 === t;\n\n case \"!=\"\n /* NOT_EQUAL */\n :\n return 0 !== t;\n\n case \">\"\n /* GREATER_THAN */\n :\n return t > 0;\n\n case \">=\"\n /* GREATER_THAN_OR_EQUAL */\n :\n return t >= 0;\n\n default:\n return O();\n }\n }, n.prototype.g = function () {\n return [\"<\"\n /* LESS_THAN */\n , \"<=\"\n /* LESS_THAN_OR_EQUAL */\n , \">\"\n /* GREATER_THAN */\n , \">=\"\n /* GREATER_THAN_OR_EQUAL */\n , \"!=\"\n /* NOT_EQUAL */\n , \"not-in\"\n /* NOT_IN */\n ].indexOf(this.op) >= 0;\n }, n;\n}(function () {});\n\nvar Lt =\n/** @class */\nfunction (e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this, t, n, r) || this).key = ct.fromName(r.referenceValue), i;\n }\n\n return t(n, e), n.prototype.matches = function (t) {\n var e = ct.comparator(t.key, this.key);\n return this.m(e);\n }, n;\n}(Rt),\n Ot =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t, \"in\"\n /* IN */\n , n) || this).keys = Ft(\"in\"\n /* IN */\n , n), r;\n }\n\n return t(n, e), n.prototype.matches = function (t) {\n return this.keys.some(function (e) {\n return e.isEqual(t.key);\n });\n }, n;\n}(Rt),\n Pt =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t, \"not-in\"\n /* NOT_IN */\n , n) || this).keys = Ft(\"not-in\"\n /* NOT_IN */\n , n), r;\n }\n\n return t(n, e), n.prototype.matches = function (t) {\n return !this.keys.some(function (e) {\n return e.isEqual(t.key);\n });\n }, n;\n}(Rt);\n/** Filter that matches on key fields within an array. */\n\n\nfunction Ft(t, e) {\n var n;\n return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map(function (t) {\n return ct.fromName(t.referenceValue);\n });\n}\n/** A Filter that implements the array-contains operator. */\n\n\nvar Mt =\n/** @class */\nfunction (e) {\n function n(t, n) {\n return e.call(this, t, \"array-contains\"\n /* ARRAY_CONTAINS */\n , n) || this;\n }\n\n return t(n, e), n.prototype.matches = function (t) {\n var e = t.data.field(this.field);\n return wt(e) && lt(e.arrayValue, this.value);\n }, n;\n}(Rt),\n Vt =\n/** @class */\nfunction (e) {\n function n(t, n) {\n return e.call(this, t, \"in\"\n /* IN */\n , n) || this;\n }\n\n return t(n, e), n.prototype.matches = function (t) {\n var e = t.data.field(this.field);\n return null !== e && lt(this.value.arrayValue, e);\n }, n;\n}(Rt),\n qt =\n/** @class */\nfunction (e) {\n function n(t, n) {\n return e.call(this, t, \"not-in\"\n /* NOT_IN */\n , n) || this;\n }\n\n return t(n, e), n.prototype.matches = function (t) {\n if (lt(this.value.arrayValue, {\n nullValue: \"NULL_VALUE\"\n })) return !1;\n var e = t.data.field(this.field);\n return null !== e && !lt(this.value.arrayValue, e);\n }, n;\n}(Rt),\n Ut =\n/** @class */\nfunction (e) {\n function n(t, n) {\n return e.call(this, t, \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n , n) || this;\n }\n\n return t(n, e), n.prototype.matches = function (t) {\n var e = this,\n n = t.data.field(this.field);\n return !(!wt(n) || !n.arrayValue.values) && n.arrayValue.values.some(function (t) {\n return lt(e.value.arrayValue, t);\n });\n }, n;\n}(Rt),\n Bt = function Bt(t, e) {\n this.position = t, this.before = e;\n};\n/** A Filter that implements the IN operator. */\n\n\nfunction jt(t) {\n // TODO(b/29183165): Make this collision robust.\n return (t.before ? \"b\" : \"a\") + \":\" + t.position.map(function (t) {\n return yt(t);\n }).join(\",\");\n}\n/**\n * An ordering on a field, in some Direction. Direction defaults to ASCENDING.\n */\n\n\nvar Kt = function Kt(t, e\n/* ASCENDING */\n) {\n void 0 === e && (e = \"asc\"), this.field = t, this.dir = e;\n};\n\nfunction Qt(t, e) {\n return t.dir === e.dir && t.field.isEqual(e.field);\n}\n/**\n * Returns true if a document sorts before a bound using the provided sort\n * order.\n */\n\n\nfunction Gt(t, e, n) {\n for (var r = 0, i = 0; i < t.position.length; i++) {\n var o = e[i],\n s = t.position[i];\n if (r = o.field.isKeyField() ? ct.comparator(ct.fromName(s.referenceValue), n.key) : dt(s, n.data.field(o.field)), \"desc\"\n /* DESCENDING */\n === o.dir && (r *= -1), 0 !== r) break;\n }\n\n return t.before ? r <= 0 : r < 0;\n}\n\nfunction zt(t, e) {\n if (null === t) return null === e;\n if (null === e) return !1;\n if (t.before !== e.before || t.position.length !== e.position.length) return !1;\n\n for (var n = 0; n < t.position.length; n++) {\n if (!ft(t.position[n], e.position[n])) return !1;\n }\n\n return !0;\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/**\n * Query encapsulates all the query attributes we support in the SDK. It can\n * be run against the LocalStore, as well as be converted to a `Target` to\n * query the RemoteStore results.\n *\n * Visible for testing.\n */\n\n\nvar Wt =\n/**\n * Initializes a Query with a path and optional additional query constraints.\n * Path must currently be empty if this is a collection group query.\n */\nfunction Wt(t, e, n, r, i, o\n/* First */\n, s, u) {\n void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), void 0 === i && (i = null), void 0 === o && (o = \"F\"), void 0 === s && (s = null), void 0 === u && (u = null), this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = r, this.limit = i, this.limitType = o, this.startAt = s, this.endAt = u, this.p = null, // The corresponding `Target` of this `Query` instance.\n this.T = null, this.startAt, this.endAt;\n};\n/** Creates a new Query instance with the options provided. */\n\n\nfunction Ht(t, e, n, r, i, o, s, u) {\n return new Wt(t, e, n, r, i, o, s, u);\n}\n/** Creates a new Query for a query that matches all documents at `path` */\n\n\nfunction Yt(t) {\n return new Wt(t);\n}\n/**\n * Helper to convert a collection group query into a collection query at a\n * specific path. This is used when executing collection group queries, since\n * we have to split the query into a set of collection queries at multiple\n * paths.\n */\n\n\nfunction $t(t) {\n return !st(t.limit) && \"F\"\n /* First */\n === t.limitType;\n}\n\nfunction Xt(t) {\n return !st(t.limit) && \"L\"\n /* Last */\n === t.limitType;\n}\n\nfunction Jt(t) {\n return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;\n}\n\nfunction Zt(t) {\n for (var e = 0, n = t.filters; e < n.length; e++) {\n var r = n[e];\n if (r.g()) return r.field;\n }\n\n return null;\n}\n/**\n * Checks if any of the provided Operators are included in the query and\n * returns the first one that is, or null if none are.\n */\n\n/**\n * Returns whether the query matches a collection group rather than a specific\n * collection.\n */\n\n\nfunction te(t) {\n return null !== t.collectionGroup;\n}\n/**\n * Returns the implicit order by constraint that is used to execute the Query,\n * which can be different from the order by constraints the user provided (e.g.\n * the SDK and backend always orders by `__name__`).\n */\n\n\nfunction ee(t) {\n var e = F(t);\n\n if (null === e.p) {\n e.p = [];\n var n = Zt(e),\n r = Jt(e);\n if (null !== n && null === r) // In order to implicitly add key ordering, we must also add the\n // inequality filter field for it to be a valid query.\n // Note that the default inequality field and key ordering is ascending.\n n.isKeyField() || e.p.push(new Kt(n)), e.p.push(new Kt($.keyField(), \"asc\"\n /* ASCENDING */\n ));else {\n for (var i = !1, o = 0, s = e.explicitOrderBy; o < s.length; o++) {\n var u = s[o];\n e.p.push(u), u.field.isKeyField() && (i = !0);\n }\n\n if (!i) {\n // The order of the implicit key ordering always matches the last\n // explicit order by\n var a = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : \"asc\"\n /* ASCENDING */\n ;\n e.p.push(new Kt($.keyField(), a));\n }\n }\n }\n\n return e.p;\n}\n/**\n * Converts this `Query` instance to it's corresponding `Target` representation.\n */\n\n\nfunction ne(t) {\n var e = F(t);\n if (!e.T) if (\"F\"\n /* First */\n === e.limitType) e.T = At(e.path, e.collectionGroup, ee(e), e.filters, e.limit, e.startAt, e.endAt);else {\n for ( // Flip the orderBy directions since we want the last results\n var n = [], r = 0, i = ee(e); r < i.length; r++) {\n var o = i[r],\n s = \"desc\"\n /* DESCENDING */\n === o.dir ? \"asc\"\n /* ASCENDING */\n : \"desc\"\n /* DESCENDING */\n ;\n n.push(new Kt(o.field, s));\n } // We need to swap the cursors to match the now-flipped query ordering.\n\n\n var u = e.endAt ? new Bt(e.endAt.position, !e.endAt.before) : null,\n a = e.startAt ? new Bt(e.startAt.position, !e.startAt.before) : null; // Now return as a LimitType.First query.\n\n e.T = At(e.path, e.collectionGroup, n, e.filters, e.limit, u, a);\n }\n return e.T;\n}\n\nfunction re(t, e, n) {\n return new Wt(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);\n}\n\nfunction ie(t, e) {\n return Ct(ne(t), ne(e)) && t.limitType === e.limitType;\n} // TODO(b/29183165): This is used to get a unique string from a query to, for\n// example, use as a dictionary key, but the implementation is subject to\n// collisions. Make it collision-free.\n\n\nfunction oe(t) {\n return kt(ne(t)) + \"|lt:\" + t.limitType;\n}\n\nfunction se(t) {\n return \"Query(target=\" + function (t) {\n var e = t.path.canonicalString();\n return null !== t.collectionGroup && (e += \" collectionGroup=\" + t.collectionGroup), t.filters.length > 0 && (e += \", filters: [\" + t.filters.map(function (t) {\n return (e = t).field.canonicalString() + \" \" + e.op + \" \" + yt(e.value);\n /** Returns a debug description for `filter`. */\n\n var e;\n /** Filter that matches on key fields (i.e. '__name__'). */\n }).join(\", \") + \"]\"), st(t.limit) || (e += \", limit: \" + t.limit), t.orderBy.length > 0 && (e += \", orderBy: [\" + t.orderBy.map(function (t) {\n return function (t) {\n return t.field.canonicalString() + \" (\" + t.dir + \")\";\n }(t);\n }).join(\", \") + \"]\"), t.startAt && (e += \", startAt: \" + jt(t.startAt)), t.endAt && (e += \", endAt: \" + jt(t.endAt)), \"Target(\" + e + \")\";\n }(ne(t)) + \"; limitType=\" + t.limitType + \")\";\n}\n/** Returns whether `doc` matches the constraints of `query`. */\n\n\nfunction ue(t, e) {\n return e.isFoundDocument() && function (t, e) {\n var n = e.key.path;\n return null !== t.collectionGroup ? e.key.hasCollectionId(t.collectionGroup) && t.path.isPrefixOf(n) : ct.isDocumentKey(t.path) ? t.path.isEqual(n) : t.path.isImmediateParentOf(n);\n }(t, e) && function (t, e) {\n for (var n = 0, r = t.explicitOrderBy; n < r.length; n++) {\n var i = r[n]; // order by key always matches\n\n if (!i.field.isKeyField() && null === e.data.field(i.field)) return !1;\n }\n\n return !0;\n }(t, e) && function (t, e) {\n for (var n = 0, r = t.filters; n < r.length; n++) {\n if (!r[n].matches(e)) return !1;\n }\n\n return !0;\n }(t, e) && function (t, e) {\n return !(t.startAt && !Gt(t.startAt, ee(t), e)) && (!t.endAt || !Gt(t.endAt, ee(t), e));\n }(t, e);\n}\n\nfunction ae(t) {\n return function (e, n) {\n for (var r = !1, i = 0, o = ee(t); i < o.length; i++) {\n var s = o[i],\n u = ce(s, e, n);\n if (0 !== u) return u;\n r = r || s.field.isKeyField();\n }\n\n return 0;\n };\n}\n\nfunction ce(t, e, n) {\n var r = t.field.isKeyField() ? ct.comparator(e.key, n.key) : function (t, e, n) {\n var r = e.data.field(t),\n i = n.data.field(t);\n return null !== r && null !== i ? dt(r, i) : O();\n }(t.field, e, n);\n\n switch (t.dir) {\n case \"asc\"\n /* ASCENDING */\n :\n return r;\n\n case \"desc\"\n /* DESCENDING */\n :\n return -1 * r;\n\n default:\n return O();\n }\n}\n/**\n * @license\n * Copyright 2020 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 * Returns an DoubleValue for `value` that is encoded based the serializer's\n * `useProto3Json` setting.\n */\n\n\nfunction he(t, e) {\n if (t.I) {\n if (isNaN(e)) return {\n doubleValue: \"NaN\"\n };\n if (e === 1 / 0) return {\n doubleValue: \"Infinity\"\n };\n if (e === -1 / 0) return {\n doubleValue: \"-Infinity\"\n };\n }\n\n return {\n doubleValue: ut(e) ? \"-0\" : e\n };\n}\n/**\n * Returns an IntegerValue for `value`.\n */\n\n\nfunction fe(t) {\n return {\n integerValue: \"\" + t\n };\n}\n/**\n * Returns a value for a number that's appropriate to put into a proto.\n * The return value is an IntegerValue if it can safely represent the value,\n * otherwise a DoubleValue is returned.\n */\n\n\nfunction le(t, e) {\n return at(e) ? fe(e) : he(t, e);\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\n/** Used to represent a field transform on a mutation. */\n\n\nvar de = function de() {\n // Make sure that the structural type of `TransformOperation` is unique.\n // See https://github.com/microsoft/TypeScript/issues/5451\n this._ = void 0;\n};\n/**\n * Computes the local transform result against the provided `previousValue`,\n * optionally using the provided localWriteTime.\n */\n\n\nfunction pe(t, e, n) {\n return t instanceof me ? function (t, e) {\n var n = {\n fields: {\n __type__: {\n stringValue: \"server_timestamp\"\n },\n __local_write_time__: {\n timestampValue: {\n seconds: t.seconds,\n nanos: t.nanoseconds\n }\n }\n }\n };\n return e && (n.fields.__previous_value__ = e), {\n mapValue: n\n };\n }(n, e) : t instanceof ge ? we(t, e) : t instanceof be ? Ie(t, e) : function (t, e) {\n // PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit\n // precision and resolves overflows by reducing precision, we do not\n // manually cap overflows at 2^63.\n var n = ve(t, e),\n r = Ee(n) + Ee(t.A);\n return gt(n) && gt(t.A) ? fe(r) : he(t.R, r);\n }(t, e);\n}\n/**\n * Computes a final transform result after the transform has been acknowledged\n * by the server, potentially using the server-provided transformResult.\n */\n\n\nfunction ye(t, e, n) {\n // The server just sends null as the transform result for array operations,\n // so we have to calculate a result the same as we do for local\n // applications.\n return t instanceof ge ? we(t, e) : t instanceof be ? Ie(t, e) : n;\n}\n/**\n * If this transform operation is not idempotent, returns the base value to\n * persist for this transform. If a base value is returned, the transform\n * operation is always applied to this base value, even if document has\n * already been updated.\n *\n * Base values provide consistent behavior for non-idempotent transforms and\n * allow us to return the same latency-compensated value even if the backend\n * has already applied the transform operation. The base value is null for\n * idempotent transforms, as they can be re-played even if the backend has\n * already applied them.\n *\n * @returns a base value to store along with the mutation, or null for\n * idempotent transforms.\n */\n\n\nfunction ve(t, e) {\n return t instanceof Te ? gt(n = e) || function (t) {\n return !!t && \"doubleValue\" in t;\n }(n) ? e : {\n integerValue: 0\n } : null;\n var n;\n}\n/** Transforms a value into a server-generated timestamp. */\n\n\nvar me =\n/** @class */\nfunction (e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n\n return t(n, e), n;\n}(de),\n ge =\n/** @class */\nfunction (e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).elements = t, n;\n }\n\n return t(n, e), n;\n}(de);\n/** Transforms an array value via a union operation. */\n\n\nfunction we(t, e) {\n for (var n = _e(e), r = function r(t) {\n n.some(function (e) {\n return ft(e, t);\n }) || n.push(t);\n }, i = 0, o = t.elements; i < o.length; i++) {\n r(o[i]);\n }\n\n return {\n arrayValue: {\n values: n\n }\n };\n}\n/** Transforms an array value via a remove operation. */\n\n\nvar be =\n/** @class */\nfunction (e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).elements = t, n;\n }\n\n return t(n, e), n;\n}(de);\n\nfunction Ie(t, e) {\n for (var n = _e(e), r = function r(t) {\n n = n.filter(function (e) {\n return !ft(e, t);\n });\n }, i = 0, o = t.elements; i < o.length; i++) {\n r(o[i]);\n }\n\n return {\n arrayValue: {\n values: n\n }\n };\n}\n/**\n * Implements the backend semantics for locally computed NUMERIC_ADD (increment)\n * transforms. Converts all field values to integers or doubles, but unlike the\n * backend does not cap integer values at 2^63. Instead, JavaScript number\n * arithmetic is used and precision loss can occur for values greater than 2^53.\n */\n\n\nvar Te =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).R = t, r.A = n, r;\n }\n\n return t(n, e), n;\n}(de);\n\nfunction Ee(t) {\n return et(t.integerValue || t.doubleValue);\n}\n\nfunction _e(t) {\n return wt(t) && t.arrayValue.values ? t.arrayValue.values.slice() : [];\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/** A field path and the TransformOperation to perform upon it. */\n\n\nvar Se = function Se(t, e) {\n this.field = t, this.transform = e;\n};\n/** The result of successfully applying a mutation to the backend. */\n\n\nvar Ne = function Ne(\n/**\n * The version at which the mutation was committed:\n *\n * - For most operations, this is the updateTime in the WriteResult.\n * - For deletes, the commitTime of the WriteResponse (because deletes are\n * not stored and have no updateTime).\n *\n * Note that these versions can be different: No-op writes will not change\n * the updateTime even though the commitTime advances.\n */\nt,\n/**\n * The resulting fields returned from the backend after a mutation\n * containing field transforms has been committed. Contains one FieldValue\n * for each FieldTransform that was in the mutation.\n *\n * Will be empty if the mutation did not contain any field transforms.\n */\ne) {\n this.version = t, this.transformResults = e;\n},\n De =\n/** @class */\nfunction () {\n function t(t, e) {\n this.updateTime = t, this.exists = e\n /** Creates a new empty Precondition. */\n ;\n }\n\n return t.none = function () {\n return new t();\n },\n /** Creates a new Precondition with an exists flag. */\n t.exists = function (e) {\n return new t(void 0, e);\n },\n /** Creates a new Precondition based on a version a document exists at. */\n t.updateTime = function (e) {\n return new t(e);\n }, Object.defineProperty(t.prototype, \"isNone\", {\n /** Returns whether this Precondition is empty. */\n get: function get() {\n return void 0 === this.updateTime && void 0 === this.exists;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function (t) {\n return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);\n }, t;\n}();\n/**\n * Encodes a precondition for a mutation. This follows the model that the\n * backend accepts with the special case of an explicit \"empty\" precondition\n * (meaning no precondition).\n */\n\n/** Returns true if the preconditions is valid for the given document. */\n\n\nfunction Ae(t, e) {\n return void 0 !== t.updateTime ? e.isFoundDocument() && e.version.isEqual(t.updateTime) : void 0 === t.exists || t.exists === e.isFoundDocument();\n}\n/**\n * A mutation describes a self-contained change to a document. Mutations can\n * create, replace, delete, and update subsets of documents.\n *\n * Mutations not only act on the value of the document but also its version.\n *\n * For local mutations (mutations that haven't been committed yet), we preserve\n * the existing version for Set and Patch mutations. For Delete mutations, we\n * reset the version to 0.\n *\n * Here's the expected transition table.\n *\n * MUTATION APPLIED TO RESULTS IN\n *\n * SetMutation Document(v3) Document(v3)\n * SetMutation NoDocument(v3) Document(v0)\n * SetMutation InvalidDocument(v0) Document(v0)\n * PatchMutation Document(v3) Document(v3)\n * PatchMutation NoDocument(v3) NoDocument(v3)\n * PatchMutation InvalidDocument(v0) UnknownDocument(v3)\n * DeleteMutation Document(v3) NoDocument(v0)\n * DeleteMutation NoDocument(v3) NoDocument(v0)\n * DeleteMutation InvalidDocument(v0) NoDocument(v0)\n *\n * For acknowledged mutations, we use the updateTime of the WriteResponse as\n * the resulting version for Set and Patch mutations. As deletes have no\n * explicit update time, we use the commitTime of the WriteResponse for\n * Delete mutations.\n *\n * If a mutation is acknowledged by the backend but fails the precondition check\n * locally, we transition to an `UnknownDocument` and rely on Watch to send us\n * the updated version.\n *\n * Field transforms are used only with Patch and Set Mutations. We use the\n * `updateTransforms` message to store transforms, rather than the `transforms`s\n * messages.\n *\n * ## Subclassing Notes\n *\n * Every type of mutation needs to implement its own applyToRemoteDocument() and\n * applyToLocalView() to implement the actual behavior of applying the mutation\n * to some source document (see `applySetMutationToRemoteDocument()` for an\n * example).\n */\n\n\nvar ke = function ke() {};\n/**\n * Applies this mutation to the given document for the purposes of computing a\n * new remote document. If the input document doesn't match the expected state\n * (e.g. it is invalid or outdated), the document type may transition to\n * unknown.\n *\n * @param mutation - The mutation to apply.\n * @param document - The document to mutate. The input document can be an\n * invalid document if the client has no knowledge of the pre-mutation state\n * of the document.\n * @param mutationResult - The result of applying the mutation from the backend.\n */\n\n\nfunction Ce(t, e, n) {\n t instanceof Pe ? function (t, e, n) {\n // Unlike applySetMutationToLocalView, if we're applying a mutation to a\n // remote document the server has accepted the mutation so the precondition\n // must have held.\n var r = t.value.clone(),\n i = Ve(t.fieldTransforms, e, n.transformResults);\n r.setAll(i), e.convertToFoundDocument(n.version, r).setHasCommittedMutations();\n }(t, e, n) : t instanceof Fe ? function (t, e, n) {\n if (Ae(t.precondition, e)) {\n var r = Ve(t.fieldTransforms, e, n.transformResults),\n i = e.data;\n i.setAll(Me(t)), i.setAll(r), e.convertToFoundDocument(n.version, i).setHasCommittedMutations();\n } else e.convertToUnknownDocument(n.version);\n }(t, e, n) : function (t, e, n) {\n // Unlike applyToLocalView, if we're applying a mutation to a remote\n // document the server has accepted the mutation so the precondition must\n // have held.\n e.convertToNoDocument(n.version).setHasCommittedMutations();\n }(0, e, n);\n}\n/**\n * Applies this mutation to the given document for the purposes of computing\n * the new local view of a document. If the input document doesn't match the\n * expected state, the document is not modified.\n *\n * @param mutation - The mutation to apply.\n * @param document - The document to mutate. The input document can be an\n * invalid document if the client has no knowledge of the pre-mutation state\n * of the document.\n * @param localWriteTime - A timestamp indicating the local write time of the\n * batch this mutation is a part of.\n */\n\n\nfunction xe(t, e, n) {\n t instanceof Pe ? function (t, e, n) {\n if (Ae(t.precondition, e)) {\n var r = t.value.clone(),\n i = qe(t.fieldTransforms, n, e);\n r.setAll(i), e.convertToFoundDocument(Oe(e), r).setHasLocalMutations();\n }\n }(t, e, n) : t instanceof Fe ? function (t, e, n) {\n if (Ae(t.precondition, e)) {\n var r = qe(t.fieldTransforms, n, e),\n i = e.data;\n i.setAll(Me(t)), i.setAll(r), e.convertToFoundDocument(Oe(e), i).setHasLocalMutations();\n }\n }(t, e, n) : function (t, e) {\n Ae(t.precondition, e) && // We don't call `setHasLocalMutations()` since we want to be backwards\n // compatible with the existing SDK behavior.\n e.convertToNoDocument(K.min());\n }(t, e);\n}\n/**\n * If this mutation is not idempotent, returns the base value to persist with\n * this mutation. If a base value is returned, the mutation is always applied\n * to this base value, even if document has already been updated.\n *\n * The base value is a sparse object that consists of only the document\n * fields for which this mutation contains a non-idempotent transformation\n * (e.g. a numeric increment). The provided value guarantees consistent\n * behavior for non-idempotent transforms and allow us to return the same\n * latency-compensated value even if the backend has already applied the\n * mutation. The base value is null for idempotent mutations, as they can be\n * re-played even if the backend has already applied them.\n *\n * @returns a base value to store along with the mutation, or null for\n * idempotent mutations.\n */\n\n\nfunction Re(t, e) {\n for (var n = null, r = 0, i = t.fieldTransforms; r < i.length; r++) {\n var o = i[r],\n s = e.data.field(o.field),\n u = ve(o.transform, s || null);\n null != u && (null == n && (n = _t.empty()), n.set(o.field, u));\n }\n\n return n || null;\n}\n\nfunction Le(t, e) {\n return t.type === e.type && !!t.key.isEqual(e.key) && !!t.precondition.isEqual(e.precondition) && !!function (t, e) {\n return void 0 === t && void 0 === e || !(!t || !e) && U(t, e, function (t, e) {\n return function (t, e) {\n return t.field.isEqual(e.field) && function (t, e) {\n return t instanceof ge && e instanceof ge || t instanceof be && e instanceof be ? U(t.elements, e.elements, ft) : t instanceof Te && e instanceof Te ? ft(t.A, e.A) : t instanceof me && e instanceof me;\n }(t.transform, e.transform);\n }(t, e);\n });\n }(t.fieldTransforms, e.fieldTransforms) && (0\n /* Set */\n === t.type ? t.value.isEqual(e.value) : 1\n /* Patch */\n !== t.type || t.data.isEqual(e.data) && t.fieldMask.isEqual(e.fieldMask));\n}\n/**\n * Returns the version from the given document for use as the result of a\n * mutation. Mutations are defined to return the version of the base document\n * only if it is an existing document. Deleted and unknown documents have a\n * post-mutation version of SnapshotVersion.min().\n */\n\n\nfunction Oe(t) {\n return t.isFoundDocument() ? t.version : K.min();\n}\n/**\n * A mutation that creates or replaces the document at the given key with the\n * object value contents.\n */\n\n\nvar Pe =\n/** @class */\nfunction (e) {\n function n(t, n, r, i) {\n void 0 === i && (i = []);\n var o = this;\n return (o = e.call(this) || this).key = t, o.value = n, o.precondition = r, o.fieldTransforms = i, o.type = 0\n /* Set */\n , o;\n }\n\n return t(n, e), n;\n}(ke),\n Fe =\n/** @class */\nfunction (e) {\n function n(t, n, r, i, o) {\n void 0 === o && (o = []);\n var s = this;\n return (s = e.call(this) || this).key = t, s.data = n, s.fieldMask = r, s.precondition = i, s.fieldTransforms = o, s.type = 1\n /* Patch */\n , s;\n }\n\n return t(n, e), n;\n}(ke);\n\nfunction Me(t) {\n var e = new Map();\n return t.fieldMask.fields.forEach(function (n) {\n if (!n.isEmpty()) {\n var r = t.data.field(n);\n e.set(n, r);\n }\n }), e\n /**\n * Creates a list of \"transform results\" (a transform result is a field value\n * representing the result of applying a transform) for use after a mutation\n * containing transforms has been acknowledged by the server.\n *\n * @param fieldTransforms - The field transforms to apply the result to.\n * @param mutableDocument - The current state of the document after applying all\n * previous mutations.\n * @param serverTransformResults - The transform results received by the server.\n * @returns The transform results list.\n */\n ;\n}\n\nfunction Ve(t, e, n) {\n var r = new Map();\n P(t.length === n.length);\n\n for (var i = 0; i < n.length; i++) {\n var o = t[i],\n s = o.transform,\n u = e.data.field(o.field);\n r.set(o.field, ye(s, u, n[i]));\n }\n\n return r;\n}\n/**\n * Creates a list of \"transform results\" (a transform result is a field value\n * representing the result of applying a transform) for use when applying a\n * transform locally.\n *\n * @param fieldTransforms - The field transforms to apply the result to.\n * @param localWriteTime - The local time of the mutation (used to\n * generate ServerTimestampValues).\n * @param mutableDocument - The current state of the document after applying all\n * previous mutations.\n * @returns The transform results list.\n */\n\n\nfunction qe(t, e, n) {\n for (var r = new Map(), i = 0, o = t; i < o.length; i++) {\n var s = o[i],\n u = s.transform,\n a = n.data.field(s.field);\n r.set(s.field, pe(u, a, e));\n }\n\n return r;\n}\n/** A mutation that deletes the document at the given key. */\n\n\nvar Ue,\n Be,\n je =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2\n /* Delete */\n , r.fieldTransforms = [], r;\n }\n\n return t(n, e), n;\n}(ke),\n Ke =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 3\n /* Verify */\n , r.fieldTransforms = [], r;\n }\n\n return t(n, e), n;\n}(ke),\n Qe = // TODO(b/33078163): just use simplest form of existence filter for now\nfunction Qe(t) {\n this.count = t;\n};\n/**\n * Determines whether an error code represents a permanent error when received\n * in response to a non-write operation.\n *\n * See isPermanentWriteError for classifying write errors.\n */\n\n\nfunction Ge(t) {\n switch (t) {\n case N.OK:\n return O();\n\n case N.CANCELLED:\n case N.UNKNOWN:\n case N.DEADLINE_EXCEEDED:\n case N.RESOURCE_EXHAUSTED:\n case N.INTERNAL:\n case N.UNAVAILABLE: // Unauthenticated means something went wrong with our token and we need\n // to retry with new credentials which will happen automatically.\n\n case N.UNAUTHENTICATED:\n return !1;\n\n case N.INVALID_ARGUMENT:\n case N.NOT_FOUND:\n case N.ALREADY_EXISTS:\n case N.PERMISSION_DENIED:\n case N.FAILED_PRECONDITION: // Aborted might be retried in some scenarios, but that is dependant on\n // the context and should handled individually by the calling code.\n // See https://cloud.google.com/apis/design/errors.\n\n case N.ABORTED:\n case N.OUT_OF_RANGE:\n case N.UNIMPLEMENTED:\n case N.DATA_LOSS:\n return !0;\n\n default:\n return O();\n }\n}\n/**\n * Determines whether an error code represents a permanent error when received\n * in response to a write operation.\n *\n * Write operations must be handled specially because as of b/119437764, ABORTED\n * errors on the write stream should be retried too (even though ABORTED errors\n * are not generally retryable).\n *\n * Note that during the initial handshake on the write stream an ABORTED error\n * signals that we should discard our stream token (i.e. it is permanent). This\n * means a handshake error should be classified with isPermanentError, above.\n */\n\n/**\n * Maps an error Code from GRPC status code number, like 0, 1, or 14. These\n * are not the same as HTTP status codes.\n *\n * @returns The Code equivalent to the given GRPC status code. Fails if there\n * is no match.\n */\n\n\nfunction ze(t) {\n if (void 0 === t) // This shouldn't normally happen, but in certain error cases (like trying\n // to send invalid proto messages) we may get an error with no GRPC code.\n return x(\"GRPC error has no .code\"), N.UNKNOWN;\n\n switch (t) {\n case Ue.OK:\n return N.OK;\n\n case Ue.CANCELLED:\n return N.CANCELLED;\n\n case Ue.UNKNOWN:\n return N.UNKNOWN;\n\n case Ue.DEADLINE_EXCEEDED:\n return N.DEADLINE_EXCEEDED;\n\n case Ue.RESOURCE_EXHAUSTED:\n return N.RESOURCE_EXHAUSTED;\n\n case Ue.INTERNAL:\n return N.INTERNAL;\n\n case Ue.UNAVAILABLE:\n return N.UNAVAILABLE;\n\n case Ue.UNAUTHENTICATED:\n return N.UNAUTHENTICATED;\n\n case Ue.INVALID_ARGUMENT:\n return N.INVALID_ARGUMENT;\n\n case Ue.NOT_FOUND:\n return N.NOT_FOUND;\n\n case Ue.ALREADY_EXISTS:\n return N.ALREADY_EXISTS;\n\n case Ue.PERMISSION_DENIED:\n return N.PERMISSION_DENIED;\n\n case Ue.FAILED_PRECONDITION:\n return N.FAILED_PRECONDITION;\n\n case Ue.ABORTED:\n return N.ABORTED;\n\n case Ue.OUT_OF_RANGE:\n return N.OUT_OF_RANGE;\n\n case Ue.UNIMPLEMENTED:\n return N.UNIMPLEMENTED;\n\n case Ue.DATA_LOSS:\n return N.DATA_LOSS;\n\n default:\n return O();\n }\n}\n/**\n * Converts an HTTP response's error status to the equivalent error code.\n *\n * @param status - An HTTP error response status (\"FAILED_PRECONDITION\",\n * \"UNKNOWN\", etc.)\n * @returns The equivalent Code. Non-matching responses are mapped to\n * Code.UNKNOWN.\n */\n\n\n(Be = Ue || (Ue = {}))[Be.OK = 0] = \"OK\", Be[Be.CANCELLED = 1] = \"CANCELLED\", Be[Be.UNKNOWN = 2] = \"UNKNOWN\", Be[Be.INVALID_ARGUMENT = 3] = \"INVALID_ARGUMENT\", Be[Be.DEADLINE_EXCEEDED = 4] = \"DEADLINE_EXCEEDED\", Be[Be.NOT_FOUND = 5] = \"NOT_FOUND\", Be[Be.ALREADY_EXISTS = 6] = \"ALREADY_EXISTS\", Be[Be.PERMISSION_DENIED = 7] = \"PERMISSION_DENIED\", Be[Be.UNAUTHENTICATED = 16] = \"UNAUTHENTICATED\", Be[Be.RESOURCE_EXHAUSTED = 8] = \"RESOURCE_EXHAUSTED\", Be[Be.FAILED_PRECONDITION = 9] = \"FAILED_PRECONDITION\", Be[Be.ABORTED = 10] = \"ABORTED\", Be[Be.OUT_OF_RANGE = 11] = \"OUT_OF_RANGE\", Be[Be.UNIMPLEMENTED = 12] = \"UNIMPLEMENTED\", Be[Be.INTERNAL = 13] = \"INTERNAL\", Be[Be.UNAVAILABLE = 14] = \"UNAVAILABLE\", Be[Be.DATA_LOSS = 15] = \"DATA_LOSS\";\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// An immutable sorted map implementation, based on a Left-leaning Red-Black\n// tree.\n\nvar We =\n/** @class */\nfunction () {\n function t(t, e) {\n this.comparator = t, this.root = e || Ye.EMPTY;\n } // Returns a copy of the map, with the specified key/value added or replaced.\n\n\n return t.prototype.insert = function (e, n) {\n return new t(this.comparator, this.root.insert(e, n, this.comparator).copy(null, null, Ye.BLACK, null, null));\n }, // Returns a copy of the map, with the specified key removed.\n t.prototype.remove = function (e) {\n return new t(this.comparator, this.root.remove(e, this.comparator).copy(null, null, Ye.BLACK, null, null));\n }, // Returns the value of the node with the given key, or null.\n t.prototype.get = function (t) {\n for (var e = this.root; !e.isEmpty();) {\n var n = this.comparator(t, e.key);\n if (0 === n) return e.value;\n n < 0 ? e = e.left : n > 0 && (e = e.right);\n }\n\n return null;\n }, // Returns the index of the element in this sorted map, or -1 if it doesn't\n // exist.\n t.prototype.indexOf = function (t) {\n for ( // Number of nodes that were pruned when descending right\n var e = 0, n = this.root; !n.isEmpty();) {\n var r = this.comparator(t, n.key);\n if (0 === r) return e + n.left.size;\n r < 0 ? n = n.left : ( // Count all nodes left of the node plus the node itself\n e += n.left.size + 1, n = n.right);\n } // Node not found\n\n\n return -1;\n }, t.prototype.isEmpty = function () {\n return this.root.isEmpty();\n }, Object.defineProperty(t.prototype, \"size\", {\n // Returns the total number of nodes in the map.\n get: function get() {\n return this.root.size;\n },\n enumerable: !1,\n configurable: !0\n }), // Returns the minimum key in the map.\n t.prototype.minKey = function () {\n return this.root.minKey();\n }, // Returns the maximum key in the map.\n t.prototype.maxKey = function () {\n return this.root.maxKey();\n }, // Traverses the map in key order and calls the specified action function\n // for each key/value pair. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n t.prototype.inorderTraversal = function (t) {\n return this.root.inorderTraversal(t);\n }, t.prototype.forEach = function (t) {\n this.inorderTraversal(function (e, n) {\n return t(e, n), !1;\n });\n }, t.prototype.toString = function () {\n var t = [];\n return this.inorderTraversal(function (e, n) {\n return t.push(e + \":\" + n), !1;\n }), \"{\" + t.join(\", \") + \"}\";\n }, // Traverses the map in reverse key order and calls the specified action\n // function for each key/value pair. If action returns true, traversal is\n // aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n t.prototype.reverseTraversal = function (t) {\n return this.root.reverseTraversal(t);\n }, // Returns an iterator over the SortedMap.\n t.prototype.getIterator = function () {\n return new He(this.root, null, this.comparator, !1);\n }, t.prototype.getIteratorFrom = function (t) {\n return new He(this.root, t, this.comparator, !1);\n }, t.prototype.getReverseIterator = function () {\n return new He(this.root, null, this.comparator, !0);\n }, t.prototype.getReverseIteratorFrom = function (t) {\n return new He(this.root, t, this.comparator, !0);\n }, t;\n}(),\n He =\n/** @class */\nfunction () {\n function t(t, e, n, r) {\n this.isReverse = r, this.nodeStack = [];\n\n for (var i = 1; !t.isEmpty();) {\n if (i = e ? n(t.key, e) : 1, // flip the comparison if we're going in reverse\n r && (i *= -1), i < 0) // This node is less than our start key. ignore it\n t = this.isReverse ? t.left : t.right;else {\n if (0 === i) {\n // This node is exactly equal to our start key. Push it on the stack,\n // but stop iterating;\n this.nodeStack.push(t);\n break;\n } // This node is greater than our start key, add it to the stack and move\n // to the next one\n\n\n this.nodeStack.push(t), t = this.isReverse ? t.right : t.left;\n }\n }\n }\n\n return t.prototype.getNext = function () {\n var t = this.nodeStack.pop(),\n e = {\n key: t.key,\n value: t.value\n };\n if (this.isReverse) for (t = t.left; !t.isEmpty();) {\n this.nodeStack.push(t), t = t.right;\n } else for (t = t.right; !t.isEmpty();) {\n this.nodeStack.push(t), t = t.left;\n }\n return e;\n }, t.prototype.hasNext = function () {\n return this.nodeStack.length > 0;\n }, t.prototype.peek = function () {\n if (0 === this.nodeStack.length) return null;\n var t = this.nodeStack[this.nodeStack.length - 1];\n return {\n key: t.key,\n value: t.value\n };\n }, t;\n}(),\n Ye =\n/** @class */\nfunction () {\n function t(e, n, r, i, o) {\n this.key = e, this.value = n, this.color = null != r ? r : t.RED, this.left = null != i ? i : t.EMPTY, this.right = null != o ? o : t.EMPTY, this.size = this.left.size + 1 + this.right.size;\n } // Returns a copy of the current node, optionally replacing pieces of it.\n\n\n return t.prototype.copy = function (e, n, r, i, o) {\n return new t(null != e ? e : this.key, null != n ? n : this.value, null != r ? r : this.color, null != i ? i : this.left, null != o ? o : this.right);\n }, t.prototype.isEmpty = function () {\n return !1;\n }, // Traverses the tree in key order and calls the specified action function\n // for each node. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n t.prototype.inorderTraversal = function (t) {\n return this.left.inorderTraversal(t) || t(this.key, this.value) || this.right.inorderTraversal(t);\n }, // Traverses the tree in reverse key order and calls the specified action\n // function for each node. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n t.prototype.reverseTraversal = function (t) {\n return this.right.reverseTraversal(t) || t(this.key, this.value) || this.left.reverseTraversal(t);\n }, // Returns the minimum node in the tree.\n t.prototype.min = function () {\n return this.left.isEmpty() ? this : this.left.min();\n }, // Returns the maximum key in the tree.\n t.prototype.minKey = function () {\n return this.min().key;\n }, // Returns the maximum key in the tree.\n t.prototype.maxKey = function () {\n return this.right.isEmpty() ? this.key : this.right.maxKey();\n }, // Returns new tree, with the key/value added.\n t.prototype.insert = function (t, e, n) {\n var r = this,\n i = n(t, r.key);\n return (r = i < 0 ? r.copy(null, null, null, r.left.insert(t, e, n), null) : 0 === i ? r.copy(null, e, null, null, null) : r.copy(null, null, null, null, r.right.insert(t, e, n))).fixUp();\n }, t.prototype.removeMin = function () {\n if (this.left.isEmpty()) return t.EMPTY;\n var e = this;\n return e.left.isRed() || e.left.left.isRed() || (e = e.moveRedLeft()), (e = e.copy(null, null, null, e.left.removeMin(), null)).fixUp();\n }, // Returns new tree, with the specified item removed.\n t.prototype.remove = function (e, n) {\n var r,\n i = this;\n if (n(e, i.key) < 0) i.left.isEmpty() || i.left.isRed() || i.left.left.isRed() || (i = i.moveRedLeft()), i = i.copy(null, null, null, i.left.remove(e, n), null);else {\n if (i.left.isRed() && (i = i.rotateRight()), i.right.isEmpty() || i.right.isRed() || i.right.left.isRed() || (i = i.moveRedRight()), 0 === n(e, i.key)) {\n if (i.right.isEmpty()) return t.EMPTY;\n r = i.right.min(), i = i.copy(r.key, r.value, null, null, i.right.removeMin());\n }\n\n i = i.copy(null, null, null, null, i.right.remove(e, n));\n }\n return i.fixUp();\n }, t.prototype.isRed = function () {\n return this.color;\n }, // Returns new tree after performing any needed rotations.\n t.prototype.fixUp = function () {\n var t = this;\n return t.right.isRed() && !t.left.isRed() && (t = t.rotateLeft()), t.left.isRed() && t.left.left.isRed() && (t = t.rotateRight()), t.left.isRed() && t.right.isRed() && (t = t.colorFlip()), t;\n }, t.prototype.moveRedLeft = function () {\n var t = this.colorFlip();\n return t.right.left.isRed() && (t = (t = (t = t.copy(null, null, null, null, t.right.rotateRight())).rotateLeft()).colorFlip()), t;\n }, t.prototype.moveRedRight = function () {\n var t = this.colorFlip();\n return t.left.left.isRed() && (t = (t = t.rotateRight()).colorFlip()), t;\n }, t.prototype.rotateLeft = function () {\n var e = this.copy(null, null, t.RED, null, this.right.left);\n return this.right.copy(null, null, this.color, e, null);\n }, t.prototype.rotateRight = function () {\n var e = this.copy(null, null, t.RED, this.left.right, null);\n return this.left.copy(null, null, this.color, null, e);\n }, t.prototype.colorFlip = function () {\n var t = this.left.copy(null, null, !this.left.color, null, null),\n e = this.right.copy(null, null, !this.right.color, null, null);\n return this.copy(null, null, !this.color, t, e);\n }, // For testing.\n t.prototype.checkMaxDepth = function () {\n var t = this.check();\n return Math.pow(2, t) <= this.size + 1;\n }, // In a balanced RB tree, the black-depth (number of black nodes) from root to\n // leaves is equal on both sides. This function verifies that or asserts.\n t.prototype.check = function () {\n if (this.isRed() && this.left.isRed()) throw O();\n if (this.right.isRed()) throw O();\n var t = this.left.check();\n if (t !== this.right.check()) throw O();\n return t + (this.isRed() ? 0 : 1);\n }, t;\n}(); // end SortedMap\n// An iterator over an LLRBNode.\n// end LLRBNode\n// Empty node is shared between all LLRB trees.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n\nYe.EMPTY = null, Ye.RED = !0, Ye.BLACK = !1, // end LLRBEmptyNode\nYe.EMPTY = new (\n/** @class */\nfunction () {\n function t() {\n this.size = 0;\n }\n\n return Object.defineProperty(t.prototype, \"key\", {\n get: function get() {\n throw O();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"value\", {\n get: function get() {\n throw O();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"color\", {\n get: function get() {\n throw O();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"left\", {\n get: function get() {\n throw O();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"right\", {\n get: function get() {\n throw O();\n },\n enumerable: !1,\n configurable: !0\n }), // Returns a copy of the current node.\n t.prototype.copy = function (t, e, n, r, i) {\n return this;\n }, // Returns a copy of the tree, with the specified key/value added.\n t.prototype.insert = function (t, e, n) {\n return new Ye(t, e);\n }, // Returns a copy of the tree, with the specified key removed.\n t.prototype.remove = function (t, e) {\n return this;\n }, t.prototype.isEmpty = function () {\n return !0;\n }, t.prototype.inorderTraversal = function (t) {\n return !1;\n }, t.prototype.reverseTraversal = function (t) {\n return !1;\n }, t.prototype.minKey = function () {\n return null;\n }, t.prototype.maxKey = function () {\n return null;\n }, t.prototype.isRed = function () {\n return !1;\n }, // For testing.\n t.prototype.checkMaxDepth = function () {\n return !0;\n }, t.prototype.check = function () {\n return 0;\n }, t;\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/**\n * SortedSet is an immutable (copy-on-write) collection that holds elements\n * in order specified by the provided comparator.\n *\n * NOTE: if provided comparator returns 0 for two elements, we consider them to\n * be equal!\n */\n\nvar $e =\n/** @class */\nfunction () {\n function t(t) {\n this.comparator = t, this.data = new We(this.comparator);\n }\n\n return t.prototype.has = function (t) {\n return null !== this.data.get(t);\n }, t.prototype.first = function () {\n return this.data.minKey();\n }, t.prototype.last = function () {\n return this.data.maxKey();\n }, Object.defineProperty(t.prototype, \"size\", {\n get: function get() {\n return this.data.size;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.indexOf = function (t) {\n return this.data.indexOf(t);\n },\n /** Iterates elements in order defined by \"comparator\" */\n t.prototype.forEach = function (t) {\n this.data.inorderTraversal(function (e, n) {\n return t(e), !1;\n });\n },\n /** Iterates over `elem`s such that: range[0] <= elem < range[1]. */\n t.prototype.forEachInRange = function (t, e) {\n for (var n = this.data.getIteratorFrom(t[0]); n.hasNext();) {\n var r = n.getNext();\n if (this.comparator(r.key, t[1]) >= 0) return;\n e(r.key);\n }\n },\n /**\n * Iterates over `elem`s such that: start <= elem until false is returned.\n */\n t.prototype.forEachWhile = function (t, e) {\n var n;\n\n for (n = void 0 !== e ? this.data.getIteratorFrom(e) : this.data.getIterator(); n.hasNext();) {\n if (!t(n.getNext().key)) return;\n }\n },\n /** Finds the least element greater than or equal to `elem`. */\n t.prototype.firstAfterOrEqual = function (t) {\n var e = this.data.getIteratorFrom(t);\n return e.hasNext() ? e.getNext().key : null;\n }, t.prototype.getIterator = function () {\n return new Xe(this.data.getIterator());\n }, t.prototype.getIteratorFrom = function (t) {\n return new Xe(this.data.getIteratorFrom(t));\n },\n /** Inserts or updates an element */\n t.prototype.add = function (t) {\n return this.copy(this.data.remove(t).insert(t, !0));\n },\n /** Deletes an element */\n t.prototype.delete = function (t) {\n return this.has(t) ? this.copy(this.data.remove(t)) : this;\n }, t.prototype.isEmpty = function () {\n return this.data.isEmpty();\n }, t.prototype.unionWith = function (t) {\n var e = this; // Make sure `result` always refers to the larger one of the two sets.\n\n return e.size < t.size && (e = t, t = this), t.forEach(function (t) {\n e = e.add(t);\n }), e;\n }, t.prototype.isEqual = function (e) {\n if (!(e instanceof t)) return !1;\n if (this.size !== e.size) return !1;\n\n for (var n = this.data.getIterator(), r = e.data.getIterator(); n.hasNext();) {\n var i = n.getNext().key,\n o = r.getNext().key;\n if (0 !== this.comparator(i, o)) return !1;\n }\n\n return !0;\n }, t.prototype.toArray = function () {\n var t = [];\n return this.forEach(function (e) {\n t.push(e);\n }), t;\n }, t.prototype.toString = function () {\n var t = [];\n return this.forEach(function (e) {\n return t.push(e);\n }), \"SortedSet(\" + t.toString() + \")\";\n }, t.prototype.copy = function (e) {\n var n = new t(this.comparator);\n return n.data = e, n;\n }, t;\n}(),\n Xe =\n/** @class */\nfunction () {\n function t(t) {\n this.iter = t;\n }\n\n return t.prototype.getNext = function () {\n return this.iter.getNext().key;\n }, t.prototype.hasNext = function () {\n return this.iter.hasNext();\n }, t;\n}(),\n Je = new We(ct.comparator);\n\nfunction Ze() {\n return Je;\n}\n\nvar tn = new We(ct.comparator);\n\nfunction en() {\n return tn;\n}\n\nvar nn = new We(ct.comparator);\n\nfunction rn() {\n return nn;\n}\n\nvar on = new $e(ct.comparator);\n\nfunction sn() {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n }\n\n for (var n = on, r = 0, i = t; r < i.length; r++) {\n var o = i[r];\n n = n.add(o);\n }\n\n return n;\n}\n\nvar un = new $e(q);\n\nfunction an() {\n return un;\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/**\n * An event from the RemoteStore. It is split into targetChanges (changes to the\n * state or the set of documents in our watched targets) and documentUpdates\n * (changes to the actual documents).\n */\n\n\nvar cn =\n/** @class */\nfunction () {\n function t(\n /**\n * The snapshot version this event brings us up to, or MIN if not set.\n */\n t,\n /**\n * A map from target to changes to the target. See TargetChange.\n */\n e,\n /**\n * A set of targets that is known to be inconsistent. Listens for these\n * targets should be re-established without resume tokens.\n */\n n,\n /**\n * A set of which documents have changed or been deleted, along with the\n * doc's new values (if not deleted).\n */\n r,\n /**\n * A set of which document updates are due only to limbo resolution targets.\n */\n i) {\n this.snapshotVersion = t, this.targetChanges = e, this.targetMismatches = n, this.documentUpdates = r, this.resolvedLimboDocuments = i;\n }\n /**\n * HACK: Views require RemoteEvents in order to determine whether the view is\n * CURRENT, but secondary tabs don't receive remote events. So this method is\n * used to create a synthesized RemoteEvent that can be used to apply a\n * CURRENT status change to a View, for queries executed in a different tab.\n */\n // PORTING NOTE: Multi-tab only\n\n\n return t.createSynthesizedRemoteEventForCurrentChange = function (e, n) {\n var r = new Map();\n return r.set(e, hn.createSynthesizedTargetChangeForCurrentChange(e, n)), new t(K.min(), r, an(), Ze(), sn());\n }, t;\n}(),\n hn =\n/** @class */\nfunction () {\n function t(\n /**\n * An opaque, server-assigned token that allows watching a query to be resumed\n * after disconnecting without retransmitting all the data that matches the\n * query. The resume token essentially identifies a point in time from which\n * the server should resume sending results.\n */\n t,\n /**\n * The \"current\" (synced) status of this target. Note that \"current\"\n * has special meaning in the RPC protocol that implies that a target is\n * both up-to-date and consistent with the rest of the watch stream.\n */\n e,\n /**\n * The set of documents that were newly assigned to this target as part of\n * this remote event.\n */\n n,\n /**\n * The set of documents that were already assigned to this target but received\n * an update during this remote event.\n */\n r,\n /**\n * The set of documents that were removed from this target as part of this\n * remote event.\n */\n i) {\n this.resumeToken = t, this.current = e, this.addedDocuments = n, this.modifiedDocuments = r, this.removedDocuments = i\n /**\n * This method is used to create a synthesized TargetChanges that can be used to\n * apply a CURRENT status change to a View (for queries executed in a different\n * tab) or for new queries (to raise snapshots with correct CURRENT status).\n */\n ;\n }\n\n return t.createSynthesizedTargetChangeForCurrentChange = function (e, n) {\n return new t(J.EMPTY_BYTE_STRING, n, sn(), sn(), sn());\n }, t;\n}(),\n fn = function fn(\n/** The new document applies to all of these targets. */\nt,\n/** The new document is removed from all of these targets. */\ne,\n/** The key of the document for this change. */\nn,\n/**\n * The new document or NoDocument if it was deleted. Is null if the\n * document went out of view without the server sending a new document.\n */\nr) {\n this.v = t, this.removedTargetIds = e, this.key = n, this.P = r;\n},\n ln = function ln(t, e) {\n this.targetId = t, this.V = e;\n},\n dn = function dn(\n/** What kind of change occurred to the watch target. */\nt,\n/** The target IDs that were added/removed/set. */\ne,\n/**\n * An opaque, server-assigned token that allows watching a target to be\n * resumed after disconnecting without retransmitting all the data that\n * matches the target. The resume token essentially identifies a point in\n * time from which the server should resume sending results.\n */\nn\n/** An RPC error indicating why the watch failed. */\n, r) {\n void 0 === n && (n = J.EMPTY_BYTE_STRING), void 0 === r && (r = null), this.state = t, this.targetIds = e, this.resumeToken = n, this.cause = r;\n},\n pn =\n/** @class */\nfunction () {\n function t() {\n /**\n * The number of pending responses (adds or removes) that we are waiting on.\n * We only consider targets active that have no pending responses.\n */\n this.S = 0,\n /**\n * Keeps track of the document changes since the last raised snapshot.\n *\n * These changes are continuously updated as we receive document updates and\n * always reflect the current set of changes against the last issued snapshot.\n */\n this.D = mn(),\n /** See public getters for explanations of these fields. */\n this.C = J.EMPTY_BYTE_STRING, this.N = !1,\n /**\n * Whether this target state should be included in the next snapshot. We\n * initialize to true so that newly-added targets are included in the next\n * RemoteEvent.\n */\n this.k = !0;\n }\n\n return Object.defineProperty(t.prototype, \"current\", {\n /**\n * Whether this target has been marked 'current'.\n *\n * 'Current' has special meaning in the RPC protocol: It implies that the\n * Watch backend has sent us all changes up to the point at which the target\n * was added and that the target is consistent with the rest of the watch\n * stream.\n */\n get: function get() {\n return this.N;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"resumeToken\", {\n /** The last resume token sent to us for this target. */\n get: function get() {\n return this.C;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"F\", {\n /** Whether this target has pending target adds or target removes. */\n get: function get() {\n return 0 !== this.S;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"$\", {\n /** Whether we have modified any state that should trigger a snapshot. */\n get: function get() {\n return this.k;\n },\n enumerable: !1,\n configurable: !0\n }),\n /**\n * Applies the resume token to the TargetChange, but only when it has a new\n * value. Empty resumeTokens are discarded.\n */\n t.prototype.O = function (t) {\n t.approximateByteSize() > 0 && (this.k = !0, this.C = t);\n },\n /**\n * Creates a target change from the current set of changes.\n *\n * To reset the document changes after raising this snapshot, call\n * `clearPendingChanges()`.\n */\n t.prototype.M = function () {\n var t = sn(),\n e = sn(),\n n = sn();\n return this.D.forEach(function (r, i) {\n switch (i) {\n case 0\n /* Added */\n :\n t = t.add(r);\n break;\n\n case 2\n /* Modified */\n :\n e = e.add(r);\n break;\n\n case 1\n /* Removed */\n :\n n = n.add(r);\n break;\n\n default:\n O();\n }\n }), new hn(this.C, this.N, t, e, n);\n },\n /**\n * Resets the document changes and sets `hasPendingChanges` to false.\n */\n t.prototype.L = function () {\n this.k = !1, this.D = mn();\n }, t.prototype.B = function (t, e) {\n this.k = !0, this.D = this.D.insert(t, e);\n }, t.prototype.q = function (t) {\n this.k = !0, this.D = this.D.remove(t);\n }, t.prototype.U = function () {\n this.S += 1;\n }, t.prototype.K = function () {\n this.S -= 1;\n }, t.prototype.j = function () {\n this.k = !0, this.N = !0;\n }, t;\n}(),\n yn =\n/** @class */\nfunction () {\n function t(t) {\n this.W = t,\n /** The internal state of all tracked targets. */\n this.G = new Map(),\n /** Keeps track of the documents to update since the last raised snapshot. */\n this.H = Ze(),\n /** A mapping of document keys to their set of target IDs. */\n this.J = vn(),\n /**\n * A list of targets with existence filter mismatches. These targets are\n * known to be inconsistent and their listens needs to be re-established by\n * RemoteStore.\n */\n this.Y = new $e(q)\n /**\n * Processes and adds the DocumentWatchChange to the current set of changes.\n */\n ;\n }\n\n return t.prototype.X = function (t) {\n for (var e = 0, n = t.v; e < n.length; e++) {\n var r = n[e];\n t.P && t.P.isFoundDocument() ? this.Z(r, t.P) : this.tt(r, t.key, t.P);\n }\n\n for (var i = 0, o = t.removedTargetIds; i < o.length; i++) {\n r = o[i];\n this.tt(r, t.key, t.P);\n }\n },\n /** Processes and adds the WatchTargetChange to the current set of changes. */\n t.prototype.et = function (t) {\n var e = this;\n this.forEachTarget(t, function (n) {\n var r = e.nt(n);\n\n switch (t.state) {\n case 0\n /* NoChange */\n :\n e.st(n) && r.O(t.resumeToken);\n break;\n\n case 1\n /* Added */\n :\n // We need to decrement the number of pending acks needed from watch\n // for this targetId.\n r.K(), r.F || // We have a freshly added target, so we need to reset any state\n // that we had previously. This can happen e.g. when remove and add\n // back a target for existence filter mismatches.\n r.L(), r.O(t.resumeToken);\n break;\n\n case 2\n /* Removed */\n :\n // We need to keep track of removed targets to we can post-filter and\n // remove any target changes.\n // We need to decrement the number of pending acks needed from watch\n // for this targetId.\n r.K(), r.F || e.removeTarget(n);\n break;\n\n case 3\n /* Current */\n :\n e.st(n) && (r.j(), r.O(t.resumeToken));\n break;\n\n case 4\n /* Reset */\n :\n e.st(n) && ( // Reset the target and synthesizes removes for all existing\n // documents. The backend will re-add any documents that still\n // match the target before it sends the next global snapshot.\n e.it(n), r.O(t.resumeToken));\n break;\n\n default:\n O();\n }\n });\n },\n /**\n * Iterates over all targetIds that the watch change applies to: either the\n * targetIds explicitly listed in the change or the targetIds of all currently\n * active targets.\n */\n t.prototype.forEachTarget = function (t, e) {\n var n = this;\n t.targetIds.length > 0 ? t.targetIds.forEach(e) : this.G.forEach(function (t, r) {\n n.st(r) && e(r);\n });\n },\n /**\n * Handles existence filters and synthesizes deletes for filter mismatches.\n * Targets that are invalidated by filter mismatches are added to\n * `pendingTargetResets`.\n */\n t.prototype.rt = function (t) {\n var e = t.targetId,\n n = t.V.count,\n r = this.ot(e);\n\n if (r) {\n var i = r.target;\n if (xt(i)) {\n if (0 === n) {\n // The existence filter told us the document does not exist. We deduce\n // that this document does not exist and apply a deleted document to\n // our updates. Without applying this deleted document there might be\n // another query that will raise this document as part of a snapshot\n // until it is resolved, essentially exposing inconsistency between\n // queries.\n var o = new ct(i.path);\n this.tt(e, o, Nt.newNoDocument(o, K.min()));\n } else P(1 === n);\n } else this.ct(e) !== n && ( // Existence filter mismatch: We reset the mapping and raise a new\n // snapshot with `isFromCache:true`.\n this.it(e), this.Y = this.Y.add(e));\n }\n },\n /**\n * Converts the currently accumulated state into a remote event at the\n * provided snapshot version. Resets the accumulated changes before returning.\n */\n t.prototype.ut = function (t) {\n var e = this,\n n = new Map();\n this.G.forEach(function (r, i) {\n var o = e.ot(i);\n\n if (o) {\n if (r.current && xt(o.target)) {\n // Document queries for document that don't exist can produce an empty\n // result set. To update our local cache, we synthesize a document\n // delete if we have not previously received the document. This\n // resolves the limbo state of the document, removing it from\n // limboDocumentRefs.\n // TODO(dimond): Ideally we would have an explicit lookup target\n // instead resulting in an explicit delete message and we could\n // remove this special logic.\n var s = new ct(o.target.path);\n null !== e.H.get(s) || e.at(i, s) || e.tt(i, s, Nt.newNoDocument(s, t));\n }\n\n r.$ && (n.set(i, r.M()), r.L());\n }\n });\n var r = sn(); // We extract the set of limbo-only document updates as the GC logic\n // special-cases documents that do not appear in the target cache.\n // TODO(gsoltis): Expand on this comment once GC is available in the JS\n // client.\n\n this.J.forEach(function (t, n) {\n var i = !0;\n n.forEachWhile(function (t) {\n var n = e.ot(t);\n return !n || 2\n /* LimboResolution */\n === n.purpose || (i = !1, !1);\n }), i && (r = r.add(t));\n });\n var i = new cn(t, n, this.Y, this.H, r);\n return this.H = Ze(), this.J = vn(), this.Y = new $e(q), i;\n },\n /**\n * Adds the provided document to the internal list of document updates and\n * its document key to the given target's mapping.\n */\n // Visible for testing.\n t.prototype.Z = function (t, e) {\n if (this.st(t)) {\n var n = this.at(t, e.key) ? 2\n /* Modified */\n : 0\n /* Added */\n ;\n this.nt(t).B(e.key, n), this.H = this.H.insert(e.key, e), this.J = this.J.insert(e.key, this.ht(e.key).add(t));\n }\n },\n /**\n * Removes the provided document from the target mapping. If the\n * document no longer matches the target, but the document's state is still\n * known (e.g. we know that the document was deleted or we received the change\n * that caused the filter mismatch), the new document can be provided\n * to update the remote document cache.\n */\n // Visible for testing.\n t.prototype.tt = function (t, e, n) {\n if (this.st(t)) {\n var r = this.nt(t);\n this.at(t, e) ? r.B(e, 1\n /* Removed */\n ) : // The document may have entered and left the target before we raised a\n // snapshot, so we can just ignore the change.\n r.q(e), this.J = this.J.insert(e, this.ht(e).delete(t)), n && (this.H = this.H.insert(e, n));\n }\n }, t.prototype.removeTarget = function (t) {\n this.G.delete(t);\n },\n /**\n * Returns the current count of documents in the target. This includes both\n * the number of documents that the LocalStore considers to be part of the\n * target as well as any accumulated changes.\n */\n t.prototype.ct = function (t) {\n var e = this.nt(t).M();\n return this.W.getRemoteKeysForTarget(t).size + e.addedDocuments.size - e.removedDocuments.size;\n },\n /**\n * Increment the number of acks needed from watch before we can consider the\n * server to be 'in-sync' with the client's active targets.\n */\n t.prototype.U = function (t) {\n this.nt(t).U();\n }, t.prototype.nt = function (t) {\n var e = this.G.get(t);\n return e || (e = new pn(), this.G.set(t, e)), e;\n }, t.prototype.ht = function (t) {\n var e = this.J.get(t);\n return e || (e = new $e(q), this.J = this.J.insert(t, e)), e;\n },\n /**\n * Verifies that the user is still interested in this target (by calling\n * `getTargetDataForTarget()`) and that we are not waiting for pending ADDs\n * from watch.\n */\n t.prototype.st = function (t) {\n var e = null !== this.ot(t);\n return e || C(\"WatchChangeAggregator\", \"Detected inactive target\", t), e;\n },\n /**\n * Returns the TargetData for an active target (i.e. a target that the user\n * is still interested in that has no outstanding target change requests).\n */\n t.prototype.ot = function (t) {\n var e = this.G.get(t);\n return e && e.F ? null : this.W.lt(t);\n },\n /**\n * Resets the state of a Watch target to its initial state (e.g. sets\n * 'current' to false, clears the resume token and removes its target mapping\n * from all documents).\n */\n t.prototype.it = function (t) {\n var e = this;\n this.G.set(t, new pn()), this.W.getRemoteKeysForTarget(t).forEach(function (n) {\n e.tt(t, n,\n /*updatedDocument=*/\n null);\n });\n },\n /**\n * Returns whether the LocalStore considers the document to be part of the\n * specified target.\n */\n t.prototype.at = function (t, e) {\n return this.W.getRemoteKeysForTarget(t).has(e);\n }, t;\n}();\n/**\n * A TargetChange specifies the set of changes for a specific target as part of\n * a RemoteEvent. These changes track which documents are added, modified or\n * removed, as well as the target's resume token and whether the target is\n * marked CURRENT.\n * The actual changes *to* documents are not part of the TargetChange since\n * documents may be part of multiple targets.\n */\n\n\nfunction vn() {\n return new We(ct.comparator);\n}\n\nfunction mn() {\n return new We(ct.comparator);\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\nvar gn = {\n asc: \"ASCENDING\",\n desc: \"DESCENDING\"\n},\n wn = {\n \"<\": \"LESS_THAN\",\n \"<=\": \"LESS_THAN_OR_EQUAL\",\n \">\": \"GREATER_THAN\",\n \">=\": \"GREATER_THAN_OR_EQUAL\",\n \"==\": \"EQUAL\",\n \"!=\": \"NOT_EQUAL\",\n \"array-contains\": \"ARRAY_CONTAINS\",\n in: \"IN\",\n \"not-in\": \"NOT_IN\",\n \"array-contains-any\": \"ARRAY_CONTAINS_ANY\"\n},\n bn = function bn(t, e) {\n this.databaseId = t, this.I = e;\n};\n/**\n * This class generates JsonObject values for the Datastore API suitable for\n * sending to either GRPC stub methods or via the JSON/HTTP REST API.\n *\n * The serializer supports both Protobuf.js and Proto3 JSON formats. By\n * setting `useProto3Json` to true, the serializer will use the Proto3 JSON\n * format.\n *\n * For a description of the Proto3 JSON format check\n * https://developers.google.com/protocol-buffers/docs/proto3#json\n *\n * TODO(klimt): We can remove the databaseId argument if we keep the full\n * resource name in documents.\n */\n\n/**\n * Returns a value for a Date that's appropriate to put into a proto.\n */\n\n\nfunction In(t, e) {\n return t.I ? new Date(1e3 * e.seconds).toISOString().replace(/\\.\\d*/, \"\").replace(\"Z\", \"\") + \".\" + (\"000000000\" + e.nanoseconds).slice(-9) + \"Z\" : {\n seconds: \"\" + e.seconds,\n nanos: e.nanoseconds\n };\n}\n/**\n * Returns a value for bytes that's appropriate to put in a proto.\n *\n * Visible for testing.\n */\n\n\nfunction Tn(t, e) {\n return t.I ? e.toBase64() : e.toUint8Array();\n}\n/**\n * Returns a ByteString based on the proto string value.\n */\n\n\nfunction En(t, e) {\n return In(t, e.toTimestamp());\n}\n\nfunction _n(t) {\n return P(!!t), K.fromTimestamp(function (t) {\n var e = tt(t);\n return new j(e.seconds, e.nanos);\n }(t));\n}\n\nfunction Sn(t, e) {\n return function (t) {\n return new H([\"projects\", t.projectId, \"databases\", t.database]);\n }(t).child(\"documents\").child(e).canonicalString();\n}\n\nfunction Nn(t) {\n var e = H.fromString(t);\n return P($n(e)), e;\n}\n\nfunction Dn(t, e) {\n return Sn(t.databaseId, e.path);\n}\n\nfunction An(t, e) {\n var n = Nn(e);\n if (n.get(1) !== t.databaseId.projectId) throw new D(N.INVALID_ARGUMENT, \"Tried to deserialize key from different project: \" + n.get(1) + \" vs \" + t.databaseId.projectId);\n if (n.get(3) !== t.databaseId.database) throw new D(N.INVALID_ARGUMENT, \"Tried to deserialize key from different database: \" + n.get(3) + \" vs \" + t.databaseId.database);\n return new ct(Rn(n));\n}\n\nfunction kn(t, e) {\n return Sn(t.databaseId, e);\n}\n\nfunction Cn(t) {\n var e = Nn(t); // In v1beta1 queries for collections at the root did not have a trailing\n // \"/documents\". In v1 all resource paths contain \"/documents\". Preserve the\n // ability to read the v1beta1 form for compatibility with queries persisted\n // in the local target cache.\n\n return 4 === e.length ? H.emptyPath() : Rn(e);\n}\n\nfunction xn(t) {\n return new H([\"projects\", t.databaseId.projectId, \"databases\", t.databaseId.database]).canonicalString();\n}\n\nfunction Rn(t) {\n return P(t.length > 4 && \"documents\" === t.get(4)), t.popFirst(5)\n /** Creates a Document proto from key and fields (but no create/update time) */\n ;\n}\n\nfunction Ln(t, e, n) {\n return {\n name: Dn(t, e),\n fields: n.value.mapValue.fields\n };\n}\n\nfunction On(t, e, n) {\n var r = An(t, e.name),\n i = _n(e.updateTime),\n o = new _t({\n mapValue: {\n fields: e.fields\n }\n }),\n s = Nt.newFoundDocument(r, i, o);\n\n return n && s.setHasCommittedMutations(), n ? s.setHasCommittedMutations() : s;\n}\n\nfunction Pn(t, e) {\n var n;\n if (e instanceof Pe) n = {\n update: Ln(t, e.key, e.value)\n };else if (e instanceof je) n = {\n delete: Dn(t, e.key)\n };else if (e instanceof Fe) n = {\n update: Ln(t, e.key, e.data),\n updateMask: Yn(e.fieldMask)\n };else {\n if (!(e instanceof Ke)) return O();\n n = {\n verify: Dn(t, e.key)\n };\n }\n return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map(function (t) {\n return function (t, e) {\n var n = e.transform;\n if (n instanceof me) return {\n fieldPath: e.field.canonicalString(),\n setToServerValue: \"REQUEST_TIME\"\n };\n if (n instanceof ge) return {\n fieldPath: e.field.canonicalString(),\n appendMissingElements: {\n values: n.elements\n }\n };\n if (n instanceof be) return {\n fieldPath: e.field.canonicalString(),\n removeAllFromArray: {\n values: n.elements\n }\n };\n if (n instanceof Te) return {\n fieldPath: e.field.canonicalString(),\n increment: n.A\n };\n throw O();\n }(0, t);\n })), e.precondition.isNone || (n.currentDocument = function (t, e) {\n return void 0 !== e.updateTime ? {\n updateTime: En(t, e.updateTime)\n } : void 0 !== e.exists ? {\n exists: e.exists\n } : O();\n }(t, e.precondition)), n;\n}\n\nfunction Fn(t, e) {\n var n = e.currentDocument ? function (t) {\n return void 0 !== t.updateTime ? De.updateTime(_n(t.updateTime)) : void 0 !== t.exists ? De.exists(t.exists) : De.none();\n }(e.currentDocument) : De.none(),\n r = e.updateTransforms ? e.updateTransforms.map(function (e) {\n return function (t, e) {\n var n = null;\n if (\"setToServerValue\" in e) P(\"REQUEST_TIME\" === e.setToServerValue), n = new me();else if (\"appendMissingElements\" in e) {\n var r = e.appendMissingElements.values || [];\n n = new ge(r);\n } else if (\"removeAllFromArray\" in e) {\n var i = e.removeAllFromArray.values || [];\n n = new be(i);\n } else \"increment\" in e ? n = new Te(t, e.increment) : O();\n var o = $.fromServerFormat(e.fieldPath);\n return new Se(o, n);\n }(t, e);\n }) : [];\n\n if (e.update) {\n e.update.name;\n var i = An(t, e.update.name),\n o = new _t({\n mapValue: {\n fields: e.update.fields\n }\n });\n\n if (e.updateMask) {\n var s = function (t) {\n var e = t.fieldPaths || [];\n return new X(e.map(function (t) {\n return $.fromServerFormat(t);\n }));\n }(e.updateMask);\n\n return new Fe(i, o, s, n, r);\n }\n\n return new Pe(i, o, n, r);\n }\n\n if (e.delete) {\n var u = An(t, e.delete);\n return new je(u, n);\n }\n\n if (e.verify) {\n var a = An(t, e.verify);\n return new Ke(a, n);\n }\n\n return O();\n}\n\nfunction Mn(t, e) {\n return {\n documents: [kn(t, e.path)]\n };\n}\n\nfunction Vn(t, e) {\n // Dissect the path into parent, collectionId, and optional key filter.\n var n = {\n structuredQuery: {}\n },\n r = e.path;\n null !== e.collectionGroup ? (n.parent = kn(t, r), n.structuredQuery.from = [{\n collectionId: e.collectionGroup,\n allDescendants: !0\n }]) : (n.parent = kn(t, r.popLast()), n.structuredQuery.from = [{\n collectionId: r.lastSegment()\n }]);\n\n var i = function (t) {\n if (0 !== t.length) {\n var e = t.map(function (t) {\n // visible for testing\n return function (t) {\n if (\"==\"\n /* EQUAL */\n === t.op) {\n if (It(t.value)) return {\n unaryFilter: {\n field: Gn(t.field),\n op: \"IS_NAN\"\n }\n };\n if (bt(t.value)) return {\n unaryFilter: {\n field: Gn(t.field),\n op: \"IS_NULL\"\n }\n };\n } else if (\"!=\"\n /* NOT_EQUAL */\n === t.op) {\n if (It(t.value)) return {\n unaryFilter: {\n field: Gn(t.field),\n op: \"IS_NOT_NAN\"\n }\n };\n if (bt(t.value)) return {\n unaryFilter: {\n field: Gn(t.field),\n op: \"IS_NOT_NULL\"\n }\n };\n }\n\n return {\n fieldFilter: {\n field: Gn(t.field),\n op: Qn(t.op),\n value: t.value\n }\n };\n }(t);\n });\n return 1 === e.length ? e[0] : {\n compositeFilter: {\n op: \"AND\",\n filters: e\n }\n };\n }\n }(e.filters);\n\n i && (n.structuredQuery.where = i);\n\n var o = function (t) {\n if (0 !== t.length) return t.map(function (t) {\n // visible for testing\n return function (t) {\n return {\n field: Gn(t.field),\n direction: Kn(t.dir)\n };\n }(t);\n });\n }(e.orderBy);\n\n o && (n.structuredQuery.orderBy = o);\n\n var s = function (t, e) {\n return t.I || st(e) ? e : {\n value: e\n };\n }(t, e.limit);\n\n return null !== s && (n.structuredQuery.limit = s), e.startAt && (n.structuredQuery.startAt = Bn(e.startAt)), e.endAt && (n.structuredQuery.endAt = Bn(e.endAt)), n;\n}\n\nfunction qn(t) {\n var e = Cn(t.parent),\n n = t.structuredQuery,\n r = n.from ? n.from.length : 0,\n i = null;\n\n if (r > 0) {\n P(1 === r);\n var o = n.from[0];\n o.allDescendants ? i = o.collectionId : e = e.child(o.collectionId);\n }\n\n var s = [];\n n.where && (s = Un(n.where));\n var u = [];\n n.orderBy && (u = n.orderBy.map(function (t) {\n return function (t) {\n return new Kt(zn(t.field), // visible for testing\n function (t) {\n switch (t) {\n case \"ASCENDING\":\n return \"asc\"\n /* ASCENDING */\n ;\n\n case \"DESCENDING\":\n return \"desc\"\n /* DESCENDING */\n ;\n\n default:\n return;\n }\n }(t.direction));\n }(t);\n }));\n var a = null;\n n.limit && (a = function (t) {\n var e;\n return st(e = \"object\" == typeof t ? t.value : t) ? null : e;\n }(n.limit));\n var c = null;\n n.startAt && (c = jn(n.startAt));\n var h = null;\n return n.endAt && (h = jn(n.endAt)), Ht(e, i, u, s, a, \"F\"\n /* First */\n , c, h);\n}\n\nfunction Un(t) {\n return t ? void 0 !== t.unaryFilter ? [Hn(t)] : void 0 !== t.fieldFilter ? [Wn(t)] : void 0 !== t.compositeFilter ? t.compositeFilter.filters.map(function (t) {\n return Un(t);\n }).reduce(function (t, e) {\n return t.concat(e);\n }) : O() : [];\n}\n\nfunction Bn(t) {\n return {\n before: t.before,\n values: t.position\n };\n}\n\nfunction jn(t) {\n var e = !!t.before,\n n = t.values || [];\n return new Bt(n, e);\n} // visible for testing\n\n\nfunction Kn(t) {\n return gn[t];\n}\n\nfunction Qn(t) {\n return wn[t];\n}\n\nfunction Gn(t) {\n return {\n fieldPath: t.canonicalString()\n };\n}\n\nfunction zn(t) {\n return $.fromServerFormat(t.fieldPath);\n}\n\nfunction Wn(t) {\n return Rt.create(zn(t.fieldFilter.field), function (t) {\n switch (t) {\n case \"EQUAL\":\n return \"==\"\n /* EQUAL */\n ;\n\n case \"NOT_EQUAL\":\n return \"!=\"\n /* NOT_EQUAL */\n ;\n\n case \"GREATER_THAN\":\n return \">\"\n /* GREATER_THAN */\n ;\n\n case \"GREATER_THAN_OR_EQUAL\":\n return \">=\"\n /* GREATER_THAN_OR_EQUAL */\n ;\n\n case \"LESS_THAN\":\n return \"<\"\n /* LESS_THAN */\n ;\n\n case \"LESS_THAN_OR_EQUAL\":\n return \"<=\"\n /* LESS_THAN_OR_EQUAL */\n ;\n\n case \"ARRAY_CONTAINS\":\n return \"array-contains\"\n /* ARRAY_CONTAINS */\n ;\n\n case \"IN\":\n return \"in\"\n /* IN */\n ;\n\n case \"NOT_IN\":\n return \"not-in\"\n /* NOT_IN */\n ;\n\n case \"ARRAY_CONTAINS_ANY\":\n return \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n ;\n\n case \"OPERATOR_UNSPECIFIED\":\n default:\n return O();\n }\n }(t.fieldFilter.op), t.fieldFilter.value);\n}\n\nfunction Hn(t) {\n switch (t.unaryFilter.op) {\n case \"IS_NAN\":\n var e = zn(t.unaryFilter.field);\n return Rt.create(e, \"==\"\n /* EQUAL */\n , {\n doubleValue: NaN\n });\n\n case \"IS_NULL\":\n var n = zn(t.unaryFilter.field);\n return Rt.create(n, \"==\"\n /* EQUAL */\n , {\n nullValue: \"NULL_VALUE\"\n });\n\n case \"IS_NOT_NAN\":\n var r = zn(t.unaryFilter.field);\n return Rt.create(r, \"!=\"\n /* NOT_EQUAL */\n , {\n doubleValue: NaN\n });\n\n case \"IS_NOT_NULL\":\n var i = zn(t.unaryFilter.field);\n return Rt.create(i, \"!=\"\n /* NOT_EQUAL */\n , {\n nullValue: \"NULL_VALUE\"\n });\n\n case \"OPERATOR_UNSPECIFIED\":\n default:\n return O();\n }\n}\n\nfunction Yn(t) {\n var e = [];\n return t.fields.forEach(function (t) {\n return e.push(t.canonicalString());\n }), {\n fieldPaths: e\n };\n}\n\nfunction $n(t) {\n // Resource names have at least 4 components (project ID, database ID)\n return t.length >= 4 && \"projects\" === t.get(0) && \"databases\" === t.get(2);\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/**\n * Encodes a resource path into a IndexedDb-compatible string form.\n */\n\n\nfunction Xn(t) {\n for (var e = \"\", n = 0; n < t.length; n++) {\n e.length > 0 && (e = Zn(e)), e = Jn(t.get(n), e);\n }\n\n return Zn(e);\n}\n/** Encodes a single segment of a resource path into the given result */\n\n\nfunction Jn(t, e) {\n for (var n = e, r = t.length, i = 0; i < r; i++) {\n var o = t.charAt(i);\n\n switch (o) {\n case \"\\0\":\n n += \"\u0001\u0010\";\n break;\n\n case \"\u0001\":\n n += \"\u0001\u0011\";\n break;\n\n default:\n n += o;\n }\n }\n\n return n;\n}\n/** Encodes a path separator into the given result */\n\n\nfunction Zn(t) {\n return t + \"\u0001\u0001\";\n}\n/**\n * Decodes the given IndexedDb-compatible string form of a resource path into\n * a ResourcePath instance. Note that this method is not suitable for use with\n * decoding resource names from the server; those are One Platform format\n * strings.\n */\n\n\nfunction tr(t) {\n // Event the empty path must encode as a path of at least length 2. A path\n // with exactly 2 must be the empty path.\n var e = t.length;\n if (P(e >= 2), 2 === e) return P(\"\u0001\" === t.charAt(0) && \"\u0001\" === t.charAt(1)), H.emptyPath(); // Escape characters cannot exist past the second-to-last position in the\n // source value.\n\n for (var n = e - 2, r = [], i = \"\", o = 0; o < e;) {\n // The last two characters of a valid encoded path must be a separator, so\n // there must be an end to this segment.\n var s = t.indexOf(\"\u0001\", o);\n\n switch ((s < 0 || s > n) && O(), t.charAt(s + 1)) {\n case \"\u0001\":\n var u = t.substring(o, s),\n a = void 0;\n 0 === i.length ? // Avoid copying for the common case of a segment that excludes \\0\n // and \\001\n a = u : (a = i += u, i = \"\"), r.push(a);\n break;\n\n case \"\u0010\":\n i += t.substring(o, s), i += \"\\0\";\n break;\n\n case \"\u0011\":\n // The escape character can be used in the output to encode itself.\n i += t.substring(o, s + 1);\n break;\n\n default:\n O();\n }\n\n o = s + 2;\n }\n\n return new H(r);\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/**\n * Schema Version for the Web client:\n * 1. Initial version including Mutation Queue, Query Cache, and Remote\n * Document Cache\n * 2. Used to ensure a targetGlobal object exists and add targetCount to it. No\n * longer required because migration 3 unconditionally clears it.\n * 3. Dropped and re-created Query Cache to deal with cache corruption related\n * to limbo resolution. Addresses\n * https://github.com/firebase/firebase-ios-sdk/issues/1548\n * 4. Multi-Tab Support.\n * 5. Removal of held write acks.\n * 6. Create document global for tracking document cache size.\n * 7. Ensure every cached document has a sentinel row with a sequence number.\n * 8. Add collection-parent index for Collection Group queries.\n * 9. Change RemoteDocumentChanges store to be keyed by readTime rather than\n * an auto-incrementing ID. This is required for Index-Free queries.\n * 10. Rewrite the canonical IDs to the explicit Protobuf-based format.\n * 11. Add bundles and named_queries for bundle support.\n */\n\n/**\n * Wrapper class to store timestamps (seconds and nanos) in IndexedDb objects.\n */\n\n\nvar er = function er(t, e) {\n this.seconds = t, this.nanoseconds = e;\n},\n nr = function nr(t,\n/** Whether to allow shared access from multiple tabs. */\ne, n) {\n this.ownerId = t, this.allowTabSynchronization = e, this.leaseTimestampMs = n;\n};\n/**\n * A singleton object to be stored in the 'owner' store in IndexedDb.\n *\n * A given database can have a single primary tab assigned at a given time. That\n * tab must validate that it is still holding the primary lease before every\n * operation that requires locked access. The primary tab should regularly\n * write an updated timestamp to this lease to prevent other tabs from\n * \"stealing\" the primary lease\n */\n\n/**\n * Name of the IndexedDb object store.\n *\n * Note that the name 'owner' is chosen to ensure backwards compatibility with\n * older clients that only supported single locked access to the persistence\n * layer.\n */\n\n\nnr.store = \"owner\",\n/**\n * The key string used for the single object that exists in the\n * DbPrimaryClient store.\n */\nnr.key = \"owner\";\n/**\n * An object to be stored in the 'mutationQueues' store in IndexedDb.\n *\n * Each user gets a single queue of MutationBatches to apply to the server.\n * DbMutationQueue tracks the metadata about the queue.\n */\n\nvar rr = function rr(\n/**\n * The normalized user ID to which this queue belongs.\n */\nt,\n/**\n * An identifier for the highest numbered batch that has been acknowledged\n * by the server. All MutationBatches in this queue with batchIds less\n * than or equal to this value are considered to have been acknowledged by\n * the server.\n *\n * NOTE: this is deprecated and no longer used by the code.\n */\ne,\n/**\n * A stream token that was previously sent by the server.\n *\n * See StreamingWriteRequest in datastore.proto for more details about\n * usage.\n *\n * After sending this token, earlier tokens may not be used anymore so\n * only a single stream token is retained.\n *\n * NOTE: this is deprecated and no longer used by the code.\n */\nn) {\n this.userId = t, this.lastAcknowledgedBatchId = e, this.lastStreamToken = n;\n};\n/** Name of the IndexedDb object store. */\n\n\nrr.store = \"mutationQueues\",\n/** Keys are automatically assigned via the userId property. */\nrr.keyPath = \"userId\";\n/**\n * An object to be stored in the 'mutations' store in IndexedDb.\n *\n * Represents a batch of user-level mutations intended to be sent to the server\n * in a single write. Each user-level batch gets a separate DbMutationBatch\n * with a new batchId.\n */\n\nvar ir = function ir(\n/**\n * The normalized user ID to which this batch belongs.\n */\nt,\n/**\n * An identifier for this batch, allocated using an auto-generated key.\n */\ne,\n/**\n * The local write time of the batch, stored as milliseconds since the\n * epoch.\n */\nn,\n/**\n * A list of \"mutations\" that represent a partial base state from when this\n * write batch was initially created. During local application of the write\n * batch, these baseMutations are applied prior to the real writes in order\n * to override certain document fields from the remote document cache. This\n * is necessary in the case of non-idempotent writes (e.g. `increment()`\n * transforms) to make sure that the local view of the modified documents\n * doesn't flicker if the remote document cache receives the result of the\n * non-idempotent write before the write is removed from the queue.\n *\n * These mutations are never sent to the backend.\n */\nr,\n/**\n * A list of mutations to apply. All mutations will be applied atomically.\n *\n * Mutations are serialized via toMutation().\n */\ni) {\n this.userId = t, this.batchId = e, this.localWriteTimeMs = n, this.baseMutations = r, this.mutations = i;\n};\n/** Name of the IndexedDb object store. */\n\n\nir.store = \"mutations\",\n/** Keys are automatically assigned via the userId, batchId properties. */\nir.keyPath = \"batchId\",\n/** The index name for lookup of mutations by user. */\nir.userMutationsIndex = \"userMutationsIndex\",\n/** The user mutations index is keyed by [userId, batchId] pairs. */\nir.userMutationsKeyPath = [\"userId\", \"batchId\"];\n/**\n * An object to be stored in the 'documentMutations' store in IndexedDb.\n *\n * A manually maintained index of all the mutation batches that affect a given\n * document key. The rows in this table are references based on the contents of\n * DbMutationBatch.mutations.\n */\n\nvar or =\n/** @class */\nfunction () {\n function t() {}\n /**\n * Creates a [userId] key for use in the DbDocumentMutations index to iterate\n * over all of a user's document mutations.\n */\n\n\n return t.prefixForUser = function (t) {\n return [t];\n },\n /**\n * Creates a [userId, encodedPath] key for use in the DbDocumentMutations\n * index to iterate over all at document mutations for a given path or lower.\n */\n t.prefixForPath = function (t, e) {\n return [t, Xn(e)];\n },\n /**\n * Creates a full index key of [userId, encodedPath, batchId] for inserting\n * and deleting into the DbDocumentMutations index.\n */\n t.key = function (t, e, n) {\n return [t, Xn(e), n];\n }, t;\n}();\n\nor.store = \"documentMutations\",\n/**\n * Because we store all the useful information for this store in the key,\n * there is no useful information to store as the value. The raw (unencoded)\n * path cannot be stored because IndexedDb doesn't store prototype\n * information.\n */\nor.PLACEHOLDER = new or();\n/**\n * Represents the known absence of a document at a particular version.\n * Stored in IndexedDb as part of a DbRemoteDocument object.\n */\n\nvar sr = function sr(t, e) {\n this.path = t, this.readTime = e;\n},\n ur = function ur(t, e) {\n this.path = t, this.version = e;\n},\n ar = // TODO: We are currently storing full document keys almost three times\n// (once as part of the primary key, once - partly - as `parentPath` and once\n// inside the encoded documents). During our next migration, we should\n// rewrite the primary key as parentPath + document ID which would allow us\n// to drop one value.\nfunction ar(\n/**\n * Set to an instance of DbUnknownDocument if the data for a document is\n * not known, but it is known that a document exists at the specified\n * version (e.g. it had a successful update applied to it)\n */\nt,\n/**\n * Set to an instance of a DbNoDocument if it is known that no document\n * exists.\n */\ne,\n/**\n * Set to an instance of a Document if there's a cached version of the\n * document.\n */\nn,\n/**\n * Documents that were written to the remote document store based on\n * a write acknowledgment are marked with `hasCommittedMutations`. These\n * documents are potentially inconsistent with the backend's copy and use\n * the write's commit version as their document version.\n */\nr,\n/**\n * When the document was read from the backend. Undefined for data written\n * prior to schema version 9.\n */\ni,\n/**\n * The path of the collection this document is part of. Undefined for data\n * written prior to schema version 9.\n */\no) {\n this.unknownDocument = t, this.noDocument = e, this.document = n, this.hasCommittedMutations = r, this.readTime = i, this.parentPath = o;\n};\n/**\n * Represents a document that is known to exist but whose data is unknown.\n * Stored in IndexedDb as part of a DbRemoteDocument object.\n */\n\n\nar.store = \"remoteDocuments\",\n/**\n * An index that provides access to all entries sorted by read time (which\n * corresponds to the last modification time of each row).\n *\n * This index is used to provide a changelog for Multi-Tab.\n */\nar.readTimeIndex = \"readTimeIndex\", ar.readTimeIndexPath = \"readTime\",\n/**\n * An index that provides access to documents in a collection sorted by read\n * time.\n *\n * This index is used to allow the RemoteDocumentCache to fetch newly changed\n * documents in a collection.\n */\nar.collectionReadTimeIndex = \"collectionReadTimeIndex\", ar.collectionReadTimeIndexPath = [\"parentPath\", \"readTime\"];\n/**\n * Contains a single entry that has metadata about the remote document cache.\n */\n\nvar cr =\n/**\n * @param byteSize - Approximately the total size in bytes of all the\n * documents in the document cache.\n */\nfunction cr(t) {\n this.byteSize = t;\n};\n\ncr.store = \"remoteDocumentGlobal\", cr.key = \"remoteDocumentGlobalKey\";\n/**\n * An object to be stored in the 'targets' store in IndexedDb.\n *\n * This is based on and should be kept in sync with the proto used in the iOS\n * client.\n *\n * Each query the client listens to against the server is tracked on disk so\n * that the query can be efficiently resumed on restart.\n */\n\nvar hr = function hr(\n/**\n * An auto-generated sequential numeric identifier for the query.\n *\n * Queries are stored using their canonicalId as the key, but these\n * canonicalIds can be quite long so we additionally assign a unique\n * queryId which can be used by referenced data structures (e.g.\n * indexes) to minimize the on-disk cost.\n */\nt,\n/**\n * The canonical string representing this query. This is not unique.\n */\ne,\n/**\n * The last readTime received from the Watch Service for this query.\n *\n * This is the same value as TargetChange.read_time in the protos.\n */\nn,\n/**\n * An opaque, server-assigned token that allows watching a query to be\n * resumed after disconnecting without retransmitting all the data\n * that matches the query. The resume token essentially identifies a\n * point in time from which the server should resume sending results.\n *\n * This is related to the snapshotVersion in that the resumeToken\n * effectively also encodes that value, but the resumeToken is opaque\n * and sometimes encodes additional information.\n *\n * A consequence of this is that the resumeToken should be used when\n * asking the server to reason about where this client is in the watch\n * stream, but the client should use the snapshotVersion for its own\n * purposes.\n *\n * This is the same value as TargetChange.resume_token in the protos.\n */\nr,\n/**\n * A sequence number representing the last time this query was\n * listened to, used for garbage collection purposes.\n *\n * Conventionally this would be a timestamp value, but device-local\n * clocks are unreliable and they must be able to create new listens\n * even while disconnected. Instead this should be a monotonically\n * increasing number that's incremented on each listen call.\n *\n * This is different from the queryId since the queryId is an\n * immutable identifier assigned to the Query on first use while\n * lastListenSequenceNumber is updated every time the query is\n * listened to.\n */\ni,\n/**\n * Denotes the maximum snapshot version at which the associated query view\n * contained no limbo documents. Undefined for data written prior to\n * schema version 9.\n */\no,\n/**\n * The query for this target.\n *\n * Because canonical ids are not unique we must store the actual query. We\n * use the proto to have an object we can persist without having to\n * duplicate translation logic to and from a `Query` object.\n */\ns) {\n this.targetId = t, this.canonicalId = e, this.readTime = n, this.resumeToken = r, this.lastListenSequenceNumber = i, this.lastLimboFreeSnapshotVersion = o, this.query = s;\n};\n\nhr.store = \"targets\",\n/** Keys are automatically assigned via the targetId property. */\nhr.keyPath = \"targetId\",\n/** The name of the queryTargets index. */\nhr.queryTargetsIndexName = \"queryTargetsIndex\",\n/**\n * The index of all canonicalIds to the targets that they match. This is not\n * a unique mapping because canonicalId does not promise a unique name for all\n * possible queries, so we append the targetId to make the mapping unique.\n */\nhr.queryTargetsKeyPath = [\"canonicalId\", \"targetId\"];\n/**\n * An object representing an association between a target and a document, or a\n * sentinel row marking the last sequence number at which a document was used.\n * Each document cached must have a corresponding sentinel row before lru\n * garbage collection is enabled.\n *\n * The target associations and sentinel rows are co-located so that orphaned\n * documents and their sequence numbers can be identified efficiently via a scan\n * of this store.\n */\n\nvar fr = function fr(\n/**\n * The targetId identifying a target or 0 for a sentinel row.\n */\nt,\n/**\n * The path to the document, as encoded in the key.\n */\ne,\n/**\n * If this is a sentinel row, this should be the sequence number of the last\n * time the document specified by `path` was used. Otherwise, it should be\n * `undefined`.\n */\nn) {\n this.targetId = t, this.path = e, this.sequenceNumber = n;\n};\n/** Name of the IndexedDb object store. */\n\n\nfr.store = \"targetDocuments\",\n/** Keys are automatically assigned via the targetId, path properties. */\nfr.keyPath = [\"targetId\", \"path\"],\n/** The index name for the reverse index. */\nfr.documentTargetsIndex = \"documentTargetsIndex\",\n/** We also need to create the reverse index for these properties. */\nfr.documentTargetsKeyPath = [\"path\", \"targetId\"];\n/**\n * A record of global state tracked across all Targets, tracked separately\n * to avoid the need for extra indexes.\n *\n * This should be kept in-sync with the proto used in the iOS client.\n */\n\nvar lr = function lr(\n/**\n * The highest numbered target id across all targets.\n *\n * See DbTarget.targetId.\n */\nt,\n/**\n * The highest numbered lastListenSequenceNumber across all targets.\n *\n * See DbTarget.lastListenSequenceNumber.\n */\ne,\n/**\n * A global snapshot version representing the last consistent snapshot we\n * received from the backend. This is monotonically increasing and any\n * snapshots received from the backend prior to this version (e.g. for\n * targets resumed with a resumeToken) should be suppressed (buffered)\n * until the backend has caught up to this snapshot version again. This\n * prevents our cache from ever going backwards in time.\n */\nn,\n/**\n * The number of targets persisted.\n */\nr) {\n this.highestTargetId = t, this.highestListenSequenceNumber = e, this.lastRemoteSnapshotVersion = n, this.targetCount = r;\n};\n/**\n * The key string used for the single object that exists in the\n * DbTargetGlobal store.\n */\n\n\nlr.key = \"targetGlobalKey\", lr.store = \"targetGlobal\";\n/**\n * An object representing an association between a Collection id (e.g. 'messages')\n * to a parent path (e.g. '/chats/123') that contains it as a (sub)collection.\n * This is used to efficiently find all collections to query when performing\n * a Collection Group query.\n */\n\nvar dr = function dr(\n/**\n * The collectionId (e.g. 'messages')\n */\nt,\n/**\n * The path to the parent (either a document location or an empty path for\n * a root-level collection).\n */\ne) {\n this.collectionId = t, this.parent = e;\n};\n/** Name of the IndexedDb object store. */\n\n\ndr.store = \"collectionParents\",\n/** Keys are automatically assigned via the collectionId, parent properties. */\ndr.keyPath = [\"collectionId\", \"parent\"];\n/**\n * A record of the metadata state of each client.\n *\n * PORTING NOTE: This is used to synchronize multi-tab state and does not need\n * to be ported to iOS or Android.\n */\n\nvar pr = function pr( // Note: Previous schema versions included a field\n// \"lastProcessedDocumentChangeId\". Don't use anymore.\n\n/** The auto-generated client id assigned at client startup. */\nt,\n/** The last time this state was updated. */\ne,\n/** Whether the client's network connection is enabled. */\nn,\n/** Whether this client is running in a foreground tab. */\nr) {\n this.clientId = t, this.updateTimeMs = e, this.networkEnabled = n, this.inForeground = r;\n};\n/** Name of the IndexedDb object store. */\n\n\npr.store = \"clientMetadata\",\n/** Keys are automatically assigned via the clientId properties. */\npr.keyPath = \"clientId\";\n/**\n * A object representing a bundle loaded by the SDK.\n */\n\nvar yr = function yr(\n/** The ID of the loaded bundle. */\nt,\n/** The create time of the loaded bundle. */\ne,\n/** The schema version of the loaded bundle. */\nn) {\n this.bundleId = t, this.createTime = e, this.version = n;\n};\n/** Name of the IndexedDb object store. */\n\n\nyr.store = \"bundles\", yr.keyPath = \"bundleId\";\n/**\n * A object representing a named query loaded by the SDK via a bundle.\n */\n\nvar vr = function vr(\n/** The name of the query. */\nt,\n/** The read time of the results saved in the bundle from the named query. */\ne,\n/** The query saved in the bundle. */\nn) {\n this.name = t, this.readTime = e, this.bundledQuery = n;\n};\n/** Name of the IndexedDb object store. */\n\n\nvr.store = \"namedQueries\", vr.keyPath = \"name\"; // Visible for testing\n\nvar mr = e(e([], e(e([], e(e([], e(e([], [rr.store, ir.store, or.store, ar.store, hr.store, nr.store, lr.store, fr.store]), [pr.store])), [cr.store])), [dr.store])), [yr.store, vr.store]),\n gr = \"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.\",\n wr =\n/** @class */\nfunction () {\n function t() {\n this.onCommittedListeners = [];\n }\n\n return t.prototype.addOnCommittedListener = function (t) {\n this.onCommittedListeners.push(t);\n }, t.prototype.raiseOnCommittedEvent = function () {\n this.onCommittedListeners.forEach(function (t) {\n return t();\n });\n }, t;\n}(),\n br = function br() {\n var t = this;\n this.promise = new Promise(function (e, n) {\n t.resolve = e, t.reject = n;\n });\n},\n Ir =\n/** @class */\nfunction () {\n function t(t) {\n var e = this; // NOTE: next/catchCallback will always point to our own wrapper functions,\n // not the user's raw next() or catch() callbacks.\n\n this.nextCallback = null, this.catchCallback = null, // When the operation resolves, we'll set result or error and mark isDone.\n this.result = void 0, this.error = void 0, this.isDone = !1, // Set to true when .then() or .catch() are called and prevents additional\n // chaining.\n this.callbackAttached = !1, t(function (t) {\n e.isDone = !0, e.result = t, e.nextCallback && // value should be defined unless T is Void, but we can't express\n // that in the type system.\n e.nextCallback(t);\n }, function (t) {\n e.isDone = !0, e.error = t, e.catchCallback && e.catchCallback(t);\n });\n }\n\n return t.prototype.catch = function (t) {\n return this.next(void 0, t);\n }, t.prototype.next = function (e, n) {\n var r = this;\n return this.callbackAttached && O(), this.callbackAttached = !0, this.isDone ? this.error ? this.wrapFailure(n, this.error) : this.wrapSuccess(e, this.result) : new t(function (t, i) {\n r.nextCallback = function (n) {\n r.wrapSuccess(e, n).next(t, i);\n }, r.catchCallback = function (e) {\n r.wrapFailure(n, e).next(t, i);\n };\n });\n }, t.prototype.toPromise = function () {\n var t = this;\n return new Promise(function (e, n) {\n t.next(e, n);\n });\n }, t.prototype.wrapUserFunction = function (e) {\n try {\n var n = e();\n return n instanceof t ? n : t.resolve(n);\n } catch (e) {\n return t.reject(e);\n }\n }, t.prototype.wrapSuccess = function (e, n) {\n return e ? this.wrapUserFunction(function () {\n return e(n);\n }) : t.resolve(n);\n }, t.prototype.wrapFailure = function (e, n) {\n return e ? this.wrapUserFunction(function () {\n return e(n);\n }) : t.reject(n);\n }, t.resolve = function (e) {\n return new t(function (t, n) {\n t(e);\n });\n }, t.reject = function (e) {\n return new t(function (t, n) {\n n(e);\n });\n }, t.waitFor = function ( // Accept all Promise types in waitFor().\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n e) {\n return new t(function (t, n) {\n var r = 0,\n i = 0,\n o = !1;\n e.forEach(function (e) {\n ++r, e.next(function () {\n ++i, o && i === r && t();\n }, function (t) {\n return n(t);\n });\n }), o = !0, i === r && t();\n });\n },\n /**\n * Given an array of predicate functions that asynchronously evaluate to a\n * boolean, implements a short-circuiting `or` between the results. Predicates\n * will be evaluated until one of them returns `true`, then stop. The final\n * result will be whether any of them returned `true`.\n */\n t.or = function (e) {\n for (var n = t.resolve(!1), r = function r(e) {\n n = n.next(function (n) {\n return n ? t.resolve(n) : e();\n });\n }, i = 0, o = e; i < o.length; i++) {\n r(o[i]);\n }\n\n return n;\n }, t.forEach = function (t, e) {\n var n = this,\n r = [];\n return t.forEach(function (t, i) {\n r.push(e.call(n, t, i));\n }), this.waitFor(r);\n }, t;\n}(),\n Tr =\n/** @class */\nfunction () {\n function t(t, e) {\n var n = this;\n this.action = t, this.transaction = e, this.aborted = !1,\n /**\n * A promise that resolves with the result of the IndexedDb transaction.\n */\n this.ft = new br(), this.transaction.oncomplete = function () {\n n.ft.resolve();\n }, this.transaction.onabort = function () {\n e.error ? n.ft.reject(new Sr(t, e.error)) : n.ft.resolve();\n }, this.transaction.onerror = function (e) {\n var r = Cr(e.target.error);\n n.ft.reject(new Sr(t, r));\n };\n }\n\n return t.open = function (e, n, r, i) {\n try {\n return new t(n, e.transaction(i, r));\n } catch (e) {\n throw new Sr(n, e);\n }\n }, Object.defineProperty(t.prototype, \"dt\", {\n get: function get() {\n return this.ft.promise;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.abort = function (t) {\n t && this.ft.reject(t), this.aborted || (C(\"SimpleDb\", \"Aborting transaction:\", t ? t.message : \"Client-initiated abort\"), this.aborted = !0, this.transaction.abort());\n },\n /**\n * Returns a SimpleDbStore for the specified store. All\n * operations performed on the SimpleDbStore happen within the context of this\n * transaction and it cannot be used anymore once the transaction is\n * completed.\n *\n * Note that we can't actually enforce that the KeyType and ValueType are\n * correct, but they allow type safety through the rest of the consuming code.\n */\n t.prototype.store = function (t) {\n var e = this.transaction.objectStore(t);\n return new Dr(e);\n }, t;\n}(),\n Er =\n/** @class */\nfunction () {\n /*\n * Creates a new SimpleDb wrapper for IndexedDb database `name`.\n *\n * Note that `version` must not be a downgrade. IndexedDB does not support\n * downgrading the schema version. We currently do not support any way to do\n * versioning outside of IndexedDB's versioning mechanism, as only\n * version-upgrade transactions are allowed to do things like create\n * objectstores.\n */\n function t(e, n, r) {\n this.name = e, this.version = n, this.wt = r, // NOTE: According to https://bugs.webkit.org/show_bug.cgi?id=197050, the\n // bug we're checking for should exist in iOS >= 12.2 and < 13, but for\n // whatever reason it's much harder to hit after 12.2 so we only proactively\n // log on 12.2.\n 12.2 === t._t(i()) && x(\"Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.\");\n }\n /** Deletes the specified database. */\n\n\n return t.delete = function (t) {\n return C(\"SimpleDb\", \"Removing database:\", t), Ar(window.indexedDB.deleteDatabase(t)).toPromise();\n },\n /** Returns true if IndexedDB is available in the current environment. */\n t.yt = function () {\n if (\"undefined\" == typeof indexedDB) return !1;\n if (t.gt()) return !0; // We extensively use indexed array values and compound keys,\n // which IE and Edge do not support. However, they still have indexedDB\n // defined on the window, so we need to check for them here and make sure\n // to return that persistence is not enabled for those browsers.\n // For tracking support of this feature, see here:\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/\n // Check the UA string to find out the browser.\n\n var e = i(),\n n = t._t(e),\n r = 0 < n && n < 10,\n o = t.Et(e),\n s = 0 < o && o < 4.5; // IE 10\n // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';\n // IE 11\n // ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';\n // Edge\n // ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML,\n // like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0';\n // iOS Safari: Disable for users running iOS version < 10.\n\n\n return !(e.indexOf(\"MSIE \") > 0 || e.indexOf(\"Trident/\") > 0 || e.indexOf(\"Edge/\") > 0 || r || s);\n },\n /**\n * Returns true if the backing IndexedDB store is the Node IndexedDBShim\n * (see https://github.com/axemclion/IndexedDBShim).\n */\n t.gt = function () {\n var t;\n return \"undefined\" != typeof process && \"YES\" === (null === (t = process.env) || void 0 === t ? void 0 : t.Tt);\n },\n /** Helper to get a typed SimpleDbStore from a transaction. */\n t.It = function (t, e) {\n return t.store(e);\n }, // visible for testing\n\n /** Parse User Agent to determine iOS version. Returns -1 if not found. */\n t._t = function (t) {\n var e = t.match(/i(?:phone|pad|pod) os ([\\d_]+)/i),\n n = e ? e[1].split(\"_\").slice(0, 2).join(\".\") : \"-1\";\n return Number(n);\n }, // visible for testing\n\n /** Parse User Agent to determine Android version. Returns -1 if not found. */\n t.Et = function (t) {\n var e = t.match(/Android ([\\d.]+)/i),\n n = e ? e[1].split(\".\").slice(0, 2).join(\".\") : \"-1\";\n return Number(n);\n },\n /**\n * Opens the specified database, creating or upgrading it if necessary.\n */\n t.prototype.At = function (t) {\n return n(this, void 0, void 0, function () {\n var e,\n n = this;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return this.db ? [3\n /*break*/\n , 2] : (C(\"SimpleDb\", \"Opening database:\", this.name), e = this, [4\n /*yield*/\n , new Promise(function (e, r) {\n // TODO(mikelehen): Investigate browser compatibility.\n // https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB\n // suggests IE9 and older WebKit browsers handle upgrade\n // differently. They expect setVersion, as described here:\n // https://developer.mozilla.org/en-US/docs/Web/API/IDBVersionChangeRequest/setVersion\n var i = indexedDB.open(n.name, n.version);\n i.onsuccess = function (t) {\n var n = t.target.result;\n e(n);\n }, i.onblocked = function () {\n r(new Sr(t, \"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed.\"));\n }, i.onerror = function (e) {\n var n = e.target.error;\n \"VersionError\" === n.name ? r(new D(N.FAILED_PRECONDITION, \"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.\")) : r(new Sr(t, n));\n }, i.onupgradeneeded = function (t) {\n C(\"SimpleDb\", 'Database \"' + n.name + '\" requires upgrade from version:', t.oldVersion);\n var e = t.target.result;\n n.wt.Rt(e, i.transaction, t.oldVersion, n.version).next(function () {\n C(\"SimpleDb\", \"Database upgrade to version \" + n.version + \" complete\");\n });\n };\n })]);\n\n case 1:\n e.db = r.sent(), r.label = 2;\n\n case 2:\n return [2\n /*return*/\n , (this.bt && (this.db.onversionchange = function (t) {\n return n.bt(t);\n }), this.db)];\n }\n });\n });\n }, t.prototype.vt = function (t) {\n this.bt = t, this.db && (this.db.onversionchange = function (e) {\n return t(e);\n });\n }, t.prototype.runTransaction = function (t, e, i, o) {\n return n(this, void 0, void 0, function () {\n var n, s, u, a, c;\n return r(this, function (h) {\n switch (h.label) {\n case 0:\n n = \"readonly\" === e, s = 0, u = function u() {\n var e, u, c, h, f;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n ++s, r.label = 1;\n\n case 1:\n return r.trys.push([1, 4,, 5]), [4\n /*yield*/\n , a.At(t)];\n\n case 2:\n // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to\n // fire), but still return the original transactionFnResult back to the\n // caller.\n return a.db = r.sent(), e = Tr.open(a.db, t, n ? \"readonly\" : \"readwrite\", i), u = o(e).catch(function (t) {\n // Abort the transaction if there was an error.\n return e.abort(t), Ir.reject(t);\n }).toPromise(), c = {}, u.catch(function () {}), [4\n /*yield*/\n , e.dt];\n\n case 3:\n return [2\n /*return*/\n , (c.value = ( // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to\n // fire), but still return the original transactionFnResult back to the\n // caller.\n r.sent(), u), c)];\n\n case 4:\n return h = r.sent(), f = \"FirebaseError\" !== h.name && s < 3, C(\"SimpleDb\", \"Transaction failed with error:\", h.message, \"Retrying:\", f), a.close(), f ? [3\n /*break*/\n , 5] : [2\n /*return*/\n , {\n value: Promise.reject(h)\n }];\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n }, a = this, h.label = 1;\n\n case 1:\n return [5\n /*yield**/\n , u()];\n\n case 2:\n if (\"object\" == typeof (c = h.sent())) return [2\n /*return*/\n , c.value];\n h.label = 3;\n\n case 3:\n return [3\n /*break*/\n , 1];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n }, t.prototype.close = function () {\n this.db && this.db.close(), this.db = void 0;\n }, t;\n}(),\n _r =\n/** @class */\nfunction () {\n function t(t) {\n this.Pt = t, this.Vt = !1, this.St = null;\n }\n\n return Object.defineProperty(t.prototype, \"isDone\", {\n get: function get() {\n return this.Vt;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"Dt\", {\n get: function get() {\n return this.St;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"cursor\", {\n set: function set(t) {\n this.Pt = t;\n },\n enumerable: !1,\n configurable: !0\n }),\n /**\n * This function can be called to stop iteration at any point.\n */\n t.prototype.done = function () {\n this.Vt = !0;\n },\n /**\n * This function can be called to skip to that next key, which could be\n * an index or a primary key.\n */\n t.prototype.Ct = function (t) {\n this.St = t;\n },\n /**\n * Delete the current cursor value from the object store.\n *\n * NOTE: You CANNOT do this with a keysOnly query.\n */\n t.prototype.delete = function () {\n return Ar(this.Pt.delete());\n }, t;\n}(),\n Sr =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, N.UNAVAILABLE, \"IndexedDB transaction '\" + t + \"' failed: \" + n) || this).name = \"IndexedDbTransactionError\", r;\n }\n\n return t(n, e), n;\n}(D); // V2 is no longer usable (see comment at top of file)\n// Visible for testing\n\n/**\n * A base class representing a persistence transaction, encapsulating both the\n * transaction's sequence numbers as well as a list of onCommitted listeners.\n *\n * When you call Persistence.runTransaction(), it will create a transaction and\n * pass it to your callback. You then pass it to any method that operates\n * on persistence.\n */\n\n/** Verifies whether `e` is an IndexedDbTransactionError. */\n\n\nfunction Nr(t) {\n // Use name equality, as instanceof checks on errors don't work with errors\n // that wrap other errors.\n return \"IndexedDbTransactionError\" === t.name;\n}\n/**\n * A wrapper around an IDBObjectStore providing an API that:\n *\n * 1) Has generic KeyType / ValueType parameters to provide strongly-typed\n * methods for acting against the object store.\n * 2) Deals with IndexedDB's onsuccess / onerror event callbacks, making every\n * method return a PersistencePromise instead.\n * 3) Provides a higher-level API to avoid needing to do excessive wrapping of\n * intermediate IndexedDB types (IDBCursorWithValue, etc.)\n */\n\n\nvar Dr =\n/** @class */\nfunction () {\n function t(t) {\n this.store = t;\n }\n\n return t.prototype.put = function (t, e) {\n var n;\n return void 0 !== e ? (C(\"SimpleDb\", \"PUT\", this.store.name, t, e), n = this.store.put(e, t)) : (C(\"SimpleDb\", \"PUT\", this.store.name, \"\", t), n = this.store.put(t)), Ar(n);\n },\n /**\n * Adds a new value into an Object Store and returns the new key. Similar to\n * IndexedDb's `add()`, this method will fail on primary key collisions.\n *\n * @param value - The object to write.\n * @returns The key of the value to add.\n */\n t.prototype.add = function (t) {\n return C(\"SimpleDb\", \"ADD\", this.store.name, t, t), Ar(this.store.add(t));\n },\n /**\n * Gets the object with the specified key from the specified store, or null\n * if no object exists with the specified key.\n *\n * @key The key of the object to get.\n * @returns The object with the specified key or null if no object exists.\n */\n t.prototype.get = function (t) {\n var e = this; // We're doing an unsafe cast to ValueType.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n return Ar(this.store.get(t)).next(function (n) {\n // Normalize nonexistence to null.\n return void 0 === n && (n = null), C(\"SimpleDb\", \"GET\", e.store.name, t, n), n;\n });\n }, t.prototype.delete = function (t) {\n return C(\"SimpleDb\", \"DELETE\", this.store.name, t), Ar(this.store.delete(t));\n },\n /**\n * If we ever need more of the count variants, we can add overloads. For now,\n * all we need is to count everything in a store.\n *\n * Returns the number of rows in the store.\n */\n t.prototype.count = function () {\n return C(\"SimpleDb\", \"COUNT\", this.store.name), Ar(this.store.count());\n }, t.prototype.Nt = function (t, e) {\n var n = this.cursor(this.options(t, e)),\n r = [];\n return this.xt(n, function (t, e) {\n r.push(e);\n }).next(function () {\n return r;\n });\n }, t.prototype.kt = function (t, e) {\n C(\"SimpleDb\", \"DELETE ALL\", this.store.name);\n var n = this.options(t, e);\n n.Ft = !1;\n var r = this.cursor(n);\n return this.xt(r, function (t, e, n) {\n return n.delete();\n });\n }, t.prototype.$t = function (t, e) {\n var n;\n e ? n = t : (n = {}, e = t);\n var r = this.cursor(n);\n return this.xt(r, e);\n },\n /**\n * Iterates over a store, but waits for the given callback to complete for\n * each entry before iterating the next entry. This allows the callback to do\n * asynchronous work to determine if this iteration should continue.\n *\n * The provided callback should return `true` to continue iteration, and\n * `false` otherwise.\n */\n t.prototype.Ot = function (t) {\n var e = this.cursor({});\n return new Ir(function (n, r) {\n e.onerror = function (t) {\n var e = Cr(t.target.error);\n r(e);\n }, e.onsuccess = function (e) {\n var r = e.target.result;\n r ? t(r.primaryKey, r.value).next(function (t) {\n t ? r.continue() : n();\n }) : n();\n };\n });\n }, t.prototype.xt = function (t, e) {\n var n = [];\n return new Ir(function (r, i) {\n t.onerror = function (t) {\n i(t.target.error);\n }, t.onsuccess = function (t) {\n var i = t.target.result;\n\n if (i) {\n var o = new _r(i),\n s = e(i.primaryKey, i.value, o);\n\n if (s instanceof Ir) {\n var u = s.catch(function (t) {\n return o.done(), Ir.reject(t);\n });\n n.push(u);\n }\n\n o.isDone ? r() : null === o.Dt ? i.continue() : i.continue(o.Dt);\n } else r();\n };\n }).next(function () {\n return Ir.waitFor(n);\n });\n }, t.prototype.options = function (t, e) {\n var n;\n return void 0 !== t && (\"string\" == typeof t ? n = t : e = t), {\n index: n,\n range: e\n };\n }, t.prototype.cursor = function (t) {\n var e = \"next\";\n\n if (t.reverse && (e = \"prev\"), t.index) {\n var n = this.store.index(t.index);\n return t.Ft ? n.openKeyCursor(t.range, e) : n.openCursor(t.range, e);\n }\n\n return this.store.openCursor(t.range, e);\n }, t;\n}();\n/**\n * Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror\n * handlers to resolve / reject the PersistencePromise as appropriate.\n */\n\n\nfunction Ar(t) {\n return new Ir(function (e, n) {\n t.onsuccess = function (t) {\n var n = t.target.result;\n e(n);\n }, t.onerror = function (t) {\n var e = Cr(t.target.error);\n n(e);\n };\n });\n} // Guard so we only report the error once.\n\n\nvar kr = !1;\n\nfunction Cr(t) {\n var e = Er._t(i());\n\n if (e >= 12.2 && e < 13) {\n var n = \"An internal error was encountered in the Indexed Database server\";\n\n if (t.message.indexOf(n) >= 0) {\n // Wrap error in a more descriptive one.\n var r = new D(\"internal\", \"IOS_INDEXEDDB_BUG1: IndexedDb has thrown '\" + n + \"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.\");\n return kr || (kr = !0, // Throw a global exception outside of this promise chain, for the user to\n // potentially catch.\n setTimeout(function () {\n throw r;\n }, 0)), r;\n }\n }\n\n return t;\n}\n/**\n * @license\n * Copyright 2020 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\nvar xr =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).Mt = t, r.currentSequenceNumber = n, r;\n }\n\n return t(n, e), n;\n}(wr);\n\nfunction Rr(t, e) {\n var n = F(t);\n return Er.It(n.Mt, e);\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/**\n * A batch of mutations that will be sent as one unit to the backend.\n */\n\n\nvar Lr =\n/** @class */\nfunction () {\n /**\n * @param batchId - The unique ID of this mutation batch.\n * @param localWriteTime - The original write time of this mutation.\n * @param baseMutations - Mutations that are used to populate the base\n * values when this mutation is applied locally. This can be used to locally\n * overwrite values that are persisted in the remote document cache. Base\n * mutations are never sent to the backend.\n * @param mutations - The user-provided mutations in this mutation batch.\n * User-provided mutations are applied both locally and remotely on the\n * backend.\n */\n function t(t, e, n, r) {\n this.batchId = t, this.localWriteTime = e, this.baseMutations = n, this.mutations = r\n /**\n * Applies all the mutations in this MutationBatch to the specified document\n * to compute the state of the remote document\n *\n * @param document - The document to apply mutations to.\n * @param batchResult - The result of applying the MutationBatch to the\n * backend.\n */\n ;\n }\n\n return t.prototype.applyToRemoteDocument = function (t, e) {\n for (var n = e.mutationResults, r = 0; r < this.mutations.length; r++) {\n var i = this.mutations[r];\n i.key.isEqual(t.key) && Ce(i, t, n[r]);\n }\n },\n /**\n * Computes the local view of a document given all the mutations in this\n * batch.\n *\n * @param document - The document to apply mutations to.\n */\n t.prototype.applyToLocalView = function (t) {\n // First, apply the base state. This allows us to apply non-idempotent\n // transform against a consistent set of values.\n for (var e = 0, n = this.baseMutations; e < n.length; e++) {\n (o = n[e]).key.isEqual(t.key) && xe(o, t, this.localWriteTime);\n } // Second, apply all user-provided mutations.\n\n\n for (var r = 0, i = this.mutations; r < i.length; r++) {\n var o;\n (o = i[r]).key.isEqual(t.key) && xe(o, t, this.localWriteTime);\n }\n },\n /**\n * Computes the local view for all provided documents given the mutations in\n * this batch.\n */\n t.prototype.applyToLocalDocumentSet = function (t) {\n var e = this; // TODO(mrschmidt): This implementation is O(n^2). If we apply the mutations\n // directly (as done in `applyToLocalView()`), we can reduce the complexity\n // to O(n).\n\n this.mutations.forEach(function (n) {\n var r = t.get(n.key),\n i = r; // TODO(mutabledocuments): This method should take a MutableDocumentMap\n // and we should remove this cast.\n\n e.applyToLocalView(i), r.isValidDocument() || i.convertToNoDocument(K.min());\n });\n }, t.prototype.keys = function () {\n return this.mutations.reduce(function (t, e) {\n return t.add(e.key);\n }, sn());\n }, t.prototype.isEqual = function (t) {\n return this.batchId === t.batchId && U(this.mutations, t.mutations, function (t, e) {\n return Le(t, e);\n }) && U(this.baseMutations, t.baseMutations, function (t, e) {\n return Le(t, e);\n });\n }, t;\n}(),\n Or =\n/** @class */\nfunction () {\n function t(t, e, n,\n /**\n * A pre-computed mapping from each mutated document to the resulting\n * version.\n */\n r) {\n this.batch = t, this.commitVersion = e, this.mutationResults = n, this.docVersions = r\n /**\n * Creates a new MutationBatchResult for the given batch and results. There\n * must be one result for each mutation in the batch. This static factory\n * caches a document=>version mapping (docVersions).\n */\n ;\n }\n\n return t.from = function (e, n, r) {\n P(e.mutations.length === r.length);\n\n for (var i = rn(), o = e.mutations, s = 0; s < o.length; s++) {\n i = i.insert(o[s].key, r[s].version);\n }\n\n return new t(e, n, r, i);\n }, t;\n}(),\n Pr =\n/** @class */\nfunction () {\n function t(\n /** The target being listened to. */\n t,\n /**\n * The target ID to which the target corresponds; Assigned by the\n * LocalStore for user listens and by the SyncEngine for limbo watches.\n */\n e,\n /** The purpose of the target. */\n n,\n /**\n * The sequence number of the last transaction during which this target data\n * was modified.\n */\n r,\n /** The latest snapshot version seen for this target. */\n i\n /**\n * The maximum snapshot version at which the associated view\n * contained no limbo documents.\n */\n , o\n /**\n * An opaque, server-assigned token that allows watching a target to be\n * resumed after disconnecting without retransmitting all the data that\n * matches the target. The resume token essentially identifies a point in\n * time from which the server should resume sending results.\n */\n , s) {\n void 0 === i && (i = K.min()), void 0 === o && (o = K.min()), void 0 === s && (s = J.EMPTY_BYTE_STRING), this.target = t, this.targetId = e, this.purpose = n, this.sequenceNumber = r, this.snapshotVersion = i, this.lastLimboFreeSnapshotVersion = o, this.resumeToken = s;\n }\n /** Creates a new target data instance with an updated sequence number. */\n\n\n return t.prototype.withSequenceNumber = function (e) {\n return new t(this.target, this.targetId, this.purpose, e, this.snapshotVersion, this.lastLimboFreeSnapshotVersion, this.resumeToken);\n },\n /**\n * Creates a new target data instance with an updated resume token and\n * snapshot version.\n */\n t.prototype.withResumeToken = function (e, n) {\n return new t(this.target, this.targetId, this.purpose, this.sequenceNumber, n, this.lastLimboFreeSnapshotVersion, e);\n },\n /**\n * Creates a new target data instance with an updated last limbo free\n * snapshot version number.\n */\n t.prototype.withLastLimboFreeSnapshotVersion = function (e) {\n return new t(this.target, this.targetId, this.purpose, this.sequenceNumber, this.snapshotVersion, e, this.resumeToken);\n }, t;\n}(),\n Fr = function Fr(t) {\n this.Lt = t;\n};\n/** The result of applying a mutation batch to the backend. */\n\n/** Decodes a remote document from storage locally to a Document. */\n\n\nfunction Mr(t, e) {\n if (e.document) return On(t.Lt, e.document, !!e.hasCommittedMutations);\n\n if (e.noDocument) {\n var n = ct.fromSegments(e.noDocument.path),\n r = jr(e.noDocument.readTime),\n i = Nt.newNoDocument(n, r);\n return e.hasCommittedMutations ? i.setHasCommittedMutations() : i;\n }\n\n if (e.unknownDocument) {\n var o = ct.fromSegments(e.unknownDocument.path);\n r = jr(e.unknownDocument.version);\n return Nt.newUnknownDocument(o, r);\n }\n\n return O();\n}\n/** Encodes a document for storage locally. */\n\n\nfunction Vr(t, e, n) {\n var r = qr(n),\n i = e.key.path.popLast().toArray();\n\n if (e.isFoundDocument()) {\n var o = function (t, e) {\n return {\n name: Dn(t, e.key),\n fields: e.data.value.mapValue.fields,\n updateTime: In(t, e.version.toTimestamp())\n };\n }(t.Lt, e),\n s = e.hasCommittedMutations;\n\n return new ar(\n /* unknownDocument= */\n null,\n /* noDocument= */\n null, o, s, r, i);\n }\n\n if (e.isNoDocument()) {\n var u = e.key.path.toArray(),\n a = Br(e.version);\n s = e.hasCommittedMutations;\n return new ar(\n /* unknownDocument= */\n null, new sr(u, a),\n /* document= */\n null, s, r, i);\n }\n\n if (e.isUnknownDocument()) {\n var c = e.key.path.toArray(),\n h = Br(e.version);\n return new ar(new ur(c, h),\n /* noDocument= */\n null,\n /* document= */\n null,\n /* hasCommittedMutations= */\n !0, r, i);\n }\n\n return O();\n}\n\nfunction qr(t) {\n var e = t.toTimestamp();\n return [e.seconds, e.nanoseconds];\n}\n\nfunction Ur(t) {\n var e = new j(t[0], t[1]);\n return K.fromTimestamp(e);\n}\n\nfunction Br(t) {\n var e = t.toTimestamp();\n return new er(e.seconds, e.nanoseconds);\n}\n\nfunction jr(t) {\n var e = new j(t.seconds, t.nanoseconds);\n return K.fromTimestamp(e);\n}\n/** Encodes a batch of mutations into a DbMutationBatch for local storage. */\n\n/** Decodes a DbMutationBatch into a MutationBatch */\n\n\nfunction Kr(t, e) {\n // Squash old transform mutations into existing patch or set mutations.\n // The replacement of representing `transforms` with `update_transforms`\n // on the SDK means that old `transform` mutations stored in IndexedDB need\n // to be updated to `update_transforms`.\n // TODO(b/174608374): Remove this code once we perform a schema migration.\n for (var n = (e.baseMutations || []).map(function (e) {\n return Fn(t.Lt, e);\n }), r = 0; r < e.mutations.length - 1; ++r) {\n var i = e.mutations[r];\n\n if (r + 1 < e.mutations.length && void 0 !== e.mutations[r + 1].transform) {\n var o = e.mutations[r + 1];\n i.updateTransforms = o.transform.fieldTransforms, e.mutations.splice(r + 1, 1), ++r;\n }\n }\n\n var s = e.mutations.map(function (e) {\n return Fn(t.Lt, e);\n }),\n u = j.fromMillis(e.localWriteTimeMs);\n return new Lr(e.batchId, u, n, s);\n}\n/** Decodes a DbTarget into TargetData */\n\n\nfunction Qr(t) {\n var e,\n n,\n r = jr(t.readTime),\n i = void 0 !== t.lastLimboFreeSnapshotVersion ? jr(t.lastLimboFreeSnapshotVersion) : K.min();\n return void 0 !== t.query.documents ? (P(1 === (n = t.query).documents.length), e = ne(Yt(Cn(n.documents[0])))) : e = function (t) {\n return ne(qn(t));\n }(t.query), new Pr(e, t.targetId, 0\n /* Listen */\n , t.lastListenSequenceNumber, r, i, J.fromBase64String(t.resumeToken))\n /** Encodes TargetData into a DbTarget for storage locally. */\n ;\n}\n\nfunction Gr(t, e) {\n var n,\n r = Br(e.snapshotVersion),\n i = Br(e.lastLimboFreeSnapshotVersion);\n n = xt(e.target) ? Mn(t.Lt, e.target) : Vn(t.Lt, e.target); // We can't store the resumeToken as a ByteString in IndexedDb, so we\n // convert it to a base64 string for storage.\n\n var o = e.resumeToken.toBase64(); // lastListenSequenceNumber is always 0 until we do real GC.\n\n return new hr(e.targetId, kt(e.target), r, o, e.sequenceNumber, i, n);\n}\n/**\n * A helper function for figuring out what kind of query has been stored.\n */\n\n/**\n * Encodes a `BundledQuery` from bundle proto to a Query object.\n *\n * This reconstructs the original query used to build the bundle being loaded,\n * including features exists only in SDKs (for example: limit-to-last).\n */\n\n\nfunction zr(t) {\n var e = qn({\n parent: t.parent,\n structuredQuery: t.structuredQuery\n });\n return \"LAST\" === t.limitType ? re(e, e.limit, \"L\"\n /* Last */\n ) : e;\n}\n/** Encodes a NamedQuery proto object to a NamedQuery model object. */\n\n/**\n * @license\n * Copyright 2020 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\nvar Wr =\n/** @class */\nfunction () {\n function t() {}\n\n return t.prototype.getBundleMetadata = function (t, e) {\n return Hr(t).get(e).next(function (t) {\n if (t) return {\n id: (e = t).bundleId,\n createTime: jr(e.createTime),\n version: e.version\n };\n /** Encodes a DbBundle to a BundleMetadata object. */\n\n var e;\n /** Encodes a BundleMetadata to a DbBundle. */\n });\n }, t.prototype.saveBundleMetadata = function (t, e) {\n return Hr(t).put({\n bundleId: (n = e).id,\n createTime: Br(_n(n.createTime)),\n version: n.version\n });\n var n;\n /** Encodes a DbNamedQuery to a NamedQuery. */\n }, t.prototype.getNamedQuery = function (t, e) {\n return Yr(t).get(e).next(function (t) {\n if (t) return {\n name: (e = t).name,\n query: zr(e.bundledQuery),\n readTime: jr(e.readTime)\n };\n var e;\n /** Encodes a NamedQuery from a bundle proto to a DbNamedQuery. */\n });\n }, t.prototype.saveNamedQuery = function (t, e) {\n return Yr(t).put(function (t) {\n return {\n name: t.name,\n readTime: Br(_n(t.readTime)),\n bundledQuery: t.bundledQuery\n };\n }(e));\n }, t;\n}();\n/**\n * Helper to get a typed SimpleDbStore for the bundles object store.\n */\n\n\nfunction Hr(t) {\n return Rr(t, yr.store);\n}\n/**\n * Helper to get a typed SimpleDbStore for the namedQueries object store.\n */\n\n\nfunction Yr(t) {\n return Rr(t, vr.store);\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\n/**\n * An in-memory implementation of IndexManager.\n */\n\n\nvar $r =\n/** @class */\nfunction () {\n function t() {\n this.Bt = new Xr();\n }\n\n return t.prototype.addToCollectionParentIndex = function (t, e) {\n return this.Bt.add(e), Ir.resolve();\n }, t.prototype.getCollectionParents = function (t, e) {\n return Ir.resolve(this.Bt.getEntries(e));\n }, t;\n}(),\n Xr =\n/** @class */\nfunction () {\n function t() {\n this.index = {};\n } // Returns false if the entry already existed.\n\n\n return t.prototype.add = function (t) {\n var e = t.lastSegment(),\n n = t.popLast(),\n r = this.index[e] || new $e(H.comparator),\n i = !r.has(n);\n return this.index[e] = r.add(n), i;\n }, t.prototype.has = function (t) {\n var e = t.lastSegment(),\n n = t.popLast(),\n r = this.index[e];\n return r && r.has(n);\n }, t.prototype.getEntries = function (t) {\n return (this.index[t] || new $e(H.comparator)).toArray();\n }, t;\n}(),\n Jr =\n/** @class */\nfunction () {\n function t() {\n /**\n * An in-memory copy of the index entries we've already written since the SDK\n * launched. Used to avoid re-writing the same entry repeatedly.\n *\n * This is *NOT* a complete cache of what's in persistence and so can never be used to\n * satisfy reads.\n */\n this.qt = new Xr();\n }\n /**\n * Adds a new entry to the collection parent index.\n *\n * Repeated calls for the same collectionPath should be avoided within a\n * transaction as IndexedDbIndexManager only caches writes once a transaction\n * has been committed.\n */\n\n\n return t.prototype.addToCollectionParentIndex = function (t, e) {\n var n = this;\n\n if (!this.qt.has(e)) {\n var r = e.lastSegment(),\n i = e.popLast();\n t.addOnCommittedListener(function () {\n // Add the collection to the in memory cache only if the transaction was\n // successfully committed.\n n.qt.add(e);\n });\n var o = {\n collectionId: r,\n parent: Xn(i)\n };\n return Zr(t).put(o);\n }\n\n return Ir.resolve();\n }, t.prototype.getCollectionParents = function (t, e) {\n var n = [],\n r = IDBKeyRange.bound([e, \"\"], [B(e), \"\"],\n /*lowerOpen=*/\n !1,\n /*upperOpen=*/\n !0);\n return Zr(t).Nt(r).next(function (t) {\n for (var r = 0, i = t; r < i.length; r++) {\n var o = i[r]; // This collectionId guard shouldn't be necessary (and isn't as long\n // as we're running in a real browser), but there's a bug in\n // indexeddbshim that breaks our range in our tests running in node:\n // https://github.com/axemclion/IndexedDBShim/issues/334\n\n if (o.collectionId !== e) break;\n n.push(tr(o.parent));\n }\n\n return n;\n });\n }, t;\n}();\n/**\n * Internal implementation of the collection-parent index exposed by MemoryIndexManager.\n * Also used for in-memory caching by IndexedDbIndexManager and initial index population\n * in indexeddb_schema.ts\n */\n\n/**\n * Helper to get a typed SimpleDbStore for the collectionParents\n * document store.\n */\n\n\nfunction Zr(t) {\n return Rr(t, dr.store);\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\n\nvar ti = {\n didRun: !1,\n sequenceNumbersCollected: 0,\n targetsRemoved: 0,\n documentsRemoved: 0\n},\n ei =\n/** @class */\nfunction () {\n function t( // When we attempt to collect, we will only do so if the cache size is greater than this\n // threshold. Passing `COLLECTION_DISABLED` here will cause collection to always be skipped.\n t, // The percentage of sequence numbers that we will attempt to collect\n e, // A cap on the total number of sequence numbers that will be collected. This prevents\n // us from collecting a huge number of sequence numbers if the cache has grown very large.\n n) {\n this.cacheSizeCollectionThreshold = t, this.percentileToCollect = e, this.maximumSequenceNumbersToCollect = n;\n }\n\n return t.withCacheSize = function (e) {\n return new t(e, t.DEFAULT_COLLECTION_PERCENTILE, t.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT);\n }, t;\n}();\n/**\n * @license\n * Copyright 2020 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 * Delete a mutation batch and the associated document mutations.\n * @returns A PersistencePromise of the document mutations that were removed.\n */\n\n\nfunction ni(t, e, n) {\n var r = t.store(ir.store),\n i = t.store(or.store),\n o = [],\n s = IDBKeyRange.only(n.batchId),\n u = 0,\n a = r.$t({\n range: s\n }, function (t, e, n) {\n return u++, n.delete();\n });\n o.push(a.next(function () {\n P(1 === u);\n }));\n\n for (var c = [], h = 0, f = n.mutations; h < f.length; h++) {\n var l = f[h],\n d = or.key(e, l.key.path, n.batchId);\n o.push(i.delete(d)), c.push(l.key);\n }\n\n return Ir.waitFor(o).next(function () {\n return c;\n });\n}\n/**\n * Returns an approximate size for the given document.\n */\n\n\nfunction ri(t) {\n if (!t) return 0;\n var e;\n if (t.document) e = t.document;else if (t.unknownDocument) e = t.unknownDocument;else {\n if (!t.noDocument) throw O();\n e = t.noDocument;\n }\n return JSON.stringify(e).length;\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/** A mutation queue for a specific user, backed by IndexedDB. */\n\n\nei.DEFAULT_COLLECTION_PERCENTILE = 10, ei.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT = 1e3, ei.DEFAULT = new ei(41943040, ei.DEFAULT_COLLECTION_PERCENTILE, ei.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT), ei.DISABLED = new ei(-1, 0, 0);\n\nvar ii =\n/** @class */\nfunction () {\n function t(\n /**\n * The normalized userId (e.g. null UID => \"\" userId) used to store /\n * retrieve mutations.\n */\n t, e, n, r) {\n this.userId = t, this.R = e, this.Ut = n, this.referenceDelegate = r,\n /**\n * Caches the document keys for pending mutation batches. If the mutation\n * has been removed from IndexedDb, the cached value may continue to\n * be used to retrieve the batch's document keys. To remove a cached value\n * locally, `removeCachedMutationKeys()` should be invoked either directly\n * or through `removeMutationBatches()`.\n *\n * With multi-tab, when the primary client acknowledges or rejects a mutation,\n * this cache is used by secondary clients to invalidate the local\n * view of the documents that were previously affected by the mutation.\n */\n // PORTING NOTE: Multi-tab only.\n this.Kt = {}\n /**\n * Creates a new mutation queue for the given user.\n * @param user - The user for which to create a mutation queue.\n * @param serializer - The serializer to use when persisting to IndexedDb.\n */\n ;\n }\n\n return t.Qt = function (e, n, r, i) {\n // TODO(mcg): Figure out what constraints there are on userIDs\n // In particular, are there any reserved characters? are empty ids allowed?\n // For the moment store these together in the same mutations table assuming\n // that empty userIDs aren't allowed.\n return P(\"\" !== e.uid), new t(e.isAuthenticated() ? e.uid : \"\", n, r, i);\n }, t.prototype.checkEmpty = function (t) {\n var e = !0,\n n = IDBKeyRange.bound([this.userId, Number.NEGATIVE_INFINITY], [this.userId, Number.POSITIVE_INFINITY]);\n return si(t).$t({\n index: ir.userMutationsIndex,\n range: n\n }, function (t, n, r) {\n e = !1, r.done();\n }).next(function () {\n return e;\n });\n }, t.prototype.addMutationBatch = function (t, e, n, r) {\n var i = this,\n o = ui(t),\n s = si(t); // The IndexedDb implementation in Chrome (and Firefox) does not handle\n // compound indices that include auto-generated keys correctly. To ensure\n // that the index entry is added correctly in all browsers, we perform two\n // writes: The first write is used to retrieve the next auto-generated Batch\n // ID, and the second write populates the index and stores the actual\n // mutation batch.\n // See: https://bugs.chromium.org/p/chromium/issues/detail?id=701972\n // We write an empty object to obtain key\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n return s.add({}).next(function (u) {\n P(\"number\" == typeof u);\n\n for (var a = new Lr(u, e, n, r), c = function (t, e, n) {\n var r = n.baseMutations.map(function (e) {\n return Pn(t.Lt, e);\n }),\n i = n.mutations.map(function (e) {\n return Pn(t.Lt, e);\n });\n return new ir(e, n.batchId, n.localWriteTime.toMillis(), r, i);\n }(i.R, i.userId, a), h = [], f = new $e(function (t, e) {\n return q(t.canonicalString(), e.canonicalString());\n }), l = 0, d = r; l < d.length; l++) {\n var p = d[l],\n y = or.key(i.userId, p.key.path, u);\n f = f.add(p.key.path.popLast()), h.push(s.put(c)), h.push(o.put(y, or.PLACEHOLDER));\n }\n\n return f.forEach(function (e) {\n h.push(i.Ut.addToCollectionParentIndex(t, e));\n }), t.addOnCommittedListener(function () {\n i.Kt[u] = a.keys();\n }), Ir.waitFor(h).next(function () {\n return a;\n });\n });\n }, t.prototype.lookupMutationBatch = function (t, e) {\n var n = this;\n return si(t).get(e).next(function (t) {\n return t ? (P(t.userId === n.userId), Kr(n.R, t)) : null;\n });\n },\n /**\n * Returns the document keys for the mutation batch with the given batchId.\n * For primary clients, this method returns `null` after\n * `removeMutationBatches()` has been called. Secondary clients return a\n * cached result until `removeCachedMutationKeys()` is invoked.\n */\n // PORTING NOTE: Multi-tab only.\n t.prototype.jt = function (t, e) {\n var n = this;\n return this.Kt[e] ? Ir.resolve(this.Kt[e]) : this.lookupMutationBatch(t, e).next(function (t) {\n if (t) {\n var r = t.keys();\n return n.Kt[e] = r, r;\n }\n\n return null;\n });\n }, t.prototype.getNextMutationBatchAfterBatchId = function (t, e) {\n var n = this,\n r = e + 1,\n i = IDBKeyRange.lowerBound([this.userId, r]),\n o = null;\n return si(t).$t({\n index: ir.userMutationsIndex,\n range: i\n }, function (t, e, i) {\n e.userId === n.userId && (P(e.batchId >= r), o = Kr(n.R, e)), i.done();\n }).next(function () {\n return o;\n });\n }, t.prototype.getHighestUnacknowledgedBatchId = function (t) {\n var e = IDBKeyRange.upperBound([this.userId, Number.POSITIVE_INFINITY]),\n n = -1;\n return si(t).$t({\n index: ir.userMutationsIndex,\n range: e,\n reverse: !0\n }, function (t, e, r) {\n n = e.batchId, r.done();\n }).next(function () {\n return n;\n });\n }, t.prototype.getAllMutationBatches = function (t) {\n var e = this,\n n = IDBKeyRange.bound([this.userId, -1], [this.userId, Number.POSITIVE_INFINITY]);\n return si(t).Nt(ir.userMutationsIndex, n).next(function (t) {\n return t.map(function (t) {\n return Kr(e.R, t);\n });\n });\n }, t.prototype.getAllMutationBatchesAffectingDocumentKey = function (t, e) {\n var n = this,\n r = or.prefixForPath(this.userId, e.path),\n i = IDBKeyRange.lowerBound(r),\n o = []; // Scan the document-mutation index starting with a prefix starting with\n // the given documentKey.\n\n return ui(t).$t({\n range: i\n }, function (r, i, s) {\n var u = r[0],\n a = r[1],\n c = r[2],\n h = tr(a); // Only consider rows matching exactly the specific key of\n // interest. Note that because we order by path first, and we\n // order terminators before path separators, we'll encounter all\n // the index rows for documentKey contiguously. In particular, all\n // the rows for documentKey will occur before any rows for\n // documents nested in a subcollection beneath documentKey so we\n // can stop as soon as we hit any such row.\n\n if (u === n.userId && e.path.isEqual(h)) // Look up the mutation batch in the store.\n return si(t).get(c).next(function (t) {\n if (!t) throw O();\n P(t.userId === n.userId), o.push(Kr(n.R, t));\n });\n s.done();\n }).next(function () {\n return o;\n });\n }, t.prototype.getAllMutationBatchesAffectingDocumentKeys = function (t, e) {\n var n = this,\n r = new $e(q),\n i = [];\n return e.forEach(function (e) {\n var o = or.prefixForPath(n.userId, e.path),\n s = IDBKeyRange.lowerBound(o),\n u = ui(t).$t({\n range: s\n }, function (t, i, o) {\n var s = t[0],\n u = t[1],\n a = t[2],\n c = tr(u); // Only consider rows matching exactly the specific key of\n // interest. Note that because we order by path first, and we\n // order terminators before path separators, we'll encounter all\n // the index rows for documentKey contiguously. In particular, all\n // the rows for documentKey will occur before any rows for\n // documents nested in a subcollection beneath documentKey so we\n // can stop as soon as we hit any such row.\n\n s === n.userId && e.path.isEqual(c) ? r = r.add(a) : o.done();\n });\n i.push(u);\n }), Ir.waitFor(i).next(function () {\n return n.Wt(t, r);\n });\n }, t.prototype.getAllMutationBatchesAffectingQuery = function (t, e) {\n var n = this,\n r = e.path,\n i = r.length + 1,\n o = or.prefixForPath(this.userId, r),\n s = IDBKeyRange.lowerBound(o),\n u = new $e(q);\n return ui(t).$t({\n range: s\n }, function (t, e, o) {\n var s = t[0],\n a = t[1],\n c = t[2],\n h = tr(a);\n s === n.userId && r.isPrefixOf(h) ? // Rows with document keys more than one segment longer than the\n // query path can't be matches. For example, a query on 'rooms'\n // can't match the document /rooms/abc/messages/xyx.\n // TODO(mcg): we'll need a different scanner when we implement\n // ancestor queries.\n h.length === i && (u = u.add(c)) : o.done();\n }).next(function () {\n return n.Wt(t, u);\n });\n }, t.prototype.Wt = function (t, e) {\n var n = this,\n r = [],\n i = []; // TODO(rockwood): Implement this using iterate.\n\n return e.forEach(function (e) {\n i.push(si(t).get(e).next(function (t) {\n if (null === t) throw O();\n P(t.userId === n.userId), r.push(Kr(n.R, t));\n }));\n }), Ir.waitFor(i).next(function () {\n return r;\n });\n }, t.prototype.removeMutationBatch = function (t, e) {\n var n = this;\n return ni(t.Mt, this.userId, e).next(function (r) {\n return t.addOnCommittedListener(function () {\n n.Gt(e.batchId);\n }), Ir.forEach(r, function (e) {\n return n.referenceDelegate.markPotentiallyOrphaned(t, e);\n });\n });\n },\n /**\n * Clears the cached keys for a mutation batch. This method should be\n * called by secondary clients after they process mutation updates.\n *\n * Note that this method does not have to be called from primary clients as\n * the corresponding cache entries are cleared when an acknowledged or\n * rejected batch is removed from the mutation queue.\n */\n // PORTING NOTE: Multi-tab only\n t.prototype.Gt = function (t) {\n delete this.Kt[t];\n }, t.prototype.performConsistencyCheck = function (t) {\n var e = this;\n return this.checkEmpty(t).next(function (n) {\n if (!n) return Ir.resolve(); // Verify that there are no entries in the documentMutations index if\n // the queue is empty.\n\n var r = IDBKeyRange.lowerBound(or.prefixForUser(e.userId)),\n i = [];\n return ui(t).$t({\n range: r\n }, function (t, n, r) {\n if (t[0] === e.userId) {\n var o = tr(t[1]);\n i.push(o);\n } else r.done();\n }).next(function () {\n P(0 === i.length);\n });\n });\n }, t.prototype.containsKey = function (t, e) {\n return oi(t, this.userId, e);\n }, // PORTING NOTE: Multi-tab only (state is held in memory in other clients).\n\n /** Returns the mutation queue's metadata from IndexedDb. */\n t.prototype.zt = function (t) {\n var e = this;\n return ai(t).get(this.userId).next(function (t) {\n return t || new rr(e.userId, -1,\n /*lastStreamToken=*/\n \"\");\n });\n }, t;\n}();\n/**\n * @returns true if the mutation queue for the given user contains a pending\n * mutation for the given key.\n */\n\n\nfunction oi(t, e, n) {\n var r = or.prefixForPath(e, n.path),\n i = r[1],\n o = IDBKeyRange.lowerBound(r),\n s = !1;\n return ui(t).$t({\n range: o,\n Ft: !0\n }, function (t, n, r) {\n var o = t[0],\n u = t[1];\n /*batchID*/\n\n t[2], o === e && u === i && (s = !0), r.done();\n }).next(function () {\n return s;\n });\n}\n/** Returns true if any mutation queue contains the given document. */\n\n/**\n * Helper to get a typed SimpleDbStore for the mutations object store.\n */\n\n\nfunction si(t) {\n return Rr(t, ir.store);\n}\n/**\n * Helper to get a typed SimpleDbStore for the mutationQueues object store.\n */\n\n\nfunction ui(t) {\n return Rr(t, or.store);\n}\n/**\n * Helper to get a typed SimpleDbStore for the mutationQueues object store.\n */\n\n\nfunction ai(t) {\n return Rr(t, rr.store);\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/** Offset to ensure non-overlapping target ids. */\n\n/**\n * Generates monotonically increasing target IDs for sending targets to the\n * watch stream.\n *\n * The client constructs two generators, one for the target cache, and one for\n * for the sync engine (to generate limbo documents targets). These\n * generators produce non-overlapping IDs (by using even and odd IDs\n * respectively).\n *\n * By separating the target ID space, the query cache can generate target IDs\n * that persist across client restarts, while sync engine can independently\n * generate in-memory target IDs that are transient and can be reused after a\n * restart.\n */\n\n\nvar ci =\n/** @class */\nfunction () {\n function t(t) {\n this.Ht = t;\n }\n\n return t.prototype.next = function () {\n return this.Ht += 2, this.Ht;\n }, t.Jt = function () {\n // The target cache generator must return '2' in its first call to `next()`\n // as there is no differentiation in the protocol layer between an unset\n // number and the number '0'. If we were to sent a target with target ID\n // '0', the backend would consider it unset and replace it with its own ID.\n return new t(0);\n }, t.Yt = function () {\n // Sync engine assigns target IDs for limbo document detection.\n return new t(-1);\n }, t;\n}(),\n hi =\n/** @class */\nfunction () {\n function t(t, e) {\n this.referenceDelegate = t, this.R = e;\n } // PORTING NOTE: We don't cache global metadata for the target cache, since\n // some of it (in particular `highestTargetId`) can be modified by secondary\n // tabs. We could perhaps be more granular (and e.g. still cache\n // `lastRemoteSnapshotVersion` in memory) but for simplicity we currently go\n // to IndexedDb whenever we need to read metadata. We can revisit if it turns\n // out to have a meaningful performance impact.\n\n\n return t.prototype.allocateTargetId = function (t) {\n var e = this;\n return this.Xt(t).next(function (n) {\n var r = new ci(n.highestTargetId);\n return n.highestTargetId = r.next(), e.Zt(t, n).next(function () {\n return n.highestTargetId;\n });\n });\n }, t.prototype.getLastRemoteSnapshotVersion = function (t) {\n return this.Xt(t).next(function (t) {\n return K.fromTimestamp(new j(t.lastRemoteSnapshotVersion.seconds, t.lastRemoteSnapshotVersion.nanoseconds));\n });\n }, t.prototype.getHighestSequenceNumber = function (t) {\n return this.Xt(t).next(function (t) {\n return t.highestListenSequenceNumber;\n });\n }, t.prototype.setTargetsMetadata = function (t, e, n) {\n var r = this;\n return this.Xt(t).next(function (i) {\n return i.highestListenSequenceNumber = e, n && (i.lastRemoteSnapshotVersion = n.toTimestamp()), e > i.highestListenSequenceNumber && (i.highestListenSequenceNumber = e), r.Zt(t, i);\n });\n }, t.prototype.addTargetData = function (t, e) {\n var n = this;\n return this.te(t, e).next(function () {\n return n.Xt(t).next(function (r) {\n return r.targetCount += 1, n.ee(e, r), n.Zt(t, r);\n });\n });\n }, t.prototype.updateTargetData = function (t, e) {\n return this.te(t, e);\n }, t.prototype.removeTargetData = function (t, e) {\n var n = this;\n return this.removeMatchingKeysForTargetId(t, e.targetId).next(function () {\n return fi(t).delete(e.targetId);\n }).next(function () {\n return n.Xt(t);\n }).next(function (e) {\n return P(e.targetCount > 0), e.targetCount -= 1, n.Zt(t, e);\n });\n },\n /**\n * Drops any targets with sequence number less than or equal to the upper bound, excepting those\n * present in `activeTargetIds`. Document associations for the removed targets are also removed.\n * Returns the number of targets removed.\n */\n t.prototype.removeTargets = function (t, e, n) {\n var r = this,\n i = 0,\n o = [];\n return fi(t).$t(function (s, u) {\n var a = Qr(u);\n a.sequenceNumber <= e && null === n.get(a.targetId) && (i++, o.push(r.removeTargetData(t, a)));\n }).next(function () {\n return Ir.waitFor(o);\n }).next(function () {\n return i;\n });\n },\n /**\n * Call provided function with each `TargetData` that we have cached.\n */\n t.prototype.forEachTarget = function (t, e) {\n return fi(t).$t(function (t, n) {\n var r = Qr(n);\n e(r);\n });\n }, t.prototype.Xt = function (t) {\n return li(t).get(lr.key).next(function (t) {\n return P(null !== t), t;\n });\n }, t.prototype.Zt = function (t, e) {\n return li(t).put(lr.key, e);\n }, t.prototype.te = function (t, e) {\n return fi(t).put(Gr(this.R, e));\n },\n /**\n * In-place updates the provided metadata to account for values in the given\n * TargetData. Saving is done separately. Returns true if there were any\n * changes to the metadata.\n */\n t.prototype.ee = function (t, e) {\n var n = !1;\n return t.targetId > e.highestTargetId && (e.highestTargetId = t.targetId, n = !0), t.sequenceNumber > e.highestListenSequenceNumber && (e.highestListenSequenceNumber = t.sequenceNumber, n = !0), n;\n }, t.prototype.getTargetCount = function (t) {\n return this.Xt(t).next(function (t) {\n return t.targetCount;\n });\n }, t.prototype.getTargetData = function (t, e) {\n // Iterating by the canonicalId may yield more than one result because\n // canonicalId values are not required to be unique per target. This query\n // depends on the queryTargets index to be efficient.\n var n = kt(e),\n r = IDBKeyRange.bound([n, Number.NEGATIVE_INFINITY], [n, Number.POSITIVE_INFINITY]),\n i = null;\n return fi(t).$t({\n range: r,\n index: hr.queryTargetsIndexName\n }, function (t, n, r) {\n var o = Qr(n); // After finding a potential match, check that the target is\n // actually equal to the requested target.\n\n Ct(e, o.target) && (i = o, r.done());\n }).next(function () {\n return i;\n });\n }, t.prototype.addMatchingKeys = function (t, e, n) {\n var r = this,\n i = [],\n o = di(t); // PORTING NOTE: The reverse index (documentsTargets) is maintained by\n // IndexedDb.\n\n return e.forEach(function (e) {\n var s = Xn(e.path);\n i.push(o.put(new fr(n, s))), i.push(r.referenceDelegate.addReference(t, n, e));\n }), Ir.waitFor(i);\n }, t.prototype.removeMatchingKeys = function (t, e, n) {\n var r = this,\n i = di(t); // PORTING NOTE: The reverse index (documentsTargets) is maintained by\n // IndexedDb.\n\n return Ir.forEach(e, function (e) {\n var o = Xn(e.path);\n return Ir.waitFor([i.delete([n, o]), r.referenceDelegate.removeReference(t, n, e)]);\n });\n }, t.prototype.removeMatchingKeysForTargetId = function (t, e) {\n var n = di(t),\n r = IDBKeyRange.bound([e], [e + 1],\n /*lowerOpen=*/\n !1,\n /*upperOpen=*/\n !0);\n return n.delete(r);\n }, t.prototype.getMatchingKeysForTargetId = function (t, e) {\n var n = IDBKeyRange.bound([e], [e + 1],\n /*lowerOpen=*/\n !1,\n /*upperOpen=*/\n !0),\n r = di(t),\n i = sn();\n return r.$t({\n range: n,\n Ft: !0\n }, function (t, e, n) {\n var r = tr(t[1]),\n o = new ct(r);\n i = i.add(o);\n }).next(function () {\n return i;\n });\n }, t.prototype.containsKey = function (t, e) {\n var n = Xn(e.path),\n r = IDBKeyRange.bound([n], [B(n)],\n /*lowerOpen=*/\n !1,\n /*upperOpen=*/\n !0),\n i = 0;\n return di(t).$t({\n index: fr.documentTargetsIndex,\n Ft: !0,\n range: r\n }, function (t, e, n) {\n var r = t[0];\n t[1], // Having a sentinel row for a document does not count as containing that document;\n // For the target cache, containing the document means the document is part of some\n // target.\n 0 !== r && (i++, n.done());\n }).next(function () {\n return i > 0;\n });\n },\n /**\n * Looks up a TargetData entry by target ID.\n *\n * @param targetId - The target ID of the TargetData entry to look up.\n * @returns The cached TargetData entry, or null if the cache has no entry for\n * the target.\n */\n // PORTING NOTE: Multi-tab only.\n t.prototype.lt = function (t, e) {\n return fi(t).get(e).next(function (t) {\n return t ? Qr(t) : null;\n });\n }, t;\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/**\n * Helper to get a typed SimpleDbStore for the queries object store.\n */\n\n\nfunction fi(t) {\n return Rr(t, hr.store);\n}\n/**\n * Helper to get a typed SimpleDbStore for the target globals object store.\n */\n\n\nfunction li(t) {\n return Rr(t, lr.store);\n}\n/**\n * Helper to get a typed SimpleDbStore for the document target object store.\n */\n\n\nfunction di(t) {\n return Rr(t, fr.store);\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/**\n * Verifies the error thrown by a LocalStore operation. If a LocalStore\n * operation fails because the primary lease has been taken by another client,\n * we ignore the error (the persistence layer will immediately call\n * `applyPrimaryLease` to propagate the primary state change). All other errors\n * are re-thrown.\n *\n * @param err - An error returned by a LocalStore operation.\n * @returns A Promise that resolves after we recovered, or the original error.\n */\n\n\nfunction pi(t) {\n return n(this, void 0, void 0, function () {\n return r(this, function (e) {\n if (t.code !== N.FAILED_PRECONDITION || t.message !== gr) throw t;\n return C(\"LocalStore\", \"Unexpectedly lost primary lease\"), [2\n /*return*/\n ];\n });\n });\n}\n/**\n * @license\n * Copyright 2020 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\nfunction yi(t, e) {\n var n = t[0],\n r = t[1],\n i = e[0],\n o = e[1],\n s = q(n, i);\n return 0 === s ? q(r, o) : s;\n}\n/**\n * Used to calculate the nth sequence number. Keeps a rolling buffer of the\n * lowest n values passed to `addElement`, and finally reports the largest of\n * them in `maxValue`.\n */\n\n\nvar vi =\n/** @class */\nfunction () {\n function t(t) {\n this.ne = t, this.buffer = new $e(yi), this.se = 0;\n }\n\n return t.prototype.ie = function () {\n return ++this.se;\n }, t.prototype.re = function (t) {\n var e = [t, this.ie()];\n if (this.buffer.size < this.ne) this.buffer = this.buffer.add(e);else {\n var n = this.buffer.last();\n yi(e, n) < 0 && (this.buffer = this.buffer.delete(n).add(e));\n }\n }, Object.defineProperty(t.prototype, \"maxValue\", {\n get: function get() {\n // Guaranteed to be non-empty. If we decide we are not collecting any\n // sequence numbers, nthSequenceNumber below short-circuits. If we have\n // decided that we are collecting n sequence numbers, it's because n is some\n // percentage of the existing sequence numbers. That means we should never\n // be in a situation where we are collecting sequence numbers but don't\n // actually have any.\n return this.buffer.last()[0];\n },\n enumerable: !1,\n configurable: !0\n }), t;\n}(),\n mi =\n/** @class */\nfunction () {\n function t(t, e) {\n this.garbageCollector = t, this.asyncQueue = e, this.oe = !1, this.ce = null;\n }\n\n return t.prototype.start = function (t) {\n -1 !== this.garbageCollector.params.cacheSizeCollectionThreshold && this.ue(t);\n }, t.prototype.stop = function () {\n this.ce && (this.ce.cancel(), this.ce = null);\n }, Object.defineProperty(t.prototype, \"started\", {\n get: function get() {\n return null !== this.ce;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.ue = function (t) {\n var e = this,\n i = this.oe ? 3e5 : 6e4;\n C(\"LruGarbageCollector\", \"Garbage collection scheduled in \" + i + \"ms\"), this.ce = this.asyncQueue.enqueueAfterDelay(\"lru_garbage_collection\"\n /* LruGarbageCollection */\n , i, function () {\n return n(e, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n this.ce = null, this.oe = !0, n.label = 1;\n\n case 1:\n return n.trys.push([1, 3,, 7]), [4\n /*yield*/\n , t.collectGarbage(this.garbageCollector)];\n\n case 2:\n return n.sent(), [3\n /*break*/\n , 7];\n\n case 3:\n return Nr(e = n.sent()) ? (C(\"LruGarbageCollector\", \"Ignoring IndexedDB error during garbage collection: \", e), [3\n /*break*/\n , 6]) : [3\n /*break*/\n , 4];\n\n case 4:\n return [4\n /*yield*/\n , pi(e)];\n\n case 5:\n n.sent(), n.label = 6;\n\n case 6:\n return [3\n /*break*/\n , 7];\n\n case 7:\n return [4\n /*yield*/\n , this.ue(t)];\n\n case 8:\n return n.sent(), [2\n /*return*/\n ];\n }\n });\n });\n });\n }, t;\n}(),\n gi =\n/** @class */\nfunction () {\n function t(t, e) {\n this.ae = t, this.params = e;\n }\n\n return t.prototype.calculateTargetCount = function (t, e) {\n return this.ae.he(t).next(function (t) {\n return Math.floor(e / 100 * t);\n });\n }, t.prototype.nthSequenceNumber = function (t, e) {\n var n = this;\n if (0 === e) return Ir.resolve(S.o);\n var r = new vi(e);\n return this.ae.forEachTarget(t, function (t) {\n return r.re(t.sequenceNumber);\n }).next(function () {\n return n.ae.le(t, function (t) {\n return r.re(t);\n });\n }).next(function () {\n return r.maxValue;\n });\n }, t.prototype.removeTargets = function (t, e, n) {\n return this.ae.removeTargets(t, e, n);\n }, t.prototype.removeOrphanedDocuments = function (t, e) {\n return this.ae.removeOrphanedDocuments(t, e);\n }, t.prototype.collect = function (t, e) {\n var n = this;\n return -1 === this.params.cacheSizeCollectionThreshold ? (C(\"LruGarbageCollector\", \"Garbage collection skipped; disabled\"), Ir.resolve(ti)) : this.getCacheSize(t).next(function (r) {\n return r < n.params.cacheSizeCollectionThreshold ? (C(\"LruGarbageCollector\", \"Garbage collection skipped; Cache size \" + r + \" is lower than threshold \" + n.params.cacheSizeCollectionThreshold), ti) : n.fe(t, e);\n });\n }, t.prototype.getCacheSize = function (t) {\n return this.ae.getCacheSize(t);\n }, t.prototype.fe = function (t, e) {\n var n,\n r,\n i,\n o,\n s,\n u,\n a,\n c = this,\n h = Date.now();\n return this.calculateTargetCount(t, this.params.percentileToCollect).next(function (e) {\n // Cap at the configured max\n return e > c.params.maximumSequenceNumbersToCollect ? (C(\"LruGarbageCollector\", \"Capping sequence numbers to collect down to the maximum of \" + c.params.maximumSequenceNumbersToCollect + \" from \" + e), r = c.params.maximumSequenceNumbersToCollect) : r = e, o = Date.now(), c.nthSequenceNumber(t, r);\n }).next(function (r) {\n return n = r, s = Date.now(), c.removeTargets(t, n, e);\n }).next(function (e) {\n return i = e, u = Date.now(), c.removeOrphanedDocuments(t, n);\n }).next(function (t) {\n return a = Date.now(), k() <= y.DEBUG && C(\"LruGarbageCollector\", \"LRU Garbage Collection\\n\\tCounted targets in \" + (o - h) + \"ms\\n\\tDetermined least recently used \" + r + \" in \" + (s - o) + \"ms\\n\\tRemoved \" + i + \" targets in \" + (u - s) + \"ms\\n\\tRemoved \" + t + \" documents in \" + (a - u) + \"ms\\nTotal Duration: \" + (a - h) + \"ms\"), Ir.resolve({\n didRun: !0,\n sequenceNumbersCollected: r,\n targetsRemoved: i,\n documentsRemoved: t\n });\n });\n }, t;\n}(),\n wi =\n/** @class */\nfunction () {\n function t(t, e) {\n this.db = t, this.garbageCollector = function (t, e) {\n return new gi(t, e);\n }(this, e);\n }\n\n return t.prototype.he = function (t) {\n var e = this.de(t);\n return this.db.getTargetCache().getTargetCount(t).next(function (t) {\n return e.next(function (e) {\n return t + e;\n });\n });\n }, t.prototype.de = function (t) {\n var e = 0;\n return this.le(t, function (t) {\n e++;\n }).next(function () {\n return e;\n });\n }, t.prototype.forEachTarget = function (t, e) {\n return this.db.getTargetCache().forEachTarget(t, e);\n }, t.prototype.le = function (t, e) {\n return this.we(t, function (t, n) {\n return e(n);\n });\n }, t.prototype.addReference = function (t, e, n) {\n return bi(t, n);\n }, t.prototype.removeReference = function (t, e, n) {\n return bi(t, n);\n }, t.prototype.removeTargets = function (t, e, n) {\n return this.db.getTargetCache().removeTargets(t, e, n);\n }, t.prototype.markPotentiallyOrphaned = function (t, e) {\n return bi(t, e);\n },\n /**\n * Returns true if anything would prevent this document from being garbage\n * collected, given that the document in question is not present in any\n * targets and has a sequence number less than or equal to the upper bound for\n * the collection run.\n */\n t.prototype._e = function (t, e) {\n return function (t, e) {\n var n = !1;\n return ai(t).Ot(function (r) {\n return oi(t, r, e).next(function (t) {\n return t && (n = !0), Ir.resolve(!t);\n });\n }).next(function () {\n return n;\n });\n }(t, e);\n }, t.prototype.removeOrphanedDocuments = function (t, e) {\n var n = this,\n r = this.db.getRemoteDocumentCache().newChangeBuffer(),\n i = [],\n o = 0;\n return this.we(t, function (s, u) {\n if (u <= e) {\n var a = n._e(t, s).next(function (e) {\n if (!e) // Our size accounting requires us to read all documents before\n // removing them.\n return o++, r.getEntry(t, s).next(function () {\n return r.removeEntry(s), di(t).delete([0, Xn(s.path)]);\n });\n });\n\n i.push(a);\n }\n }).next(function () {\n return Ir.waitFor(i);\n }).next(function () {\n return r.apply(t);\n }).next(function () {\n return o;\n });\n }, t.prototype.removeTarget = function (t, e) {\n var n = e.withSequenceNumber(t.currentSequenceNumber);\n return this.db.getTargetCache().updateTargetData(t, n);\n }, t.prototype.updateLimboDocument = function (t, e) {\n return bi(t, e);\n },\n /**\n * Call provided function for each document in the cache that is 'orphaned'. Orphaned\n * means not a part of any target, so the only entry in the target-document index for\n * that document will be the sentinel row (targetId 0), which will also have the sequence\n * number for the last time the document was accessed.\n */\n t.prototype.we = function (t, e) {\n var n,\n r = di(t),\n i = S.o;\n return r.$t({\n index: fr.documentTargetsIndex\n }, function (t, r) {\n var o = t[0];\n t[1];\n var s = r.path,\n u = r.sequenceNumber;\n 0 === o ? ( // if nextToReport is valid, report it, this is a new key so the\n // last one must not be a member of any targets.\n i !== S.o && e(new ct(tr(n)), i), // set nextToReport to be this sequence number. It's the next one we\n // might report, if we don't find any targets for this document.\n // Note that the sequence number must be defined when the targetId\n // is 0.\n i = u, n = s) : // set nextToReport to be invalid, we know we don't need to report\n // this one since we found a target for it.\n i = S.o;\n }).next(function () {\n // Since we report sequence numbers after getting to the next key, we\n // need to check if the last key we iterated over was an orphaned\n // document and report it.\n i !== S.o && e(new ct(tr(n)), i);\n });\n }, t.prototype.getCacheSize = function (t) {\n return this.db.getRemoteDocumentCache().getSize(t);\n }, t;\n}();\n/**\n * This class is responsible for the scheduling of LRU garbage collection. It handles checking\n * whether or not GC is enabled, as well as which delay to use before the next run.\n */\n\n\nfunction bi(t, e) {\n return di(t).put(\n /**\n * @returns A value suitable for writing a sentinel row in the target-document\n * store.\n */\n function (t, e) {\n return new fr(0, Xn(t.path), e);\n }(e, t.currentSequenceNumber));\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/**\n * A map implementation that uses objects as keys. Objects must have an\n * associated equals function and must be immutable. Entries in the map are\n * stored together with the key being produced from the mapKeyFn. This map\n * automatically handles collisions of keys.\n */\n\n\nvar Ii =\n/** @class */\nfunction () {\n function t(t, e) {\n this.mapKeyFn = t, this.equalsFn = e,\n /**\n * The inner map for a key/value pair. Due to the possibility of collisions we\n * keep a list of entries that we do a linear search through to find an actual\n * match. Note that collisions should be rare, so we still expect near\n * constant time lookups in practice.\n */\n this.inner = {}\n /** Get a value for this key, or undefined if it does not exist. */\n ;\n }\n\n return t.prototype.get = function (t) {\n var e = this.mapKeyFn(t),\n n = this.inner[e];\n if (void 0 !== n) for (var r = 0, i = n; r < i.length; r++) {\n var o = i[r],\n s = o[0],\n u = o[1];\n if (this.equalsFn(s, t)) return u;\n }\n }, t.prototype.has = function (t) {\n return void 0 !== this.get(t);\n },\n /** Put this key and value in the map. */\n t.prototype.set = function (t, e) {\n var n = this.mapKeyFn(t),\n r = this.inner[n];\n\n if (void 0 !== r) {\n for (var i = 0; i < r.length; i++) {\n if (this.equalsFn(r[i][0], t)) return void (r[i] = [t, e]);\n }\n\n r.push([t, e]);\n } else this.inner[n] = [[t, e]];\n },\n /**\n * Remove this key from the map. Returns a boolean if anything was deleted.\n */\n t.prototype.delete = function (t) {\n var e = this.mapKeyFn(t),\n n = this.inner[e];\n if (void 0 === n) return !1;\n\n for (var r = 0; r < n.length; r++) {\n if (this.equalsFn(n[r][0], t)) return 1 === n.length ? delete this.inner[e] : n.splice(r, 1), !0;\n }\n\n return !1;\n }, t.prototype.forEach = function (t) {\n G(this.inner, function (e, n) {\n for (var r = 0, i = n; r < i.length; r++) {\n var o = i[r],\n s = o[0],\n u = o[1];\n t(s, u);\n }\n });\n }, t.prototype.isEmpty = function () {\n return z(this.inner);\n }, t;\n}(),\n Ti =\n/** @class */\nfunction () {\n function t() {\n // A mapping of document key to the new cache entry that should be written (or null if any\n // existing cache entry should be removed).\n this.changes = new Ii(function (t) {\n return t.toString();\n }, function (t, e) {\n return t.isEqual(e);\n }), this.changesApplied = !1;\n }\n\n return t.prototype.getReadTime = function (t) {\n var e = this.changes.get(t);\n return e ? e.readTime : K.min();\n },\n /**\n * Buffers a `RemoteDocumentCache.addEntry()` call.\n *\n * You can only modify documents that have already been retrieved via\n * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).\n */\n t.prototype.addEntry = function (t, e) {\n this.assertNotApplied(), this.changes.set(t.key, {\n document: t,\n readTime: e\n });\n },\n /**\n * Buffers a `RemoteDocumentCache.removeEntry()` call.\n *\n * You can only remove documents that have already been retrieved via\n * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).\n */\n t.prototype.removeEntry = function (t, e) {\n void 0 === e && (e = null), this.assertNotApplied(), this.changes.set(t, {\n document: Nt.newInvalidDocument(t),\n readTime: e\n });\n },\n /**\n * Looks up an entry in the cache. The buffered changes will first be checked,\n * and if no buffered change applies, this will forward to\n * `RemoteDocumentCache.getEntry()`.\n *\n * @param transaction - The transaction in which to perform any persistence\n * operations.\n * @param documentKey - The key of the entry to look up.\n * @returns The cached document or an invalid document if we have nothing\n * cached.\n */\n t.prototype.getEntry = function (t, e) {\n this.assertNotApplied();\n var n = this.changes.get(e);\n return void 0 !== n ? Ir.resolve(n.document) : this.getFromCache(t, e);\n },\n /**\n * Looks up several entries in the cache, forwarding to\n * `RemoteDocumentCache.getEntry()`.\n *\n * @param transaction - The transaction in which to perform any persistence\n * operations.\n * @param documentKeys - The keys of the entries to look up.\n * @returns A map of cached documents, indexed by key. If an entry cannot be\n * found, the corresponding key will be mapped to an invalid document.\n */\n t.prototype.getEntries = function (t, e) {\n return this.getAllFromCache(t, e);\n },\n /**\n * Applies buffered changes to the underlying RemoteDocumentCache, using\n * the provided transaction.\n */\n t.prototype.apply = function (t) {\n return this.assertNotApplied(), this.changesApplied = !0, this.applyChanges(t);\n },\n /** Helper to assert this.changes is not null */\n t.prototype.assertNotApplied = function () {}, t;\n}(),\n Ei =\n/** @class */\nfunction () {\n /**\n * @param serializer - The document serializer.\n * @param indexManager - The query indexes that need to be maintained.\n */\n function t(t, e) {\n this.R = t, this.Ut = e\n /**\n * Adds the supplied entries to the cache.\n *\n * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()` to ensure proper accounting of metadata.\n */\n ;\n }\n\n return t.prototype.addEntry = function (t, e, n) {\n return Ni(t).put(Di(e), n);\n },\n /**\n * Removes a document from the cache.\n *\n * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()` to ensure proper accounting of metadata.\n */\n t.prototype.removeEntry = function (t, e) {\n var n = Ni(t),\n r = Di(e);\n return n.delete(r);\n },\n /**\n * Updates the current cache size.\n *\n * Callers to `addEntry()` and `removeEntry()` *must* call this afterwards to update the\n * cache's metadata.\n */\n t.prototype.updateMetadata = function (t, e) {\n var n = this;\n return this.getMetadata(t).next(function (r) {\n return r.byteSize += e, n.me(t, r);\n });\n }, t.prototype.getEntry = function (t, e) {\n var n = this;\n return Ni(t).get(Di(e)).next(function (t) {\n return n.ye(e, t);\n });\n },\n /**\n * Looks up an entry in the cache.\n *\n * @param documentKey - The key of the entry to look up.\n * @returns The cached document entry and its size.\n */\n t.prototype.ge = function (t, e) {\n var n = this;\n return Ni(t).get(Di(e)).next(function (t) {\n return {\n document: n.ye(e, t),\n size: ri(t)\n };\n });\n }, t.prototype.getEntries = function (t, e) {\n var n = this,\n r = Ze();\n return this.pe(t, e, function (t, e) {\n var i = n.ye(t, e);\n r = r.insert(t, i);\n }).next(function () {\n return r;\n });\n },\n /**\n * Looks up several entries in the cache.\n *\n * @param documentKeys - The set of keys entries to look up.\n * @returns A map of documents indexed by key and a map of sizes indexed by\n * key (zero if the document does not exist).\n */\n t.prototype.Ee = function (t, e) {\n var n = this,\n r = Ze(),\n i = new We(ct.comparator);\n return this.pe(t, e, function (t, e) {\n var o = n.ye(t, e);\n r = r.insert(t, o), i = i.insert(t, ri(e));\n }).next(function () {\n return {\n documents: r,\n Te: i\n };\n });\n }, t.prototype.pe = function (t, e, n) {\n if (e.isEmpty()) return Ir.resolve();\n var r = IDBKeyRange.bound(e.first().path.toArray(), e.last().path.toArray()),\n i = e.getIterator(),\n o = i.getNext();\n return Ni(t).$t({\n range: r\n }, function (t, e, r) {\n // Go through keys not found in cache.\n for (var s = ct.fromSegments(t); o && ct.comparator(o, s) < 0;) {\n n(o, null), o = i.getNext();\n }\n\n o && o.isEqual(s) && ( // Key found in cache.\n n(o, e), o = i.hasNext() ? i.getNext() : null), // Skip to the next key (if there is one).\n o ? r.Ct(o.path.toArray()) : r.done();\n }).next(function () {\n // The rest of the keys are not in the cache. One case where `iterate`\n // above won't go through them is when the cache is empty.\n for (; o;) {\n n(o, null), o = i.hasNext() ? i.getNext() : null;\n }\n });\n }, t.prototype.getDocumentsMatchingQuery = function (t, e, n) {\n var r = this,\n i = Ze(),\n o = e.path.length + 1,\n s = {};\n\n if (n.isEqual(K.min())) {\n // Documents are ordered by key, so we can use a prefix scan to narrow\n // down the documents we need to match the query against.\n var u = e.path.toArray();\n s.range = IDBKeyRange.lowerBound(u);\n } else {\n // Execute an index-free query and filter by read time. This is safe\n // since all document changes to queries that have a\n // lastLimboFreeSnapshotVersion (`sinceReadTime`) have a read time set.\n var a = e.path.toArray(),\n c = qr(n);\n s.range = IDBKeyRange.lowerBound([a, c],\n /* open= */\n !0), s.index = ar.collectionReadTimeIndex;\n }\n\n return Ni(t).$t(s, function (t, n, s) {\n // The query is actually returning any path that starts with the query\n // path prefix which may include documents in subcollections. For\n // example, a query on 'rooms' will return rooms/abc/messages/xyx but we\n // shouldn't match it. Fix this by discarding rows with document keys\n // more than one segment longer than the query path.\n if (t.length === o) {\n var u = Mr(r.R, n);\n e.path.isPrefixOf(u.key.path) ? ue(e, u) && (i = i.insert(u.key, u)) : s.done();\n }\n }).next(function () {\n return i;\n });\n }, t.prototype.newChangeBuffer = function (t) {\n return new _i(this, !!t && t.trackRemovals);\n }, t.prototype.getSize = function (t) {\n return this.getMetadata(t).next(function (t) {\n return t.byteSize;\n });\n }, t.prototype.getMetadata = function (t) {\n return Si(t).get(cr.key).next(function (t) {\n return P(!!t), t;\n });\n }, t.prototype.me = function (t, e) {\n return Si(t).put(cr.key, e);\n },\n /**\n * Decodes `remoteDoc` and returns the document (or null, if the document\n * corresponds to the format used for sentinel deletes).\n */\n t.prototype.ye = function (t, e) {\n if (e) {\n var n = Mr(this.R, e); // Whether the document is a sentinel removal and should only be used in the\n // `getNewDocumentChanges()`\n\n if (!n.isNoDocument() || !n.version.isEqual(K.min())) return n;\n }\n\n return Nt.newInvalidDocument(t);\n }, t;\n}(),\n _i =\n/** @class */\nfunction (e) {\n /**\n * @param documentCache - The IndexedDbRemoteDocumentCache to apply the changes to.\n * @param trackRemovals - Whether to create sentinel deletes that can be tracked by\n * `getNewDocumentChanges()`.\n */\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).Ie = t, r.trackRemovals = n, // A map of document sizes prior to applying the changes in this buffer.\n r.Ae = new Ii(function (t) {\n return t.toString();\n }, function (t, e) {\n return t.isEqual(e);\n }), r;\n }\n\n return t(n, e), n.prototype.applyChanges = function (t) {\n var e = this,\n n = [],\n r = 0,\n i = new $e(function (t, e) {\n return q(t.canonicalString(), e.canonicalString());\n });\n return this.changes.forEach(function (o, s) {\n var u = e.Ae.get(o);\n\n if (s.document.isValidDocument()) {\n var a = Vr(e.Ie.R, s.document, e.getReadTime(o));\n i = i.add(o.path.popLast());\n var c = ri(a);\n r += c - u, n.push(e.Ie.addEntry(t, o, a));\n } else if (r -= u, e.trackRemovals) {\n // In order to track removals, we store a \"sentinel delete\" in the\n // RemoteDocumentCache. This entry is represented by a NoDocument\n // with a version of 0 and ignored by `maybeDecodeDocument()` but\n // preserved in `getNewDocumentChanges()`.\n var h = Vr(e.Ie.R, Nt.newNoDocument(o, K.min()), e.getReadTime(o));\n n.push(e.Ie.addEntry(t, o, h));\n } else n.push(e.Ie.removeEntry(t, o));\n }), i.forEach(function (r) {\n n.push(e.Ie.Ut.addToCollectionParentIndex(t, r));\n }), n.push(this.Ie.updateMetadata(t, r)), Ir.waitFor(n);\n }, n.prototype.getFromCache = function (t, e) {\n var n = this; // Record the size of everything we load from the cache so we can compute a delta later.\n\n return this.Ie.ge(t, e).next(function (t) {\n return n.Ae.set(e, t.size), t.document;\n });\n }, n.prototype.getAllFromCache = function (t, e) {\n var n = this; // Record the size of everything we load from the cache so we can compute\n // a delta later.\n\n return this.Ie.Ee(t, e).next(function (t) {\n var e = t.documents; // Note: `getAllFromCache` returns two maps instead of a single map from\n // keys to `DocumentSizeEntry`s. This is to allow returning the\n // `MutableDocumentMap` directly, without a conversion.\n\n return t.Te.forEach(function (t, e) {\n n.Ae.set(t, e);\n }), e;\n });\n }, n;\n}(Ti);\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 * An in-memory buffer of entries to be written to a RemoteDocumentCache.\n * It can be used to batch up a set of changes to be written to the cache, but\n * additionally supports reading entries back with the `getEntry()` method,\n * falling back to the underlying RemoteDocumentCache if no entry is\n * buffered.\n *\n * Entries added to the cache *must* be read first. This is to facilitate\n * calculating the size delta of the pending changes.\n *\n * PORTING NOTE: This class was implemented then removed from other platforms.\n * If byte-counting ends up being needed on the other platforms, consider\n * porting this class as part of that implementation work.\n */\n\n\nfunction Si(t) {\n return Rr(t, cr.store);\n}\n/**\n * Helper to get a typed SimpleDbStore for the remoteDocuments object store.\n */\n\n\nfunction Ni(t) {\n return Rr(t, ar.store);\n}\n\nfunction Di(t) {\n return t.path.toArray();\n}\n/**\n * @license\n * Copyright 2020 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/** Performs database creation and schema upgrades. */\n\n\nvar Ai =\n/** @class */\nfunction () {\n function t(t) {\n this.R = t;\n }\n /**\n * Performs database creation and schema upgrades.\n *\n * Note that in production, this method is only ever used to upgrade the schema\n * to SCHEMA_VERSION. Different values of toVersion are only used for testing\n * and local feature development.\n */\n\n\n return t.prototype.Rt = function (t, e, n, r) {\n var i = this;\n P(n < r && n >= 0 && r <= 11);\n var o = new Tr(\"createOrUpgrade\", e);\n n < 1 && r >= 1 && (function (t) {\n t.createObjectStore(nr.store);\n }(t), function (t) {\n t.createObjectStore(rr.store, {\n keyPath: rr.keyPath\n }), t.createObjectStore(ir.store, {\n keyPath: ir.keyPath,\n autoIncrement: !0\n }).createIndex(ir.userMutationsIndex, ir.userMutationsKeyPath, {\n unique: !0\n }), t.createObjectStore(or.store);\n }(t), ki(t), function (t) {\n t.createObjectStore(ar.store);\n }(t)); // Migration 2 to populate the targetGlobal object no longer needed since\n // migration 3 unconditionally clears it.\n\n var s = Ir.resolve();\n return n < 3 && r >= 3 && ( // Brand new clients don't need to drop and recreate--only clients that\n // potentially have corrupt data.\n 0 !== n && (function (t) {\n t.deleteObjectStore(fr.store), t.deleteObjectStore(hr.store), t.deleteObjectStore(lr.store);\n }(t), ki(t)), s = s.next(function () {\n /**\n * Creates the target global singleton row.\n *\n * @param txn - The version upgrade transaction for indexeddb\n */\n return function (t) {\n var e = t.store(lr.store),\n n = new lr(\n /*highestTargetId=*/\n 0,\n /*lastListenSequenceNumber=*/\n 0, K.min().toTimestamp(),\n /*targetCount=*/\n 0);\n return e.put(lr.key, n);\n }(o);\n })), n < 4 && r >= 4 && (0 !== n && ( // Schema version 3 uses auto-generated keys to generate globally unique\n // mutation batch IDs (this was previously ensured internally by the\n // client). To migrate to the new schema, we have to read all mutations\n // and write them back out. We preserve the existing batch IDs to guarantee\n // consistency with other object stores. Any further mutation batch IDs will\n // be auto-generated.\n s = s.next(function () {\n return function (t, e) {\n return e.store(ir.store).Nt().next(function (n) {\n t.deleteObjectStore(ir.store), t.createObjectStore(ir.store, {\n keyPath: ir.keyPath,\n autoIncrement: !0\n }).createIndex(ir.userMutationsIndex, ir.userMutationsKeyPath, {\n unique: !0\n });\n var r = e.store(ir.store),\n i = n.map(function (t) {\n return r.put(t);\n });\n return Ir.waitFor(i);\n });\n }(t, o);\n })), s = s.next(function () {\n !function (t) {\n t.createObjectStore(pr.store, {\n keyPath: pr.keyPath\n });\n }(t);\n })), n < 5 && r >= 5 && (s = s.next(function () {\n return i.Re(o);\n })), n < 6 && r >= 6 && (s = s.next(function () {\n return function (t) {\n t.createObjectStore(cr.store);\n }(t), i.be(o);\n })), n < 7 && r >= 7 && (s = s.next(function () {\n return i.ve(o);\n })), n < 8 && r >= 8 && (s = s.next(function () {\n return i.Pe(t, o);\n })), n < 9 && r >= 9 && (s = s.next(function () {\n // Multi-Tab used to manage its own changelog, but this has been moved\n // to the DbRemoteDocument object store itself. Since the previous change\n // log only contained transient data, we can drop its object store.\n !function (t) {\n t.objectStoreNames.contains(\"remoteDocumentChanges\") && t.deleteObjectStore(\"remoteDocumentChanges\");\n }(t), function (t) {\n var e = t.objectStore(ar.store);\n e.createIndex(ar.readTimeIndex, ar.readTimeIndexPath, {\n unique: !1\n }), e.createIndex(ar.collectionReadTimeIndex, ar.collectionReadTimeIndexPath, {\n unique: !1\n });\n }(e);\n })), n < 10 && r >= 10 && (s = s.next(function () {\n return i.Ve(o);\n })), n < 11 && r >= 11 && (s = s.next(function () {\n !function (t) {\n t.createObjectStore(yr.store, {\n keyPath: yr.keyPath\n });\n }(t), function (t) {\n t.createObjectStore(vr.store, {\n keyPath: vr.keyPath\n });\n }(t);\n })), s;\n }, t.prototype.be = function (t) {\n var e = 0;\n return t.store(ar.store).$t(function (t, n) {\n e += ri(n);\n }).next(function () {\n var n = new cr(e);\n return t.store(cr.store).put(cr.key, n);\n });\n }, t.prototype.Re = function (t) {\n var e = this,\n n = t.store(rr.store),\n r = t.store(ir.store);\n return n.Nt().next(function (n) {\n return Ir.forEach(n, function (n) {\n var i = IDBKeyRange.bound([n.userId, -1], [n.userId, n.lastAcknowledgedBatchId]);\n return r.Nt(ir.userMutationsIndex, i).next(function (r) {\n return Ir.forEach(r, function (r) {\n P(r.userId === n.userId);\n var i = Kr(e.R, r);\n return ni(t, n.userId, i).next(function () {});\n });\n });\n });\n });\n },\n /**\n * Ensures that every document in the remote document cache has a corresponding sentinel row\n * with a sequence number. Missing rows are given the most recently used sequence number.\n */\n t.prototype.ve = function (t) {\n var e = t.store(fr.store),\n n = t.store(ar.store);\n return t.store(lr.store).get(lr.key).next(function (t) {\n var r = [];\n return n.$t(function (n, i) {\n var o = new H(n),\n s = function (t) {\n return [0, Xn(t)];\n }(o);\n\n r.push(e.get(s).next(function (n) {\n return n ? Ir.resolve() : function (n) {\n return e.put(new fr(0, Xn(n), t.highestListenSequenceNumber));\n }(o);\n }));\n }).next(function () {\n return Ir.waitFor(r);\n });\n });\n }, t.prototype.Pe = function (t, e) {\n // Create the index.\n t.createObjectStore(dr.store, {\n keyPath: dr.keyPath\n });\n\n var n = e.store(dr.store),\n r = new Xr(),\n i = function i(t) {\n if (r.add(t)) {\n var e = t.lastSegment(),\n i = t.popLast();\n return n.put({\n collectionId: e,\n parent: Xn(i)\n });\n }\n }; // Helper to add an index entry iff we haven't already written it.\n // Index existing remote documents.\n\n\n return e.store(ar.store).$t({\n Ft: !0\n }, function (t, e) {\n var n = new H(t);\n return i(n.popLast());\n }).next(function () {\n return e.store(or.store).$t({\n Ft: !0\n }, function (t, e) {\n t[0];\n var n = t[1];\n t[2];\n var r = tr(n);\n return i(r.popLast());\n });\n });\n }, t.prototype.Ve = function (t) {\n var e = this,\n n = t.store(hr.store);\n return n.$t(function (t, r) {\n var i = Qr(r),\n o = Gr(e.R, i);\n return n.put(o);\n });\n }, t;\n}();\n\nfunction ki(t) {\n t.createObjectStore(fr.store, {\n keyPath: fr.keyPath\n }).createIndex(fr.documentTargetsIndex, fr.documentTargetsKeyPath, {\n unique: !0\n }), // NOTE: This is unique only because the TargetId is the suffix.\n t.createObjectStore(hr.store, {\n keyPath: hr.keyPath\n }).createIndex(hr.queryTargetsIndexName, hr.queryTargetsKeyPath, {\n unique: !0\n }), t.createObjectStore(lr.store);\n}\n\nvar Ci = \"Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.\",\n xi =\n/** @class */\nfunction () {\n function t(\n /**\n * Whether to synchronize the in-memory state of multiple tabs and share\n * access to local persistence.\n */\n e, n, r, i, o, s, u, a, c,\n /**\n * If set to true, forcefully obtains database access. Existing tabs will\n * no longer be able to access IndexedDB.\n */\n h) {\n if (this.allowTabSynchronization = e, this.persistenceKey = n, this.clientId = r, this.Se = o, this.window = s, this.document = u, this.De = c, this.Ce = h, this.Ne = null, this.xe = !1, this.isPrimary = !1, this.networkEnabled = !0,\n /** Our window.unload handler, if registered. */\n this.ke = null, this.inForeground = !1,\n /** Our 'visibilitychange' listener if registered. */\n this.Fe = null,\n /** The client metadata refresh task. */\n this.$e = null,\n /** The last time we garbage collected the client metadata object store. */\n this.Oe = Number.NEGATIVE_INFINITY,\n /** A listener to notify on primary state changes. */\n this.Me = function (t) {\n return Promise.resolve();\n }, !t.yt()) throw new D(N.UNIMPLEMENTED, \"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.\");\n this.referenceDelegate = new wi(this, i), this.Le = n + \"main\", this.R = new Fr(a), this.Be = new Er(this.Le, 11, new Ai(this.R)), this.qe = new hi(this.referenceDelegate, this.R), this.Ut = new Jr(), this.Ue = function (t, e) {\n return new Ei(t, e);\n }(this.R, this.Ut), this.Ke = new Wr(), this.window && this.window.localStorage ? this.Qe = this.window.localStorage : (this.Qe = null, !1 === h && x(\"IndexedDbPersistence\", \"LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page.\"));\n }\n /**\n * Attempt to start IndexedDb persistence.\n *\n * @returns Whether persistence was enabled.\n */\n\n\n return t.prototype.start = function () {\n var t = this; // NOTE: This is expected to fail sometimes (in the case of another tab\n // already having the persistence lock), so it's the first thing we should\n // do.\n\n return this.je().then(function () {\n if (!t.isPrimary && !t.allowTabSynchronization) // Fail `start()` if `synchronizeTabs` is disabled and we cannot\n // obtain the primary lease.\n throw new D(N.FAILED_PRECONDITION, Ci);\n return t.We(), t.Ge(), t.ze(), t.runTransaction(\"getHighestListenSequenceNumber\", \"readonly\", function (e) {\n return t.qe.getHighestSequenceNumber(e);\n });\n }).then(function (e) {\n t.Ne = new S(e, t.De);\n }).then(function () {\n t.xe = !0;\n }).catch(function (e) {\n return t.Be && t.Be.close(), Promise.reject(e);\n });\n },\n /**\n * Registers a listener that gets called when the primary state of the\n * instance changes. Upon registering, this listener is invoked immediately\n * with the current primary state.\n *\n * PORTING NOTE: This is only used for Web multi-tab.\n */\n t.prototype.He = function (t) {\n var e = this;\n return this.Me = function (i) {\n return n(e, void 0, void 0, function () {\n return r(this, function (e) {\n return this.started ? [2\n /*return*/\n , t(i)] : [2\n /*return*/\n ];\n });\n });\n }, t(this.isPrimary);\n },\n /**\n * Registers a listener that gets called when the database receives a\n * version change event indicating that it has deleted.\n *\n * PORTING NOTE: This is only used for Web multi-tab.\n */\n t.prototype.setDatabaseDeletedListener = function (t) {\n var e = this;\n this.Be.vt(function (i) {\n return n(e, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return null === i.newVersion ? [4\n /*yield*/\n , t()] : [3\n /*break*/\n , 2];\n\n case 1:\n e.sent(), e.label = 2;\n\n case 2:\n return [2\n /*return*/\n ];\n }\n });\n });\n });\n },\n /**\n * Adjusts the current network state in the client's metadata, potentially\n * affecting the primary lease.\n *\n * PORTING NOTE: This is only used for Web multi-tab.\n */\n t.prototype.setNetworkEnabled = function (t) {\n var e = this;\n this.networkEnabled !== t && (this.networkEnabled = t, // Schedule a primary lease refresh for immediate execution. The eventual\n // lease update will be propagated via `primaryStateListener`.\n this.Se.enqueueAndForget(function () {\n return n(e, void 0, void 0, function () {\n return r(this, function (t) {\n switch (t.label) {\n case 0:\n return this.started ? [4\n /*yield*/\n , this.je()] : [3\n /*break*/\n , 2];\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n return [2\n /*return*/\n ];\n }\n });\n });\n }));\n },\n /**\n * Updates the client metadata in IndexedDb and attempts to either obtain or\n * extend the primary lease for the local client. Asynchronously notifies the\n * primary state listener if the client either newly obtained or released its\n * primary lease.\n */\n t.prototype.je = function () {\n var t = this;\n return this.runTransaction(\"updateClientMetadataAndTryBecomePrimary\", \"readwrite\", function (e) {\n return Li(e).put(new pr(t.clientId, Date.now(), t.networkEnabled, t.inForeground)).next(function () {\n if (t.isPrimary) return t.Je(e).next(function (e) {\n e || (t.isPrimary = !1, t.Se.enqueueRetryable(function () {\n return t.Me(!1);\n }));\n });\n }).next(function () {\n return t.Ye(e);\n }).next(function (n) {\n return t.isPrimary && !n ? t.Xe(e).next(function () {\n return !1;\n }) : !!n && t.Ze(e).next(function () {\n return !0;\n });\n });\n }).catch(function (e) {\n if (Nr(e)) // Proceed with the existing state. Any subsequent access to\n // IndexedDB will verify the lease.\n return C(\"IndexedDbPersistence\", \"Failed to extend owner lease: \", e), t.isPrimary;\n if (!t.allowTabSynchronization) throw e;\n return C(\"IndexedDbPersistence\", \"Releasing owner lease after error during lease refresh\", e),\n /* isPrimary= */\n !1;\n }).then(function (e) {\n t.isPrimary !== e && t.Se.enqueueRetryable(function () {\n return t.Me(e);\n }), t.isPrimary = e;\n });\n }, t.prototype.Je = function (t) {\n var e = this;\n return Ri(t).get(nr.key).next(function (t) {\n return Ir.resolve(e.tn(t));\n });\n }, t.prototype.en = function (t) {\n return Li(t).delete(this.clientId);\n },\n /**\n * If the garbage collection threshold has passed, prunes the\n * RemoteDocumentChanges and the ClientMetadata store based on the last update\n * time of all clients.\n */\n t.prototype.nn = function () {\n return n(this, void 0, void 0, function () {\n var t,\n e,\n n,\n i,\n o = this;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return !this.isPrimary || this.sn(this.Oe, 18e5) ? [3\n /*break*/\n , 2] : (this.Oe = Date.now(), [4\n /*yield*/\n , this.runTransaction(\"maybeGarbageCollectMultiClientState\", \"readwrite-primary\", function (t) {\n var e = Rr(t, pr.store);\n return e.Nt().next(function (t) {\n var n = o.rn(t, 18e5),\n r = t.filter(function (t) {\n return -1 === n.indexOf(t);\n }); // Delete metadata for clients that are no longer considered active.\n\n return Ir.forEach(r, function (t) {\n return e.delete(t.clientId);\n }).next(function () {\n return r;\n });\n });\n }).catch(function () {\n return [];\n })]);\n\n case 1:\n // Delete potential leftover entries that may continue to mark the\n // inactive clients as zombied in LocalStorage.\n // Ideally we'd delete the IndexedDb and LocalStorage zombie entries for\n // the client atomically, but we can't. So we opt to delete the IndexedDb\n // entries first to avoid potentially reviving a zombied client.\n if (t = r.sent(), this.Qe) for (e = 0, n = t; e < n.length; e++) {\n i = n[e], this.Qe.removeItem(this.on(i.clientId));\n }\n r.label = 2;\n\n case 2:\n return [2\n /*return*/\n ];\n }\n });\n });\n },\n /**\n * Schedules a recurring timer to update the client metadata and to either\n * extend or acquire the primary lease if the client is eligible.\n */\n t.prototype.ze = function () {\n var t = this;\n this.$e = this.Se.enqueueAfterDelay(\"client_metadata_refresh\"\n /* ClientMetadataRefresh */\n , 4e3, function () {\n return t.je().then(function () {\n return t.nn();\n }).then(function () {\n return t.ze();\n });\n });\n },\n /** Checks whether `client` is the local client. */\n t.prototype.tn = function (t) {\n return !!t && t.ownerId === this.clientId;\n },\n /**\n * Evaluate the state of all active clients and determine whether the local\n * client is or can act as the holder of the primary lease. Returns whether\n * the client is eligible for the lease, but does not actually acquire it.\n * May return 'false' even if there is no active leaseholder and another\n * (foreground) client should become leaseholder instead.\n */\n t.prototype.Ye = function (t) {\n var e = this;\n return this.Ce ? Ir.resolve(!0) : Ri(t).get(nr.key).next(function (n) {\n // A client is eligible for the primary lease if:\n // - its network is enabled and the client's tab is in the foreground.\n // - its network is enabled and no other client's tab is in the\n // foreground.\n // - every clients network is disabled and the client's tab is in the\n // foreground.\n // - every clients network is disabled and no other client's tab is in\n // the foreground.\n // - the `forceOwningTab` setting was passed in.\n if (null !== n && e.sn(n.leaseTimestampMs, 5e3) && !e.cn(n.ownerId)) {\n if (e.tn(n) && e.networkEnabled) return !0;\n\n if (!e.tn(n)) {\n if (!n.allowTabSynchronization) // Fail the `canActAsPrimary` check if the current leaseholder has\n // not opted into multi-tab synchronization. If this happens at\n // client startup, we reject the Promise returned by\n // `enablePersistence()` and the user can continue to use Firestore\n // with in-memory persistence.\n // If this fails during a lease refresh, we will instead block the\n // AsyncQueue from executing further operations. Note that this is\n // acceptable since mixing & matching different `synchronizeTabs`\n // settings is not supported.\n // TODO(b/114226234): Remove this check when `synchronizeTabs` can\n // no longer be turned off.\n throw new D(N.FAILED_PRECONDITION, Ci);\n return !1;\n }\n }\n\n return !(!e.networkEnabled || !e.inForeground) || Li(t).Nt().next(function (t) {\n return void 0 === e.rn(t, 5e3).find(function (t) {\n if (e.clientId !== t.clientId) {\n var n = !e.networkEnabled && t.networkEnabled,\n r = !e.inForeground && t.inForeground,\n i = e.networkEnabled === t.networkEnabled;\n if (n || r && i) return !0;\n }\n\n return !1;\n });\n });\n }).next(function (t) {\n return e.isPrimary !== t && C(\"IndexedDbPersistence\", \"Client \" + (t ? \"is\" : \"is not\") + \" eligible for a primary lease.\"), t;\n });\n }, t.prototype.shutdown = function () {\n return n(this, void 0, void 0, function () {\n var t = this;\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n // Use `SimpleDb.runTransaction` directly to avoid failing if another tab\n // has obtained the primary lease.\n // The shutdown() operations are idempotent and can be called even when\n // start() aborted (e.g. because it couldn't acquire the persistence lease).\n return this.xe = !1, this.un(), this.$e && (this.$e.cancel(), this.$e = null), this.an(), this.hn(), [4\n /*yield*/\n , this.Be.runTransaction(\"shutdown\", \"readwrite\", [nr.store, pr.store], function (e) {\n var n = new xr(e, S.o);\n return t.Xe(n).next(function () {\n return t.en(n);\n });\n })];\n\n case 1:\n // The shutdown() operations are idempotent and can be called even when\n // start() aborted (e.g. because it couldn't acquire the persistence lease).\n // Use `SimpleDb.runTransaction` directly to avoid failing if another tab\n // has obtained the primary lease.\n return e.sent(), this.Be.close(), // Remove the entry marking the client as zombied from LocalStorage since\n // we successfully deleted its metadata from IndexedDb.\n this.ln(), [2\n /*return*/\n ];\n }\n });\n });\n },\n /**\n * Returns clients that are not zombied and have an updateTime within the\n * provided threshold.\n */\n t.prototype.rn = function (t, e) {\n var n = this;\n return t.filter(function (t) {\n return n.sn(t.updateTimeMs, e) && !n.cn(t.clientId);\n });\n },\n /**\n * Returns the IDs of the clients that are currently active. If multi-tab\n * is not supported, returns an array that only contains the local client's\n * ID.\n *\n * PORTING NOTE: This is only used for Web multi-tab.\n */\n t.prototype.fn = function () {\n var t = this;\n return this.runTransaction(\"getActiveClients\", \"readonly\", function (e) {\n return Li(e).Nt().next(function (e) {\n return t.rn(e, 18e5).map(function (t) {\n return t.clientId;\n });\n });\n });\n }, Object.defineProperty(t.prototype, \"started\", {\n get: function get() {\n return this.xe;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.getMutationQueue = function (t) {\n return ii.Qt(t, this.R, this.Ut, this.referenceDelegate);\n }, t.prototype.getTargetCache = function () {\n return this.qe;\n }, t.prototype.getRemoteDocumentCache = function () {\n return this.Ue;\n }, t.prototype.getIndexManager = function () {\n return this.Ut;\n }, t.prototype.getBundleCache = function () {\n return this.Ke;\n }, t.prototype.runTransaction = function (t, e, n) {\n var r = this;\n C(\"IndexedDbPersistence\", \"Starting transaction:\", t);\n var i,\n o = \"readonly\" === e ? \"readonly\" : \"readwrite\"; // Do all transactions as readwrite against all object stores, since we\n // are the only reader/writer.\n\n return this.Be.runTransaction(t, o, mr, function (o) {\n return i = new xr(o, r.Ne ? r.Ne.next() : S.o), \"readwrite-primary\" === e ? r.Je(i).next(function (t) {\n return !!t || r.Ye(i);\n }).next(function (e) {\n if (!e) throw x(\"Failed to obtain primary lease for action '\" + t + \"'.\"), r.isPrimary = !1, r.Se.enqueueRetryable(function () {\n return r.Me(!1);\n }), new D(N.FAILED_PRECONDITION, gr);\n return n(i);\n }).next(function (t) {\n return r.Ze(i).next(function () {\n return t;\n });\n }) : r.dn(i).next(function () {\n return n(i);\n });\n }).then(function (t) {\n return i.raiseOnCommittedEvent(), t;\n });\n },\n /**\n * Verifies that the current tab is the primary leaseholder or alternatively\n * that the leaseholder has opted into multi-tab synchronization.\n */\n // TODO(b/114226234): Remove this check when `synchronizeTabs` can no longer\n // be turned off.\n t.prototype.dn = function (t) {\n var e = this;\n return Ri(t).get(nr.key).next(function (t) {\n if (null !== t && e.sn(t.leaseTimestampMs, 5e3) && !e.cn(t.ownerId) && !e.tn(t) && !(e.Ce || e.allowTabSynchronization && t.allowTabSynchronization)) throw new D(N.FAILED_PRECONDITION, Ci);\n });\n },\n /**\n * Obtains or extends the new primary lease for the local client. This\n * method does not verify that the client is eligible for this lease.\n */\n t.prototype.Ze = function (t) {\n var e = new nr(this.clientId, this.allowTabSynchronization, Date.now());\n return Ri(t).put(nr.key, e);\n }, t.yt = function () {\n return Er.yt();\n },\n /** Checks the primary lease and removes it if we are the current primary. */\n t.prototype.Xe = function (t) {\n var e = this,\n n = Ri(t);\n return n.get(nr.key).next(function (t) {\n return e.tn(t) ? (C(\"IndexedDbPersistence\", \"Releasing primary lease.\"), n.delete(nr.key)) : Ir.resolve();\n });\n },\n /** Verifies that `updateTimeMs` is within `maxAgeMs`. */\n t.prototype.sn = function (t, e) {\n var n = Date.now();\n return !(t < n - e || t > n && (x(\"Detected an update time that is in the future: \" + t + \" > \" + n), 1));\n }, t.prototype.We = function () {\n var t = this;\n null !== this.document && \"function\" == typeof this.document.addEventListener && (this.Fe = function () {\n t.Se.enqueueAndForget(function () {\n return t.inForeground = \"visible\" === t.document.visibilityState, t.je();\n });\n }, this.document.addEventListener(\"visibilitychange\", this.Fe), this.inForeground = \"visible\" === this.document.visibilityState);\n }, t.prototype.an = function () {\n this.Fe && (this.document.removeEventListener(\"visibilitychange\", this.Fe), this.Fe = null);\n },\n /**\n * Attaches a window.unload handler that will synchronously write our\n * clientId to a \"zombie client id\" location in LocalStorage. This can be used\n * by tabs trying to acquire the primary lease to determine that the lease\n * is no longer valid even if the timestamp is recent. This is particularly\n * important for the refresh case (so the tab correctly re-acquires the\n * primary lease). LocalStorage is used for this rather than IndexedDb because\n * it is a synchronous API and so can be used reliably from an unload\n * handler.\n */\n t.prototype.Ge = function () {\n var t,\n e = this;\n \"function\" == typeof (null === (t = this.window) || void 0 === t ? void 0 : t.addEventListener) && (this.ke = function () {\n // Note: In theory, this should be scheduled on the AsyncQueue since it\n // accesses internal state. We execute this code directly during shutdown\n // to make sure it gets a chance to run.\n e.un(), o() && navigator.appVersion.match(\"Version/14\") && // On Safari 14, we do not run any cleanup actions as it might trigger\n // a bug that prevents Safari from re-opening IndexedDB during the\n // next page load.\n // See https://bugs.webkit.org/show_bug.cgi?id=226547\n e.Se.enterRestrictedMode(\n /* purgeExistingTasks= */\n !0), e.Se.enqueueAndForget(function () {\n return e.shutdown();\n });\n }, this.window.addEventListener(\"pagehide\", this.ke));\n }, t.prototype.hn = function () {\n this.ke && (this.window.removeEventListener(\"pagehide\", this.ke), this.ke = null);\n },\n /**\n * Returns whether a client is \"zombied\" based on its LocalStorage entry.\n * Clients become zombied when their tab closes without running all of the\n * cleanup logic in `shutdown()`.\n */\n t.prototype.cn = function (t) {\n var e;\n\n try {\n var n = null !== (null === (e = this.Qe) || void 0 === e ? void 0 : e.getItem(this.on(t)));\n return C(\"IndexedDbPersistence\", \"Client '\" + t + \"' \" + (n ? \"is\" : \"is not\") + \" zombied in LocalStorage\"), n;\n } catch (t) {\n // Gracefully handle if LocalStorage isn't working.\n return x(\"IndexedDbPersistence\", \"Failed to get zombied client id.\", t), !1;\n }\n },\n /**\n * Record client as zombied (a client that had its tab closed). Zombied\n * clients are ignored during primary tab selection.\n */\n t.prototype.un = function () {\n if (this.Qe) try {\n this.Qe.setItem(this.on(this.clientId), String(Date.now()));\n } catch (t) {\n // Gracefully handle if LocalStorage isn't available / working.\n x(\"Failed to set zombie client id.\", t);\n }\n },\n /** Removes the zombied client entry if it exists. */\n t.prototype.ln = function () {\n if (this.Qe) try {\n this.Qe.removeItem(this.on(this.clientId));\n } catch (t) {// Ignore\n }\n }, t.prototype.on = function (t) {\n return \"firestore_zombie_\" + this.persistenceKey + \"_\" + t;\n }, t;\n}();\n/**\n * Oldest acceptable age in milliseconds for client metadata before the client\n * is considered inactive and its associated data is garbage collected.\n */\n\n/**\n * An IndexedDB-backed instance of Persistence. Data is stored persistently\n * across sessions.\n *\n * On Web only, the Firestore SDKs support shared access to its persistence\n * layer. This allows multiple browser tabs to read and write to IndexedDb and\n * to synchronize state even without network connectivity. Shared access is\n * currently optional and not enabled unless all clients invoke\n * `enablePersistence()` with `{synchronizeTabs:true}`.\n *\n * In multi-tab mode, if multiple clients are active at the same time, the SDK\n * will designate one client as the “primary client”. An effort is made to pick\n * a visible, network-connected and active client, and this client is\n * responsible for letting other clients know about its presence. The primary\n * client writes a unique client-generated identifier (the client ID) to\n * IndexedDb’s “owner” store every 4 seconds. If the primary client fails to\n * update this entry, another client can acquire the lease and take over as\n * primary.\n *\n * Some persistence operations in the SDK are designated as primary-client only\n * operations. This includes the acknowledgment of mutations and all updates of\n * remote documents. The effects of these operations are written to persistence\n * and then broadcast to other tabs via LocalStorage (see\n * `WebStorageSharedClientState`), which then refresh their state from\n * persistence.\n *\n * Similarly, the primary client listens to notifications sent by secondary\n * clients to discover persistence changes written by secondary clients, such as\n * the addition of new mutations and query targets.\n *\n * If multi-tab is not enabled and another tab already obtained the primary\n * lease, IndexedDbPersistence enters a failed state and all subsequent\n * operations will automatically fail.\n *\n * Additionally, there is an optimization so that when a tab is closed, the\n * primary lease is released immediately (this is especially important to make\n * sure that a refreshed tab is able to immediately re-acquire the primary\n * lease). Unfortunately, IndexedDB cannot be reliably used in window.unload\n * since it is an asynchronous API. So in addition to attempting to give up the\n * lease, the leaseholder writes its client ID to a \"zombiedClient\" entry in\n * LocalStorage which acts as an indicator that another tab should go ahead and\n * take the primary lease immediately regardless of the current lease timestamp.\n *\n * TODO(b/114226234): Remove `synchronizeTabs` section when multi-tab is no\n * longer optional.\n */\n\n/**\n * Helper to get a typed SimpleDbStore for the primary client object store.\n */\n\n\nfunction Ri(t) {\n return Rr(t, nr.store);\n}\n/**\n * Helper to get a typed SimpleDbStore for the client metadata object store.\n */\n\n\nfunction Li(t) {\n return Rr(t, pr.store);\n}\n/**\n * Generates a string used as a prefix when storing data in IndexedDB and\n * LocalStorage.\n */\n\n\nfunction Oi(t, e) {\n // Use two different prefix formats:\n // * firestore / persistenceKey / projectID . databaseID / ...\n // * firestore / persistenceKey / projectID / ...\n // projectIDs are DNS-compatible names and cannot contain dots\n // so there's no danger of collisions.\n var n = t.projectId;\n return t.isDefaultDatabase || (n += \".\" + t.database), \"firestore/\" + e + \"/\" + n + \"/\"\n /**\n * @license\n * Copyright 2020 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\nvar Pi = function Pi(t, e) {\n this.progress = t, this.wn = e;\n},\n Fi =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this.Ue = t, this._n = e, this.Ut = n\n /**\n * Get the local view of the document identified by `key`.\n *\n * @returns Local view of the document or null if we don't have any cached\n * state for it.\n */\n ;\n }\n\n return t.prototype.mn = function (t, e) {\n var n = this;\n return this._n.getAllMutationBatchesAffectingDocumentKey(t, e).next(function (r) {\n return n.yn(t, e, r);\n });\n },\n /** Internal version of `getDocument` that allows reusing batches. */\n t.prototype.yn = function (t, e, n) {\n return this.Ue.getEntry(t, e).next(function (t) {\n for (var e = 0, r = n; e < r.length; e++) {\n r[e].applyToLocalView(t);\n }\n\n return t;\n });\n }, // Returns the view of the given `docs` as they would appear after applying\n // all mutations in the given `batches`.\n t.prototype.gn = function (t, e) {\n t.forEach(function (t, n) {\n for (var r = 0, i = e; r < i.length; r++) {\n i[r].applyToLocalView(n);\n }\n });\n },\n /**\n * Gets the local view of the documents identified by `keys`.\n *\n * If we don't have cached state for a document in `keys`, a NoDocument will\n * be stored for that key in the resulting set.\n */\n t.prototype.pn = function (t, e) {\n var n = this;\n return this.Ue.getEntries(t, e).next(function (e) {\n return n.En(t, e).next(function () {\n return e;\n });\n });\n },\n /**\n * Applies the local view the given `baseDocs` without retrieving documents\n * from the local store.\n */\n t.prototype.En = function (t, e) {\n var n = this;\n return this._n.getAllMutationBatchesAffectingDocumentKeys(t, e).next(function (t) {\n return n.gn(e, t);\n });\n },\n /**\n * Performs a query against the local view of all documents.\n *\n * @param transaction - The persistence transaction.\n * @param query - The query to match documents against.\n * @param sinceReadTime - If not set to SnapshotVersion.min(), return only\n * documents that have been read since this snapshot version (exclusive).\n */\n t.prototype.getDocumentsMatchingQuery = function (t, e, n) {\n /**\n * Returns whether the query matches a single document by path (rather than a\n * collection).\n */\n return function (t) {\n return ct.isDocumentKey(t.path) && null === t.collectionGroup && 0 === t.filters.length;\n }(e) ? this.Tn(t, e.path) : te(e) ? this.In(t, e, n) : this.An(t, e, n);\n }, t.prototype.Tn = function (t, e) {\n // Just do a simple document lookup.\n return this.mn(t, new ct(e)).next(function (t) {\n var e = en();\n return t.isFoundDocument() && (e = e.insert(t.key, t)), e;\n });\n }, t.prototype.In = function (t, e, n) {\n var r = this,\n i = e.collectionGroup,\n o = en();\n return this.Ut.getCollectionParents(t, i).next(function (s) {\n return Ir.forEach(s, function (s) {\n var u = function (t, e) {\n return new Wt(e,\n /*collectionGroup=*/\n null, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);\n }(e, s.child(i));\n\n return r.An(t, u, n).next(function (t) {\n t.forEach(function (t, e) {\n o = o.insert(t, e);\n });\n });\n }).next(function () {\n return o;\n });\n });\n }, t.prototype.An = function (t, e, n) {\n var r,\n i,\n o = this; // Query the remote documents and overlay mutations.\n\n return this.Ue.getDocumentsMatchingQuery(t, e, n).next(function (n) {\n return r = n, o._n.getAllMutationBatchesAffectingQuery(t, e);\n }).next(function (e) {\n return i = e, o.Rn(t, i, r).next(function (t) {\n r = t;\n\n for (var e = 0, n = i; e < n.length; e++) {\n for (var o = n[e], s = 0, u = o.mutations; s < u.length; s++) {\n var a = u[s],\n c = a.key,\n h = r.get(c);\n null == h && ( // Create invalid document to apply mutations on top of\n h = Nt.newInvalidDocument(c), r = r.insert(c, h)), xe(a, h, o.localWriteTime), h.isFoundDocument() || (r = r.remove(c));\n }\n }\n });\n }).next(function () {\n // Finally, filter out any documents that don't actually match\n // the query.\n return r.forEach(function (t, n) {\n ue(e, n) || (r = r.remove(t));\n }), r;\n });\n }, t.prototype.Rn = function (t, e, n) {\n for (var r = sn(), i = 0, o = e; i < o.length; i++) {\n for (var s = 0, u = o[i].mutations; s < u.length; s++) {\n var a = u[s];\n a instanceof Fe && null === n.get(a.key) && (r = r.add(a.key));\n }\n }\n\n var c = n;\n return this.Ue.getEntries(t, r).next(function (t) {\n return t.forEach(function (t, e) {\n e.isFoundDocument() && (c = c.insert(t, e));\n }), c;\n });\n }, t;\n}(),\n Mi =\n/** @class */\nfunction () {\n function t(t, e, n, r) {\n this.targetId = t, this.fromCache = e, this.bn = n, this.vn = r;\n }\n\n return t.Pn = function (e, n) {\n for (var r = sn(), i = sn(), o = 0, s = n.docChanges; o < s.length; o++) {\n var u = s[o];\n\n switch (u.type) {\n case 0\n /* Added */\n :\n r = r.add(u.doc.key);\n break;\n\n case 1\n /* Removed */\n :\n i = i.add(u.doc.key);\n // do nothing\n }\n }\n\n return new t(e, n.fromCache, r, i);\n }, t;\n}(),\n Vi =\n/** @class */\nfunction () {\n function t() {}\n /** Sets the document view to query against. */\n\n\n return t.prototype.Vn = function (t) {\n this.Sn = t;\n },\n /** Returns all local documents matching the specified query. */\n t.prototype.getDocumentsMatchingQuery = function (t, e, n, r) {\n var i = this; // Queries that match all documents don't benefit from using\n // key-based lookups. It is more efficient to scan all documents in a\n // collection, rather than to perform individual lookups.\n\n return function (t) {\n return 0 === t.filters.length && null === t.limit && null == t.startAt && null == t.endAt && (0 === t.explicitOrderBy.length || 1 === t.explicitOrderBy.length && t.explicitOrderBy[0].field.isKeyField());\n }(e) || n.isEqual(K.min()) ? this.Dn(t, e) : this.Sn.pn(t, r).next(function (o) {\n var s = i.Cn(e, o);\n return ($t(e) || Xt(e)) && i.Nn(e.limitType, s, r, n) ? i.Dn(t, e) : (k() <= y.DEBUG && C(\"QueryEngine\", \"Re-using previous result from %s to execute query: %s\", n.toString(), se(e)), i.Sn.getDocumentsMatchingQuery(t, e, n).next(function (t) {\n // We merge `previousResults` into `updateResults`, since\n // `updateResults` is already a DocumentMap. If a document is\n // contained in both lists, then its contents are the same.\n return s.forEach(function (e) {\n t = t.insert(e.key, e);\n }), t;\n }));\n }); // Queries that have never seen a snapshot without limbo free documents\n // should also be run as a full collection scan.\n },\n /** Applies the query filter and sorting to the provided documents. */\n t.prototype.Cn = function (t, e) {\n // Sort the documents and re-apply the query filter since previously\n // matching documents do not necessarily still match the query.\n var n = new $e(ae(t));\n return e.forEach(function (e, r) {\n ue(t, r) && (n = n.add(r));\n }), n;\n },\n /**\n * Determines if a limit query needs to be refilled from cache, making it\n * ineligible for index-free execution.\n *\n * @param sortedPreviousResults - The documents that matched the query when it\n * was last synchronized, sorted by the query's comparator.\n * @param remoteKeys - The document keys that matched the query at the last\n * snapshot.\n * @param limboFreeSnapshotVersion - The version of the snapshot when the\n * query was last synchronized.\n */\n t.prototype.Nn = function (t, e, n, r) {\n // The query needs to be refilled if a previously matching document no\n // longer matches.\n if (n.size !== e.size) return !0; // Limit queries are not eligible for index-free query execution if there is\n // a potential that an older document from cache now sorts before a document\n // that was previously part of the limit. This, however, can only happen if\n // the document at the edge of the limit goes out of limit.\n // If a document that is not the limit boundary sorts differently,\n // the boundary of the limit itself did not change and documents from cache\n // will continue to be \"rejected\" by this boundary. Therefore, we can ignore\n // any modifications that don't affect the last document.\n\n var i = \"F\"\n /* First */\n === t ? e.last() : e.first();\n return !!i && (i.hasPendingWrites || i.version.compareTo(r) > 0);\n }, t.prototype.Dn = function (t, e) {\n return k() <= y.DEBUG && C(\"QueryEngine\", \"Using full collection scan to execute query:\", se(e)), this.Sn.getDocumentsMatchingQuery(t, e, K.min());\n }, t;\n}(),\n qi =\n/** @class */\nfunction () {\n function t(\n /** Manages our in-memory or durable persistence. */\n t, e, n, r) {\n this.persistence = t, this.xn = e, this.R = r,\n /**\n * Maps a targetID to data about its target.\n *\n * PORTING NOTE: We are using an immutable data structure on Web to make re-runs\n * of `applyRemoteEvent()` idempotent.\n */\n this.kn = new We(q),\n /** Maps a target to its targetID. */\n // TODO(wuandy): Evaluate if TargetId can be part of Target.\n this.Fn = new Ii(function (t) {\n return kt(t);\n }, Ct),\n /**\n * The read time of the last entry processed by `getNewDocumentChanges()`.\n *\n * PORTING NOTE: This is only used for multi-tab synchronization.\n */\n this.$n = K.min(), this._n = t.getMutationQueue(n), this.On = t.getRemoteDocumentCache(), this.qe = t.getTargetCache(), this.Mn = new Fi(this.On, this._n, this.persistence.getIndexManager()), this.Ke = t.getBundleCache(), this.xn.Vn(this.Mn);\n }\n\n return t.prototype.collectGarbage = function (t) {\n var e = this;\n return this.persistence.runTransaction(\"Collect garbage\", \"readwrite-primary\", function (n) {\n return t.collect(n, e.kn);\n });\n }, t;\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/**\n * A readonly view of the local state of all documents we're tracking (i.e. we\n * have a cached version in remoteDocumentCache or local mutations for the\n * document). The view is computed by applying the mutations in the\n * MutationQueue to the RemoteDocumentCache.\n */\n\n\nfunction Ui(\n/** Manages our in-memory or durable persistence. */\nt, e, n, r) {\n return new qi(t, e, n, r);\n}\n/**\n * Tells the LocalStore that the currently authenticated user has changed.\n *\n * In response the local store switches the mutation queue to the new user and\n * returns any resulting document changes.\n */\n// PORTING NOTE: Android and iOS only return the documents affected by the\n// change.\n\n\nfunction Bi(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = F(t), i = n._n, o = n.Mn, [4\n /*yield*/\n , n.persistence.runTransaction(\"Handle user change\", \"readonly\", function (t) {\n // Swap out the mutation queue, grabbing the pending mutation batches\n // before and after.\n var r;\n return n._n.getAllMutationBatches(t).next(function (s) {\n return r = s, i = n.persistence.getMutationQueue(e), // Recreate our LocalDocumentsView using the new\n // MutationQueue.\n o = new Fi(n.On, i, n.persistence.getIndexManager()), i.getAllMutationBatches(t);\n }).next(function (e) {\n for (var n = [], i = [], s = sn(), u = 0, a = r // Union the old/new changed keys.\n ; u < a.length; u++) {\n var c = a[u];\n n.push(c.batchId);\n\n for (var h = 0, f = c.mutations; h < f.length; h++) {\n var l = f[h];\n s = s.add(l.key);\n }\n }\n\n for (var d = 0, p = e; d < p.length; d++) {\n var y = p[d];\n i.push(y.batchId);\n\n for (var v = 0, m = y.mutations; v < m.length; v++) {\n var g = m[v];\n s = s.add(g.key);\n }\n } // Return the set of all (potentially) changed documents and the list\n // of mutation batch IDs that were affected by change.\n\n\n return o.pn(t, s).next(function (t) {\n return {\n Ln: t,\n removedBatchIds: n,\n addedBatchIds: i\n };\n });\n });\n })];\n\n case 1:\n return s = r.sent(), [2\n /*return*/\n , (n._n = i, n.Mn = o, n.xn.Vn(n.Mn), s)];\n }\n });\n });\n}\n/* Accepts locally generated Mutations and commit them to storage. */\n\n/**\n * Acknowledges the given batch.\n *\n * On the happy path when a batch is acknowledged, the local store will\n *\n * + remove the batch from the mutation queue;\n * + apply the changes to the remote document cache;\n * + recalculate the latency compensated view implied by those changes (there\n * may be mutations in the queue that affect the documents but haven't been\n * acknowledged yet); and\n * + give the changed documents back the sync engine\n *\n * @returns The resulting (modified) documents.\n */\n\n\nfunction ji(t, e) {\n var n = F(t);\n return n.persistence.runTransaction(\"Acknowledge batch\", \"readwrite-primary\", function (t) {\n var r = e.batch.keys(),\n i = n.On.newChangeBuffer({\n trackRemovals: !0\n });\n return function (t, e, n, r) {\n var i = n.batch,\n o = i.keys(),\n s = Ir.resolve();\n return o.forEach(function (t) {\n s = s.next(function () {\n return r.getEntry(e, t);\n }).next(function (e) {\n var o = n.docVersions.get(t);\n P(null !== o), e.version.compareTo(o) < 0 && (i.applyToRemoteDocument(e, n), e.isValidDocument() && // We use the commitVersion as the readTime rather than the\n // document's updateTime since the updateTime is not advanced\n // for updates that do not modify the underlying document.\n r.addEntry(e, n.commitVersion));\n });\n }), s.next(function () {\n return t._n.removeMutationBatch(e, i);\n });\n }(n, t, e, i).next(function () {\n return i.apply(t);\n }).next(function () {\n return n._n.performConsistencyCheck(t);\n }).next(function () {\n return n.Mn.pn(t, r);\n });\n });\n}\n/**\n * Removes mutations from the MutationQueue for the specified batch;\n * LocalDocuments will be recalculated.\n *\n * @returns The resulting modified documents.\n */\n\n/**\n * Returns the last consistent snapshot processed (used by the RemoteStore to\n * determine whether to buffer incoming snapshots from the backend).\n */\n\n\nfunction Ki(t) {\n var e = F(t);\n return e.persistence.runTransaction(\"Get last remote snapshot version\", \"readonly\", function (t) {\n return e.qe.getLastRemoteSnapshotVersion(t);\n });\n}\n/**\n * Updates the \"ground-state\" (remote) documents. We assume that the remote\n * event reflects any write batches that have been acknowledged or rejected\n * (i.e. we do not re-apply local mutations to updates from this event).\n *\n * LocalDocuments are re-calculated if there are remaining mutations in the\n * queue.\n */\n\n\nfunction Qi(t, e) {\n var n = F(t),\n r = e.snapshotVersion,\n i = n.kn;\n return n.persistence.runTransaction(\"Apply remote event\", \"readwrite-primary\", function (t) {\n var o = n.On.newChangeBuffer({\n trackRemovals: !0\n }); // Reset newTargetDataByTargetMap in case this transaction gets re-run.\n\n i = n.kn;\n var s = [];\n e.targetChanges.forEach(function (e, o) {\n var u = i.get(o);\n\n if (u) {\n // Only update the remote keys if the target is still active. This\n // ensures that we can persist the updated target data along with\n // the updated assignment.\n s.push(n.qe.removeMatchingKeys(t, e.removedDocuments, o).next(function () {\n return n.qe.addMatchingKeys(t, e.addedDocuments, o);\n }));\n var a = e.resumeToken; // Update the resume token if the change includes one.\n\n if (a.approximateByteSize() > 0) {\n var c = u.withResumeToken(a, r).withSequenceNumber(t.currentSequenceNumber);\n i = i.insert(o, c), // Update the target data if there are target changes (or if\n // sufficient time has passed since the last update).\n\n /**\n * Returns true if the newTargetData should be persisted during an update of\n * an active target. TargetData should always be persisted when a target is\n * being released and should not call this function.\n *\n * While the target is active, TargetData updates can be omitted when nothing\n * about the target has changed except metadata like the resume token or\n * snapshot version. Occasionally it's worth the extra write to prevent these\n * values from getting too stale after a crash, but this doesn't have to be\n * too frequent.\n */\n function (t, e, n) {\n // Always persist target data if we don't already have a resume token.\n return P(e.resumeToken.approximateByteSize() > 0), 0 === t.resumeToken.approximateByteSize() || // Don't allow resume token changes to be buffered indefinitely. This\n // allows us to be reasonably up-to-date after a crash and avoids needing\n // to loop over all active queries on shutdown. Especially in the browser\n // we may not get time to do anything interesting while the current tab is\n // closing.\n e.snapshotVersion.toMicroseconds() - t.snapshotVersion.toMicroseconds() >= 3e8 || n.addedDocuments.size + n.modifiedDocuments.size + n.removedDocuments.size > 0;\n }(u, c, e) && s.push(n.qe.updateTargetData(t, c));\n }\n }\n });\n var u = Ze(); // HACK: The only reason we allow a null snapshot version is so that we\n // can synthesize remote events when we get permission denied errors while\n // trying to resolve the state of a locally cached document that is in\n // limbo.\n\n if (e.documentUpdates.forEach(function (r, i) {\n e.resolvedLimboDocuments.has(r) && s.push(n.persistence.referenceDelegate.updateLimboDocument(t, r));\n }), // Each loop iteration only affects its \"own\" doc, so it's safe to get all the remote\n // documents in advance in a single call.\n s.push(Gi(t, o, e.documentUpdates, r, void 0).next(function (t) {\n u = t;\n })), !r.isEqual(K.min())) {\n var a = n.qe.getLastRemoteSnapshotVersion(t).next(function (e) {\n return n.qe.setTargetsMetadata(t, t.currentSequenceNumber, r);\n });\n s.push(a);\n }\n\n return Ir.waitFor(s).next(function () {\n return o.apply(t);\n }).next(function () {\n return n.Mn.En(t, u);\n }).next(function () {\n return u;\n });\n }).then(function (t) {\n return n.kn = i, t;\n });\n}\n/**\n * Populates document change buffer with documents from backend or a bundle.\n * Returns the document changes resulting from applying those documents.\n *\n * @param txn - Transaction to use to read existing documents from storage.\n * @param documentBuffer - Document buffer to collect the resulted changes to be\n * applied to storage.\n * @param documents - Documents to be applied.\n * @param globalVersion - A `SnapshotVersion` representing the read time if all\n * documents have the same read time.\n * @param documentVersions - A DocumentKey-to-SnapshotVersion map if documents\n * have their own read time.\n *\n * Note: this function will use `documentVersions` if it is defined;\n * when it is not defined, resorts to `globalVersion`.\n */\n\n\nfunction Gi(t, e, n, r, // TODO(wuandy): We could add `readTime` to MaybeDocument instead to remove\n// this parameter.\ni) {\n var o = sn();\n return n.forEach(function (t) {\n return o = o.add(t);\n }), e.getEntries(t, o).next(function (t) {\n var o = Ze();\n return n.forEach(function (n, s) {\n var u = t.get(n),\n a = (null == i ? void 0 : i.get(n)) || r; // Note: The order of the steps below is important, since we want\n // to ensure that rejected limbo resolutions (which fabricate\n // NoDocuments with SnapshotVersion.min()) never add documents to\n // cache.\n\n s.isNoDocument() && s.version.isEqual(K.min()) ? ( // NoDocuments with SnapshotVersion.min() are used in manufactured\n // events. We remove these documents from cache since we lost\n // access.\n e.removeEntry(n, a), o = o.insert(n, s)) : !u.isValidDocument() || s.version.compareTo(u.version) > 0 || 0 === s.version.compareTo(u.version) && u.hasPendingWrites ? (e.addEntry(s, a), o = o.insert(n, s)) : C(\"LocalStore\", \"Ignoring outdated watch update for \", n, \". Current version:\", u.version, \" Watch version:\", s.version);\n }), o;\n })\n /**\n * Gets the mutation batch after the passed in batchId in the mutation queue\n * or null if empty.\n * @param afterBatchId - If provided, the batch to search after.\n * @returns The next mutation or null if there wasn't one.\n */\n ;\n}\n\nfunction zi(t, e) {\n var n = F(t);\n return n.persistence.runTransaction(\"Get next mutation batch\", \"readonly\", function (t) {\n return void 0 === e && (e = -1), n._n.getNextMutationBatchAfterBatchId(t, e);\n });\n}\n/**\n * Reads the current value of a Document with a given key or null if not\n * found - used for testing.\n */\n\n/**\n * Assigns the given target an internal ID so that its results can be pinned so\n * they don't get GC'd. A target must be allocated in the local store before\n * the store can be used to manage its view.\n *\n * Allocating an already allocated `Target` will return the existing `TargetData`\n * for that `Target`.\n */\n\n\nfunction Wi(t, e) {\n var n = F(t);\n return n.persistence.runTransaction(\"Allocate target\", \"readwrite\", function (t) {\n var r;\n return n.qe.getTargetData(t, e).next(function (i) {\n return i ? ( // This target has been listened to previously, so reuse the\n // previous targetID.\n // TODO(mcg): freshen last accessed date?\n r = i, Ir.resolve(r)) : n.qe.allocateTargetId(t).next(function (i) {\n return r = new Pr(e, i, 0\n /* Listen */\n , t.currentSequenceNumber), n.qe.addTargetData(t, r).next(function () {\n return r;\n });\n });\n });\n }).then(function (t) {\n // If Multi-Tab is enabled, the existing target data may be newer than\n // the in-memory data\n var r = n.kn.get(t.targetId);\n return (null === r || t.snapshotVersion.compareTo(r.snapshotVersion) > 0) && (n.kn = n.kn.insert(t.targetId, t), n.Fn.set(e, t.targetId)), t;\n });\n}\n/**\n * Returns the TargetData as seen by the LocalStore, including updates that may\n * have not yet been persisted to the TargetCache.\n */\n// Visible for testing.\n\n/**\n * Unpins all the documents associated with the given target. If\n * `keepPersistedTargetData` is set to false and Eager GC enabled, the method\n * directly removes the associated target data from the target cache.\n *\n * Releasing a non-existing `Target` is a no-op.\n */\n// PORTING NOTE: `keepPersistedTargetData` is multi-tab only.\n\n\nfunction Hi(t, e, i) {\n return n(this, void 0, void 0, function () {\n var n, o, s, u;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n n = F(t), o = n.kn.get(e), s = i ? \"readwrite\" : \"readwrite-primary\", r.label = 1;\n\n case 1:\n return r.trys.push([1, 4,, 5]), i ? [3\n /*break*/\n , 3] : [4\n /*yield*/\n , n.persistence.runTransaction(\"Release target\", s, function (t) {\n return n.persistence.referenceDelegate.removeTarget(t, o);\n })];\n\n case 2:\n r.sent(), r.label = 3;\n\n case 3:\n return [3\n /*break*/\n , 5];\n\n case 4:\n if (!Nr(u = r.sent())) throw u; // All `releaseTarget` does is record the final metadata state for the\n // target, but we've been recording this periodically during target\n // activity. If we lose this write this could cause a very slight\n // difference in the order of target deletion during GC, but we\n // don't define exact LRU semantics so this is acceptable.\n\n return C(\"LocalStore\", \"Failed to update sequence numbers for target \" + e + \": \" + u), [3\n /*break*/\n , 5];\n\n case 5:\n return n.kn = n.kn.remove(e), n.Fn.delete(o.target), [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Runs the specified query against the local store and returns the results,\n * potentially taking advantage of query data from previous executions (such\n * as the set of remote keys).\n *\n * @param usePreviousResults - Whether results from previous executions can\n * be used to optimize this query execution.\n */\n\n\nfunction Yi(t, e, n) {\n var r = F(t),\n i = K.min(),\n o = sn();\n return r.persistence.runTransaction(\"Execute query\", \"readonly\", function (t) {\n return function (t, e, n) {\n var r = F(t),\n i = r.Fn.get(n);\n return void 0 !== i ? Ir.resolve(r.kn.get(i)) : r.qe.getTargetData(e, n);\n }(r, t, ne(e)).next(function (e) {\n if (e) return i = e.lastLimboFreeSnapshotVersion, r.qe.getMatchingKeysForTargetId(t, e.targetId).next(function (t) {\n o = t;\n });\n }).next(function () {\n return r.xn.getDocumentsMatchingQuery(t, e, n ? i : K.min(), n ? o : sn());\n }).next(function (t) {\n return {\n documents: t,\n Bn: o\n };\n });\n });\n} // PORTING NOTE: Multi-Tab only.\n\n\nfunction $i(t, e) {\n var n = F(t),\n r = F(n.qe),\n i = n.kn.get(e);\n return i ? Promise.resolve(i.target) : n.persistence.runTransaction(\"Get target data\", \"readonly\", function (t) {\n return r.lt(t, e).next(function (t) {\n return t ? t.target : null;\n });\n });\n}\n/**\n * Returns the set of documents that have been updated since the last call.\n * If this is the first call, returns the set of changes since client\n * initialization. Further invocations will return document that have changed\n * since the prior call.\n */\n// PORTING NOTE: Multi-Tab only.\n\n\nfunction Xi(t) {\n var e = F(t);\n return e.persistence.runTransaction(\"Get new document changes\", \"readonly\", function (t) {\n return function (t, e, n) {\n var r = F(t),\n i = Ze(),\n o = qr(n),\n s = Ni(e),\n u = IDBKeyRange.lowerBound(o, !0);\n return s.$t({\n index: ar.readTimeIndex,\n range: u\n }, function (t, e) {\n // Unlike `getEntry()` and others, `getNewDocumentChanges()` parses\n // the documents directly since we want to keep sentinel deletes.\n var n = Mr(r.R, e);\n i = i.insert(n.key, n), o = e.readTime;\n }).next(function () {\n return {\n wn: i,\n readTime: Ur(o)\n };\n });\n }(e.On, t, e.$n);\n }).then(function (t) {\n var n = t.wn,\n r = t.readTime;\n return e.$n = r, n;\n });\n}\n/**\n * Reads the newest document change from persistence and moves the internal\n * synchronization marker forward so that calls to `getNewDocumentChanges()`\n * only return changes that happened after client initialization.\n */\n// PORTING NOTE: Multi-Tab only.\n\n\nfunction Ji(t) {\n return n(this, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n return [2\n /*return*/\n , (e = F(t)).persistence.runTransaction(\"Synchronize last document change read time\", \"readonly\", function (t) {\n return function (t) {\n var e = Ni(t),\n n = K.min(); // If there are no existing entries, we return SnapshotVersion.min().\n\n return e.$t({\n index: ar.readTimeIndex,\n reverse: !0\n }, function (t, e, r) {\n e.readTime && (n = Ur(e.readTime)), r.done();\n }).next(function () {\n return n;\n });\n }(t);\n }).then(function (t) {\n e.$n = t;\n })];\n });\n });\n}\n/**\n * Creates a new target using the given bundle name, which will be used to\n * hold the keys of all documents from the bundle in query-document mappings.\n * This ensures that the loaded documents do not get garbage collected\n * right away.\n */\n\n/**\n * Applies the documents from a bundle to the \"ground-state\" (remote)\n * documents.\n *\n * LocalDocuments are re-calculated if there are remaining mutations in the\n * queue.\n */\n\n\nfunction Zi(t, e, i, o) {\n return n(this, void 0, void 0, function () {\n var n, s, u, a, c, h, f, l, d, p;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n for (n = F(t), s = sn(), u = Ze(), a = rn(), c = 0, h = i; c < h.length; c++) {\n f = h[c], l = e.qn(f.metadata.name), f.document && (s = s.add(l)), u = u.insert(l, e.Un(f)), a = a.insert(l, e.Kn(f.metadata.readTime));\n }\n\n return d = n.On.newChangeBuffer({\n trackRemovals: !0\n }), [4\n /*yield*/\n , Wi(n, function (t) {\n // It is OK that the path used for the query is not valid, because this will\n // not be read and queried.\n return ne(Yt(H.fromString(\"__bundle__/docs/\" + t)));\n }(o))];\n\n case 1:\n // Allocates a target to hold all document keys from the bundle, such that\n // they will not get garbage collected right away.\n return p = r.sent(), [2\n /*return*/\n , n.persistence.runTransaction(\"Apply bundle documents\", \"readwrite\", function (t) {\n return Gi(t, d, u, K.min(), a).next(function (e) {\n return d.apply(t), e;\n }).next(function (e) {\n return n.qe.removeMatchingKeysForTargetId(t, p.targetId).next(function () {\n return n.qe.addMatchingKeys(t, s, p.targetId);\n }).next(function () {\n return n.Mn.En(t, e);\n }).next(function () {\n return e;\n });\n });\n })];\n }\n });\n });\n}\n/**\n * Returns a promise of a boolean to indicate if the given bundle has already\n * been loaded and the create time is newer than the current loading bundle.\n */\n\n/**\n * Saves the given `NamedQuery` to local persistence.\n */\n\n\nfunction to(t, e, i) {\n return void 0 === i && (i = sn()), n(this, void 0, void 0, function () {\n var n, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , Wi(t, ne(zr(e.bundledQuery)))];\n\n case 1:\n return n = r.sent(), [2\n /*return*/\n , (o = F(t)).persistence.runTransaction(\"Save named query\", \"readwrite\", function (t) {\n var r = _n(e.readTime); // Simply save the query itself if it is older than what the SDK already\n // has.\n\n\n if (n.snapshotVersion.compareTo(r) >= 0) return o.Ke.saveNamedQuery(t, e); // Update existing target data because the query from the bundle is newer.\n\n var s = n.withResumeToken(J.EMPTY_BYTE_STRING, r);\n return o.kn = o.kn.insert(s.targetId, s), o.qe.updateTargetData(t, s).next(function () {\n return o.qe.removeMatchingKeysForTargetId(t, n.targetId);\n }).next(function () {\n return o.qe.addMatchingKeys(t, i, n.targetId);\n }).next(function () {\n return o.Ke.saveNamedQuery(t, e);\n });\n })];\n }\n });\n });\n}\n/**\n * @license\n * Copyright 2020 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\nvar eo =\n/** @class */\nfunction () {\n function t(t) {\n this.R = t, this.Qn = new Map(), this.jn = new Map();\n }\n\n return t.prototype.getBundleMetadata = function (t, e) {\n return Ir.resolve(this.Qn.get(e));\n }, t.prototype.saveBundleMetadata = function (t, e) {\n /** Decodes a BundleMetadata proto into a BundleMetadata object. */\n var n;\n return this.Qn.set(e.id, {\n id: (n = e).id,\n version: n.version,\n createTime: _n(n.createTime)\n }), Ir.resolve();\n }, t.prototype.getNamedQuery = function (t, e) {\n return Ir.resolve(this.jn.get(e));\n }, t.prototype.saveNamedQuery = function (t, e) {\n return this.jn.set(e.name, function (t) {\n return {\n name: t.name,\n query: zr(t.bundledQuery),\n readTime: _n(t.readTime)\n };\n }(e)), Ir.resolve();\n }, t;\n}(),\n no =\n/** @class */\nfunction () {\n function t() {\n // A set of outstanding references to a document sorted by key.\n this.Wn = new $e(ro.Gn), // A set of outstanding references to a document sorted by target id.\n this.zn = new $e(ro.Hn)\n /** Returns true if the reference set contains no references. */\n ;\n }\n\n return t.prototype.isEmpty = function () {\n return this.Wn.isEmpty();\n },\n /** Adds a reference to the given document key for the given ID. */\n t.prototype.addReference = function (t, e) {\n var n = new ro(t, e);\n this.Wn = this.Wn.add(n), this.zn = this.zn.add(n);\n },\n /** Add references to the given document keys for the given ID. */\n t.prototype.Jn = function (t, e) {\n var n = this;\n t.forEach(function (t) {\n return n.addReference(t, e);\n });\n },\n /**\n * Removes a reference to the given document key for the given\n * ID.\n */\n t.prototype.removeReference = function (t, e) {\n this.Yn(new ro(t, e));\n }, t.prototype.Xn = function (t, e) {\n var n = this;\n t.forEach(function (t) {\n return n.removeReference(t, e);\n });\n },\n /**\n * Clears all references with a given ID. Calls removeRef() for each key\n * removed.\n */\n t.prototype.Zn = function (t) {\n var e = this,\n n = new ct(new H([])),\n r = new ro(n, t),\n i = new ro(n, t + 1),\n o = [];\n return this.zn.forEachInRange([r, i], function (t) {\n e.Yn(t), o.push(t.key);\n }), o;\n }, t.prototype.ts = function () {\n var t = this;\n this.Wn.forEach(function (e) {\n return t.Yn(e);\n });\n }, t.prototype.Yn = function (t) {\n this.Wn = this.Wn.delete(t), this.zn = this.zn.delete(t);\n }, t.prototype.es = function (t) {\n var e = new ct(new H([])),\n n = new ro(e, t),\n r = new ro(e, t + 1),\n i = sn();\n return this.zn.forEachInRange([n, r], function (t) {\n i = i.add(t.key);\n }), i;\n }, t.prototype.containsKey = function (t) {\n var e = new ro(t, 0),\n n = this.Wn.firstAfterOrEqual(e);\n return null !== n && t.isEqual(n.key);\n }, t;\n}(),\n ro =\n/** @class */\nfunction () {\n function t(t, e) {\n this.key = t, this.ns = e\n /** Compare by key then by ID */\n ;\n }\n\n return t.Gn = function (t, e) {\n return ct.comparator(t.key, e.key) || q(t.ns, e.ns);\n },\n /** Compare by ID then by key */\n t.Hn = function (t, e) {\n return q(t.ns, e.ns) || ct.comparator(t.key, e.key);\n }, t;\n}(),\n io =\n/** @class */\nfunction () {\n function t(t, e) {\n this.Ut = t, this.referenceDelegate = e,\n /**\n * The set of all mutations that have been sent but not yet been applied to\n * the backend.\n */\n this._n = [],\n /** Next value to use when assigning sequential IDs to each mutation batch. */\n this.ss = 1,\n /** An ordered mapping between documents and the mutations batch IDs. */\n this.rs = new $e(ro.Gn);\n }\n\n return t.prototype.checkEmpty = function (t) {\n return Ir.resolve(0 === this._n.length);\n }, t.prototype.addMutationBatch = function (t, e, n, r) {\n var i = this.ss;\n this.ss++, this._n.length > 0 && this._n[this._n.length - 1];\n var o = new Lr(i, e, n, r);\n\n this._n.push(o); // Track references by document key and index collection parents.\n\n\n for (var s = 0, u = r; s < u.length; s++) {\n var a = u[s];\n this.rs = this.rs.add(new ro(a.key, i)), this.Ut.addToCollectionParentIndex(t, a.key.path.popLast());\n }\n\n return Ir.resolve(o);\n }, t.prototype.lookupMutationBatch = function (t, e) {\n return Ir.resolve(this.os(e));\n }, t.prototype.getNextMutationBatchAfterBatchId = function (t, e) {\n var n = e + 1,\n r = this.cs(n),\n i = r < 0 ? 0 : r; // The requested batchId may still be out of range so normalize it to the\n // start of the queue.\n\n return Ir.resolve(this._n.length > i ? this._n[i] : null);\n }, t.prototype.getHighestUnacknowledgedBatchId = function () {\n return Ir.resolve(0 === this._n.length ? -1 : this.ss - 1);\n }, t.prototype.getAllMutationBatches = function (t) {\n return Ir.resolve(this._n.slice());\n }, t.prototype.getAllMutationBatchesAffectingDocumentKey = function (t, e) {\n var n = this,\n r = new ro(e, 0),\n i = new ro(e, Number.POSITIVE_INFINITY),\n o = [];\n return this.rs.forEachInRange([r, i], function (t) {\n var e = n.os(t.ns);\n o.push(e);\n }), Ir.resolve(o);\n }, t.prototype.getAllMutationBatchesAffectingDocumentKeys = function (t, e) {\n var n = this,\n r = new $e(q);\n return e.forEach(function (t) {\n var e = new ro(t, 0),\n i = new ro(t, Number.POSITIVE_INFINITY);\n n.rs.forEachInRange([e, i], function (t) {\n r = r.add(t.ns);\n });\n }), Ir.resolve(this.us(r));\n }, t.prototype.getAllMutationBatchesAffectingQuery = function (t, e) {\n // Use the query path as a prefix for testing if a document matches the\n // query.\n var n = e.path,\n r = n.length + 1,\n i = n; // Construct a document reference for actually scanning the index. Unlike\n // the prefix the document key in this reference must have an even number of\n // segments. The empty segment can be used a suffix of the query path\n // because it precedes all other segments in an ordered traversal.\n\n ct.isDocumentKey(i) || (i = i.child(\"\"));\n var o = new ro(new ct(i), 0),\n s = new $e(q); // Find unique batchIDs referenced by all documents potentially matching the\n // query.\n\n return this.rs.forEachWhile(function (t) {\n var e = t.key.path;\n return !!n.isPrefixOf(e) && ( // Rows with document keys more than one segment longer than the query\n // path can't be matches. For example, a query on 'rooms' can't match\n // the document /rooms/abc/messages/xyx.\n // TODO(mcg): we'll need a different scanner when we implement\n // ancestor queries.\n e.length === r && (s = s.add(t.ns)), !0);\n }, o), Ir.resolve(this.us(s));\n }, t.prototype.us = function (t) {\n var e = this,\n n = []; // Construct an array of matching batches, sorted by batchID to ensure that\n // multiple mutations affecting the same document key are applied in order.\n\n return t.forEach(function (t) {\n var r = e.os(t);\n null !== r && n.push(r);\n }), n;\n }, t.prototype.removeMutationBatch = function (t, e) {\n var n = this;\n P(0 === this.hs(e.batchId, \"removed\")), this._n.shift();\n var r = this.rs;\n return Ir.forEach(e.mutations, function (i) {\n var o = new ro(i.key, e.batchId);\n return r = r.delete(o), n.referenceDelegate.markPotentiallyOrphaned(t, i.key);\n }).next(function () {\n n.rs = r;\n });\n }, t.prototype.Gt = function (t) {// No-op since the memory mutation queue does not maintain a separate cache.\n }, t.prototype.containsKey = function (t, e) {\n var n = new ro(e, 0),\n r = this.rs.firstAfterOrEqual(n);\n return Ir.resolve(e.isEqual(r && r.key));\n }, t.prototype.performConsistencyCheck = function (t) {\n return this._n.length, Ir.resolve();\n },\n /**\n * Finds the index of the given batchId in the mutation queue and asserts that\n * the resulting index is within the bounds of the queue.\n *\n * @param batchId - The batchId to search for\n * @param action - A description of what the caller is doing, phrased in passive\n * form (e.g. \"acknowledged\" in a routine that acknowledges batches).\n */\n t.prototype.hs = function (t, e) {\n return this.cs(t);\n },\n /**\n * Finds the index of the given batchId in the mutation queue. This operation\n * is O(1).\n *\n * @returns The computed index of the batch with the given batchId, based on\n * the state of the queue. Note this index can be negative if the requested\n * batchId has already been remvoed from the queue or past the end of the\n * queue if the batchId is larger than the last added batch.\n */\n t.prototype.cs = function (t) {\n return 0 === this._n.length ? 0 : t - this._n[0].batchId; // Examine the front of the queue to figure out the difference between the\n // batchId and indexes in the array. Note that since the queue is ordered\n // by batchId, if the first batch has a larger batchId then the requested\n // batchId doesn't exist in the queue.\n },\n /**\n * A version of lookupMutationBatch that doesn't return a promise, this makes\n * other functions that uses this code easier to read and more efficent.\n */\n t.prototype.os = function (t) {\n var e = this.cs(t);\n return e < 0 || e >= this._n.length ? null : this._n[e];\n }, t;\n}(),\n oo =\n/** @class */\nfunction () {\n /**\n * @param sizer - Used to assess the size of a document. For eager GC, this is\n * expected to just return 0 to avoid unnecessarily doing the work of\n * calculating the size.\n */\n function t(t, e) {\n this.Ut = t, this.ls = e,\n /** Underlying cache of documents and their read times. */\n this.docs = new We(ct.comparator),\n /** Size of all cached documents. */\n this.size = 0\n /**\n * Adds the supplied entry to the cache and updates the cache size as appropriate.\n *\n * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()`.\n */\n ;\n }\n\n return t.prototype.addEntry = function (t, e, n) {\n var r = e.key,\n i = this.docs.get(r),\n o = i ? i.size : 0,\n s = this.ls(e);\n return this.docs = this.docs.insert(r, {\n document: e.clone(),\n size: s,\n readTime: n\n }), this.size += s - o, this.Ut.addToCollectionParentIndex(t, r.path.popLast());\n },\n /**\n * Removes the specified entry from the cache and updates the cache size as appropriate.\n *\n * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()`.\n */\n t.prototype.removeEntry = function (t) {\n var e = this.docs.get(t);\n e && (this.docs = this.docs.remove(t), this.size -= e.size);\n }, t.prototype.getEntry = function (t, e) {\n var n = this.docs.get(e);\n return Ir.resolve(n ? n.document.clone() : Nt.newInvalidDocument(e));\n }, t.prototype.getEntries = function (t, e) {\n var n = this,\n r = Ze();\n return e.forEach(function (t) {\n var e = n.docs.get(t);\n r = r.insert(t, e ? e.document.clone() : Nt.newInvalidDocument(t));\n }), Ir.resolve(r);\n }, t.prototype.getDocumentsMatchingQuery = function (t, e, n) {\n for (var r = Ze(), i = new ct(e.path.child(\"\")), o = this.docs.getIteratorFrom(i) // Documents are ordered by key, so we can use a prefix scan to narrow down\n // the documents we need to match the query against.\n ; o.hasNext();) {\n var s = o.getNext(),\n u = s.key,\n a = s.value,\n c = a.document,\n h = a.readTime;\n if (!e.path.isPrefixOf(u.path)) break;\n h.compareTo(n) <= 0 || ue(e, c) && (r = r.insert(c.key, c.clone()));\n }\n\n return Ir.resolve(r);\n }, t.prototype.fs = function (t, e) {\n return Ir.forEach(this.docs, function (t) {\n return e(t);\n });\n }, t.prototype.newChangeBuffer = function (t) {\n // `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps\n // a separate changelog and does not need special handling for removals.\n return new so(this);\n }, t.prototype.getSize = function (t) {\n return Ir.resolve(this.size);\n }, t;\n}(),\n so =\n/** @class */\nfunction (e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).Ie = t, n;\n }\n\n return t(n, e), n.prototype.applyChanges = function (t) {\n var e = this,\n n = [];\n return this.changes.forEach(function (r, i) {\n i.document.isValidDocument() ? n.push(e.Ie.addEntry(t, i.document, e.getReadTime(r))) : e.Ie.removeEntry(r);\n }), Ir.waitFor(n);\n }, n.prototype.getFromCache = function (t, e) {\n return this.Ie.getEntry(t, e);\n }, n.prototype.getAllFromCache = function (t, e) {\n return this.Ie.getEntries(t, e);\n }, n;\n}(Ti),\n uo =\n/** @class */\nfunction () {\n function t(t) {\n this.persistence = t,\n /**\n * Maps a target to the data about that target\n */\n this.ds = new Ii(function (t) {\n return kt(t);\n }, Ct),\n /** The last received snapshot version. */\n this.lastRemoteSnapshotVersion = K.min(),\n /** The highest numbered target ID encountered. */\n this.highestTargetId = 0,\n /** The highest sequence number encountered. */\n this.ws = 0,\n /**\n * A ordered bidirectional mapping between documents and the remote target\n * IDs.\n */\n this._s = new no(), this.targetCount = 0, this.ys = ci.Jt();\n }\n\n return t.prototype.forEachTarget = function (t, e) {\n return this.ds.forEach(function (t, n) {\n return e(n);\n }), Ir.resolve();\n }, t.prototype.getLastRemoteSnapshotVersion = function (t) {\n return Ir.resolve(this.lastRemoteSnapshotVersion);\n }, t.prototype.getHighestSequenceNumber = function (t) {\n return Ir.resolve(this.ws);\n }, t.prototype.allocateTargetId = function (t) {\n return this.highestTargetId = this.ys.next(), Ir.resolve(this.highestTargetId);\n }, t.prototype.setTargetsMetadata = function (t, e, n) {\n return n && (this.lastRemoteSnapshotVersion = n), e > this.ws && (this.ws = e), Ir.resolve();\n }, t.prototype.te = function (t) {\n this.ds.set(t.target, t);\n var e = t.targetId;\n e > this.highestTargetId && (this.ys = new ci(e), this.highestTargetId = e), t.sequenceNumber > this.ws && (this.ws = t.sequenceNumber);\n }, t.prototype.addTargetData = function (t, e) {\n return this.te(e), this.targetCount += 1, Ir.resolve();\n }, t.prototype.updateTargetData = function (t, e) {\n return this.te(e), Ir.resolve();\n }, t.prototype.removeTargetData = function (t, e) {\n return this.ds.delete(e.target), this._s.Zn(e.targetId), this.targetCount -= 1, Ir.resolve();\n }, t.prototype.removeTargets = function (t, e, n) {\n var r = this,\n i = 0,\n o = [];\n return this.ds.forEach(function (s, u) {\n u.sequenceNumber <= e && null === n.get(u.targetId) && (r.ds.delete(s), o.push(r.removeMatchingKeysForTargetId(t, u.targetId)), i++);\n }), Ir.waitFor(o).next(function () {\n return i;\n });\n }, t.prototype.getTargetCount = function (t) {\n return Ir.resolve(this.targetCount);\n }, t.prototype.getTargetData = function (t, e) {\n var n = this.ds.get(e) || null;\n return Ir.resolve(n);\n }, t.prototype.addMatchingKeys = function (t, e, n) {\n return this._s.Jn(e, n), Ir.resolve();\n }, t.prototype.removeMatchingKeys = function (t, e, n) {\n this._s.Xn(e, n);\n\n var r = this.persistence.referenceDelegate,\n i = [];\n return r && e.forEach(function (e) {\n i.push(r.markPotentiallyOrphaned(t, e));\n }), Ir.waitFor(i);\n }, t.prototype.removeMatchingKeysForTargetId = function (t, e) {\n return this._s.Zn(e), Ir.resolve();\n }, t.prototype.getMatchingKeysForTargetId = function (t, e) {\n var n = this._s.es(e);\n\n return Ir.resolve(n);\n }, t.prototype.containsKey = function (t, e) {\n return Ir.resolve(this._s.containsKey(e));\n }, t;\n}(),\n ao =\n/** @class */\nfunction () {\n /**\n * The constructor accepts a factory for creating a reference delegate. This\n * allows both the delegate and this instance to have strong references to\n * each other without having nullable fields that would then need to be\n * checked or asserted on every access.\n */\n function t(t, e) {\n var n = this;\n this.gs = {}, this.Ne = new S(0), this.xe = !1, this.xe = !0, this.referenceDelegate = t(this), this.qe = new uo(this), this.Ut = new $r(), this.Ue = function (t, e) {\n return new oo(t, function (t) {\n return n.referenceDelegate.ps(t);\n });\n }(this.Ut), this.R = new Fr(e), this.Ke = new eo(this.R);\n }\n\n return t.prototype.start = function () {\n return Promise.resolve();\n }, t.prototype.shutdown = function () {\n // No durable state to ensure is closed on shutdown.\n return this.xe = !1, Promise.resolve();\n }, Object.defineProperty(t.prototype, \"started\", {\n get: function get() {\n return this.xe;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.setDatabaseDeletedListener = function () {// No op.\n }, t.prototype.setNetworkEnabled = function () {// No op.\n }, t.prototype.getIndexManager = function () {\n return this.Ut;\n }, t.prototype.getMutationQueue = function (t) {\n var e = this.gs[t.toKey()];\n return e || (e = new io(this.Ut, this.referenceDelegate), this.gs[t.toKey()] = e), e;\n }, t.prototype.getTargetCache = function () {\n return this.qe;\n }, t.prototype.getRemoteDocumentCache = function () {\n return this.Ue;\n }, t.prototype.getBundleCache = function () {\n return this.Ke;\n }, t.prototype.runTransaction = function (t, e, n) {\n var r = this;\n C(\"MemoryPersistence\", \"Starting transaction:\", t);\n var i = new co(this.Ne.next());\n return this.referenceDelegate.Es(), n(i).next(function (t) {\n return r.referenceDelegate.Ts(i).next(function () {\n return t;\n });\n }).toPromise().then(function (t) {\n return i.raiseOnCommittedEvent(), t;\n });\n }, t.prototype.Is = function (t, e) {\n return Ir.or(Object.values(this.gs).map(function (n) {\n return function () {\n return n.containsKey(t, e);\n };\n }));\n }, t;\n}(),\n co =\n/** @class */\nfunction (e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).currentSequenceNumber = t, n;\n }\n\n return t(n, e), n;\n}(wr),\n ho =\n/** @class */\nfunction () {\n function t(t) {\n this.persistence = t,\n /** Tracks all documents that are active in Query views. */\n this.As = new no(),\n /** The list of documents that are potentially GCed after each transaction. */\n this.Rs = null;\n }\n\n return t.bs = function (e) {\n return new t(e);\n }, Object.defineProperty(t.prototype, \"vs\", {\n get: function get() {\n if (this.Rs) return this.Rs;\n throw O();\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.addReference = function (t, e, n) {\n return this.As.addReference(n, e), this.vs.delete(n.toString()), Ir.resolve();\n }, t.prototype.removeReference = function (t, e, n) {\n return this.As.removeReference(n, e), this.vs.add(n.toString()), Ir.resolve();\n }, t.prototype.markPotentiallyOrphaned = function (t, e) {\n return this.vs.add(e.toString()), Ir.resolve();\n }, t.prototype.removeTarget = function (t, e) {\n var n = this;\n this.As.Zn(e.targetId).forEach(function (t) {\n return n.vs.add(t.toString());\n });\n var r = this.persistence.getTargetCache();\n return r.getMatchingKeysForTargetId(t, e.targetId).next(function (t) {\n t.forEach(function (t) {\n return n.vs.add(t.toString());\n });\n }).next(function () {\n return r.removeTargetData(t, e);\n });\n }, t.prototype.Es = function () {\n this.Rs = new Set();\n }, t.prototype.Ts = function (t) {\n var e = this,\n n = this.persistence.getRemoteDocumentCache().newChangeBuffer(); // Remove newly orphaned documents.\n\n return Ir.forEach(this.vs, function (r) {\n var i = ct.fromPath(r);\n return e.Ps(t, i).next(function (t) {\n t || n.removeEntry(i);\n });\n }).next(function () {\n return e.Rs = null, n.apply(t);\n });\n }, t.prototype.updateLimboDocument = function (t, e) {\n var n = this;\n return this.Ps(t, e).next(function (t) {\n t ? n.vs.delete(e.toString()) : n.vs.add(e.toString());\n });\n }, t.prototype.ps = function (t) {\n // For eager GC, we don't care about the document size, there are no size thresholds.\n return 0;\n }, t.prototype.Ps = function (t, e) {\n var n = this;\n return Ir.or([function () {\n return Ir.resolve(n.As.containsKey(e));\n }, function () {\n return n.persistence.getTargetCache().containsKey(t, e);\n }, function () {\n return n.persistence.Is(t, e);\n }]);\n }, t;\n}(),\n fo =\n/** @class */\nfunction () {\n function t(t) {\n this.uid = t;\n }\n\n return t.prototype.isAuthenticated = function () {\n return null != this.uid;\n },\n /**\n * Returns a key representing this user, suitable for inclusion in a\n * dictionary.\n */\n t.prototype.toKey = function () {\n return this.isAuthenticated() ? \"uid:\" + this.uid : \"anonymous-user\";\n }, t.prototype.isEqual = function (t) {\n return t.uid === this.uid;\n }, t;\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/**\n * A collection of references to a document from some kind of numbered entity\n * (either a target ID or batch ID). As references are added to or removed from\n * the set corresponding events are emitted to a registered garbage collector.\n *\n * Each reference is represented by a DocumentReference object. Each of them\n * contains enough information to uniquely identify the reference. They are all\n * stored primarily in a set sorted by key. A document is considered garbage if\n * there's no references in that set (this can be efficiently checked thanks to\n * sorting by key).\n *\n * ReferenceSet also keeps a secondary set that contains references sorted by\n * IDs. This one is used to efficiently implement removal of all references by\n * some target ID.\n */\n\n/** Assembles the key for a client state in WebStorage */\n\n\nfunction lo(t, e) {\n return \"firestore_clients_\" + t + \"_\" + e;\n} // The format of the WebStorage key that stores the mutation state is:\n// firestore_mutations__\n// (for unauthenticated users)\n// or: firestore_mutations___\n// 'user_uid' is last to avoid needing to escape '_' characters that it might\n// contain.\n\n/** Assembles the key for a mutation batch in WebStorage */\n\n\nfunction po(t, e, n) {\n var r = \"firestore_mutations_\" + t + \"_\" + n;\n return e.isAuthenticated() && (r += \"_\" + e.uid), r;\n} // The format of the WebStorage key that stores a query target's metadata is:\n// firestore_targets__\n\n/** Assembles the key for a query state in WebStorage */\n\n\nfunction yo(t, e) {\n return \"firestore_targets_\" + t + \"_\" + e;\n} // The WebStorage prefix that stores the primary tab's online state. The\n// format of the key is:\n// firestore_online_state_\n\n/**\n * Holds the state of a mutation batch, including its user ID, batch ID and\n * whether the batch is 'pending', 'acknowledged' or 'rejected'.\n */\n// Visible for testing\n\n/** A user with a null UID. */\n\n\nfo.UNAUTHENTICATED = new fo(null), // TODO(mikelehen): Look into getting a proper uid-equivalent for\n// non-FirebaseAuth providers.\nfo.GOOGLE_CREDENTIALS = new fo(\"google-credentials-uid\"), fo.FIRST_PARTY = new fo(\"first-party-uid\"), fo.MOCK_USER = new fo(\"mock-user\");\n\nvar vo =\n/** @class */\nfunction () {\n function t(t, e, n, r) {\n this.user = t, this.batchId = e, this.state = n, this.error = r\n /**\n * Parses a MutationMetadata from its JSON representation in WebStorage.\n * Logs a warning and returns null if the format of the data is not valid.\n */\n ;\n }\n\n return t.Vs = function (e, n, r) {\n var i,\n o = JSON.parse(r),\n s = \"object\" == typeof o && -1 !== [\"pending\", \"acknowledged\", \"rejected\"].indexOf(o.state) && (void 0 === o.error || \"object\" == typeof o.error);\n return s && o.error && (s = \"string\" == typeof o.error.message && \"string\" == typeof o.error.code) && (i = new D(o.error.code, o.error.message)), s ? new t(e, n, o.state, i) : (x(\"SharedClientState\", \"Failed to parse mutation state for ID '\" + n + \"': \" + r), null);\n }, t.prototype.Ss = function () {\n var t = {\n state: this.state,\n updateTimeMs: Date.now()\n };\n return this.error && (t.error = {\n code: this.error.code,\n message: this.error.message\n }), JSON.stringify(t);\n }, t;\n}(),\n mo =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this.targetId = t, this.state = e, this.error = n\n /**\n * Parses a QueryTargetMetadata from its JSON representation in WebStorage.\n * Logs a warning and returns null if the format of the data is not valid.\n */\n ;\n }\n\n return t.Vs = function (e, n) {\n var r,\n i = JSON.parse(n),\n o = \"object\" == typeof i && -1 !== [\"not-current\", \"current\", \"rejected\"].indexOf(i.state) && (void 0 === i.error || \"object\" == typeof i.error);\n return o && i.error && (o = \"string\" == typeof i.error.message && \"string\" == typeof i.error.code) && (r = new D(i.error.code, i.error.message)), o ? new t(e, i.state, r) : (x(\"SharedClientState\", \"Failed to parse target state for ID '\" + e + \"': \" + n), null);\n }, t.prototype.Ss = function () {\n var t = {\n state: this.state,\n updateTimeMs: Date.now()\n };\n return this.error && (t.error = {\n code: this.error.code,\n message: this.error.message\n }), JSON.stringify(t);\n }, t;\n}(),\n go =\n/** @class */\nfunction () {\n function t(t, e) {\n this.clientId = t, this.activeTargetIds = e\n /**\n * Parses a RemoteClientState from the JSON representation in WebStorage.\n * Logs a warning and returns null if the format of the data is not valid.\n */\n ;\n }\n\n return t.Vs = function (e, n) {\n for (var r = JSON.parse(n), i = \"object\" == typeof r && r.activeTargetIds instanceof Array, o = an(), s = 0; i && s < r.activeTargetIds.length; ++s) {\n i = at(r.activeTargetIds[s]), o = o.add(r.activeTargetIds[s]);\n }\n\n return i ? new t(e, o) : (x(\"SharedClientState\", \"Failed to parse client data for instance '\" + e + \"': \" + n), null);\n }, t;\n}(),\n wo =\n/** @class */\nfunction () {\n function t(t, e) {\n this.clientId = t, this.onlineState = e\n /**\n * Parses a SharedOnlineState from its JSON representation in WebStorage.\n * Logs a warning and returns null if the format of the data is not valid.\n */\n ;\n }\n\n return t.Vs = function (e) {\n var n = JSON.parse(e);\n return \"object\" == typeof n && -1 !== [\"Unknown\", \"Online\", \"Offline\"].indexOf(n.onlineState) && \"string\" == typeof n.clientId ? new t(n.clientId, n.onlineState) : (x(\"SharedClientState\", \"Failed to parse online state: \" + e), null);\n }, t;\n}(),\n bo =\n/** @class */\nfunction () {\n function t() {\n this.activeTargetIds = an();\n }\n\n return t.prototype.Ds = function (t) {\n this.activeTargetIds = this.activeTargetIds.add(t);\n }, t.prototype.Cs = function (t) {\n this.activeTargetIds = this.activeTargetIds.delete(t);\n },\n /**\n * Converts this entry into a JSON-encoded format we can use for WebStorage.\n * Does not encode `clientId` as it is part of the key in WebStorage.\n */\n t.prototype.Ss = function () {\n var t = {\n activeTargetIds: this.activeTargetIds.toArray(),\n updateTimeMs: Date.now()\n };\n return JSON.stringify(t);\n }, t;\n}(),\n Io =\n/** @class */\nfunction () {\n function t(t, e, n, r, i) {\n this.window = t, this.Se = e, this.persistenceKey = n, this.Ns = r, this.syncEngine = null, this.onlineStateHandler = null, this.sequenceNumberHandler = null, this.xs = this.ks.bind(this), this.Fs = new We(q), this.started = !1,\n /**\n * Captures WebStorage events that occur before `start()` is called. These\n * events are replayed once `WebStorageSharedClientState` is started.\n */\n this.$s = []; // Escape the special characters mentioned here:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\n\n var o = n.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n this.storage = this.window.localStorage, this.currentUser = i, this.Os = lo(this.persistenceKey, this.Ns), this.Ms =\n /** Assembles the key for the current sequence number. */\n function (t) {\n return \"firestore_sequence_number_\" + t;\n }(this.persistenceKey), this.Fs = this.Fs.insert(this.Ns, new bo()), this.Ls = new RegExp(\"^firestore_clients_\" + o + \"_([^_]*)$\"), this.Bs = new RegExp(\"^firestore_mutations_\" + o + \"_(\\\\d+)(?:_(.*))?$\"), this.qs = new RegExp(\"^firestore_targets_\" + o + \"_(\\\\d+)$\"), this.Us =\n /** Assembles the key for the online state of the primary tab. */\n function (t) {\n return \"firestore_online_state_\" + t;\n }(this.persistenceKey), this.Ks = function (t) {\n return \"firestore_bundle_loaded_\" + t;\n }(this.persistenceKey), // Rather than adding the storage observer during start(), we add the\n // storage observer during initialization. This ensures that we collect\n // events before other components populate their initial state (during their\n // respective start() calls). Otherwise, we might for example miss a\n // mutation that is added after LocalStore's start() processed the existing\n // mutations but before we observe WebStorage events.\n this.window.addEventListener(\"storage\", this.xs);\n }\n /** Returns 'true' if WebStorage is available in the current environment. */\n\n\n return t.yt = function (t) {\n return !(!t || !t.localStorage);\n }, t.prototype.start = function () {\n return n(this, void 0, void 0, function () {\n var t,\n e,\n n,\n i,\n o,\n s,\n u,\n a,\n c,\n h,\n f,\n l = this;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , this.syncEngine.fn()];\n\n case 1:\n for (t = r.sent(), e = 0, n = t; e < n.length; e++) {\n (i = n[e]) !== this.Ns && (o = this.getItem(lo(this.persistenceKey, i))) && (s = go.Vs(i, o)) && (this.Fs = this.Fs.insert(s.clientId, s));\n }\n\n for (this.Qs(), (u = this.storage.getItem(this.Us)) && (a = this.js(u)) && this.Ws(a), c = 0, h = this.$s; c < h.length; c++) {\n f = h[c], this.ks(f);\n }\n\n return this.$s = [], // Register a window unload hook to remove the client metadata entry from\n // WebStorage even if `shutdown()` was not called.\n this.window.addEventListener(\"pagehide\", function () {\n return l.shutdown();\n }), this.started = !0, [2\n /*return*/\n ];\n }\n });\n });\n }, t.prototype.writeSequenceNumber = function (t) {\n this.setItem(this.Ms, JSON.stringify(t));\n }, t.prototype.getAllActiveQueryTargets = function () {\n return this.Gs(this.Fs);\n }, t.prototype.isActiveQueryTarget = function (t) {\n var e = !1;\n return this.Fs.forEach(function (n, r) {\n r.activeTargetIds.has(t) && (e = !0);\n }), e;\n }, t.prototype.addPendingMutation = function (t) {\n this.zs(t, \"pending\");\n }, t.prototype.updateMutationState = function (t, e, n) {\n this.zs(t, e, n), // Once a final mutation result is observed by other clients, they no longer\n // access the mutation's metadata entry. Since WebStorage replays events\n // in order, it is safe to delete the entry right after updating it.\n this.Hs(t);\n }, t.prototype.addLocalQueryTarget = function (t) {\n var e = \"not-current\"; // Lookup an existing query state if the target ID was already registered\n // by another tab\n\n if (this.isActiveQueryTarget(t)) {\n var n = this.storage.getItem(yo(this.persistenceKey, t));\n\n if (n) {\n var r = mo.Vs(t, n);\n r && (e = r.state);\n }\n }\n\n return this.Js.Ds(t), this.Qs(), e;\n }, t.prototype.removeLocalQueryTarget = function (t) {\n this.Js.Cs(t), this.Qs();\n }, t.prototype.isLocalQueryTarget = function (t) {\n return this.Js.activeTargetIds.has(t);\n }, t.prototype.clearQueryState = function (t) {\n this.removeItem(yo(this.persistenceKey, t));\n }, t.prototype.updateQueryState = function (t, e, n) {\n this.Ys(t, e, n);\n }, t.prototype.handleUserChange = function (t, e, n) {\n var r = this;\n e.forEach(function (t) {\n r.Hs(t);\n }), this.currentUser = t, n.forEach(function (t) {\n r.addPendingMutation(t);\n });\n }, t.prototype.setOnlineState = function (t) {\n this.Xs(t);\n }, t.prototype.notifyBundleLoaded = function () {\n this.Zs();\n }, t.prototype.shutdown = function () {\n this.started && (this.window.removeEventListener(\"storage\", this.xs), this.removeItem(this.Os), this.started = !1);\n }, t.prototype.getItem = function (t) {\n var e = this.storage.getItem(t);\n return C(\"SharedClientState\", \"READ\", t, e), e;\n }, t.prototype.setItem = function (t, e) {\n C(\"SharedClientState\", \"SET\", t, e), this.storage.setItem(t, e);\n }, t.prototype.removeItem = function (t) {\n C(\"SharedClientState\", \"REMOVE\", t), this.storage.removeItem(t);\n }, t.prototype.ks = function (t) {\n var e = this,\n i = t; // Note: The function is typed to take Event to be interface-compatible with\n // `Window.addEventListener`.\n\n if (i.storageArea === this.storage) {\n if (C(\"SharedClientState\", \"EVENT\", i.key, i.newValue), i.key === this.Os) return void x(\"Received WebStorage notification for local change. Another client might have garbage-collected our state\");\n this.Se.enqueueRetryable(function () {\n return n(e, void 0, void 0, function () {\n var t, e, n, o, s, u;\n return r(this, function (r) {\n if (this.started) {\n if (null !== i.key) if (this.Ls.test(i.key)) {\n if (null == i.newValue) return t = this.ti(i.key), [2\n /*return*/\n , this.ei(t, null)];\n if (e = this.ni(i.key, i.newValue)) return [2\n /*return*/\n , this.ei(e.clientId, e)];\n } else if (this.Bs.test(i.key)) {\n if (null !== i.newValue && (n = this.si(i.key, i.newValue))) return [2\n /*return*/\n , this.ii(n)];\n } else if (this.qs.test(i.key)) {\n if (null !== i.newValue && (o = this.ri(i.key, i.newValue))) return [2\n /*return*/\n , this.oi(o)];\n } else if (i.key === this.Us) {\n if (null !== i.newValue && (s = this.js(i.newValue))) return [2\n /*return*/\n , this.Ws(s)];\n } else if (i.key === this.Ms) (u = function (t) {\n var e = S.o;\n if (null != t) try {\n var n = JSON.parse(t);\n P(\"number\" == typeof n), e = n;\n } catch (t) {\n x(\"SharedClientState\", \"Failed to read sequence number from WebStorage\", t);\n }\n return e;\n }(i.newValue)) !== S.o && this.sequenceNumberHandler(u);else if (i.key === this.Ks) return [2\n /*return*/\n , this.syncEngine.ci()];\n } else this.$s.push(i);\n\n return [2\n /*return*/\n ];\n });\n });\n });\n }\n }, Object.defineProperty(t.prototype, \"Js\", {\n get: function get() {\n return this.Fs.get(this.Ns);\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.Qs = function () {\n this.setItem(this.Os, this.Js.Ss());\n }, t.prototype.zs = function (t, e, n) {\n var r = new vo(this.currentUser, t, e, n),\n i = po(this.persistenceKey, this.currentUser, t);\n this.setItem(i, r.Ss());\n }, t.prototype.Hs = function (t) {\n var e = po(this.persistenceKey, this.currentUser, t);\n this.removeItem(e);\n }, t.prototype.Xs = function (t) {\n var e = {\n clientId: this.Ns,\n onlineState: t\n };\n this.storage.setItem(this.Us, JSON.stringify(e));\n }, t.prototype.Ys = function (t, e, n) {\n var r = yo(this.persistenceKey, t),\n i = new mo(t, e, n);\n this.setItem(r, i.Ss());\n }, t.prototype.Zs = function () {\n this.setItem(this.Ks, \"value-not-used\");\n },\n /**\n * Parses a client state key in WebStorage. Returns null if the key does not\n * match the expected key format.\n */\n t.prototype.ti = function (t) {\n var e = this.Ls.exec(t);\n return e ? e[1] : null;\n },\n /**\n * Parses a client state in WebStorage. Returns 'null' if the value could not\n * be parsed.\n */\n t.prototype.ni = function (t, e) {\n var n = this.ti(t);\n return go.Vs(n, e);\n },\n /**\n * Parses a mutation batch state in WebStorage. Returns 'null' if the value\n * could not be parsed.\n */\n t.prototype.si = function (t, e) {\n var n = this.Bs.exec(t),\n r = Number(n[1]),\n i = void 0 !== n[2] ? n[2] : null;\n return vo.Vs(new fo(i), r, e);\n },\n /**\n * Parses a query target state from WebStorage. Returns 'null' if the value\n * could not be parsed.\n */\n t.prototype.ri = function (t, e) {\n var n = this.qs.exec(t),\n r = Number(n[1]);\n return mo.Vs(r, e);\n },\n /**\n * Parses an online state from WebStorage. Returns 'null' if the value\n * could not be parsed.\n */\n t.prototype.js = function (t) {\n return wo.Vs(t);\n }, t.prototype.ii = function (t) {\n return n(this, void 0, void 0, function () {\n return r(this, function (e) {\n return t.user.uid === this.currentUser.uid ? [2\n /*return*/\n , this.syncEngine.ui(t.batchId, t.state, t.error)] : (C(\"SharedClientState\", \"Ignoring mutation for non-active user \" + t.user.uid), [2\n /*return*/\n ]);\n });\n });\n }, t.prototype.oi = function (t) {\n return this.syncEngine.ai(t.targetId, t.state, t.error);\n }, t.prototype.ei = function (t, e) {\n var n = this,\n r = e ? this.Fs.insert(t, e) : this.Fs.remove(t),\n i = this.Gs(this.Fs),\n o = this.Gs(r),\n s = [],\n u = [];\n return o.forEach(function (t) {\n i.has(t) || s.push(t);\n }), i.forEach(function (t) {\n o.has(t) || u.push(t);\n }), this.syncEngine.hi(s, u).then(function () {\n n.Fs = r;\n });\n }, t.prototype.Ws = function (t) {\n // We check whether the client that wrote this online state is still active\n // by comparing its client ID to the list of clients kept active in\n // IndexedDb. If a client does not update their IndexedDb client state\n // within 5 seconds, it is considered inactive and we don't emit an online\n // state event.\n this.Fs.get(t.clientId) && this.onlineStateHandler(t.onlineState);\n }, t.prototype.Gs = function (t) {\n var e = an();\n return t.forEach(function (t, n) {\n e = e.unionWith(n.activeTargetIds);\n }), e;\n }, t;\n}(),\n To =\n/** @class */\nfunction () {\n function t() {\n this.li = new bo(), this.fi = {}, this.onlineStateHandler = null, this.sequenceNumberHandler = null;\n }\n\n return t.prototype.addPendingMutation = function (t) {// No op.\n }, t.prototype.updateMutationState = function (t, e, n) {// No op.\n }, t.prototype.addLocalQueryTarget = function (t) {\n return this.li.Ds(t), this.fi[t] || \"not-current\";\n }, t.prototype.updateQueryState = function (t, e, n) {\n this.fi[t] = e;\n }, t.prototype.removeLocalQueryTarget = function (t) {\n this.li.Cs(t);\n }, t.prototype.isLocalQueryTarget = function (t) {\n return this.li.activeTargetIds.has(t);\n }, t.prototype.clearQueryState = function (t) {\n delete this.fi[t];\n }, t.prototype.getAllActiveQueryTargets = function () {\n return this.li.activeTargetIds;\n }, t.prototype.isActiveQueryTarget = function (t) {\n return this.li.activeTargetIds.has(t);\n }, t.prototype.start = function () {\n return this.li = new bo(), Promise.resolve();\n }, t.prototype.handleUserChange = function (t, e, n) {// No op.\n }, t.prototype.setOnlineState = function (t) {// No op.\n }, t.prototype.shutdown = function () {}, t.prototype.writeSequenceNumber = function (t) {}, t.prototype.notifyBundleLoaded = function () {// No op.\n }, t;\n}(),\n Eo =\n/** @class */\nfunction () {\n function t() {}\n\n return t.prototype.di = function (t) {// No-op.\n }, t.prototype.shutdown = function () {// No-op.\n }, t;\n}(),\n _o =\n/** @class */\nfunction () {\n function t() {\n var t = this;\n this.wi = function () {\n return t._i();\n }, this.mi = function () {\n return t.yi();\n }, this.gi = [], this.pi();\n }\n\n return t.prototype.di = function (t) {\n this.gi.push(t);\n }, t.prototype.shutdown = function () {\n window.removeEventListener(\"online\", this.wi), window.removeEventListener(\"offline\", this.mi);\n }, t.prototype.pi = function () {\n window.addEventListener(\"online\", this.wi), window.addEventListener(\"offline\", this.mi);\n }, t.prototype._i = function () {\n C(\"ConnectivityMonitor\", \"Network connectivity changed: AVAILABLE\");\n\n for (var t = 0, e = this.gi; t < e.length; t++) {\n (0, e[t])(0\n /* AVAILABLE */\n );\n }\n }, t.prototype.yi = function () {\n C(\"ConnectivityMonitor\", \"Network connectivity changed: UNAVAILABLE\");\n\n for (var t = 0, e = this.gi; t < e.length; t++) {\n (0, e[t])(1\n /* UNAVAILABLE */\n );\n }\n }, // TODO(chenbrian): Consider passing in window either into this component or\n // here for testing via FakeWindow.\n\n /** Checks that all used attributes of window are available. */\n t.yt = function () {\n return \"undefined\" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener;\n }, t;\n}(),\n So = {\n BatchGetDocuments: \"batchGet\",\n Commit: \"commit\",\n RunQuery: \"runQuery\"\n},\n No =\n/** @class */\nfunction () {\n function t(t) {\n this.Ei = t.Ei, this.Ti = t.Ti;\n }\n\n return t.prototype.Ii = function (t) {\n this.Ai = t;\n }, t.prototype.Ri = function (t) {\n this.bi = t;\n }, t.prototype.onMessage = function (t) {\n this.vi = t;\n }, t.prototype.close = function () {\n this.Ti();\n }, t.prototype.send = function (t) {\n this.Ei(t);\n }, t.prototype.Pi = function () {\n this.Ai();\n }, t.prototype.Vi = function (t) {\n this.bi(t);\n }, t.prototype.Si = function (t) {\n this.vi(t);\n }, t;\n}(),\n Do =\n/** @class */\nfunction (e) {\n function n(t) {\n var n = this;\n return (n = e.call(this, t) || this).forceLongPolling = t.forceLongPolling, n.autoDetectLongPolling = t.autoDetectLongPolling, n.useFetchStreams = t.useFetchStreams, n;\n }\n /**\n * Base class for all Rest-based connections to the backend (WebChannel and\n * HTTP).\n */\n\n\n return t(n, e), n.prototype.Fi = function (t, e, n, r) {\n return new Promise(function (i, o) {\n var s = new v();\n s.listenOnce(m.COMPLETE, function () {\n try {\n switch (s.getLastErrorCode()) {\n case g.NO_ERROR:\n var e = s.getResponseJson();\n C(\"Connection\", \"XHR received:\", JSON.stringify(e)), i(e);\n break;\n\n case g.TIMEOUT:\n C(\"Connection\", 'RPC \"' + t + '\" timed out'), o(new D(N.DEADLINE_EXCEEDED, \"Request time out\"));\n break;\n\n case g.HTTP_ERROR:\n var n = s.getStatus();\n\n if (C(\"Connection\", 'RPC \"' + t + '\" failed with status:', n, \"response text:\", s.getResponseText()), n > 0) {\n var r = s.getResponseJson().error;\n\n if (r && r.status && r.message) {\n var u = function (t) {\n var e = t.toLowerCase().replace(/_/g, \"-\");\n return Object.values(N).indexOf(e) >= 0 ? e : N.UNKNOWN;\n }(r.status);\n\n o(new D(u, r.message));\n } else o(new D(N.UNKNOWN, \"Server responded with status \" + s.getStatus()));\n } else // If we received an HTTP_ERROR but there's no status code,\n // it's most probably a connection issue\n o(new D(N.UNAVAILABLE, \"Connection failed.\"));\n\n break;\n\n default:\n O();\n }\n } finally {\n C(\"Connection\", 'RPC \"' + t + '\" completed.');\n }\n });\n var u = JSON.stringify(r);\n s.send(e, \"POST\", u, n, 15);\n });\n }, n.prototype.Oi = function (t, e) {\n var n = [this.Di, \"/\", \"google.firestore.v1.Firestore\", \"/\", t, \"/channel\"],\n r = w(),\n i = b(),\n o = {\n // Required for backend stickiness, routing behavior is based on this\n // parameter.\n httpSessionIdParam: \"gsessionid\",\n initMessageHeaders: {},\n messageUrlParams: {\n // This param is used to improve routing and project isolation by the\n // backend and must be included in every request.\n database: \"projects/\" + this.databaseId.projectId + \"/databases/\" + this.databaseId.database\n },\n sendRawJson: !0,\n supportsCrossDomainXhr: !0,\n internalChannelParams: {\n // Override the default timeout (randomized between 10-20 seconds) since\n // a large write batch on a slow internet connection may take a long\n // time to send to the backend. Rather than have WebChannel impose a\n // tight timeout which could lead to infinite timeouts and retries, we\n // set it very large (5-10 minutes) and rely on the browser's builtin\n // timeouts to kick in if the request isn't working.\n forwardChannelRequestTimeoutMs: 6e5\n },\n forceLongPolling: this.forceLongPolling,\n detectBufferingProxy: this.autoDetectLongPolling\n };\n this.useFetchStreams && (o.xmlHttpFactory = new I({})), this.ki(o.initMessageHeaders, e), // Sending the custom headers we just added to request.initMessageHeaders\n // (Authorization, etc.) will trigger the browser to make a CORS preflight\n // request because the XHR will no longer meet the criteria for a \"simple\"\n // CORS request:\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests\n // Therefore to avoid the CORS preflight request (an extra network\n // roundtrip), we use the httpHeadersOverwriteParam option to specify that\n // the headers should instead be encoded into a special \"$httpHeaders\" query\n // parameter, which is recognized by the webchannel backend. This is\n // formally defined here:\n // https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L32\n // TODO(b/145624756): There is a backend bug where $httpHeaders isn't respected if the request\n // doesn't have an Origin header. So we have to exclude a few browser environments that are\n // known to (sometimes) not include an Origin. See\n // https://github.com/firebase/firebase-js-sdk/issues/1491.\n s() || u() || a() || c() || h() || f() || (o.httpHeadersOverwriteParam = \"$httpHeaders\");\n var l = n.join(\"\");\n C(\"Connection\", \"Creating WebChannel: \" + l, o);\n\n var d = r.createWebChannel(l, o),\n p = !1,\n y = !1,\n v = new No({\n Ei: function Ei(t) {\n y ? C(\"Connection\", \"Not sending because WebChannel is closed:\", t) : (p || (C(\"Connection\", \"Opening WebChannel transport.\"), d.open(), p = !0), C(\"Connection\", \"WebChannel sending:\", t), d.send(t));\n },\n Ti: function Ti() {\n return d.close();\n }\n }),\n m = function m(t, e, n) {\n // TODO(dimond): closure typing seems broken because WebChannel does\n // not implement goog.events.Listenable\n t.listen(e, function (t) {\n try {\n n(t);\n } catch (t) {\n setTimeout(function () {\n throw t;\n }, 0);\n }\n });\n }; // WebChannel supports sending the first message with the handshake - saving\n // a network round trip. However, it will have to call send in the same\n // JS event loop as open. In order to enforce this, we delay actually\n // opening the WebChannel until send is called. Whether we have called\n // open is tracked with this variable.\n // Closure events are guarded and exceptions are swallowed, so catch any\n // exception and rethrow using a setTimeout so they become visible again.\n // Note that eventually this function could go away if we are confident\n // enough the code is exception free.\n\n\n return m(d, T.EventType.OPEN, function () {\n y || C(\"Connection\", \"WebChannel transport opened.\");\n }), m(d, T.EventType.CLOSE, function () {\n y || (y = !0, C(\"Connection\", \"WebChannel transport closed\"), v.Vi());\n }), m(d, T.EventType.ERROR, function (t) {\n y || (y = !0, R(\"Connection\", \"WebChannel transport errored:\", t), v.Vi(new D(N.UNAVAILABLE, \"The operation could not be completed\")));\n }), m(d, T.EventType.MESSAGE, function (t) {\n var e;\n\n if (!y) {\n var n = t.data[0];\n P(!!n); // TODO(b/35143891): There is a bug in One Platform that caused errors\n // (and only errors) to be wrapped in an extra array. To be forward\n // compatible with the bug we need to check either condition. The latter\n // can be removed once the fix has been rolled out.\n // Use any because msgData.error is not typed.\n\n var r = n,\n i = r.error || (null === (e = r[0]) || void 0 === e ? void 0 : e.error);\n\n if (i) {\n C(\"Connection\", \"WebChannel received error:\", i); // error.status will be a string like 'OK' or 'NOT_FOUND'.\n\n var o = i.status,\n s =\n /**\n * Maps an error Code from a GRPC status identifier like 'NOT_FOUND'.\n *\n * @returns The Code equivalent to the given status string or undefined if\n * there is no match.\n */\n function (t) {\n // lookup by string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var e = Ue[t];\n if (void 0 !== e) return ze(e);\n }(o),\n u = i.message;\n\n void 0 === s && (s = N.INTERNAL, u = \"Unknown error status: \" + o + \" with message \" + i.message), // Mark closed so no further events are propagated\n y = !0, v.Vi(new D(s, u)), d.close();\n } else C(\"Connection\", \"WebChannel received:\", n), v.Si(n);\n }\n }), m(i, E.STAT_EVENT, function (t) {\n t.stat === _.PROXY ? C(\"Connection\", \"Detected buffering proxy\") : t.stat === _.NOPROXY && C(\"Connection\", \"Detected no buffering proxy\");\n }), setTimeout(function () {\n // Technically we could/should wait for the WebChannel opened event,\n // but because we want to send the first message with the WebChannel\n // handshake we pretend the channel opened here (asynchronously), and\n // then delay the actual open until the first message is sent.\n v.Pi();\n }, 0), v;\n }, n;\n}(\n/** @class */\nfunction () {\n function t(t) {\n this.databaseInfo = t, this.databaseId = t.databaseId;\n var e = t.ssl ? \"https\" : \"http\";\n this.Di = e + \"://\" + t.host, this.Ci = \"projects/\" + this.databaseId.projectId + \"/databases/\" + this.databaseId.database + \"/documents\";\n }\n\n return t.prototype.Ni = function (t, e, n, r) {\n var i = this.xi(t, e);\n C(\"RestConnection\", \"Sending: \", i, n);\n var o = {};\n return this.ki(o, r), this.Fi(t, i, o, n).then(function (t) {\n return C(\"RestConnection\", \"Received: \", t), t;\n }, function (e) {\n throw R(\"RestConnection\", t + \" failed with error: \", e, \"url: \", i, \"request:\", n), e;\n });\n }, t.prototype.$i = function (t, e, n, r) {\n // The REST API automatically aggregates all of the streamed results, so we\n // can just use the normal invoke() method.\n return this.Ni(t, e, n, r);\n },\n /**\n * Modifies the headers for a request, adding any authorization token if\n * present and any additional headers for the request.\n */\n t.prototype.ki = function (t, e) {\n if (t[\"X-Goog-Api-Client\"] = \"gl-js/ fire/8.10.0\", // Content-Type: text/plain will avoid preflight requests which might\n // mess with CORS and redirects by proxies. If we add custom headers\n // we will need to change this code to potentially use the $httpOverwrite\n // parameter supported by ESF to avoid triggering preflight requests.\n t[\"Content-Type\"] = \"text/plain\", this.databaseInfo.appId && (t[\"X-Firebase-GMPID\"] = this.databaseInfo.appId), e) for (var n in e.authHeaders) {\n e.authHeaders.hasOwnProperty(n) && (t[n] = e.authHeaders[n]);\n }\n }, t.prototype.xi = function (t, e) {\n var n = So[t];\n return this.Di + \"/v1/\" + e + \":\" + n;\n }, t;\n}());\n/**\n * Holds the state of a query target, including its target ID and whether the\n * target is 'not-current', 'current' or 'rejected'.\n */\n// Visible for testing\n\n/**\n * @license\n * Copyright 2020 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/** Initializes the WebChannelConnection for the browser. */\n\n/**\n * @license\n * Copyright 2020 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/** The Platform's 'window' implementation or null if not available. */\n\n\nfunction Ao() {\n // `window` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof window ? window : null;\n}\n/** The Platform's 'document' implementation or null if not available. */\n\n\nfunction ko() {\n // `document` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof document ? document : null;\n}\n/**\n * @license\n * Copyright 2020 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\nfunction Co(t) {\n return new bn(t,\n /* useProto3Json= */\n !0);\n}\n/**\n * An instance of the Platform's 'TextEncoder' implementation.\n */\n\n/**\n * A helper for running delayed tasks following an exponential backoff curve\n * between attempts.\n *\n * Each delay is made up of a \"base\" delay which follows the exponential\n * backoff curve, and a +/- 50% \"jitter\" that is calculated and added to the\n * base delay. This prevents clients from accidentally synchronizing their\n * delays causing spikes of load to the backend.\n */\n\n\nvar xo =\n/** @class */\nfunction () {\n function t(\n /**\n * The AsyncQueue to run backoff operations on.\n */\n t,\n /**\n * The ID to use when scheduling backoff operations on the AsyncQueue.\n */\n e,\n /**\n * The initial delay (used as the base delay on the first retry attempt).\n * Note that jitter will still be applied, so the actual delay could be as\n * little as 0.5*initialDelayMs.\n */\n n\n /**\n * The multiplier to use to determine the extended base delay after each\n * attempt.\n */\n , r\n /**\n * The maximum base delay after which no further backoff is performed.\n * Note that jitter will still be applied, so the actual delay could be as\n * much as 1.5*maxDelayMs.\n */\n , i) {\n void 0 === n && (n = 1e3), void 0 === r && (r = 1.5), void 0 === i && (i = 6e4), this.Se = t, this.timerId = e, this.Mi = n, this.Li = r, this.Bi = i, this.qi = 0, this.Ui = null,\n /** The last backoff attempt, as epoch milliseconds. */\n this.Ki = Date.now(), this.reset();\n }\n /**\n * Resets the backoff delay.\n *\n * The very next backoffAndWait() will have no delay. If it is called again\n * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and\n * subsequent ones will increase according to the backoffFactor.\n */\n\n\n return t.prototype.reset = function () {\n this.qi = 0;\n },\n /**\n * Resets the backoff delay to the maximum delay (e.g. for use after a\n * RESOURCE_EXHAUSTED error).\n */\n t.prototype.Qi = function () {\n this.qi = this.Bi;\n },\n /**\n * Returns a promise that resolves after currentDelayMs, and increases the\n * delay for any subsequent attempts. If there was a pending backoff operation\n * already, it will be canceled.\n */\n t.prototype.ji = function (t) {\n var e = this; // Cancel any pending backoff operation.\n\n this.cancel(); // First schedule using the current base (which may be 0 and should be\n // honored as such).\n\n var n = Math.floor(this.qi + this.Wi()),\n r = Math.max(0, Date.now() - this.Ki),\n i = Math.max(0, n - r); // Guard against lastAttemptTime being in the future due to a clock change.\n\n i > 0 && C(\"ExponentialBackoff\", \"Backing off for \" + i + \" ms (base delay: \" + this.qi + \" ms, delay with jitter: \" + n + \" ms, last attempt: \" + r + \" ms ago)\"), this.Ui = this.Se.enqueueAfterDelay(this.timerId, i, function () {\n return e.Ki = Date.now(), t();\n }), // Apply backoff factor to determine next delay and ensure it is within\n // bounds.\n this.qi *= this.Li, this.qi < this.Mi && (this.qi = this.Mi), this.qi > this.Bi && (this.qi = this.Bi);\n }, t.prototype.Gi = function () {\n null !== this.Ui && (this.Ui.skipDelay(), this.Ui = null);\n }, t.prototype.cancel = function () {\n null !== this.Ui && (this.Ui.cancel(), this.Ui = null);\n },\n /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */\n t.prototype.Wi = function () {\n return (Math.random() - .5) * this.qi;\n }, t;\n}(),\n Ro =\n/** @class */\nfunction () {\n function t(t, e, n, r, i, o) {\n this.Se = t, this.zi = n, this.Hi = r, this.Ji = i, this.listener = o, this.state = 0\n /* Initial */\n ,\n /**\n * A close count that's incremented every time the stream is closed; used by\n * getCloseGuardedDispatcher() to invalidate callbacks that happen after\n * close.\n */\n this.Yi = 0, this.Xi = null, this.stream = null, this.Zi = new xo(t, e)\n /**\n * Returns true if start() has been called and no error has occurred. True\n * indicates the stream is open or in the process of opening (which\n * encompasses respecting backoff, getting auth tokens, and starting the\n * actual RPC). Use isOpen() to determine if the stream is open and ready for\n * outbound requests.\n */\n ;\n }\n\n return t.prototype.tr = function () {\n return 1\n /* Starting */\n === this.state || 2\n /* Open */\n === this.state || 4\n /* Backoff */\n === this.state;\n },\n /**\n * Returns true if the underlying RPC is open (the onOpen() listener has been\n * called) and the stream is ready for outbound requests.\n */\n t.prototype.er = function () {\n return 2\n /* Open */\n === this.state;\n },\n /**\n * Starts the RPC. Only allowed if isStarted() returns false. The stream is\n * not immediately ready for use: onOpen() will be invoked when the RPC is\n * ready for outbound requests, at which point isOpen() will return true.\n *\n * When start returns, isStarted() will return true.\n */\n t.prototype.start = function () {\n 3\n /* Error */\n !== this.state ? this.auth() : this.nr();\n },\n /**\n * Stops the RPC. This call is idempotent and allowed regardless of the\n * current isStarted() state.\n *\n * When stop returns, isStarted() and isOpen() will both return false.\n */\n t.prototype.stop = function () {\n return n(this, void 0, void 0, function () {\n return r(this, function (t) {\n switch (t.label) {\n case 0:\n return this.tr() ? [4\n /*yield*/\n , this.close(0\n /* Initial */\n )] : [3\n /*break*/\n , 2];\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n return [2\n /*return*/\n ];\n }\n });\n });\n },\n /**\n * After an error the stream will usually back off on the next attempt to\n * start it. If the error warrants an immediate restart of the stream, the\n * sender can use this to indicate that the receiver should not back off.\n *\n * Each error will call the onClose() listener. That function can decide to\n * inhibit backoff if required.\n */\n t.prototype.sr = function () {\n this.state = 0\n /* Initial */\n , this.Zi.reset();\n },\n /**\n * Marks this stream as idle. If no further actions are performed on the\n * stream for one minute, the stream will automatically close itself and\n * notify the stream's onClose() handler with Status.OK. The stream will then\n * be in a !isStarted() state, requiring the caller to start the stream again\n * before further use.\n *\n * Only streams that are in state 'Open' can be marked idle, as all other\n * states imply pending network operations.\n */\n t.prototype.ir = function () {\n var t = this; // Starts the idle time if we are in state 'Open' and are not yet already\n // running a timer (in which case the previous idle timeout still applies).\n\n this.er() && null === this.Xi && (this.Xi = this.Se.enqueueAfterDelay(this.zi, 6e4, function () {\n return t.rr();\n }));\n },\n /** Sends a message to the underlying stream. */\n t.prototype.cr = function (t) {\n this.ur(), this.stream.send(t);\n },\n /** Called by the idle timer when the stream should close due to inactivity. */\n t.prototype.rr = function () {\n return n(this, void 0, void 0, function () {\n return r(this, function (t) {\n return this.er() ? [2\n /*return*/\n , this.close(0\n /* Initial */\n )] : [2\n /*return*/\n ];\n });\n });\n },\n /** Marks the stream as active again. */\n t.prototype.ur = function () {\n this.Xi && (this.Xi.cancel(), this.Xi = null);\n },\n /**\n * Closes the stream and cleans up as necessary:\n *\n * * closes the underlying GRPC stream;\n * * calls the onClose handler with the given 'error';\n * * sets internal stream state to 'finalState';\n * * adjusts the backoff timer based on the error\n *\n * A new stream can be opened by calling start().\n *\n * @param finalState - the intended state of the stream after closing.\n * @param error - the error the connection was closed with.\n */\n t.prototype.close = function (t, e) {\n return n(this, void 0, void 0, function () {\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n // Notify the listener that the stream closed.\n // Cancel any outstanding timers (they're guaranteed not to execute).\n return this.ur(), this.Zi.cancel(), // Invalidates any stream-related callbacks (e.g. from auth or the\n // underlying stream), guaranteeing they won't execute.\n this.Yi++, 3\n /* Error */\n !== t ? // If this is an intentional close ensure we don't delay our next connection attempt.\n this.Zi.reset() : e && e.code === N.RESOURCE_EXHAUSTED ? ( // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)\n x(e.toString()), x(\"Using maximum backoff delay to prevent overloading the backend.\"), this.Zi.Qi()) : e && e.code === N.UNAUTHENTICATED && // \"unauthenticated\" error means the token was rejected. Try force refreshing it in case it\n // just expired.\n this.Ji.invalidateToken(), // Clean up the underlying stream because we are no longer interested in events.\n null !== this.stream && (this.ar(), this.stream.close(), this.stream = null), // This state must be assigned before calling onClose() to allow the callback to\n // inhibit backoff or otherwise manipulate the state in its non-started state.\n this.state = t, [4\n /*yield*/\n , this.listener.Ri(e)];\n\n case 1:\n // Cancel any outstanding timers (they're guaranteed not to execute).\n // Notify the listener that the stream closed.\n return n.sent(), [2\n /*return*/\n ];\n }\n });\n });\n },\n /**\n * Can be overridden to perform additional cleanup before the stream is closed.\n * Calling super.tearDown() is not required.\n */\n t.prototype.ar = function () {}, t.prototype.auth = function () {\n var t = this;\n this.state = 1\n /* Starting */\n ;\n var e = this.hr(this.Yi),\n n = this.Yi; // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.\n\n this.Ji.getToken().then(function (e) {\n // Stream can be stopped while waiting for authentication.\n // TODO(mikelehen): We really should just use dispatchIfNotClosed\n // and let this dispatch onto the queue, but that opened a spec test can\n // of worms that I don't want to deal with in this PR.\n t.Yi === n && // Normally we'd have to schedule the callback on the AsyncQueue.\n // However, the following calls are safe to be called outside the\n // AsyncQueue since they don't chain asynchronous calls\n t.lr(e);\n }, function (n) {\n e(function () {\n var e = new D(N.UNKNOWN, \"Fetching auth token failed: \" + n.message);\n return t.dr(e);\n });\n });\n }, t.prototype.lr = function (t) {\n var e = this,\n n = this.hr(this.Yi);\n this.stream = this.wr(t), this.stream.Ii(function () {\n n(function () {\n return e.state = 2\n /* Open */\n , e.listener.Ii();\n });\n }), this.stream.Ri(function (t) {\n n(function () {\n return e.dr(t);\n });\n }), this.stream.onMessage(function (t) {\n n(function () {\n return e.onMessage(t);\n });\n });\n }, t.prototype.nr = function () {\n var t = this;\n this.state = 4\n /* Backoff */\n , this.Zi.ji(function () {\n return n(t, void 0, void 0, function () {\n return r(this, function (t) {\n return this.state = 0\n /* Initial */\n , this.start(), [2\n /*return*/\n ];\n });\n });\n });\n }, // Visible for tests\n t.prototype.dr = function (t) {\n // In theory the stream could close cleanly, however, in our current model\n // we never expect this to happen because if we stop a stream ourselves,\n // this callback will never be called. To prevent cases where we retry\n // without a backoff accidentally, we set the stream to error in all cases.\n return C(\"PersistentStream\", \"close with error: \" + t), this.stream = null, this.close(3\n /* Error */\n , t);\n },\n /**\n * Returns a \"dispatcher\" function that dispatches operations onto the\n * AsyncQueue but only runs them if closeCount remains unchanged. This allows\n * us to turn auth / stream callbacks into no-ops if the stream is closed /\n * re-opened, etc.\n */\n t.prototype.hr = function (t) {\n var e = this;\n return function (n) {\n e.Se.enqueueAndForget(function () {\n return e.Yi === t ? n() : (C(\"PersistentStream\", \"stream callback skipped by getCloseGuardedDispatcher.\"), Promise.resolve());\n });\n };\n }, t;\n}(),\n Lo =\n/** @class */\nfunction (e) {\n function n(t, n, r, i, o) {\n var s = this;\n return (s = e.call(this, t, \"listen_stream_connection_backoff\"\n /* ListenStreamConnectionBackoff */\n , \"listen_stream_idle\"\n /* ListenStreamIdle */\n , n, r, o) || this).R = i, s;\n }\n\n return t(n, e), n.prototype.wr = function (t) {\n return this.Hi.Oi(\"Listen\", t);\n }, n.prototype.onMessage = function (t) {\n // A successful response means the stream is healthy\n this.Zi.reset();\n\n var e = function (t, e) {\n var n;\n\n if (\"targetChange\" in e) {\n e.targetChange; // proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE'\n // if unset\n\n var r = function (t) {\n return \"NO_CHANGE\" === t ? 0\n /* NoChange */\n : \"ADD\" === t ? 1\n /* Added */\n : \"REMOVE\" === t ? 2\n /* Removed */\n : \"CURRENT\" === t ? 3\n /* Current */\n : \"RESET\" === t ? 4\n /* Reset */\n : O();\n }(e.targetChange.targetChangeType || \"NO_CHANGE\"),\n i = e.targetChange.targetIds || [],\n o = function (t, e) {\n return t.I ? (P(void 0 === e || \"string\" == typeof e), J.fromBase64String(e || \"\")) : (P(void 0 === e || e instanceof Uint8Array), J.fromUint8Array(e || new Uint8Array()));\n }(t, e.targetChange.resumeToken),\n s = (u = e.targetChange.cause) && function (t) {\n var e = void 0 === t.code ? N.UNKNOWN : ze(t.code);\n return new D(e, t.message || \"\");\n }(u);\n\n n = new dn(r, i, o, s || null);\n } else if (\"documentChange\" in e) {\n e.documentChange, (r = e.documentChange).document, r.document.name, r.document.updateTime, i = An(t, r.document.name), o = _n(r.document.updateTime);\n var u = new _t({\n mapValue: {\n fields: r.document.fields\n }\n }),\n a = (s = Nt.newFoundDocument(i, o, u), r.targetIds || []),\n c = r.removedTargetIds || [];\n n = new fn(a, c, s.key, s);\n } else if (\"documentDelete\" in e) e.documentDelete, (r = e.documentDelete).document, i = An(t, r.document), o = r.readTime ? _n(r.readTime) : K.min(), u = Nt.newNoDocument(i, o), s = r.removedTargetIds || [], n = new fn([], s, u.key, u);else if (\"documentRemove\" in e) e.documentRemove, (r = e.documentRemove).document, i = An(t, r.document), o = r.removedTargetIds || [], n = new fn([], o, i, null);else {\n if (!(\"filter\" in e)) return O();\n e.filter;\n var h = e.filter;\n h.targetId, r = h.count || 0, i = new Qe(r), o = h.targetId, n = new ln(o, i);\n }\n\n return n;\n }(this.R, t),\n n = function (t) {\n // We have only reached a consistent snapshot for the entire stream if there\n // is a read_time set and it applies to all targets (i.e. the list of\n // targets is empty). The backend is guaranteed to send such responses.\n if (!(\"targetChange\" in t)) return K.min();\n var e = t.targetChange;\n return e.targetIds && e.targetIds.length ? K.min() : e.readTime ? _n(e.readTime) : K.min();\n }(t);\n\n return this.listener._r(e, n);\n },\n /**\n * Registers interest in the results of the given target. If the target\n * includes a resumeToken it will be included in the request. Results that\n * affect the target will be streamed back as WatchChange messages that\n * reference the targetId.\n */\n n.prototype.mr = function (t) {\n var e = {};\n e.database = xn(this.R), e.addTarget = function (t, e) {\n var n,\n r = e.target;\n return (n = xt(r) ? {\n documents: Mn(t, r)\n } : {\n query: Vn(t, r)\n }).targetId = e.targetId, e.resumeToken.approximateByteSize() > 0 ? n.resumeToken = Tn(t, e.resumeToken) : e.snapshotVersion.compareTo(K.min()) > 0 && ( // TODO(wuandy): Consider removing above check because it is most likely true.\n // Right now, many tests depend on this behaviour though (leaving min() out\n // of serialization).\n n.readTime = In(t, e.snapshotVersion.toTimestamp())), n;\n }(this.R, t);\n\n var n = function (t, e) {\n var n = function (t, e) {\n switch (e) {\n case 0\n /* Listen */\n :\n return null;\n\n case 1\n /* ExistenceFilterMismatch */\n :\n return \"existence-filter-mismatch\";\n\n case 2\n /* LimboResolution */\n :\n return \"limbo-document\";\n\n default:\n return O();\n }\n }(0, e.purpose);\n\n return null == n ? null : {\n \"goog-listen-tags\": n\n };\n }(this.R, t);\n\n n && (e.labels = n), this.cr(e);\n },\n /**\n * Unregisters interest in the results of the target associated with the\n * given targetId.\n */\n n.prototype.yr = function (t) {\n var e = {};\n e.database = xn(this.R), e.removeTarget = t, this.cr(e);\n }, n;\n}(Ro),\n Oo =\n/** @class */\nfunction (e) {\n function n(t, n, r, i, o) {\n var s = this;\n return (s = e.call(this, t, \"write_stream_connection_backoff\"\n /* WriteStreamConnectionBackoff */\n , \"write_stream_idle\"\n /* WriteStreamIdle */\n , n, r, o) || this).R = i, s.gr = !1, s;\n }\n\n return t(n, e), Object.defineProperty(n.prototype, \"pr\", {\n /**\n * Tracks whether or not a handshake has been successfully exchanged and\n * the stream is ready to accept mutations.\n */\n get: function get() {\n return this.gr;\n },\n enumerable: !1,\n configurable: !0\n }), // Override of PersistentStream.start\n n.prototype.start = function () {\n this.gr = !1, this.lastStreamToken = void 0, e.prototype.start.call(this);\n }, n.prototype.ar = function () {\n this.gr && this.Er([]);\n }, n.prototype.wr = function (t) {\n return this.Hi.Oi(\"Write\", t);\n }, n.prototype.onMessage = function (t) {\n if ( // Always capture the last stream token.\n P(!!t.streamToken), this.lastStreamToken = t.streamToken, this.gr) {\n // A successful first write response means the stream is healthy,\n // Note, that we could consider a successful handshake healthy, however,\n // the write itself might be causing an error we want to back off from.\n this.Zi.reset();\n\n var e = function (t, e) {\n return t && t.length > 0 ? (P(void 0 !== e), t.map(function (t) {\n return function (t, e) {\n // NOTE: Deletes don't have an updateTime.\n var n = t.updateTime ? _n(t.updateTime) : _n(e);\n return n.isEqual(K.min()) && ( // The Firestore Emulator currently returns an update time of 0 for\n // deletes of non-existing documents (rather than null). This breaks the\n // test \"get deleted doc while offline with source=cache\" as NoDocuments\n // with version 0 are filtered by IndexedDb's RemoteDocumentCache.\n // TODO(#2149): Remove this when Emulator is fixed\n n = _n(e)), new Ne(n, t.transformResults || []);\n }(t, e);\n })) : [];\n }(t.writeResults, t.commitTime),\n n = _n(t.commitTime);\n\n return this.listener.Tr(n, e);\n } // The first response is always the handshake response\n\n\n return P(!t.writeResults || 0 === t.writeResults.length), this.gr = !0, this.listener.Ir();\n },\n /**\n * Sends an initial streamToken to the server, performing the handshake\n * required to make the StreamingWrite RPC work. Subsequent\n * calls should wait until onHandshakeComplete was called.\n */\n n.prototype.Ar = function () {\n // TODO(dimond): Support stream resumption. We intentionally do not set the\n // stream token on the handshake, ignoring any stream token we might have.\n var t = {};\n t.database = xn(this.R), this.cr(t);\n },\n /** Sends a group of mutations to the Firestore backend to apply. */\n n.prototype.Er = function (t) {\n var e = this,\n n = {\n streamToken: this.lastStreamToken,\n writes: t.map(function (t) {\n return Pn(e.R, t);\n })\n };\n this.cr(n);\n }, n;\n}(Ro),\n Po =\n/** @class */\nfunction (e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).credentials = t, i.Hi = n, i.R = r, i.Rr = !1, i;\n }\n\n return t(n, e), n.prototype.br = function () {\n if (this.Rr) throw new D(N.FAILED_PRECONDITION, \"The client has already been terminated.\");\n },\n /** Gets an auth token and invokes the provided RPC. */\n n.prototype.Ni = function (t, e, n) {\n var r = this;\n return this.br(), this.credentials.getToken().then(function (i) {\n return r.Hi.Ni(t, e, n, i);\n }).catch(function (t) {\n throw \"FirebaseError\" === t.name ? (t.code === N.UNAUTHENTICATED && r.credentials.invalidateToken(), t) : new D(N.UNKNOWN, t.toString());\n });\n },\n /** Gets an auth token and invokes the provided RPC with streamed results. */\n n.prototype.$i = function (t, e, n) {\n var r = this;\n return this.br(), this.credentials.getToken().then(function (i) {\n return r.Hi.$i(t, e, n, i);\n }).catch(function (t) {\n throw \"FirebaseError\" === t.name ? (t.code === N.UNAUTHENTICATED && r.credentials.invalidateToken(), t) : new D(N.UNKNOWN, t.toString());\n });\n }, n.prototype.terminate = function () {\n this.Rr = !0;\n }, n;\n}(function () {}),\n Fo =\n/** @class */\nfunction () {\n function t(t, e) {\n this.asyncQueue = t, this.onlineStateHandler = e,\n /** The current OnlineState. */\n this.state = \"Unknown\"\n /* Unknown */\n ,\n /**\n * A count of consecutive failures to open the stream. If it reaches the\n * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to\n * Offline.\n */\n this.vr = 0,\n /**\n * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we\n * transition from OnlineState.Unknown to OnlineState.Offline without waiting\n * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times).\n */\n this.Pr = null,\n /**\n * Whether the client should log a warning message if it fails to connect to\n * the backend (initially true, cleared after a successful stream, or if we've\n * logged the message already).\n */\n this.Vr = !0\n /**\n * Called by RemoteStore when a watch stream is started (including on each\n * backoff attempt).\n *\n * If this is the first attempt, it sets the OnlineState to Unknown and starts\n * the onlineStateTimer.\n */\n ;\n }\n\n return t.prototype.Sr = function () {\n var t = this;\n 0 === this.vr && (this.Dr(\"Unknown\"\n /* Unknown */\n ), this.Pr = this.asyncQueue.enqueueAfterDelay(\"online_state_timeout\"\n /* OnlineStateTimeout */\n , 1e4, function () {\n return t.Pr = null, t.Cr(\"Backend didn't respond within 10 seconds.\"), t.Dr(\"Offline\"\n /* Offline */\n ), Promise.resolve();\n }));\n },\n /**\n * Updates our OnlineState as appropriate after the watch stream reports a\n * failure. The first failure moves us to the 'Unknown' state. We then may\n * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we\n * actually transition to the 'Offline' state.\n */\n t.prototype.Nr = function (t) {\n \"Online\"\n /* Online */\n === this.state ? this.Dr(\"Unknown\"\n /* Unknown */\n ) : (this.vr++, this.vr >= 1 && (this.kr(), this.Cr(\"Connection failed 1 times. Most recent error: \" + t.toString()), this.Dr(\"Offline\"\n /* Offline */\n )));\n },\n /**\n * Explicitly sets the OnlineState to the specified state.\n *\n * Note that this resets our timers / failure counters, etc. used by our\n * Offline heuristics, so must not be used in place of\n * handleWatchStreamStart() and handleWatchStreamFailure().\n */\n t.prototype.set = function (t) {\n this.kr(), this.vr = 0, \"Online\"\n /* Online */\n === t && ( // We've connected to watch at least once. Don't warn the developer\n // about being offline going forward.\n this.Vr = !1), this.Dr(t);\n }, t.prototype.Dr = function (t) {\n t !== this.state && (this.state = t, this.onlineStateHandler(t));\n }, t.prototype.Cr = function (t) {\n var e = \"Could not reach Cloud Firestore backend. \" + t + \"\\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.\";\n this.Vr ? (x(e), this.Vr = !1) : C(\"OnlineStateTracker\", e);\n }, t.prototype.kr = function () {\n null !== this.Pr && (this.Pr.cancel(), this.Pr = null);\n }, t;\n}(),\n Mo = function Mo(\n/**\n * The local store, used to fill the write pipeline with outbound mutations.\n */\nt,\n/** The client-side proxy for interacting with the backend. */\ne, i, o, s) {\n var u = this;\n this.localStore = t, this.datastore = e, this.asyncQueue = i, this.remoteSyncer = {},\n /**\n * A list of up to MAX_PENDING_WRITES writes that we have fetched from the\n * LocalStore via fillWritePipeline() and have or will send to the write\n * stream.\n *\n * Whenever writePipeline.length > 0 the RemoteStore will attempt to start or\n * restart the write stream. When the stream is established the writes in the\n * pipeline will be sent in order.\n *\n * Writes remain in writePipeline until they are acknowledged by the backend\n * and thus will automatically be re-sent if the stream is interrupted /\n * restarted before they're acknowledged.\n *\n * Write responses from the backend are linked to their originating request\n * purely based on order, and so we can just shift() writes from the front of\n * the writePipeline as we receive responses.\n */\n this.Fr = [],\n /**\n * A mapping of watched targets that the client cares about tracking and the\n * user has explicitly called a 'listen' for this target.\n *\n * These targets may or may not have been sent to or acknowledged by the\n * server. On re-establishing the listen stream, these targets should be sent\n * to the server. The targets removed with unlistens are removed eagerly\n * without waiting for confirmation from the listen stream.\n */\n this.$r = new Map(),\n /**\n * A set of reasons for why the RemoteStore may be offline. If empty, the\n * RemoteStore may start its network connections.\n */\n this.Or = new Set(),\n /**\n * Event handlers that get called when the network is disabled or enabled.\n *\n * PORTING NOTE: These functions are used on the Web client to create the\n * underlying streams (to support tree-shakeable streams). On Android and iOS,\n * the streams are created during construction of RemoteStore.\n */\n this.Mr = [], this.Lr = s, this.Lr.di(function (t) {\n i.enqueueAndForget(function () {\n return n(u, void 0, void 0, function () {\n return r(this, function (t) {\n switch (t.label) {\n case 0:\n return zo(this) ? (C(\"RemoteStore\", \"Restarting streams for network reachability change.\"), [4\n /*yield*/\n , function (t) {\n return n(this, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return (e = F(t)).Or.add(4\n /* ConnectivityChange */\n ), [4\n /*yield*/\n , qo(e)];\n\n case 1:\n return n.sent(), e.Br.set(\"Unknown\"\n /* Unknown */\n ), e.Or.delete(4\n /* ConnectivityChange */\n ), [4\n /*yield*/\n , Vo(e)];\n\n case 2:\n return n.sent(), [2\n /*return*/\n ];\n }\n });\n });\n }(this)]) : [3\n /*break*/\n , 2];\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n return [2\n /*return*/\n ];\n }\n });\n });\n });\n }), this.Br = new Fo(i, o);\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/**\n * A PersistentStream is an abstract base class that represents a streaming RPC\n * to the Firestore backend. It's built on top of the connections own support\n * for streaming RPCs, and adds several critical features for our clients:\n *\n * - Exponential backoff on failure\n * - Authentication via CredentialsProvider\n * - Dispatching all callbacks into the shared worker queue\n * - Closing idle streams after 60 seconds of inactivity\n *\n * Subclasses of PersistentStream implement serialization of models to and\n * from the JSON representation of the protocol buffers for a specific\n * streaming RPC.\n *\n * ## Starting and Stopping\n *\n * Streaming RPCs are stateful and need to be start()ed before messages can\n * be sent and received. The PersistentStream will call the onOpen() function\n * of the listener once the stream is ready to accept requests.\n *\n * Should a start() fail, PersistentStream will call the registered onClose()\n * listener with a FirestoreError indicating what went wrong.\n *\n * A PersistentStream can be started and stopped repeatedly.\n *\n * Generic types:\n * SendType: The type of the outgoing message of the underlying\n * connection stream\n * ReceiveType: The type of the incoming message of the underlying\n * connection stream\n * ListenerType: The type of the listener that will be used for callbacks\n */\n\n\nfunction Vo(t) {\n return n(this, void 0, void 0, function () {\n var e, n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n if (!zo(t)) return [3\n /*break*/\n , 4];\n e = 0, n = t.Mr, r.label = 1;\n\n case 1:\n return e < n.length ? [4\n /*yield*/\n , (0, n[e])(\n /* enabled= */\n !0)] : [3\n /*break*/\n , 4];\n\n case 2:\n r.sent(), r.label = 3;\n\n case 3:\n return e++, [3\n /*break*/\n , 1];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Temporarily disables the network. The network can be re-enabled using\n * enableNetwork().\n */\n\n\nfunction qo(t) {\n return n(this, void 0, void 0, function () {\n var e, n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n e = 0, n = t.Mr, r.label = 1;\n\n case 1:\n return e < n.length ? [4\n /*yield*/\n , (0, n[e])(\n /* enabled= */\n !1)] : [3\n /*break*/\n , 4];\n\n case 2:\n r.sent(), r.label = 3;\n\n case 3:\n return e++, [3\n /*break*/\n , 1];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Starts new listen for the given target. Uses resume token if provided. It\n * is a no-op if the target of given `TargetData` is already being listened to.\n */\n\n\nfunction Uo(t, e) {\n var n = F(t);\n n.$r.has(e.targetId) || ( // Mark this as something the client is currently listening for.\n n.$r.set(e.targetId, e), Go(n) ? // The listen will be sent in onWatchStreamOpen\n Qo(n) : us(n).er() && jo(n, e));\n}\n/**\n * Removes the listen from server. It is a no-op if the given target id is\n * not being listened to.\n */\n\n\nfunction Bo(t, e) {\n var n = F(t),\n r = us(n);\n n.$r.delete(e), r.er() && Ko(n, e), 0 === n.$r.size && (r.er() ? r.ir() : zo(n) && // Revert to OnlineState.Unknown if the watch stream is not open and we\n // have no listeners, since without any listens to send we cannot\n // confirm if the stream is healthy and upgrade to OnlineState.Online.\n n.Br.set(\"Unknown\"\n /* Unknown */\n ));\n}\n/**\n * We need to increment the the expected number of pending responses we're due\n * from watch so we wait for the ack to process any messages from this target.\n */\n\n\nfunction jo(t, e) {\n t.qr.U(e.targetId), us(t).mr(e)\n /**\n * We need to increment the expected number of pending responses we're due\n * from watch so we wait for the removal on the server before we process any\n * messages from this target.\n */\n ;\n}\n\nfunction Ko(t, e) {\n t.qr.U(e), us(t).yr(e);\n}\n\nfunction Qo(t) {\n t.qr = new yn({\n getRemoteKeysForTarget: function getRemoteKeysForTarget(e) {\n return t.remoteSyncer.getRemoteKeysForTarget(e);\n },\n lt: function lt(e) {\n return t.$r.get(e) || null;\n }\n }), us(t).start(), t.Br.Sr()\n /**\n * Returns whether the watch stream should be started because it's necessary\n * and has not yet been started.\n */\n ;\n}\n\nfunction Go(t) {\n return zo(t) && !us(t).tr() && t.$r.size > 0;\n}\n\nfunction zo(t) {\n return 0 === F(t).Or.size;\n}\n\nfunction Wo(t) {\n t.qr = void 0;\n}\n\nfunction Ho(t) {\n return n(this, void 0, void 0, function () {\n return r(this, function (e) {\n return t.$r.forEach(function (e, n) {\n jo(t, e);\n }), [2\n /*return*/\n ];\n });\n });\n}\n\nfunction Yo(t, e) {\n return n(this, void 0, void 0, function () {\n return r(this, function (n) {\n return Wo(t), // If we still need the watch stream, retry the connection.\n Go(t) ? (t.Br.Nr(e), Qo(t)) : // No need to restart watch stream because there are no active targets.\n // The online state is set to unknown because there is no active attempt\n // at establishing a connection\n t.Br.set(\"Unknown\"\n /* Unknown */\n ), [2\n /*return*/\n ];\n });\n });\n}\n\nfunction $o(t, e, i) {\n return n(this, void 0, void 0, function () {\n var o, s, u;\n return r(this, function (a) {\n switch (a.label) {\n case 0:\n if (t.Br.set(\"Online\"\n /* Online */\n ), !(e instanceof dn && 2\n /* Removed */\n === e.state && e.cause)) // Mark the client as online since we got a message from the server\n return [3\n /*break*/\n , 6];\n a.label = 1;\n\n case 1:\n return a.trys.push([1, 3,, 5]), [4\n /*yield*/\n ,\n /** Handles an error on a target */\n function (t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n n = e.cause, i = 0, o = e.targetIds, r.label = 1;\n\n case 1:\n return i < o.length ? (s = o[i], t.$r.has(s) ? [4\n /*yield*/\n , t.remoteSyncer.rejectListen(s, n)] : [3\n /*break*/\n , 3]) : [3\n /*break*/\n , 5];\n\n case 2:\n r.sent(), t.$r.delete(s), t.qr.removeTarget(s), r.label = 3;\n\n case 3:\n r.label = 4;\n\n case 4:\n return i++, [3\n /*break*/\n , 1];\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n });\n }(t, e)];\n\n case 2:\n return a.sent(), [3\n /*break*/\n , 5];\n\n case 3:\n return o = a.sent(), C(\"RemoteStore\", \"Failed to remove targets %s: %s \", e.targetIds.join(\",\"), o), [4\n /*yield*/\n , Xo(t, o)];\n\n case 4:\n return a.sent(), [3\n /*break*/\n , 5];\n\n case 5:\n return [3\n /*break*/\n , 13];\n\n case 6:\n if (e instanceof fn ? t.qr.X(e) : e instanceof ln ? t.qr.rt(e) : t.qr.et(e), i.isEqual(K.min())) return [3\n /*break*/\n , 13];\n a.label = 7;\n\n case 7:\n return a.trys.push([7, 11,, 13]), [4\n /*yield*/\n , Ki(t.localStore)];\n\n case 8:\n return s = a.sent(), i.compareTo(s) >= 0 ? [4\n /*yield*/\n ,\n /**\n * Takes a batch of changes from the Datastore, repackages them as a\n * RemoteEvent, and passes that on to the listener, which is typically the\n * SyncEngine.\n */\n function (t, e) {\n var n = t.qr.ut(e); // Update in-memory resume tokens. LocalStore will update the\n // persistent view of these when applying the completed RemoteEvent.\n\n return n.targetChanges.forEach(function (n, r) {\n if (n.resumeToken.approximateByteSize() > 0) {\n var i = t.$r.get(r); // A watched target might have been removed already.\n\n i && t.$r.set(r, i.withResumeToken(n.resumeToken, e));\n }\n }), // Re-establish listens for the targets that have been invalidated by\n // existence filter mismatches.\n n.targetMismatches.forEach(function (e) {\n var n = t.$r.get(e);\n\n if (n) {\n // Clear the resume token for the target, since we're in a known mismatch\n // state.\n t.$r.set(e, n.withResumeToken(J.EMPTY_BYTE_STRING, n.snapshotVersion)), // Cause a hard reset by unwatching and rewatching immediately, but\n // deliberately don't send a resume token so that we get a full update.\n Ko(t, e); // Mark the target we send as being on behalf of an existence filter\n // mismatch, but don't actually retain that in listenTargets. This ensures\n // that we flag the first re-listen this way without impacting future\n // listens of this target (that might happen e.g. on reconnect).\n\n var r = new Pr(n.target, e, 1\n /* ExistenceFilterMismatch */\n , n.sequenceNumber);\n jo(t, r);\n }\n }), t.remoteSyncer.applyRemoteEvent(n);\n }(t, i)] : [3\n /*break*/\n , 10];\n // We have received a target change with a global snapshot if the snapshot\n // version is not equal to SnapshotVersion.min().\n\n case 9:\n // We have received a target change with a global snapshot if the snapshot\n // version is not equal to SnapshotVersion.min().\n a.sent(), a.label = 10;\n\n case 10:\n return [3\n /*break*/\n , 13];\n\n case 11:\n return C(\"RemoteStore\", \"Failed to raise snapshot:\", u = a.sent()), [4\n /*yield*/\n , Xo(t, u)];\n\n case 12:\n return a.sent(), [3\n /*break*/\n , 13];\n\n case 13:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Recovery logic for IndexedDB errors that takes the network offline until\n * `op` succeeds. Retries are scheduled with backoff using\n * `enqueueRetryable()`. If `op()` is not provided, IndexedDB access is\n * validated via a generic operation.\n *\n * The returned Promise is resolved once the network is disabled and before\n * any retry attempt.\n */\n\n\nfunction Xo(t, e, i) {\n return n(this, void 0, void 0, function () {\n var o = this;\n return r(this, function (s) {\n switch (s.label) {\n case 0:\n if (!Nr(e)) throw e; // Disable network and raise offline snapshots\n\n return t.Or.add(1\n /* IndexedDbFailed */\n ), [4\n /*yield*/\n , qo(t)];\n\n case 1:\n // Disable network and raise offline snapshots\n return s.sent(), t.Br.set(\"Offline\"\n /* Offline */\n ), i || ( // Use a simple read operation to determine if IndexedDB recovered.\n // Ideally, we would expose a health check directly on SimpleDb, but\n // RemoteStore only has access to persistence through LocalStore.\n i = function i() {\n return Ki(t.localStore);\n }), // Probe IndexedDB periodically and re-enable network\n t.asyncQueue.enqueueRetryable(function () {\n return n(o, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return C(\"RemoteStore\", \"Retrying IndexedDB access\"), [4\n /*yield*/\n , i()];\n\n case 1:\n return e.sent(), t.Or.delete(1\n /* IndexedDbFailed */\n ), [4\n /*yield*/\n , Vo(t)];\n\n case 2:\n return e.sent(), [2\n /*return*/\n ];\n }\n });\n });\n }), [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Executes `op`. If `op` fails, takes the network offline until `op`\n * succeeds. Returns after the first attempt.\n */\n\n\nfunction Jo(t, e) {\n return e().catch(function (n) {\n return Xo(t, n, e);\n });\n}\n\nfunction Zo(t) {\n return n(this, void 0, void 0, function () {\n var e, n, i, o, s;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n e = F(t), n = as(e), i = e.Fr.length > 0 ? e.Fr[e.Fr.length - 1].batchId : -1, r.label = 1;\n\n case 1:\n if (!\n /**\n * Returns true if we can add to the write pipeline (i.e. the network is\n * enabled and the write pipeline is not full).\n */\n function (t) {\n return zo(t) && t.Fr.length < 10;\n }\n /**\n * Queues additional writes to be sent to the write stream, sending them\n * immediately if the write stream is established.\n */\n (e)) return [3\n /*break*/\n , 7];\n r.label = 2;\n\n case 2:\n return r.trys.push([2, 4,, 6]), [4\n /*yield*/\n , zi(e.localStore, i)];\n\n case 3:\n return null === (o = r.sent()) ? (0 === e.Fr.length && n.ir(), [3\n /*break*/\n , 7]) : (i = o.batchId, function (t, e) {\n t.Fr.push(e);\n var n = as(t);\n n.er() && n.pr && n.Er(e.mutations);\n }(e, o), [3\n /*break*/\n , 6]);\n\n case 4:\n return s = r.sent(), [4\n /*yield*/\n , Xo(e, s)];\n\n case 5:\n return r.sent(), [3\n /*break*/\n , 6];\n\n case 6:\n return [3\n /*break*/\n , 1];\n\n case 7:\n return ts(e) && es(e), [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction ts(t) {\n return zo(t) && !as(t).tr() && t.Fr.length > 0;\n}\n\nfunction es(t) {\n as(t).start();\n}\n\nfunction ns(t) {\n return n(this, void 0, void 0, function () {\n return r(this, function (e) {\n return as(t).Ar(), [2\n /*return*/\n ];\n });\n });\n}\n\nfunction rs(t) {\n return n(this, void 0, void 0, function () {\n var e, n, i, o;\n return r(this, function (r) {\n // Send the write pipeline now that the stream is established.\n for (e = as(t), n = 0, i = t.Fr; n < i.length; n++) {\n o = i[n], e.Er(o.mutations);\n }\n\n return [2\n /*return*/\n ];\n });\n });\n}\n\nfunction is(t, e, i) {\n return n(this, void 0, void 0, function () {\n var n, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = t.Fr.shift(), o = Or.from(n, e, i), [4\n /*yield*/\n , Jo(t, function () {\n return t.remoteSyncer.applySuccessfulWrite(o);\n })];\n\n case 1:\n // It's possible that with the completion of this mutation another\n // slot has freed up.\n return r.sent(), [4\n /*yield*/\n , Zo(t)];\n\n case 2:\n // It's possible that with the completion of this mutation another\n // slot has freed up.\n return r.sent(), [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction os(t, e) {\n return n(this, void 0, void 0, function () {\n return r(this, function (i) {\n switch (i.label) {\n case 0:\n return e && as(t).pr ? [4\n /*yield*/\n , function (t, e) {\n return n(this, void 0, void 0, function () {\n var n, i;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return Ge(i = e.code) && i !== N.ABORTED ? (n = t.Fr.shift(), // In this case it's also unlikely that the server itself is melting\n // down -- this was just a bad request so inhibit backoff on the next\n // restart.\n as(t).sr(), [4\n /*yield*/\n , Jo(t, function () {\n return t.remoteSyncer.rejectFailedWrite(n.batchId, e);\n })]) : [3\n /*break*/\n , 3];\n\n case 1:\n // It's possible that with the completion of this mutation\n // another slot has freed up.\n return r.sent(), [4\n /*yield*/\n , Zo(t)];\n\n case 2:\n // In this case it's also unlikely that the server itself is melting\n // down -- this was just a bad request so inhibit backoff on the next\n // restart.\n // It's possible that with the completion of this mutation\n // another slot has freed up.\n r.sent(), r.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n }(t, e)] : [3\n /*break*/\n , 2];\n // This error affects the actual write.\n\n case 1:\n // This error affects the actual write.\n i.sent(), i.label = 2;\n\n case 2:\n // If the write stream closed after the write handshake completes, a write\n // operation failed and we fail the pending operation.\n // The write stream might have been started by refilling the write\n // pipeline for failed writes\n return ts(t) && es(t), [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Toggles the network state when the client gains or loses its primary lease.\n */\n\n\nfunction ss(t, e) {\n return n(this, void 0, void 0, function () {\n var n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = F(t), e ? (n.Or.delete(2\n /* IsSecondary */\n ), [4\n /*yield*/\n , Vo(n)]) : [3\n /*break*/\n , 2];\n\n case 1:\n return r.sent(), [3\n /*break*/\n , 5];\n\n case 2:\n return e ? [3\n /*break*/\n , 4] : (n.Or.add(2\n /* IsSecondary */\n ), [4\n /*yield*/\n , qo(n)]);\n\n case 3:\n r.sent(), n.Br.set(\"Unknown\"\n /* Unknown */\n ), r.label = 4;\n\n case 4:\n r.label = 5;\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * If not yet initialized, registers the WatchStream and its network state\n * callback with `remoteStoreImpl`. Returns the existing stream if one is\n * already available.\n *\n * PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.\n * This is not done on Web to allow it to be tree-shaken.\n */\n\n\nfunction us(t) {\n var e = this;\n return t.Ur || ( // Create stream (but note that it is not started yet).\n t.Ur = function (t, e, n) {\n var r = F(t);\n return r.br(), new Lo(e, r.Hi, r.credentials, r.R, n);\n }(t.datastore, t.asyncQueue, {\n Ii: Ho.bind(null, t),\n Ri: Yo.bind(null, t),\n _r: $o.bind(null, t)\n }), t.Mr.push(function (i) {\n return n(e, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return i ? (t.Ur.sr(), Go(t) ? Qo(t) : t.Br.set(\"Unknown\"\n /* Unknown */\n ), [3\n /*break*/\n , 3]) : [3\n /*break*/\n , 1];\n\n case 1:\n return [4\n /*yield*/\n , t.Ur.stop()];\n\n case 2:\n e.sent(), Wo(t), e.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n })), t.Ur\n /**\n * If not yet initialized, registers the WriteStream and its network state\n * callback with `remoteStoreImpl`. Returns the existing stream if one is\n * already available.\n *\n * PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup.\n * This is not done on Web to allow it to be tree-shaken.\n */\n ;\n}\n\nfunction as(t) {\n var e = this;\n return t.Kr || ( // Create stream (but note that it is not started yet).\n t.Kr = function (t, e, n) {\n var r = F(t);\n return r.br(), new Oo(e, r.Hi, r.credentials, r.R, n);\n }(t.datastore, t.asyncQueue, {\n Ii: ns.bind(null, t),\n Ri: os.bind(null, t),\n Ir: rs.bind(null, t),\n Tr: is.bind(null, t)\n }), t.Mr.push(function (i) {\n return n(e, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return i ? (t.Kr.sr(), [4\n /*yield*/\n , Zo(t)]) : [3\n /*break*/\n , 2];\n\n case 1:\n // This will start the write stream if necessary.\n return e.sent(), [3\n /*break*/\n , 4];\n\n case 2:\n return [4\n /*yield*/\n , t.Kr.stop()];\n\n case 3:\n e.sent(), t.Fr.length > 0 && (C(\"RemoteStore\", \"Stopping write stream with \" + t.Fr.length + \" pending writes\"), t.Fr = []), e.label = 4;\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n })), t.Kr\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 * Represents an operation scheduled to be run in the future on an AsyncQueue.\n *\n * It is created via DelayedOperation.createAndSchedule().\n *\n * Supports cancellation (via cancel()) and early execution (via skipDelay()).\n *\n * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type\n * in newer versions of TypeScript defines `finally`, which is not available in\n * IE.\n */\n ;\n}\n\nvar cs =\n/** @class */\nfunction () {\n function t(t, e, n, r, i) {\n this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = i, this.deferred = new br(), this.then = this.deferred.promise.then.bind(this.deferred.promise), // It's normal for the deferred promise to be canceled (due to cancellation)\n // and so we attach a dummy catch callback to avoid\n // 'UnhandledPromiseRejectionWarning' log spam.\n this.deferred.promise.catch(function (t) {})\n /**\n * Creates and returns a DelayedOperation that has been scheduled to be\n * executed on the provided asyncQueue after the provided delayMs.\n *\n * @param asyncQueue - The queue to schedule the operation on.\n * @param id - A Timer ID identifying the type of operation this is.\n * @param delayMs - The delay (ms) before the operation should be scheduled.\n * @param op - The operation to run.\n * @param removalCallback - A callback to be called synchronously once the\n * operation is executed or canceled, notifying the AsyncQueue to remove it\n * from its delayedOperations list.\n * PORTING NOTE: This exists to prevent making removeDelayedOperation() and\n * the DelayedOperation class public.\n */\n ;\n }\n\n return t.createAndSchedule = function (e, n, r, i, o) {\n var s = new t(e, n, Date.now() + r, i, o);\n return s.start(r), s;\n },\n /**\n * Starts the timer. This is called immediately after construction by\n * createAndSchedule().\n */\n t.prototype.start = function (t) {\n var e = this;\n this.timerHandle = setTimeout(function () {\n return e.handleDelayElapsed();\n }, t);\n },\n /**\n * Queues the operation to run immediately (if it hasn't already been run or\n * canceled).\n */\n t.prototype.skipDelay = function () {\n return this.handleDelayElapsed();\n },\n /**\n * Cancels the operation if it hasn't already been executed or canceled. The\n * promise will be rejected.\n *\n * As long as the operation has not yet been run, calling cancel() provides a\n * guarantee that the operation will not be run.\n */\n t.prototype.cancel = function (t) {\n null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new D(N.CANCELLED, \"Operation cancelled\" + (t ? \": \" + t : \"\"))));\n }, t.prototype.handleDelayElapsed = function () {\n var t = this;\n this.asyncQueue.enqueueAndForget(function () {\n return null !== t.timerHandle ? (t.clearTimeout(), t.op().then(function (e) {\n return t.deferred.resolve(e);\n })) : Promise.resolve();\n });\n }, t.prototype.clearTimeout = function () {\n null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle), this.timerHandle = null);\n }, t;\n}();\n/**\n * Returns a FirestoreError that can be surfaced to the user if the provided\n * error is an IndexedDbTransactionError. Re-throws the error otherwise.\n */\n\n\nfunction hs(t, e) {\n if (x(\"AsyncQueue\", e + \": \" + t), Nr(t)) return new D(N.UNAVAILABLE, e + \": \" + t);\n throw t;\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/**\n * DocumentSet is an immutable (copy-on-write) collection that holds documents\n * in order specified by the provided comparator. We always add a document key\n * comparator on top of what is provided to guarantee document equality based on\n * the key.\n */\n\n\nvar fs =\n/** @class */\nfunction () {\n /** The default ordering is by key if the comparator is omitted */\n function t(t) {\n // We are adding document key comparator to the end as it's the only\n // guaranteed unique property of a document.\n this.comparator = t ? function (e, n) {\n return t(e, n) || ct.comparator(e.key, n.key);\n } : function (t, e) {\n return ct.comparator(t.key, e.key);\n }, this.keyedMap = en(), this.sortedSet = new We(this.comparator)\n /**\n * Returns an empty copy of the existing DocumentSet, using the same\n * comparator.\n */\n ;\n }\n\n return t.emptySet = function (e) {\n return new t(e.comparator);\n }, t.prototype.has = function (t) {\n return null != this.keyedMap.get(t);\n }, t.prototype.get = function (t) {\n return this.keyedMap.get(t);\n }, t.prototype.first = function () {\n return this.sortedSet.minKey();\n }, t.prototype.last = function () {\n return this.sortedSet.maxKey();\n }, t.prototype.isEmpty = function () {\n return this.sortedSet.isEmpty();\n },\n /**\n * Returns the index of the provided key in the document set, or -1 if the\n * document key is not present in the set;\n */\n t.prototype.indexOf = function (t) {\n var e = this.keyedMap.get(t);\n return e ? this.sortedSet.indexOf(e) : -1;\n }, Object.defineProperty(t.prototype, \"size\", {\n get: function get() {\n return this.sortedSet.size;\n },\n enumerable: !1,\n configurable: !0\n }),\n /** Iterates documents in order defined by \"comparator\" */\n t.prototype.forEach = function (t) {\n this.sortedSet.inorderTraversal(function (e, n) {\n return t(e), !1;\n });\n },\n /** Inserts or updates a document with the same key */\n t.prototype.add = function (t) {\n // First remove the element if we have it.\n var e = this.delete(t.key);\n return e.copy(e.keyedMap.insert(t.key, t), e.sortedSet.insert(t, null));\n },\n /** Deletes a document with a given key */\n t.prototype.delete = function (t) {\n var e = this.get(t);\n return e ? this.copy(this.keyedMap.remove(t), this.sortedSet.remove(e)) : this;\n }, t.prototype.isEqual = function (e) {\n if (!(e instanceof t)) return !1;\n if (this.size !== e.size) return !1;\n\n for (var n = this.sortedSet.getIterator(), r = e.sortedSet.getIterator(); n.hasNext();) {\n var i = n.getNext().key,\n o = r.getNext().key;\n if (!i.isEqual(o)) return !1;\n }\n\n return !0;\n }, t.prototype.toString = function () {\n var t = [];\n return this.forEach(function (e) {\n t.push(e.toString());\n }), 0 === t.length ? \"DocumentSet ()\" : \"DocumentSet (\\n \" + t.join(\" \\n\") + \"\\n)\";\n }, t.prototype.copy = function (e, n) {\n var r = new t();\n return r.comparator = this.comparator, r.keyedMap = e, r.sortedSet = n, r;\n }, t;\n}(),\n ls =\n/** @class */\nfunction () {\n function t() {\n this.Qr = new We(ct.comparator);\n }\n\n return t.prototype.track = function (t) {\n var e = t.doc.key,\n n = this.Qr.get(e);\n n ? // Merge the new change with the existing change.\n 0\n /* Added */\n !== t.type && 3\n /* Metadata */\n === n.type ? this.Qr = this.Qr.insert(e, t) : 3\n /* Metadata */\n === t.type && 1\n /* Removed */\n !== n.type ? this.Qr = this.Qr.insert(e, {\n type: n.type,\n doc: t.doc\n }) : 2\n /* Modified */\n === t.type && 2\n /* Modified */\n === n.type ? this.Qr = this.Qr.insert(e, {\n type: 2\n /* Modified */\n ,\n doc: t.doc\n }) : 2\n /* Modified */\n === t.type && 0\n /* Added */\n === n.type ? this.Qr = this.Qr.insert(e, {\n type: 0\n /* Added */\n ,\n doc: t.doc\n }) : 1\n /* Removed */\n === t.type && 0\n /* Added */\n === n.type ? this.Qr = this.Qr.remove(e) : 1\n /* Removed */\n === t.type && 2\n /* Modified */\n === n.type ? this.Qr = this.Qr.insert(e, {\n type: 1\n /* Removed */\n ,\n doc: n.doc\n }) : 0\n /* Added */\n === t.type && 1\n /* Removed */\n === n.type ? this.Qr = this.Qr.insert(e, {\n type: 2\n /* Modified */\n ,\n doc: t.doc\n }) : // This includes these cases, which don't make sense:\n // Added->Added\n // Removed->Removed\n // Modified->Added\n // Removed->Modified\n // Metadata->Added\n // Removed->Metadata\n O() : this.Qr = this.Qr.insert(e, t);\n }, t.prototype.jr = function () {\n var t = [];\n return this.Qr.inorderTraversal(function (e, n) {\n t.push(n);\n }), t;\n }, t;\n}(),\n ds =\n/** @class */\nfunction () {\n function t(t, e, n, r, i, o, s, u) {\n this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = r, this.mutatedKeys = i, this.fromCache = o, this.syncStateChanged = s, this.excludesMetadataChanges = u\n /** Returns a view snapshot as if all documents in the snapshot were added. */\n ;\n }\n\n return t.fromInitialDocuments = function (e, n, r, i) {\n var o = [];\n return n.forEach(function (t) {\n o.push({\n type: 0\n /* Added */\n ,\n doc: t\n });\n }), new t(e, n, fs.emptySet(n), o, r, i,\n /* syncStateChanged= */\n !0,\n /* excludesMetadataChanges= */\n !1);\n }, Object.defineProperty(t.prototype, \"hasPendingWrites\", {\n get: function get() {\n return !this.mutatedKeys.isEmpty();\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function (t) {\n if (!(this.fromCache === t.fromCache && this.syncStateChanged === t.syncStateChanged && this.mutatedKeys.isEqual(t.mutatedKeys) && ie(this.query, t.query) && this.docs.isEqual(t.docs) && this.oldDocs.isEqual(t.oldDocs))) return !1;\n var e = this.docChanges,\n n = t.docChanges;\n if (e.length !== n.length) return !1;\n\n for (var r = 0; r < e.length; r++) {\n if (e[r].type !== n[r].type || !e[r].doc.isEqual(n[r].doc)) return !1;\n }\n\n return !0;\n }, t;\n}(),\n ps = function ps() {\n this.Wr = void 0, this.listeners = [];\n},\n ys = function ys() {\n this.queries = new Ii(function (t) {\n return oe(t);\n }, ie), this.onlineState = \"Unknown\"\n /* Unknown */\n , this.Gr = new Set();\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/**\n * DocumentChangeSet keeps track of a set of changes to docs in a query, merging\n * duplicate events for the same doc.\n */\n\n\nfunction vs(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s, u, a, c;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n if (n = F(t), i = e.query, o = !1, (s = n.queries.get(i)) || (o = !0, s = new ps()), !o) return [3\n /*break*/\n , 4];\n r.label = 1;\n\n case 1:\n return r.trys.push([1, 3,, 4]), u = s, [4\n /*yield*/\n , n.onListen(i)];\n\n case 2:\n return u.Wr = r.sent(), [3\n /*break*/\n , 4];\n\n case 3:\n return a = r.sent(), c = hs(a, \"Initialization of query '\" + se(e.query) + \"' failed\"), [2\n /*return*/\n , void e.onError(c)];\n\n case 4:\n return n.queries.set(i, s), s.listeners.push(e), // Run global snapshot listeners if a consistent snapshot has been emitted.\n e.zr(n.onlineState), s.Wr && e.Hr(s.Wr) && bs(n), [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction ms(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s, u;\n return r(this, function (r) {\n return n = F(t), i = e.query, o = !1, (s = n.queries.get(i)) && (u = s.listeners.indexOf(e)) >= 0 && (s.listeners.splice(u, 1), o = 0 === s.listeners.length), o ? [2\n /*return*/\n , (n.queries.delete(i), n.onUnlisten(i))] : [2\n /*return*/\n ];\n });\n });\n}\n\nfunction gs(t, e) {\n for (var n = F(t), r = !1, i = 0, o = e; i < o.length; i++) {\n var s = o[i],\n u = s.query,\n a = n.queries.get(u);\n\n if (a) {\n for (var c = 0, h = a.listeners; c < h.length; c++) {\n h[c].Hr(s) && (r = !0);\n }\n\n a.Wr = s;\n }\n }\n\n r && bs(n);\n}\n\nfunction ws(t, e, n) {\n var r = F(t),\n i = r.queries.get(e);\n if (i) for (var o = 0, s = i.listeners; o < s.length; o++) {\n s[o].onError(n);\n } // Remove all listeners. NOTE: We don't need to call syncEngine.unlisten()\n // after an error.\n\n r.queries.delete(e);\n} // Call all global snapshot listeners that have been set.\n\n\nfunction bs(t) {\n t.Gr.forEach(function (t) {\n t.next();\n });\n}\n/**\n * QueryListener takes a series of internal view snapshots and determines\n * when to raise the event.\n *\n * It uses an Observer to dispatch events.\n */\n\n\nvar Is =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this.query = t, this.Jr = e,\n /**\n * Initial snapshots (e.g. from cache) may not be propagated to the wrapped\n * observer. This flag is set to true once we've actually raised an event.\n */\n this.Yr = !1, this.Xr = null, this.onlineState = \"Unknown\"\n /* Unknown */\n , this.options = n || {}\n /**\n * Applies the new ViewSnapshot to this listener, raising a user-facing event\n * if applicable (depending on what changed, whether the user has opted into\n * metadata-only changes, etc.). Returns true if a user-facing event was\n * indeed raised.\n */\n ;\n }\n\n return t.prototype.Hr = function (t) {\n if (!this.options.includeMetadataChanges) {\n for ( // Remove the metadata only changes.\n var e = [], n = 0, r = t.docChanges; n < r.length; n++) {\n var i = r[n];\n 3\n /* Metadata */\n !== i.type && e.push(i);\n }\n\n t = new ds(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged,\n /* excludesMetadataChanges= */\n !0);\n }\n\n var o = !1;\n return this.Yr ? this.Zr(t) && (this.Jr.next(t), o = !0) : this.eo(t, this.onlineState) && (this.no(t), o = !0), this.Xr = t, o;\n }, t.prototype.onError = function (t) {\n this.Jr.error(t);\n },\n /** Returns whether a snapshot was raised. */\n t.prototype.zr = function (t) {\n this.onlineState = t;\n var e = !1;\n return this.Xr && !this.Yr && this.eo(this.Xr, t) && (this.no(this.Xr), e = !0), e;\n }, t.prototype.eo = function (t, e) {\n // Always raise the first event when we're synced\n if (!t.fromCache) return !0; // NOTE: We consider OnlineState.Unknown as online (it should become Offline\n // or Online if we wait long enough).\n\n var n = \"Offline\"\n /* Offline */\n !== e; // Don't raise the event if we're online, aren't synced yet (checked\n // above) and are waiting for a sync.\n\n return !(this.options.so && n || t.docs.isEmpty() && \"Offline\"\n /* Offline */\n !== e); // Raise data from cache if we have any documents or we are offline\n }, t.prototype.Zr = function (t) {\n // We don't need to handle includeDocumentMetadataChanges here because\n // the Metadata only changes have already been stripped out if needed.\n // At this point the only changes we will see are the ones we should\n // propagate.\n if (t.docChanges.length > 0) return !0;\n var e = this.Xr && this.Xr.hasPendingWrites !== t.hasPendingWrites;\n return !(!t.syncStateChanged && !e) && !0 === this.options.includeMetadataChanges; // Generally we should have hit one of the cases above, but it's possible\n // to get here if there were only metadata docChanges and they got\n // stripped out.\n }, t.prototype.no = function (t) {\n t = ds.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.Yr = !0, this.Jr.next(t);\n }, t;\n}(),\n Ts =\n/** @class */\nfunction () {\n function t(t, // How many bytes this element takes to store in the bundle.\n e) {\n this.payload = t, this.byteLength = e;\n }\n\n return t.prototype.io = function () {\n return \"metadata\" in this.payload;\n }, t;\n}(),\n Es =\n/** @class */\nfunction () {\n function t(t) {\n this.R = t;\n }\n\n return t.prototype.qn = function (t) {\n return An(this.R, t);\n },\n /**\n * Converts a BundleDocument to a MutableDocument.\n */\n t.prototype.Un = function (t) {\n return t.metadata.exists ? On(this.R, t.document, !1) : Nt.newNoDocument(this.qn(t.metadata.name), this.Kn(t.metadata.readTime));\n }, t.prototype.Kn = function (t) {\n return _n(t);\n }, t;\n}(),\n _s =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this.ro = t, this.localStore = e, this.R = n,\n /** Batched queries to be saved into storage */\n this.queries = [],\n /** Batched documents to be saved into storage */\n this.documents = [], this.progress = Ss(t)\n /**\n * Adds an element from the bundle to the loader.\n *\n * Returns a new progress if adding the element leads to a new progress,\n * otherwise returns null.\n */\n ;\n }\n\n return t.prototype.oo = function (t) {\n this.progress.bytesLoaded += t.byteLength;\n var e = this.progress.documentsLoaded;\n return t.payload.namedQuery ? this.queries.push(t.payload.namedQuery) : t.payload.documentMetadata ? (this.documents.push({\n metadata: t.payload.documentMetadata\n }), t.payload.documentMetadata.exists || ++e) : t.payload.document && (this.documents[this.documents.length - 1].document = t.payload.document, ++e), e !== this.progress.documentsLoaded ? (this.progress.documentsLoaded = e, Object.assign({}, this.progress)) : null;\n }, t.prototype.co = function (t) {\n for (var e = new Map(), n = new Es(this.R), r = 0, i = t; r < i.length; r++) {\n var o = i[r];\n if (o.metadata.queries) for (var s = n.qn(o.metadata.name), u = 0, a = o.metadata.queries; u < a.length; u++) {\n var c = a[u],\n h = (e.get(c) || sn()).add(s);\n e.set(c, h);\n }\n }\n\n return e;\n },\n /**\n * Update the progress to 'Success' and return the updated progress.\n */\n t.prototype.complete = function () {\n return n(this, void 0, void 0, function () {\n var t, e, n, i, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , Zi(this.localStore, new Es(this.R), this.documents, this.ro.id)];\n\n case 1:\n t = r.sent(), e = this.co(this.documents), n = 0, i = this.queries, r.label = 2;\n\n case 2:\n return n < i.length ? (o = i[n], [4\n /*yield*/\n , to(this.localStore, o, e.get(o.name))]) : [3\n /*break*/\n , 5];\n\n case 3:\n r.sent(), r.label = 4;\n\n case 4:\n return n++, [3\n /*break*/\n , 2];\n\n case 5:\n return [2\n /*return*/\n , (this.progress.taskState = \"Success\", new Pi(Object.assign({}, this.progress), t))];\n }\n });\n });\n }, t;\n}();\n/**\n * @license\n * Copyright 2020 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 * A complete element in the bundle stream, together with the byte length it\n * occupies in the stream.\n */\n\n/**\n * Returns a `LoadBundleTaskProgress` representing the initial progress of\n * loading a bundle.\n */\n\n\nfunction Ss(t) {\n return {\n taskState: \"Running\",\n documentsLoaded: 0,\n bytesLoaded: 0,\n totalDocuments: t.totalDocuments,\n totalBytes: t.totalBytes\n };\n}\n/**\n * Returns a `LoadBundleTaskProgress` representing the progress that the loading\n * has succeeded.\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\nvar Ns = function Ns(t) {\n this.key = t;\n},\n Ds = function Ds(t) {\n this.key = t;\n},\n As =\n/** @class */\nfunction () {\n function t(t,\n /** Documents included in the remote target */\n e) {\n this.query = t, this.uo = e, this.ao = null,\n /**\n * A flag whether the view is current with the backend. A view is considered\n * current after it has seen the current flag from the backend and did not\n * lose consistency within the watch stream (e.g. because of an existence\n * filter mismatch).\n */\n this.current = !1,\n /** Documents in the view but not in the remote target */\n this.ho = sn(),\n /** Document Keys that have local changes */\n this.mutatedKeys = sn(), this.lo = ae(t), this.fo = new fs(this.lo);\n }\n\n return Object.defineProperty(t.prototype, \"wo\", {\n /**\n * The set of remote documents that the server has told us belongs to the target associated with\n * this view.\n */\n get: function get() {\n return this.uo;\n },\n enumerable: !1,\n configurable: !0\n }),\n /**\n * Iterates over a set of doc changes, applies the query limit, and computes\n * what the new results should be, what the changes were, and whether we may\n * need to go back to the local cache for more results. Does not make any\n * changes to the view.\n * @param docChanges - The doc changes to apply to this view.\n * @param previousChanges - If this is being called with a refill, then start\n * with this set of docs and changes instead of the current view.\n * @returns a new set of docs, changes, and refill flag.\n */\n t.prototype._o = function (t, e) {\n var n = this,\n r = e ? e.mo : new ls(),\n i = e ? e.fo : this.fo,\n o = e ? e.mutatedKeys : this.mutatedKeys,\n s = i,\n u = !1,\n a = $t(this.query) && i.size === this.query.limit ? i.last() : null,\n c = Xt(this.query) && i.size === this.query.limit ? i.first() : null; // Drop documents out to meet limit/limitToLast requirement.\n\n if (t.inorderTraversal(function (t, e) {\n var h = i.get(t),\n f = ue(n.query, e) ? e : null,\n l = !!h && n.mutatedKeys.has(h.key),\n d = !!f && (f.hasLocalMutations || // We only consider committed mutations for documents that were\n // mutated during the lifetime of the view.\n n.mutatedKeys.has(f.key) && f.hasCommittedMutations),\n p = !1; // Calculate change\n\n h && f ? h.data.isEqual(f.data) ? l !== d && (r.track({\n type: 3\n /* Metadata */\n ,\n doc: f\n }), p = !0) : n.yo(h, f) || (r.track({\n type: 2\n /* Modified */\n ,\n doc: f\n }), p = !0, (a && n.lo(f, a) > 0 || c && n.lo(f, c) < 0) && ( // This doc moved from inside the limit to outside the limit.\n // That means there may be some other doc in the local cache\n // that should be included instead.\n u = !0)) : !h && f ? (r.track({\n type: 0\n /* Added */\n ,\n doc: f\n }), p = !0) : h && !f && (r.track({\n type: 1\n /* Removed */\n ,\n doc: h\n }), p = !0, (a || c) && ( // A doc was removed from a full limit query. We'll need to\n // requery from the local cache to see if we know about some other\n // doc that should be in the results.\n u = !0)), p && (f ? (s = s.add(f), o = d ? o.add(t) : o.delete(t)) : (s = s.delete(t), o = o.delete(t)));\n }), $t(this.query) || Xt(this.query)) for (; s.size > this.query.limit;) {\n var h = $t(this.query) ? s.last() : s.first();\n s = s.delete(h.key), o = o.delete(h.key), r.track({\n type: 1\n /* Removed */\n ,\n doc: h\n });\n }\n return {\n fo: s,\n mo: r,\n Nn: u,\n mutatedKeys: o\n };\n }, t.prototype.yo = function (t, e) {\n // We suppress the initial change event for documents that were modified as\n // part of a write acknowledgment (e.g. when the value of a server transform\n // is applied) as Watch will send us the same document again.\n // By suppressing the event, we only raise two user visible events (one with\n // `hasPendingWrites` and the final state of the document) instead of three\n // (one with `hasPendingWrites`, the modified document with\n // `hasPendingWrites` and the final state of the document).\n return t.hasLocalMutations && e.hasCommittedMutations && !e.hasLocalMutations;\n },\n /**\n * Updates the view with the given ViewDocumentChanges and optionally updates\n * limbo docs and sync state from the provided target change.\n * @param docChanges - The set of changes to make to the view's docs.\n * @param updateLimboDocuments - Whether to update limbo documents based on\n * this change.\n * @param targetChange - A target change to apply for computing limbo docs and\n * sync state.\n * @returns A new ViewChange with the given docs, changes, and sync state.\n */\n // PORTING NOTE: The iOS/Android clients always compute limbo document changes.\n t.prototype.applyChanges = function (t, e, n) {\n var r = this,\n i = this.fo;\n this.fo = t.fo, this.mutatedKeys = t.mutatedKeys; // Sort changes based on type and query comparator\n\n var o = t.mo.jr();\n o.sort(function (t, e) {\n return function (t, e) {\n var n = function n(t) {\n switch (t) {\n case 0\n /* Added */\n :\n return 1;\n\n case 2\n /* Modified */\n :\n case 3\n /* Metadata */\n :\n // A metadata change is converted to a modified change at the public\n // api layer. Since we sort by document key and then change type,\n // metadata and modified changes must be sorted equivalently.\n return 2;\n\n case 1\n /* Removed */\n :\n return 0;\n\n default:\n return O();\n }\n };\n\n return n(t) - n(e);\n }(t.type, e.type) || r.lo(t.doc, e.doc);\n }), this.po(n);\n var s = e ? this.Eo() : [],\n u = 0 === this.ho.size && this.current ? 1\n /* Synced */\n : 0\n /* Local */\n ,\n a = u !== this.ao;\n return this.ao = u, 0 !== o.length || a ? {\n snapshot: new ds(this.query, t.fo, i, o, t.mutatedKeys, 0\n /* Local */\n === u, a,\n /* excludesMetadataChanges= */\n !1),\n To: s\n } : {\n To: s\n }; // no changes\n },\n /**\n * Applies an OnlineState change to the view, potentially generating a\n * ViewChange if the view's syncState changes as a result.\n */\n t.prototype.zr = function (t) {\n return this.current && \"Offline\"\n /* Offline */\n === t ? ( // If we're offline, set `current` to false and then call applyChanges()\n // to refresh our syncState and generate a ViewChange as appropriate. We\n // are guaranteed to get a new TargetChange that sets `current` back to\n // true once the client is back online.\n this.current = !1, this.applyChanges({\n fo: this.fo,\n mo: new ls(),\n mutatedKeys: this.mutatedKeys,\n Nn: !1\n },\n /* updateLimboDocuments= */\n !1)) : {\n To: []\n };\n },\n /**\n * Returns whether the doc for the given key should be in limbo.\n */\n t.prototype.Io = function (t) {\n // If the remote end says it's part of this query, it's not in limbo.\n return !this.uo.has(t) && // The local store doesn't think it's a result, so it shouldn't be in limbo.\n !!this.fo.has(t) && !this.fo.get(t).hasLocalMutations;\n },\n /**\n * Updates syncedDocuments, current, and limbo docs based on the given change.\n * Returns the list of changes to which docs are in limbo.\n */\n t.prototype.po = function (t) {\n var e = this;\n t && (t.addedDocuments.forEach(function (t) {\n return e.uo = e.uo.add(t);\n }), t.modifiedDocuments.forEach(function (t) {}), t.removedDocuments.forEach(function (t) {\n return e.uo = e.uo.delete(t);\n }), this.current = t.current);\n }, t.prototype.Eo = function () {\n var t = this; // We can only determine limbo documents when we're in-sync with the server.\n\n if (!this.current) return []; // TODO(klimt): Do this incrementally so that it's not quadratic when\n // updating many documents.\n\n var e = this.ho;\n this.ho = sn(), this.fo.forEach(function (e) {\n t.Io(e.key) && (t.ho = t.ho.add(e.key));\n }); // Diff the new limbo docs with the old limbo docs.\n\n var n = [];\n return e.forEach(function (e) {\n t.ho.has(e) || n.push(new Ds(e));\n }), this.ho.forEach(function (t) {\n e.has(t) || n.push(new Ns(t));\n }), n;\n },\n /**\n * Update the in-memory state of the current view with the state read from\n * persistence.\n *\n * We update the query view whenever a client's primary status changes:\n * - When a client transitions from primary to secondary, it can miss\n * LocalStorage updates and its query views may temporarily not be\n * synchronized with the state on disk.\n * - For secondary to primary transitions, the client needs to update the list\n * of `syncedDocuments` since secondary clients update their query views\n * based purely on synthesized RemoteEvents.\n *\n * @param queryResult.documents - The documents that match the query according\n * to the LocalStore.\n * @param queryResult.remoteKeys - The keys of the documents that match the\n * query according to the backend.\n *\n * @returns The ViewChange that resulted from this synchronization.\n */\n // PORTING NOTE: Multi-tab only.\n t.prototype.Ao = function (t) {\n this.uo = t.Bn, this.ho = sn();\n\n var e = this._o(t.documents);\n\n return this.applyChanges(e,\n /*updateLimboDocuments=*/\n !0);\n },\n /**\n * Returns a view snapshot as if this query was just listened to. Contains\n * a document add for every existing document and the `fromCache` and\n * `hasPendingWrites` status of the already established view.\n */\n // PORTING NOTE: Multi-tab only.\n t.prototype.Ro = function () {\n return ds.fromInitialDocuments(this.query, this.fo, this.mutatedKeys, 0\n /* Local */\n === this.ao);\n }, t;\n}(),\n ks = function ks(\n/**\n * The query itself.\n */\nt,\n/**\n * The target number created by the client that is used in the watch\n * stream to identify this query.\n */\ne,\n/**\n * The view is responsible for computing the final merged truth of what\n * docs are in the query. It gets notified of local and remote changes,\n * and applies the query filters and limits to determine the most correct\n * possible results.\n */\nn) {\n this.query = t, this.targetId = e, this.view = n;\n},\n Cs = function Cs(t) {\n this.key = t,\n /**\n * Set to true once we've received a document. This is used in\n * getRemoteKeysForTarget() and ultimately used by WatchChangeAggregator to\n * decide whether it needs to manufacture a delete event for the target once\n * the target is CURRENT.\n */\n this.bo = !1;\n},\n xs =\n/** @class */\nfunction () {\n function t(t, e, n, // PORTING NOTE: Manages state synchronization in multi-tab environments.\n r, i, o) {\n this.localStore = t, this.remoteStore = e, this.eventManager = n, this.sharedClientState = r, this.currentUser = i, this.maxConcurrentLimboResolutions = o, this.vo = {}, this.Po = new Ii(function (t) {\n return oe(t);\n }, ie), this.Vo = new Map(),\n /**\n * The keys of documents that are in limbo for which we haven't yet started a\n * limbo resolution query. The strings in this set are the result of calling\n * `key.path.canonicalString()` where `key` is a `DocumentKey` object.\n *\n * The `Set` type was chosen because it provides efficient lookup and removal\n * of arbitrary elements and it also maintains insertion order, providing the\n * desired queue-like FIFO semantics.\n */\n this.So = new Set(),\n /**\n * Keeps track of the target ID for each document that is in limbo with an\n * active target.\n */\n this.Do = new We(ct.comparator),\n /**\n * Keeps track of the information about an active limbo resolution for each\n * active target ID that was started for the purpose of limbo resolution.\n */\n this.Co = new Map(), this.No = new no(),\n /** Stores user completion handlers, indexed by User and BatchId. */\n this.xo = {},\n /** Stores user callbacks waiting for all pending writes to be acknowledged. */\n this.ko = new Map(), this.Fo = ci.Yt(), this.onlineState = \"Unknown\"\n /* Unknown */\n , // The primary state is set to `true` or `false` immediately after Firestore\n // startup. In the interim, a client should only be considered primary if\n // `isPrimary` is true.\n this.$o = void 0;\n }\n\n return Object.defineProperty(t.prototype, \"isPrimaryClient\", {\n get: function get() {\n return !0 === this.$o;\n },\n enumerable: !1,\n configurable: !0\n }), t;\n}();\n/**\n * Initiates the new listen, resolves promise when listen enqueued to the\n * server. All the subsequent view snapshots or errors are sent to the\n * subscribed handlers. Returns the initial snapshot.\n */\n\n\nfunction Rs(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s, u, a;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = uu(t), (s = n.Po.get(e)) ? ( // PORTING NOTE: With Multi-Tab Web, it is possible that a query view\n // already exists when EventManager calls us for the first time. This\n // happens when the primary tab is already listening to this query on\n // behalf of another tab and the user of the primary also starts listening\n // to the query. EventManager will not have an assigned target ID in this\n // case and calls `listen` to obtain this ID.\n i = s.targetId, n.sharedClientState.addLocalQueryTarget(i), o = s.view.Ro(), [3\n /*break*/\n , 4]) : [3\n /*break*/\n , 1];\n\n case 1:\n return [4\n /*yield*/\n , Wi(n.localStore, ne(e))];\n\n case 2:\n return u = r.sent(), a = n.sharedClientState.addLocalQueryTarget(u.targetId), i = u.targetId, [4\n /*yield*/\n , Ls(n, e, i, \"current\" === a)];\n\n case 3:\n o = r.sent(), n.isPrimaryClient && Uo(n.remoteStore, u), r.label = 4;\n\n case 4:\n return [2\n /*return*/\n , o];\n }\n });\n });\n}\n/**\n * Registers a view for a previously unknown query and computes its initial\n * snapshot.\n */\n\n\nfunction Ls(t, e, i, o) {\n return n(this, void 0, void 0, function () {\n var s, u, a, c, h, f;\n return r(this, function (l) {\n switch (l.label) {\n case 0:\n // PORTING NOTE: On Web only, we inject the code that registers new Limbo\n // targets based on view changes. This allows us to only depend on Limbo\n // changes when user code includes queries.\n return t.Oo = function (e, i, o) {\n return function (t, e, i, o) {\n return n(this, void 0, void 0, function () {\n var n, s, u;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = e.view._o(i), n.Nn ? [4\n /*yield*/\n , Yi(t.localStore, e.query,\n /* usePreviousResults= */\n !1).then(function (t) {\n var r = t.documents;\n return e.view._o(r, n);\n })] : [3\n /*break*/\n , 2];\n\n case 1:\n // The query has a limit and some docs were removed, so we need\n // to re-run the query against the local store to make sure we\n // didn't lose any good docs that had been past the limit.\n n = r.sent(), r.label = 2;\n\n case 2:\n return s = o && o.targetChanges.get(e.targetId), u = e.view.applyChanges(n,\n /* updateLimboDocuments= */\n t.isPrimaryClient, s), [2\n /*return*/\n , (zs(t, e.targetId, u.To), u.snapshot)];\n }\n });\n });\n }(t, e, i, o);\n }, [4\n /*yield*/\n , Yi(t.localStore, e,\n /* usePreviousResults= */\n !0)];\n\n case 1:\n return s = l.sent(), u = new As(e, s.Bn), a = u._o(s.documents), c = hn.createSynthesizedTargetChangeForCurrentChange(i, o && \"Offline\"\n /* Offline */\n !== t.onlineState), h = u.applyChanges(a,\n /* updateLimboDocuments= */\n t.isPrimaryClient, c), zs(t, i, h.To), f = new ks(e, i, u), [2\n /*return*/\n , (t.Po.set(e, f), t.Vo.has(i) ? t.Vo.get(i).push(e) : t.Vo.set(i, [e]), h.snapshot)];\n }\n });\n });\n}\n/** Stops listening to the query. */\n\n\nfunction Os(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = F(t), i = n.Po.get(e), (o = n.Vo.get(i.targetId)).length > 1 ? [2\n /*return*/\n , (n.Vo.set(i.targetId, o.filter(function (t) {\n return !ie(t, e);\n })), void n.Po.delete(e))] : n.isPrimaryClient ? ( // We need to remove the local query target first to allow us to verify\n // whether any other client is still interested in this target.\n n.sharedClientState.removeLocalQueryTarget(i.targetId), n.sharedClientState.isActiveQueryTarget(i.targetId) ? [3\n /*break*/\n , 2] : [4\n /*yield*/\n , Hi(n.localStore, i.targetId,\n /*keepPersistedTargetData=*/\n !1).then(function () {\n n.sharedClientState.clearQueryState(i.targetId), Bo(n.remoteStore, i.targetId), Qs(n, i.targetId);\n }).catch(pi)]) : [3\n /*break*/\n , 3];\n\n case 1:\n r.sent(), r.label = 2;\n\n case 2:\n return [3\n /*break*/\n , 5];\n\n case 3:\n return Qs(n, i.targetId), [4\n /*yield*/\n , Hi(n.localStore, i.targetId,\n /*keepPersistedTargetData=*/\n !0)];\n\n case 4:\n r.sent(), r.label = 5;\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Initiates the write of local mutation batch which involves adding the\n * writes to the mutation queue, notifying the remote store about new\n * mutations and raising events for any changes this write caused.\n *\n * The promise returned by this call is resolved when the above steps\n * have completed, *not* when the write was acked by the backend. The\n * userCallback is resolved once the write was acked/rejected by the\n * backend (or failed locally for any other reason).\n */\n\n\nfunction Ps(t, e, i) {\n return n(this, void 0, void 0, function () {\n var n, o, s, u;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n n = au(t), r.label = 1;\n\n case 1:\n return r.trys.push([1, 5,, 6]), [4\n /*yield*/\n , function (t, e) {\n var n,\n r = F(t),\n i = j.now(),\n o = e.reduce(function (t, e) {\n return t.add(e.key);\n }, sn());\n return r.persistence.runTransaction(\"Locally write mutations\", \"readwrite\", function (t) {\n return r.Mn.pn(t, o).next(function (o) {\n n = o;\n\n for ( // For non-idempotent mutations (such as `FieldValue.increment()`),\n // we record the base state in a separate patch mutation. This is\n // later used to guarantee consistent values and prevents flicker\n // even if the backend sends us an update that already includes our\n // transform.\n var s = [], u = 0, a = e; u < a.length; u++) {\n var c = a[u],\n h = Re(c, n.get(c.key));\n null != h && // NOTE: The base state should only be applied if there's some\n // existing document to override, so use a Precondition of\n // exists=true\n s.push(new Fe(c.key, h, St(h.value.mapValue), De.exists(!0)));\n }\n\n return r._n.addMutationBatch(t, i, s, e);\n });\n }).then(function (t) {\n return t.applyToLocalDocumentSet(n), {\n batchId: t.batchId,\n changes: n\n };\n });\n }(n.localStore, e)];\n\n case 2:\n return o = r.sent(), n.sharedClientState.addPendingMutation(o.batchId), function (t, e, n) {\n var r = t.xo[t.currentUser.toKey()];\n r || (r = new We(q)), r = r.insert(e, n), t.xo[t.currentUser.toKey()] = r;\n }(n, o.batchId, i), [4\n /*yield*/\n , Ys(n, o.changes)];\n\n case 3:\n return r.sent(), [4\n /*yield*/\n , Zo(n.remoteStore)];\n\n case 4:\n return r.sent(), [3\n /*break*/\n , 6];\n\n case 5:\n return s = r.sent(), u = hs(s, \"Failed to persist write\"), i.reject(u), [3\n /*break*/\n , 6];\n\n case 6:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Applies one remote event to the sync engine, notifying any views of the\n * changes, and releasing any pending mutation batches that would become\n * visible because of the snapshot version the remote event contains.\n */\n\n\nfunction Fs(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n n = F(t), r.label = 1;\n\n case 1:\n return r.trys.push([1, 4,, 6]), [4\n /*yield*/\n , Qi(n.localStore, e)];\n\n case 2:\n return i = r.sent(), // Update `receivedDocument` as appropriate for any limbo targets.\n e.targetChanges.forEach(function (t, e) {\n var r = n.Co.get(e);\n r && ( // Since this is a limbo resolution lookup, it's for a single document\n // and it could be added, modified, or removed, but not a combination.\n P(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1), t.addedDocuments.size > 0 ? r.bo = !0 : t.modifiedDocuments.size > 0 ? P(r.bo) : t.removedDocuments.size > 0 && (P(r.bo), r.bo = !1));\n }), [4\n /*yield*/\n , Ys(n, i, e)];\n\n case 3:\n // Update `receivedDocument` as appropriate for any limbo targets.\n return r.sent(), [3\n /*break*/\n , 6];\n\n case 4:\n return [4\n /*yield*/\n , pi(r.sent())];\n\n case 5:\n return r.sent(), [3\n /*break*/\n , 6];\n\n case 6:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Applies an OnlineState change to the sync engine and notifies any views of\n * the change.\n */\n\n\nfunction Ms(t, e, n) {\n var r = F(t); // If we are the secondary client, we explicitly ignore the remote store's\n // online state (the local client may go offline, even though the primary\n // tab remains online) and only apply the primary tab's online state from\n // SharedClientState.\n\n if (r.isPrimaryClient && 0\n /* RemoteStore */\n === n || !r.isPrimaryClient && 1\n /* SharedClientState */\n === n) {\n var i = [];\n r.Po.forEach(function (t, n) {\n var r = n.view.zr(e);\n r.snapshot && i.push(r.snapshot);\n }), function (t, e) {\n var n = F(t);\n n.onlineState = e;\n var r = !1;\n n.queries.forEach(function (t, n) {\n for (var i = 0, o = n.listeners; i < o.length; i++) {\n // Run global snapshot listeners if a consistent snapshot has been emitted.\n o[i].zr(e) && (r = !0);\n }\n }), r && bs(n);\n }(r.eventManager, e), i.length && r.vo._r(i), r.onlineState = e, r.isPrimaryClient && r.sharedClientState.setOnlineState(e);\n }\n}\n/**\n * Rejects the listen for the given targetID. This can be triggered by the\n * backend for any active target.\n *\n * @param syncEngine - The sync engine implementation.\n * @param targetId - The targetID corresponds to one previously initiated by the\n * user as part of TargetData passed to listen() on RemoteStore.\n * @param err - A description of the condition that has forced the rejection.\n * Nearly always this will be an indication that the user is no longer\n * authorized to see the data matching the target.\n */\n\n\nfunction Vs(t, e, i) {\n return n(this, void 0, void 0, function () {\n var n, o, s, u, a, c;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n // PORTING NOTE: Multi-tab only.\n return (n = F(t)).sharedClientState.updateQueryState(e, \"rejected\", i), o = n.Co.get(e), (s = o && o.key) ? (u = (u = new We(ct.comparator)).insert(s, Nt.newNoDocument(s, K.min())), a = sn().add(s), c = new cn(K.min(),\n /* targetChanges= */\n new Map(),\n /* targetMismatches= */\n new $e(q), u, a), [4\n /*yield*/\n , Fs(n, c)]) : [3\n /*break*/\n , 2];\n\n case 1:\n return r.sent(), // Since this query failed, we won't want to manually unlisten to it.\n // We only remove it from bookkeeping after we successfully applied the\n // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to\n // this query when the RemoteStore restarts the Watch stream, which should\n // re-trigger the target failure.\n n.Do = n.Do.remove(s), n.Co.delete(e), Hs(n), [3\n /*break*/\n , 4];\n\n case 2:\n return [4\n /*yield*/\n , Hi(n.localStore, e,\n /* keepPersistedTargetData */\n !1).then(function () {\n return Qs(n, e, i);\n }).catch(pi)];\n\n case 3:\n r.sent(), r.label = 4;\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction qs(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n n = F(t), i = e.batch.batchId, r.label = 1;\n\n case 1:\n return r.trys.push([1, 4,, 6]), [4\n /*yield*/\n , ji(n.localStore, e)];\n\n case 2:\n return o = r.sent(), // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught\n // up), so we raise user callbacks first so that they consistently happen\n // before listen events.\n Ks(n, i,\n /*error=*/\n null), js(n, i), n.sharedClientState.updateMutationState(i, \"acknowledged\"), [4\n /*yield*/\n , Ys(n, o)];\n\n case 3:\n // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught\n // up), so we raise user callbacks first so that they consistently happen\n // before listen events.\n return r.sent(), [3\n /*break*/\n , 6];\n\n case 4:\n return [4\n /*yield*/\n , pi(r.sent())];\n\n case 5:\n return r.sent(), [3\n /*break*/\n , 6];\n\n case 6:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction Us(t, e, i) {\n return n(this, void 0, void 0, function () {\n var n, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n n = F(t), r.label = 1;\n\n case 1:\n return r.trys.push([1, 4,, 6]), [4\n /*yield*/\n , function (t, e) {\n var n = F(t);\n return n.persistence.runTransaction(\"Reject batch\", \"readwrite-primary\", function (t) {\n var r;\n return n._n.lookupMutationBatch(t, e).next(function (e) {\n return P(null !== e), r = e.keys(), n._n.removeMutationBatch(t, e);\n }).next(function () {\n return n._n.performConsistencyCheck(t);\n }).next(function () {\n return n.Mn.pn(t, r);\n });\n });\n }(n.localStore, e)];\n\n case 2:\n return o = r.sent(), // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught up),\n // so we raise user callbacks first so that they consistently happen before\n // listen events.\n Ks(n, e, i), js(n, e), n.sharedClientState.updateMutationState(e, \"rejected\", i), [4\n /*yield*/\n , Ys(n, o)];\n\n case 3:\n // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught up),\n // so we raise user callbacks first so that they consistently happen before\n // listen events.\n return r.sent(), [3\n /*break*/\n , 6];\n\n case 4:\n return [4\n /*yield*/\n , pi(r.sent())];\n\n case 5:\n return r.sent(), [3\n /*break*/\n , 6];\n\n case 6:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Registers a user callback that resolves when all pending mutations at the moment of calling\n * are acknowledged .\n */\n\n\nfunction Bs(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s, u;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n zo((n = F(t)).remoteStore) || C(\"SyncEngine\", \"The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.\"), r.label = 1;\n\n case 1:\n return r.trys.push([1, 3,, 4]), [4\n /*yield*/\n , function (t) {\n var e = F(t);\n return e.persistence.runTransaction(\"Get highest unacknowledged batch id\", \"readonly\", function (t) {\n return e._n.getHighestUnacknowledgedBatchId(t);\n });\n }(n.localStore)];\n\n case 2:\n return -1 === (i = r.sent()) ? [2\n /*return*/\n , void e.resolve()] : ((o = n.ko.get(i) || []).push(e), n.ko.set(i, o), [3\n /*break*/\n , 4]);\n\n case 3:\n return s = r.sent(), u = hs(s, \"Initialization of waitForPendingWrites() operation failed\"), e.reject(u), [3\n /*break*/\n , 4];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\n * Triggers the callbacks that are waiting for this batch id to get acknowledged by server,\n * if there are any.\n */\n\n\nfunction js(t, e) {\n (t.ko.get(e) || []).forEach(function (t) {\n t.resolve();\n }), t.ko.delete(e)\n /** Reject all outstanding callbacks waiting for pending writes to complete. */\n ;\n}\n\nfunction Ks(t, e, n) {\n var r = F(t),\n i = r.xo[r.currentUser.toKey()]; // NOTE: Mutations restored from persistence won't have callbacks, so it's\n // okay for there to be no callback for this ID.\n\n if (i) {\n var o = i.get(e);\n o && (n ? o.reject(n) : o.resolve(), i = i.remove(e)), r.xo[r.currentUser.toKey()] = i;\n }\n}\n\nfunction Qs(t, e, n) {\n void 0 === n && (n = null), t.sharedClientState.removeLocalQueryTarget(e);\n\n for (var r = 0, i = t.Vo.get(e); r < i.length; r++) {\n var o = i[r];\n t.Po.delete(o), n && t.vo.Mo(o, n);\n }\n\n t.Vo.delete(e), t.isPrimaryClient && t.No.Zn(e).forEach(function (e) {\n t.No.containsKey(e) || // We removed the last reference for this key\n Gs(t, e);\n });\n}\n\nfunction Gs(t, e) {\n t.So.delete(e.path.canonicalString()); // It's possible that the target already got removed because the query failed. In that case,\n // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.\n\n var n = t.Do.get(e);\n null !== n && (Bo(t.remoteStore, n), t.Do = t.Do.remove(e), t.Co.delete(n), Hs(t));\n}\n\nfunction zs(t, e, n) {\n for (var r = 0, i = n; r < i.length; r++) {\n var o = i[r];\n o instanceof Ns ? (t.No.addReference(o.key, e), Ws(t, o)) : o instanceof Ds ? (C(\"SyncEngine\", \"Document no longer in limbo: \" + o.key), t.No.removeReference(o.key, e), t.No.containsKey(o.key) || // We removed the last reference for this key\n Gs(t, o.key)) : O();\n }\n}\n\nfunction Ws(t, e) {\n var n = e.key,\n r = n.path.canonicalString();\n t.Do.get(n) || t.So.has(r) || (C(\"SyncEngine\", \"New document in limbo: \" + n), t.So.add(r), Hs(t));\n}\n/**\n * Starts listens for documents in limbo that are enqueued for resolution,\n * subject to a maximum number of concurrent resolutions.\n *\n * Without bounding the number of concurrent resolutions, the server can fail\n * with \"resource exhausted\" errors which can lead to pathological client\n * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.\n */\n\n\nfunction Hs(t) {\n for (; t.So.size > 0 && t.Do.size < t.maxConcurrentLimboResolutions;) {\n var e = t.So.values().next().value;\n t.So.delete(e);\n var n = new ct(H.fromString(e)),\n r = t.Fo.next();\n t.Co.set(r, new Cs(n)), t.Do = t.Do.insert(n, r), Uo(t.remoteStore, new Pr(ne(Yt(n.path)), r, 2\n /* LimboResolution */\n , S.o));\n }\n}\n\nfunction Ys(t, e, i) {\n return n(this, void 0, void 0, function () {\n var o, s, u, a;\n return r(this, function (c) {\n switch (c.label) {\n case 0:\n return o = F(t), s = [], u = [], a = [], o.Po.isEmpty() ? [3\n /*break*/\n , 3] : (o.Po.forEach(function (t, n) {\n a.push(o.Oo(n, e, i).then(function (t) {\n if (t) {\n o.isPrimaryClient && o.sharedClientState.updateQueryState(n.targetId, t.fromCache ? \"not-current\" : \"current\"), s.push(t);\n var e = Mi.Pn(n.targetId, t);\n u.push(e);\n }\n }));\n }), [4\n /*yield*/\n , Promise.all(a)]);\n\n case 1:\n return c.sent(), o.vo._r(s), [4\n /*yield*/\n , function (t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s, u, a, c, h, f;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n n = F(t), r.label = 1;\n\n case 1:\n return r.trys.push([1, 3,, 4]), [4\n /*yield*/\n , n.persistence.runTransaction(\"notifyLocalViewChanges\", \"readwrite\", function (t) {\n return Ir.forEach(e, function (e) {\n return Ir.forEach(e.bn, function (r) {\n return n.persistence.referenceDelegate.addReference(t, e.targetId, r);\n }).next(function () {\n return Ir.forEach(e.vn, function (r) {\n return n.persistence.referenceDelegate.removeReference(t, e.targetId, r);\n });\n });\n });\n })];\n\n case 2:\n return r.sent(), [3\n /*break*/\n , 4];\n\n case 3:\n if (!Nr(i = r.sent())) throw i; // If `notifyLocalViewChanges` fails, we did not advance the sequence\n // number for the documents that were included in this transaction.\n // This might trigger them to be deleted earlier than they otherwise\n // would have, but it should not invalidate the integrity of the data.\n\n return C(\"LocalStore\", \"Failed to update sequence numbers: \" + i), [3\n /*break*/\n , 4];\n\n case 4:\n for (o = 0, s = e; o < s.length; o++) {\n u = s[o], a = u.targetId, u.fromCache || (c = n.kn.get(a), h = c.snapshotVersion, f = c.withLastLimboFreeSnapshotVersion(h), // Advance the last limbo free snapshot version\n n.kn = n.kn.insert(a, f));\n }\n\n return [2\n /*return*/\n ];\n }\n });\n });\n }(o.localStore, u)];\n\n case 2:\n c.sent(), c.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction $s(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return (n = F(t)).currentUser.isEqual(e) ? [3\n /*break*/\n , 3] : (C(\"SyncEngine\", \"User change. New user:\", e.toKey()), [4\n /*yield*/\n , Bi(n.localStore, e)]);\n\n case 1:\n return i = r.sent(), n.currentUser = e, // Fails tasks waiting for pending writes requested by previous user.\n function (t, e) {\n t.ko.forEach(function (t) {\n t.forEach(function (t) {\n t.reject(new D(N.CANCELLED, \"'waitForPendingWrites' promise is rejected due to a user change.\"));\n });\n }), t.ko.clear();\n }(n), // TODO(b/114226417): Consider calling this only in the primary tab.\n n.sharedClientState.handleUserChange(e, i.removedBatchIds, i.addedBatchIds), [4\n /*yield*/\n , Ys(n, i.Ln)];\n\n case 2:\n r.sent(), r.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction Xs(t, e) {\n var n = F(t),\n r = n.Co.get(e);\n if (r && r.bo) return sn().add(r.key);\n var i = sn(),\n o = n.Vo.get(e);\n if (!o) return i;\n\n for (var s = 0, u = o; s < u.length; s++) {\n var a = u[s],\n c = n.Po.get(a);\n i = i.unionWith(c.view.wo);\n }\n\n return i;\n}\n/**\n * Reconcile the list of synced documents in an existing view with those\n * from persistence.\n */\n\n\nfunction Js(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , Yi((n = F(t)).localStore, e.query,\n /* usePreviousResults= */\n !0)];\n\n case 1:\n return i = r.sent(), o = e.view.Ao(i), [2\n /*return*/\n , (n.isPrimaryClient && zs(n, e.targetId, o.To), o)];\n }\n });\n });\n}\n/**\n * Retrieves newly changed documents from remote document cache and raises\n * snapshots if needed.\n */\n// PORTING NOTE: Multi-Tab only.\n\n\nfunction Zs(t) {\n return n(this, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n return [2\n /*return*/\n , Xi((e = F(t)).localStore).then(function (t) {\n return Ys(e, t);\n })];\n });\n });\n}\n/** Applies a mutation state to an existing batch. */\n// PORTING NOTE: Multi-Tab only.\n\n\nfunction tu(t, e, i, o) {\n return n(this, void 0, void 0, function () {\n var n, s;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , function (t, e) {\n var n = F(t),\n r = F(n._n);\n return n.persistence.runTransaction(\"Lookup mutation documents\", \"readonly\", function (t) {\n return r.jt(t, e).next(function (e) {\n return e ? n.Mn.pn(t, e) : Ir.resolve(null);\n });\n });\n }((n = F(t)).localStore, e)];\n\n case 1:\n return null === (s = r.sent()) ? [3\n /*break*/\n , 6] : \"pending\" !== i ? [3\n /*break*/\n , 3] : [4\n /*yield*/\n , Zo(n.remoteStore)];\n\n case 2:\n // If we are the primary client, we need to send this write to the\n // backend. Secondary clients will ignore these writes since their remote\n // connection is disabled.\n return r.sent(), [3\n /*break*/\n , 4];\n\n case 3:\n \"acknowledged\" === i || \"rejected\" === i ? ( // NOTE: Both these methods are no-ops for batches that originated from\n // other clients.\n Ks(n, e, o || null), js(n, e), function (t, e) {\n F(F(t)._n).Gt(e);\n }(n.localStore, e)) : O(), r.label = 4;\n\n case 4:\n return [4\n /*yield*/\n , Ys(n, s)];\n\n case 5:\n return r.sent(), [3\n /*break*/\n , 7];\n\n case 6:\n // A throttled tab may not have seen the mutation before it was completed\n // and removed from the mutation queue, in which case we won't have cached\n // the affected documents. In this case we can safely ignore the update\n // since that means we didn't apply the mutation locally at all (if we\n // had, we would have cached the affected documents), and so we will just\n // see any resulting document changes via normal remote document updates\n // as applicable.\n C(\"SyncEngine\", \"Cannot apply mutation batch with id: \" + e), r.label = 7;\n\n case 7:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/** Applies a query target change from a different tab. */\n// PORTING NOTE: Multi-Tab only.\n\n\nfunction eu(t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s, u, a, c, h;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return uu(n = F(t)), au(n), !0 !== e || !0 === n.$o ? [3\n /*break*/\n , 3] : (i = n.sharedClientState.getAllActiveQueryTargets(), [4\n /*yield*/\n , nu(n, i.toArray())]);\n\n case 1:\n return o = r.sent(), n.$o = !0, [4\n /*yield*/\n , ss(n.remoteStore, !0)];\n\n case 2:\n for (r.sent(), s = 0, u = o; s < u.length; s++) {\n a = u[s], Uo(n.remoteStore, a);\n }\n\n return [3\n /*break*/\n , 7];\n\n case 3:\n return !1 !== e || !1 === n.$o ? [3\n /*break*/\n , 7] : (c = [], h = Promise.resolve(), n.Vo.forEach(function (t, e) {\n n.sharedClientState.isLocalQueryTarget(e) ? c.push(e) : h = h.then(function () {\n return Qs(n, e), Hi(n.localStore, e,\n /*keepPersistedTargetData=*/\n !0);\n }), Bo(n.remoteStore, e);\n }), [4\n /*yield*/\n , h]);\n\n case 4:\n return r.sent(), [4\n /*yield*/\n , nu(n, c)];\n\n case 5:\n return r.sent(), // PORTING NOTE: Multi-Tab only.\n function (t) {\n var e = F(t);\n e.Co.forEach(function (t, n) {\n Bo(e.remoteStore, n);\n }), e.No.ts(), e.Co = new Map(), e.Do = new We(ct.comparator);\n }(n), n.$o = !1, [4\n /*yield*/\n , ss(n.remoteStore, !1)];\n\n case 6:\n r.sent(), r.label = 7;\n\n case 7:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction nu(t, e, i) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s, u, a, c, h, f, l, d, p, y, v;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n n = F(t), i = [], o = [], s = 0, u = e, r.label = 1;\n\n case 1:\n return s < u.length ? (a = u[s], c = void 0, (h = n.Vo.get(a)) && 0 !== h.length ? [4\n /*yield*/\n , Wi(n.localStore, ne(h[0]))] : [3\n /*break*/\n , 7]) : [3\n /*break*/\n , 13];\n\n case 2:\n // For queries that have a local View, we fetch their current state\n // from LocalStore (as the resume token and the snapshot version\n // might have changed) and reconcile their views with the persisted\n // state (the list of syncedDocuments may have gotten out of sync).\n c = r.sent(), f = 0, l = h, r.label = 3;\n\n case 3:\n return f < l.length ? (d = l[f], p = n.Po.get(d), [4\n /*yield*/\n , Js(n, p)]) : [3\n /*break*/\n , 6];\n\n case 4:\n (y = r.sent()).snapshot && o.push(y.snapshot), r.label = 5;\n\n case 5:\n return f++, [3\n /*break*/\n , 3];\n\n case 6:\n return [3\n /*break*/\n , 11];\n\n case 7:\n return [4\n /*yield*/\n , $i(n.localStore, a)];\n\n case 8:\n return v = r.sent(), [4\n /*yield*/\n , Wi(n.localStore, v)];\n\n case 9:\n return c = r.sent(), [4\n /*yield*/\n , Ls(n, ru(v), a,\n /*current=*/\n !1)];\n\n case 10:\n r.sent(), r.label = 11;\n\n case 11:\n i.push(c), r.label = 12;\n\n case 12:\n return s++, [3\n /*break*/\n , 1];\n\n case 13:\n return [2\n /*return*/\n , (n.vo._r(o), i)];\n }\n });\n });\n}\n/**\n * Creates a `Query` object from the specified `Target`. There is no way to\n * obtain the original `Query`, so we synthesize a `Query` from the `Target`\n * object.\n *\n * The synthesized result might be different from the original `Query`, but\n * since the synthesized `Query` should return the same results as the\n * original one (only the presentation of results might differ), the potential\n * difference will not cause issues.\n */\n// PORTING NOTE: Multi-Tab only.\n\n\nfunction ru(t) {\n return Ht(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, \"F\"\n /* First */\n , t.startAt, t.endAt);\n}\n/** Returns the IDs of the clients that are currently active. */\n// PORTING NOTE: Multi-Tab only.\n\n\nfunction iu(t) {\n var e = F(t);\n return F(F(e.localStore).persistence).fn();\n}\n/** Applies a query target change from a different tab. */\n// PORTING NOTE: Multi-Tab only.\n\n\nfunction ou(t, e, i, o) {\n return n(this, void 0, void 0, function () {\n var n, s, u;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return (n = F(t)).$o ? ( // If we receive a target state notification via WebStorage, we are\n // either already secondary or another tab has taken the primary lease.\n C(\"SyncEngine\", \"Ignoring unexpected query state notification.\"), [3\n /*break*/\n , 8]) : [3\n /*break*/\n , 1];\n\n case 1:\n if (!n.Vo.has(e)) return [3\n /*break*/\n , 8];\n\n switch (i) {\n case \"current\":\n case \"not-current\":\n return [3\n /*break*/\n , 2];\n\n case \"rejected\":\n return [3\n /*break*/\n , 5];\n }\n\n return [3\n /*break*/\n , 7];\n\n case 2:\n return [4\n /*yield*/\n , Xi(n.localStore)];\n\n case 3:\n return s = r.sent(), u = cn.createSynthesizedRemoteEventForCurrentChange(e, \"current\" === i), [4\n /*yield*/\n , Ys(n, s, u)];\n\n case 4:\n return r.sent(), [3\n /*break*/\n , 8];\n\n case 5:\n return [4\n /*yield*/\n , Hi(n.localStore, e,\n /* keepPersistedTargetData */\n !0)];\n\n case 6:\n return r.sent(), Qs(n, e, o), [3\n /*break*/\n , 8];\n\n case 7:\n O(), r.label = 8;\n\n case 8:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/** Adds or removes Watch targets for queries from different tabs. */\n\n\nfunction su(t, e, i) {\n return n(this, void 0, void 0, function () {\n var n, o, s, u, a, c, h, f, l, d;\n return r(this, function (p) {\n switch (p.label) {\n case 0:\n if (!(n = uu(t)).$o) return [3\n /*break*/\n , 10];\n o = 0, s = e, p.label = 1;\n\n case 1:\n return o < s.length ? (u = s[o], n.Vo.has(u) ? ( // A target might have been added in a previous attempt\n C(\"SyncEngine\", \"Adding an already active target \" + u), [3\n /*break*/\n , 5]) : [4\n /*yield*/\n , $i(n.localStore, u)]) : [3\n /*break*/\n , 6];\n\n case 2:\n return a = p.sent(), [4\n /*yield*/\n , Wi(n.localStore, a)];\n\n case 3:\n return c = p.sent(), [4\n /*yield*/\n , Ls(n, ru(a), c.targetId,\n /*current=*/\n !1)];\n\n case 4:\n p.sent(), Uo(n.remoteStore, c), p.label = 5;\n\n case 5:\n return o++, [3\n /*break*/\n , 1];\n\n case 6:\n h = function h(t) {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return n.Vo.has(t) ? [4\n /*yield*/\n , Hi(n.localStore, t,\n /* keepPersistedTargetData */\n !1).then(function () {\n Bo(n.remoteStore, t), Qs(n, t);\n }).catch(pi)] : [3\n /*break*/\n , 2];\n // Release queries that are still active.\n\n case 1:\n // Release queries that are still active.\n e.sent(), e.label = 2;\n\n case 2:\n return [2\n /*return*/\n ];\n }\n });\n }, f = 0, l = i, p.label = 7;\n\n case 7:\n return f < l.length ? (d = l[f], [5\n /*yield**/\n , h(d)]) : [3\n /*break*/\n , 10];\n\n case 8:\n p.sent(), p.label = 9;\n\n case 9:\n return f++, [3\n /*break*/\n , 7];\n\n case 10:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction uu(t) {\n var e = F(t);\n return e.remoteStore.remoteSyncer.applyRemoteEvent = Fs.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Xs.bind(null, e), e.remoteStore.remoteSyncer.rejectListen = Vs.bind(null, e), e.vo._r = gs.bind(null, e.eventManager), e.vo.Mo = ws.bind(null, e.eventManager), e;\n}\n\nfunction au(t) {\n var e = F(t);\n return e.remoteStore.remoteSyncer.applySuccessfulWrite = qs.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = Us.bind(null, e), e\n /**\n * Loads a Firestore bundle into the SDK. The returned promise resolves when\n * the bundle finished loading.\n *\n * @param syncEngine - SyncEngine to use.\n * @param bundleReader - Bundle to load into the SDK.\n * @param task - LoadBundleTask used to update the loading progress to public API.\n */\n ;\n}\n\nfunction cu(t, e, i) {\n var o = F(t); // eslint-disable-next-line @typescript-eslint/no-floating-promises\n\n (function (t, e, i) {\n return n(this, void 0, void 0, function () {\n var n, o, s, u, a, c;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return r.trys.push([0, 14,, 15]), [4\n /*yield*/\n , e.getMetadata()];\n\n case 1:\n return n = r.sent(), [4\n /*yield*/\n , function (t, e) {\n var n = F(t),\n r = _n(e.createTime);\n\n return n.persistence.runTransaction(\"hasNewerBundle\", \"readonly\", function (t) {\n return n.Ke.getBundleMetadata(t, e.id);\n }).then(function (t) {\n return !!t && t.createTime.compareTo(r) >= 0;\n });\n }(t.localStore, n)];\n\n case 2:\n return r.sent() ? [4\n /*yield*/\n , e.close()] : [3\n /*break*/\n , 4];\n\n case 3:\n return [2\n /*return*/\n , (r.sent(), void i._completeWith(function (t) {\n return {\n taskState: \"Success\",\n documentsLoaded: t.totalDocuments,\n bytesLoaded: t.totalBytes,\n totalDocuments: t.totalDocuments,\n totalBytes: t.totalBytes\n };\n }(n)))];\n\n case 4:\n return i._updateProgress(Ss(n)), o = new _s(n, t.localStore, e.R), [4\n /*yield*/\n , e.Lo()];\n\n case 5:\n s = r.sent(), r.label = 6;\n\n case 6:\n return s ? [4\n /*yield*/\n , o.oo(s)] : [3\n /*break*/\n , 10];\n\n case 7:\n return (u = r.sent()) && i._updateProgress(u), [4\n /*yield*/\n , e.Lo()];\n\n case 8:\n s = r.sent(), r.label = 9;\n\n case 9:\n return [3\n /*break*/\n , 6];\n\n case 10:\n return [4\n /*yield*/\n , o.complete()];\n\n case 11:\n // TODO(b/160876443): This currently raises snapshots with\n // `fromCache=false` if users already listen to some queries and bundles\n // has newer version.\n return a = r.sent(), [4\n /*yield*/\n , Ys(t, a.wn,\n /* remoteEvent */\n void 0)];\n\n case 12:\n // Save metadata, so loading the same bundle will skip.\n // TODO(b/160876443): This currently raises snapshots with\n // `fromCache=false` if users already listen to some queries and bundles\n // has newer version.\n return r.sent(), [4\n /*yield*/\n , function (t, e) {\n var n = F(t);\n return n.persistence.runTransaction(\"Save bundle\", \"readwrite\", function (t) {\n return n.Ke.saveBundleMetadata(t, e);\n });\n }(t.localStore, n)];\n\n case 13:\n // TODO(b/160876443): This currently raises snapshots with\n // `fromCache=false` if users already listen to some queries and bundles\n // has newer version.\n // Save metadata, so loading the same bundle will skip.\n return r.sent(), i._completeWith(a.progress), [3\n /*break*/\n , 15];\n\n case 14:\n return R(\"SyncEngine\", \"Loading bundle failed with \" + (c = r.sent())), i._failWith(c), [3\n /*break*/\n , 15];\n\n case 15:\n return [2\n /*return*/\n ];\n }\n });\n });\n }\n /**\n * @license\n * Copyright 2020 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 * Provides all components needed for Firestore with in-memory persistence.\n * Uses EagerGC garbage collection.\n */\n )(o, e, i).then(function () {\n o.sharedClientState.notifyBundleLoaded();\n });\n}\n\nvar hu =\n/** @class */\nfunction () {\n function t() {\n this.synchronizeTabs = !1;\n }\n\n return t.prototype.initialize = function (t) {\n return n(this, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return this.R = Co(t.databaseInfo.databaseId), this.sharedClientState = this.Bo(t), this.persistence = this.qo(t), [4\n /*yield*/\n , this.persistence.start()];\n\n case 1:\n return e.sent(), this.gcScheduler = this.Uo(t), this.localStore = this.Ko(t), [2\n /*return*/\n ];\n }\n });\n });\n }, t.prototype.Uo = function (t) {\n return null;\n }, t.prototype.Ko = function (t) {\n return Ui(this.persistence, new Vi(), t.initialUser, this.R);\n }, t.prototype.qo = function (t) {\n return new ao(ho.bs, this.R);\n }, t.prototype.Bo = function (t) {\n return new To();\n }, t.prototype.terminate = function () {\n return n(this, void 0, void 0, function () {\n return r(this, function (t) {\n switch (t.label) {\n case 0:\n return this.gcScheduler && this.gcScheduler.stop(), [4\n /*yield*/\n , this.sharedClientState.shutdown()];\n\n case 1:\n return t.sent(), [4\n /*yield*/\n , this.persistence.shutdown()];\n\n case 2:\n return t.sent(), [2\n /*return*/\n ];\n }\n });\n });\n }, t;\n}(),\n fu =\n/** @class */\nfunction (e) {\n function i(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).Qo = t, i.cacheSizeBytes = n, i.forceOwnership = r, i.synchronizeTabs = !1, i;\n }\n\n return t(i, e), i.prototype.initialize = function (t) {\n return n(this, void 0, void 0, function () {\n var n = this;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , e.prototype.initialize.call(this, t)];\n\n case 1:\n return r.sent(), [4\n /*yield*/\n , Ji(this.localStore)];\n\n case 2:\n return r.sent(), [4\n /*yield*/\n , this.Qo.initialize(this, t)];\n\n case 3:\n // Enqueue writes from a previous session\n return r.sent(), [4\n /*yield*/\n , au(this.Qo.syncEngine)];\n\n case 4:\n // Enqueue writes from a previous session\n return r.sent(), [4\n /*yield*/\n , Zo(this.Qo.remoteStore)];\n\n case 5:\n // NOTE: This will immediately call the listener, so we make sure to\n // set it after localStore / remoteStore are started.\n return r.sent(), [4\n /*yield*/\n , this.persistence.He(function () {\n return n.gcScheduler && !n.gcScheduler.started && n.gcScheduler.start(n.localStore), Promise.resolve();\n })];\n\n case 6:\n // NOTE: This will immediately call the listener, so we make sure to\n // set it after localStore / remoteStore are started.\n return r.sent(), [2\n /*return*/\n ];\n }\n });\n });\n }, i.prototype.Ko = function (t) {\n return Ui(this.persistence, new Vi(), t.initialUser, this.R);\n }, i.prototype.Uo = function (t) {\n var e = this.persistence.referenceDelegate.garbageCollector;\n return new mi(e, t.asyncQueue);\n }, i.prototype.qo = function (t) {\n var e = Oi(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey),\n n = void 0 !== this.cacheSizeBytes ? ei.withCacheSize(this.cacheSizeBytes) : ei.DEFAULT;\n return new xi(this.synchronizeTabs, e, t.clientId, n, t.asyncQueue, Ao(), ko(), this.R, this.sharedClientState, !!this.forceOwnership);\n }, i.prototype.Bo = function (t) {\n return new To();\n }, i;\n}(hu),\n lu =\n/** @class */\nfunction (e) {\n function i(t, n) {\n var r = this;\n return (r = e.call(this, t, n,\n /* forceOwnership= */\n !1) || this).Qo = t, r.cacheSizeBytes = n, r.synchronizeTabs = !0, r;\n }\n\n return t(i, e), i.prototype.initialize = function (t) {\n return n(this, void 0, void 0, function () {\n var i,\n o = this;\n return r(this, function (s) {\n switch (s.label) {\n case 0:\n return [4\n /*yield*/\n , e.prototype.initialize.call(this, t)];\n\n case 1:\n return s.sent(), i = this.Qo.syncEngine, this.sharedClientState instanceof Io ? (this.sharedClientState.syncEngine = {\n ui: tu.bind(null, i),\n ai: ou.bind(null, i),\n hi: su.bind(null, i),\n fn: iu.bind(null, i),\n ci: Zs.bind(null, i)\n }, [4\n /*yield*/\n , this.sharedClientState.start()]) : [3\n /*break*/\n , 3];\n\n case 2:\n s.sent(), s.label = 3;\n\n case 3:\n // NOTE: This will immediately call the listener, so we make sure to\n // set it after localStore / remoteStore are started.\n return [4\n /*yield*/\n , this.persistence.He(function (t) {\n return n(o, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return [4\n /*yield*/\n , eu(this.Qo.syncEngine, t)];\n\n case 1:\n return e.sent(), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop()), [2\n /*return*/\n ];\n }\n });\n });\n })];\n\n case 4:\n // NOTE: This will immediately call the listener, so we make sure to\n // set it after localStore / remoteStore are started.\n return s.sent(), [2\n /*return*/\n ];\n }\n });\n });\n }, i.prototype.Bo = function (t) {\n var e = Ao();\n if (!Io.yt(e)) throw new D(N.UNIMPLEMENTED, \"IndexedDB persistence is only available on platforms that support LocalStorage.\");\n var n = Oi(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);\n return new Io(e, t.asyncQueue, n, t.clientId, t.initialUser);\n }, i;\n}(fu),\n du =\n/** @class */\nfunction () {\n function t() {}\n\n return t.prototype.initialize = function (t, e) {\n return n(this, void 0, void 0, function () {\n var n = this;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return this.localStore ? [3\n /*break*/\n , 2] : (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState, this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e), this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,\n /* startAsPrimary=*/\n !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = function (t) {\n return Ms(n.syncEngine, t, 1\n /* SharedClientState */\n );\n }, this.remoteStore.remoteSyncer.handleCredentialChange = $s.bind(null, this.syncEngine), [4\n /*yield*/\n , ss(this.remoteStore, this.syncEngine.isPrimaryClient)]);\n\n case 1:\n r.sent(), r.label = 2;\n\n case 2:\n return [2\n /*return*/\n ];\n }\n });\n });\n }, t.prototype.createEventManager = function (t) {\n return new ys();\n }, t.prototype.createDatastore = function (t) {\n var e,\n n = Co(t.databaseInfo.databaseId),\n r = (e = t.databaseInfo, new Do(e));\n /** Return the Platform-specific connectivity monitor. */\n\n return function (t, e, n) {\n return new Po(t, e, n);\n }(t.credentials, r, n);\n }, t.prototype.createRemoteStore = function (t) {\n var e,\n n,\n r,\n i,\n o,\n s = this;\n return e = this.localStore, n = this.datastore, r = t.asyncQueue, i = function i(t) {\n return Ms(s.syncEngine, t, 0\n /* RemoteStore */\n );\n }, o = _o.yt() ? new _o() : new Eo(), new Mo(e, n, r, i, o);\n }, t.prototype.createSyncEngine = function (t, e) {\n return function (t, e, n, // PORTING NOTE: Manages state synchronization in multi-tab environments.\n r, i, o, s) {\n var u = new xs(t, e, n, r, i, o);\n return s && (u.$o = !0), u;\n }(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);\n }, t.prototype.terminate = function () {\n return function (t) {\n return n(this, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return e = F(t), C(\"RemoteStore\", \"RemoteStore shutting down.\"), e.Or.add(5\n /* Shutdown */\n ), [4\n /*yield*/\n , qo(e)];\n\n case 1:\n return n.sent(), e.Lr.shutdown(), // Set the OnlineState to Unknown (rather than Offline) to avoid potentially\n // triggering spurious listener events with cached data, etc.\n e.Br.set(\"Unknown\"\n /* Unknown */\n ), [2\n /*return*/\n ];\n }\n });\n });\n }(this.remoteStore);\n }, t;\n}();\n/**\n * Provides all components needed for Firestore with IndexedDB persistence.\n */\n\n/**\n * @license\n * Copyright 2020 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 * How many bytes to read each time when `ReadableStreamReader.read()` is\n * called. Only applicable for byte streams that we control (e.g. those backed\n * by an UInt8Array).\n */\n\n/**\n * Builds a `ByteStreamReader` from a UInt8Array.\n * @param source - The data source to use.\n * @param bytesPerRead - How many bytes each `read()` from the returned reader\n * will read.\n */\n\n\nfunction pu(t, e) {\n void 0 === e && (e = 10240);\n var i = 0;\n return {\n read: function read() {\n return n(this, void 0, void 0, function () {\n var n;\n return r(this, function (r) {\n return i < t.byteLength ? (n = {\n value: t.slice(i, i + e),\n done: !1\n }, [2\n /*return*/\n , (i += e, n)]) : [2\n /*return*/\n , {\n done: !0\n }];\n });\n });\n },\n cancel: function cancel() {\n return n(this, void 0, void 0, function () {\n return r(this, function (t) {\n return [2\n /*return*/\n ];\n });\n });\n },\n releaseLock: function releaseLock() {},\n closed: Promise.reject(\"unimplemented\")\n };\n}\n/**\n * @license\n * Copyright 2020 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 * On web, a `ReadableStream` is wrapped around by a `ByteStreamReader`.\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/*\n * A wrapper implementation of Observer that will dispatch events\n * asynchronously. To allow immediate silencing, a mute call is added which\n * causes events scheduled to no longer be raised.\n */\n\n\nvar yu =\n/** @class */\nfunction () {\n function t(t) {\n this.observer = t,\n /**\n * When set to true, will not raise future events. Necessary to deal with\n * async detachment of listener.\n */\n this.muted = !1;\n }\n\n return t.prototype.next = function (t) {\n this.observer.next && this.jo(this.observer.next, t);\n }, t.prototype.error = function (t) {\n this.observer.error ? this.jo(this.observer.error, t) : console.error(\"Uncaught Error in snapshot listener:\", t);\n }, t.prototype.Wo = function () {\n this.muted = !0;\n }, t.prototype.jo = function (t, e) {\n var n = this;\n this.muted || setTimeout(function () {\n n.muted || t(e);\n }, 0);\n }, t;\n}(),\n vu =\n/** @class */\nfunction () {\n function t(\n /** The reader to read from underlying binary bundle data source. */\n t, e) {\n var n = this;\n this.Go = t, this.R = e,\n /** Cached bundle metadata. */\n this.metadata = new br(),\n /**\n * Internal buffer to hold bundle content, accumulating incomplete element\n * content.\n */\n this.buffer = new Uint8Array(), this.zo = new TextDecoder(\"utf-8\"), // Read the metadata (which is the first element).\n this.Ho().then(function (t) {\n t && t.io() ? n.metadata.resolve(t.payload.metadata) : n.metadata.reject(new Error(\"The first element of the bundle is not a metadata, it is\\n \" + JSON.stringify(null == t ? void 0 : t.payload)));\n }, function (t) {\n return n.metadata.reject(t);\n });\n }\n\n return t.prototype.close = function () {\n return this.Go.cancel();\n }, t.prototype.getMetadata = function () {\n return n(this, void 0, void 0, function () {\n return r(this, function (t) {\n return [2\n /*return*/\n , this.metadata.promise];\n });\n });\n }, t.prototype.Lo = function () {\n return n(this, void 0, void 0, function () {\n return r(this, function (t) {\n switch (t.label) {\n case 0:\n return [4\n /*yield*/\n , this.getMetadata()];\n\n case 1:\n // Makes sure metadata is read before proceeding.\n return [2\n /*return*/\n , (t.sent(), this.Ho())];\n }\n });\n });\n },\n /**\n * Reads from the head of internal buffer, and pulling more data from\n * underlying stream if a complete element cannot be found, until an\n * element(including the prefixed length and the JSON string) is found.\n *\n * Once a complete element is read, it is dropped from internal buffer.\n *\n * Returns either the bundled element, or null if we have reached the end of\n * the stream.\n */\n t.prototype.Ho = function () {\n return n(this, void 0, void 0, function () {\n var t, e, n, i;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , this.Jo()];\n\n case 1:\n return null === (t = r.sent()) ? [2\n /*return*/\n , null] : (e = this.zo.decode(t), n = Number(e), isNaN(n) && this.Yo(\"length string (\" + e + \") is not valid number\"), [4\n /*yield*/\n , this.Xo(n)]);\n\n case 2:\n return i = r.sent(), [2\n /*return*/\n , new Ts(JSON.parse(i), t.length + n)];\n }\n });\n });\n },\n /** First index of '{' from the underlying buffer. */\n t.prototype.Zo = function () {\n return this.buffer.findIndex(function (t) {\n return t === \"{\".charCodeAt(0);\n });\n },\n /**\n * Reads from the beginning of the internal buffer, until the first '{', and\n * return the content.\n *\n * If reached end of the stream, returns a null.\n */\n t.prototype.Jo = function () {\n return n(this, void 0, void 0, function () {\n var t, e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return this.Zo() < 0 ? [4\n /*yield*/\n , this.tc()] : [3\n /*break*/\n , 3];\n\n case 1:\n if (n.sent()) return [3\n /*break*/\n , 3];\n n.label = 2;\n\n case 2:\n return [3\n /*break*/\n , 0];\n\n case 3:\n // Broke out of the loop because underlying stream is closed, and there\n // happens to be no more data to process.\n return 0 === this.buffer.length ? [2\n /*return*/\n , null] : ( // Broke out of the loop because underlying stream is closed, but still\n // cannot find an open bracket.\n (t = this.Zo()) < 0 && this.Yo(\"Reached the end of bundle when a length string is expected.\"), e = this.buffer.slice(0, t), [2\n /*return*/\n , (this.buffer = this.buffer.slice(t), e)]);\n }\n });\n });\n },\n /**\n * Reads from a specified position from the internal buffer, for a specified\n * number of bytes, pulling more data from the underlying stream if needed.\n *\n * Returns a string decoded from the read bytes.\n */\n t.prototype.Xo = function (t) {\n return n(this, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return this.buffer.length < t ? [4\n /*yield*/\n , this.tc()] : [3\n /*break*/\n , 3];\n\n case 1:\n n.sent() && this.Yo(\"Reached the end of bundle when more is expected.\"), n.label = 2;\n\n case 2:\n return [3\n /*break*/\n , 0];\n\n case 3:\n // Update the internal buffer to drop the read json string.\n return e = this.zo.decode(this.buffer.slice(0, t)), [2\n /*return*/\n , (this.buffer = this.buffer.slice(t), e)];\n }\n });\n });\n }, t.prototype.Yo = function (t) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n throw this.Go.cancel(), new Error(\"Invalid bundle format: \" + t);\n },\n /**\n * Pulls more data from underlying stream to internal buffer.\n * Returns a boolean indicating whether the stream is finished.\n */\n t.prototype.tc = function () {\n return n(this, void 0, void 0, function () {\n var t, e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return [4\n /*yield*/\n , this.Go.read()];\n\n case 1:\n return (t = n.sent()).done || ((e = new Uint8Array(this.buffer.length + t.value.length)).set(this.buffer), e.set(t.value, this.buffer.length), this.buffer = e), [2\n /*return*/\n , t.done];\n }\n });\n });\n }, t;\n}(),\n mu =\n/** @class */\nfunction () {\n function t(t) {\n this.datastore = t, // The version of each document that was read during this transaction.\n this.readVersions = new Map(), this.mutations = [], this.committed = !1,\n /**\n * A deferred usage error that occurred previously in this transaction that\n * will cause the transaction to fail once it actually commits.\n */\n this.lastWriteError = null,\n /**\n * Set of documents that have been written in the transaction.\n *\n * When there's more than one write to the same key in a transaction, any\n * writes after the first are handled differently.\n */\n this.writtenDocs = new Set();\n }\n\n return t.prototype.lookup = function (t) {\n return n(this, void 0, void 0, function () {\n var e,\n i = this;\n return r(this, function (o) {\n switch (o.label) {\n case 0:\n if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new D(N.INVALID_ARGUMENT, \"Firestore transactions require all reads to be executed before all writes.\");\n return [4\n /*yield*/\n , function (t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o, s, u, a;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = F(t), i = xn(n.R) + \"/documents\", o = {\n documents: e.map(function (t) {\n return Dn(n.R, t);\n })\n }, [4\n /*yield*/\n , n.$i(\"BatchGetDocuments\", i, o)];\n\n case 1:\n return s = r.sent(), u = new Map(), s.forEach(function (t) {\n var e = function (t, e) {\n return \"found\" in e ? function (t, e) {\n P(!!e.found), e.found.name, e.found.updateTime;\n\n var n = An(t, e.found.name),\n r = _n(e.found.updateTime),\n i = new _t({\n mapValue: {\n fields: e.found.fields\n }\n });\n\n return Nt.newFoundDocument(n, r, i);\n }(t, e) : \"missing\" in e ? function (t, e) {\n P(!!e.missing), P(!!e.readTime);\n\n var n = An(t, e.missing),\n r = _n(e.readTime);\n\n return Nt.newNoDocument(n, r);\n }(t, e) : O();\n }(n.R, t);\n\n u.set(e.key.toString(), e);\n }), a = [], [2\n /*return*/\n , (e.forEach(function (t) {\n var e = u.get(t.toString());\n P(!!e), a.push(e);\n }), a)];\n }\n });\n });\n }(this.datastore, t)];\n\n case 1:\n return [2\n /*return*/\n , ((e = o.sent()).forEach(function (t) {\n return i.recordVersion(t);\n }), e)];\n }\n });\n });\n }, t.prototype.set = function (t, e) {\n this.write(e.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString());\n }, t.prototype.update = function (t, e) {\n try {\n this.write(e.toMutation(t, this.preconditionForUpdate(t)));\n } catch (t) {\n this.lastWriteError = t;\n }\n\n this.writtenDocs.add(t.toString());\n }, t.prototype.delete = function (t) {\n this.write(new je(t, this.precondition(t))), this.writtenDocs.add(t.toString());\n }, t.prototype.commit = function () {\n return n(this, void 0, void 0, function () {\n var t,\n e = this;\n return r(this, function (i) {\n switch (i.label) {\n case 0:\n if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;\n return t = this.readVersions, // For each mutation, note that the doc was written.\n this.mutations.forEach(function (e) {\n t.delete(e.key.toString());\n }), // For each document that was read but not written to, we want to perform\n // a `verify` operation.\n t.forEach(function (t, n) {\n var r = ct.fromPath(n);\n e.mutations.push(new Ke(r, e.precondition(r)));\n }), [4\n /*yield*/\n , function (t, e) {\n return n(this, void 0, void 0, function () {\n var n, i, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = F(t), i = xn(n.R) + \"/documents\", o = {\n writes: e.map(function (t) {\n return Pn(n.R, t);\n })\n }, [4\n /*yield*/\n , n.Ni(\"Commit\", i, o)];\n\n case 1:\n return r.sent(), [2\n /*return*/\n ];\n }\n });\n });\n }(this.datastore, this.mutations)];\n\n case 1:\n // For each mutation, note that the doc was written.\n return i.sent(), this.committed = !0, [2\n /*return*/\n ];\n }\n });\n });\n }, t.prototype.recordVersion = function (t) {\n var e;\n if (t.isFoundDocument()) e = t.version;else {\n if (!t.isNoDocument()) throw O(); // For deleted docs, we must use baseVersion 0 when we overwrite them.\n\n e = K.min();\n }\n var n = this.readVersions.get(t.key.toString());\n\n if (n) {\n if (!e.isEqual(n)) // This transaction will fail no matter what.\n throw new D(N.ABORTED, \"Document version changed between two reads.\");\n } else this.readVersions.set(t.key.toString(), e);\n },\n /**\n * Returns the version of this document when it was read in this transaction,\n * as a precondition, or no precondition if it was not read.\n */\n t.prototype.precondition = function (t) {\n var e = this.readVersions.get(t.toString());\n return !this.writtenDocs.has(t.toString()) && e ? De.updateTime(e) : De.none();\n },\n /**\n * Returns the precondition for a document if the operation is an update.\n */\n t.prototype.preconditionForUpdate = function (t) {\n var e = this.readVersions.get(t.toString()); // The first time a document is written, we want to take into account the\n // read time and existence\n\n if (!this.writtenDocs.has(t.toString()) && e) {\n if (e.isEqual(K.min())) // The document doesn't exist, so fail the transaction.\n // This has to be validated locally because you can't send a\n // precondition that a document does not exist without changing the\n // semantics of the backend write to be an insert. This is the reverse\n // of what we want, since we want to assert that the document doesn't\n // exist but then send the update and have it fail. Since we can't\n // express that to the backend, we have to validate locally.\n // Note: this can change once we can send separate verify writes in the\n // transaction.\n throw new D(N.INVALID_ARGUMENT, \"Can't update a document that doesn't exist.\"); // Document exists, base precondition on document update time.\n\n return De.updateTime(e);\n } // Document was not read, so we just use the preconditions for a blind\n // update.\n\n\n return De.exists(!0);\n }, t.prototype.write = function (t) {\n this.ensureCommitNotCalled(), this.mutations.push(t);\n }, t.prototype.ensureCommitNotCalled = function () {}, t;\n}(),\n gu =\n/** @class */\nfunction () {\n function t(t, e, n, r) {\n this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r, this.ec = 5, this.Zi = new xo(this.asyncQueue, \"transaction_retry\"\n /* TransactionRetry */\n )\n /** Runs the transaction and sets the result on deferred. */\n ;\n }\n\n return t.prototype.run = function () {\n this.ec -= 1, this.nc();\n }, t.prototype.nc = function () {\n var t = this;\n this.Zi.ji(function () {\n return n(t, void 0, void 0, function () {\n var t,\n e,\n n = this;\n return r(this, function (r) {\n return t = new mu(this.datastore), (e = this.sc(t)) && e.then(function (e) {\n n.asyncQueue.enqueueAndForget(function () {\n return t.commit().then(function () {\n n.deferred.resolve(e);\n }).catch(function (t) {\n n.ic(t);\n });\n });\n }).catch(function (t) {\n n.ic(t);\n }), [2\n /*return*/\n ];\n });\n });\n });\n }, t.prototype.sc = function (t) {\n try {\n var e = this.updateFunction(t);\n return !st(e) && e.catch && e.then ? e : (this.deferred.reject(Error(\"Transaction callback must return a Promise\")), null);\n } catch (t) {\n // Do not retry errors thrown by user provided updateFunction.\n return this.deferred.reject(t), null;\n }\n }, t.prototype.ic = function (t) {\n var e = this;\n this.ec > 0 && this.rc(t) ? (this.ec -= 1, this.asyncQueue.enqueueAndForget(function () {\n return e.nc(), Promise.resolve();\n })) : this.deferred.reject(t);\n }, t.prototype.rc = function (t) {\n if (\"FirebaseError\" === t.name) {\n // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and\n // non-matching document versions with ABORTED. These errors should be retried.\n var e = t.code;\n return \"aborted\" === e || \"failed-precondition\" === e || !Ge(e);\n }\n\n return !1;\n }, t;\n}(),\n wu =\n/** @class */\nfunction () {\n function t(t,\n /**\n * Asynchronous queue responsible for all of our internal processing. When\n * we get incoming work from the user (via public API) or the network\n * (incoming GRPC messages), we should always schedule onto this queue.\n * This ensures all of our work is properly serialized (e.g. we don't\n * start processing a new operation while the previous one is waiting for\n * an async I/O to complete).\n */\n e, i) {\n var o = this;\n this.credentials = t, this.asyncQueue = e, this.databaseInfo = i, this.user = fo.UNAUTHENTICATED, this.clientId = V.u(), this.credentialListener = function () {\n return Promise.resolve();\n }, this.credentials.setChangeListener(e, function (t) {\n return n(o, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return C(\"FirestoreClient\", \"Received user=\", t.uid), [4\n /*yield*/\n , this.credentialListener(t)];\n\n case 1:\n return e.sent(), this.user = t, [2\n /*return*/\n ];\n }\n });\n });\n });\n }\n\n return t.prototype.getConfiguration = function () {\n return n(this, void 0, void 0, function () {\n return r(this, function (t) {\n return [2\n /*return*/\n , {\n asyncQueue: this.asyncQueue,\n databaseInfo: this.databaseInfo,\n clientId: this.clientId,\n credentials: this.credentials,\n initialUser: this.user,\n maxConcurrentLimboResolutions: 100\n }];\n });\n });\n }, t.prototype.setCredentialChangeListener = function (t) {\n this.credentialListener = t;\n },\n /**\n * Checks that the client has not been terminated. Ensures that other methods on\n * this class cannot be called after the client is terminated.\n */\n t.prototype.verifyNotTerminated = function () {\n if (this.asyncQueue.isShuttingDown) throw new D(N.FAILED_PRECONDITION, \"The client has already been terminated.\");\n }, t.prototype.terminate = function () {\n var t = this;\n this.asyncQueue.enterRestrictedMode();\n var e = new br();\n return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(function () {\n return n(t, void 0, void 0, function () {\n var t, n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return r.trys.push([0, 5,, 6]), this.onlineComponents ? [4\n /*yield*/\n , this.onlineComponents.terminate()] : [3\n /*break*/\n , 2];\n\n case 1:\n r.sent(), r.label = 2;\n\n case 2:\n return this.offlineComponents ? [4\n /*yield*/\n , this.offlineComponents.terminate()] : [3\n /*break*/\n , 4];\n\n case 3:\n r.sent(), r.label = 4;\n\n case 4:\n // `removeChangeListener` must be called after shutting down the\n // RemoteStore as it will prevent the RemoteStore from retrieving\n // auth tokens.\n return this.credentials.removeChangeListener(), e.resolve(), [3\n /*break*/\n , 6];\n\n case 5:\n return t = r.sent(), n = hs(t, \"Failed to shutdown persistence\"), e.reject(n), [3\n /*break*/\n , 6];\n\n case 6:\n return [2\n /*return*/\n ];\n }\n });\n });\n }), e.promise;\n }, t;\n}();\n/**\n * @license\n * Copyright 2020 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 * A class representing a bundle.\n *\n * Takes a bundle stream or buffer, and presents abstractions to read bundled\n * elements out of the underlying content.\n */\n\n\nfunction bu(t, e) {\n return n(this, void 0, void 0, function () {\n var i,\n o,\n s = this;\n return r(this, function (u) {\n switch (u.label) {\n case 0:\n return t.asyncQueue.verifyOperationInProgress(), C(\"FirestoreClient\", \"Initializing OfflineComponentProvider\"), [4\n /*yield*/\n , t.getConfiguration()];\n\n case 1:\n return i = u.sent(), [4\n /*yield*/\n , e.initialize(i)];\n\n case 2:\n return u.sent(), o = i.initialUser, t.setCredentialChangeListener(function (t) {\n return n(s, void 0, void 0, function () {\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return o.isEqual(t) ? [3\n /*break*/\n , 2] : [4\n /*yield*/\n , Bi(e.localStore, t)];\n\n case 1:\n n.sent(), o = t, n.label = 2;\n\n case 2:\n return [2\n /*return*/\n ];\n }\n });\n });\n }), // When a user calls clearPersistence() in one client, all other clients\n // need to be terminated to allow the delete to succeed.\n e.persistence.setDatabaseDeletedListener(function () {\n return t.terminate();\n }), t.offlineComponents = e, [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction Iu(t, e) {\n return n(this, void 0, void 0, function () {\n var i, o;\n return r(this, function (s) {\n switch (s.label) {\n case 0:\n return t.asyncQueue.verifyOperationInProgress(), [4\n /*yield*/\n , Tu(t)];\n\n case 1:\n return i = s.sent(), C(\"FirestoreClient\", \"Initializing OnlineComponentProvider\"), [4\n /*yield*/\n , t.getConfiguration()];\n\n case 2:\n return o = s.sent(), [4\n /*yield*/\n , e.initialize(i, o)];\n\n case 3:\n return s.sent(), // The CredentialChangeListener of the online component provider takes\n // precedence over the offline component provider.\n t.setCredentialChangeListener(function (t) {\n return function (t, e) {\n return n(this, void 0, void 0, function () {\n var n, i;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return (n = F(t)).asyncQueue.verifyOperationInProgress(), C(\"RemoteStore\", \"RemoteStore received new credentials\"), i = zo(n), // Tear down and re-create our network streams. This will ensure we get a\n // fresh auth token for the new user and re-fill the write pipeline with\n // new mutations from the LocalStore (since mutations are per-user).\n n.Or.add(3\n /* CredentialChange */\n ), [4\n /*yield*/\n , qo(n)];\n\n case 1:\n return r.sent(), i && // Don't set the network status to Unknown if we are offline.\n n.Br.set(\"Unknown\"\n /* Unknown */\n ), [4\n /*yield*/\n , n.remoteSyncer.handleCredentialChange(e)];\n\n case 2:\n return r.sent(), n.Or.delete(3\n /* CredentialChange */\n ), [4\n /*yield*/\n , Vo(n)];\n\n case 3:\n // Tear down and re-create our network streams. This will ensure we get a\n // fresh auth token for the new user and re-fill the write pipeline with\n // new mutations from the LocalStore (since mutations are per-user).\n return r.sent(), [2\n /*return*/\n ];\n }\n });\n });\n }(e.remoteStore, t);\n }), t.onlineComponents = e, [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction Tu(t) {\n return n(this, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return t.offlineComponents ? [3\n /*break*/\n , 2] : (C(\"FirestoreClient\", \"Using default OfflineComponentProvider\"), [4\n /*yield*/\n , bu(t, new hu())]);\n\n case 1:\n e.sent(), e.label = 2;\n\n case 2:\n return [2\n /*return*/\n , t.offlineComponents];\n }\n });\n });\n}\n\nfunction Eu(t) {\n return n(this, void 0, void 0, function () {\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return t.onlineComponents ? [3\n /*break*/\n , 2] : (C(\"FirestoreClient\", \"Using default OnlineComponentProvider\"), [4\n /*yield*/\n , Iu(t, new du())]);\n\n case 1:\n e.sent(), e.label = 2;\n\n case 2:\n return [2\n /*return*/\n , t.onlineComponents];\n }\n });\n });\n}\n\nfunction _u(t) {\n return Tu(t).then(function (t) {\n return t.persistence;\n });\n}\n\nfunction Su(t) {\n return Tu(t).then(function (t) {\n return t.localStore;\n });\n}\n\nfunction Nu(t) {\n return Eu(t).then(function (t) {\n return t.remoteStore;\n });\n}\n\nfunction Du(t) {\n return Eu(t).then(function (t) {\n return t.syncEngine;\n });\n}\n\nfunction Au(t) {\n return n(this, void 0, void 0, function () {\n var e, n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , Eu(t)];\n\n case 1:\n return e = r.sent(), [2\n /*return*/\n , ((n = e.eventManager).onListen = Rs.bind(null, e.syncEngine), n.onUnlisten = Os.bind(null, e.syncEngine), n)];\n }\n });\n });\n}\n/** Enables the network connection and re-enqueues all pending operations. */\n\n\nfunction ku(t, e, i) {\n var o = this;\n void 0 === i && (i = {});\n var s = new br();\n return t.asyncQueue.enqueueAndForget(function () {\n return n(o, void 0, void 0, function () {\n var n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = function n(t, e, _n2, r, i) {\n var o = new yu({\n next: function next(o) {\n // Remove query first before passing event to user to avoid\n // user actions affecting the now stale query.\n e.enqueueAndForget(function () {\n return ms(t, s);\n });\n var u = o.docs.has(_n2);\n !u && o.fromCache ? // TODO(dimond): If we're online and the document doesn't\n // exist then we resolve with a doc.exists set to false. If\n // we're offline however, we reject the Promise in this\n // case. Two options: 1) Cache the negative response from\n // the server so we can deliver that even when you're\n // offline 2) Actually reject the Promise in the online case\n // if the document doesn't exist.\n i.reject(new D(N.UNAVAILABLE, \"Failed to get document because the client is offline.\")) : u && o.fromCache && r && \"server\" === r.source ? i.reject(new D(N.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to \"server\" to retrieve the cached document.)')) : i.resolve(o);\n },\n error: function error(t) {\n return i.reject(t);\n }\n }),\n s = new Is(Yt(_n2.path), o, {\n includeMetadataChanges: !0,\n so: !0\n });\n return vs(t, s);\n }, [4\n /*yield*/\n , Au(t)];\n\n case 1:\n return [2\n /*return*/\n , n.apply(void 0, [r.sent(), t.asyncQueue, e, i, s])];\n }\n });\n });\n }), s.promise;\n}\n\nfunction Cu(t, e, i) {\n var o = this;\n void 0 === i && (i = {});\n var s = new br();\n return t.asyncQueue.enqueueAndForget(function () {\n return n(o, void 0, void 0, function () {\n var n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = function n(t, e, _n3, r, i) {\n var o = new yu({\n next: function next(n) {\n // Remove query first before passing event to user to avoid\n // user actions affecting the now stale query.\n e.enqueueAndForget(function () {\n return ms(t, s);\n }), n.fromCache && \"server\" === r.source ? i.reject(new D(N.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to \"server\" to retrieve the cached documents.)')) : i.resolve(n);\n },\n error: function error(t) {\n return i.reject(t);\n }\n }),\n s = new Is(_n3, o, {\n includeMetadataChanges: !0,\n so: !0\n });\n return vs(t, s);\n }, [4\n /*yield*/\n , Au(t)];\n\n case 1:\n return [2\n /*return*/\n , n.apply(void 0, [r.sent(), t.asyncQueue, e, i, s])];\n }\n });\n });\n }), s.promise;\n}\n\nvar xu =\n/**\n * Constructs a DatabaseInfo using the provided host, databaseId and\n * persistenceKey.\n *\n * @param databaseId - The database to use.\n * @param appId - The Firebase App Id.\n * @param persistenceKey - A unique identifier for this Firestore's local\n * storage (used in conjunction with the databaseId).\n * @param host - The Firestore backend host to connect to.\n * @param ssl - Whether to use SSL when connecting.\n * @param forceLongPolling - Whether to use the forceLongPolling option\n * when using WebChannel as the network transport.\n * @param autoDetectLongPolling - Whether to use the detectBufferingProxy\n * option when using WebChannel as the network transport.\n * @param useFetchStreams Whether to use the Fetch API instead of\n * XMLHTTPRequest\n */\nfunction xu(t, e, n, r, i, o, s, u) {\n this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = i, this.forceLongPolling = o, this.autoDetectLongPolling = s, this.useFetchStreams = u;\n},\n Ru =\n/** @class */\nfunction () {\n function t(t, e) {\n this.projectId = t, this.database = e || \"(default)\";\n }\n\n return Object.defineProperty(t.prototype, \"isDefaultDatabase\", {\n get: function get() {\n return \"(default)\" === this.database;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function (e) {\n return e instanceof t && e.projectId === this.projectId && e.database === this.database;\n }, t;\n}(),\n Lu = new Map(),\n Ou = function Ou(t, e) {\n this.user = e, this.type = \"OAuth\", this.authHeaders = {}, // Set the headers using Object Literal notation to avoid minification\n this.authHeaders.Authorization = \"Bearer \" + t;\n},\n Pu =\n/** @class */\nfunction () {\n function t() {\n /**\n * Stores the listener registered with setChangeListener()\n * This isn't actually necessary since the UID never changes, but we use this\n * to verify the listen contract is adhered to in tests.\n */\n this.changeListener = null;\n }\n\n return t.prototype.getToken = function () {\n return Promise.resolve(null);\n }, t.prototype.invalidateToken = function () {}, t.prototype.setChangeListener = function (t, e) {\n this.changeListener = e, // Fire with initial user.\n t.enqueueRetryable(function () {\n return e(fo.UNAUTHENTICATED);\n });\n }, t.prototype.removeChangeListener = function () {\n this.changeListener = null;\n }, t;\n}(),\n Fu =\n/** @class */\nfunction () {\n function t(t) {\n this.token = t,\n /**\n * Stores the listener registered with setChangeListener()\n * This isn't actually necessary since the UID never changes, but we use this\n * to verify the listen contract is adhered to in tests.\n */\n this.changeListener = null;\n }\n\n return t.prototype.getToken = function () {\n return Promise.resolve(this.token);\n }, t.prototype.invalidateToken = function () {}, t.prototype.setChangeListener = function (t, e) {\n var n = this;\n this.changeListener = e, // Fire with initial user.\n t.enqueueRetryable(function () {\n return e(n.token.user);\n });\n }, t.prototype.removeChangeListener = function () {\n this.changeListener = null;\n }, t;\n}(),\n Mu =\n/** @class */\nfunction () {\n function t(t) {\n var e = this;\n /** Tracks the current User. */\n\n this.currentUser = fo.UNAUTHENTICATED,\n /** Promise that allows blocking on the initialization of Firebase Auth. */\n this.oc = new br(),\n /**\n * Counter used to detect if the token changed while a getToken request was\n * outstanding.\n */\n this.cc = 0, this.forceRefresh = !1, this.auth = null, this.asyncQueue = null, this.uc = function () {\n e.cc++, e.currentUser = e.ac(), e.oc.resolve(), e.changeListener && e.asyncQueue.enqueueRetryable(function () {\n return e.changeListener(e.currentUser);\n });\n };\n\n var n = function n(t) {\n C(\"FirebaseCredentialsProvider\", \"Auth detected\"), e.auth = t, e.auth.addAuthTokenListener(e.uc);\n };\n\n t.onInit(function (t) {\n return n(t);\n }), // Our users can initialize Auth right after Firestore, so we give it\n // a chance to register itself with the component framework before we\n // determine whether to start up in unauthenticated mode.\n setTimeout(function () {\n if (!e.auth) {\n var r = t.getImmediate({\n optional: !0\n });\n r ? n(r) : ( // If auth is still not available, proceed with `null` user\n C(\"FirebaseCredentialsProvider\", \"Auth not yet detected\"), e.oc.resolve());\n }\n }, 0);\n }\n\n return t.prototype.getToken = function () {\n var t = this,\n e = this.cc,\n n = this.forceRefresh; // Take note of the current value of the tokenCounter so that this method\n // can fail (with an ABORTED error) if there is a token change while the\n // request is outstanding.\n\n return this.forceRefresh = !1, this.auth ? this.auth.getToken(n).then(function (n) {\n // Cancel the request since the token changed while the request was\n // outstanding so the response is potentially for a previous user (which\n // user, we can't be sure).\n return t.cc !== e ? (C(\"FirebaseCredentialsProvider\", \"getToken aborted due to token change.\"), t.getToken()) : n ? (P(\"string\" == typeof n.accessToken), new Ou(n.accessToken, t.currentUser)) : null;\n }) : Promise.resolve(null);\n }, t.prototype.invalidateToken = function () {\n this.forceRefresh = !0;\n }, t.prototype.setChangeListener = function (t, e) {\n var i = this;\n this.asyncQueue = t, // Blocks the AsyncQueue until the next user is available.\n this.asyncQueue.enqueueRetryable(function () {\n return n(i, void 0, void 0, function () {\n return r(this, function (t) {\n switch (t.label) {\n case 0:\n return [4\n /*yield*/\n , this.oc.promise];\n\n case 1:\n return t.sent(), [4\n /*yield*/\n , e(this.currentUser)];\n\n case 2:\n return t.sent(), this.changeListener = e, [2\n /*return*/\n ];\n }\n });\n });\n });\n }, t.prototype.removeChangeListener = function () {\n this.auth && this.auth.removeAuthTokenListener(this.uc), this.changeListener = function () {\n return Promise.resolve();\n };\n }, // Auth.getUid() can return null even with a user logged in. It is because\n // getUid() is synchronous, but the auth code populating Uid is asynchronous.\n // This method should only be called in the AuthTokenListener callback\n // to guarantee to get the actual user.\n t.prototype.ac = function () {\n var t = this.auth && this.auth.getUid();\n return P(null === t || \"string\" == typeof t), new fo(t);\n }, t;\n}(),\n Vu =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this.hc = t, this.lc = e, this.fc = n, this.type = \"FirstParty\", this.user = fo.FIRST_PARTY;\n }\n\n return Object.defineProperty(t.prototype, \"authHeaders\", {\n get: function get() {\n var t = {\n \"X-Goog-AuthUser\": this.lc\n },\n e = this.hc.auth.getAuthHeaderValueForFirstParty([]); // Use array notation to prevent minification\n\n return e && (t.Authorization = e), this.fc && (t[\"X-Goog-Iam-Authorization-Token\"] = this.fc), t;\n },\n enumerable: !1,\n configurable: !0\n }), t;\n}(),\n qu =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this.hc = t, this.lc = e, this.fc = n;\n }\n\n return t.prototype.getToken = function () {\n return Promise.resolve(new Vu(this.hc, this.lc, this.fc));\n }, t.prototype.setChangeListener = function (t, e) {\n // Fire with initial uid.\n t.enqueueRetryable(function () {\n return e(fo.FIRST_PARTY);\n });\n }, t.prototype.removeChangeListener = function () {}, t.prototype.invalidateToken = function () {}, t;\n}();\n/** The default database name for a project. */\n\n/** Represents the database ID a Firestore client is associated with. */\n\n/**\n * Builds a CredentialsProvider depending on the type of\n * the credentials passed in.\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\nfunction Uu(t, e, n) {\n if (!n) throw new D(N.INVALID_ARGUMENT, \"Function \" + t + \"() cannot be called with an empty \" + e + \".\");\n}\n\nfunction Bu(t, e) {\n if (void 0 === e) return {\n merge: !1\n };\n if (void 0 !== e.mergeFields && void 0 !== e.merge) throw new D(N.INVALID_ARGUMENT, \"Invalid options passed to function \" + t + '(): You cannot specify both \"merge\" and \"mergeFields\".');\n return e;\n}\n/**\n * Validates that two boolean options are not set at the same time.\n */\n\n\nfunction ju(t, e, n, r) {\n if (!0 === e && !0 === r) throw new D(N.INVALID_ARGUMENT, t + \" and \" + n + \" cannot be used together.\");\n}\n/**\n * Validates that `path` refers to a document (indicated by the fact it contains\n * an even numbers of segments).\n */\n\n\nfunction Ku(t) {\n if (!ct.isDocumentKey(t)) throw new D(N.INVALID_ARGUMENT, \"Invalid document reference. Document references must have an even number of segments, but \" + t + \" has \" + t.length + \".\");\n}\n/**\n * Validates that `path` refers to a collection (indicated by the fact it\n * contains an odd numbers of segments).\n */\n\n\nfunction Qu(t) {\n if (ct.isDocumentKey(t)) throw new D(N.INVALID_ARGUMENT, \"Invalid collection reference. Collection references must have an odd number of segments, but \" + t + \" has \" + t.length + \".\");\n}\n/**\n * Returns true if it's a non-null object without a custom prototype\n * (i.e. excludes Array, Date, etc.).\n */\n\n/** Returns a string describing the type / value of the provided input. */\n\n\nfunction Gu(t) {\n if (void 0 === t) return \"undefined\";\n if (null === t) return \"null\";\n if (\"string\" == typeof t) return t.length > 20 && (t = t.substring(0, 20) + \"...\"), JSON.stringify(t);\n if (\"number\" == typeof t || \"boolean\" == typeof t) return \"\" + t;\n\n if (\"object\" == typeof t) {\n if (t instanceof Array) return \"an array\";\n\n var e =\n /** Hacky method to try to get the constructor name for an object. */\n function (t) {\n if (t.constructor) {\n var e = /function\\s+([^\\s(]+)\\s*\\(/.exec(t.constructor.toString());\n if (e && e.length > 1) return e[1];\n }\n\n return null;\n }(t);\n\n return e ? \"a custom \" + e + \" object\" : \"an object\";\n }\n\n return \"function\" == typeof t ? \"a function\" : O();\n}\n\nfunction zu(t, // eslint-disable-next-line @typescript-eslint/no-explicit-any\ne) {\n if (\"_delegate\" in t && ( // Unwrap Compat types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n t = t._delegate), !(t instanceof e)) {\n if (e.name === t.constructor.name) throw new D(N.INVALID_ARGUMENT, \"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?\");\n var n = Gu(t);\n throw new D(N.INVALID_ARGUMENT, \"Expected type '\" + e.name + \"', but it was: \" + n);\n }\n\n return t;\n}\n\nfunction Wu(t, e) {\n if (e <= 0) throw new D(N.INVALID_ARGUMENT, \"Function \" + t + \"() requires a positive number, but it was: \" + e + \".\");\n}\n/**\n * @license\n * Copyright 2020 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// settings() defaults:\n\n/**\n * A concrete type describing all the values that can be applied via a\n * user-supplied firestore.Settings object. This is a separate type so that\n * defaults can be supplied and the value can be checked for equality.\n */\n\n\nvar Hu =\n/** @class */\nfunction () {\n function t(t) {\n var e;\n\n if (void 0 === t.host) {\n if (void 0 !== t.ssl) throw new D(N.INVALID_ARGUMENT, \"Can't provide ssl option if host option is not set\");\n this.host = \"firestore.googleapis.com\", this.ssl = !0;\n } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;\n\n if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties, void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040;else {\n if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new D(N.INVALID_ARGUMENT, \"cacheSizeBytes must be at least 1048576\");\n this.cacheSizeBytes = t.cacheSizeBytes;\n }\n this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling, this.useFetchStreams = !!t.useFetchStreams, ju(\"experimentalForceLongPolling\", t.experimentalForceLongPolling, \"experimentalAutoDetectLongPolling\", t.experimentalAutoDetectLongPolling);\n }\n\n return t.prototype.isEqual = function (t) {\n return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;\n }, t;\n}(),\n Yu =\n/** @class */\nfunction () {\n /** @hideconstructor */\n function t(t, e) {\n /**\n * Whether it's a Firestore or Firestore Lite instance.\n */\n this.type = \"firestore-lite\", this._persistenceKey = \"(lite)\", this._settings = new Hu({}), this._settingsFrozen = !1, t instanceof Ru ? (this._databaseId = t, this._credentials = new Pu()) : (this._app = t, this._databaseId = function (t) {\n if (!Object.prototype.hasOwnProperty.apply(t.options, [\"projectId\"])) throw new D(N.INVALID_ARGUMENT, '\"projectId\" not provided in firebase.initializeApp.');\n return new Ru(t.options.projectId);\n }(t), this._credentials = new Mu(e));\n }\n\n return Object.defineProperty(t.prototype, \"app\", {\n /**\n * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service\n * instance.\n */\n get: function get() {\n if (!this._app) throw new D(N.FAILED_PRECONDITION, \"Firestore was not initialized using the Firebase SDK. 'app' is not available\");\n return this._app;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"_initialized\", {\n get: function get() {\n return this._settingsFrozen;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"_terminated\", {\n get: function get() {\n return void 0 !== this._terminateTask;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype._setSettings = function (t) {\n if (this._settingsFrozen) throw new D(N.FAILED_PRECONDITION, \"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.\");\n this._settings = new Hu(t), void 0 !== t.credentials && (this._credentials = function (t) {\n if (!t) return new Pu();\n\n switch (t.type) {\n case \"gapi\":\n var e = t.client; // Make sure this really is a Gapi client.\n\n return P(!(\"object\" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)), new qu(e, t.sessionIndex || \"0\", t.iamToken || null);\n\n case \"provider\":\n return t.client;\n\n default:\n throw new D(N.INVALID_ARGUMENT, \"makeCredentialsProvider failed due to invalid credential type\");\n }\n }(t.credentials));\n }, t.prototype._getSettings = function () {\n return this._settings;\n }, t.prototype._freezeSettings = function () {\n return this._settingsFrozen = !0, this._settings;\n }, t.prototype._delete = function () {\n return this._terminateTask || (this._terminateTask = this._terminate()), this._terminateTask;\n },\n /** Returns a JSON-serializable representation of this Firestore instance. */\n t.prototype.toJSON = function () {\n return {\n app: this._app,\n databaseId: this._databaseId,\n settings: this._settings\n };\n },\n /**\n * Terminates all components used by this client. Subclasses can override\n * this method to clean up their own dependencies, but must also call this\n * method.\n *\n * Only ever called once.\n */\n t.prototype._terminate = function () {\n /**\n * Removes all components associated with the provided instance. Must be called\n * when the `Firestore` instance is terminated.\n */\n return t = this, (e = Lu.get(t)) && (C(\"ComponentProvider\", \"Removing Datastore\"), Lu.delete(t), e.terminate()), Promise.resolve();\n var t, e;\n }, t;\n}(),\n $u =\n/** @class */\nfunction () {\n /** @hideconstructor */\n function t(t,\n /**\n * If provided, the `FirestoreDataConverter` associated with this instance.\n */\n e, n) {\n this.converter = e, this._key = n,\n /** The type of this Firestore reference. */\n this.type = \"document\", this.firestore = t;\n }\n\n return Object.defineProperty(t.prototype, \"_path\", {\n get: function get() {\n return this._key.path;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"id\", {\n /**\n * The document's identifier within its collection.\n */\n get: function get() {\n return this._key.path.lastSegment();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"path\", {\n /**\n * A string representing the path of the referenced document (relative\n * to the root of the database).\n */\n get: function get() {\n return this._key.path.canonicalString();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"parent\", {\n /**\n * The collection this `DocumentReference` belongs to.\n */\n get: function get() {\n return new Ju(this.firestore, this.converter, this._key.path.popLast());\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.withConverter = function (e) {\n return new t(this.firestore, e, this._key);\n }, t;\n}(),\n Xu =\n/** @class */\nfunction () {\n // This is the lite version of the Query class in the main SDK.\n\n /** @hideconstructor protected */\n function t(t,\n /**\n * If provided, the `FirestoreDataConverter` associated with this instance.\n */\n e, n) {\n this.converter = e, this._query = n,\n /** The type of this Firestore reference. */\n this.type = \"query\", this.firestore = t;\n }\n\n return t.prototype.withConverter = function (e) {\n return new t(this.firestore, e, this._query);\n }, t;\n}(),\n Ju =\n/** @class */\nfunction (e) {\n /** @hideconstructor */\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this, t, n, Yt(r)) || this)._path = r,\n /** The type of this Firestore reference. */\n i.type = \"collection\", i;\n }\n\n return t(n, e), Object.defineProperty(n.prototype, \"id\", {\n /** The collection's identifier. */\n get: function get() {\n return this._query.path.lastSegment();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(n.prototype, \"path\", {\n /**\n * A string representing the path of the referenced collection (relative\n * to the root of the database).\n */\n get: function get() {\n return this._query.path.canonicalString();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(n.prototype, \"parent\", {\n /**\n * A reference to the containing `DocumentReference` if this is a\n * subcollection. If this isn't a subcollection, the reference is null.\n */\n get: function get() {\n var t = this._path.popLast();\n\n return t.isEmpty() ? null : new $u(this.firestore,\n /* converter= */\n null, new ct(t));\n },\n enumerable: !1,\n configurable: !0\n }), n.prototype.withConverter = function (t) {\n return new n(this.firestore, t, this._path);\n }, n;\n}(Xu);\n/**\n * @license\n * Copyright 2020 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 * The Cloud Firestore service interface.\n *\n * Do not call this constructor directly. Instead, use {@link getFirestore}.\n */\n\n\nfunction Zu(t, n) {\n for (var r, i = [], o = 2; o < arguments.length; o++) {\n i[o - 2] = arguments[o];\n }\n\n if (t = l(t), Uu(\"collection\", \"path\", n), t instanceof Yu) return Qu(r = H.fromString.apply(H, e([n], i))), new Ju(t,\n /* converter= */\n null, r);\n if (!(t instanceof $u || t instanceof Ju)) throw new D(N.INVALID_ARGUMENT, \"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore\");\n return Qu(r = H.fromString.apply(H, e([t.path], i)).child(H.fromString(n))), new Ju(t.firestore,\n /* converter= */\n null, r);\n} // TODO(firestorelite): Consider using ErrorFactory -\n// https://github.com/firebase/firebase-js-sdk/blob/0131e1f/packages/util/src/errors.ts#L106\n\n/**\n * Creates and returns a new `Query` instance that includes all documents in the\n * database that are contained in a collection or subcollection with the\n * given `collectionId`.\n *\n * @param firestore - A reference to the root Firestore instance.\n * @param collectionId - Identifies the collections to query over. Every\n * collection or subcollection with this ID as the last segment of its path\n * will be included. Cannot contain a slash.\n * @returns The created `Query`.\n */\n\n\nfunction ta(t, n) {\n for (var r, i = [], o = 2; o < arguments.length; o++) {\n i[o - 2] = arguments[o];\n }\n\n if (t = l(t), // We allow omission of 'pathString' but explicitly prohibit passing in both\n // 'undefined' and 'null'.\n 1 === arguments.length && (n = V.u()), Uu(\"doc\", \"path\", n), t instanceof Yu) return Ku(r = H.fromString.apply(H, e([n], i))), new $u(t,\n /* converter= */\n null, new ct(r));\n if (!(t instanceof $u || t instanceof Ju)) throw new D(N.INVALID_ARGUMENT, \"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore\");\n return Ku(r = t._path.child(H.fromString.apply(H, e([n], i)))), new $u(t.firestore, t instanceof Ju ? t.converter : null, new ct(r));\n}\n/**\n * Returns true if the provided references are equal.\n *\n * @param left - A reference to compare.\n * @param right - A reference to compare.\n * @returns true if the references point to the same location in the same\n * Firestore database.\n */\n\n\nfunction ea(t, e) {\n return t = l(t), e = l(e), (t instanceof $u || t instanceof Ju) && (e instanceof $u || e instanceof Ju) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter\n /**\n * Returns true if the provided queries point to the same collection and apply\n * the same constraints.\n *\n * @param left - A `Query` to compare.\n * @param right - A `Query` to compare.\n * @returns true if the references point to the same location in the same\n * Firestore database.\n */\n ;\n}\n\nfunction na(t, e) {\n return t = l(t), e = l(e), t instanceof Xu && e instanceof Xu && t.firestore === e.firestore && ie(t._query, e._query) && t.converter === e.converter\n /**\n * @license\n * Copyright 2020 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\nvar ra =\n/** @class */\nfunction () {\n function t() {\n var t = this; // The last promise in the queue.\n\n this.dc = Promise.resolve(), // A list of retryable operations. Retryable operations are run in order and\n // retried with backoff.\n this.wc = [], // Is this AsyncQueue being shut down? Once it is set to true, it will not\n // be changed again.\n this._c = !1, // Operations scheduled to be queued in the future. Operations are\n // automatically removed after they are run or canceled.\n this.mc = [], // visible for testing\n this.yc = null, // Flag set while there's an outstanding AsyncQueue operation, used for\n // assertion sanity-checks.\n this.gc = !1, // Enabled during shutdown on Safari to prevent future access to IndexedDB.\n this.Ec = !1, // List of TimerIds to fast-forward delays for.\n this.Tc = [], // Backoff timer used to schedule retries for retryable operations\n this.Zi = new xo(this, \"async_queue_retry\"\n /* AsyncQueueRetry */\n ), // Visibility handler that triggers an immediate retry of all retryable\n // operations. Meant to speed up recovery when we regain file system access\n // after page comes into foreground.\n this.Ic = function () {\n var e = ko();\n e && C(\"AsyncQueue\", \"Visibility state changed to \" + e.visibilityState), t.Zi.Gi();\n };\n var e = ko();\n e && \"function\" == typeof e.addEventListener && e.addEventListener(\"visibilitychange\", this.Ic);\n }\n\n return Object.defineProperty(t.prototype, \"isShuttingDown\", {\n get: function get() {\n return this._c;\n },\n enumerable: !1,\n configurable: !0\n }),\n /**\n * Adds a new operation to the queue without waiting for it to complete (i.e.\n * we ignore the Promise result).\n */\n t.prototype.enqueueAndForget = function (t) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.enqueue(t);\n }, t.prototype.enqueueAndForgetEvenWhileRestricted = function (t) {\n this.Ac(), // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.Rc(t);\n }, t.prototype.enterRestrictedMode = function (t) {\n if (!this._c) {\n this._c = !0, this.Ec = t || !1;\n var e = ko();\n e && \"function\" == typeof e.removeEventListener && e.removeEventListener(\"visibilitychange\", this.Ic);\n }\n }, t.prototype.enqueue = function (t) {\n var e = this;\n if (this.Ac(), this._c) // Return a Promise which never resolves.\n return new Promise(function () {}); // Create a deferred Promise that we can return to the callee. This\n // allows us to return a \"hanging Promise\" only to the callee and still\n // advance the queue even when the operation is not run.\n\n var n = new br();\n return this.Rc(function () {\n return e._c && e.Ec ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);\n }).then(function () {\n return n.promise;\n });\n }, t.prototype.enqueueRetryable = function (t) {\n var e = this;\n this.enqueueAndForget(function () {\n return e.wc.push(t), e.bc();\n });\n },\n /**\n * Runs the next operation from the retryable queue. If the operation fails,\n * reschedules with backoff.\n */\n t.prototype.bc = function () {\n return n(this, void 0, void 0, function () {\n var t,\n e = this;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n if (0 === this.wc.length) return [3\n /*break*/\n , 5];\n n.label = 1;\n\n case 1:\n return n.trys.push([1, 3,, 4]), [4\n /*yield*/\n , this.wc[0]()];\n\n case 2:\n return n.sent(), this.wc.shift(), this.Zi.reset(), [3\n /*break*/\n , 4];\n\n case 3:\n if (!Nr(t = n.sent())) throw t; // Failure will be handled by AsyncQueue\n\n return C(\"AsyncQueue\", \"Operation failed with retryable error: \" + t), [3\n /*break*/\n , 4];\n\n case 4:\n this.wc.length > 0 && // If there are additional operations, we re-schedule `retryNextOp()`.\n // This is necessary to run retryable operations that failed during\n // their initial attempt since we don't know whether they are already\n // enqueued. If, for example, `op1`, `op2`, `op3` are enqueued and `op1`\n // needs to be re-run, we will run `op1`, `op1`, `op2` using the\n // already enqueued calls to `retryNextOp()`. `op3()` will then run in the\n // call scheduled here.\n // Since `backoffAndRun()` cancels an existing backoff and schedules a\n // new backoff on every call, there is only ever a single additional\n // operation in the queue.\n this.Zi.ji(function () {\n return e.bc();\n }), n.label = 5;\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n });\n }, t.prototype.Rc = function (t) {\n var e = this,\n n = this.dc.then(function () {\n return e.gc = !0, t().catch(function (t) {\n // Re-throw the error so that this.tail becomes a rejected Promise and\n // all further attempts to chain (via .then) will just short-circuit\n // and return the rejected Promise.\n throw e.yc = t, e.gc = !1, x(\"INTERNAL UNHANDLED ERROR: \",\n /**\n * Chrome includes Error.message in Error.stack. Other browsers do not.\n * This returns expected output of message + stack when available.\n * @param error - Error or FirestoreError\n */\n function (t) {\n var e = t.message || \"\";\n return t.stack && (e = t.stack.includes(t.message) ? t.stack : t.message + \"\\n\" + t.stack), e;\n }(t)), t;\n }).then(function (t) {\n return e.gc = !1, t;\n });\n });\n return this.dc = n, n;\n }, t.prototype.enqueueAfterDelay = function (t, e, n) {\n var r = this;\n this.Ac(), // Fast-forward delays for timerIds that have been overriden.\n this.Tc.indexOf(t) > -1 && (e = 0);\n var i = cs.createAndSchedule(this, t, e, n, function (t) {\n return r.vc(t);\n });\n return this.mc.push(i), i;\n }, t.prototype.Ac = function () {\n this.yc && O();\n }, t.prototype.verifyOperationInProgress = function () {},\n /**\n * Waits until all currently queued tasks are finished executing. Delayed\n * operations are not run.\n */\n t.prototype.Pc = function () {\n return n(this, void 0, void 0, function () {\n var t;\n return r(this, function (e) {\n switch (e.label) {\n case 0:\n return [4\n /*yield*/\n , t = this.dc];\n\n case 1:\n e.sent(), e.label = 2;\n\n case 2:\n if (t !== this.dc) return [3\n /*break*/\n , 0];\n e.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n },\n /**\n * For Tests: Determine if a delayed operation with a particular TimerId\n * exists.\n */\n t.prototype.Vc = function (t) {\n for (var e = 0, n = this.mc; e < n.length; e++) {\n if (n[e].timerId === t) return !0;\n }\n\n return !1;\n },\n /**\n * For Tests: Runs some or all delayed operations early.\n *\n * @param lastTimerId - Delayed operations up to and including this TimerId\n * will be drained. Pass TimerId.All to run all delayed operations.\n * @returns a Promise that resolves once all operations have been run.\n */\n t.prototype.Sc = function (t) {\n var e = this; // Note that draining may generate more delayed ops, so we do that first.\n\n return this.Pc().then(function () {\n // Run ops in the same order they'd run if they ran naturally.\n e.mc.sort(function (t, e) {\n return t.targetTimeMs - e.targetTimeMs;\n });\n\n for (var n = 0, r = e.mc; n < r.length; n++) {\n var i = r[n];\n if (i.skipDelay(), \"all\"\n /* All */\n !== t && i.timerId === t) break;\n }\n\n return e.Pc();\n });\n },\n /**\n * For Tests: Skip all subsequent delays for a timer id.\n */\n t.prototype.Dc = function (t) {\n this.Tc.push(t);\n },\n /** Called once a DelayedOperation is run or canceled. */\n t.prototype.vc = function (t) {\n // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.\n var e = this.mc.indexOf(t);\n this.mc.splice(e, 1);\n }, t;\n}();\n\nfunction ia(t) {\n /**\n * Returns true if obj is an object and contains at least one of the specified\n * methods.\n */\n return function (t, e) {\n if (\"object\" != typeof t || null === t) return !1;\n\n for (var n = t, r = 0, i = [\"next\", \"error\", \"complete\"]; r < i.length; r++) {\n var o = i[r];\n if (o in n && \"function\" == typeof n[o]) return !0;\n }\n\n return !1;\n }(t);\n}\n\nvar oa =\n/** @class */\nfunction () {\n function t() {\n this._progressObserver = {}, this._taskCompletionResolver = new br(), this._lastProgress = {\n taskState: \"Running\",\n totalBytes: 0,\n totalDocuments: 0,\n bytesLoaded: 0,\n documentsLoaded: 0\n }\n /**\n * Registers functions to listen to bundle loading progress events.\n * @param next - Called when there is a progress update from bundle loading. Typically `next` calls occur\n * each time a Firestore document is loaded from the bundle.\n * @param error - Called when an error occurs during bundle loading. The task aborts after reporting the\n * error, and there should be no more updates after this.\n * @param complete - Called when the loading task is complete.\n */\n ;\n }\n\n return t.prototype.onProgress = function (t, e, n) {\n this._progressObserver = {\n next: t,\n error: e,\n complete: n\n };\n },\n /**\n * Implements the `Promise.catch` interface.\n *\n * @param onRejected - Called when an error occurs during bundle loading.\n */\n t.prototype.catch = function (t) {\n return this._taskCompletionResolver.promise.catch(t);\n },\n /**\n * Implements the `Promise.then` interface.\n *\n * @param onFulfilled - Called on the completion of the loading task with a final `LoadBundleTaskProgress` update.\n * The update will always have its `taskState` set to `\"Success\"`.\n * @param onRejected - Called when an error occurs during bundle loading.\n */\n t.prototype.then = function (t, e) {\n return this._taskCompletionResolver.promise.then(t, e);\n },\n /**\n * Notifies all observers that bundle loading has completed, with a provided\n * `LoadBundleTaskProgress` object.\n *\n * @private\n */\n t.prototype._completeWith = function (t) {\n this._updateProgress(t), this._progressObserver.complete && this._progressObserver.complete(), this._taskCompletionResolver.resolve(t);\n },\n /**\n * Notifies all observers that bundle loading has failed, with a provided\n * `Error` as the reason.\n *\n * @private\n */\n t.prototype._failWith = function (t) {\n this._lastProgress.taskState = \"Error\", this._progressObserver.next && this._progressObserver.next(this._lastProgress), this._progressObserver.error && this._progressObserver.error(t), this._taskCompletionResolver.reject(t);\n },\n /**\n * Notifies a progress update of loading a bundle.\n * @param progress - The new progress.\n *\n * @private\n */\n t.prototype._updateProgress = function (t) {\n this._lastProgress = t, this._progressObserver.next && this._progressObserver.next(t);\n }, t;\n}(),\n sa = -1,\n ua =\n/** @class */\nfunction (e) {\n /** @hideconstructor */\n function n(t, n) {\n var r = this;\n /**\n * Whether it's a Firestore or Firestore Lite instance.\n */\n\n return (r = e.call(this, t, n) || this).type = \"firestore\", r._queue = new ra(), r._persistenceKey = \"name\" in t ? t.name : \"[DEFAULT]\", r;\n }\n\n return t(n, e), n.prototype._terminate = function () {\n return this._firestoreClient || // The client must be initialized to ensure that all subsequent API\n // usage throws an exception.\n ca(this), this._firestoreClient.terminate();\n }, n;\n}(Yu);\n/**\n * @license\n * Copyright 2020 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/** DOMException error code constants. */\n\n/**\n * @internal\n */\n\n\nfunction aa(t) {\n return t._firestoreClient || ca(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;\n}\n\nfunction ca(t) {\n var e,\n n = t._freezeSettings(),\n r = function (t, e, n, r) {\n return new xu(t, e, n, r.host, r.ssl, r.experimentalForceLongPolling, r.experimentalAutoDetectLongPolling, r.useFetchStreams);\n }(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || \"\", t._persistenceKey, n);\n\n t._firestoreClient = new wu(t._credentials, t._queue, r);\n}\n/**\n * Attempts to enable persistent storage, if possible.\n *\n * Must be called before any other functions (other than\n * {@link initializeFirestore}, {@link getFirestore} or\n * {@link clearIndexedDbPersistence}.\n *\n * If this fails, `enableIndexedDbPersistence()` will reject the promise it\n * returns. Note that even after this failure, the `Firestore` instance will\n * remain usable, however offline persistence will be disabled.\n *\n * There are several reasons why this can fail, which can be identified by\n * the `code` on the error.\n *\n * * failed-precondition: The app is already open in another browser tab.\n * * unimplemented: The browser is incompatible with the offline\n * persistence implementation.\n *\n * @param firestore - The `Firestore` instance to enable persistence for.\n * @param persistenceSettings - Optional settings object to configure\n * persistence.\n * @returns A promise that represents successfully enabling persistent storage.\n */\n\n/**\n * Registers both the `OfflineComponentProvider` and `OnlineComponentProvider`.\n * If the operation fails with a recoverable error (see\n * `canRecoverFromIndexedDbError()` below), the returned Promise is rejected\n * but the client remains usable.\n */\n\n\nfunction ha(t, e, i) {\n var o = this,\n s = new br();\n return t.asyncQueue.enqueue(function () {\n return n(o, void 0, void 0, function () {\n var n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return r.trys.push([0, 3,, 4]), [4\n /*yield*/\n , bu(t, i)];\n\n case 1:\n return r.sent(), [4\n /*yield*/\n , Iu(t, e)];\n\n case 2:\n return r.sent(), s.resolve(), [3\n /*break*/\n , 4];\n\n case 3:\n if (!\n /**\n * Decides whether the provided error allows us to gracefully disable\n * persistence (as opposed to crashing the client).\n */\n function (t) {\n return \"FirebaseError\" === t.name ? t.code === N.FAILED_PRECONDITION || t.code === N.UNIMPLEMENTED : !(\"undefined\" != typeof DOMException && t instanceof DOMException) || 22 === t.code || 20 === t.code || // Firefox Private Browsing mode disables IndexedDb and returns\n // INVALID_STATE for any usage.\n 11 === t.code;\n }(n = r.sent())) throw n;\n return console.warn(\"Error enabling offline persistence. Falling back to persistence disabled: \" + n), s.reject(n), [3\n /*break*/\n , 4];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n }).then(function () {\n return s.promise;\n });\n}\n/**\n * Re-enables use of the network for this Firestore instance after a prior\n * call to {@link disableNetwork}.\n *\n * @returns A promise that is resolved once the network has been enabled.\n */\n\n\nfunction fa(t) {\n if (t._initialized || t._terminated) throw new D(N.FAILED_PRECONDITION, \"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.\");\n}\n/**\n * @license\n * Copyright 2020 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 * A `FieldPath` refers to a field in a document. The path may consist of a\n * single field name (referring to a top-level field in the document), or a\n * list of field names (referring to a nested field in the document).\n *\n * Create a `FieldPath` by providing field names. If more than one field\n * name is provided, the path will point to a nested field in a document.\n */\n\n\nvar la =\n/** @class */\nfunction () {\n /**\n * Creates a FieldPath from the provided field names. If more than one field\n * name is provided, the path will point to a nested field in a document.\n *\n * @param fieldNames - A list of field names.\n */\n function t() {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n }\n\n for (var n = 0; n < t.length; ++n) {\n if (0 === t[n].length) throw new D(N.INVALID_ARGUMENT, \"Invalid field name at argument $(i + 1). Field names must not be empty.\");\n }\n\n this._internalPath = new $(t);\n }\n /**\n * Returns true if this `FieldPath` is equal to the provided one.\n *\n * @param other - The `FieldPath` to compare against.\n * @returns true if this `FieldPath` is equal to the provided one.\n */\n\n\n return t.prototype.isEqual = function (t) {\n return this._internalPath.isEqual(t._internalPath);\n }, t;\n}(),\n da =\n/** @class */\nfunction () {\n /** @hideconstructor */\n function t(t) {\n this._byteString = t;\n }\n /**\n * Creates a new `Bytes` object from the given Base64 string, converting it to\n * bytes.\n *\n * @param base64 - The Base64 string used to create the `Bytes` object.\n */\n\n\n return t.fromBase64String = function (e) {\n try {\n return new t(J.fromBase64String(e));\n } catch (e) {\n throw new D(N.INVALID_ARGUMENT, \"Failed to construct data from Base64 string: \" + e);\n }\n },\n /**\n * Creates a new `Bytes` object from the given Uint8Array.\n *\n * @param array - The Uint8Array used to create the `Bytes` object.\n */\n t.fromUint8Array = function (e) {\n return new t(J.fromUint8Array(e));\n },\n /**\n * Returns the underlying bytes as a Base64-encoded string.\n *\n * @returns The Base64-encoded string created from the `Bytes` object.\n */\n t.prototype.toBase64 = function () {\n return this._byteString.toBase64();\n },\n /**\n * Returns the underlying bytes in a new `Uint8Array`.\n *\n * @returns The Uint8Array created from the `Bytes` object.\n */\n t.prototype.toUint8Array = function () {\n return this._byteString.toUint8Array();\n },\n /**\n * Returns a string representation of the `Bytes` object.\n *\n * @returns A string representation of the `Bytes` object.\n */\n t.prototype.toString = function () {\n return \"Bytes(base64: \" + this.toBase64() + \")\";\n },\n /**\n * Returns true if this `Bytes` object is equal to the provided one.\n *\n * @param other - The `Bytes` object to compare against.\n * @returns true if this `Bytes` object is equal to the provided one.\n */\n t.prototype.isEqual = function (t) {\n return this._byteString.isEqual(t._byteString);\n }, t;\n}(),\n pa =\n/**\n * @param _methodName - The public API endpoint that returns this class.\n * @hideconstructor\n */\nfunction pa(t) {\n this._methodName = t;\n},\n ya =\n/** @class */\nfunction () {\n /**\n * Creates a new immutable `GeoPoint` object with the provided latitude and\n * longitude values.\n * @param latitude - The latitude as number between -90 and 90.\n * @param longitude - The longitude as number between -180 and 180.\n */\n function t(t, e) {\n if (!isFinite(t) || t < -90 || t > 90) throw new D(N.INVALID_ARGUMENT, \"Latitude must be a number between -90 and 90, but was: \" + t);\n if (!isFinite(e) || e < -180 || e > 180) throw new D(N.INVALID_ARGUMENT, \"Longitude must be a number between -180 and 180, but was: \" + e);\n this._lat = t, this._long = e;\n }\n\n return Object.defineProperty(t.prototype, \"latitude\", {\n /**\n * The latitude of this `GeoPoint` instance.\n */\n get: function get() {\n return this._lat;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"longitude\", {\n /**\n * The longitude of this `GeoPoint` instance.\n */\n get: function get() {\n return this._long;\n },\n enumerable: !1,\n configurable: !0\n }),\n /**\n * Returns true if this `GeoPoint` is equal to the provided one.\n *\n * @param other - The `GeoPoint` to compare against.\n * @returns true if this `GeoPoint` is equal to the provided one.\n */\n t.prototype.isEqual = function (t) {\n return this._lat === t._lat && this._long === t._long;\n },\n /** Returns a JSON-serializable representation of this GeoPoint. */\n t.prototype.toJSON = function () {\n return {\n latitude: this._lat,\n longitude: this._long\n };\n },\n /**\n * Actually private to JS consumers of our API, so this function is prefixed\n * with an underscore.\n */\n t.prototype._compareTo = function (t) {\n return q(this._lat, t._lat) || q(this._long, t._long);\n }, t;\n}(),\n va = /^__.*__$/,\n ma =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this.data = t, this.fieldMask = e, this.fieldTransforms = n;\n }\n\n return t.prototype.toMutation = function (t, e) {\n return null !== this.fieldMask ? new Fe(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Pe(t, this.data, e, this.fieldTransforms);\n }, t;\n}(),\n ga =\n/** @class */\nfunction () {\n function t(t, // The fieldMask does not include document transforms.\n e, n) {\n this.data = t, this.fieldMask = e, this.fieldTransforms = n;\n }\n\n return t.prototype.toMutation = function (t, e) {\n return new Fe(t, this.data, this.fieldMask, e, this.fieldTransforms);\n }, t;\n}();\n/**\n * @license\n * Copyright 2020 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 * An immutable object representing an array of bytes.\n */\n\n\nfunction wa(t) {\n switch (t) {\n case 0\n /* Set */\n : // fall through\n\n case 2\n /* MergeSet */\n : // fall through\n\n case 1\n /* Update */\n :\n return !0;\n\n case 3\n /* Argument */\n :\n case 4\n /* ArrayArgument */\n :\n return !1;\n\n default:\n throw O();\n }\n}\n/** A \"context\" object passed around while parsing user data. */\n\n\nvar ba =\n/** @class */\nfunction () {\n /**\n * Initializes a ParseContext with the given source and path.\n *\n * @param settings - The settings for the parser.\n * @param databaseId - The database ID of the Firestore instance.\n * @param serializer - The serializer to use to generate the Value proto.\n * @param ignoreUndefinedProperties - Whether to ignore undefined properties\n * rather than throw.\n * @param fieldTransforms - A mutable list of field transforms encountered\n * while parsing the data.\n * @param fieldMask - A mutable list of field paths encountered while parsing\n * the data.\n *\n * TODO(b/34871131): We don't support array paths right now, so path can be\n * null to indicate the context represents any location within an array (in\n * which case certain features will not work and errors will be somewhat\n * compromised).\n */\n function t(t, e, n, r, i, o) {\n this.settings = t, this.databaseId = e, this.R = n, this.ignoreUndefinedProperties = r, // Minor hack: If fieldTransforms is undefined, we assume this is an\n // external call and we need to validate the entire path.\n void 0 === i && this.Cc(), this.fieldTransforms = i || [], this.fieldMask = o || [];\n }\n\n return Object.defineProperty(t.prototype, \"path\", {\n get: function get() {\n return this.settings.path;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"Nc\", {\n get: function get() {\n return this.settings.Nc;\n },\n enumerable: !1,\n configurable: !0\n }),\n /** Returns a new context with the specified settings overwritten. */\n t.prototype.xc = function (e) {\n return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.R, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);\n }, t.prototype.kc = function (t) {\n var e,\n n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t),\n r = this.xc({\n path: n,\n Fc: !1\n });\n return r.$c(t), r;\n }, t.prototype.Oc = function (t) {\n var e,\n n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t),\n r = this.xc({\n path: n,\n Fc: !1\n });\n return r.Cc(), r;\n }, t.prototype.Mc = function (t) {\n // TODO(b/34871131): We don't support array paths right now; so make path\n // undefined.\n return this.xc({\n path: void 0,\n Fc: !0\n });\n }, t.prototype.Lc = function (t) {\n return Ua(t, this.settings.methodName, this.settings.Bc || !1, this.path, this.settings.qc);\n },\n /** Returns 'true' if 'fieldPath' was traversed when creating this context. */\n t.prototype.contains = function (t) {\n return void 0 !== this.fieldMask.find(function (e) {\n return t.isPrefixOf(e);\n }) || void 0 !== this.fieldTransforms.find(function (e) {\n return t.isPrefixOf(e.field);\n });\n }, t.prototype.Cc = function () {\n // TODO(b/34871131): Remove null check once we have proper paths for fields\n // within arrays.\n if (this.path) for (var t = 0; t < this.path.length; t++) {\n this.$c(this.path.get(t));\n }\n }, t.prototype.$c = function (t) {\n if (0 === t.length) throw this.Lc(\"Document fields must not be empty\");\n if (wa(this.Nc) && va.test(t)) throw this.Lc('Document fields cannot begin and end with \"__\"');\n }, t;\n}(),\n Ia =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this.databaseId = t, this.ignoreUndefinedProperties = e, this.R = n || Co(t)\n /** Creates a new top-level parse context. */\n ;\n }\n\n return t.prototype.Uc = function (t, e, n, r) {\n return void 0 === r && (r = !1), new ba({\n Nc: t,\n methodName: e,\n qc: n,\n path: $.emptyPath(),\n Fc: !1,\n Bc: r\n }, this.databaseId, this.R, this.ignoreUndefinedProperties);\n }, t;\n}();\n/**\n * Helper for parsing raw user input (provided via the API) into internal model\n * classes.\n */\n\n\nfunction Ta(t) {\n var e = t._freezeSettings(),\n n = Co(t._databaseId);\n\n return new Ia(t._databaseId, !!e.ignoreUndefinedProperties, n);\n}\n/** Parse document data from a set() call. */\n\n\nfunction Ea(t, e, n, r, i, o) {\n void 0 === o && (o = {});\n var s = t.Uc(o.merge || o.mergeFields ? 2\n /* MergeSet */\n : 0\n /* Set */\n , e, n, i);\n Fa(\"Data must be an object, but it was:\", s, r);\n var u,\n a,\n c = Oa(r, s);\n if (o.merge) u = new X(s.fieldMask), a = s.fieldTransforms;else if (o.mergeFields) {\n for (var h = [], f = 0, l = o.mergeFields; f < l.length; f++) {\n var d = Ma(e, l[f], n);\n if (!s.contains(d)) throw new D(N.INVALID_ARGUMENT, \"Field '\" + d + \"' is specified in your field mask but missing from your input data.\");\n Ba(h, d) || h.push(d);\n }\n\n u = new X(h), a = s.fieldTransforms.filter(function (t) {\n return u.covers(t.field);\n });\n } else u = null, a = s.fieldTransforms;\n return new ma(new _t(c), u, a);\n}\n\nvar _a =\n/** @class */\nfunction (e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n\n return t(n, e), n.prototype._toFieldTransform = function (t) {\n if (2\n /* MergeSet */\n !== t.Nc) throw 1\n /* Update */\n === t.Nc ? t.Lc(this._methodName + \"() can only appear at the top level of your update data\") : t.Lc(this._methodName + \"() cannot be used with set() unless you pass {merge:true}\"); // No transform to add for a delete, but we need to add it to our\n // fieldMask so it gets deleted.\n\n return t.fieldMask.push(t.path), null;\n }, n.prototype.isEqual = function (t) {\n return t instanceof n;\n }, n;\n}(pa);\n/**\n * Creates a child context for parsing SerializableFieldValues.\n *\n * This is different than calling `ParseContext.contextWith` because it keeps\n * the fieldTransforms and fieldMask separate.\n *\n * The created context has its `dataSource` set to `UserDataSource.Argument`.\n * Although these values are used with writes, any elements in these FieldValues\n * are not considered writes since they cannot contain any FieldValue sentinels,\n * etc.\n *\n * @param fieldValue - The sentinel FieldValue for which to create a child\n * context.\n * @param context - The parent context.\n * @param arrayElement - Whether or not the FieldValue has an array.\n */\n\n\nfunction Sa(t, e, n) {\n return new ba({\n Nc: 3\n /* Argument */\n ,\n qc: e.settings.qc,\n methodName: t._methodName,\n Fc: n\n }, e.databaseId, e.R, e.ignoreUndefinedProperties);\n}\n\nvar Na =\n/** @class */\nfunction (e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n\n return t(n, e), n.prototype._toFieldTransform = function (t) {\n return new Se(t.path, new me());\n }, n.prototype.isEqual = function (t) {\n return t instanceof n;\n }, n;\n}(pa),\n Da =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t) || this).Kc = n, r;\n }\n\n return t(n, e), n.prototype._toFieldTransform = function (t) {\n var e = Sa(this, t,\n /*array=*/\n !0),\n n = this.Kc.map(function (t) {\n return La(t, e);\n }),\n r = new ge(n);\n return new Se(t.path, r);\n }, n.prototype.isEqual = function (t) {\n // TODO(mrschmidt): Implement isEquals\n return this === t;\n }, n;\n}(pa),\n Aa =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t) || this).Kc = n, r;\n }\n\n return t(n, e), n.prototype._toFieldTransform = function (t) {\n var e = Sa(this, t,\n /*array=*/\n !0),\n n = this.Kc.map(function (t) {\n return La(t, e);\n }),\n r = new be(n);\n return new Se(t.path, r);\n }, n.prototype.isEqual = function (t) {\n // TODO(mrschmidt): Implement isEquals\n return this === t;\n }, n;\n}(pa),\n ka =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t) || this).Qc = n, r;\n }\n\n return t(n, e), n.prototype._toFieldTransform = function (t) {\n var e = new Te(t.R, le(t.R, this.Qc));\n return new Se(t.path, e);\n }, n.prototype.isEqual = function (t) {\n // TODO(mrschmidt): Implement isEquals\n return this === t;\n }, n;\n}(pa);\n/** Parse update data from an update() call. */\n\n\nfunction Ca(t, e, n, r) {\n var i = t.Uc(1\n /* Update */\n , e, n);\n Fa(\"Data must be an object, but it was:\", i, r);\n\n var o = [],\n s = _t.empty();\n\n G(r, function (t, r) {\n var u = qa(e, t, n); // For Compat types, we have to \"extract\" the underlying types before\n // performing validation.\n\n r = l(r);\n var a = i.Oc(u);\n if (r instanceof _a) // Add it to the field mask, but don't add anything to updateData.\n o.push(u);else {\n var c = La(r, a);\n null != c && (o.push(u), s.set(u, c));\n }\n });\n var u = new X(o);\n return new ga(s, u, i.fieldTransforms);\n}\n/** Parse update data from a list of field/value arguments. */\n\n\nfunction xa(t, e, n, r, i, o) {\n var s = t.Uc(1\n /* Update */\n , e, n),\n u = [Ma(e, r, n)],\n a = [i];\n if (o.length % 2 != 0) throw new D(N.INVALID_ARGUMENT, \"Function \" + e + \"() needs to be called with an even number of arguments that alternate between field names and values.\");\n\n for (var c = 0; c < o.length; c += 2) {\n u.push(Ma(e, o[c])), a.push(o[c + 1]);\n } // We iterate in reverse order to pick the last value for a field if the\n // user specified the field multiple times.\n\n\n for (var h = [], f = _t.empty(), d = u.length - 1; d >= 0; --d) {\n if (!Ba(h, u[d])) {\n var p = u[d],\n y = a[d]; // For Compat types, we have to \"extract\" the underlying types before\n // performing validation.\n\n y = l(y);\n var v = s.Oc(p);\n if (y instanceof _a) // Add it to the field mask, but don't add anything to updateData.\n h.push(p);else {\n var m = La(y, v);\n null != m && (h.push(p), f.set(p, m));\n }\n }\n }\n\n var g = new X(h);\n return new ga(f, g, s.fieldTransforms);\n}\n/**\n * Parse a \"query value\" (e.g. value in a where filter or a value in a cursor\n * bound).\n *\n * @param allowArrays - Whether the query value is an array that may directly\n * contain additional arrays (e.g. the operand of an `in` query).\n */\n\n\nfunction Ra(t, e, n, r) {\n return void 0 === r && (r = !1), La(n, t.Uc(r ? 4\n /* ArrayArgument */\n : 3\n /* Argument */\n , e));\n}\n/**\n * Parses user data to Protobuf Values.\n *\n * @param input - Data to be parsed.\n * @param context - A context object representing the current path being parsed,\n * the source of the data being parsed, etc.\n * @returns The parsed value, or null if the value was a FieldValue sentinel\n * that should not be included in the resulting parsed data.\n */\n\n\nfunction La(t, e) {\n if (Pa( // Unwrap the API type from the Compat SDK. This will return the API type\n // from firestore-exp.\n t = l(t))) return Fa(\"Unsupported field value:\", e, t), Oa(t, e);\n if (t instanceof pa) // FieldValues usually parse into transforms (except FieldValue.delete())\n // in which case we do not want to include this field in our parsed data\n // (as doing so will overwrite the field directly prior to the transform\n // trying to transform it). So we don't add this location to\n // context.fieldMask and we return null as our parsing result.\n\n /**\n * \"Parses\" the provided FieldValueImpl, adding any necessary transforms to\n * context.fieldTransforms.\n */\n return function (t, e) {\n // Sentinels are only supported with writes, and not within arrays.\n if (!wa(e.Nc)) throw e.Lc(t._methodName + \"() can only be used with update() and set()\");\n if (!e.path) throw e.Lc(t._methodName + \"() is not currently supported inside arrays\");\n\n var n = t._toFieldTransform(e);\n\n n && e.fieldTransforms.push(n);\n }(t, e), null;\n if (void 0 === t && e.ignoreUndefinedProperties) // If the input is undefined it can never participate in the fieldMask, so\n // don't handle this below. If `ignoreUndefinedProperties` is false,\n // `parseScalarValue` will reject an undefined value.\n return null;\n\n if ( // If context.path is null we are inside an array and we don't support\n // field mask paths more granular than the top-level array.\n e.path && e.fieldMask.push(e.path), t instanceof Array) {\n // TODO(b/34871131): Include the path containing the array in the error\n // message.\n // In the case of IN queries, the parsed data is an array (representing\n // the set of values to be included for the IN query) that may directly\n // contain additional arrays (each representing an individual field\n // value), so we disable this validation.\n if (e.settings.Fc && 4\n /* ArrayArgument */\n !== e.Nc) throw e.Lc(\"Nested arrays are not supported\");\n return function (t, e) {\n for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {\n var s = La(o[i], e.Mc(r));\n null == s && ( // Just include nulls in the array for fields being replaced with a\n // sentinel.\n s = {\n nullValue: \"NULL_VALUE\"\n }), n.push(s), r++;\n }\n\n return {\n arrayValue: {\n values: n\n }\n };\n }(t, e);\n }\n\n return function (t, e) {\n if (null === (t = l(t))) return {\n nullValue: \"NULL_VALUE\"\n };\n if (\"number\" == typeof t) return le(e.R, t);\n if (\"boolean\" == typeof t) return {\n booleanValue: t\n };\n if (\"string\" == typeof t) return {\n stringValue: t\n };\n\n if (t instanceof Date) {\n var n = j.fromDate(t);\n return {\n timestampValue: In(e.R, n)\n };\n }\n\n if (t instanceof j) {\n // Firestore backend truncates precision down to microseconds. To ensure\n // offline mode works the same with regards to truncation, perform the\n // truncation immediately without waiting for the backend to do that.\n n = new j(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));\n return {\n timestampValue: In(e.R, n)\n };\n }\n\n if (t instanceof ya) return {\n geoPointValue: {\n latitude: t.latitude,\n longitude: t.longitude\n }\n };\n if (t instanceof da) return {\n bytesValue: Tn(e.R, t._byteString)\n };\n\n if (t instanceof $u) {\n n = e.databaseId;\n var r = t.firestore._databaseId;\n if (!r.isEqual(n)) throw e.Lc(\"Document reference is for database \" + r.projectId + \"/\" + r.database + \" but should be for database \" + n.projectId + \"/\" + n.database);\n return {\n referenceValue: Sn(t.firestore._databaseId || e.databaseId, t._key.path)\n };\n }\n\n throw e.Lc(\"Unsupported field value: \" + Gu(t));\n }(t, e);\n}\n\nfunction Oa(t, e) {\n var n = {};\n return z(t) ? // If we encounter an empty object, we explicitly add it to the update\n // mask to ensure that the server creates a map entry.\n e.path && e.path.length > 0 && e.fieldMask.push(e.path) : G(t, function (t, r) {\n var i = La(r, e.kc(t));\n null != i && (n[t] = i);\n }), {\n mapValue: {\n fields: n\n }\n };\n}\n\nfunction Pa(t) {\n return !(\"object\" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof j || t instanceof ya || t instanceof da || t instanceof $u || t instanceof pa);\n}\n\nfunction Fa(t, e, n) {\n if (!Pa(n) || !function (t) {\n return \"object\" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));\n }(n)) {\n var r = Gu(n);\n throw \"an object\" === r ? e.Lc(t + \" a custom object\") : e.Lc(t + \" \" + r);\n }\n}\n/**\n * Helper that calls fromDotSeparatedString() but wraps any error thrown.\n */\n\n\nfunction Ma(t, e, n) {\n if ( // If required, replace the FieldPath Compat class with with the firestore-exp\n // FieldPath.\n (e = l(e)) instanceof la) return e._internalPath;\n if (\"string\" == typeof e) return qa(t, e);\n throw Ua(\"Field path arguments must be of type string or FieldPath.\", t,\n /* hasConverter= */\n !1,\n /* path= */\n void 0, n);\n}\n/**\n * Matches any characters in a field path string that are reserved.\n */\n\n\nvar Va = new RegExp(\"[~\\\\*/\\\\[\\\\]]\");\n/**\n * Wraps fromDotSeparatedString with an error message about the method that\n * was thrown.\n * @param methodName - The publicly visible method name\n * @param path - The dot-separated string form of a field path which will be\n * split on dots.\n * @param targetDoc - The document against which the field path will be\n * evaluated.\n */\n\nfunction qa(t, n, r) {\n if (n.search(Va) >= 0) throw Ua(\"Invalid field path (\" + n + \"). Paths must not contain '~', '*', '/', '[', or ']'\", t,\n /* hasConverter= */\n !1,\n /* path= */\n void 0, r);\n\n try {\n return new (la.bind.apply(la, e([void 0], n.split(\".\"))))()._internalPath;\n } catch (e) {\n throw Ua(\"Invalid field path (\" + n + \"). Paths must not be empty, begin with '.', end with '.', or contain '..'\", t,\n /* hasConverter= */\n !1,\n /* path= */\n void 0, r);\n }\n}\n\nfunction Ua(t, e, n, r, i) {\n var o = r && !r.isEmpty(),\n s = void 0 !== i,\n u = \"Function \" + e + \"() called with invalid data\";\n n && (u += \" (via `toFirestore()`)\");\n var a = \"\";\n return (o || s) && (a += \" (found\", o && (a += \" in field \" + r), s && (a += \" in document \" + i), a += \")\"), new D(N.INVALID_ARGUMENT, (u += \". \") + t + a)\n /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */\n ;\n}\n\nfunction Ba(t, e) {\n return t.some(function (t) {\n return t.isEqual(e);\n });\n}\n/**\n * @license\n * Copyright 2020 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 * A `DocumentSnapshot` contains data read from a document in your Firestore\n * database. The data can be extracted with `.data()` or `.get()` to\n * get a specific field.\n *\n * For a `DocumentSnapshot` that points to a non-existing document, any data\n * access will return 'undefined'. You can use the `exists()` method to\n * explicitly verify a document's existence.\n */\n\n\nvar ja =\n/** @class */\nfunction () {\n // Note: This class is stripped down version of the DocumentSnapshot in\n // the legacy SDK. The changes are:\n // - No support for SnapshotMetadata.\n // - No support for SnapshotOptions.\n\n /** @hideconstructor protected */\n function t(t, e, n, r, i) {\n this._firestore = t, this._userDataWriter = e, this._key = n, this._document = r, this._converter = i;\n }\n\n return Object.defineProperty(t.prototype, \"id\", {\n /** Property of the `DocumentSnapshot` that provides the document's ID. */\n get: function get() {\n return this._key.path.lastSegment();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"ref\", {\n /**\n * The `DocumentReference` for the document included in the `DocumentSnapshot`.\n */\n get: function get() {\n return new $u(this._firestore, this._converter, this._key);\n },\n enumerable: !1,\n configurable: !0\n }),\n /**\n * Signals whether or not the document at the snapshot's location exists.\n *\n * @returns true if the document exists.\n */\n t.prototype.exists = function () {\n return null !== this._document;\n },\n /**\n * Retrieves all fields in the document as an `Object`. Returns `undefined` if\n * the document doesn't exist.\n *\n * @returns An `Object` containing all fields in the document or `undefined`\n * if the document doesn't exist.\n */\n t.prototype.data = function () {\n if (this._document) {\n if (this._converter) {\n // We only want to use the converter and create a new DocumentSnapshot\n // if a converter has been provided.\n var t = new Ka(this._firestore, this._userDataWriter, this._key, this._document,\n /* converter= */\n null);\n return this._converter.fromFirestore(t);\n }\n\n return this._userDataWriter.convertValue(this._document.data.value);\n }\n },\n /**\n * Retrieves the field specified by `fieldPath`. Returns `undefined` if the\n * document or field doesn't exist.\n *\n * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific\n * field.\n * @returns The data at the specified field location or undefined if no such\n * field exists in the document.\n */\n // We are using `any` here to avoid an explicit cast by our users.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n t.prototype.get = function (t) {\n if (this._document) {\n var e = this._document.data.field(Qa(\"DocumentSnapshot.get\", t));\n\n if (null !== e) return this._userDataWriter.convertValue(e);\n }\n }, t;\n}(),\n Ka =\n/** @class */\nfunction (e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n /**\n * Retrieves all fields in the document as an `Object`.\n *\n * @override\n * @returns An `Object` containing all fields in the document.\n */\n\n\n return t(n, e), n.prototype.data = function () {\n return e.prototype.data.call(this);\n }, n;\n}(ja);\n/**\n * A `QueryDocumentSnapshot` contains data read from a document in your\n * Firestore database as part of a query. The document is guaranteed to exist\n * and its data can be extracted with `.data()` or `.get()` to get a\n * specific field.\n *\n * A `QueryDocumentSnapshot` offers the same API surface as a\n * `DocumentSnapshot`. Since query results contain only existing documents, the\n * `exists` property will always be true and `data()` will never return\n * 'undefined'.\n */\n\n/**\n * Helper that calls fromDotSeparatedString() but wraps any error thrown.\n */\n\n\nfunction Qa(t, e) {\n return \"string\" == typeof e ? qa(t, e) : e instanceof la ? e._internalPath : e._delegate._internalPath;\n}\n/**\n * @license\n * Copyright 2020 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 * Metadata about a snapshot, describing the state of the snapshot.\n */\n\n\nvar Ga =\n/** @class */\nfunction () {\n /** @hideconstructor */\n function t(t, e) {\n this.hasPendingWrites = t, this.fromCache = e\n /**\n * Returns true if this `SnapshotMetadata` is equal to the provided one.\n *\n * @param other - The `SnapshotMetadata` to compare against.\n * @returns true if this `SnapshotMetadata` is equal to the provided one.\n */\n ;\n }\n\n return t.prototype.isEqual = function (t) {\n return this.hasPendingWrites === t.hasPendingWrites && this.fromCache === t.fromCache;\n }, t;\n}(),\n za =\n/** @class */\nfunction (e) {\n /** @hideconstructor protected */\n function n(t, n, r, i, o, s) {\n var u = this;\n return (u = e.call(this, t, n, r, i, s) || this)._firestore = t, u._firestoreImpl = t, u.metadata = o, u;\n }\n /**\n * Property of the `DocumentSnapshot` that signals whether or not the data\n * exists. True if the document exists.\n */\n\n\n return t(n, e), n.prototype.exists = function () {\n return e.prototype.exists.call(this);\n },\n /**\n * Retrieves all fields in the document as an `Object`. Returns `undefined` if\n * the document doesn't exist.\n *\n * By default, `FieldValue.serverTimestamp()` values that have not yet been\n * set to their final value will be returned as `null`. You can override\n * this by passing an options object.\n *\n * @param options - An options object to configure how data is retrieved from\n * the snapshot (for example the desired behavior for server timestamps that\n * have not yet been set to their final value).\n * @returns An `Object` containing all fields in the document or `undefined` if\n * the document doesn't exist.\n */\n n.prototype.data = function (t) {\n if (void 0 === t && (t = {}), this._document) {\n if (this._converter) {\n // We only want to use the converter and create a new DocumentSnapshot\n // if a converter has been provided.\n var e = new Wa(this._firestore, this._userDataWriter, this._key, this._document, this.metadata,\n /* converter= */\n null);\n return this._converter.fromFirestore(e, t);\n }\n\n return this._userDataWriter.convertValue(this._document.data.value, t.serverTimestamps);\n }\n },\n /**\n * Retrieves the field specified by `fieldPath`. Returns `undefined` if the\n * document or field doesn't exist.\n *\n * By default, a `FieldValue.serverTimestamp()` that has not yet been set to\n * its final value will be returned as `null`. You can override this by\n * passing an options object.\n *\n * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific\n * field.\n * @param options - An options object to configure how the field is retrieved\n * from the snapshot (for example the desired behavior for server timestamps\n * that have not yet been set to their final value).\n * @returns The data at the specified field location or undefined if no such\n * field exists in the document.\n */\n // We are using `any` here to avoid an explicit cast by our users.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n n.prototype.get = function (t, e) {\n if (void 0 === e && (e = {}), this._document) {\n var n = this._document.data.field(Qa(\"DocumentSnapshot.get\", t));\n\n if (null !== n) return this._userDataWriter.convertValue(n, e.serverTimestamps);\n }\n }, n;\n}(ja),\n Wa =\n/** @class */\nfunction (e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n /**\n * Retrieves all fields in the document as an `Object`.\n *\n * By default, `FieldValue.serverTimestamp()` values that have not yet been\n * set to their final value will be returned as `null`. You can override\n * this by passing an options object.\n *\n * @override\n * @param options - An options object to configure how data is retrieved from\n * the snapshot (for example the desired behavior for server timestamps that\n * have not yet been set to their final value).\n * @returns An `Object` containing all fields in the document.\n */\n\n\n return t(n, e), n.prototype.data = function (t) {\n return void 0 === t && (t = {}), e.prototype.data.call(this, t);\n }, n;\n}(za),\n Ha =\n/** @class */\nfunction () {\n /** @hideconstructor */\n function t(t, e, n, r) {\n this._firestore = t, this._userDataWriter = e, this._snapshot = r, this.metadata = new Ga(r.hasPendingWrites, r.fromCache), this.query = n;\n }\n\n return Object.defineProperty(t.prototype, \"docs\", {\n /** An array of all the documents in the `QuerySnapshot`. */\n get: function get() {\n var t = [];\n return this.forEach(function (e) {\n return t.push(e);\n }), t;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"size\", {\n /** The number of documents in the `QuerySnapshot`. */\n get: function get() {\n return this._snapshot.docs.size;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"empty\", {\n /** True if there are no documents in the `QuerySnapshot`. */\n get: function get() {\n return 0 === this.size;\n },\n enumerable: !1,\n configurable: !0\n }),\n /**\n * Enumerates all of the documents in the `QuerySnapshot`.\n *\n * @param callback - A callback to be called with a `QueryDocumentSnapshot` for\n * each document in the snapshot.\n * @param thisArg - The `this` binding for the callback.\n */\n t.prototype.forEach = function (t, e) {\n var n = this;\n\n this._snapshot.docs.forEach(function (r) {\n t.call(e, new Wa(n._firestore, n._userDataWriter, r.key, r, new Ga(n._snapshot.mutatedKeys.has(r.key), n._snapshot.fromCache), n.query.converter));\n });\n },\n /**\n * Returns an array of the documents changes since the last snapshot. If this\n * is the first snapshot, all documents will be in the list as 'added'\n * changes.\n *\n * @param options - `SnapshotListenOptions` that control whether metadata-only\n * changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger\n * snapshot events.\n */\n t.prototype.docChanges = function (t) {\n void 0 === t && (t = {});\n var e = !!t.includeMetadataChanges;\n if (e && this._snapshot.excludesMetadataChanges) throw new D(N.INVALID_ARGUMENT, \"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().\");\n return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === e || (this._cachedChanges =\n /** Calculates the array of DocumentChanges for a given ViewSnapshot. */\n function (t, e) {\n if (t._snapshot.oldDocs.isEmpty()) {\n var n = 0;\n return t._snapshot.docChanges.map(function (e) {\n return {\n type: \"added\",\n doc: new Wa(t._firestore, t._userDataWriter, e.doc.key, e.doc, new Ga(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter),\n oldIndex: -1,\n newIndex: n++\n };\n });\n } // A DocumentSet that is updated incrementally as changes are applied to use\n // to lookup the index of a document.\n\n\n var r = t._snapshot.oldDocs;\n return t._snapshot.docChanges.filter(function (t) {\n return e || 3\n /* Metadata */\n !== t.type;\n }).map(function (e) {\n var n = new Wa(t._firestore, t._userDataWriter, e.doc.key, e.doc, new Ga(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter),\n i = -1,\n o = -1;\n return 0\n /* Added */\n !== e.type && (i = r.indexOf(e.doc.key), r = r.delete(e.doc.key)), 1\n /* Removed */\n !== e.type && (o = (r = r.add(e.doc)).indexOf(e.doc.key)), {\n type: Ya(e.type),\n doc: n,\n oldIndex: i,\n newIndex: o\n };\n });\n }(this, e), this._cachedChangesIncludeMetadataChanges = e), this._cachedChanges;\n }, t;\n}();\n/**\n * A `DocumentSnapshot` contains data read from a document in your Firestore\n * database. The data can be extracted with `.data()` or `.get()` to\n * get a specific field.\n *\n * For a `DocumentSnapshot` that points to a non-existing document, any data\n * access will return 'undefined'. You can use the `exists()` method to\n * explicitly verify a document's existence.\n */\n\n\nfunction Ya(t) {\n switch (t) {\n case 0\n /* Added */\n :\n return \"added\";\n\n case 2\n /* Modified */\n :\n case 3\n /* Metadata */\n :\n return \"modified\";\n\n case 1\n /* Removed */\n :\n return \"removed\";\n\n default:\n return O();\n }\n} // TODO(firestoreexp): Add tests for snapshotEqual with different snapshot\n// metadata\n\n/**\n * Returns true if the provided snapshots are equal.\n *\n * @param left - A snapshot to compare.\n * @param right - A snapshot to compare.\n * @returns true if the snapshots are equal.\n */\n\n\nfunction $a(t, e) {\n return t instanceof za && e instanceof za ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Ha && e instanceof Ha && t._firestore === e._firestore && na(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot);\n}\n/**\n * @license\n * Copyright 2020 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\nfunction Xa(t) {\n if (Xt(t) && 0 === t.explicitOrderBy.length) throw new D(N.UNIMPLEMENTED, \"limitToLast() queries require specifying at least one orderBy() clause\");\n}\n/**\n * A `QueryConstraint` is used to narrow the set of documents returned by a\n * Firestore query. `QueryConstraint`s are created by invoking {@link where},\n * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link\n * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and\n * can then be passed to {@link query} to create a new query instance that\n * also contains this `QueryConstraint`.\n */\n\n\nvar Ja = function Ja() {};\n/**\n * Creates a new immutable instance of `Query` that is extended to also include\n * additional query constraints.\n *\n * @param query - The Query instance to use as a base for the new constraints.\n * @param queryConstraints - The list of `QueryConstraint`s to apply.\n * @throws if any of the provided query constraints cannot be combined with the\n * existing or new constraints.\n */\n\n\nfunction Za(t) {\n for (var e = [], n = 1; n < arguments.length; n++) {\n e[n - 1] = arguments[n];\n }\n\n for (var r = 0, i = e; r < i.length; r++) {\n var o = i[r];\n t = o._apply(t);\n }\n\n return t;\n}\n\nvar tc =\n/** @class */\nfunction (e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).jc = t, i.Wc = n, i.Gc = r, i.type = \"where\", i;\n }\n\n return t(n, e), n.prototype._apply = function (t) {\n var e = Ta(t.firestore),\n n = function (t, e, n, r, i, o, s) {\n var u;\n\n if (i.isKeyField()) {\n if (\"array-contains\"\n /* ARRAY_CONTAINS */\n === o || \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n === o) throw new D(N.INVALID_ARGUMENT, \"Invalid Query. You can't perform '\" + o + \"' queries on FieldPath.documentId().\");\n\n if (\"in\"\n /* IN */\n === o || \"not-in\"\n /* NOT_IN */\n === o) {\n uc(s, o);\n\n for (var a = [], c = 0, h = s; c < h.length; c++) {\n var f = h[c];\n a.push(sc(r, t, f));\n }\n\n u = {\n arrayValue: {\n values: a\n }\n };\n } else u = sc(r, t, s);\n } else \"in\"\n /* IN */\n !== o && \"not-in\"\n /* NOT_IN */\n !== o && \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n !== o || uc(s, o), u = Ra(n, \"where\", s,\n /* allowArrays= */\n \"in\"\n /* IN */\n === o || \"not-in\"\n /* NOT_IN */\n === o);\n\n var l = Rt.create(i, o, u);\n return function (t, e) {\n if (e.g()) {\n var n = Zt(t);\n if (null !== n && !n.isEqual(e.field)) throw new D(N.INVALID_ARGUMENT, \"Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '\" + n.toString() + \"' and '\" + e.field.toString() + \"'\");\n var r = Jt(t);\n null !== r && ac(t, e.field, r);\n }\n\n var i = function (t, e) {\n for (var n = 0, r = t.filters; n < r.length; n++) {\n var i = r[n];\n if (e.indexOf(i.op) >= 0) return i.op;\n }\n\n return null;\n }(t,\n /**\n * Given an operator, returns the set of operators that cannot be used with it.\n *\n * Operators in a query must adhere to the following set of rules:\n * 1. Only one array operator is allowed.\n * 2. Only one disjunctive operator is allowed.\n * 3. NOT_EQUAL cannot be used with another NOT_EQUAL operator.\n * 4. NOT_IN cannot be used with array, disjunctive, or NOT_EQUAL operators.\n *\n * Array operators: ARRAY_CONTAINS, ARRAY_CONTAINS_ANY\n * Disjunctive operators: IN, ARRAY_CONTAINS_ANY, NOT_IN\n */\n function (t) {\n switch (t) {\n case \"!=\"\n /* NOT_EQUAL */\n :\n return [\"!=\"\n /* NOT_EQUAL */\n , \"not-in\"\n /* NOT_IN */\n ];\n\n case \"array-contains\"\n /* ARRAY_CONTAINS */\n :\n return [\"array-contains\"\n /* ARRAY_CONTAINS */\n , \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n , \"not-in\"\n /* NOT_IN */\n ];\n\n case \"in\"\n /* IN */\n :\n return [\"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n , \"in\"\n /* IN */\n , \"not-in\"\n /* NOT_IN */\n ];\n\n case \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n :\n return [\"array-contains\"\n /* ARRAY_CONTAINS */\n , \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n , \"in\"\n /* IN */\n , \"not-in\"\n /* NOT_IN */\n ];\n\n case \"not-in\"\n /* NOT_IN */\n :\n return [\"array-contains\"\n /* ARRAY_CONTAINS */\n , \"array-contains-any\"\n /* ARRAY_CONTAINS_ANY */\n , \"in\"\n /* IN */\n , \"not-in\"\n /* NOT_IN */\n , \"!=\"\n /* NOT_EQUAL */\n ];\n\n default:\n return [];\n }\n }(e.op));\n\n if (null !== i) // Special case when it's a duplicate op to give a slightly clearer error message.\n throw i === e.op ? new D(N.INVALID_ARGUMENT, \"Invalid query. You cannot use more than one '\" + e.op.toString() + \"' filter.\") : new D(N.INVALID_ARGUMENT, \"Invalid query. You cannot use '\" + e.op.toString() + \"' filters with '\" + i.toString() + \"' filters.\");\n }(t, l), l;\n }(t._query, 0, e, t.firestore._databaseId, this.jc, this.Wc, this.Gc);\n\n return new Xu(t.firestore, t.converter, function (t, e) {\n var n = t.filters.concat([e]);\n return new Wt(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);\n }(t._query, n));\n }, n;\n}(Ja),\n ec =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).jc = t, r.zc = n, r.type = \"orderBy\", r;\n }\n\n return t(n, e), n.prototype._apply = function (t) {\n var e = function (t, e, n) {\n if (null !== t.startAt) throw new D(N.INVALID_ARGUMENT, \"Invalid query. You must not call startAt() or startAfter() before calling orderBy().\");\n if (null !== t.endAt) throw new D(N.INVALID_ARGUMENT, \"Invalid query. You must not call endAt() or endBefore() before calling orderBy().\");\n var r = new Kt(e, n);\n return function (t, e) {\n if (null === Jt(t)) {\n // This is the first order by. It must match any inequality.\n var n = Zt(t);\n null !== n && ac(t, n, e.field);\n }\n }(t, r), r;\n }(t._query, this.jc, this.zc);\n\n return new Xu(t.firestore, t.converter, function (t, e) {\n // TODO(dimond): validate that orderBy does not list the same key twice.\n var n = t.explicitOrderBy.concat([e]);\n return new Wt(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);\n }(t._query, e));\n }, n;\n}(Ja),\n nc =\n/** @class */\nfunction (e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).type = t, i.Hc = n, i.Jc = r, i;\n }\n\n return t(n, e), n.prototype._apply = function (t) {\n return new Xu(t.firestore, t.converter, re(t._query, this.Hc, this.Jc));\n }, n;\n}(Ja),\n rc =\n/** @class */\nfunction (e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).type = t, i.Yc = n, i.Xc = r, i;\n }\n\n return t(n, e), n.prototype._apply = function (t) {\n var e = oc(t, this.type, this.Yc, this.Xc);\n return new Xu(t.firestore, t.converter, function (t, e) {\n return new Wt(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);\n }(t._query, e));\n }, n;\n}(Ja),\n ic =\n/** @class */\nfunction (e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).type = t, i.Yc = n, i.Xc = r, i;\n }\n\n return t(n, e), n.prototype._apply = function (t) {\n var e = oc(t, this.type, this.Yc, this.Xc);\n return new Xu(t.firestore, t.converter, function (t, e) {\n return new Wt(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);\n }(t._query, e));\n }, n;\n}(Ja);\n/**\n * Creates a `QueryConstraint` that enforces that documents must contain the\n * specified field and that the value should satisfy the relation constraint\n * provided.\n *\n * @param fieldPath - The path to compare\n * @param opStr - The operation string (e.g \"<\", \"<=\", \"==\", \"<\",\n * \"<=\", \"!=\").\n * @param value - The value for comparison\n * @returns The created `Query`.\n */\n\n/** Helper function to create a bound from a document or fields */\n\n\nfunction oc(t, e, n, r) {\n if (n[0] = l(n[0]), n[0] instanceof ja) return function (t, e, n, r, i) {\n if (!r) throw new D(N.NOT_FOUND, \"Can't use a DocumentSnapshot that doesn't exist for \" + n + \"().\"); // Because people expect to continue/end a query at the exact document\n // provided, we need to use the implicit sort order rather than the explicit\n // sort order, because it's guaranteed to contain the document key. That way\n // the position becomes unambiguous and the query continues/ends exactly at\n // the provided document. Without the key (by using the explicit sort\n // orders), multiple documents could match the position, yielding duplicate\n // results.\n\n for (var o = [], s = 0, u = ee(t); s < u.length; s++) {\n var a = u[s];\n if (a.field.isKeyField()) o.push(mt(e, r.key));else {\n var c = r.data.field(a.field);\n if (rt(c)) throw new D(N.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field \"' + a.field + '\" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');\n\n if (null === c) {\n var h = a.field.canonicalString();\n throw new D(N.INVALID_ARGUMENT, \"Invalid query. You are trying to start or end a query using a document for which the field '\" + h + \"' (used as the orderBy) does not exist.\");\n }\n\n o.push(c);\n }\n }\n\n return new Bt(o, i);\n }(t._query, t.firestore._databaseId, e, n[0]._document, r);\n var i = Ta(t.firestore);\n return function (t, e, n, r, i, o) {\n // Use explicit order by's because it has to match the query the user made\n var s = t.explicitOrderBy;\n if (i.length > s.length) throw new D(N.INVALID_ARGUMENT, \"Too many arguments provided to \" + r + \"(). The number of arguments must be less than or equal to the number of orderBy() clauses\");\n\n for (var u = [], a = 0; a < i.length; a++) {\n var c = i[a];\n\n if (s[a].field.isKeyField()) {\n if (\"string\" != typeof c) throw new D(N.INVALID_ARGUMENT, \"Invalid query. Expected a string for document ID in \" + r + \"(), but got a \" + typeof c);\n if (!te(t) && -1 !== c.indexOf(\"/\")) throw new D(N.INVALID_ARGUMENT, \"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to \" + r + \"() must be a plain document ID, but '\" + c + \"' contains a slash.\");\n var h = t.path.child(H.fromString(c));\n if (!ct.isDocumentKey(h)) throw new D(N.INVALID_ARGUMENT, \"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to \" + r + \"() must result in a valid document path, but '\" + h + \"' is not because it contains an odd number of segments.\");\n var f = new ct(h);\n u.push(mt(e, f));\n } else {\n var l = Ra(n, r, c);\n u.push(l);\n }\n }\n\n return new Bt(u, o);\n }(t._query, t.firestore._databaseId, i, e, n, r);\n}\n\nfunction sc(t, e, n) {\n if (\"string\" == typeof (n = l(n))) {\n if (\"\" === n) throw new D(N.INVALID_ARGUMENT, \"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.\");\n if (!te(e) && -1 !== n.indexOf(\"/\")) throw new D(N.INVALID_ARGUMENT, \"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '\" + n + \"' contains a '/' character.\");\n var r = e.path.child(H.fromString(n));\n if (!ct.isDocumentKey(r)) throw new D(N.INVALID_ARGUMENT, \"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '\" + r + \"' is not because it has an odd number of segments (\" + r.length + \").\");\n return mt(t, new ct(r));\n }\n\n if (n instanceof $u) return mt(t, n._key);\n throw new D(N.INVALID_ARGUMENT, \"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: \" + Gu(n) + \".\");\n}\n/**\n * Validates that the value passed into a disjunctive filter satisfies all\n * array requirements.\n */\n\n\nfunction uc(t, e) {\n if (!Array.isArray(t) || 0 === t.length) throw new D(N.INVALID_ARGUMENT, \"Invalid Query. A non-empty array is required for '\" + e.toString() + \"' filters.\");\n if (t.length > 10) throw new D(N.INVALID_ARGUMENT, \"Invalid Query. '\" + e.toString() + \"' filters support a maximum of 10 elements in the value array.\");\n}\n\nfunction ac(t, e, n) {\n if (!n.isEqual(e)) throw new D(N.INVALID_ARGUMENT, \"Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '\" + e.toString() + \"' and so you must also use '\" + e.toString() + \"' as your first argument to orderBy(), but your first orderBy() is on field '\" + n.toString() + \"' instead.\");\n}\n/**\n * @license\n * Copyright 2020 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 * Converts Firestore's internal types to the JavaScript types that we expose\n * to the user.\n *\n * @internal\n */\n\n\nvar cc =\n/** @class */\nfunction () {\n function t() {}\n\n return t.prototype.convertValue = function (t, e) {\n switch (void 0 === e && (e = \"none\"), ht(t)) {\n case 0\n /* NullValue */\n :\n return null;\n\n case 1\n /* BooleanValue */\n :\n return t.booleanValue;\n\n case 2\n /* NumberValue */\n :\n return et(t.integerValue || t.doubleValue);\n\n case 3\n /* TimestampValue */\n :\n return this.convertTimestamp(t.timestampValue);\n\n case 4\n /* ServerTimestampValue */\n :\n return this.convertServerTimestamp(t, e);\n\n case 5\n /* StringValue */\n :\n return t.stringValue;\n\n case 6\n /* BlobValue */\n :\n return this.convertBytes(nt(t.bytesValue));\n\n case 7\n /* RefValue */\n :\n return this.convertReference(t.referenceValue);\n\n case 8\n /* GeoPointValue */\n :\n return this.convertGeoPoint(t.geoPointValue);\n\n case 9\n /* ArrayValue */\n :\n return this.convertArray(t.arrayValue, e);\n\n case 10\n /* ObjectValue */\n :\n return this.convertObject(t.mapValue, e);\n\n default:\n throw O();\n }\n }, t.prototype.convertObject = function (t, e) {\n var n = this,\n r = {};\n return G(t.fields, function (t, i) {\n r[t] = n.convertValue(i, e);\n }), r;\n }, t.prototype.convertGeoPoint = function (t) {\n return new ya(et(t.latitude), et(t.longitude));\n }, t.prototype.convertArray = function (t, e) {\n var n = this;\n return (t.values || []).map(function (t) {\n return n.convertValue(t, e);\n });\n }, t.prototype.convertServerTimestamp = function (t, e) {\n switch (e) {\n case \"previous\":\n var n = it(t);\n return null == n ? null : this.convertValue(n, e);\n\n case \"estimate\":\n return this.convertTimestamp(ot(t));\n\n default:\n return null;\n }\n }, t.prototype.convertTimestamp = function (t) {\n var e = tt(t);\n return new j(e.seconds, e.nanos);\n }, t.prototype.convertDocumentKey = function (t, e) {\n var n = H.fromString(t);\n P($n(n));\n var r = new Ru(n.get(1), n.get(3)),\n i = new ct(n.popFirst(5));\n return r.isEqual(e) || // TODO(b/64130202): Somehow support foreign references.\n x(\"Document \" + i + \" contains a document reference within a different database (\" + r.projectId + \"/\" + r.database + \") which is not supported. It will be treated as a reference in the current database (\" + e.projectId + \"/\" + e.database + \") instead.\"), i;\n }, t;\n}();\n/**\n * @license\n * Copyright 2020 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 * Converts custom model object of type T into DocumentData by applying the\n * converter if it exists.\n *\n * This function is used when converting user objects to DocumentData\n * because we want to provide the user with a more specific error message if\n * their set() or fails due to invalid data originating from a toFirestore()\n * call.\n */\n\n\nfunction hc(t, e, n) {\n // Cast to `any` in order to satisfy the union type constraint on\n // toFirestore().\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;\n}\n\nvar fc =\n/** @class */\nfunction (e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).firestore = t, n;\n }\n\n return t(n, e), n.prototype.convertBytes = function (t) {\n return new da(t);\n }, n.prototype.convertReference = function (t) {\n var e = this.convertDocumentKey(t, this.firestore._databaseId);\n return new $u(this.firestore,\n /* converter= */\n null, e);\n }, n;\n}(cc),\n lc =\n/** @class */\nfunction () {\n /** @hideconstructor */\n function t(t, e) {\n this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1, this._dataReader = Ta(t);\n }\n\n return t.prototype.set = function (t, e, n) {\n this._verifyNotCommitted();\n\n var r = dc(t, this._firestore),\n i = hc(r.converter, e, n),\n o = Ea(this._dataReader, \"WriteBatch.set\", r._key, i, null !== r.converter, n);\n return this._mutations.push(o.toMutation(r._key, De.none())), this;\n }, t.prototype.update = function (t, e, n) {\n for (var r = [], i = 3; i < arguments.length; i++) {\n r[i - 3] = arguments[i];\n }\n\n this._verifyNotCommitted();\n\n var o,\n s = dc(t, this._firestore); // For Compat types, we have to \"extract\" the underlying types before\n // performing validation.\n\n return o = \"string\" == typeof (e = l(e)) || e instanceof la ? xa(this._dataReader, \"WriteBatch.update\", s._key, e, n, r) : Ca(this._dataReader, \"WriteBatch.update\", s._key, e), this._mutations.push(o.toMutation(s._key, De.exists(!0))), this;\n },\n /**\n * Deletes the document referred to by the provided {@link DocumentReference}.\n *\n * @param documentRef - A reference to the document to be deleted.\n * @returns This `WriteBatch` instance. Used for chaining method calls.\n */\n t.prototype.delete = function (t) {\n this._verifyNotCommitted();\n\n var e = dc(t, this._firestore);\n return this._mutations = this._mutations.concat(new je(e._key, De.none())), this;\n },\n /**\n * Commits all of the writes in this write batch as a single atomic unit.\n *\n * The result of these writes will only be reflected in document reads that\n * occur after the returned Promise resolves. If the client is offline, the\n * write fails. If you would like to see local modifications or buffer writes\n * until the client is online, use the full Firestore SDK.\n *\n * @returns A Promise resolved once all of the writes in the batch have been\n * successfully written to the backend as an atomic unit (note that it won't\n * resolve while you're offline).\n */\n t.prototype.commit = function () {\n return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();\n }, t.prototype._verifyNotCommitted = function () {\n if (this._committed) throw new D(N.FAILED_PRECONDITION, \"A write batch can no longer be used after commit() has been called.\");\n }, t;\n}();\n/**\n * @license\n * Copyright 2020 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 * A write batch, used to perform multiple writes as a single atomic unit.\n *\n * A `WriteBatch` object can be acquired by calling {@link writeBatch}. It\n * provides methods for adding writes to the write batch. None of the writes\n * will be committed (or visible locally) until {@link WriteBatch.commit} is\n * called.\n */\n\n\nfunction dc(t, e) {\n if ((t = l(t)).firestore !== e) throw new D(N.INVALID_ARGUMENT, \"Provided document reference is from a different Firestore instance.\");\n return t;\n}\n/**\n * @license\n * Copyright 2020 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// TODO(mrschmidt) Consider using `BaseTransaction` as the base class in the\n// legacy SDK.\n\n/**\n * A reference to a transaction.\n *\n * The `Transaction` object passed to a transaction's `updateFunction` provides\n * the methods to read and write data within the transaction context. See\n * {@link runTransaction}.\n */\n\n\nvar pc =\n/** @class */\nfunction (e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).firestore = t, n;\n }\n\n return t(n, e), n.prototype.convertBytes = function (t) {\n return new da(t);\n }, n.prototype.convertReference = function (t) {\n var e = this.convertDocumentKey(t, this.firestore._databaseId);\n return new $u(this.firestore,\n /* converter= */\n null, e);\n }, n;\n}(cc);\n/**\n * Reads the document referred to by this `DocumentReference` from cache.\n * Returns an error if the document is not currently cached.\n *\n * @returns A Promise resolved with a `DocumentSnapshot` containing the\n * current document contents.\n */\n\n\nfunction yc(t, e, n) {\n for (var r = [], i = 3; i < arguments.length; i++) {\n r[i - 3] = arguments[i];\n }\n\n t = zu(t, $u);\n var o = zu(t.firestore, ua),\n s = Ta(o);\n return mc(o, [(\"string\" == typeof ( // For Compat types, we have to \"extract\" the underlying types before\n // performing validation.\n e = l(e)) || e instanceof la ? xa(s, \"updateDoc\", t._key, e, n, r) : Ca(s, \"updateDoc\", t._key, e)).toMutation(t._key, De.exists(!0))]);\n}\n/**\n * Deletes the document referred to by the specified `DocumentReference`.\n *\n * @param reference - A reference to the document to delete.\n * @returns A Promise resolved once the document has been successfully\n * deleted from the backend (note that it won't resolve while you're offline).\n */\n\n\nfunction vc(t) {\n for (var e, i, o, s = [], u = 1; u < arguments.length; u++) {\n s[u - 1] = arguments[u];\n }\n\n t = l(t);\n var a = {\n includeMetadataChanges: !1\n },\n c = 0;\n \"object\" != typeof s[c] || ia(s[c]) || (a = s[c], c++);\n var h,\n f,\n d,\n p = {\n includeMetadataChanges: a.includeMetadataChanges\n };\n\n if (ia(s[c])) {\n var y = s[c];\n s[c] = null === (e = y.next) || void 0 === e ? void 0 : e.bind(y), s[c + 1] = null === (i = y.error) || void 0 === i ? void 0 : i.bind(y), s[c + 2] = null === (o = y.complete) || void 0 === o ? void 0 : o.bind(y);\n }\n\n if (t instanceof $u) f = zu(t.firestore, ua), d = Yt(t._key.path), h = {\n next: function next(e) {\n s[c] && s[c](gc(f, t, e));\n },\n error: s[c + 1],\n complete: s[c + 2]\n };else {\n var v = zu(t, Xu);\n f = zu(v.firestore, ua), d = v._query;\n var m = new pc(f);\n h = {\n next: function next(t) {\n s[c] && s[c](new Ha(f, m, v, t));\n },\n error: s[c + 1],\n complete: s[c + 2]\n }, Xa(t._query);\n }\n return function (t, e, i, o) {\n var s = this,\n u = new yu(o),\n a = new Is(e, u, i);\n return t.asyncQueue.enqueueAndForget(function () {\n return n(s, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return e = vs, [4\n /*yield*/\n , Au(t)];\n\n case 1:\n return [2\n /*return*/\n , e.apply(void 0, [n.sent(), a])];\n }\n });\n });\n }), function () {\n u.Wo(), t.asyncQueue.enqueueAndForget(function () {\n return n(s, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return e = ms, [4\n /*yield*/\n , Au(t)];\n\n case 1:\n return [2\n /*return*/\n , e.apply(void 0, [n.sent(), a])];\n }\n });\n });\n });\n };\n }(aa(f), d, p, h);\n}\n/**\n * Locally writes `mutations` on the async queue.\n * @internal\n */\n\n\nfunction mc(t, e) {\n return function (t, e) {\n var i = this,\n o = new br();\n return t.asyncQueue.enqueueAndForget(function () {\n return n(i, void 0, void 0, function () {\n var n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = Ps, [4\n /*yield*/\n , Du(t)];\n\n case 1:\n return [2\n /*return*/\n , n.apply(void 0, [r.sent(), e, o])];\n }\n });\n });\n }), o.promise;\n }(aa(t), e);\n}\n/**\n * Converts a ViewSnapshot that contains the single document specified by `ref`\n * to a DocumentSnapshot.\n */\n\n\nfunction gc(t, e, n) {\n var r = n.docs.get(e._key),\n i = new pc(t);\n return new za(t, i, e._key, r, new Ga(n.hasPendingWrites, n.fromCache), e.converter);\n}\n/**\n * @license\n * Copyright 2020 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 * A reference to a transaction.\n *\n * The `Transaction` object passed to a transaction's `updateFunction` provides\n * the methods to read and write data within the transaction context. See\n * {@link runTransaction}.\n */\n\n\nvar wc =\n/** @class */\nfunction (e) {\n // This class implements the same logic as the Transaction API in the Lite SDK\n // but is subclassed in order to return its own DocumentSnapshot types.\n\n /** @hideconstructor */\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t, n) || this)._firestore = t, r;\n }\n /**\n * Reads the document referenced by the provided {@link DocumentReference}.\n *\n * @param documentRef - A reference to the document to be read.\n * @returns A `DocumentSnapshot` with the read data.\n */\n\n\n return t(n, e), n.prototype.get = function (t) {\n var n = this,\n r = dc(t, this._firestore),\n i = new pc(this._firestore);\n return e.prototype.get.call(this, t).then(function (t) {\n return new za(n._firestore, i, r._key, t._document, new Ga(\n /* hasPendingWrites= */\n !1,\n /* fromCache= */\n !1), r.converter);\n });\n }, n;\n}(\n/** @class */\nfunction () {\n /** @hideconstructor */\n function t(t, e) {\n this._firestore = t, this._transaction = e, this._dataReader = Ta(t)\n /**\n * Reads the document referenced by the provided {@link DocumentReference}.\n *\n * @param documentRef - A reference to the document to be read.\n * @returns A `DocumentSnapshot` with the read data.\n */\n ;\n }\n\n return t.prototype.get = function (t) {\n var e = this,\n n = dc(t, this._firestore),\n r = new fc(this._firestore);\n return this._transaction.lookup([n._key]).then(function (t) {\n if (!t || 1 !== t.length) return O();\n var i = t[0];\n if (i.isFoundDocument()) return new ja(e._firestore, r, i.key, i, n.converter);\n if (i.isNoDocument()) return new ja(e._firestore, r, n._key, null, n.converter);\n throw O();\n });\n }, t.prototype.set = function (t, e, n) {\n var r = dc(t, this._firestore),\n i = hc(r.converter, e, n),\n o = Ea(this._dataReader, \"Transaction.set\", r._key, i, null !== r.converter, n);\n return this._transaction.set(r._key, o), this;\n }, t.prototype.update = function (t, e, n) {\n for (var r = [], i = 3; i < arguments.length; i++) {\n r[i - 3] = arguments[i];\n }\n\n var o,\n s = dc(t, this._firestore); // For Compat types, we have to \"extract\" the underlying types before\n // performing validation.\n\n return o = \"string\" == typeof (e = l(e)) || e instanceof la ? xa(this._dataReader, \"Transaction.update\", s._key, e, n, r) : Ca(this._dataReader, \"Transaction.update\", s._key, e), this._transaction.update(s._key, o), this;\n },\n /**\n * Deletes the document referred to by the provided {@link DocumentReference}.\n *\n * @param documentRef - A reference to the document to be deleted.\n * @returns This `Transaction` instance. Used for chaining method calls.\n */\n t.prototype.delete = function (t) {\n var e = dc(t, this._firestore);\n return this._transaction.delete(e._key), this;\n }, t;\n}());\n/**\n * Executes the given `updateFunction` and then attempts to commit the changes\n * applied within the transaction. If any document read within the transaction\n * has changed, Cloud Firestore retries the `updateFunction`. If it fails to\n * commit after 5 attempts, the transaction fails.\n *\n * The maximum number of writes allowed in a single transaction is 500.\n *\n * @param firestore - A reference to the Firestore database to run this\n * transaction against.\n * @param updateFunction - The function to execute within the transaction\n * context.\n * @returns If the transaction completed successfully or was explicitly aborted\n * (the `updateFunction` returned a failed promise), the promise returned by the\n * `updateFunction `is returned here. Otherwise, if the transaction failed, a\n * rejected promise with the corresponding failure error is returned.\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/** Helper function to assert Uint8Array is available at runtime. */\n\n\nfunction bc() {\n if (\"undefined\" == typeof Uint8Array) throw new D(N.UNIMPLEMENTED, \"Uint8Arrays are not available in this environment.\");\n}\n/** Helper function to assert Base64 functions are available at runtime. */\n\n\nfunction Ic() {\n if (\"undefined\" == typeof atob) throw new D(N.UNIMPLEMENTED, \"Blobs are unavailable in Firestore in this environment.\");\n}\n/** Immutable class holding a blob (binary data) */\n\n\nvar Tc =\n/** @class */\nfunction () {\n function t(t) {\n this._delegate = t;\n }\n\n return t.fromBase64String = function (e) {\n return Ic(), new t(da.fromBase64String(e));\n }, t.fromUint8Array = function (e) {\n return bc(), new t(da.fromUint8Array(e));\n }, t.prototype.toBase64 = function () {\n return Ic(), this._delegate.toBase64();\n }, t.prototype.toUint8Array = function () {\n return bc(), this._delegate.toUint8Array();\n }, t.prototype.isEqual = function (t) {\n return this._delegate.isEqual(t._delegate);\n }, t.prototype.toString = function () {\n return \"Blob(base64: \" + this.toBase64() + \")\";\n }, t;\n}(),\n Ec =\n/** @class */\nfunction () {\n function t() {}\n\n return t.prototype.enableIndexedDbPersistence = function (t, e) {\n return function (t, e) {\n fa(t = zu(t, ua));\n\n var n = aa(t),\n r = t._freezeSettings(),\n i = new du();\n\n return ha(n, i, new fu(i, r.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));\n }(t._delegate, {\n forceOwnership: e\n });\n }, t.prototype.enableMultiTabIndexedDbPersistence = function (t) {\n return function (t) {\n fa(t = zu(t, ua));\n\n var e = aa(t),\n n = t._freezeSettings(),\n r = new du();\n\n return ha(e, r, new lu(r, n.cacheSizeBytes));\n }(t._delegate);\n }, t.prototype.clearIndexedDbPersistence = function (t) {\n return function (t) {\n var e = this;\n if (t._initialized && !t._terminated) throw new D(N.FAILED_PRECONDITION, \"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.\");\n var i = new br();\n return t._queue.enqueueAndForgetEvenWhileRestricted(function () {\n return n(e, void 0, void 0, function () {\n var e;\n return r(this, function (o) {\n switch (o.label) {\n case 0:\n return o.trys.push([0, 2,, 3]), [4\n /*yield*/\n , function (t) {\n return n(this, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return Er.yt() ? (e = t + \"main\", [4\n /*yield*/\n , Er.delete(e)]) : [2\n /*return*/\n , Promise.resolve()];\n\n case 1:\n return n.sent(), [2\n /*return*/\n ];\n }\n });\n });\n }(Oi(t._databaseId, t._persistenceKey))];\n\n case 1:\n return o.sent(), i.resolve(), [3\n /*break*/\n , 3];\n\n case 2:\n return e = o.sent(), i.reject(e), [3\n /*break*/\n , 3];\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n }), i.promise\n /**\n * Waits until all currently pending writes for the active user have been\n * acknowledged by the backend.\n *\n * The returned Promise resolves immediately if there are no outstanding writes.\n * Otherwise, the Promise waits for all previously issued writes (including\n * those written in a previous app session), but it does not wait for writes\n * that were added after the function is called. If you want to wait for\n * additional writes, call `waitForPendingWrites()` again.\n *\n * Any outstanding `waitForPendingWrites()` Promises are rejected during user\n * changes.\n *\n * @returns A Promise which resolves when all currently pending writes have been\n * acknowledged by the backend.\n */\n ;\n }(t._delegate);\n }, t;\n}(),\n _c =\n/** @class */\nfunction () {\n function t(t, e, n) {\n var r = this;\n this._delegate = e, this.Zc = n, this.INTERNAL = {\n delete: function _delete() {\n return r.terminate();\n }\n }, t instanceof Ru || (this.tu = t);\n }\n\n return Object.defineProperty(t.prototype, \"_databaseId\", {\n get: function get() {\n return this._delegate._databaseId;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.settings = function (t) {\n var e = this._delegate._getSettings();\n\n t.merge || e.host === t.host || R(\"You are overriding the original host. If you did not intend to override your settings, use {merge: true}.\"), t.merge && // Remove the property from the settings once the merge is completed\n delete (t = Object.assign(Object.assign({}, e), t)).merge, this._delegate._setSettings(t);\n }, t.prototype.useEmulator = function (t, e, n) {\n void 0 === n && (n = {}), function (t, e, n, r) {\n var i;\n void 0 === r && (r = {});\n\n var o = (t = zu(t, Yu))._getSettings();\n\n if (\"firestore.googleapis.com\" !== o.host && o.host !== e && R(\"Host has been set in both settings() and useEmulator(), emulator host will be used\"), t._setSettings(Object.assign(Object.assign({}, o), {\n host: e + \":\" + n,\n ssl: !1\n })), r.mockUserToken) {\n var s, u;\n if (\"string\" == typeof r.mockUserToken) s = r.mockUserToken, u = fo.MOCK_USER;else {\n // Let createMockUserToken validate first (catches common mistakes like\n // invalid field \"uid\" and missing field \"sub\" / \"user_id\".)\n s = d(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);\n var a = r.mockUserToken.sub || r.mockUserToken.user_id;\n if (!a) throw new D(N.INVALID_ARGUMENT, \"mockUserToken must contain 'sub' or 'user_id' field!\");\n u = new fo(a);\n }\n t._credentials = new Fu(new Ou(s, u));\n }\n }(this._delegate, t, e, n);\n }, t.prototype.enableNetwork = function () {\n return function (t) {\n var e = this;\n return t.asyncQueue.enqueue(function () {\n return n(e, void 0, void 0, function () {\n var e, n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , _u(t)];\n\n case 1:\n return e = r.sent(), [4\n /*yield*/\n , Nu(t)];\n\n case 2:\n return n = r.sent(), [2\n /*return*/\n , (e.setNetworkEnabled(!0), function (t) {\n var e = F(t);\n return e.Or.delete(0\n /* UserDisabled */\n ), Vo(e);\n }(n))];\n }\n });\n });\n });\n }\n /** Disables the network connection. Pending operations will not complete. */\n (aa(zu(this._delegate, ua)));\n }, t.prototype.disableNetwork = function () {\n return function (t) {\n var e = this;\n return t.asyncQueue.enqueue(function () {\n return n(e, void 0, void 0, function () {\n var e, i;\n return r(this, function (o) {\n switch (o.label) {\n case 0:\n return [4\n /*yield*/\n , _u(t)];\n\n case 1:\n return e = o.sent(), [4\n /*yield*/\n , Nu(t)];\n\n case 2:\n return i = o.sent(), [2\n /*return*/\n , (e.setNetworkEnabled(!1), function (t) {\n return n(this, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return (e = F(t)).Or.add(0\n /* UserDisabled */\n ), [4\n /*yield*/\n , qo(e)];\n\n case 1:\n return n.sent(), // Set the OnlineState to Offline so get()s return from cache, etc.\n e.Br.set(\"Offline\"\n /* Offline */\n ), [2\n /*return*/\n ];\n }\n });\n });\n }(i))];\n }\n });\n });\n });\n }\n /**\n * Returns a Promise that resolves when all writes that were pending at the time\n * this method was called received server acknowledgement. An acknowledgement\n * can be either acceptance or rejection.\n */\n (aa(zu(this._delegate, ua)));\n }, t.prototype.enablePersistence = function (t) {\n var e = !1,\n n = !1;\n return t && ju(\"synchronizeTabs\", e = !!t.synchronizeTabs, \"experimentalForceOwningTab\", n = !!t.experimentalForceOwningTab), e ? this.Zc.enableMultiTabIndexedDbPersistence(this) : this.Zc.enableIndexedDbPersistence(this, n);\n }, t.prototype.clearPersistence = function () {\n return this.Zc.clearIndexedDbPersistence(this);\n }, t.prototype.terminate = function () {\n return this.tu && (this.tu._removeServiceInstance(\"firestore\"), this.tu._removeServiceInstance(\"firestore-exp\")), this._delegate._delete();\n }, t.prototype.waitForPendingWrites = function () {\n return function (t) {\n var e = this,\n i = new br();\n return t.asyncQueue.enqueueAndForget(function () {\n return n(e, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return e = Bs, [4\n /*yield*/\n , Du(t)];\n\n case 1:\n return [2\n /*return*/\n , e.apply(void 0, [n.sent(), i])];\n }\n });\n });\n }), i.promise;\n }(aa(zu(this._delegate, ua)));\n }, t.prototype.onSnapshotsInSync = function (t) {\n return function (t, e) {\n return function (t, e) {\n var i = this,\n o = new yu(e);\n return t.asyncQueue.enqueueAndForget(function () {\n return n(i, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return e = function e(t, _e2) {\n F(t).Gr.add(_e2), // Immediately fire an initial event, indicating all existing listeners\n // are in-sync.\n _e2.next();\n }, [4\n /*yield*/\n , Au(t)];\n\n case 1:\n return [2\n /*return*/\n , e.apply(void 0, [n.sent(), o])];\n }\n });\n });\n }), function () {\n o.Wo(), t.asyncQueue.enqueueAndForget(function () {\n return n(i, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return e = function e(t, _e3) {\n F(t).Gr.delete(_e3);\n }, [4\n /*yield*/\n , Au(t)];\n\n case 1:\n return [2\n /*return*/\n , e.apply(void 0, [n.sent(), o])];\n }\n });\n });\n });\n }\n /**\n * Takes an updateFunction in which a set of reads and writes can be performed\n * atomically. In the updateFunction, the client can read and write values\n * using the supplied transaction object. After the updateFunction, all\n * changes will be committed. If a retryable error occurs (ex: some other\n * client has changed any of the data referenced), then the updateFunction\n * will be called again after a backoff. If the updateFunction still fails\n * after all retries, then the transaction will be rejected.\n *\n * The transaction object passed to the updateFunction contains methods for\n * accessing documents and collections. Unlike other datastore access, data\n * accessed with the transaction will not reflect local changes that have not\n * been committed. For this reason, it is required that all reads are\n * performed before any writes. Transactions must be performed while online.\n */\n ;\n }(aa(t = zu(t, ua)), ia(e) ? e : {\n next: e\n });\n }(this._delegate, t);\n }, Object.defineProperty(t.prototype, \"app\", {\n get: function get() {\n if (!this.tu) throw new D(N.FAILED_PRECONDITION, \"Firestore was not initialized using the Firebase SDK. 'app' is not available\");\n return this.tu;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.collection = function (t) {\n try {\n return new qc(this, Zu(this._delegate, t));\n } catch (t) {\n throw xc(t, \"collection()\", \"Firestore.collection()\");\n }\n }, t.prototype.doc = function (t) {\n try {\n return new Cc(this, ta(this._delegate, t));\n } catch (t) {\n throw xc(t, \"doc()\", \"Firestore.doc()\");\n }\n }, t.prototype.collectionGroup = function (t) {\n try {\n return new Fc(this, function (t, e) {\n if (t = zu(t, Yu), Uu(\"collectionGroup\", \"collection id\", e), e.indexOf(\"/\") >= 0) throw new D(N.INVALID_ARGUMENT, \"Invalid collection ID '\" + e + \"' passed to function collectionGroup(). Collection IDs must not contain '/'.\");\n return new Xu(t,\n /* converter= */\n null,\n /**\n * Creates a new Query for a collection group query that matches all documents\n * within the provided collection group.\n */\n function (t) {\n return new Wt(H.emptyPath(), t);\n }(e));\n }(this._delegate, t));\n } catch (t) {\n throw xc(t, \"collectionGroup()\", \"Firestore.collectionGroup()\");\n }\n }, t.prototype.runTransaction = function (t) {\n var e = this;\n return function (t, e) {\n return function (t, e) {\n var i = this,\n o = new br();\n return t.asyncQueue.enqueueAndForget(function () {\n return n(i, void 0, void 0, function () {\n var n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return [4\n /*yield*/\n , function (t) {\n return Eu(t).then(function (t) {\n return t.datastore;\n });\n }(t)];\n\n case 1:\n return n = r.sent(), new gu(t.asyncQueue, n, e, o).run(), [2\n /*return*/\n ];\n }\n });\n });\n }), o.promise;\n }(aa(t), function (n) {\n return e(new wc(t, n));\n });\n }(this._delegate, function (n) {\n return t(new Dc(e, n));\n });\n }, t.prototype.batch = function () {\n var t = this;\n return aa(this._delegate), new Ac(new lc(this._delegate, function (e) {\n return mc(t._delegate, e);\n }));\n }, t.prototype.loadBundle = function (t) {\n throw new D(N.FAILED_PRECONDITION, '\"loadBundle()\" does not exist, have you imported \"firebase/firestore/bundle\"?');\n }, t.prototype.namedQuery = function (t) {\n throw new D(N.FAILED_PRECONDITION, '\"namedQuery()\" does not exist, have you imported \"firebase/firestore/bundle\"?');\n }, t;\n}(),\n Sc =\n/** @class */\nfunction (e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).firestore = t, n;\n }\n\n return t(n, e), n.prototype.convertBytes = function (t) {\n return new Tc(new da(t));\n }, n.prototype.convertReference = function (t) {\n var e = this.convertDocumentKey(t, this.firestore._databaseId);\n return Cc.eu(e, this.firestore,\n /* converter= */\n null);\n }, n;\n}(cc);\n/**\n * The persistence provider included with the full Firestore SDK.\n */\n\n\nfunction Nc(t) {\n var e;\n e = t, A.setLogLevel(e);\n}\n/**\n * A reference to a transaction.\n */\n\n\nvar Dc =\n/** @class */\nfunction () {\n function t(t, e) {\n this._firestore = t, this._delegate = e, this._userDataWriter = new Sc(t);\n }\n\n return t.prototype.get = function (t) {\n var e = this,\n n = Uc(t);\n return this._delegate.get(n).then(function (t) {\n return new Oc(e._firestore, new za(e._firestore._delegate, e._userDataWriter, t._key, t._document, t.metadata, n.converter));\n });\n }, t.prototype.set = function (t, e, n) {\n var r = Uc(t);\n return n ? (Bu(\"Transaction.set\", n), this._delegate.set(r, e, n)) : this._delegate.set(r, e), this;\n }, t.prototype.update = function (t, n, r) {\n for (var i, o = [], s = 3; s < arguments.length; s++) {\n o[s - 3] = arguments[s];\n }\n\n var u = Uc(t);\n return 2 === arguments.length ? this._delegate.update(u, n) : (i = this._delegate).update.apply(i, e([u, n, r], o)), this;\n }, t.prototype.delete = function (t) {\n var e = Uc(t);\n return this._delegate.delete(e), this;\n }, t;\n}(),\n Ac =\n/** @class */\nfunction () {\n function t(t) {\n this._delegate = t;\n }\n\n return t.prototype.set = function (t, e, n) {\n var r = Uc(t);\n return n ? (Bu(\"WriteBatch.set\", n), this._delegate.set(r, e, n)) : this._delegate.set(r, e), this;\n }, t.prototype.update = function (t, n, r) {\n for (var i, o = [], s = 3; s < arguments.length; s++) {\n o[s - 3] = arguments[s];\n }\n\n var u = Uc(t);\n return 2 === arguments.length ? this._delegate.update(u, n) : (i = this._delegate).update.apply(i, e([u, n, r], o)), this;\n }, t.prototype.delete = function (t) {\n var e = Uc(t);\n return this._delegate.delete(e), this;\n }, t.prototype.commit = function () {\n return this._delegate.commit();\n }, t;\n}(),\n kc =\n/** @class */\nfunction () {\n function t(t, e, n) {\n this._firestore = t, this._userDataWriter = e, this._delegate = n;\n }\n\n return t.prototype.fromFirestore = function (t, e) {\n var n = new Wa(this._firestore._delegate, this._userDataWriter, t._key, t._document, t.metadata,\n /* converter= */\n null);\n return this._delegate.fromFirestore(new Pc(this._firestore, n), null != e ? e : {});\n }, t.prototype.toFirestore = function (t, e) {\n return e ? this._delegate.toFirestore(t, e) : this._delegate.toFirestore(t);\n }, // Use the same instance of `FirestoreDataConverter` for the given instances\n // of `Firestore` and `PublicFirestoreDataConverter` so that isEqual() will\n // compare equal for two objects created with the same converter instance.\n t.nu = function (e, n) {\n var r = t.su,\n i = r.get(e);\n i || (i = new WeakMap(), r.set(e, i));\n var o = i.get(n);\n return o || (o = new t(e, new Sc(e), n), i.set(n, o)), o;\n }, t;\n}();\n\nkc.su = new WeakMap();\n/**\n * A reference to a particular document in a collection in the database.\n */\n\nvar Cc =\n/** @class */\nfunction () {\n function t(t, e) {\n this.firestore = t, this._delegate = e, this._userDataWriter = new Sc(t);\n }\n\n return t.iu = function (e, n, r) {\n if (e.length % 2 != 0) throw new D(N.INVALID_ARGUMENT, \"Invalid document reference. Document references must have an even number of segments, but \" + e.canonicalString() + \" has \" + e.length);\n return new t(n, new $u(n._delegate, r, new ct(e)));\n }, t.eu = function (e, n, r) {\n return new t(n, new $u(n._delegate, r, e));\n }, Object.defineProperty(t.prototype, \"id\", {\n get: function get() {\n return this._delegate.id;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"parent\", {\n get: function get() {\n return new qc(this.firestore, this._delegate.parent);\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"path\", {\n get: function get() {\n return this._delegate.path;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.collection = function (t) {\n try {\n return new qc(this.firestore, Zu(this._delegate, t));\n } catch (t) {\n throw xc(t, \"collection()\", \"DocumentReference.collection()\");\n }\n }, t.prototype.isEqual = function (t) {\n return (t = l(t)) instanceof $u && ea(this._delegate, t);\n }, t.prototype.set = function (t, e) {\n e = Bu(\"DocumentReference.set\", e);\n\n try {\n return function (t, e, n) {\n t = zu(t, $u);\n var r = zu(t.firestore, ua),\n i = hc(t.converter, e, n);\n return mc(r, [Ea(Ta(r), \"setDoc\", t._key, i, null !== t.converter, n).toMutation(t._key, De.none())]);\n }(this._delegate, t, e);\n } catch (t) {\n throw xc(t, \"setDoc()\", \"DocumentReference.set()\");\n }\n }, t.prototype.update = function (t, n) {\n for (var r = [], i = 2; i < arguments.length; i++) {\n r[i - 2] = arguments[i];\n }\n\n try {\n return 1 === arguments.length ? yc(this._delegate, t) : yc.apply(void 0, e([this._delegate, t, n], r));\n } catch (t) {\n throw xc(t, \"updateDoc()\", \"DocumentReference.update()\");\n }\n }, t.prototype.delete = function () {\n return mc(zu((t = this._delegate).firestore, ua), [new je(t._key, De.none())]);\n var t;\n /**\n * Add a new document to specified `CollectionReference` with the given data,\n * assigning it a document ID automatically.\n *\n * @param reference - A reference to the collection to add this document to.\n * @param data - An Object containing the data for the new document.\n * @returns A Promise resolved with a `DocumentReference` pointing to the\n * newly created document after it has been written to the backend (Note that it\n * won't resolve while you're offline).\n */\n }, t.prototype.onSnapshot = function () {\n for (var t = this, e = [], n = 0; n < arguments.length; n++) {\n e[n] = arguments[n];\n }\n\n var r = Rc(e),\n i = Lc(e, function (e) {\n return new Oc(t.firestore, new za(t.firestore._delegate, t._userDataWriter, e._key, e._document, e.metadata, t._delegate.converter));\n });\n return vc(this._delegate, r, i);\n }, t.prototype.get = function (t) {\n var e = this;\n return (\"cache\" === (null == t ? void 0 : t.source) ? function (t) {\n t = zu(t, $u);\n var e = zu(t.firestore, ua),\n i = aa(e),\n o = new pc(e);\n return function (t, e) {\n var i = this,\n o = new br();\n return t.asyncQueue.enqueueAndForget(function () {\n return n(i, void 0, void 0, function () {\n var i;\n return r(this, function (s) {\n switch (s.label) {\n case 0:\n return i = function i(t, e, _i2) {\n return n(this, void 0, void 0, function () {\n var n, o;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return r.trys.push([0, 2,, 3]), [4\n /*yield*/\n , function (t, e) {\n var n = F(t);\n return n.persistence.runTransaction(\"read document\", \"readonly\", function (t) {\n return n.Mn.mn(t, e);\n });\n }(t, e)];\n\n case 1:\n return (o = r.sent()).isFoundDocument() ? _i2.resolve(o) : o.isNoDocument() ? _i2.resolve(null) : _i2.reject(new D(N.UNAVAILABLE, \"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)\")), [3\n /*break*/\n , 3];\n\n case 2:\n return n = r.sent(), o = hs(n, \"Failed to get document '\" + e + \" from cache\"), _i2.reject(o), [3\n /*break*/\n , 3];\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n }, [4\n /*yield*/\n , Su(t)];\n\n case 1:\n return [2\n /*return*/\n , i.apply(void 0, [s.sent(), e, o])];\n }\n });\n });\n }), o.promise;\n }(i, t._key).then(function (n) {\n return new za(e, o, t._key, n, new Ga(null !== n && n.hasLocalMutations,\n /* fromCache= */\n !0), t.converter);\n });\n }(this._delegate) : \"server\" === (null == t ? void 0 : t.source) ? function (t) {\n t = zu(t, $u);\n var e = zu(t.firestore, ua);\n return ku(aa(e), t._key, {\n source: \"server\"\n }).then(function (n) {\n return gc(e, t, n);\n });\n }(this._delegate) : function (t) {\n t = zu(t, $u);\n var e = zu(t.firestore, ua);\n return ku(aa(e), t._key).then(function (n) {\n return gc(e, t, n);\n });\n }(this._delegate)).then(function (t) {\n return new Oc(e.firestore, new za(e.firestore._delegate, e._userDataWriter, t._key, t._document, t.metadata, e._delegate.converter));\n });\n }, t.prototype.withConverter = function (e) {\n return new t(this.firestore, e ? this._delegate.withConverter(kc.nu(this.firestore, e)) : this._delegate.withConverter(null));\n }, t;\n}();\n/**\n * Replaces the function name in an error thrown by the firestore-exp API\n * with the function names used in the classic API.\n */\n\n\nfunction xc(t, e, n) {\n return t.message = t.message.replace(e, n), t\n /**\n * Iterates the list of arguments from an `onSnapshot` call and returns the\n * first argument that may be an `SnapshotListenOptions` object. Returns an\n * empty object if none is found.\n */\n ;\n}\n\nfunction Rc(t) {\n for (var e = 0, n = t; e < n.length; e++) {\n var r = n[e];\n if (\"object\" == typeof r && !ia(r)) return r;\n }\n\n return {};\n}\n/**\n * Creates an observer that can be passed to the firestore-exp SDK. The\n * observer converts all observed values into the format expected by the classic\n * SDK.\n *\n * @param args - The list of arguments from an `onSnapshot` call.\n * @param wrapper - The function that converts the firestore-exp type into the\n * type used by this shim.\n */\n\n\nfunction Lc(t, e) {\n var n, r, i;\n return {\n next: function next(t) {\n i.next && i.next(e(t));\n },\n error: null === (n = (i = ia(t[0]) ? t[0] : ia(t[1]) ? t[1] : \"function\" == typeof t[0] ? {\n next: t[0],\n error: t[1],\n complete: t[2]\n } : {\n next: t[1],\n error: t[2],\n complete: t[3]\n }).error) || void 0 === n ? void 0 : n.bind(i),\n complete: null === (r = i.complete) || void 0 === r ? void 0 : r.bind(i)\n };\n}\n\nvar Oc =\n/** @class */\nfunction () {\n function t(t, e) {\n this._firestore = t, this._delegate = e;\n }\n\n return Object.defineProperty(t.prototype, \"ref\", {\n get: function get() {\n return new Cc(this._firestore, this._delegate.ref);\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"id\", {\n get: function get() {\n return this._delegate.id;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"metadata\", {\n get: function get() {\n return this._delegate.metadata;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"exists\", {\n get: function get() {\n return this._delegate.exists();\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.data = function (t) {\n return this._delegate.data(t);\n }, t.prototype.get = function (t, e) {\n return this._delegate.get(t, e);\n }, t.prototype.isEqual = function (t) {\n return $a(this._delegate, t._delegate);\n }, t;\n}(),\n Pc =\n/** @class */\nfunction (e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n\n return t(n, e), n.prototype.data = function (t) {\n return this._delegate.data(t);\n }, n;\n}(Oc),\n Fc =\n/** @class */\nfunction () {\n function t(t, e) {\n this.firestore = t, this._delegate = e, this._userDataWriter = new Sc(t);\n }\n\n return t.prototype.where = function (e, n, r) {\n try {\n // The \"as string\" cast is a little bit of a hack. `where` accepts the\n // FieldPath Compat type as input, but is not typed as such in order to\n // not expose this via our public typings file.\n return new t(this.firestore, Za(this._delegate, function (t, e, n) {\n var r = e,\n i = Qa(\"where\", t);\n return new tc(i, r, n);\n }(e, n, r)));\n } catch (e) {\n throw xc(e, /(orderBy|where)\\(\\)/, \"Query.$1()\");\n }\n }, t.prototype.orderBy = function (e, n) {\n try {\n // The \"as string\" cast is a little bit of a hack. `orderBy` accepts the\n // FieldPath Compat type as input, but is not typed as such in order to\n // not expose this via our public typings file.\n return new t(this.firestore, Za(this._delegate, function (t, e) {\n void 0 === e && (e = \"asc\");\n var n = e,\n r = Qa(\"orderBy\", t);\n return new ec(r, n);\n }(e, n)));\n } catch (e) {\n throw xc(e, /(orderBy|where)\\(\\)/, \"Query.$1()\");\n }\n }, t.prototype.limit = function (e) {\n try {\n return new t(this.firestore, Za(this._delegate, function (t) {\n return Wu(\"limit\", t), new nc(\"limit\", t, \"F\"\n /* First */\n );\n }(e)));\n } catch (e) {\n throw xc(e, \"limit()\", \"Query.limit()\");\n }\n }, t.prototype.limitToLast = function (e) {\n try {\n return new t(this.firestore, Za(this._delegate, function (t) {\n return Wu(\"limitToLast\", t), new nc(\"limitToLast\", t, \"L\"\n /* Last */\n );\n }(e)));\n } catch (e) {\n throw xc(e, \"limitToLast()\", \"Query.limitToLast()\");\n }\n }, t.prototype.startAt = function () {\n for (var e = [], n = 0; n < arguments.length; n++) {\n e[n] = arguments[n];\n }\n\n try {\n return new t(this.firestore, Za(this._delegate, function () {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n }\n\n return new rc(\"startAt\", t,\n /*before=*/\n !0);\n }.apply(void 0, e)));\n } catch (e) {\n throw xc(e, \"startAt()\", \"Query.startAt()\");\n }\n }, t.prototype.startAfter = function () {\n for (var e = [], n = 0; n < arguments.length; n++) {\n e[n] = arguments[n];\n }\n\n try {\n return new t(this.firestore, Za(this._delegate, function () {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n }\n\n return new rc(\"startAfter\", t,\n /*before=*/\n !1);\n }.apply(void 0, e)));\n } catch (e) {\n throw xc(e, \"startAfter()\", \"Query.startAfter()\");\n }\n }, t.prototype.endBefore = function () {\n for (var e = [], n = 0; n < arguments.length; n++) {\n e[n] = arguments[n];\n }\n\n try {\n return new t(this.firestore, Za(this._delegate, function () {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n }\n\n return new ic(\"endBefore\", t,\n /*before=*/\n !0);\n }.apply(void 0, e)));\n } catch (e) {\n throw xc(e, \"endBefore()\", \"Query.endBefore()\");\n }\n }, t.prototype.endAt = function () {\n for (var e = [], n = 0; n < arguments.length; n++) {\n e[n] = arguments[n];\n }\n\n try {\n return new t(this.firestore, Za(this._delegate, function () {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n }\n\n return new ic(\"endAt\", t,\n /*before=*/\n !1);\n }.apply(void 0, e)));\n } catch (e) {\n throw xc(e, \"endAt()\", \"Query.endAt()\");\n }\n }, t.prototype.isEqual = function (t) {\n return na(this._delegate, t._delegate);\n }, t.prototype.get = function (t) {\n var e = this;\n return (\"cache\" === (null == t ? void 0 : t.source) ?\n /**\n * Executes the query and returns the results as a `QuerySnapshot` from cache.\n * Returns an error if the document is not currently cached.\n *\n * @returns A Promise that will be resolved with the results of the query.\n */\n function (t) {\n t = zu(t, Xu);\n var e = zu(t.firestore, ua),\n i = aa(e),\n o = new pc(e);\n return function (t, e) {\n var i = this,\n o = new br();\n return t.asyncQueue.enqueueAndForget(function () {\n return n(i, void 0, void 0, function () {\n var i;\n return r(this, function (s) {\n switch (s.label) {\n case 0:\n return i = function i(t, e, _i3) {\n return n(this, void 0, void 0, function () {\n var n, o, s, u, a;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return r.trys.push([0, 2,, 3]), [4\n /*yield*/\n , Yi(t, e,\n /* usePreviousResults= */\n !0)];\n\n case 1:\n return a = r.sent(), n = new As(e, a.Bn), o = n._o(a.documents), s = n.applyChanges(o,\n /* updateLimboDocuments= */\n !1), _i3.resolve(s.snapshot), [3\n /*break*/\n , 3];\n\n case 2:\n return u = r.sent(), a = hs(u, \"Failed to execute query '\" + e + \" against cache\"), _i3.reject(a), [3\n /*break*/\n , 3];\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n }, [4\n /*yield*/\n , Su(t)];\n\n case 1:\n return [2\n /*return*/\n , i.apply(void 0, [s.sent(), e, o])];\n }\n });\n });\n }), o.promise;\n }(i, t._query).then(function (n) {\n return new Ha(e, o, t, n);\n });\n }(this._delegate) : \"server\" === (null == t ? void 0 : t.source) ? function (t) {\n t = zu(t, Xu);\n var e = zu(t.firestore, ua),\n n = aa(e),\n r = new pc(e);\n return Cu(n, t._query, {\n source: \"server\"\n }).then(function (n) {\n return new Ha(e, r, t, n);\n });\n }(this._delegate) : function (t) {\n t = zu(t, Xu);\n var e = zu(t.firestore, ua),\n n = aa(e),\n r = new pc(e);\n return Xa(t._query), Cu(n, t._query).then(function (n) {\n return new Ha(e, r, t, n);\n });\n }(this._delegate)).then(function (t) {\n return new Vc(e.firestore, new Ha(e.firestore._delegate, e._userDataWriter, e._delegate, t._snapshot));\n });\n }, t.prototype.onSnapshot = function () {\n for (var t = this, e = [], n = 0; n < arguments.length; n++) {\n e[n] = arguments[n];\n }\n\n var r = Rc(e),\n i = Lc(e, function (e) {\n return new Vc(t.firestore, new Ha(t.firestore._delegate, t._userDataWriter, t._delegate, e._snapshot));\n });\n return vc(this._delegate, r, i);\n }, t.prototype.withConverter = function (e) {\n return new t(this.firestore, e ? this._delegate.withConverter(kc.nu(this.firestore, e)) : this._delegate.withConverter(null));\n }, t;\n}(),\n Mc =\n/** @class */\nfunction () {\n function t(t, e) {\n this._firestore = t, this._delegate = e;\n }\n\n return Object.defineProperty(t.prototype, \"type\", {\n get: function get() {\n return this._delegate.type;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"doc\", {\n get: function get() {\n return new Pc(this._firestore, this._delegate.doc);\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"oldIndex\", {\n get: function get() {\n return this._delegate.oldIndex;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"newIndex\", {\n get: function get() {\n return this._delegate.newIndex;\n },\n enumerable: !1,\n configurable: !0\n }), t;\n}(),\n Vc =\n/** @class */\nfunction () {\n function t(t, e) {\n this._firestore = t, this._delegate = e;\n }\n\n return Object.defineProperty(t.prototype, \"query\", {\n get: function get() {\n return new Fc(this._firestore, this._delegate.query);\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"metadata\", {\n get: function get() {\n return this._delegate.metadata;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"size\", {\n get: function get() {\n return this._delegate.size;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"empty\", {\n get: function get() {\n return this._delegate.empty;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"docs\", {\n get: function get() {\n var t = this;\n return this._delegate.docs.map(function (e) {\n return new Pc(t._firestore, e);\n });\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.docChanges = function (t) {\n var e = this;\n return this._delegate.docChanges(t).map(function (t) {\n return new Mc(e._firestore, t);\n });\n }, t.prototype.forEach = function (t, e) {\n var n = this;\n\n this._delegate.forEach(function (r) {\n t.call(e, new Pc(n._firestore, r));\n });\n }, t.prototype.isEqual = function (t) {\n return $a(this._delegate, t._delegate);\n }, t;\n}(),\n qc =\n/** @class */\nfunction (e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t, n) || this).firestore = t, r._delegate = n, r;\n }\n\n return t(n, e), Object.defineProperty(n.prototype, \"id\", {\n get: function get() {\n return this._delegate.id;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(n.prototype, \"path\", {\n get: function get() {\n return this._delegate.path;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(n.prototype, \"parent\", {\n get: function get() {\n var t = this._delegate.parent;\n return t ? new Cc(this.firestore, t) : null;\n },\n enumerable: !1,\n configurable: !0\n }), n.prototype.doc = function (t) {\n try {\n return new Cc(this.firestore, void 0 === t ? ta(this._delegate) : ta(this._delegate, t));\n } catch (t) {\n throw xc(t, \"doc()\", \"CollectionReference.doc()\");\n }\n }, n.prototype.add = function (t) {\n var e = this;\n return function (t, e) {\n var n = zu(t.firestore, ua),\n r = ta(t),\n i = hc(t.converter, e);\n return mc(n, [Ea(Ta(t.firestore), \"addDoc\", r._key, i, null !== t.converter, {}).toMutation(r._key, De.exists(!1))]).then(function () {\n return r;\n });\n }(this._delegate, t).then(function (t) {\n return new Cc(e.firestore, t);\n });\n }, n.prototype.isEqual = function (t) {\n return ea(this._delegate, t._delegate);\n }, n.prototype.withConverter = function (t) {\n return new n(this.firestore, t ? this._delegate.withConverter(kc.nu(this.firestore, t)) : this._delegate.withConverter(null));\n }, n;\n}(Fc);\n\nfunction Uc(t) {\n return zu(t, $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 */\n// The objects that are a part of this API are exposed to third-parties as\n// compiled javascript so we want to flag our private members with a leading\n// underscore to discourage their use.\n\n/**\n * A `FieldPath` refers to a field in a document. The path may consist of a\n * single field name (referring to a top-level field in the document), or a list\n * of field names (referring to a nested field in the document).\n */\n\n\nvar Bc =\n/** @class */\nfunction () {\n /**\n * Creates a FieldPath from the provided field names. If more than one field\n * name is provided, the path will point to a nested field in a document.\n *\n * @param fieldNames - A list of field names.\n */\n function t() {\n for (var t = [], n = 0; n < arguments.length; n++) {\n t[n] = arguments[n];\n }\n\n this._delegate = new (la.bind.apply(la, e([void 0], t)))();\n }\n\n return t.documentId = function () {\n /**\n * Internal Note: The backend doesn't technically support querying by\n * document ID. Instead it queries by the entire document name (full path\n * included), but in the cases we currently support documentId(), the net\n * effect is the same.\n */\n return new t($.keyField().canonicalString());\n }, t.prototype.isEqual = function (t) {\n return (t = l(t)) instanceof la && this._delegate._internalPath.isEqual(t._internalPath);\n }, t;\n}(),\n jc =\n/** @class */\nfunction () {\n function t(t) {\n this._delegate = t;\n }\n\n return t.serverTimestamp = function () {\n var e = new Na(\"serverTimestamp\");\n return e._methodName = \"FieldValue.serverTimestamp\", new t(e);\n }, t.delete = function () {\n var e = new _a(\"deleteField\");\n return e._methodName = \"FieldValue.delete\", new t(e);\n }, t.arrayUnion = function () {\n for (var e = [], n = 0; n < arguments.length; n++) {\n e[n] = arguments[n];\n }\n\n var r =\n /**\n * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link\n * @firebase/firestore/lite#(updateDoc:1)} that tells the server to union the given elements with any array\n * value that already exists on the server. Each specified element that doesn't\n * already exist in the array will be added to the end. If the field being\n * modified is not already an array it will be overwritten with an array\n * containing exactly the specified elements.\n *\n * @param elements - The elements to union into the array.\n * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or\n * `updateDoc()`.\n */\n function () {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n } // NOTE: We don't actually parse the data until it's used in set() or\n // update() since we'd need the Firestore instance to do this.\n\n\n return new Da(\"arrayUnion\", t);\n }.apply(void 0, e);\n\n return r._methodName = \"FieldValue.arrayUnion\", new t(r);\n }, t.arrayRemove = function () {\n for (var e = [], n = 0; n < arguments.length; n++) {\n e[n] = arguments[n];\n }\n\n var r = function () {\n for (var t = [], e = 0; e < arguments.length; e++) {\n t[e] = arguments[e];\n } // NOTE: We don't actually parse the data until it's used in set() or\n // update() since we'd need the Firestore instance to do this.\n\n\n return new Aa(\"arrayRemove\", t);\n }.apply(void 0, e);\n\n return r._methodName = \"FieldValue.arrayRemove\", new t(r);\n }, t.increment = function (e) {\n var n = function (t) {\n return new ka(\"increment\", t);\n }(e);\n\n return n._methodName = \"FieldValue.increment\", new t(n);\n }, t.prototype.isEqual = function (t) {\n return this._delegate.isEqual(t._delegate);\n }, t;\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/**\n * @license\n * Copyright 2020 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\nfunction Kc(t) {\n /**\n * Loads a Firestore bundle into the local cache.\n *\n * @param firestore - The `Firestore` instance to load bundles for for.\n * @param bundleData - An object representing the bundle to be loaded. Valid objects are\n * `ArrayBuffer`, `ReadableStream` or `string`.\n *\n * @returns\n * A `LoadBundleTask` object, which notifies callers with progress updates, and completion\n * or error events. It can be used as a `Promise`.\n */\n return function (t, e) {\n var i = aa(t = zu(t, ua)),\n o = new oa();\n return function (t, e, i, o) {\n var s = this,\n u = function (t, e) {\n return function (t, e) {\n return new vu(t, e);\n }(function (t, e) {\n if (t instanceof Uint8Array) return pu(t, e);\n if (t instanceof ArrayBuffer) return pu(new Uint8Array(t), e);\n if (t instanceof ReadableStream) return t.getReader();\n throw new Error(\"Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream\");\n }(\"string\" == typeof t ? new TextEncoder().encode(t) : t), e);\n }(i, Co(e));\n\n t.asyncQueue.enqueueAndForget(function () {\n return n(s, void 0, void 0, function () {\n var e;\n return r(this, function (n) {\n switch (n.label) {\n case 0:\n return e = cu, [4\n /*yield*/\n , Du(t)];\n\n case 1:\n return e.apply(void 0, [n.sent(), u, o]), [2\n /*return*/\n ];\n }\n });\n });\n });\n }(i, t._databaseId, e, o), o;\n }(this._delegate, t);\n}\n\nfunction Qc(t) {\n var e,\n i,\n o = this;\n return (e = this._delegate, i = t, function (t, e) {\n var i = this;\n return t.asyncQueue.enqueue(function () {\n return n(i, void 0, void 0, function () {\n var n;\n return r(this, function (r) {\n switch (r.label) {\n case 0:\n return n = function n(t, e) {\n var n = F(t);\n return n.persistence.runTransaction(\"Get named query\", \"readonly\", function (t) {\n return n.Ke.getNamedQuery(t, e);\n });\n }, [4\n /*yield*/\n , Su(t)];\n\n case 1:\n return [2\n /*return*/\n , n.apply(void 0, [r.sent(), e])];\n }\n });\n });\n });\n }(aa(e = zu(e, ua)), i).then(function (t) {\n return t ? new Xu(e, null, t.query) : null;\n })).then(function (t) {\n return t ? new Fc(o, t) : null;\n });\n}\n\nexport { ya as C, sa as E, j as M, Nc as Q, ua as T, _c as U, Ac as W, Oc as X, Pc as Z, Tc as a, Kc as c, Dc as j, Vc as n, jc as o, Ec as q, Bc as r, qc as s, Fc as t, Qc as u, Cc as z };"],"names":["S","t","e","n","this","previousValue","sequenceNumberHandler","i","writeSequenceNumber","prototype","Math","max","next","o","N","OK","CANCELLED","UNKNOWN","INVALID_ARGUMENT","DEADLINE_EXCEEDED","NOT_FOUND","ALREADY_EXISTS","PERMISSION_DENIED","UNAUTHENTICATED","RESOURCE_EXHAUSTED","FAILED_PRECONDITION","ABORTED","OUT_OF_RANGE","UNIMPLEMENTED","INTERNAL","UNAVAILABLE","DATA_LOSS","D","r","call","code","message","name","toString","Error","A","k","logLevel","C","arguments","length","map","L","debug","apply","x","error","R","warn","JSON","stringify","O","P","F","M","self","crypto","msCrypto","Uint8Array","getRandomValues","floor","random","V","u","charAt","q","U","every","B","j","seconds","nanoseconds","now","fromMillis","Date","fromDate","getTime","toDate","toMillis","_compareTo","isEqual","toJSON","valueOf","String","padStart","K","timestamp","fromTimestamp","min","compareTo","toMicroseconds","toTimestamp","Q","Object","hasOwnProperty","G","z","W","segments","offset","len","defineProperty","get","enumerable","configurable","comparator","child","slice","limit","forEach","push","construct","popFirst","popLast","firstSegment","lastSegment","isEmpty","isPrefixOf","isImmediateParentOf","toArray","H","canonicalString","join","fromString","s","indexOf","split","filter","emptyPath","Y","$","isValidIdentifier","test","replace","isKeyField","keyField","fromServerFormat","a","X","fields","sort","covers","J","binaryString","fromBase64String","atob","fromUint8Array","fromCharCode","toBase64","btoa","toUint8Array","charCodeAt","approximateByteSize","EMPTY_BYTE_STRING","Z","RegExp","tt","exec","substr","Number","nanos","et","nt","rt","mapValue","__type__","stringValue","it","__previous_value__","ot","__local_write_time__","timestampValue","st","ut","at","isInteger","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","ct","path","fromPath","fromName","hasCollectionId","isDocumentKey","fromSegments","ht","ft","booleanValue","bytesValue","referenceValue","geoPointValue","latitude","longitude","integerValue","doubleValue","isNaN","arrayValue","values","lt","find","dt","pt","keys","yt","vt","mt","projectId","database","gt","wt","bt","It","Tt","Et","assign","_t","value","empty","field","set","getFieldsMap","setAll","applyChanges","delete","clone","St","Nt","key","documentType","version","data","documentState","newInvalidDocument","newFoundDocument","newNoDocument","newUnknownDocument","convertToFoundDocument","convertToNoDocument","convertToUnknownDocument","setHasCommittedMutations","setHasLocalMutations","hasLocalMutations","hasCommittedMutations","isValidDocument","isFoundDocument","isNoDocument","isUnknownDocument","Dt","collectionGroup","orderBy","filters","startAt","endAt","h","At","kt","op","dir","jt","Ct","Qt","zt","xt","Rt","create","l","Lt","Mt","Vt","qt","Ut","Ot","Pt","matches","m","g","Ft","some","nullValue","Bt","position","before","Kt","Gt","Wt","explicitOrderBy","limitType","p","T","Ht","Yt","$t","Xt","Jt","Zt","te","ee","ne","re","ie","oe","se","ue","ae","ce","he","I","fe","le","de","_","pe","me","ge","we","be","Ie","ve","Ee","ye","Te","elements","_e","Se","transform","Ne","transformResults","De","updateTime","exists","none","Ae","ke","Ce","Pe","Ve","fieldTransforms","Fe","precondition","Me","xe","qe","Oe","Re","Le","type","fieldMask","Map","Ue","Be","je","Ke","Qe","count","Ge","ze","We","root","Ye","EMPTY","insert","copy","BLACK","remove","left","right","size","minKey","maxKey","inorderTraversal","reverseTraversal","getIterator","He","getIteratorFrom","getReverseIterator","getReverseIteratorFrom","isReverse","nodeStack","getNext","pop","hasNext","peek","color","RED","fixUp","removeMin","isRed","moveRedLeft","rotateRight","moveRedRight","rotateLeft","colorFlip","checkMaxDepth","check","pow","$e","has","first","last","forEachInRange","forEachWhile","firstAfterOrEqual","Xe","add","unionWith","iter","Je","Ze","tn","en","nn","rn","on","sn","un","an","cn","snapshotVersion","targetChanges","targetMismatches","documentUpdates","resolvedLimboDocuments","createSynthesizedRemoteEventForCurrentChange","hn","createSynthesizedTargetChangeForCurrentChange","resumeToken","current","addedDocuments","modifiedDocuments","removedDocuments","fn","v","removedTargetIds","ln","targetId","dn","state","targetIds","cause","pn","mn","yn","vn","forEachTarget","removeTarget","target","purpose","getRemoteKeysForTarget","gn","asc","desc","wn","in","bn","databaseId","In","toISOString","Tn","En","_n","Sn","Nn","$n","Dn","An","Rn","kn","Cn","xn","Ln","On","Pn","update","updateMask","Yn","verify","updateTransforms","fieldPath","setToServerValue","appendMissingElements","removeAllFromArray","increment","isNone","currentDocument","Fn","fieldPaths","Mn","documents","Vn","structuredQuery","parent","from","collectionId","allDescendants","unaryFilter","Gn","fieldFilter","Qn","compositeFilter","where","direction","Kn","Bn","qn","Un","zn","c","jn","Hn","Wn","reduce","concat","NaN","Xn","Zn","Jn","tr","substring","er","nr","ownerId","allowTabSynchronization","leaseTimestampMs","store","rr","userId","lastAcknowledgedBatchId","lastStreamToken","keyPath","ir","batchId","localWriteTimeMs","baseMutations","mutations","userMutationsIndex","userMutationsKeyPath","or","prefixForUser","prefixForPath","PLACEHOLDER","sr","readTime","ur","ar","unknownDocument","noDocument","document","parentPath","readTimeIndex","readTimeIndexPath","collectionReadTimeIndex","collectionReadTimeIndexPath","cr","byteSize","hr","canonicalId","lastListenSequenceNumber","lastLimboFreeSnapshotVersion","query","queryTargetsIndexName","queryTargetsKeyPath","fr","sequenceNumber","documentTargetsIndex","documentTargetsKeyPath","lr","highestTargetId","highestListenSequenceNumber","lastRemoteSnapshotVersion","targetCount","dr","pr","clientId","updateTimeMs","networkEnabled","inForeground","yr","bundleId","createTime","vr","bundledQuery","mr","gr","wr","onCommittedListeners","addOnCommittedListener","raiseOnCommittedEvent","br","promise","Promise","resolve","reject","Ir","nextCallback","catchCallback","result","isDone","callbackAttached","catch","wrapFailure","wrapSuccess","toPromise","wrapUserFunction","waitFor","Tr","action","transaction","aborted","oncomplete","onabort","Sr","onerror","Cr","open","abort","objectStore","Dr","Er","Ar","window","indexedDB","deleteDatabase","process","match","label","db","onsuccess","onblocked","onupgradeneeded","oldVersion","sent","onversionchange","runTransaction","f","trys","close","_r","done","Nr","put","cursor","options","primaryKey","continue","index","range","reverse","openKeyCursor","openCursor","kr","setTimeout","xr","currentSequenceNumber","Rr","Lr","localWriteTime","applyToRemoteDocument","mutationResults","applyToLocalView","applyToLocalDocumentSet","Or","batch","commitVersion","docVersions","Pr","withSequenceNumber","withResumeToken","withLastLimboFreeSnapshotVersion","Fr","Mr","jr","Vr","qr","Br","Ur","Kr","splice","Qr","Gr","zr","Wr","getBundleMetadata","Hr","id","saveBundleMetadata","getNamedQuery","Yr","saveNamedQuery","$r","Xr","addToCollectionParentIndex","getCollectionParents","getEntries","Jr","Zr","IDBKeyRange","bound","ti","didRun","sequenceNumbersCollected","targetsRemoved","documentsRemoved","ei","cacheSizeCollectionThreshold","percentileToCollect","maximumSequenceNumbersToCollect","withCacheSize","DEFAULT_COLLECTION_PERCENTILE","DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT","ni","only","d","ri","DEFAULT","DISABLED","ii","referenceDelegate","uid","isAuthenticated","checkEmpty","NEGATIVE_INFINITY","POSITIVE_INFINITY","si","addMutationBatch","ui","y","lookupMutationBatch","getNextMutationBatchAfterBatchId","lowerBound","getHighestUnacknowledgedBatchId","upperBound","getAllMutationBatches","getAllMutationBatchesAffectingDocumentKey","getAllMutationBatchesAffectingDocumentKeys","getAllMutationBatchesAffectingQuery","removeMutationBatch","markPotentiallyOrphaned","performConsistencyCheck","containsKey","oi","ai","ci","hi","allocateTargetId","getLastRemoteSnapshotVersion","getHighestSequenceNumber","setTargetsMetadata","addTargetData","updateTargetData","removeTargetData","removeMatchingKeysForTargetId","fi","removeTargets","li","getTargetCount","getTargetData","addMatchingKeys","di","addReference","removeMatchingKeys","removeReference","getMatchingKeysForTargetId","pi","yi","vi","buffer","mi","garbageCollector","asyncQueue","start","params","stop","cancel","enqueueAfterDelay","collectGarbage","gi","calculateTargetCount","nthSequenceNumber","maxValue","removeOrphanedDocuments","collect","getCacheSize","wi","getTargetCache","bi","getRemoteDocumentCache","newChangeBuffer","getEntry","removeEntry","updateLimboDocument","getSize","Ii","mapKeyFn","equalsFn","inner","Ti","changes","changesApplied","getReadTime","addEntry","assertNotApplied","getFromCache","getAllFromCache","Ei","Ni","Di","updateMetadata","getMetadata","getDocumentsMatchingQuery","_i","trackRemovals","Si","Ai","createObjectStore","autoIncrement","createIndex","unique","ki","deleteObjectStore","objectStoreNames","contains","Ci","xi","persistenceKey","isPrimary","localStorage","then","started","setDatabaseDeletedListener","newVersion","setNetworkEnabled","enqueueAndForget","Li","enqueueRetryable","Ri","removeItem","shutdown","getMutationQueue","getIndexManager","getBundleCache","addEventListener","visibilityState","removeEventListener","navigator","appVersion","enterRestrictedMode","getItem","setItem","Oi","isDefaultDatabase","Pi","progress","Fi","Mi","fromCache","docChanges","doc","Vi","hasPendingWrites","qi","persistence","Ui","Bi","removedBatchIds","addedBatchIds","ji","Ki","Qi","Gi","zi","Wi","Hi","Yi","$i","Xi","Ji","Zi","metadata","to","eo","no","ro","ts","es","ns","io","ss","rs","os","cs","us","hs","shift","oo","ls","docs","fs","so","uo","ds","ws","_s","ys","ao","gs","ps","toKey","co","Es","Ts","Is","ho","As","Rs","bs","vs","Set","Ps","fo","lo","po","yo","GOOGLE_CREDENTIALS","FIRST_PARTY","MOCK_USER","vo","user","Vs","parse","Ss","mo","go","activeTargetIds","Array","wo","onlineState","bo","Ds","Cs","Io","Ns","syncEngine","onlineStateHandler","xs","ks","bind","Fs","$s","storage","currentUser","Os","Ms","Ls","Bs","qs","Us","Ks","Qs","js","Ws","getAllActiveQueryTargets","Gs","isActiveQueryTarget","addPendingMutation","zs","updateMutationState","Hs","addLocalQueryTarget","Js","removeLocalQueryTarget","isLocalQueryTarget","clearQueryState","updateQueryState","Ys","handleUserChange","setOnlineState","Xs","notifyBundleLoaded","Zs","storageArea","newValue","To","Eo","_o","So","BatchGetDocuments","Commit","RunQuery","No","onMessage","send","Do","forceLongPolling","autoDetectLongPolling","useFetchStreams","listenOnce","getLastErrorCode","getResponseJson","getStatus","getResponseText","status","toLowerCase","httpSessionIdParam","initMessageHeaders","messageUrlParams","sendRawJson","supportsCrossDomainXhr","internalChannelParams","forwardChannelRequestTimeoutMs","detectBufferingProxy","xmlHttpFactory","httpHeadersOverwriteParam","createWebChannel","listen","stat","databaseInfo","ssl","host","appId","authHeaders","Ao","ko","Co","xo","timerId","reset","skipDelay","Ro","listener","stream","auth","invalidateToken","getToken","Lo","targetChange","targetChangeType","documentChange","documentDelete","documentRemove","addTarget","labels","Oo","streamToken","writeResults","commitTime","writes","Po","credentials","terminate","Fo","Mo","localStore","datastore","remoteSyncer","zo","qo","Vo","Uo","Go","Qo","jo","Bo","Ko","Wo","Ho","Yo","$o","rejectListen","Xo","applyRemoteEvent","Jo","Zo","as","is","applySuccessfulWrite","rejectFailedWrite","targetTimeMs","removalCallback","deferred","createAndSchedule","timerHandle","handleDelayElapsed","clearTimeout","keyedMap","sortedSet","emptySet","track","oldDocs","mutatedKeys","syncStateChanged","excludesMetadataChanges","fromInitialDocuments","listeners","queries","onListen","onError","ms","onUnlisten","includeMetadataChanges","payload","byteLength","bytesLoaded","documentsLoaded","namedQuery","documentMetadata","complete","taskState","totalDocuments","totalBytes","snapshot","view","remoteStore","eventManager","sharedClientState","maxConcurrentLimboResolutions","uu","isPrimaryClient","au","all","clear","tu","eu","nu","ru","iu","ou","su","hu","synchronizeTabs","initialize","gcScheduler","initialUser","fu","cacheSizeBytes","forceOwnership","lu","du","createDatastore","createRemoteStore","createEventManager","createSyncEngine","handleCredentialChange","yu","observer","muted","console","mu","TextDecoder","decode","findIndex","tc","read","readVersions","committed","lastWriteError","writtenDocs","lookup","ensureCommitNotCalled","found","missing","recordVersion","write","toMutation","preconditionForUpdate","commit","gu","updateFunction","ec","run","nc","sc","ic","rc","wu","credentialListener","setChangeListener","getConfiguration","setCredentialChangeListener","verifyNotTerminated","isShuttingDown","enqueueAndForgetEvenWhileRestricted","onlineComponents","offlineComponents","removeChangeListener","bu","verifyOperationInProgress","Iu","Tu","Eu","_u","Su","Nu","Du","Au","ku","_n2","source","Cu","_n3","xu","Ru","Lu","Ou","Authorization","Pu","changeListener","Fu","token","Mu","oc","cc","forceRefresh","uc","ac","addAuthTokenListener","onInit","getImmediate","optional","accessToken","removeAuthTokenListener","getUid","Vu","hc","lc","fc","getAuthHeaderValueForFirstParty","qu","Uu","Bu","merge","mergeFields","ju","Ku","Qu","Gu","constructor","zu","_delegate","Wu","Hu","ignoreUndefinedProperties","experimentalForceLongPolling","experimentalAutoDetectLongPolling","Yu","_persistenceKey","_settings","_settingsFrozen","_databaseId","_credentials","_app","_terminateTask","_setSettings","client","sessionIndex","iamToken","_getSettings","_freezeSettings","_delete","_terminate","app","settings","$u","converter","_key","firestore","Ju","withConverter","Xu","_query","_path","Zu","ta","ea","na","ra","dc","wc","_c","mc","yc","gc","Ec","Tc","Ic","enqueue","Ac","Rc","bc","stack","includes","vc","Pc","Vc","Sc","Dc","ia","_progressObserver","_taskCompletionResolver","_lastProgress","onProgress","_completeWith","_updateProgress","_failWith","sa","ua","_queue","_firestoreClient","ca","aa","ha","DOMException","fa","_initialized","_terminated","la","_internalPath","da","_byteString","pa","_methodName","ya","isFinite","_lat","_long","va","ma","ga","wa","ba","Cc","Nc","xc","kc","Fc","$c","Oc","Mc","Lc","Ua","methodName","Bc","qc","Ia","Uc","Ta","Ea","Fa","Oa","Ma","Ba","_a","_toFieldTransform","Sa","Na","Da","Kc","La","Aa","ka","Qc","Ca","qa","xa","Ra","Pa","getPrototypeOf","Va","search","ja","_firestore","_userDataWriter","_document","_converter","Ka","fromFirestore","convertValue","Qa","Ga","za","_firestoreImpl","Wa","serverTimestamps","Ha","_snapshot","_cachedChanges","_cachedChangesIncludeMetadataChanges","oldIndex","newIndex","Ya","$a","Xa","Ja","Za","_apply","jc","Wc","Gc","zc","Hc","Jc","Yc","Xc","isArray","convertTimestamp","convertServerTimestamp","convertBytes","convertReference","convertGeoPoint","convertArray","convertObject","convertDocumentKey","toFirestore","_commitHandler","_mutations","_committed","_dataReader","_verifyNotCommitted","pc","_transaction","enableIndexedDbPersistence","enableMultiTabIndexedDbPersistence","clearIndexedDbPersistence","Zc","useEmulator","mockUserToken","sub","user_id","enableNetwork","disableNetwork","enablePersistence","experimentalForceOwningTab","clearPersistence","_removeServiceInstance","waitForPendingWrites","onSnapshotsInSync","_e2","_e3","collection","loadBundle","setLogLevel","WeakMap","onSnapshot","_i2","ref","limitToLast","startAfter","endBefore","_i3","documentId","serverTimestamp","arrayUnion","arrayRemove"],"sourceRoot":""}