@firebase/firestore 4.7.5-canary.46c91bc3b → 4.7.5-canary.7bf2aec63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,7 +67,7 @@ User.MOCK_USER = new User("mock-user");
67
67
  * See the License for the specific language governing permissions and
68
68
  * limitations under the License.
69
69
  */
70
- let b = "11.1.0-canary.46c91bc3b";
70
+ let S = "11.1.0-canary.7bf2aec63";
71
71
 
72
72
  /**
73
73
  * @license
@@ -85,11 +85,11 @@ let b = "11.1.0-canary.46c91bc3b";
85
85
  * See the License for the specific language governing permissions and
86
86
  * limitations under the License.
87
87
  */
88
- const S = new Logger("@firebase/firestore");
88
+ const b = new Logger("@firebase/firestore");
89
89
 
90
90
  // Helper methods are needed because variables can't be exported as read/write
91
91
  function __PRIVATE_getLogLevel() {
92
- return S.logLevel;
92
+ return b.logLevel;
93
93
  }
94
94
 
95
95
  /**
@@ -105,29 +105,29 @@ function __PRIVATE_getLogLevel() {
105
105
  * <li><code>`silent` to turn off logging.</li>
106
106
  * </ul>
107
107
  */ function setLogLevel(e) {
108
- S.setLogLevel(e);
108
+ b.setLogLevel(e);
109
109
  }
110
110
 
111
111
  function __PRIVATE_logDebug(e, ...t) {
112
- if (S.logLevel <= LogLevel.DEBUG) {
112
+ if (b.logLevel <= LogLevel.DEBUG) {
113
113
  const n = t.map(__PRIVATE_argToString);
114
- S.debug(`Firestore (${b}): ${e}`, ...n);
114
+ b.debug(`Firestore (${S}): ${e}`, ...n);
115
115
  }
116
116
  }
117
117
 
118
118
  function __PRIVATE_logError(e, ...t) {
119
- if (S.logLevel <= LogLevel.ERROR) {
119
+ if (b.logLevel <= LogLevel.ERROR) {
120
120
  const n = t.map(__PRIVATE_argToString);
121
- S.error(`Firestore (${b}): ${e}`, ...n);
121
+ b.error(`Firestore (${S}): ${e}`, ...n);
122
122
  }
123
123
  }
124
124
 
125
125
  /**
126
126
  * @internal
127
127
  */ function __PRIVATE_logWarn(e, ...t) {
128
- if (S.logLevel <= LogLevel.WARN) {
128
+ if (b.logLevel <= LogLevel.WARN) {
129
129
  const n = t.map(__PRIVATE_argToString);
130
- S.warn(`Firestore (${b}): ${e}`, ...n);
130
+ b.warn(`Firestore (${S}): ${e}`, ...n);
131
131
  }
132
132
  }
133
133
 
@@ -188,7 +188,7 @@ function __PRIVATE_logError(e, ...t) {
188
188
  */ function fail(e = "Unexpected state") {
189
189
  // Log the failure in addition to throw an exception, just in case the
190
190
  // exception is swallowed.
191
- const t = `FIRESTORE (${b}) INTERNAL ASSERTION FAILED: ` + e;
191
+ const t = `FIRESTORE (${S}) INTERNAL ASSERTION FAILED: ` + e;
192
192
  // NOTE: We don't use FirestoreError here because these are internal failures
193
193
  // that cannot be handled by the user. (Also it would create a circular
194
194
  // dependency between the error and assert modules which doesn't work.)
@@ -1001,14 +1001,30 @@ class BasePath {
1001
1001
  toArray() {
1002
1002
  return this.segments.slice(this.offset, this.limit());
1003
1003
  }
1004
- static comparator(e, t) {
1004
+ /**
1005
+ * Compare 2 paths segment by segment, prioritizing numeric IDs
1006
+ * (e.g., "__id123__") in numeric ascending order, followed by string
1007
+ * segments in lexicographical order.
1008
+ */ static comparator(e, t) {
1005
1009
  const n = Math.min(e.length, t.length);
1006
1010
  for (let r = 0; r < n; r++) {
1007
- const n = e.get(r), i = t.get(r);
1008
- if (n < i) return -1;
1009
- if (n > i) return 1;
1011
+ const n = BasePath.compareSegments(e.get(r), t.get(r));
1012
+ if (0 !== n) return n;
1010
1013
  }
1011
- return e.length < t.length ? -1 : e.length > t.length ? 1 : 0;
1014
+ return Math.sign(e.length - t.length);
1015
+ }
1016
+ static compareSegments(e, t) {
1017
+ const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);
1018
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) :
1019
+ // both non-numeric
1020
+ e < t ? -1 : e > t ? 1 : 0;
1021
+ }
1022
+ // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1023
+ static isNumericId(e) {
1024
+ return e.startsWith("__id") && e.endsWith("__");
1025
+ }
1026
+ static extractNumericId(e) {
1027
+ return Integer.fromString(e.substring(4, e.length - 2));
1012
1028
  }
1013
1029
  }
1014
1030
 
@@ -1731,7 +1747,7 @@ class __PRIVATE_SimpleDbTransaction {
1731
1747
  };
1732
1748
  }))), this.N && (this.db.onversionchange = e => this.N(e)), this.db;
1733
1749
  }
1734
- L(e) {
1750
+ B(e) {
1735
1751
  this.N = e, this.db && (this.db.onversionchange = t => e(t));
1736
1752
  }
1737
1753
  async runTransaction(e, t, n, r) {
@@ -1780,7 +1796,7 @@ class __PRIVATE_SimpleDbTransaction {
1780
1796
  * within the key range or index.
1781
1797
  */ class __PRIVATE_IterationController {
1782
1798
  constructor(e) {
1783
- this.B = e, this.k = !1, this.q = null;
1799
+ this.L = e, this.k = !1, this.q = null;
1784
1800
  }
1785
1801
  get isDone() {
1786
1802
  return this.k;
@@ -1789,7 +1805,7 @@ class __PRIVATE_SimpleDbTransaction {
1789
1805
  return this.q;
1790
1806
  }
1791
1807
  set cursor(e) {
1792
- this.B = e;
1808
+ this.L = e;
1793
1809
  }
1794
1810
  /**
1795
1811
  * This function can be called to stop iteration at any point.
@@ -1807,7 +1823,7 @@ class __PRIVATE_SimpleDbTransaction {
1807
1823
  *
1808
1824
  * NOTE: You CANNOT do this with a keysOnly query.
1809
1825
  */ delete() {
1810
- return __PRIVATE_wrapRequest(this.B.delete());
1826
+ return __PRIVATE_wrapRequest(this.L.delete());
1811
1827
  }
1812
1828
  }
1813
1829
 
@@ -2303,7 +2319,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2303
2319
  * there is no useful information to store as the value. The raw (unencoded)
2304
2320
  * path cannot be stored because IndexedDb doesn't store prototype
2305
2321
  * information.
2306
- */ const x = {}, O = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], N = [ "prefixPath", "collectionGroup", "documentId" ], L = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], B = [ "canonicalId", "targetId" ], k = [ "targetId", "path" ], q = [ "path", "targetId" ], Q = [ "collectionId", "parent" ], K = [ "indexId", "uid" ], $ = [ "uid", "sequenceNumber" ], U = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], W = [ "indexId", "uid", "orderedDocumentKey" ], G = [ "userId", "collectionPath", "documentId" ], z = [ "userId", "collectionPath", "largestBatchId" ], j = [ "userId", "collectionGroup", "largestBatchId" ], H = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], J = [ ...H, "documentOverlays" ], Y = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], Z = Y, X = [ ...Z, "indexConfiguration", "indexState", "indexEntries" ], ee = X, te = [ ...X, "globals" ];
2322
+ */ const x = {}, O = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], N = [ "prefixPath", "collectionGroup", "documentId" ], B = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], L = [ "canonicalId", "targetId" ], k = [ "targetId", "path" ], q = [ "path", "targetId" ], Q = [ "collectionId", "parent" ], K = [ "indexId", "uid" ], $ = [ "uid", "sequenceNumber" ], U = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], W = [ "indexId", "uid", "orderedDocumentKey" ], G = [ "userId", "collectionPath", "documentId" ], z = [ "userId", "collectionPath", "largestBatchId" ], j = [ "userId", "collectionGroup", "largestBatchId" ], H = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], J = [ ...H, "documentOverlays" ], Y = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], Z = Y, X = [ ...Z, "indexConfiguration", "indexState", "indexEntries" ], ee = X, te = [ ...X, "globals" ];
2307
2323
 
2308
2324
  /**
2309
2325
  * @license
@@ -5893,7 +5909,7 @@ class BloomFilter {
5893
5909
  }
5894
5910
  // Calculate the ith hash value based on the hashed 64bit integers,
5895
5911
  // and calculate its corresponding bit index in the bitmap to be checked.
5896
- Ee(e, t, n) {
5912
+ de(e, t, n) {
5897
5913
  // Calculate hashed value h(i) = h1 + (i * h2).
5898
5914
  let r = e.add(t.multiply(Integer.fromNumber(n)));
5899
5915
  // Wrap if hash value overflow 64bit.
@@ -5901,7 +5917,7 @@ class BloomFilter {
5901
5917
  r.modulo(this.Ie).toNumber();
5902
5918
  }
5903
5919
  // Return whether the bit on the given index in the bitmap is set to 1.
5904
- de(e) {
5920
+ Ee(e) {
5905
5921
  return 0 != (this.bitmap[Math.floor(e / 8)] & 1 << e % 8);
5906
5922
  }
5907
5923
  mightContain(e) {
@@ -5909,8 +5925,8 @@ class BloomFilter {
5909
5925
  if (0 === this.Te) return !1;
5910
5926
  const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
5911
5927
  for (let e = 0; e < this.hashCount; e++) {
5912
- const t = this.Ee(n, r, e);
5913
- if (!this.de(t)) return !1;
5928
+ const t = this.de(n, r, e);
5929
+ if (!this.Ee(t)) return !1;
5914
5930
  }
5915
5931
  return !0;
5916
5932
  }
@@ -5922,7 +5938,7 @@ class BloomFilter {
5922
5938
  if (0 === this.Te) return;
5923
5939
  const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
5924
5940
  for (let e = 0; e < this.hashCount; e++) {
5925
- const t = this.Ee(n, r, e);
5941
+ const t = this.de(n, r, e);
5926
5942
  this.Ae(t);
5927
5943
  }
5928
5944
  }
@@ -6147,10 +6163,10 @@ class __PRIVATE_WatchTargetChange {
6147
6163
  /** The last resume token sent to us for this target. */ get resumeToken() {
6148
6164
  return this.pe;
6149
6165
  }
6150
- /** Whether this target has pending target adds or target removes. */ get be() {
6166
+ /** Whether this target has pending target adds or target removes. */ get Se() {
6151
6167
  return 0 !== this.fe;
6152
6168
  }
6153
- /** Whether we have modified any state that should trigger a snapshot. */ get Se() {
6169
+ /** Whether we have modified any state that should trigger a snapshot. */ get be() {
6154
6170
  return this.we;
6155
6171
  }
6156
6172
  /**
@@ -6212,9 +6228,9 @@ class __PRIVATE_WatchTargetChange {
6212
6228
  */
6213
6229
  class __PRIVATE_WatchChangeAggregator {
6214
6230
  constructor(e) {
6215
- this.Le = e,
6231
+ this.Be = e,
6216
6232
  /** The internal state of all tracked targets. */
6217
- this.Be = new Map,
6233
+ this.Le = new Map,
6218
6234
  /** Keeps track of the documents to update since the last raised snapshot. */
6219
6235
  this.ke = __PRIVATE_mutableDocumentMap(), this.qe = __PRIVATE_documentTargetMap(),
6220
6236
  /** A mapping of document keys to their set of target IDs. */
@@ -6243,7 +6259,7 @@ class __PRIVATE_WatchChangeAggregator {
6243
6259
  case 1 /* WatchTargetChangeState.Added */ :
6244
6260
  // We need to decrement the number of pending acks needed from watch
6245
6261
  // for this targetId.
6246
- n.Oe(), n.be ||
6262
+ n.Oe(), n.Se ||
6247
6263
  // We have a freshly added target, so we need to reset any state
6248
6264
  // that we had previously. This can happen e.g. when remove and add
6249
6265
  // back a target for existence filter mismatches.
@@ -6255,7 +6271,7 @@ class __PRIVATE_WatchChangeAggregator {
6255
6271
  // remove any target changes.
6256
6272
  // We need to decrement the number of pending acks needed from watch
6257
6273
  // for this targetId.
6258
- n.Oe(), n.be || this.removeTarget(t);
6274
+ n.Oe(), n.Se || this.removeTarget(t);
6259
6275
  break;
6260
6276
 
6261
6277
  case 3 /* WatchTargetChangeState.Current */ :
@@ -6280,7 +6296,7 @@ class __PRIVATE_WatchChangeAggregator {
6280
6296
  * targetIds explicitly listed in the change or the targetIds of all currently
6281
6297
  * active targets.
6282
6298
  */ forEachTarget(e, t) {
6283
- e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Be.forEach(((e, n) => {
6299
+ e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Le.forEach(((e, n) => {
6284
6300
  this.je(n) && t(n);
6285
6301
  }));
6286
6302
  }
@@ -6350,7 +6366,7 @@ class __PRIVATE_WatchChangeAggregator {
6350
6366
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6351
6367
  * See the License for the specific language governing permissions and
6352
6368
  * limitations under the License.
6353
- */ (r, e.me, this.Le.nt(), n, i));
6369
+ */ (r, e.me, this.Be.nt(), n, i));
6354
6370
  }
6355
6371
  }
6356
6372
  }
@@ -6389,10 +6405,10 @@ class __PRIVATE_WatchChangeAggregator {
6389
6405
  * Filter out removed documents based on bloom filter membership result and
6390
6406
  * return number of documents removed.
6391
6407
  */ rt(e, t) {
6392
- const n = this.Le.getRemoteKeysForTarget(t);
6408
+ const n = this.Be.getRemoteKeysForTarget(t);
6393
6409
  let r = 0;
6394
6410
  return n.forEach((n => {
6395
- const i = this.Le.nt(), s = `projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;
6411
+ const i = this.Be.nt(), s = `projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;
6396
6412
  e.mightContain(s) || (this.We(t, n, /*updatedDocument=*/ null), r++);
6397
6413
  })), r;
6398
6414
  }
@@ -6401,7 +6417,7 @@ class __PRIVATE_WatchChangeAggregator {
6401
6417
  * provided snapshot version. Resets the accumulated changes before returning.
6402
6418
  */ it(e) {
6403
6419
  const t = new Map;
6404
- this.Be.forEach(((n, r) => {
6420
+ this.Le.forEach(((n, r) => {
6405
6421
  const i = this.Ye(r);
6406
6422
  if (i) {
6407
6423
  if (n.current && __PRIVATE_targetIsDocumentTarget(i.target)) {
@@ -6416,7 +6432,7 @@ class __PRIVATE_WatchChangeAggregator {
6416
6432
  const t = new DocumentKey(i.target.path);
6417
6433
  this.st(t).has(r) || this.ot(r, t) || this.We(r, t, MutableDocument.newNoDocument(t, e));
6418
6434
  }
6419
- n.Se && (t.set(r, n.ve()), n.Ce());
6435
+ n.be && (t.set(r, n.ve()), n.Ce());
6420
6436
  }
6421
6437
  }));
6422
6438
  let n = __PRIVATE_documentKeySet();
@@ -6467,7 +6483,7 @@ class __PRIVATE_WatchChangeAggregator {
6467
6483
  n && (this.ke = this.ke.insert(t, n));
6468
6484
  }
6469
6485
  removeTarget(e) {
6470
- this.Be.delete(e);
6486
+ this.Le.delete(e);
6471
6487
  }
6472
6488
  /**
6473
6489
  * Returns the current count of documents in the target. This includes both
@@ -6475,7 +6491,7 @@ class __PRIVATE_WatchChangeAggregator {
6475
6491
  * target as well as any accumulated changes.
6476
6492
  */ Ze(e) {
6477
6493
  const t = this.ze(e).ve();
6478
- return this.Le.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
6494
+ return this.Be.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
6479
6495
  }
6480
6496
  /**
6481
6497
  * Increment the number of acks needed from watch before we can consider the
@@ -6484,8 +6500,8 @@ class __PRIVATE_WatchChangeAggregator {
6484
6500
  this.ze(e).xe();
6485
6501
  }
6486
6502
  ze(e) {
6487
- let t = this.Be.get(e);
6488
- return t || (t = new __PRIVATE_TargetState, this.Be.set(e, t)), t;
6503
+ let t = this.Le.get(e);
6504
+ return t || (t = new __PRIVATE_TargetState, this.Le.set(e, t)), t;
6489
6505
  }
6490
6506
  _t(e) {
6491
6507
  let t = this.Qe.get(e);
@@ -6510,16 +6526,16 @@ class __PRIVATE_WatchChangeAggregator {
6510
6526
  * Returns the TargetData for an active target (i.e. a target that the user
6511
6527
  * is still interested in that has no outstanding target change requests).
6512
6528
  */ Ye(e) {
6513
- const t = this.Be.get(e);
6514
- return t && t.be ? null : this.Le.ut(e);
6529
+ const t = this.Le.get(e);
6530
+ return t && t.Se ? null : this.Be.ut(e);
6515
6531
  }
6516
6532
  /**
6517
6533
  * Resets the state of a Watch target to its initial state (e.g. sets
6518
6534
  * 'current' to false, clears the resume token and removes its target mapping
6519
6535
  * from all documents).
6520
6536
  */ He(e) {
6521
- this.Be.set(e, new __PRIVATE_TargetState);
6522
- this.Le.getRemoteKeysForTarget(e).forEach((t => {
6537
+ this.Le.set(e, new __PRIVATE_TargetState);
6538
+ this.Be.getRemoteKeysForTarget(e).forEach((t => {
6523
6539
  this.We(e, t, /*updatedDocument=*/ null);
6524
6540
  }));
6525
6541
  }
@@ -6527,7 +6543,7 @@ class __PRIVATE_WatchChangeAggregator {
6527
6543
  * Returns whether the LocalStore considers the document to be part of the
6528
6544
  * specified target.
6529
6545
  */ ot(e, t) {
6530
- return this.Le.getRemoteKeysForTarget(e).has(t);
6546
+ return this.Be.getRemoteKeysForTarget(e).has(t);
6531
6547
  }
6532
6548
  }
6533
6549
 
@@ -6545,7 +6561,7 @@ const Ie = (() => {
6545
6561
  desc: "DESCENDING"
6546
6562
  };
6547
6563
  return e;
6548
- })(), Ee = (() => {
6564
+ })(), de = (() => {
6549
6565
  const e = {
6550
6566
  "<": "LESS_THAN",
6551
6567
  "<=": "LESS_THAN_OR_EQUAL",
@@ -6559,7 +6575,7 @@ const Ie = (() => {
6559
6575
  "array-contains-any": "ARRAY_CONTAINS_ANY"
6560
6576
  };
6561
6577
  return e;
6562
- })(), de = (() => {
6578
+ })(), Ee = (() => {
6563
6579
  const e = {
6564
6580
  and: "AND",
6565
6581
  or: "OR"
@@ -7135,11 +7151,11 @@ function __PRIVATE_toDirection(e) {
7135
7151
  }
7136
7152
 
7137
7153
  function __PRIVATE_toOperatorName(e) {
7138
- return Ee[e];
7154
+ return de[e];
7139
7155
  }
7140
7156
 
7141
7157
  function __PRIVATE_toCompositeOperatorName(e) {
7142
- return de[e];
7158
+ return Ee[e];
7143
7159
  }
7144
7160
 
7145
7161
  function __PRIVATE_toFieldPathReference(e) {
@@ -7716,13 +7732,13 @@ class __PRIVATE_FirestoreIndexValueWriter {
7716
7732
  // ["bar", [2, truncated("foo")]] -> (STRING, "bar", TERM, ARRAY, NUMBER, 2, STRING, "foo", TRUNC)
7717
7733
  // ["bar", truncated(["foo"])] -> (STRING, "bar", TERM, ARRAY. STRING, "foo", TERM, TRUNC)
7718
7734
  /** Writes an index value. */
7719
- Et(e, t) {
7720
- this.dt(e, t),
7735
+ dt(e, t) {
7736
+ this.Et(e, t),
7721
7737
  // Write separator to split index values
7722
7738
  // (see go/firestore-storage-format#encodings).
7723
7739
  t.At();
7724
7740
  }
7725
- dt(e, t) {
7741
+ Et(e, t) {
7726
7742
  if ("nullValue" in e) this.Rt(t, 5); else if ("booleanValue" in e) this.Rt(t, 10),
7727
7743
  t.Vt(e.booleanValue ? 1 : 0); else if ("integerValue" in e) this.Rt(t, 15), t.Vt(__PRIVATE_normalizeNumber(e.integerValue)); else if ("doubleValue" in e) {
7728
7744
  const n = __PRIVATE_normalizeNumber(e.doubleValue);
@@ -7734,10 +7750,10 @@ class __PRIVATE_FirestoreIndexValueWriter {
7734
7750
  this.Rt(t, 20), "string" == typeof n && (n = __PRIVATE_normalizeTimestamp(n)), t.ft(`${n.seconds || ""}`),
7735
7751
  t.Vt(n.nanos || 0);
7736
7752
  } else if ("stringValue" in e) this.gt(e.stringValue, t), this.yt(t); else if ("bytesValue" in e) this.Rt(t, 30),
7737
- t.wt(__PRIVATE_normalizeByteString(e.bytesValue)), this.yt(t); else if ("referenceValue" in e) this.bt(e.referenceValue, t); else if ("geoPointValue" in e) {
7753
+ t.wt(__PRIVATE_normalizeByteString(e.bytesValue)), this.yt(t); else if ("referenceValue" in e) this.St(e.referenceValue, t); else if ("geoPointValue" in e) {
7738
7754
  const n = e.geoPointValue;
7739
7755
  this.Rt(t, 45), t.Vt(n.latitude || 0), t.Vt(n.longitude || 0);
7740
- } else "mapValue" in e ? __PRIVATE_isMaxValue(e) ? this.Rt(t, Number.MAX_SAFE_INTEGER) : __PRIVATE_isVectorValue(e) ? this.St(e.mapValue, t) : (this.Dt(e.mapValue, t),
7756
+ } else "mapValue" in e ? __PRIVATE_isMaxValue(e) ? this.Rt(t, Number.MAX_SAFE_INTEGER) : __PRIVATE_isVectorValue(e) ? this.bt(e.mapValue, t) : (this.Dt(e.mapValue, t),
7741
7757
  this.yt(t)) : "arrayValue" in e ? (this.vt(e.arrayValue, t), this.yt(t)) : fail();
7742
7758
  }
7743
7759
  gt(e, t) {
@@ -7749,9 +7765,9 @@ class __PRIVATE_FirestoreIndexValueWriter {
7749
7765
  Dt(e, t) {
7750
7766
  const n = e.fields || {};
7751
7767
  this.Rt(t, 55);
7752
- for (const e of Object.keys(n)) this.gt(e, t), this.dt(n[e], t);
7768
+ for (const e of Object.keys(n)) this.gt(e, t), this.Et(n[e], t);
7753
7769
  }
7754
- St(e, t) {
7770
+ bt(e, t) {
7755
7771
  var n, r;
7756
7772
  const i = e.fields || {};
7757
7773
  this.Rt(t, 53);
@@ -7759,14 +7775,14 @@ class __PRIVATE_FirestoreIndexValueWriter {
7759
7775
  const s = "value", o = (null === (r = null === (n = i[s].arrayValue) || void 0 === n ? void 0 : n.values) || void 0 === r ? void 0 : r.length) || 0;
7760
7776
  this.Rt(t, 15), t.Vt(__PRIVATE_normalizeNumber(o)),
7761
7777
  // Vectors then sort by position value
7762
- this.gt(s, t), this.dt(i[s], t);
7778
+ this.gt(s, t), this.Et(i[s], t);
7763
7779
  }
7764
7780
  vt(e, t) {
7765
7781
  const n = e.values || [];
7766
7782
  this.Rt(t, 50);
7767
- for (const e of n) this.dt(e, t);
7783
+ for (const e of n) this.Et(e, t);
7768
7784
  }
7769
- bt(e, t) {
7785
+ St(e, t) {
7770
7786
  this.Rt(t, 37);
7771
7787
  DocumentKey.fromName(e).path.forEach((e => {
7772
7788
  this.Rt(t, 60), this.Ct(e, t);
@@ -7838,8 +7854,8 @@ function __PRIVATE_unsignedNumLength(e) {
7838
7854
  Nt(e) {
7839
7855
  const t = e[Symbol.iterator]();
7840
7856
  let n = t.next();
7841
- for (;!n.done; ) this.Lt(n.value), n = t.next();
7842
- this.Bt();
7857
+ for (;!n.done; ) this.Bt(n.value), n = t.next();
7858
+ this.Lt();
7843
7859
  }
7844
7860
  /** Writes utf8 bytes into this byte sequence, ascending. */ kt(e) {
7845
7861
  for (const t of e) {
@@ -7856,14 +7872,14 @@ function __PRIVATE_unsignedNumLength(e) {
7856
7872
  /** Writes utf8 bytes into this byte sequence, descending */ qt(e) {
7857
7873
  for (const t of e) {
7858
7874
  const e = t.charCodeAt(0);
7859
- if (e < 128) this.Lt(e); else if (e < 2048) this.Lt(960 | e >>> 6), this.Lt(128 | 63 & e); else if (t < "\ud800" || "\udbff" < t) this.Lt(480 | e >>> 12),
7860
- this.Lt(128 | 63 & e >>> 6), this.Lt(128 | 63 & e); else {
7875
+ if (e < 128) this.Bt(e); else if (e < 2048) this.Bt(960 | e >>> 6), this.Bt(128 | 63 & e); else if (t < "\ud800" || "\udbff" < t) this.Bt(480 | e >>> 12),
7876
+ this.Bt(128 | 63 & e >>> 6), this.Bt(128 | 63 & e); else {
7861
7877
  const e = t.codePointAt(0);
7862
- this.Lt(240 | e >>> 18), this.Lt(128 | 63 & e >>> 12), this.Lt(128 | 63 & e >>> 6),
7863
- this.Lt(128 | 63 & e);
7878
+ this.Bt(240 | e >>> 18), this.Bt(128 | 63 & e >>> 12), this.Bt(128 | 63 & e >>> 6),
7879
+ this.Bt(128 | 63 & e);
7864
7880
  }
7865
7881
  }
7866
- this.Bt();
7882
+ this.Lt();
7867
7883
  }
7868
7884
  Qt(e) {
7869
7885
  // Values are encoded with a single byte length prefix, followed by the
@@ -7929,14 +7945,14 @@ function __PRIVATE_unsignedNumLength(e) {
7929
7945
  const t = 255 & e;
7930
7946
  0 === t ? (this.Gt(0), this.Gt(255)) : 255 === t ? (this.Gt(255), this.Gt(0)) : this.Gt(t);
7931
7947
  }
7932
- /** Writes a single byte descending to the buffer. */ Lt(e) {
7948
+ /** Writes a single byte descending to the buffer. */ Bt(e) {
7933
7949
  const t = 255 & e;
7934
7950
  0 === t ? (this.jt(0), this.jt(255)) : 255 === t ? (this.jt(255), this.jt(0)) : this.jt(e);
7935
7951
  }
7936
7952
  Ot() {
7937
7953
  this.Gt(0), this.Gt(1);
7938
7954
  }
7939
- Bt() {
7955
+ Lt() {
7940
7956
  this.jt(0), this.jt(1);
7941
7957
  }
7942
7958
  Gt(e) {
@@ -8688,7 +8704,7 @@ class __PRIVATE_IndexedDbIndexManager {
8688
8704
  n.push(t.value), r && (r = t.inclusive);
8689
8705
  }
8690
8706
  return new Bound(n, r);
8691
- }(s, i), c = this.En(i, s, a), l = this.En(i, s, u), h = this.dn(i, s, _), P = this.An(i.indexId, o, c, a.inclusive, l, u.inclusive, h);
8707
+ }(s, i), c = this.dn(i, s, a), l = this.dn(i, s, u), h = this.En(i, s, _), P = this.An(i.indexId, o, c, a.inclusive, l, u.inclusive, h);
8692
8708
  return PersistencePromise.forEach(P, (i => n.G(i, t.limit).next((t => {
8693
8709
  t.forEach((t => {
8694
8710
  const n = DocumentKey.fromSegments(t.documentKey);
@@ -8782,13 +8798,13 @@ class __PRIVATE_IndexedDbIndexManager {
8782
8798
  const e = t.data.field(r.fieldPath);
8783
8799
  if (null == e) return null;
8784
8800
  const i = n.Xt(r.kind);
8785
- __PRIVATE_FirestoreIndexValueWriter.Ft.Et(e, i);
8801
+ __PRIVATE_FirestoreIndexValueWriter.Ft.dt(e, i);
8786
8802
  }
8787
8803
  return n.Ht();
8788
8804
  }
8789
8805
  /** Encodes a single value to the ascending index format. */ Rn(e) {
8790
8806
  const t = new __PRIVATE_IndexByteEncoder;
8791
- return __PRIVATE_FirestoreIndexValueWriter.Ft.Et(e, t.Xt(0 /* IndexKind.ASCENDING */)),
8807
+ return __PRIVATE_FirestoreIndexValueWriter.Ft.dt(e, t.Xt(0 /* IndexKind.ASCENDING */)),
8792
8808
  t.Ht();
8793
8809
  }
8794
8810
  /**
@@ -8796,7 +8812,7 @@ class __PRIVATE_IndexedDbIndexManager {
8796
8812
  * ordering of the field index.
8797
8813
  */ gn(e, t) {
8798
8814
  const n = new __PRIVATE_IndexByteEncoder;
8799
- return __PRIVATE_FirestoreIndexValueWriter.Ft.Et(__PRIVATE_refValue(this.databaseId, t), n.Xt(function __PRIVATE_fieldIndexGetKeyOrder(e) {
8815
+ return __PRIVATE_FirestoreIndexValueWriter.Ft.dt(__PRIVATE_refValue(this.databaseId, t), n.Xt(function __PRIVATE_fieldIndexGetKeyOrder(e) {
8800
8816
  const t = __PRIVATE_fieldIndexGetDirectionalSegments(e);
8801
8817
  return 0 === t.length ? 0 /* IndexKind.ASCENDING */ : t[t.length - 1].kind;
8802
8818
  }(e))), n.Ht();
@@ -8804,7 +8820,7 @@ class __PRIVATE_IndexedDbIndexManager {
8804
8820
  /**
8805
8821
  * Encodes the given field values according to the specification in `target`.
8806
8822
  * For IN queries, a list of possible values is returned.
8807
- */ dn(e, t, n) {
8823
+ */ En(e, t, n) {
8808
8824
  if (null === n) return [];
8809
8825
  let r = [];
8810
8826
  r.push(new __PRIVATE_IndexByteEncoder);
@@ -8813,7 +8829,7 @@ class __PRIVATE_IndexedDbIndexManager {
8813
8829
  const e = n[i++];
8814
8830
  for (const n of r) if (this.pn(t, s.fieldPath) && isArray(e)) r = this.yn(r, s, e); else {
8815
8831
  const t = n.Xt(s.kind);
8816
- __PRIVATE_FirestoreIndexValueWriter.Ft.Et(e, t);
8832
+ __PRIVATE_FirestoreIndexValueWriter.Ft.dt(e, t);
8817
8833
  }
8818
8834
  }
8819
8835
  return this.wn(r);
@@ -8821,8 +8837,8 @@ class __PRIVATE_IndexedDbIndexManager {
8821
8837
  /**
8822
8838
  * Encodes the given bounds according to the specification in `target`. For IN
8823
8839
  * queries, a list of possible values is returned.
8824
- */ En(e, t, n) {
8825
- return this.dn(e, t, n.position);
8840
+ */ dn(e, t, n) {
8841
+ return this.En(e, t, n.position);
8826
8842
  }
8827
8843
  /** Returns the byte representation for the provided encoders. */ wn(e) {
8828
8844
  const t = [];
@@ -8839,7 +8855,7 @@ class __PRIVATE_IndexedDbIndexManager {
8839
8855
  const r = [ ...e ], i = [];
8840
8856
  for (const e of n.arrayValue.values || []) for (const n of r) {
8841
8857
  const r = new __PRIVATE_IndexByteEncoder;
8842
- r.seed(n.Ht()), __PRIVATE_FirestoreIndexValueWriter.Ft.Et(e, r.Xt(t.kind)), i.push(r);
8858
+ r.seed(n.Ht()), __PRIVATE_FirestoreIndexValueWriter.Ft.dt(e, r.Xt(t.kind)), i.push(r);
8843
8859
  }
8844
8860
  return i;
8845
8861
  }
@@ -8866,7 +8882,7 @@ class __PRIVATE_IndexedDbIndexManager {
8866
8882
  }
8867
8883
  updateCollectionGroup(e, t, n) {
8868
8884
  const r = __PRIVATE_indexConfigurationStore(e), i = __PRIVATE_indexStateStore(e);
8869
- return this.bn(e).next((e => r.U("collectionGroupIndex", IDBKeyRange.bound(t, t)).next((t => PersistencePromise.forEach(t, (t => i.put(__PRIVATE_toDbIndexState(t.indexId, this.uid, e, n))))))));
8885
+ return this.Sn(e).next((e => r.U("collectionGroupIndex", IDBKeyRange.bound(t, t)).next((t => PersistencePromise.forEach(t, (t => i.put(__PRIVATE_toDbIndexState(t.indexId, this.uid, e, n))))))));
8870
8886
  }
8871
8887
  updateIndexEntries(e, t) {
8872
8888
  // Porting Note: `getFieldIndexes()` on Web does not cache index lookups as
@@ -8878,7 +8894,7 @@ class __PRIVATE_IndexedDbIndexManager {
8878
8894
  return PersistencePromise.forEach(t, ((t, r) => {
8879
8895
  const i = n.get(t.collectionGroup);
8880
8896
  return (i ? PersistencePromise.resolve(i) : this.getFieldIndexes(e, t.collectionGroup)).next((i => (n.set(t.collectionGroup, i),
8881
- PersistencePromise.forEach(i, (n => this.Sn(e, t, n).next((t => {
8897
+ PersistencePromise.forEach(i, (n => this.bn(e, t, n).next((t => {
8882
8898
  const i = this.Dn(r, n);
8883
8899
  return t.isEqual(i) ? PersistencePromise.resolve() : this.vn(e, r, n, t, i);
8884
8900
  })))))));
@@ -8897,7 +8913,7 @@ class __PRIVATE_IndexedDbIndexManager {
8897
8913
  Fn(e, t, n, r) {
8898
8914
  return __PRIVATE_indexEntriesStore(e).delete([ r.indexId, this.uid, r.arrayValue, r.directionalValue, this.gn(n, t.key), t.key.path.toArray() ]);
8899
8915
  }
8900
- Sn(e, t, n) {
8916
+ bn(e, t, n) {
8901
8917
  const r = __PRIVATE_indexEntriesStore(e);
8902
8918
  let i = new SortedSet(__PRIVATE_indexEntryComparator);
8903
8919
  return r.J({
@@ -8953,7 +8969,7 @@ class __PRIVATE_IndexedDbIndexManager {
8953
8969
  s.push(this.Fn(e, t, n, r));
8954
8970
  })), PersistencePromise.waitFor(s);
8955
8971
  }
8956
- bn(e) {
8972
+ Sn(e) {
8957
8973
  let t = 1;
8958
8974
  return __PRIVATE_indexStateStore(e).J({
8959
8975
  index: "sequenceNumberIndex",
@@ -9352,7 +9368,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9352
9368
  }
9353
9369
  removeMutationBatch(e, t) {
9354
9370
  return removeMutationBatch(e._e, this.userId, t).next((n => (e.addOnCommittedListener((() => {
9355
- this.Ln(t.batchId);
9371
+ this.Bn(t.batchId);
9356
9372
  })), PersistencePromise.forEach(n, (t => this.referenceDelegate.markPotentiallyOrphaned(e, t))))));
9357
9373
  }
9358
9374
  /**
@@ -9364,7 +9380,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9364
9380
  * rejected batch is removed from the mutation queue.
9365
9381
  */
9366
9382
  // PORTING NOTE: Multi-tab only
9367
- Ln(e) {
9383
+ Bn(e) {
9368
9384
  delete this.xn[e];
9369
9385
  }
9370
9386
  performConsistencyCheck(e) {
@@ -9397,7 +9413,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9397
9413
  }
9398
9414
  // PORTING NOTE: Multi-tab only (state is held in memory in other clients).
9399
9415
  /** Returns the mutation queue's metadata from IndexedDb. */
9400
- Bn(e) {
9416
+ Ln(e) {
9401
9417
  return __PRIVATE_mutationQueuesStore(e).get(this.userId).next((e => e || {
9402
9418
  userId: this.userId,
9403
9419
  lastAcknowledgedBatchId: -1,
@@ -10738,7 +10754,7 @@ class OverlayedDocument {
10738
10754
  constructor() {
10739
10755
  // A map sorted by DocumentKey, whose value is a pair of the largest batch id
10740
10756
  // for the overlay and the overlay itself.
10741
- this.overlays = new SortedMap(DocumentKey.comparator), this.Er = new Map;
10757
+ this.overlays = new SortedMap(DocumentKey.comparator), this.dr = new Map;
10742
10758
  }
10743
10759
  getOverlay(e, t) {
10744
10760
  return PersistencePromise.resolve(this.overlays.get(t));
@@ -10755,9 +10771,9 @@ class OverlayedDocument {
10755
10771
  })), PersistencePromise.resolve();
10756
10772
  }
10757
10773
  removeOverlaysForBatchId(e, t, n) {
10758
- const r = this.Er.get(n);
10774
+ const r = this.dr.get(n);
10759
10775
  return void 0 !== r && (r.forEach((e => this.overlays = this.overlays.remove(e))),
10760
- this.Er.delete(n)), PersistencePromise.resolve();
10776
+ this.dr.delete(n)), PersistencePromise.resolve();
10761
10777
  }
10762
10778
  getOverlaysForCollection(e, t, n) {
10763
10779
  const r = __PRIVATE_newOverlayMap(), i = t.length + 1, s = new DocumentKey(t.child("")), o = this.overlays.getIteratorFrom(s);
@@ -10790,13 +10806,13 @@ class OverlayedDocument {
10790
10806
  // Remove the association of the overlay to its batch id.
10791
10807
  const r = this.overlays.get(n.key);
10792
10808
  if (null !== r) {
10793
- const e = this.Er.get(r.largestBatchId).delete(n.key);
10794
- this.Er.set(r.largestBatchId, e);
10809
+ const e = this.dr.get(r.largestBatchId).delete(n.key);
10810
+ this.dr.set(r.largestBatchId, e);
10795
10811
  }
10796
10812
  this.overlays = this.overlays.insert(n.key, new Overlay(t, n));
10797
10813
  // Create the association of this overlay to the given largestBatchId.
10798
- let i = this.Er.get(t);
10799
- void 0 === i && (i = __PRIVATE_documentKeySet(), this.Er.set(t, i)), this.Er.set(t, i.add(n.key));
10814
+ let i = this.dr.get(t);
10815
+ void 0 === i && (i = __PRIVATE_documentKeySet(), this.dr.set(t, i)), this.dr.set(t, i.add(n.key));
10800
10816
  }
10801
10817
  }
10802
10818
 
@@ -10860,16 +10876,16 @@ class OverlayedDocument {
10860
10876
  */ class __PRIVATE_ReferenceSet {
10861
10877
  constructor() {
10862
10878
  // A set of outstanding references to a document sorted by key.
10863
- this.dr = new SortedSet(__PRIVATE_DocReference.Ar),
10879
+ this.Er = new SortedSet(__PRIVATE_DocReference.Ar),
10864
10880
  // A set of outstanding references to a document sorted by target id.
10865
10881
  this.Rr = new SortedSet(__PRIVATE_DocReference.Vr);
10866
10882
  }
10867
10883
  /** Returns true if the reference set contains no references. */ isEmpty() {
10868
- return this.dr.isEmpty();
10884
+ return this.Er.isEmpty();
10869
10885
  }
10870
10886
  /** Adds a reference to the given document key for the given ID. */ addReference(e, t) {
10871
10887
  const n = new __PRIVATE_DocReference(e, t);
10872
- this.dr = this.dr.add(n), this.Rr = this.Rr.add(n);
10888
+ this.Er = this.Er.add(n), this.Rr = this.Rr.add(n);
10873
10889
  }
10874
10890
  /** Add references to the given document keys for the given ID. */ mr(e, t) {
10875
10891
  e.forEach((e => this.addReference(e, t)));
@@ -10893,12 +10909,12 @@ class OverlayedDocument {
10893
10909
  })), i;
10894
10910
  }
10895
10911
  wr() {
10896
- this.dr.forEach((e => this.gr(e)));
10912
+ this.Er.forEach((e => this.gr(e)));
10897
10913
  }
10898
10914
  gr(e) {
10899
- this.dr = this.dr.delete(e), this.Rr = this.Rr.delete(e);
10915
+ this.Er = this.Er.delete(e), this.Rr = this.Rr.delete(e);
10900
10916
  }
10901
- br(e) {
10917
+ Sr(e) {
10902
10918
  const t = new DocumentKey(new ResourcePath([])), n = new __PRIVATE_DocReference(t, e), r = new __PRIVATE_DocReference(t, e + 1);
10903
10919
  let i = __PRIVATE_documentKeySet();
10904
10920
  return this.Rr.forEachInRange([ n, r ], (e => {
@@ -10906,20 +10922,20 @@ class OverlayedDocument {
10906
10922
  })), i;
10907
10923
  }
10908
10924
  containsKey(e) {
10909
- const t = new __PRIVATE_DocReference(e, 0), n = this.dr.firstAfterOrEqual(t);
10925
+ const t = new __PRIVATE_DocReference(e, 0), n = this.Er.firstAfterOrEqual(t);
10910
10926
  return null !== n && e.isEqual(n.key);
10911
10927
  }
10912
10928
  }
10913
10929
 
10914
10930
  class __PRIVATE_DocReference {
10915
10931
  constructor(e, t) {
10916
- this.key = e, this.Sr = t;
10932
+ this.key = e, this.br = t;
10917
10933
  }
10918
10934
  /** Compare by key then by ID */ static Ar(e, t) {
10919
- return DocumentKey.comparator(e.key, t.key) || __PRIVATE_primitiveComparator(e.Sr, t.Sr);
10935
+ return DocumentKey.comparator(e.key, t.key) || __PRIVATE_primitiveComparator(e.br, t.br);
10920
10936
  }
10921
10937
  /** Compare by ID then by key */ static Vr(e, t) {
10922
- return __PRIVATE_primitiveComparator(e.Sr, t.Sr) || DocumentKey.comparator(e.key, t.key);
10938
+ return __PRIVATE_primitiveComparator(e.br, t.br) || DocumentKey.comparator(e.key, t.key);
10923
10939
  }
10924
10940
  }
10925
10941
 
@@ -10982,7 +10998,7 @@ class __PRIVATE_DocReference {
10982
10998
  getAllMutationBatchesAffectingDocumentKey(e, t) {
10983
10999
  const n = new __PRIVATE_DocReference(t, 0), r = new __PRIVATE_DocReference(t, Number.POSITIVE_INFINITY), i = [];
10984
11000
  return this.vr.forEachInRange([ n, r ], (e => {
10985
- const t = this.Cr(e.Sr);
11001
+ const t = this.Cr(e.br);
10986
11002
  i.push(t);
10987
11003
  })), PersistencePromise.resolve(i);
10988
11004
  }
@@ -10991,7 +11007,7 @@ class __PRIVATE_DocReference {
10991
11007
  return t.forEach((e => {
10992
11008
  const t = new __PRIVATE_DocReference(e, 0), r = new __PRIVATE_DocReference(e, Number.POSITIVE_INFINITY);
10993
11009
  this.vr.forEachInRange([ t, r ], (e => {
10994
- n = n.add(e.Sr);
11010
+ n = n.add(e.br);
10995
11011
  }));
10996
11012
  })), PersistencePromise.resolve(this.Mr(n));
10997
11013
  }
@@ -11017,7 +11033,7 @@ class __PRIVATE_DocReference {
11017
11033
  // the document /rooms/abc/messages/xyx.
11018
11034
  // TODO(mcg): we'll need a different scanner when we implement
11019
11035
  // ancestor queries.
11020
- t.length === r && (o = o.add(e.Sr)), !0);
11036
+ t.length === r && (o = o.add(e.br)), !0);
11021
11037
  }), s), PersistencePromise.resolve(this.Mr(o));
11022
11038
  }
11023
11039
  Mr(e) {
@@ -11039,7 +11055,7 @@ class __PRIVATE_DocReference {
11039
11055
  this.vr = n;
11040
11056
  }));
11041
11057
  }
11042
- Ln(e) {
11058
+ Bn(e) {
11043
11059
  // No-op since the memory mutation queue does not maintain a separate cache.
11044
11060
  }
11045
11061
  containsKey(e, t) {
@@ -11103,6 +11119,9 @@ class __PRIVATE_DocReference {
11103
11119
  * See the License for the specific language governing permissions and
11104
11120
  * limitations under the License.
11105
11121
  */
11122
+ /**
11123
+ * The smallest value representable by a 64-bit signed integer (long).
11124
+ */
11106
11125
  /**
11107
11126
  * The memory-only RemoteDocumentCache for IndexedDb. To construct, invoke
11108
11127
  * `newMemoryRemoteDocumentCache()`.
@@ -11161,8 +11180,11 @@ class __PRIVATE_MemoryRemoteDocumentCacheImpl {
11161
11180
  let i = __PRIVATE_mutableDocumentMap();
11162
11181
  // Documents are ordered by key, so we can use a prefix scan to narrow down
11163
11182
  // the documents we need to match the query against.
11164
- const s = t.path, o = new DocumentKey(s.child("")), _ = this.docs.getIteratorFrom(o);
11165
- for (;_.hasNext(); ) {
11183
+ const s = t.path, o = new DocumentKey(s.child("__id-9223372036854775808__")), _ = this.docs.getIteratorFrom(o);
11184
+ // Document keys are ordered first by numeric value ("__id<Long>__"),
11185
+ // then lexicographically by string value. Start the iterator at the minimum
11186
+ // possible Document key value.
11187
+ for (;_.hasNext(); ) {
11166
11188
  const {key: e, value: {document: o}} = _.getNext();
11167
11189
  if (!s.isPrefixOf(e.path)) break;
11168
11190
  e.path.length > s.length + 1 || (__PRIVATE_indexOffsetComparator(__PRIVATE_newIndexOffsetFromDocument(o), n) <= 0 || (r.has(o.key) || __PRIVATE_queryMatches(t, o)) && (i = i.insert(o.key, o.mutableCopy())));
@@ -11174,7 +11196,7 @@ class __PRIVATE_MemoryRemoteDocumentCacheImpl {
11174
11196
  // is enabled.
11175
11197
  fail();
11176
11198
  }
11177
- Lr(e, t) {
11199
+ Br(e, t) {
11178
11200
  return PersistencePromise.forEach(this.docs, (e => t(e)));
11179
11201
  }
11180
11202
  newChangeBuffer(e) {
@@ -11236,7 +11258,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11236
11258
  /**
11237
11259
  * Maps a target to the data about that target
11238
11260
  */
11239
- this.Br = new ObjectMap((e => __PRIVATE_canonifyTarget(e)), __PRIVATE_targetEquals),
11261
+ this.Lr = new ObjectMap((e => __PRIVATE_canonifyTarget(e)), __PRIVATE_targetEquals),
11240
11262
  /** The last received snapshot version. */
11241
11263
  this.lastRemoteSnapshotVersion = SnapshotVersion.min(),
11242
11264
  /** The highest numbered target ID encountered. */
@@ -11250,7 +11272,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11250
11272
  this.qr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Qr = __PRIVATE_TargetIdGenerator.qn();
11251
11273
  }
11252
11274
  forEachTarget(e, t) {
11253
- return this.Br.forEach(((e, n) => t(n))), PersistencePromise.resolve();
11275
+ return this.Lr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
11254
11276
  }
11255
11277
  getLastRemoteSnapshotVersion(e) {
11256
11278
  return PersistencePromise.resolve(this.lastRemoteSnapshotVersion);
@@ -11266,7 +11288,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11266
11288
  PersistencePromise.resolve();
11267
11289
  }
11268
11290
  Un(e) {
11269
- this.Br.set(e.target, e);
11291
+ this.Lr.set(e.target, e);
11270
11292
  const t = e.targetId;
11271
11293
  t > this.highestTargetId && (this.Qr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11272
11294
  e.sequenceNumber > this.kr && (this.kr = e.sequenceNumber);
@@ -11278,14 +11300,14 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11278
11300
  return this.Un(t), PersistencePromise.resolve();
11279
11301
  }
11280
11302
  removeTargetData(e, t) {
11281
- return this.Br.delete(t.target), this.qr.yr(t.targetId), this.targetCount -= 1,
11303
+ return this.Lr.delete(t.target), this.qr.yr(t.targetId), this.targetCount -= 1,
11282
11304
  PersistencePromise.resolve();
11283
11305
  }
11284
11306
  removeTargets(e, t, n) {
11285
11307
  let r = 0;
11286
11308
  const i = [];
11287
- return this.Br.forEach(((s, o) => {
11288
- o.sequenceNumber <= t && null === n.get(o.targetId) && (this.Br.delete(s), i.push(this.removeMatchingKeysForTargetId(e, o.targetId)),
11309
+ return this.Lr.forEach(((s, o) => {
11310
+ o.sequenceNumber <= t && null === n.get(o.targetId) && (this.Lr.delete(s), i.push(this.removeMatchingKeysForTargetId(e, o.targetId)),
11289
11311
  r++);
11290
11312
  })), PersistencePromise.waitFor(i).next((() => r));
11291
11313
  }
@@ -11293,7 +11315,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11293
11315
  return PersistencePromise.resolve(this.targetCount);
11294
11316
  }
11295
11317
  getTargetData(e, t) {
11296
- const n = this.Br.get(t) || null;
11318
+ const n = this.Lr.get(t) || null;
11297
11319
  return PersistencePromise.resolve(n);
11298
11320
  }
11299
11321
  addMatchingKeys(e, t, n) {
@@ -11310,7 +11332,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11310
11332
  return this.qr.yr(t), PersistencePromise.resolve();
11311
11333
  }
11312
11334
  getMatchingKeysForTargetId(e, t) {
11313
- const n = this.qr.br(t);
11335
+ const n = this.qr.Sr(t);
11314
11336
  return PersistencePromise.resolve(n);
11315
11337
  }
11316
11338
  containsKey(e, t) {
@@ -11511,7 +11533,7 @@ class __PRIVATE_MemoryLruDelegate {
11511
11533
  removeOrphanedDocuments(e, t) {
11512
11534
  let n = 0;
11513
11535
  const r = this.persistence.getRemoteDocumentCache(), i = r.newChangeBuffer();
11514
- return r.Lr(e, (r => this.ir(e, r, t).next((e => {
11536
+ return r.Br(e, (r => this.ir(e, r, t).next((e => {
11515
11537
  e || (n++, i.removeEntry(r, SnapshotVersion.min()));
11516
11538
  })))).next((() => i.apply(e))).next((() => n));
11517
11539
  }
@@ -11677,7 +11699,7 @@ class __PRIVATE_MemoryLruDelegate {
11677
11699
  const t = e.createObjectStore("remoteDocumentsV14", {
11678
11700
  keyPath: O
11679
11701
  });
11680
- t.createIndex("documentKeyIndex", N), t.createIndex("collectionGroupIndex", L);
11702
+ t.createIndex("documentKeyIndex", N), t.createIndex("collectionGroupIndex", B);
11681
11703
  }(e))).next((() => this.ui(e, i))).next((() => e.deleteObjectStore("remoteDocuments")))),
11682
11704
  n < 14 && r >= 14 && (s = s.next((() => this.ci(e, i)))), n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11683
11705
  e.createObjectStore("indexConfiguration", {
@@ -11846,7 +11868,7 @@ function __PRIVATE_createQueryCache(e) {
11846
11868
  // NOTE: This is unique only because the TargetId is the suffix.
11847
11869
  e.createObjectStore("targets", {
11848
11870
  keyPath: "targetId"
11849
- }).createIndex("queryTargetsIndex", B, {
11871
+ }).createIndex("queryTargetsIndex", L, {
11850
11872
  unique: !0
11851
11873
  }), e.createObjectStore("targetGlobal");
11852
11874
  }
@@ -11921,9 +11943,9 @@ class __PRIVATE_IndexedDbPersistence {
11921
11943
  /** Our window.unload handler, if registered. */
11922
11944
  this.Ii = null, this.inForeground = !1,
11923
11945
  /** Our 'visibilitychange' listener if registered. */
11924
- this.Ei = null,
11925
- /** The client metadata refresh task. */
11926
11946
  this.di = null,
11947
+ /** The client metadata refresh task. */
11948
+ this.Ei = null,
11927
11949
  /** The last time we garbage collected the client metadata object store. */
11928
11950
  this.Ai = Number.NEGATIVE_INFINITY,
11929
11951
  /** A listener to notify on primary state changes. */
@@ -11961,7 +11983,7 @@ class __PRIVATE_IndexedDbPersistence {
11961
11983
  * with the current primary state.
11962
11984
  *
11963
11985
  * PORTING NOTE: This is only used for Web multi-tab.
11964
- */ bi(e) {
11986
+ */ Si(e) {
11965
11987
  return this.Ri = async t => {
11966
11988
  if (this.started) return e(t);
11967
11989
  }, e(this.isPrimary);
@@ -11972,7 +11994,7 @@ class __PRIVATE_IndexedDbPersistence {
11972
11994
  *
11973
11995
  * PORTING NOTE: This is only used for Web multi-tab.
11974
11996
  */ setDatabaseDeletedListener(e) {
11975
- this.mi.L((async t => {
11997
+ this.mi.B((async t => {
11976
11998
  // Check if an attempt is made to delete IndexedDB.
11977
11999
  null === t.newVersion && await e();
11978
12000
  }));
@@ -12002,7 +12024,7 @@ class __PRIVATE_IndexedDbPersistence {
12002
12024
  networkEnabled: this.networkEnabled,
12003
12025
  inForeground: this.inForeground
12004
12026
  }).next((() => {
12005
- if (this.isPrimary) return this.Si(e).next((e => {
12027
+ if (this.isPrimary) return this.bi(e).next((e => {
12006
12028
  e || (this.isPrimary = !1, this.li.enqueueRetryable((() => this.Ri(!1))));
12007
12029
  }));
12008
12030
  })).next((() => this.Di(e))).next((t => this.isPrimary && !t ? this.vi(e).next((() => !1)) : !!t && this.Ci(e).next((() => !0)))))).catch((e => {
@@ -12018,7 +12040,7 @@ class __PRIVATE_IndexedDbPersistence {
12018
12040
  this.isPrimary !== e && this.li.enqueueRetryable((() => this.Ri(e))), this.isPrimary = e;
12019
12041
  }));
12020
12042
  }
12021
- Si(e) {
12043
+ bi(e) {
12022
12044
  return __PRIVATE_primaryClientStore(e).get("owner").next((e => PersistencePromise.resolve(this.Fi(e))));
12023
12045
  }
12024
12046
  Mi(e) {
@@ -12044,14 +12066,14 @@ class __PRIVATE_IndexedDbPersistence {
12044
12066
  // Ideally we'd delete the IndexedDb and LocalStorage zombie entries for
12045
12067
  // the client atomically, but we can't. So we opt to delete the IndexedDb
12046
12068
  // entries first to avoid potentially reviving a zombied client.
12047
- if (this.fi) for (const t of e) this.fi.removeItem(this.Li(t.clientId));
12069
+ if (this.fi) for (const t of e) this.fi.removeItem(this.Bi(t.clientId));
12048
12070
  }
12049
12071
  }
12050
12072
  /**
12051
12073
  * Schedules a recurring timer to update the client metadata and to either
12052
12074
  * extend or acquire the primary lease if the client is eligible.
12053
12075
  */ wi() {
12054
- this.di = this.li.enqueueAfterDelay("client_metadata_refresh" /* TimerId.ClientMetadataRefresh */ , 4e3, (() => this.gi().then((() => this.xi())).then((() => this.wi()))));
12076
+ this.Ei = this.li.enqueueAfterDelay("client_metadata_refresh" /* TimerId.ClientMetadataRefresh */ , 4e3, (() => this.gi().then((() => this.xi())).then((() => this.wi()))));
12055
12077
  }
12056
12078
  /** Checks whether `client` is the local client. */ Fi(e) {
12057
12079
  return !!e && e.ownerId === this.clientId;
@@ -12074,7 +12096,7 @@ class __PRIVATE_IndexedDbPersistence {
12074
12096
  // - every clients network is disabled and no other client's tab is in
12075
12097
  // the foreground.
12076
12098
  // - the `forceOwningTab` setting was passed in.
12077
- if (null !== t && this.Oi(t.leaseTimestampMs, 5e3) && !this.Bi(t.ownerId)) {
12099
+ if (null !== t && this.Oi(t.leaseTimestampMs, 5e3) && !this.Li(t.ownerId)) {
12078
12100
  if (this.Fi(t) && this.networkEnabled) return !0;
12079
12101
  if (!this.Fi(t)) {
12080
12102
  if (!t.allowTabSynchronization)
@@ -12106,7 +12128,7 @@ class __PRIVATE_IndexedDbPersistence {
12106
12128
  async shutdown() {
12107
12129
  // The shutdown() operations are idempotent and can be called even when
12108
12130
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12109
- this.Ur = !1, this.ki(), this.di && (this.di.cancel(), this.di = null), this.qi(),
12131
+ this.Ur = !1, this.ki(), this.Ei && (this.Ei.cancel(), this.Ei = null), this.qi(),
12110
12132
  this.Qi(),
12111
12133
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12112
12134
  // has obtained the primary lease.
@@ -12122,7 +12144,7 @@ class __PRIVATE_IndexedDbPersistence {
12122
12144
  * Returns clients that are not zombied and have an updateTime within the
12123
12145
  * provided threshold.
12124
12146
  */ Ni(e, t) {
12125
- return e.filter((e => this.Oi(e.updateTimeMs, t) && !this.Bi(e.clientId)));
12147
+ return e.filter((e => this.Oi(e.updateTimeMs, t) && !this.Li(e.clientId)));
12126
12148
  }
12127
12149
  /**
12128
12150
  * Returns the IDs of the clients that are currently active. If multi-tab
@@ -12168,7 +12190,7 @@ class __PRIVATE_IndexedDbPersistence {
12168
12190
  // Do all transactions as readwrite against all object stores, since we
12169
12191
  // are the only reader/writer.
12170
12192
  return this.mi.runTransaction(e, r, i, (r => (s = new __PRIVATE_IndexedDbTransaction(r, this.$r ? this.$r.next() : __PRIVATE_ListenSequence.oe),
12171
- "readwrite-primary" === t ? this.Si(s).next((e => !!e || this.Di(s))).next((t => {
12193
+ "readwrite-primary" === t ? this.bi(s).next((e => !!e || this.Di(s))).next((t => {
12172
12194
  if (!t) throw __PRIVATE_logError(`Failed to obtain primary lease for action '${e}'.`),
12173
12195
  this.isPrimary = !1, this.li.enqueueRetryable((() => this.Ri(!1))), new FirestoreError(D.FAILED_PRECONDITION, C);
12174
12196
  return n(s);
@@ -12183,7 +12205,7 @@ class __PRIVATE_IndexedDbPersistence {
12183
12205
  // be turned off.
12184
12206
  Ui(e) {
12185
12207
  return __PRIVATE_primaryClientStore(e).get("owner").next((e => {
12186
- if (null !== e && this.Oi(e.leaseTimestampMs, 5e3) && !this.Bi(e.ownerId) && !this.Fi(e) && !(this.Pi || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(D.FAILED_PRECONDITION, Ve);
12208
+ if (null !== e && this.Oi(e.leaseTimestampMs, 5e3) && !this.Li(e.ownerId) && !this.Fi(e) && !(this.Pi || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(D.FAILED_PRECONDITION, Ve);
12187
12209
  }));
12188
12210
  }
12189
12211
  /**
@@ -12211,13 +12233,13 @@ class __PRIVATE_IndexedDbPersistence {
12211
12233
  !1));
12212
12234
  }
12213
12235
  pi() {
12214
- null !== this.document && "function" == typeof this.document.addEventListener && (this.Ei = () => {
12236
+ null !== this.document && "function" == typeof this.document.addEventListener && (this.di = () => {
12215
12237
  this.li.enqueueAndForget((() => (this.inForeground = "visible" === this.document.visibilityState,
12216
12238
  this.gi())));
12217
- }, this.document.addEventListener("visibilitychange", this.Ei), this.inForeground = "visible" === this.document.visibilityState);
12239
+ }, this.document.addEventListener("visibilitychange", this.di), this.inForeground = "visible" === this.document.visibilityState);
12218
12240
  }
12219
12241
  qi() {
12220
- this.Ei && (this.document.removeEventListener("visibilitychange", this.Ei), this.Ei = null);
12242
+ this.di && (this.document.removeEventListener("visibilitychange", this.di), this.di = null);
12221
12243
  }
12222
12244
  /**
12223
12245
  * Attaches a window.unload handler that will synchronously write our
@@ -12251,10 +12273,10 @@ class __PRIVATE_IndexedDbPersistence {
12251
12273
  * Returns whether a client is "zombied" based on its LocalStorage entry.
12252
12274
  * Clients become zombied when their tab closes without running all of the
12253
12275
  * cleanup logic in `shutdown()`.
12254
- */ Bi(e) {
12276
+ */ Li(e) {
12255
12277
  var t;
12256
12278
  try {
12257
- const n = null !== (null === (t = this.fi) || void 0 === t ? void 0 : t.getItem(this.Li(e)));
12279
+ const n = null !== (null === (t = this.fi) || void 0 === t ? void 0 : t.getItem(this.Bi(e)));
12258
12280
  return __PRIVATE_logDebug("IndexedDbPersistence", `Client '${e}' ${n ? "is" : "is not"} zombied in LocalStorage`),
12259
12281
  n;
12260
12282
  } catch (e) {
@@ -12268,7 +12290,7 @@ class __PRIVATE_IndexedDbPersistence {
12268
12290
  * clients are ignored during primary tab selection.
12269
12291
  */ ki() {
12270
12292
  if (this.fi) try {
12271
- this.fi.setItem(this.Li(this.clientId), String(Date.now()));
12293
+ this.fi.setItem(this.Bi(this.clientId), String(Date.now()));
12272
12294
  } catch (e) {
12273
12295
  // Gracefully handle if LocalStorage isn't available / working.
12274
12296
  __PRIVATE_logError("Failed to set zombie client id.", e);
@@ -12276,12 +12298,12 @@ class __PRIVATE_IndexedDbPersistence {
12276
12298
  }
12277
12299
  /** Removes the zombied client entry if it exists. */ Ki() {
12278
12300
  if (this.fi) try {
12279
- this.fi.removeItem(this.Li(this.clientId));
12301
+ this.fi.removeItem(this.Bi(this.clientId));
12280
12302
  } catch (e) {
12281
12303
  // Ignore
12282
12304
  }
12283
12305
  }
12284
- Li(e) {
12306
+ Bi(e) {
12285
12307
  return `firestore_zombie_${this.persistenceKey}_${e}`;
12286
12308
  }
12287
12309
  }
@@ -12821,7 +12843,7 @@ function __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e) {
12821
12843
  // Each loop iteration only affects its "own" doc, so it's safe to get all
12822
12844
  // the remote documents in advance in a single call.
12823
12845
  o.push(__PRIVATE_populateDocumentChangeBuffer(e, s, t.documentUpdates).next((e => {
12824
- _ = e.Is, a = e.Es;
12846
+ _ = e.Is, a = e.ds;
12825
12847
  }))), !r.isEqual(SnapshotVersion.min())) {
12826
12848
  const t = n.Gr.getLastRemoteSnapshotVersion(e).next((t => n.Gr.setTargetsMetadata(e, e.currentSequenceNumber, r)));
12827
12849
  o.push(t);
@@ -12859,7 +12881,7 @@ function __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e) {
12859
12881
  r = r.insert(n, s)) : __PRIVATE_logDebug("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", o.version, " Watch version:", s.version);
12860
12882
  })), {
12861
12883
  Is: r,
12862
- Es: i
12884
+ ds: i
12863
12885
  };
12864
12886
  }));
12865
12887
  }
@@ -12958,7 +12980,7 @@ async function __PRIVATE_localStoreReleaseTarget(e, t, n) {
12958
12980
  })).next((() => r._s.getDocumentsMatchingQuery(e, t, n ? i : SnapshotVersion.min(), n ? s : __PRIVATE_documentKeySet()))).next((e => (__PRIVATE_setMaxReadTime(r, __PRIVATE_queryCollectionGroup(t), e),
12959
12981
  {
12960
12982
  documents: e,
12961
- ds: s
12983
+ Es: s
12962
12984
  })))));
12963
12985
  }
12964
12986
 
@@ -13027,7 +13049,7 @@ async function __PRIVATE_localStoreApplyBundledDocuments(e, t, n, r) {
13027
13049
  // Allocates a target to hold all document keys from the bundle, such that
13028
13050
  // they will not get garbage collected right away.
13029
13051
  return i.persistence.runTransaction("Apply bundle documents", "readwrite", (e => __PRIVATE_populateDocumentChangeBuffer(e, _, o).next((t => (_.apply(e),
13030
- t))).next((t => i.Gr.removeMatchingKeysForTargetId(e, a.targetId).next((() => i.Gr.addMatchingKeys(e, s, a.targetId))).next((() => i.localDocuments.getLocalViewOfDocuments(e, t.Is, t.Es))).next((() => t.Is))))));
13052
+ t))).next((t => i.Gr.removeMatchingKeysForTargetId(e, a.targetId).next((() => i.Gr.addMatchingKeys(e, s, a.targetId))).next((() => i.localDocuments.getLocalViewOfDocuments(e, t.Is, t.ds))).next((() => t.Is))))));
13031
13053
  }
13032
13054
 
13033
13055
  /**
@@ -13223,7 +13245,7 @@ class __PRIVATE_LocalClientState {
13223
13245
  */ class __PRIVATE_WebStorageSharedClientState {
13224
13246
  constructor(e, t, n, r, i) {
13225
13247
  this.window = e, this.li = t, this.persistenceKey = n, this.ws = r, this.syncEngine = null,
13226
- this.onlineStateHandler = null, this.sequenceNumberHandler = null, this.bs = this.Ss.bind(this),
13248
+ this.onlineStateHandler = null, this.sequenceNumberHandler = null, this.Ss = this.bs.bind(this),
13227
13249
  this.Ds = new SortedMap(__PRIVATE_primitiveComparator), this.started = !1,
13228
13250
  /**
13229
13251
  * Captures WebStorage events that occur before `start()` is called. These
@@ -13266,7 +13288,7 @@ class __PRIVATE_LocalClientState {
13266
13288
  // format of the key is:
13267
13289
  // firestore_bundle_loaded_v2_<persistenceKey>
13268
13290
  // The version ending with "v2" stores the list of modified collection groups.
13269
- (this.persistenceKey), this.Ls = function createBundleLoadedKey(e) {
13291
+ (this.persistenceKey), this.Bs = function createBundleLoadedKey(e) {
13270
13292
  return `firestore_bundle_loaded_v2_${e}`;
13271
13293
  }
13272
13294
  // The WebStorage key prefix for the key that stores the last sequence number allocated. The key
@@ -13278,7 +13300,7 @@ class __PRIVATE_LocalClientState {
13278
13300
  // respective start() calls). Otherwise, we might for example miss a
13279
13301
  // mutation that is added after LocalStore's start() processed the existing
13280
13302
  // mutations but before we observe WebStorage events.
13281
- this.window.addEventListener("storage", this.bs);
13303
+ this.window.addEventListener("storage", this.Ss);
13282
13304
  }
13283
13305
  /** Returns 'true' if WebStorage is available in the current environment. */ static p(e) {
13284
13306
  return !(!e || !e.localStorage);
@@ -13295,7 +13317,7 @@ class __PRIVATE_LocalClientState {
13295
13317
  n && (this.Ds = this.Ds.insert(n.clientId, n));
13296
13318
  }
13297
13319
  }
13298
- this.Bs();
13320
+ this.Ls();
13299
13321
  // Check if there is an existing online state and call the callback handler
13300
13322
  // if applicable.
13301
13323
  const t = this.storage.getItem(this.Ns);
@@ -13303,7 +13325,7 @@ class __PRIVATE_LocalClientState {
13303
13325
  const e = this.ks(t);
13304
13326
  e && this.qs(e);
13305
13327
  }
13306
- for (const e of this.vs) this.Ss(e);
13328
+ for (const e of this.vs) this.bs(e);
13307
13329
  this.vs = [],
13308
13330
  // Register a window unload hook to remove the client metadata entry from
13309
13331
  // WebStorage even if `shutdown()` was not called.
@@ -13344,10 +13366,10 @@ class __PRIVATE_LocalClientState {
13344
13366
  }
13345
13367
  // If the query is listening to cache only, the target ID should not be registered with the
13346
13368
  // local Firestore client as an active watch target.
13347
- return t && this.Us.ps(e), this.Bs(), n;
13369
+ return t && this.Us.ps(e), this.Ls(), n;
13348
13370
  }
13349
13371
  removeLocalQueryTarget(e) {
13350
- this.Us.ys(e), this.Bs();
13372
+ this.Us.ys(e), this.Ls();
13351
13373
  }
13352
13374
  isLocalQueryTarget(e) {
13353
13375
  return this.Us.activeTargetIds.has(e);
@@ -13372,7 +13394,7 @@ class __PRIVATE_LocalClientState {
13372
13394
  this.zs(e);
13373
13395
  }
13374
13396
  shutdown() {
13375
- this.started && (this.window.removeEventListener("storage", this.bs), this.removeItem(this.Cs),
13397
+ this.started && (this.window.removeEventListener("storage", this.Ss), this.removeItem(this.Cs),
13376
13398
  this.started = !1);
13377
13399
  }
13378
13400
  getItem(e) {
@@ -13385,7 +13407,7 @@ class __PRIVATE_LocalClientState {
13385
13407
  removeItem(e) {
13386
13408
  __PRIVATE_logDebug("SharedClientState", "REMOVE", e), this.storage.removeItem(e);
13387
13409
  }
13388
- Ss(e) {
13410
+ bs(e) {
13389
13411
  // Note: The function is typed to take Event to be interface-compatible with
13390
13412
  // `Window.addEventListener`.
13391
13413
  const t = e;
@@ -13434,7 +13456,7 @@ class __PRIVATE_LocalClientState {
13434
13456
  * isolated and no synchronization is performed.
13435
13457
  */ (t.newValue);
13436
13458
  e !== __PRIVATE_ListenSequence.oe && this.sequenceNumberHandler(e);
13437
- } else if (t.key === this.Ls) {
13459
+ } else if (t.key === this.Bs) {
13438
13460
  const e = this.no(t.newValue);
13439
13461
  await Promise.all(e.map((e => this.syncEngine.ro(e))));
13440
13462
  }
@@ -13445,7 +13467,7 @@ class __PRIVATE_LocalClientState {
13445
13467
  get Us() {
13446
13468
  return this.Ds.get(this.ws);
13447
13469
  }
13448
- Bs() {
13470
+ Ls() {
13449
13471
  this.setItem(this.Cs, this.Us.gs());
13450
13472
  }
13451
13473
  Ks(e, t, n) {
@@ -13469,7 +13491,7 @@ class __PRIVATE_LocalClientState {
13469
13491
  }
13470
13492
  zs(e) {
13471
13493
  const t = JSON.stringify(Array.from(e));
13472
- this.setItem(this.Ls, t);
13494
+ this.setItem(this.Bs, t);
13473
13495
  }
13474
13496
  /**
13475
13497
  * Parses a client state key in WebStorage. Returns null if the key does not
@@ -13782,10 +13804,10 @@ class __PRIVATE_StreamBridge {
13782
13804
  send(e) {
13783
13805
  this.Eo(e);
13784
13806
  }
13785
- bo() {
13807
+ So() {
13786
13808
  this.Vo();
13787
13809
  }
13788
- So() {
13810
+ bo() {
13789
13811
  this.fo();
13790
13812
  }
13791
13813
  Do(e) {
@@ -13836,7 +13858,7 @@ class __PRIVATE_RestConnection {
13836
13858
  "google-cloud-resource-prefix": this.Mo,
13837
13859
  "x-goog-request-params": this.xo
13838
13860
  };
13839
- return this.Lo(_, r, i), this.Bo(e, o, _, n).then((t => (__PRIVATE_logDebug("RestConnection", `Received RPC '${e}' ${s}: `, t),
13861
+ return this.Bo(_, r, i), this.Lo(e, o, _, n).then((t => (__PRIVATE_logDebug("RestConnection", `Received RPC '${e}' ${s}: `, t),
13840
13862
  t)), (t => {
13841
13863
  throw __PRIVATE_logWarn("RestConnection", `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13842
13864
  t;
@@ -13850,12 +13872,12 @@ class __PRIVATE_RestConnection {
13850
13872
  /**
13851
13873
  * Modifies the headers for a request, adding any authorization token if
13852
13874
  * present and any additional headers for the request.
13853
- */ Lo(e, t, n) {
13875
+ */ Bo(e, t, n) {
13854
13876
  e["X-Goog-Api-Client"] =
13855
13877
  // SDK_VERSION is updated to different value at runtime depending on the entry point,
13856
13878
  // so we need to get its value when we need it in a function.
13857
13879
  function __PRIVATE_getGoogApiClientValue() {
13858
- return "gl-js/ fire/" + b;
13880
+ return "gl-js/ fire/" + S;
13859
13881
  }(),
13860
13882
  // Content-Type: text/plain will avoid preflight requests which might
13861
13883
  // mess with CORS and redirects by proxies. If we add custom headers
@@ -13880,7 +13902,7 @@ class __PRIVATE_RestConnection {
13880
13902
  super(e), this.forceLongPolling = e.forceLongPolling, this.autoDetectLongPolling = e.autoDetectLongPolling,
13881
13903
  this.useFetchStreams = e.useFetchStreams, this.longPollingOptions = e.longPollingOptions;
13882
13904
  }
13883
- Bo(e, t, n, r) {
13905
+ Lo(e, t, n, r) {
13884
13906
  const i = __PRIVATE_generateUniqueDebugId();
13885
13907
  return new Promise(((s, o) => {
13886
13908
  const _ = new XhrIo;
@@ -13954,7 +13976,7 @@ class __PRIVATE_RestConnection {
13954
13976
  detectBufferingProxy: this.autoDetectLongPolling
13955
13977
  }, a = this.longPollingOptions.timeoutSeconds;
13956
13978
  void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.useFetchStreams = !0),
13957
- this.Lo(_.initMessageHeaders, t, n),
13979
+ this.Bo(_.initMessageHeaders, t, n),
13958
13980
  // Sending the custom headers we just added to request.initMessageHeaders
13959
13981
  // (Authorization, etc.) will trigger the browser to make a CORS preflight
13960
13982
  // request because the XHR will no longer meet the criteria for a "simple"
@@ -14002,7 +14024,7 @@ class __PRIVATE_RestConnection {
14002
14024
  // Note that eventually this function could go away if we are confident
14003
14025
  // enough the code is exception free.
14004
14026
  return __PRIVATE_unguardedEventListen(c, WebChannel.EventType.OPEN, (() => {
14005
- h || (__PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} transport opened.`), P.bo());
14027
+ h || (__PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} transport opened.`), P.So());
14006
14028
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.CLOSE, (() => {
14007
14029
  h || (h = !0, __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} transport closed`),
14008
14030
  P.Do());
@@ -14049,7 +14071,7 @@ class __PRIVATE_RestConnection {
14049
14071
  // but because we want to send the first message with the WebChannel
14050
14072
  // handshake we pretend the channel opened here (asynchronously), and
14051
14073
  // then delay the actual open until the first message is sent.
14052
- P.So();
14074
+ P.bo();
14053
14075
  }), 0), P;
14054
14076
  }
14055
14077
  }
@@ -14411,19 +14433,19 @@ class __PRIVATE_PersistentStream {
14411
14433
  }), (t => {
14412
14434
  e((() => {
14413
14435
  const e = new FirestoreError(D.UNKNOWN, "Fetching auth token failed: " + t.message);
14414
- return this.E_(e);
14436
+ return this.d_(e);
14415
14437
  }));
14416
14438
  }));
14417
14439
  }
14418
14440
  I_(e, t) {
14419
14441
  const n = this.T_(this.Xo);
14420
- this.stream = this.d_(e, t), this.stream.Ro((() => {
14442
+ this.stream = this.E_(e, t), this.stream.Ro((() => {
14421
14443
  n((() => this.listener.Ro()));
14422
14444
  })), this.stream.mo((() => {
14423
14445
  n((() => (this.state = 2 /* PersistentStreamState.Open */ , this.t_ = this.li.enqueueAfterDelay(this.Zo, 1e4, (() => (this.s_() && (this.state = 3 /* PersistentStreamState.Healthy */),
14424
14446
  Promise.resolve()))), this.listener.mo())));
14425
14447
  })), this.stream.po((e => {
14426
- n((() => this.E_(e)));
14448
+ n((() => this.d_(e)));
14427
14449
  })), this.stream.onMessage((e => {
14428
14450
  n((() => 1 == ++this.n_ ? this.A_(e) : this.onNext(e)));
14429
14451
  }));
@@ -14434,7 +14456,7 @@ class __PRIVATE_PersistentStream {
14434
14456
  }));
14435
14457
  }
14436
14458
  // Visible for tests
14437
- E_(e) {
14459
+ d_(e) {
14438
14460
  // In theory the stream could close cleanly, however, in our current model
14439
14461
  // we never expect this to happen because if we stop a stream ourselves,
14440
14462
  // this callback will never be called. To prevent cases where we retry
@@ -14466,7 +14488,7 @@ class __PRIVATE_PersistentStream {
14466
14488
  super(e, "listen_stream_connection_backoff" /* TimerId.ListenStreamConnectionBackoff */ , "listen_stream_idle" /* TimerId.ListenStreamIdle */ , "health_check_timeout" /* TimerId.HealthCheckTimeout */ , t, n, r, s),
14467
14489
  this.serializer = i;
14468
14490
  }
14469
- d_(e, t) {
14491
+ E_(e, t) {
14470
14492
  return this.connection.qo("Listen", e, t);
14471
14493
  }
14472
14494
  A_(e) {
@@ -14560,7 +14582,7 @@ class __PRIVATE_PersistentStream {
14560
14582
  P_() {
14561
14583
  this.f_ && this.g_([]);
14562
14584
  }
14563
- d_(e, t) {
14585
+ E_(e, t) {
14564
14586
  return this.connection.qo("Write", e, t);
14565
14587
  }
14566
14588
  A_(e) {
@@ -14626,25 +14648,25 @@ class __PRIVATE_PersistentStream {
14626
14648
  class __PRIVATE_DatastoreImpl extends class Datastore {} {
14627
14649
  constructor(e, t, n, r) {
14628
14650
  super(), this.authCredentials = e, this.appCheckCredentials = t, this.connection = n,
14629
- this.serializer = r, this.b_ = !1;
14651
+ this.serializer = r, this.S_ = !1;
14630
14652
  }
14631
- S_() {
14632
- if (this.b_) throw new FirestoreError(D.FAILED_PRECONDITION, "The client has already been terminated.");
14653
+ b_() {
14654
+ if (this.S_) throw new FirestoreError(D.FAILED_PRECONDITION, "The client has already been terminated.");
14633
14655
  }
14634
14656
  /** Invokes the provided RPC with auth and AppCheck tokens. */ Oo(e, t, n, r) {
14635
- return this.S_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.Oo(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {
14657
+ return this.b_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.Oo(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {
14636
14658
  throw "FirebaseError" === e.name ? (e.code === D.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
14637
14659
  this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(D.UNKNOWN, e.toString());
14638
14660
  }));
14639
14661
  }
14640
14662
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ ko(e, t, n, r, i) {
14641
- return this.S_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, o]) => this.connection.ko(e, __PRIVATE_toResourcePath(t, n), r, s, o, i))).catch((e => {
14663
+ return this.b_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, o]) => this.connection.ko(e, __PRIVATE_toResourcePath(t, n), r, s, o, i))).catch((e => {
14642
14664
  throw "FirebaseError" === e.name ? (e.code === D.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
14643
14665
  this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(D.UNKNOWN, e.toString());
14644
14666
  }));
14645
14667
  }
14646
14668
  terminate() {
14647
- this.b_ = !0, this.connection.terminate();
14669
+ this.S_ = !0, this.connection.terminate();
14648
14670
  }
14649
14671
  }
14650
14672
 
@@ -14771,7 +14793,7 @@ class __PRIVATE_OnlineStateTracker {
14771
14793
  * purely based on order, and so we can just shift() writes from the front of
14772
14794
  * the writePipeline as we receive responses.
14773
14795
  */
14774
- this.L_ = [],
14796
+ this.B_ = [],
14775
14797
  /**
14776
14798
  * A mapping of watched targets that the client cares about tracking and the
14777
14799
  * user has explicitly called a 'listen' for this target.
@@ -14781,7 +14803,7 @@ class __PRIVATE_OnlineStateTracker {
14781
14803
  * to the server. The targets removed with unlistens are removed eagerly
14782
14804
  * without waiting for confirmation from the listen stream.
14783
14805
  */
14784
- this.B_ = new Map,
14806
+ this.L_ = new Map,
14785
14807
  /**
14786
14808
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14787
14809
  * RemoteStore may start its network connections.
@@ -14828,9 +14850,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14828
14850
  */
14829
14851
  function __PRIVATE_remoteStoreListen(e, t) {
14830
14852
  const n = __PRIVATE_debugCast(e);
14831
- n.B_.has(t.targetId) || (
14853
+ n.L_.has(t.targetId) || (
14832
14854
  // Mark this as something the client is currently listening for.
14833
- n.B_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14855
+ n.L_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14834
14856
  // The listen will be sent in onWatchStreamOpen
14835
14857
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).s_() && __PRIVATE_sendWatchRequest(n, t));
14836
14858
  }
@@ -14840,7 +14862,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14840
14862
  * not being listened to.
14841
14863
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14842
14864
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14843
- n.B_.delete(t), r.s_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.B_.size && (r.s_() ? r.a_() : __PRIVATE_canUseNetwork(n) &&
14865
+ n.L_.delete(t), r.s_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.L_.size && (r.s_() ? r.a_() : __PRIVATE_canUseNetwork(n) &&
14844
14866
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14845
14867
  // have no listeners, since without any listens to send we cannot
14846
14868
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -14869,7 +14891,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14869
14891
  function __PRIVATE_startWatchStream(e) {
14870
14892
  e.U_ = new __PRIVATE_WatchChangeAggregator({
14871
14893
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14872
- ut: t => e.B_.get(t) || null,
14894
+ ut: t => e.L_.get(t) || null,
14873
14895
  nt: () => e.datastore.serializer.databaseId
14874
14896
  }), __PRIVATE_ensureWatchStream(e).start(), e.K_.F_();
14875
14897
  }
@@ -14878,7 +14900,7 @@ function __PRIVATE_startWatchStream(e) {
14878
14900
  * Returns whether the watch stream should be started because it's necessary
14879
14901
  * and has not yet been started.
14880
14902
  */ function __PRIVATE_shouldStartWatchStream(e) {
14881
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).i_() && e.B_.size > 0;
14903
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).i_() && e.L_.size > 0;
14882
14904
  }
14883
14905
 
14884
14906
  function __PRIVATE_canUseNetwork(e) {
@@ -14895,7 +14917,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
14895
14917
  }
14896
14918
 
14897
14919
  async function __PRIVATE_onWatchStreamOpen(e) {
14898
- e.B_.forEach(((t, n) => {
14920
+ e.L_.forEach(((t, n) => {
14899
14921
  __PRIVATE_sendWatchRequest(e, t);
14900
14922
  }));
14901
14923
  }
@@ -14923,7 +14945,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14923
14945
  const n = t.cause;
14924
14946
  for (const r of t.targetIds)
14925
14947
  // A watched target might have been removed already.
14926
- e.B_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.B_.delete(r), e.U_.removeTarget(r));
14948
+ e.L_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.L_.delete(r), e.U_.removeTarget(r));
14927
14949
  }
14928
14950
  /**
14929
14951
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -14954,21 +14976,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14954
14976
  // persistent view of these when applying the completed RemoteEvent.
14955
14977
  return n.targetChanges.forEach(((n, r) => {
14956
14978
  if (n.resumeToken.approximateByteSize() > 0) {
14957
- const i = e.B_.get(r);
14979
+ const i = e.L_.get(r);
14958
14980
  // A watched target might have been removed already.
14959
- i && e.B_.set(r, i.withResumeToken(n.resumeToken, t));
14981
+ i && e.L_.set(r, i.withResumeToken(n.resumeToken, t));
14960
14982
  }
14961
14983
  })),
14962
14984
  // Re-establish listens for the targets that have been invalidated by
14963
14985
  // existence filter mismatches.
14964
14986
  n.targetMismatches.forEach(((t, n) => {
14965
- const r = e.B_.get(t);
14987
+ const r = e.L_.get(t);
14966
14988
  if (!r)
14967
14989
  // A watched target might have been removed already.
14968
14990
  return;
14969
14991
  // Clear the resume token for the target, since we're in a known mismatch
14970
14992
  // state.
14971
- e.B_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
14993
+ e.L_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
14972
14994
  // Cause a hard reset by unwatching and rewatching immediately, but
14973
14995
  // deliberately don't send a resume token so that we get a full update.
14974
14996
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15019,11 +15041,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15019
15041
 
15020
15042
  async function __PRIVATE_fillWritePipeline(e) {
15021
15043
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15022
- let r = t.L_.length > 0 ? t.L_[t.L_.length - 1].batchId : -1;
15044
+ let r = t.B_.length > 0 ? t.B_[t.B_.length - 1].batchId : -1;
15023
15045
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15024
15046
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15025
15047
  if (null === e) {
15026
- 0 === t.L_.length && n.a_();
15048
+ 0 === t.B_.length && n.a_();
15027
15049
  break;
15028
15050
  }
15029
15051
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15037,20 +15059,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15037
15059
  * Returns true if we can add to the write pipeline (i.e. the network is
15038
15060
  * enabled and the write pipeline is not full).
15039
15061
  */ function __PRIVATE_canAddToWritePipeline(e) {
15040
- return __PRIVATE_canUseNetwork(e) && e.L_.length < 10;
15062
+ return __PRIVATE_canUseNetwork(e) && e.B_.length < 10;
15041
15063
  }
15042
15064
 
15043
15065
  /**
15044
15066
  * Queues additional writes to be sent to the write stream, sending them
15045
15067
  * immediately if the write stream is established.
15046
15068
  */ function __PRIVATE_addToWritePipeline(e, t) {
15047
- e.L_.push(t);
15069
+ e.B_.push(t);
15048
15070
  const n = __PRIVATE_ensureWriteStream(e);
15049
15071
  n.s_() && n.f_ && n.g_(t.mutations);
15050
15072
  }
15051
15073
 
15052
15074
  function __PRIVATE_shouldStartWriteStream(e) {
15053
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).i_() && e.L_.length > 0;
15075
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).i_() && e.B_.length > 0;
15054
15076
  }
15055
15077
 
15056
15078
  function __PRIVATE_startWriteStream(e) {
@@ -15064,11 +15086,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15064
15086
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15065
15087
  const t = __PRIVATE_ensureWriteStream(e);
15066
15088
  // Send the write pipeline now that the stream is established.
15067
- for (const n of e.L_) t.g_(n.mutations);
15089
+ for (const n of e.B_) t.g_(n.mutations);
15068
15090
  }
15069
15091
 
15070
15092
  async function __PRIVATE_onMutationResult(e, t, n) {
15071
- const r = e.L_.shift(), i = MutationBatchResult.from(r, t, n);
15093
+ const r = e.B_.shift(), i = MutationBatchResult.from(r, t, n);
15072
15094
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15073
15095
  // It's possible that with the completion of this mutation another
15074
15096
  // slot has freed up.
@@ -15088,7 +15110,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15088
15110
  }(t.code)) {
15089
15111
  // This was a permanent error, the request itself was the problem
15090
15112
  // so it's not going to succeed if we resend it.
15091
- const n = e.L_.shift();
15113
+ const n = e.B_.shift();
15092
15114
  // In this case it's also unlikely that the server itself is melting
15093
15115
  // down -- this was just a bad request so inhibit backoff on the next
15094
15116
  // restart.
@@ -15137,7 +15159,7 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15137
15159
  // Create stream (but note that it is not started yet).
15138
15160
  e.W_ = function __PRIVATE_newPersistentWatchStream(e, t, n) {
15139
15161
  const r = __PRIVATE_debugCast(e);
15140
- return r.S_(), new __PRIVATE_PersistentListenStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);
15162
+ return r.b_(), new __PRIVATE_PersistentListenStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);
15141
15163
  }
15142
15164
  /**
15143
15165
  * @license
@@ -15177,7 +15199,7 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15177
15199
  // Create stream (but note that it is not started yet).
15178
15200
  e.G_ = function __PRIVATE_newPersistentWriteStream(e, t, n) {
15179
15201
  const r = __PRIVATE_debugCast(e);
15180
- return r.S_(), new __PRIVATE_PersistentWriteStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);
15202
+ return r.b_(), new __PRIVATE_PersistentWriteStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);
15181
15203
  }(e.datastore, e.asyncQueue, {
15182
15204
  Ro: () => Promise.resolve(),
15183
15205
  mo: __PRIVATE_onWriteStreamOpen.bind(null, e),
@@ -15187,8 +15209,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15187
15209
  }), e.q_.push((async t => {
15188
15210
  t ? (e.G_.__(),
15189
15211
  // This will start the write stream if necessary.
15190
- await __PRIVATE_fillWritePipeline(e)) : (await e.G_.stop(), e.L_.length > 0 && (__PRIVATE_logDebug("RemoteStore", `Stopping write stream with ${e.L_.length} pending writes`),
15191
- e.L_ = []));
15212
+ await __PRIVATE_fillWritePipeline(e)) : (await e.G_.stop(), e.B_.length > 0 && (__PRIVATE_logDebug("RemoteStore", `Stopping write stream with ${e.B_.length} pending writes`),
15213
+ e.B_ = []));
15192
15214
  }))), e.G_;
15193
15215
  }
15194
15216
 
@@ -15810,7 +15832,7 @@ class __PRIVATE_QueryListener {
15810
15832
  return this.progress.taskState = "Success", {
15811
15833
  progress: this.progress,
15812
15834
  Ia: this.collectionGroups,
15813
- Ea: e
15835
+ da: e
15814
15836
  };
15815
15837
  }
15816
15838
  }
@@ -15868,7 +15890,7 @@ class __PRIVATE_RemovedLimboDocument {
15868
15890
  constructor(e,
15869
15891
  /** Documents included in the remote target */
15870
15892
  t) {
15871
- this.query = e, this.da = t, this.Aa = null, this.hasCachedResults = !1,
15893
+ this.query = e, this.Ea = t, this.Aa = null, this.hasCachedResults = !1,
15872
15894
  /**
15873
15895
  * A flag whether the view is current with the backend. A view is considered
15874
15896
  * current after it has seen the current flag from the backend and did not
@@ -15886,7 +15908,7 @@ class __PRIVATE_RemovedLimboDocument {
15886
15908
  * The set of remote documents that the server has told us belongs to the target associated with
15887
15909
  * this view.
15888
15910
  */ get fa() {
15889
- return this.da;
15911
+ return this.Ea;
15890
15912
  }
15891
15913
  /**
15892
15914
  * Iterates over a set of doc changes, applies the query limit, and computes
@@ -16022,19 +16044,19 @@ class __PRIVATE_RemovedLimboDocument {
16022
16044
  * See the License for the specific language governing permissions and
16023
16045
  * limitations under the License.
16024
16046
  */ (e.type, t.type) || this.Va(e.doc, t.doc))), this.wa(n), r = null != r && r;
16025
- const o = t && !r ? this.ba() : [], _ = 0 === this.Ra.size && this.current && !r ? 1 /* SyncState.Synced */ : 0 /* SyncState.Local */ , a = _ !== this.Aa;
16047
+ const o = t && !r ? this.Sa() : [], _ = 0 === this.Ra.size && this.current && !r ? 1 /* SyncState.Synced */ : 0 /* SyncState.Local */ , a = _ !== this.Aa;
16026
16048
  // We are at synced state if there is no limbo docs are waiting to be resolved, view is current
16027
16049
  // with the backend, and the query is not pending to reset due to existence filter mismatch.
16028
16050
  if (this.Aa = _, 0 !== s.length || a) {
16029
16051
  return {
16030
16052
  snapshot: new ViewSnapshot(this.query, e.ma, i, s, e.mutatedKeys, 0 /* SyncState.Local */ === _, a,
16031
16053
  /* excludesMetadataChanges= */ !1, !!n && n.resumeToken.approximateByteSize() > 0),
16032
- Sa: o
16054
+ ba: o
16033
16055
  };
16034
16056
  }
16035
16057
  // no changes
16036
16058
  return {
16037
- Sa: o
16059
+ ba: o
16038
16060
  };
16039
16061
  }
16040
16062
  /**
@@ -16053,14 +16075,14 @@ class __PRIVATE_RemovedLimboDocument {
16053
16075
  ss: !1
16054
16076
  },
16055
16077
  /* limboResolutionEnabled= */ !1)) : {
16056
- Sa: []
16078
+ ba: []
16057
16079
  };
16058
16080
  }
16059
16081
  /**
16060
16082
  * Returns whether the doc for the given key should be in limbo.
16061
16083
  */ Da(e) {
16062
16084
  // If the remote end says it's part of this query, it's not in limbo.
16063
- return !this.da.has(e) && (
16085
+ return !this.Ea.has(e) && (
16064
16086
  // The local store doesn't think it's a result, so it shouldn't be in limbo.
16065
16087
  !!this.ma.has(e) && !this.ma.get(e).hasLocalMutations);
16066
16088
  }
@@ -16068,10 +16090,10 @@ class __PRIVATE_RemovedLimboDocument {
16068
16090
  * Updates syncedDocuments, current, and limbo docs based on the given change.
16069
16091
  * Returns the list of changes to which docs are in limbo.
16070
16092
  */ wa(e) {
16071
- e && (e.addedDocuments.forEach((e => this.da = this.da.add(e))), e.modifiedDocuments.forEach((e => {})),
16072
- e.removedDocuments.forEach((e => this.da = this.da.delete(e))), this.current = e.current);
16093
+ e && (e.addedDocuments.forEach((e => this.Ea = this.Ea.add(e))), e.modifiedDocuments.forEach((e => {})),
16094
+ e.removedDocuments.forEach((e => this.Ea = this.Ea.delete(e))), this.current = e.current);
16073
16095
  }
16074
- ba() {
16096
+ Sa() {
16075
16097
  // We can only determine limbo documents when we're in-sync with the server.
16076
16098
  if (!this.current) return [];
16077
16099
  // TODO(klimt): Do this incrementally so that it's not quadratic when
@@ -16109,7 +16131,7 @@ class __PRIVATE_RemovedLimboDocument {
16109
16131
  */
16110
16132
  // PORTING NOTE: Multi-tab only.
16111
16133
  va(e) {
16112
- this.da = e.ds, this.Ra = __PRIVATE_documentKeySet();
16134
+ this.Ea = e.Es, this.Ra = __PRIVATE_documentKeySet();
16113
16135
  const t = this.ga(e.documents);
16114
16136
  return this.applyChanges(t, /* limboResolutionEnabled= */ !0);
16115
16137
  }
@@ -16196,12 +16218,12 @@ class __PRIVATE_QueryView {
16196
16218
  * Keeps track of the target ID for each document that is in limbo with an
16197
16219
  * active target.
16198
16220
  */
16199
- this.La = new SortedMap(DocumentKey.comparator),
16221
+ this.Ba = new SortedMap(DocumentKey.comparator),
16200
16222
  /**
16201
16223
  * Keeps track of the information about an active limbo resolution for each
16202
16224
  * active target ID that was started for the purpose of limbo resolution.
16203
16225
  */
16204
- this.Ba = new Map, this.ka = new __PRIVATE_ReferenceSet,
16226
+ this.La = new Map, this.ka = new __PRIVATE_ReferenceSet,
16205
16227
  /** Stores user completion handlers, indexed by User and BatchId. */
16206
16228
  this.qa = {},
16207
16229
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
@@ -16267,12 +16289,12 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16267
16289
  /* usePreviousResults= */ !1).then((({documents: e}) => t.view.ga(e, i))));
16268
16290
  const s = r && r.targetChanges.get(t.targetId), o = r && null != r.targetMismatches.get(t.targetId), _ = t.view.applyChanges(i,
16269
16291
  /* limboResolutionEnabled= */ e.isPrimaryClient, s, o);
16270
- return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.Sa), _.snapshot;
16292
+ return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.ba), _.snapshot;
16271
16293
  }(e, t, n, r);
16272
16294
  const s = await __PRIVATE_localStoreExecuteQuery(e.localStore, t,
16273
- /* usePreviousResults= */ !0), o = new __PRIVATE_View(t, s.ds), _ = o.ga(s.documents), a = TargetChange.createSynthesizedTargetChangeForCurrentChange(n, r && "Offline" /* OnlineState.Offline */ !== e.onlineState, i), u = o.applyChanges(_,
16295
+ /* usePreviousResults= */ !0), o = new __PRIVATE_View(t, s.Es), _ = o.ga(s.documents), a = TargetChange.createSynthesizedTargetChangeForCurrentChange(n, r && "Offline" /* OnlineState.Offline */ !== e.onlineState, i), u = o.applyChanges(_,
16274
16296
  /* limboResolutionEnabled= */ e.isPrimaryClient, a);
16275
- __PRIVATE_updateTrackedLimbos(e, n, u.Sa);
16297
+ __PRIVATE_updateTrackedLimbos(e, n, u.ba);
16276
16298
  const c = new __PRIVATE_QueryView(t, n, o);
16277
16299
  return e.xa.set(t, c), e.Oa.has(n) ? e.Oa.get(n).push(t) : e.Oa.set(n, [ t ]), u.snapshot;
16278
16300
  }
@@ -16385,7 +16407,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16385
16407
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16386
16408
  // Update `receivedDocument` as appropriate for any limbo targets.
16387
16409
  t.targetChanges.forEach(((e, t) => {
16388
- const r = n.Ba.get(t);
16410
+ const r = n.La.get(t);
16389
16411
  r && (
16390
16412
  // Since this is a limbo resolution lookup, it's for a single document
16391
16413
  // and it could be added, modified, or removed, but not a combination.
@@ -16439,7 +16461,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16439
16461
  const r = __PRIVATE_debugCast(e);
16440
16462
  // PORTING NOTE: Multi-tab only.
16441
16463
  r.sharedClientState.updateQueryState(t, "rejected", n);
16442
- const i = r.Ba.get(t), s = i && i.key;
16464
+ const i = r.La.get(t), s = i && i.key;
16443
16465
  if (s) {
16444
16466
  // TODO(klimt): We really only should do the following on permission
16445
16467
  // denied errors, but we don't have the cause code here.
@@ -16461,7 +16483,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16461
16483
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16462
16484
  // this query when the RemoteStore restarts the Watch stream, which should
16463
16485
  // re-trigger the target failure.
16464
- r.La = r.La.remove(s), r.Ba.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16486
+ r.Ba = r.Ba.remove(s), r.La.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16465
16487
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16466
16488
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16467
16489
  }
@@ -16567,9 +16589,9 @@ function __PRIVATE_removeLimboTarget(e, t) {
16567
16589
  e.Na.delete(t.path.canonicalString());
16568
16590
  // It's possible that the target already got removed because the query failed. In that case,
16569
16591
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16570
- const n = e.La.get(t);
16571
- null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.La = e.La.remove(t),
16572
- e.Ba.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16592
+ const n = e.Ba.get(t);
16593
+ null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.Ba = e.Ba.remove(t),
16594
+ e.La.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16573
16595
  }
16574
16596
 
16575
16597
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
@@ -16584,7 +16606,7 @@ function __PRIVATE_updateTrackedLimbos(e, t, n) {
16584
16606
 
16585
16607
  function __PRIVATE_trackLimboChange(e, t) {
16586
16608
  const n = t.key, r = n.path.canonicalString();
16587
- e.La.get(n) || e.Na.has(r) || (__PRIVATE_logDebug("SyncEngine", "New document in limbo: " + n),
16609
+ e.Ba.get(n) || e.Na.has(r) || (__PRIVATE_logDebug("SyncEngine", "New document in limbo: " + n),
16588
16610
  e.Na.add(r), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16589
16611
  }
16590
16612
 
@@ -16596,11 +16618,11 @@ function __PRIVATE_trackLimboChange(e, t) {
16596
16618
  * with "resource exhausted" errors which can lead to pathological client
16597
16619
  * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
16598
16620
  */ function __PRIVATE_pumpEnqueuedLimboResolutions(e) {
16599
- for (;e.Na.size > 0 && e.La.size < e.maxConcurrentLimboResolutions; ) {
16621
+ for (;e.Na.size > 0 && e.Ba.size < e.maxConcurrentLimboResolutions; ) {
16600
16622
  const t = e.Na.values().next().value;
16601
16623
  e.Na.delete(t);
16602
16624
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.Ka.next();
16603
- e.Ba.set(r, new LimboResolution(n)), e.La = e.La.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.oe));
16625
+ e.La.set(r, new LimboResolution(n)), e.Ba = e.Ba.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.oe));
16604
16626
  }
16605
16627
  }
16606
16628
 
@@ -16668,7 +16690,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16668
16690
  }
16669
16691
 
16670
16692
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16671
- const n = __PRIVATE_debugCast(e), r = n.Ba.get(t);
16693
+ const n = __PRIVATE_debugCast(e), r = n.La.get(t);
16672
16694
  if (r && r.Fa) return __PRIVATE_documentKeySet().add(r.key);
16673
16695
  {
16674
16696
  let e = __PRIVATE_documentKeySet();
@@ -16688,7 +16710,7 @@ function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16688
16710
  */ async function __PRIVATE_synchronizeViewAndComputeSnapshot(e, t) {
16689
16711
  const n = __PRIVATE_debugCast(e), r = await __PRIVATE_localStoreExecuteQuery(n.localStore, t.query,
16690
16712
  /* usePreviousResults= */ !0), i = t.view.va(r);
16691
- return n.isPrimaryClient && __PRIVATE_updateTrackedLimbos(n, t.targetId, i.Sa),
16713
+ return n.isPrimaryClient && __PRIVATE_updateTrackedLimbos(n, t.targetId, i.ba),
16692
16714
  i;
16693
16715
  }
16694
16716
 
@@ -16720,7 +16742,7 @@ async function __PRIVATE_syncEngineApplyBatchState(e, t, n, r) {
16720
16742
  // other clients.
16721
16743
  __PRIVATE_processUserCallback(i, t, r || null), __PRIVATE_triggerPendingWritesCallbacks(i, t),
16722
16744
  function __PRIVATE_localStoreRemoveCachedMutationBatchMetadata(e, t) {
16723
- __PRIVATE_debugCast(__PRIVATE_debugCast(e).mutationQueue).Ln(t);
16745
+ __PRIVATE_debugCast(__PRIVATE_debugCast(e).mutationQueue).Bn(t);
16724
16746
  }
16725
16747
  // PORTING NOTE: Multi-Tab only.
16726
16748
  (i.localStore, t)) : fail(), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(i, s)) :
@@ -16760,9 +16782,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16760
16782
  // PORTING NOTE: Multi-Tab only.
16761
16783
  function __PRIVATE_resetLimboDocuments(e) {
16762
16784
  const t = __PRIVATE_debugCast(e);
16763
- t.Ba.forEach(((e, n) => {
16785
+ t.La.forEach(((e, n) => {
16764
16786
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16765
- })), t.ka.wr(), t.Ba = new Map, t.La = new SortedMap(DocumentKey.comparator);
16787
+ })), t.ka.wr(), t.La = new Map, t.Ba = new SortedMap(DocumentKey.comparator);
16766
16788
  }
16767
16789
  /**
16768
16790
  * Reconcile the query views of the provided query targets with the state from
@@ -16935,7 +16957,7 @@ function __PRIVATE_syncEngineEnsureWriteCallbacks(e) {
16935
16957
  e && n._updateProgress(e), s = await t.Ga();
16936
16958
  }
16937
16959
  const o = await i.complete();
16938
- return await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, o.Ea,
16960
+ return await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, o.da,
16939
16961
  /* remoteEvent */ void 0),
16940
16962
  // Save metadata, so loading the same bundle will skip.
16941
16963
  await function __PRIVATE_localStoreSaveBundle(e, t) {
@@ -17038,7 +17060,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends __PRIVATE_MemoryOffl
17038
17060
  await __PRIVATE_syncEngineEnsureWriteCallbacks(this.Za.syncEngine), await __PRIVATE_fillWritePipeline(this.Za.remoteStore),
17039
17061
  // NOTE: This will immediately call the listener, so we make sure to
17040
17062
  // set it after localStore / remoteStore are started.
17041
- await this.persistence.bi((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(),
17063
+ await this.persistence.Si((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(),
17042
17064
  this.indexBackfillerScheduler && !this.indexBackfillerScheduler.started && this.indexBackfillerScheduler.start(),
17043
17065
  Promise.resolve())));
17044
17066
  }
@@ -17085,7 +17107,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends __PRIVATE_MemoryOffl
17085
17107
  }, await this.sharedClientState.start()),
17086
17108
  // NOTE: This will immediately call the listener, so we make sure to
17087
17109
  // set it after localStore / remoteStore are started.
17088
- await this.persistence.bi((async e => {
17110
+ await this.persistence.Si((async e => {
17089
17111
  await __PRIVATE_syncEngineApplyPrimaryState(this.Za.syncEngine, e), this.gcScheduler && (e && !this.gcScheduler.started ? this.gcScheduler.start() : e || this.gcScheduler.stop()),
17090
17112
  this.indexBackfillerScheduler && (e && !this.indexBackfillerScheduler.started ? this.indexBackfillerScheduler.start() : e || this.indexBackfillerScheduler.stop());
17091
17113
  }));
@@ -17824,7 +17846,7 @@ function __PRIVATE_firestoreClientGetDocumentsFromLocalCache(e, t) {
17824
17846
  return e.asyncQueue.enqueueAndForget((async () => async function __PRIVATE_executeQueryFromCache(e, t, n) {
17825
17847
  try {
17826
17848
  const r = await __PRIVATE_localStoreExecuteQuery(e, t,
17827
- /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.ds), s = i.ga(r.documents), o = i.applyChanges(s,
17849
+ /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.Es), s = i.ga(r.documents), o = i.applyChanges(s,
17828
17850
  /* limboResolutionEnabled= */ !1);
17829
17851
  n.resolve(o.snapshot);
17830
17852
  } catch (e) {
@@ -18586,10 +18608,10 @@ function doc(e, t, ...n) {
18586
18608
  this.Iu = [],
18587
18609
  // Is this AsyncQueue being shut down? Once it is set to true, it will not
18588
18610
  // be changed again.
18589
- this.Eu = !1,
18611
+ this.du = !1,
18590
18612
  // Operations scheduled to be queued in the future. Operations are
18591
18613
  // automatically removed after they are run or canceled.
18592
- this.du = [],
18614
+ this.Eu = [],
18593
18615
  // visible for testing
18594
18616
  this.Au = null,
18595
18617
  // Flag set while there's an outstanding AsyncQueue operation, used for
@@ -18613,7 +18635,7 @@ function doc(e, t, ...n) {
18613
18635
  t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.fu);
18614
18636
  }
18615
18637
  get isShuttingDown() {
18616
- return this.Eu;
18638
+ return this.du;
18617
18639
  }
18618
18640
  /**
18619
18641
  * Adds a new operation to the queue without waiting for it to complete (i.e.
@@ -18628,21 +18650,21 @@ function doc(e, t, ...n) {
18628
18650
  this.yu(e);
18629
18651
  }
18630
18652
  enterRestrictedMode(e) {
18631
- if (!this.Eu) {
18632
- this.Eu = !0, this.Vu = e || !1;
18653
+ if (!this.du) {
18654
+ this.du = !0, this.Vu = e || !1;
18633
18655
  const t = getDocument();
18634
18656
  t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.fu);
18635
18657
  }
18636
18658
  }
18637
18659
  enqueue(e) {
18638
- if (this.pu(), this.Eu)
18660
+ if (this.pu(), this.du)
18639
18661
  // Return a Promise which never resolves.
18640
18662
  return new Promise((() => {}));
18641
18663
  // Create a deferred Promise that we can return to the callee. This
18642
18664
  // allows us to return a "hanging Promise" only to the callee and still
18643
18665
  // advance the queue even when the operation is not run.
18644
18666
  const t = new __PRIVATE_Deferred;
18645
- return this.yu((() => this.Eu && this.Vu ? Promise.resolve() : (e().then(t.resolve, t.reject),
18667
+ return this.yu((() => this.du && this.Vu ? Promise.resolve() : (e().then(t.resolve, t.reject),
18646
18668
  t.promise))).then((() => t.promise));
18647
18669
  }
18648
18670
  enqueueRetryable(e) {
@@ -18715,8 +18737,8 @@ function doc(e, t, ...n) {
18715
18737
  this.pu(),
18716
18738
  // Fast-forward delays for timerIds that have been overridden.
18717
18739
  this.mu.indexOf(e) > -1 && (t = 0);
18718
- const r = DelayedOperation.createAndSchedule(this, e, t, n, (e => this.bu(e)));
18719
- return this.du.push(r), r;
18740
+ const r = DelayedOperation.createAndSchedule(this, e, t, n, (e => this.Su(e)));
18741
+ return this.Eu.push(r), r;
18720
18742
  }
18721
18743
  pu() {
18722
18744
  this.Au && fail();
@@ -18725,7 +18747,7 @@ function doc(e, t, ...n) {
18725
18747
  /**
18726
18748
  * Waits until all currently queued tasks are finished executing. Delayed
18727
18749
  * operations are not run.
18728
- */ async Su() {
18750
+ */ async bu() {
18729
18751
  // Operations in the queue prior to draining may have enqueued additional
18730
18752
  // operations. Keep draining the queue until the tail is no longer advanced,
18731
18753
  // which indicates that no more new operations were enqueued and that all
@@ -18739,7 +18761,7 @@ function doc(e, t, ...n) {
18739
18761
  * For Tests: Determine if a delayed operation with a particular TimerId
18740
18762
  * exists.
18741
18763
  */ Du(e) {
18742
- for (const t of this.du) if (t.timerId === e) return !0;
18764
+ for (const t of this.Eu) if (t.timerId === e) return !0;
18743
18765
  return !1;
18744
18766
  }
18745
18767
  /**
@@ -18750,12 +18772,12 @@ function doc(e, t, ...n) {
18750
18772
  * @returns a Promise that resolves once all operations have been run.
18751
18773
  */ vu(e) {
18752
18774
  // Note that draining may generate more delayed ops, so we do that first.
18753
- return this.Su().then((() => {
18775
+ return this.bu().then((() => {
18754
18776
  // Run ops in the same order they'd run if they ran naturally.
18755
18777
  /* eslint-disable-next-line @typescript-eslint/no-floating-promises */
18756
- this.du.sort(((e, t) => e.targetTimeMs - t.targetTimeMs));
18757
- for (const t of this.du) if (t.skipDelay(), "all" /* TimerId.All */ !== e && t.timerId === e) break;
18758
- return this.Su();
18778
+ this.Eu.sort(((e, t) => e.targetTimeMs - t.targetTimeMs));
18779
+ for (const t of this.Eu) if (t.skipDelay(), "all" /* TimerId.All */ !== e && t.timerId === e) break;
18780
+ return this.bu();
18759
18781
  }));
18760
18782
  }
18761
18783
  /**
@@ -18763,10 +18785,10 @@ function doc(e, t, ...n) {
18763
18785
  */ Cu(e) {
18764
18786
  this.mu.push(e);
18765
18787
  }
18766
- /** Called once a DelayedOperation is run or canceled. */ bu(e) {
18788
+ /** Called once a DelayedOperation is run or canceled. */ Su(e) {
18767
18789
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
18768
- const t = this.du.indexOf(e);
18769
- /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ this.du.splice(t, 1);
18790
+ const t = this.Eu.indexOf(e);
18791
+ /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ this.Eu.splice(t, 1);
18770
18792
  }
18771
18793
  }
18772
18794
 
@@ -18894,7 +18916,7 @@ class LoadBundleTask {
18894
18916
  * Constant used to indicate the LRU garbage collection should be disabled.
18895
18917
  * Set this value as the `cacheSizeBytes` on the settings passed to the
18896
18918
  * {@link Firestore} instance.
18897
- */ const be = -1;
18919
+ */ const Se = -1;
18898
18920
 
18899
18921
  /**
18900
18922
  * The Cloud Firestore service interface.
@@ -19554,7 +19576,7 @@ class AggregateField {
19554
19576
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19555
19577
  * See the License for the specific language governing permissions and
19556
19578
  * limitations under the License.
19557
- */ const Se = /^__.*__$/;
19579
+ */ const be = /^__.*__$/;
19558
19580
 
19559
19581
  /** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
19560
19582
  constructor(e, t, n) {
@@ -19634,9 +19656,9 @@ function __PRIVATE_isWrite(e) {
19634
19656
  path: n,
19635
19657
  Nu: !1
19636
19658
  });
19637
- return r.Lu(e), r;
19659
+ return r.Bu(e), r;
19638
19660
  }
19639
- Bu(e) {
19661
+ Lu(e) {
19640
19662
  var t;
19641
19663
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.xu({
19642
19664
  path: n,
@@ -19661,11 +19683,11 @@ function __PRIVATE_isWrite(e) {
19661
19683
  Fu() {
19662
19684
  // TODO(b/34871131): Remove null check once we have proper paths for fields
19663
19685
  // within arrays.
19664
- if (this.path) for (let e = 0; e < this.path.length; e++) this.Lu(this.path.get(e));
19686
+ if (this.path) for (let e = 0; e < this.path.length; e++) this.Bu(this.path.get(e));
19665
19687
  }
19666
- Lu(e) {
19688
+ Bu(e) {
19667
19689
  if (0 === e.length) throw this.qu("Document fields must not be empty");
19668
- if (__PRIVATE_isWrite(this.Mu) && Se.test(e)) throw this.qu('Document fields cannot begin and end with "__"');
19690
+ if (__PRIVATE_isWrite(this.Mu) && be.test(e)) throw this.qu('Document fields cannot begin and end with "__"');
19669
19691
  }
19670
19692
  }
19671
19693
 
@@ -19805,7 +19827,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19805
19827
  // For Compat types, we have to "extract" the underlying types before
19806
19828
  // performing validation.
19807
19829
  r = getModularInstance(r);
19808
- const a = i.Bu(_);
19830
+ const a = i.Lu(_);
19809
19831
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19810
19832
  // Add it to the field mask, but don't add anything to updateData.
19811
19833
  s.push(_); else {
@@ -19831,7 +19853,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19831
19853
  // For Compat types, we have to "extract" the underlying types before
19832
19854
  // performing validation.
19833
19855
  n = getModularInstance(n);
19834
- const r = o.Bu(t);
19856
+ const r = o.Lu(t);
19835
19857
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19836
19858
  // Add it to the field mask, but don't add anything to updateData.
19837
19859
  u.push(t); else {
@@ -22220,7 +22242,7 @@ let Fe = null;
22220
22242
  * @packageDocumentation
22221
22243
  */ !function __PRIVATE_registerFirestore(e, t = !0) {
22222
22244
  !function __PRIVATE_setSDKVersion(e) {
22223
- b = e;
22245
+ S = e;
22224
22246
  }(SDK_VERSION), _registerComponent(new Component("firestore", ((e, {instanceIdentifier: n, options: r}) => {
22225
22247
  const i = e.getProvider("app").getImmediate(), s = new Firestore(new __PRIVATE_FirebaseAuthCredentialsProvider(e.getProvider("auth-internal")), new __PRIVATE_FirebaseAppCheckTokenProvider(e.getProvider("app-check-internal")), function __PRIVATE_databaseIdFromApp(e, t) {
22226
22248
  if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(D.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
@@ -22229,10 +22251,10 @@ let Fe = null;
22229
22251
  return r = Object.assign({
22230
22252
  useFetchStreams: t
22231
22253
  }, r), s._setSettings(r), s;
22232
- }), "PUBLIC").setMultipleInstances(!0)), registerVersion(w, "4.7.5-canary.46c91bc3b", e),
22254
+ }), "PUBLIC").setMultipleInstances(!0)), registerVersion(w, "4.7.5-canary.7bf2aec63", e),
22233
22255
  // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
22234
- registerVersion(w, "4.7.5-canary.46c91bc3b", "esm2017");
22256
+ registerVersion(w, "4.7.5-canary.7bf2aec63", "esm2017");
22235
22257
  }();
22236
22258
 
22237
- export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, be as CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, PersistentCacheIndexManager, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryLimitConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SnapshotMetadata, Timestamp, Transaction, VectorValue, WriteBatch, __PRIVATE_AutoId as _AutoId, ByteString as _ByteString, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, __PRIVATE_EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, __PRIVATE_EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, TestingHooks as _TestingHooks, __PRIVATE_cast as _cast, __PRIVATE_debugAssert as _debugAssert, _internalAggregationQueryToProtoRunAggregationQueryRequest, _internalQueryToProtoQueryTarget, __PRIVATE_isBase64Available as _isBase64Available, __PRIVATE_logWarn as _logWarn, __PRIVATE_validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteAllPersistentCacheIndexes, deleteDoc, deleteField, disableNetwork, disablePersistentCacheIndexAutoCreation, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, enablePersistentCacheIndexAutoCreation, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, getPersistentCacheIndexManager, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, vector, waitForPendingWrites, where, writeBatch };
22259
+ export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, Se as CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, PersistentCacheIndexManager, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryLimitConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SnapshotMetadata, Timestamp, Transaction, VectorValue, WriteBatch, __PRIVATE_AutoId as _AutoId, ByteString as _ByteString, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, __PRIVATE_EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, __PRIVATE_EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, TestingHooks as _TestingHooks, __PRIVATE_cast as _cast, __PRIVATE_debugAssert as _debugAssert, _internalAggregationQueryToProtoRunAggregationQueryRequest, _internalQueryToProtoQueryTarget, __PRIVATE_isBase64Available as _isBase64Available, __PRIVATE_logWarn as _logWarn, __PRIVATE_validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteAllPersistentCacheIndexes, deleteDoc, deleteField, disableNetwork, disablePersistentCacheIndexAutoCreation, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, enablePersistentCacheIndexAutoCreation, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, getPersistentCacheIndexManager, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, vector, waitForPendingWrites, where, writeBatch };
22238
22260
  //# sourceMappingURL=index.esm2017.js.map