@firebase/firestore 4.7.5 → 4.7.6-canary.144bc3709

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.
package/dist/index.rn.js CHANGED
@@ -4,7 +4,7 @@ import { Component as s } from "@firebase/component";
4
4
 
5
5
  import { Logger as o, LogLevel as _ } from "@firebase/logger";
6
6
 
7
- import { FirebaseError as a, isIndexedDBAvailable as u, getUA as c, base64 as l, DecodeBase64StringError as h, isSafari as P, createMockUserToken as T, getModularInstance as I, deepEqual as E, getDefaultEmulatorHostnameAndPort as d } from "@firebase/util";
7
+ import { FirebaseError as a, isIndexedDBAvailable as u, getUA as c, base64 as l, DecodeBase64StringError as h, isSafari as P, createMockUserToken as I, getModularInstance as T, deepEqual as d, getDefaultEmulatorHostnameAndPort as E } from "@firebase/util";
8
8
 
9
9
  import { Integer as A, Md5 as R } from "@firebase/webchannel-wrapper/bloom-blob";
10
10
 
@@ -72,7 +72,7 @@ User.MOCK_USER = new User("mock-user");
72
72
  * See the License for the specific language governing permissions and
73
73
  * limitations under the License.
74
74
  */
75
- let D = "11.0.2";
75
+ let D = "11.2.0-canary.144bc3709";
76
76
 
77
77
  /**
78
78
  * @license
@@ -551,20 +551,20 @@ class __PRIVATE_FirebaseAuthCredentialsProvider {
551
551
  */ class __PRIVATE_FirstPartyToken {
552
552
  constructor(e, t, n) {
553
553
  this.l = e, this.h = t, this.P = n, this.type = "FirstParty", this.user = User.FIRST_PARTY,
554
- this.T = new Map;
554
+ this.I = new Map;
555
555
  }
556
556
  /**
557
557
  * Gets an authorization token, using a provided factory function, or return
558
558
  * null.
559
- */ I() {
559
+ */ T() {
560
560
  return this.P ? this.P() : null;
561
561
  }
562
562
  get headers() {
563
- this.T.set("X-Goog-AuthUser", this.l);
563
+ this.I.set("X-Goog-AuthUser", this.l);
564
564
  // Use array notation to prevent minification
565
- const e = this.I();
566
- return e && this.T.set("Authorization", e), this.h && this.T.set("X-Goog-Iam-Authorization-Token", this.h),
567
- this.T;
565
+ const e = this.T();
566
+ return e && this.I.set("Authorization", e), this.h && this.I.set("X-Goog-Iam-Authorization-Token", this.h),
567
+ this.I;
568
568
  }
569
569
  }
570
570
 
@@ -1006,14 +1006,30 @@ class BasePath {
1006
1006
  toArray() {
1007
1007
  return this.segments.slice(this.offset, this.limit());
1008
1008
  }
1009
- static comparator(e, t) {
1009
+ /**
1010
+ * Compare 2 paths segment by segment, prioritizing numeric IDs
1011
+ * (e.g., "__id123__") in numeric ascending order, followed by string
1012
+ * segments in lexicographical order.
1013
+ */ static comparator(e, t) {
1010
1014
  const n = Math.min(e.length, t.length);
1011
1015
  for (let r = 0; r < n; r++) {
1012
- const n = e.get(r), i = t.get(r);
1013
- if (n < i) return -1;
1014
- if (n > i) return 1;
1016
+ const n = BasePath.compareSegments(e.get(r), t.get(r));
1017
+ if (0 !== n) return n;
1015
1018
  }
1016
- return e.length < t.length ? -1 : e.length > t.length ? 1 : 0;
1019
+ return Math.sign(e.length - t.length);
1020
+ }
1021
+ static compareSegments(e, t) {
1022
+ const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);
1023
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) :
1024
+ // both non-numeric
1025
+ e < t ? -1 : e > t ? 1 : 0;
1026
+ }
1027
+ // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1028
+ static isNumericId(e) {
1029
+ return e.startsWith("__id") && e.endsWith("__");
1030
+ }
1031
+ static extractNumericId(e) {
1032
+ return A.fromString(e.substring(4, e.length - 2));
1017
1033
  }
1018
1034
  }
1019
1035
 
@@ -1736,7 +1752,7 @@ class __PRIVATE_SimpleDbTransaction {
1736
1752
  };
1737
1753
  }))), this.N && (this.db.onversionchange = e => this.N(e)), this.db;
1738
1754
  }
1739
- L(e) {
1755
+ B(e) {
1740
1756
  this.N = e, this.db && (this.db.onversionchange = t => e(t));
1741
1757
  }
1742
1758
  async runTransaction(e, t, n, r) {
@@ -1785,7 +1801,7 @@ class __PRIVATE_SimpleDbTransaction {
1785
1801
  * within the key range or index.
1786
1802
  */ class __PRIVATE_IterationController {
1787
1803
  constructor(e) {
1788
- this.B = e, this.k = !1, this.q = null;
1804
+ this.L = e, this.k = !1, this.q = null;
1789
1805
  }
1790
1806
  get isDone() {
1791
1807
  return this.k;
@@ -1794,7 +1810,7 @@ class __PRIVATE_SimpleDbTransaction {
1794
1810
  return this.q;
1795
1811
  }
1796
1812
  set cursor(e) {
1797
- this.B = e;
1813
+ this.L = e;
1798
1814
  }
1799
1815
  /**
1800
1816
  * This function can be called to stop iteration at any point.
@@ -1812,7 +1828,7 @@ class __PRIVATE_SimpleDbTransaction {
1812
1828
  *
1813
1829
  * NOTE: You CANNOT do this with a keysOnly query.
1814
1830
  */ delete() {
1815
- return __PRIVATE_wrapRequest(this.B.delete());
1831
+ return __PRIVATE_wrapRequest(this.L.delete());
1816
1832
  }
1817
1833
  }
1818
1834
 
@@ -2308,7 +2324,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2308
2324
  * there is no useful information to store as the value. The raw (unencoded)
2309
2325
  * path cannot be stored because IndexedDb doesn't store prototype
2310
2326
  * information.
2311
- */ const N = {}, L = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], B = [ "prefixPath", "collectionGroup", "documentId" ], k = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], q = [ "canonicalId", "targetId" ], Q = [ "targetId", "path" ], K = [ "path", "targetId" ], $ = [ "collectionId", "parent" ], U = [ "indexId", "uid" ], W = [ "uid", "sequenceNumber" ], G = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], z = [ "indexId", "uid", "orderedDocumentKey" ], j = [ "userId", "collectionPath", "documentId" ], H = [ "userId", "collectionPath", "largestBatchId" ], J = [ "userId", "collectionGroup", "largestBatchId" ], Y = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], Z = [ ...Y, "documentOverlays" ], X = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], ee = X, te = [ ...ee, "indexConfiguration", "indexState", "indexEntries" ], ne = te, re = [ ...te, "globals" ];
2327
+ */ const N = {}, B = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], L = [ "prefixPath", "collectionGroup", "documentId" ], k = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], q = [ "canonicalId", "targetId" ], Q = [ "targetId", "path" ], K = [ "path", "targetId" ], $ = [ "collectionId", "parent" ], U = [ "indexId", "uid" ], W = [ "uid", "sequenceNumber" ], G = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], z = [ "indexId", "uid", "orderedDocumentKey" ], j = [ "userId", "collectionPath", "documentId" ], H = [ "userId", "collectionPath", "largestBatchId" ], J = [ "userId", "collectionGroup", "largestBatchId" ], Y = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], Z = [ ...Y, "documentOverlays" ], X = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], ee = X, te = [ ...ee, "indexConfiguration", "indexState", "indexEntries" ], ne = te, re = [ ...te, "globals" ];
2312
2328
 
2313
2329
  /**
2314
2330
  * @license
@@ -5666,7 +5682,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
5666
5682
  * Important! The names of these identifiers matter because the string forms
5667
5683
  * are used for reverse lookups from the webchannel stream. Do NOT change the
5668
5684
  * names of these identifiers or change this into a const enum.
5669
- */ var Pe, Te;
5685
+ */ var Pe, Ie;
5670
5686
 
5671
5687
  /**
5672
5688
  * Determines whether an error code represents a permanent error when received
@@ -5794,14 +5810,14 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
5794
5810
  * "UNKNOWN", etc.)
5795
5811
  * @returns The equivalent Code. Non-matching responses are mapped to
5796
5812
  * Code.UNKNOWN.
5797
- */ (Te = Pe || (Pe = {}))[Te.OK = 0] = "OK", Te[Te.CANCELLED = 1] = "CANCELLED",
5798
- Te[Te.UNKNOWN = 2] = "UNKNOWN", Te[Te.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
5799
- Te[Te.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", Te[Te.NOT_FOUND = 5] = "NOT_FOUND",
5800
- Te[Te.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", Te[Te.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
5801
- Te[Te.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", Te[Te.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
5802
- Te[Te.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", Te[Te.ABORTED = 10] = "ABORTED",
5803
- Te[Te.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", Te[Te.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
5804
- Te[Te.INTERNAL = 13] = "INTERNAL", Te[Te.UNAVAILABLE = 14] = "UNAVAILABLE", Te[Te.DATA_LOSS = 15] = "DATA_LOSS";
5813
+ */ (Ie = Pe || (Pe = {}))[Ie.OK = 0] = "OK", Ie[Ie.CANCELLED = 1] = "CANCELLED",
5814
+ Ie[Ie.UNKNOWN = 2] = "UNKNOWN", Ie[Ie.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
5815
+ Ie[Ie.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", Ie[Ie.NOT_FOUND = 5] = "NOT_FOUND",
5816
+ Ie[Ie.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", Ie[Ie.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
5817
+ Ie[Ie.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", Ie[Ie.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
5818
+ Ie[Ie.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", Ie[Ie.ABORTED = 10] = "ABORTED",
5819
+ Ie[Ie.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", Ie[Ie.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
5820
+ Ie[Ie.INTERNAL = 13] = "INTERNAL", Ie[Ie.UNAVAILABLE = 14] = "UNAVAILABLE", Ie[Ie.DATA_LOSS = 15] = "DATA_LOSS";
5805
5821
 
5806
5822
  /**
5807
5823
  * @license
@@ -5826,7 +5842,7 @@ Te[Te.INTERNAL = 13] = "INTERNAL", Te[Te.UNAVAILABLE = 14] = "UNAVAILABLE", Te[T
5826
5842
  * integration tests that have registered callbacks to be notified of events
5827
5843
  * that happen during the test execution.
5828
5844
  */
5829
- let Ie = null;
5845
+ let Te = null;
5830
5846
 
5831
5847
  /**
5832
5848
  * Sets the value of the `testingHooksSpi` object.
@@ -5874,7 +5890,7 @@ function __PRIVATE_newTextEncoder() {
5874
5890
  * See the License for the specific language governing permissions and
5875
5891
  * limitations under the License.
5876
5892
  */
5877
- const Ee = new A([ 4294967295, 4294967295 ], 0);
5893
+ const de = new A([ 4294967295, 4294967295 ], 0);
5878
5894
 
5879
5895
  // Hash a string using md5 hashing algorithm.
5880
5896
  function __PRIVATE_getMd5HashValue(e) {
@@ -5899,30 +5915,30 @@ class BloomFilter {
5899
5915
  if (0 === e.length && 0 !== t)
5900
5916
  // Empty bloom filter should have 0 padding.
5901
5917
  throw new __PRIVATE_BloomFilterError(`Invalid padding when bitmap length is 0: ${t}`);
5902
- this.Te = 8 * e.length - t,
5918
+ this.Ie = 8 * e.length - t,
5903
5919
  // Set the bit count in Integer to avoid repetition in mightContain().
5904
- this.Ie = A.fromNumber(this.Te);
5920
+ this.Te = A.fromNumber(this.Ie);
5905
5921
  }
5906
5922
  // Calculate the ith hash value based on the hashed 64bit integers,
5907
5923
  // and calculate its corresponding bit index in the bitmap to be checked.
5908
- Ee(e, t, n) {
5924
+ de(e, t, n) {
5909
5925
  // Calculate hashed value h(i) = h1 + (i * h2).
5910
5926
  let r = e.add(t.multiply(A.fromNumber(n)));
5911
5927
  // Wrap if hash value overflow 64bit.
5912
- return 1 === r.compare(Ee) && (r = new A([ r.getBits(0), r.getBits(1) ], 0)),
5913
- r.modulo(this.Ie).toNumber();
5928
+ return 1 === r.compare(de) && (r = new A([ r.getBits(0), r.getBits(1) ], 0)),
5929
+ r.modulo(this.Te).toNumber();
5914
5930
  }
5915
5931
  // Return whether the bit on the given index in the bitmap is set to 1.
5916
- de(e) {
5932
+ Ee(e) {
5917
5933
  return 0 != (this.bitmap[Math.floor(e / 8)] & 1 << e % 8);
5918
5934
  }
5919
5935
  mightContain(e) {
5920
5936
  // Empty bitmap should always return false on membership check.
5921
- if (0 === this.Te) return !1;
5937
+ if (0 === this.Ie) return !1;
5922
5938
  const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
5923
5939
  for (let e = 0; e < this.hashCount; e++) {
5924
- const t = this.Ee(n, r, e);
5925
- if (!this.de(t)) return !1;
5940
+ const t = this.de(n, r, e);
5941
+ if (!this.Ee(t)) return !1;
5926
5942
  }
5927
5943
  return !0;
5928
5944
  }
@@ -5931,10 +5947,10 @@ class BloomFilter {
5931
5947
  return n.forEach((e => s.insert(e))), s;
5932
5948
  }
5933
5949
  insert(e) {
5934
- if (0 === this.Te) return;
5950
+ if (0 === this.Ie) return;
5935
5951
  const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);
5936
5952
  for (let e = 0; e < this.hashCount; e++) {
5937
- const t = this.Ee(n, r, e);
5953
+ const t = this.de(n, r, e);
5938
5954
  this.Ae(t);
5939
5955
  }
5940
5956
  }
@@ -6224,9 +6240,9 @@ class __PRIVATE_WatchTargetChange {
6224
6240
  */
6225
6241
  class __PRIVATE_WatchChangeAggregator {
6226
6242
  constructor(e) {
6227
- this.Le = e,
6243
+ this.Be = e,
6228
6244
  /** The internal state of all tracked targets. */
6229
- this.Be = new Map,
6245
+ this.Le = new Map,
6230
6246
  /** Keeps track of the documents to update since the last raised snapshot. */
6231
6247
  this.ke = __PRIVATE_mutableDocumentMap(), this.qe = __PRIVATE_documentTargetMap(),
6232
6248
  /** A mapping of document keys to their set of target IDs. */
@@ -6292,7 +6308,7 @@ class __PRIVATE_WatchChangeAggregator {
6292
6308
  * targetIds explicitly listed in the change or the targetIds of all currently
6293
6309
  * active targets.
6294
6310
  */ forEachTarget(e, t) {
6295
- e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Be.forEach(((e, n) => {
6311
+ e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Le.forEach(((e, n) => {
6296
6312
  this.je(n) && t(n);
6297
6313
  }));
6298
6314
  }
@@ -6327,7 +6343,7 @@ class __PRIVATE_WatchChangeAggregator {
6327
6343
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6328
6344
  this.Ke = this.Ke.insert(t, e);
6329
6345
  }
6330
- null == Ie || Ie.tt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6346
+ null == Te || Te.tt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6331
6347
  var s, o, _, a, u, c;
6332
6348
  const l = {
6333
6349
  localCacheCount: e,
@@ -6362,7 +6378,7 @@ class __PRIVATE_WatchChangeAggregator {
6362
6378
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6363
6379
  * See the License for the specific language governing permissions and
6364
6380
  * limitations under the License.
6365
- */ (r, e.me, this.Le.nt(), n, i));
6381
+ */ (r, e.me, this.Be.nt(), n, i));
6366
6382
  }
6367
6383
  }
6368
6384
  }
@@ -6389,7 +6405,7 @@ class __PRIVATE_WatchChangeAggregator {
6389
6405
  return __PRIVATE_logWarn(e instanceof __PRIVATE_BloomFilterError ? "BloomFilter error: " : "Applying bloom filter failed: ", e),
6390
6406
  null;
6391
6407
  }
6392
- return 0 === o.Te ? null : o;
6408
+ return 0 === o.Ie ? null : o;
6393
6409
  }
6394
6410
  /**
6395
6411
  * Apply bloom filter to remove the deleted documents, and return the
@@ -6401,10 +6417,10 @@ class __PRIVATE_WatchChangeAggregator {
6401
6417
  * Filter out removed documents based on bloom filter membership result and
6402
6418
  * return number of documents removed.
6403
6419
  */ rt(e, t) {
6404
- const n = this.Le.getRemoteKeysForTarget(t);
6420
+ const n = this.Be.getRemoteKeysForTarget(t);
6405
6421
  let r = 0;
6406
6422
  return n.forEach((n => {
6407
- const i = this.Le.nt(), s = `projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;
6423
+ const i = this.Be.nt(), s = `projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;
6408
6424
  e.mightContain(s) || (this.We(t, n, /*updatedDocument=*/ null), r++);
6409
6425
  })), r;
6410
6426
  }
@@ -6413,7 +6429,7 @@ class __PRIVATE_WatchChangeAggregator {
6413
6429
  * provided snapshot version. Resets the accumulated changes before returning.
6414
6430
  */ it(e) {
6415
6431
  const t = new Map;
6416
- this.Be.forEach(((n, r) => {
6432
+ this.Le.forEach(((n, r) => {
6417
6433
  const i = this.Ye(r);
6418
6434
  if (i) {
6419
6435
  if (n.current && __PRIVATE_targetIsDocumentTarget(i.target)) {
@@ -6479,7 +6495,7 @@ class __PRIVATE_WatchChangeAggregator {
6479
6495
  n && (this.ke = this.ke.insert(t, n));
6480
6496
  }
6481
6497
  removeTarget(e) {
6482
- this.Be.delete(e);
6498
+ this.Le.delete(e);
6483
6499
  }
6484
6500
  /**
6485
6501
  * Returns the current count of documents in the target. This includes both
@@ -6487,7 +6503,7 @@ class __PRIVATE_WatchChangeAggregator {
6487
6503
  * target as well as any accumulated changes.
6488
6504
  */ Ze(e) {
6489
6505
  const t = this.ze(e).ve();
6490
- return this.Le.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
6506
+ return this.Be.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;
6491
6507
  }
6492
6508
  /**
6493
6509
  * Increment the number of acks needed from watch before we can consider the
@@ -6496,8 +6512,8 @@ class __PRIVATE_WatchChangeAggregator {
6496
6512
  this.ze(e).xe();
6497
6513
  }
6498
6514
  ze(e) {
6499
- let t = this.Be.get(e);
6500
- return t || (t = new __PRIVATE_TargetState, this.Be.set(e, t)), t;
6515
+ let t = this.Le.get(e);
6516
+ return t || (t = new __PRIVATE_TargetState, this.Le.set(e, t)), t;
6501
6517
  }
6502
6518
  _t(e) {
6503
6519
  let t = this.Qe.get(e);
@@ -6522,16 +6538,16 @@ class __PRIVATE_WatchChangeAggregator {
6522
6538
  * Returns the TargetData for an active target (i.e. a target that the user
6523
6539
  * is still interested in that has no outstanding target change requests).
6524
6540
  */ Ye(e) {
6525
- const t = this.Be.get(e);
6526
- return t && t.Se ? null : this.Le.ut(e);
6541
+ const t = this.Le.get(e);
6542
+ return t && t.Se ? null : this.Be.ut(e);
6527
6543
  }
6528
6544
  /**
6529
6545
  * Resets the state of a Watch target to its initial state (e.g. sets
6530
6546
  * 'current' to false, clears the resume token and removes its target mapping
6531
6547
  * from all documents).
6532
6548
  */ He(e) {
6533
- this.Be.set(e, new __PRIVATE_TargetState);
6534
- this.Le.getRemoteKeysForTarget(e).forEach((t => {
6549
+ this.Le.set(e, new __PRIVATE_TargetState);
6550
+ this.Be.getRemoteKeysForTarget(e).forEach((t => {
6535
6551
  this.We(e, t, /*updatedDocument=*/ null);
6536
6552
  }));
6537
6553
  }
@@ -6539,7 +6555,7 @@ class __PRIVATE_WatchChangeAggregator {
6539
6555
  * Returns whether the LocalStore considers the document to be part of the
6540
6556
  * specified target.
6541
6557
  */ ot(e, t) {
6542
- return this.Le.getRemoteKeysForTarget(e).has(t);
6558
+ return this.Be.getRemoteKeysForTarget(e).has(t);
6543
6559
  }
6544
6560
  }
6545
6561
 
@@ -6551,7 +6567,7 @@ function __PRIVATE_snapshotChangesMap() {
6551
6567
  return new SortedMap(DocumentKey.comparator);
6552
6568
  }
6553
6569
 
6554
- const de = (() => {
6570
+ const Ee = (() => {
6555
6571
  const e = {
6556
6572
  asc: "ASCENDING",
6557
6573
  desc: "DESCENDING"
@@ -7143,7 +7159,7 @@ function __PRIVATE_fromFilter(e) {
7143
7159
  }
7144
7160
 
7145
7161
  function __PRIVATE_toDirection(e) {
7146
- return de[e];
7162
+ return Ee[e];
7147
7163
  }
7148
7164
 
7149
7165
  function __PRIVATE_toOperatorName(e) {
@@ -7601,7 +7617,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7601
7617
  const r = [];
7602
7618
  return n.forEach(((n, i) => {
7603
7619
  const s = new Overlay(t, i);
7604
- r.push(this.Tt(e, s));
7620
+ r.push(this.It(e, s));
7605
7621
  })), PersistencePromise.waitFor(r);
7606
7622
  }
7607
7623
  removeOverlaysForBatchId(e, t, n) {
@@ -7646,7 +7662,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7646
7662
  i.size() < r || o.largestBatchId === s ? (i.set(o.getKey(), o), s = o.largestBatchId) : n.done();
7647
7663
  })).next((() => i));
7648
7664
  }
7649
- Tt(e, t) {
7665
+ It(e, t) {
7650
7666
  return __PRIVATE_documentOverlayStore(e).put(function __PRIVATE_toDbDocumentOverlay(e, t, n) {
7651
7667
  const [r, i, s] = __PRIVATE_toDbDocumentOverlayKey(t, n.mutation.key);
7652
7668
  return {
@@ -7683,17 +7699,17 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7683
7699
  * See the License for the specific language governing permissions and
7684
7700
  * limitations under the License.
7685
7701
  */ class __PRIVATE_IndexedDbGlobalsCache {
7686
- It(e) {
7702
+ Tt(e) {
7687
7703
  return __PRIVATE_getStore(e, "globals");
7688
7704
  }
7689
7705
  getSessionToken(e) {
7690
- return this.It(e).get("sessionToken").next((e => {
7706
+ return this.Tt(e).get("sessionToken").next((e => {
7691
7707
  const t = null == e ? void 0 : e.value;
7692
7708
  return t ? ByteString.fromUint8Array(t) : ByteString.EMPTY_BYTE_STRING;
7693
7709
  }));
7694
7710
  }
7695
7711
  setSessionToken(e, t) {
7696
- return this.It(e).put({
7712
+ return this.Tt(e).put({
7697
7713
  name: "sessionToken",
7698
7714
  value: t.toUint8Array()
7699
7715
  });
@@ -7728,13 +7744,13 @@ class __PRIVATE_FirestoreIndexValueWriter {
7728
7744
  // ["bar", [2, truncated("foo")]] -> (STRING, "bar", TERM, ARRAY, NUMBER, 2, STRING, "foo", TRUNC)
7729
7745
  // ["bar", truncated(["foo"])] -> (STRING, "bar", TERM, ARRAY. STRING, "foo", TERM, TRUNC)
7730
7746
  /** Writes an index value. */
7731
- Et(e, t) {
7732
- this.dt(e, t),
7747
+ dt(e, t) {
7748
+ this.Et(e, t),
7733
7749
  // Write separator to split index values
7734
7750
  // (see go/firestore-storage-format#encodings).
7735
7751
  t.At();
7736
7752
  }
7737
- dt(e, t) {
7753
+ Et(e, t) {
7738
7754
  if ("nullValue" in e) this.Rt(t, 5); else if ("booleanValue" in e) this.Rt(t, 10),
7739
7755
  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) {
7740
7756
  const n = __PRIVATE_normalizeNumber(e.doubleValue);
@@ -7761,7 +7777,7 @@ class __PRIVATE_FirestoreIndexValueWriter {
7761
7777
  Dt(e, t) {
7762
7778
  const n = e.fields || {};
7763
7779
  this.Rt(t, 55);
7764
- for (const e of Object.keys(n)) this.gt(e, t), this.dt(n[e], t);
7780
+ for (const e of Object.keys(n)) this.gt(e, t), this.Et(n[e], t);
7765
7781
  }
7766
7782
  bt(e, t) {
7767
7783
  var n, r;
@@ -7771,12 +7787,12 @@ class __PRIVATE_FirestoreIndexValueWriter {
7771
7787
  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;
7772
7788
  this.Rt(t, 15), t.Vt(__PRIVATE_normalizeNumber(o)),
7773
7789
  // Vectors then sort by position value
7774
- this.gt(s, t), this.dt(i[s], t);
7790
+ this.gt(s, t), this.Et(i[s], t);
7775
7791
  }
7776
7792
  vt(e, t) {
7777
7793
  const n = e.values || [];
7778
7794
  this.Rt(t, 50);
7779
- for (const e of n) this.dt(e, t);
7795
+ for (const e of n) this.Et(e, t);
7780
7796
  }
7781
7797
  St(e, t) {
7782
7798
  this.Rt(t, 37);
@@ -7850,8 +7866,8 @@ function __PRIVATE_unsignedNumLength(e) {
7850
7866
  Nt(e) {
7851
7867
  const t = e[Symbol.iterator]();
7852
7868
  let n = t.next();
7853
- for (;!n.done; ) this.Lt(n.value), n = t.next();
7854
- this.Bt();
7869
+ for (;!n.done; ) this.Bt(n.value), n = t.next();
7870
+ this.Lt();
7855
7871
  }
7856
7872
  /** Writes utf8 bytes into this byte sequence, ascending. */ kt(e) {
7857
7873
  for (const t of e) {
@@ -7868,14 +7884,14 @@ function __PRIVATE_unsignedNumLength(e) {
7868
7884
  /** Writes utf8 bytes into this byte sequence, descending */ qt(e) {
7869
7885
  for (const t of e) {
7870
7886
  const e = t.charCodeAt(0);
7871
- 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),
7872
- this.Lt(128 | 63 & e >>> 6), this.Lt(128 | 63 & e); else {
7887
+ 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),
7888
+ this.Bt(128 | 63 & e >>> 6), this.Bt(128 | 63 & e); else {
7873
7889
  const e = t.codePointAt(0);
7874
- this.Lt(240 | e >>> 18), this.Lt(128 | 63 & e >>> 12), this.Lt(128 | 63 & e >>> 6),
7875
- this.Lt(128 | 63 & e);
7890
+ this.Bt(240 | e >>> 18), this.Bt(128 | 63 & e >>> 12), this.Bt(128 | 63 & e >>> 6),
7891
+ this.Bt(128 | 63 & e);
7876
7892
  }
7877
7893
  }
7878
- this.Bt();
7894
+ this.Lt();
7879
7895
  }
7880
7896
  Qt(e) {
7881
7897
  // Values are encoded with a single byte length prefix, followed by the
@@ -7941,14 +7957,14 @@ function __PRIVATE_unsignedNumLength(e) {
7941
7957
  const t = 255 & e;
7942
7958
  0 === t ? (this.Gt(0), this.Gt(255)) : 255 === t ? (this.Gt(255), this.Gt(0)) : this.Gt(t);
7943
7959
  }
7944
- /** Writes a single byte descending to the buffer. */ Lt(e) {
7960
+ /** Writes a single byte descending to the buffer. */ Bt(e) {
7945
7961
  const t = 255 & e;
7946
7962
  0 === t ? (this.jt(0), this.jt(255)) : 255 === t ? (this.jt(255), this.jt(0)) : this.jt(e);
7947
7963
  }
7948
7964
  Ot() {
7949
7965
  this.Gt(0), this.Gt(1);
7950
7966
  }
7951
- Bt() {
7967
+ Lt() {
7952
7968
  this.jt(0), this.jt(1);
7953
7969
  }
7954
7970
  Gt(e) {
@@ -8614,7 +8630,7 @@ class __PRIVATE_IndexedDbIndexManager {
8614
8630
  return t.j().next((() => n.j())).next((() => r.j()));
8615
8631
  }
8616
8632
  createTargetIndexes(e, t) {
8617
- return PersistencePromise.forEach(this.Tn(t), (t => this.getIndexType(e, t).next((n => {
8633
+ return PersistencePromise.forEach(this.In(t), (t => this.getIndexType(e, t).next((n => {
8618
8634
  if (0 /* IndexType.NONE */ === n || 1 /* IndexType.PARTIAL */ === n) {
8619
8635
  const n = new __PRIVATE_TargetIndexMatcher(t).cn();
8620
8636
  if (null != n) return this.addFieldIndex(e, n);
@@ -8625,7 +8641,7 @@ class __PRIVATE_IndexedDbIndexManager {
8625
8641
  const n = __PRIVATE_indexEntriesStore(e);
8626
8642
  let r = !0;
8627
8643
  const i = new Map;
8628
- return PersistencePromise.forEach(this.Tn(t), (t => this.In(e, t).next((e => {
8644
+ return PersistencePromise.forEach(this.In(t), (t => this.Tn(e, t).next((e => {
8629
8645
  r && (r = !!e), i.set(t, e);
8630
8646
  })))).next((() => {
8631
8647
  if (r) {
@@ -8700,7 +8716,7 @@ class __PRIVATE_IndexedDbIndexManager {
8700
8716
  n.push(t.value), r && (r = t.inclusive);
8701
8717
  }
8702
8718
  return new Bound(n, r);
8703
- }(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);
8719
+ }(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);
8704
8720
  return PersistencePromise.forEach(P, (i => n.G(i, t.limit).next((t => {
8705
8721
  t.forEach((t => {
8706
8722
  const n = DocumentKey.fromSegments(t.documentKey);
@@ -8712,7 +8728,7 @@ class __PRIVATE_IndexedDbIndexManager {
8712
8728
  return PersistencePromise.resolve(null);
8713
8729
  }));
8714
8730
  }
8715
- Tn(e) {
8731
+ In(e) {
8716
8732
  let t = this.Pn.get(e);
8717
8733
  if (t) return t;
8718
8734
  if (0 === e.filters.length) t = [ e ]; else {
@@ -8744,7 +8760,7 @@ class __PRIVATE_IndexedDbIndexManager {
8744
8760
  const i = new __PRIVATE_IndexEntry(e, DocumentKey.empty(), t, n);
8745
8761
  return r ? i.en() : i;
8746
8762
  }
8747
- In(e, t) {
8763
+ Tn(e, t) {
8748
8764
  const n = new __PRIVATE_TargetIndexMatcher(t), r = null != t.collectionGroup ? t.collectionGroup : t.path.lastSegment();
8749
8765
  return this.getFieldIndexes(e, r).next((e => {
8750
8766
  // Return the index with the most number of segments.
@@ -8757,8 +8773,8 @@ class __PRIVATE_IndexedDbIndexManager {
8757
8773
  }
8758
8774
  getIndexType(e, t) {
8759
8775
  let n = 2 /* IndexType.FULL */;
8760
- const r = this.Tn(t);
8761
- return PersistencePromise.forEach(r, (t => this.In(e, t).next((e => {
8776
+ const r = this.In(t);
8777
+ return PersistencePromise.forEach(r, (t => this.Tn(e, t).next((e => {
8762
8778
  e ? 0 /* IndexType.NONE */ !== n && e.fields.length < function __PRIVATE_targetGetSegmentCount(e) {
8763
8779
  let t = new SortedSet(FieldPath$1.comparator), n = !1;
8764
8780
  for (const r of e.filters) for (const e of r.getFlattenedFilters())
@@ -8794,13 +8810,13 @@ class __PRIVATE_IndexedDbIndexManager {
8794
8810
  const e = t.data.field(r.fieldPath);
8795
8811
  if (null == e) return null;
8796
8812
  const i = n.Xt(r.kind);
8797
- __PRIVATE_FirestoreIndexValueWriter.Ft.Et(e, i);
8813
+ __PRIVATE_FirestoreIndexValueWriter.Ft.dt(e, i);
8798
8814
  }
8799
8815
  return n.Ht();
8800
8816
  }
8801
8817
  /** Encodes a single value to the ascending index format. */ Rn(e) {
8802
8818
  const t = new __PRIVATE_IndexByteEncoder;
8803
- return __PRIVATE_FirestoreIndexValueWriter.Ft.Et(e, t.Xt(0 /* IndexKind.ASCENDING */)),
8819
+ return __PRIVATE_FirestoreIndexValueWriter.Ft.dt(e, t.Xt(0 /* IndexKind.ASCENDING */)),
8804
8820
  t.Ht();
8805
8821
  }
8806
8822
  /**
@@ -8808,7 +8824,7 @@ class __PRIVATE_IndexedDbIndexManager {
8808
8824
  * ordering of the field index.
8809
8825
  */ gn(e, t) {
8810
8826
  const n = new __PRIVATE_IndexByteEncoder;
8811
- return __PRIVATE_FirestoreIndexValueWriter.Ft.Et(__PRIVATE_refValue(this.databaseId, t), n.Xt(function __PRIVATE_fieldIndexGetKeyOrder(e) {
8827
+ return __PRIVATE_FirestoreIndexValueWriter.Ft.dt(__PRIVATE_refValue(this.databaseId, t), n.Xt(function __PRIVATE_fieldIndexGetKeyOrder(e) {
8812
8828
  const t = __PRIVATE_fieldIndexGetDirectionalSegments(e);
8813
8829
  return 0 === t.length ? 0 /* IndexKind.ASCENDING */ : t[t.length - 1].kind;
8814
8830
  }(e))), n.Ht();
@@ -8816,7 +8832,7 @@ class __PRIVATE_IndexedDbIndexManager {
8816
8832
  /**
8817
8833
  * Encodes the given field values according to the specification in `target`.
8818
8834
  * For IN queries, a list of possible values is returned.
8819
- */ dn(e, t, n) {
8835
+ */ En(e, t, n) {
8820
8836
  if (null === n) return [];
8821
8837
  let r = [];
8822
8838
  r.push(new __PRIVATE_IndexByteEncoder);
@@ -8825,7 +8841,7 @@ class __PRIVATE_IndexedDbIndexManager {
8825
8841
  const e = n[i++];
8826
8842
  for (const n of r) if (this.pn(t, s.fieldPath) && isArray(e)) r = this.yn(r, s, e); else {
8827
8843
  const t = n.Xt(s.kind);
8828
- __PRIVATE_FirestoreIndexValueWriter.Ft.Et(e, t);
8844
+ __PRIVATE_FirestoreIndexValueWriter.Ft.dt(e, t);
8829
8845
  }
8830
8846
  }
8831
8847
  return this.wn(r);
@@ -8833,8 +8849,8 @@ class __PRIVATE_IndexedDbIndexManager {
8833
8849
  /**
8834
8850
  * Encodes the given bounds according to the specification in `target`. For IN
8835
8851
  * queries, a list of possible values is returned.
8836
- */ En(e, t, n) {
8837
- return this.dn(e, t, n.position);
8852
+ */ dn(e, t, n) {
8853
+ return this.En(e, t, n.position);
8838
8854
  }
8839
8855
  /** Returns the byte representation for the provided encoders. */ wn(e) {
8840
8856
  const t = [];
@@ -8851,7 +8867,7 @@ class __PRIVATE_IndexedDbIndexManager {
8851
8867
  const r = [ ...e ], i = [];
8852
8868
  for (const e of n.arrayValue.values || []) for (const n of r) {
8853
8869
  const r = new __PRIVATE_IndexByteEncoder;
8854
- r.seed(n.Ht()), __PRIVATE_FirestoreIndexValueWriter.Ft.Et(e, r.Xt(t.kind)), i.push(r);
8870
+ r.seed(n.Ht()), __PRIVATE_FirestoreIndexValueWriter.Ft.dt(e, r.Xt(t.kind)), i.push(r);
8855
8871
  }
8856
8872
  return i;
8857
8873
  }
@@ -9016,7 +9032,7 @@ class __PRIVATE_IndexedDbIndexManager {
9016
9032
  return this.getFieldIndexes(e, t).next(__PRIVATE_getMinOffsetFromFieldIndexes);
9017
9033
  }
9018
9034
  getMinOffset(e, t) {
9019
- return PersistencePromise.mapArray(this.Tn(t), (t => this.In(e, t).next((e => e || fail())))).next(__PRIVATE_getMinOffsetFromFieldIndexes);
9035
+ return PersistencePromise.mapArray(this.In(t), (t => this.Tn(e, t).next((e => e || fail())))).next(__PRIVATE_getMinOffsetFromFieldIndexes);
9020
9036
  }
9021
9037
  }
9022
9038
 
@@ -9364,7 +9380,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9364
9380
  }
9365
9381
  removeMutationBatch(e, t) {
9366
9382
  return removeMutationBatch(e._e, this.userId, t).next((n => (e.addOnCommittedListener((() => {
9367
- this.Ln(t.batchId);
9383
+ this.Bn(t.batchId);
9368
9384
  })), PersistencePromise.forEach(n, (t => this.referenceDelegate.markPotentiallyOrphaned(e, t))))));
9369
9385
  }
9370
9386
  /**
@@ -9376,7 +9392,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9376
9392
  * rejected batch is removed from the mutation queue.
9377
9393
  */
9378
9394
  // PORTING NOTE: Multi-tab only
9379
- Ln(e) {
9395
+ Bn(e) {
9380
9396
  delete this.xn[e];
9381
9397
  }
9382
9398
  performConsistencyCheck(e) {
@@ -9409,7 +9425,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9409
9425
  }
9410
9426
  // PORTING NOTE: Multi-tab only (state is held in memory in other clients).
9411
9427
  /** Returns the mutation queue's metadata from IndexedDb. */
9412
- Bn(e) {
9428
+ Ln(e) {
9413
9429
  return __PRIVATE_mutationQueuesStore(e).get(this.userId).next((e => e || {
9414
9430
  userId: this.userId,
9415
9431
  lastAcknowledgedBatchId: -1,
@@ -10698,13 +10714,13 @@ class OverlayedDocument {
10698
10714
  * limitations under the License.
10699
10715
  */ class __PRIVATE_MemoryBundleCache {
10700
10716
  constructor(e) {
10701
- this.serializer = e, this.Tr = new Map, this.Ir = new Map;
10717
+ this.serializer = e, this.Ir = new Map, this.Tr = new Map;
10702
10718
  }
10703
10719
  getBundleMetadata(e, t) {
10704
- return PersistencePromise.resolve(this.Tr.get(t));
10720
+ return PersistencePromise.resolve(this.Ir.get(t));
10705
10721
  }
10706
10722
  saveBundleMetadata(e, t) {
10707
- return this.Tr.set(t.id,
10723
+ return this.Ir.set(t.id,
10708
10724
  /** Decodes a BundleMetadata proto into a BundleMetadata object. */
10709
10725
  function __PRIVATE_fromBundleMetadata(e) {
10710
10726
  return {
@@ -10715,10 +10731,10 @@ class OverlayedDocument {
10715
10731
  }(t)), PersistencePromise.resolve();
10716
10732
  }
10717
10733
  getNamedQuery(e, t) {
10718
- return PersistencePromise.resolve(this.Ir.get(t));
10734
+ return PersistencePromise.resolve(this.Tr.get(t));
10719
10735
  }
10720
10736
  saveNamedQuery(e, t) {
10721
- return this.Ir.set(t.name, function __PRIVATE_fromProtoNamedQuery(e) {
10737
+ return this.Tr.set(t.name, function __PRIVATE_fromProtoNamedQuery(e) {
10722
10738
  return {
10723
10739
  name: e.name,
10724
10740
  query: __PRIVATE_fromBundledQuery(e.bundledQuery),
@@ -10750,7 +10766,7 @@ class OverlayedDocument {
10750
10766
  constructor() {
10751
10767
  // A map sorted by DocumentKey, whose value is a pair of the largest batch id
10752
10768
  // for the overlay and the overlay itself.
10753
- this.overlays = new SortedMap(DocumentKey.comparator), this.Er = new Map;
10769
+ this.overlays = new SortedMap(DocumentKey.comparator), this.dr = new Map;
10754
10770
  }
10755
10771
  getOverlay(e, t) {
10756
10772
  return PersistencePromise.resolve(this.overlays.get(t));
@@ -10763,13 +10779,13 @@ class OverlayedDocument {
10763
10779
  }
10764
10780
  saveOverlays(e, t, n) {
10765
10781
  return n.forEach(((n, r) => {
10766
- this.Tt(e, t, r);
10782
+ this.It(e, t, r);
10767
10783
  })), PersistencePromise.resolve();
10768
10784
  }
10769
10785
  removeOverlaysForBatchId(e, t, n) {
10770
- const r = this.Er.get(n);
10786
+ const r = this.dr.get(n);
10771
10787
  return void 0 !== r && (r.forEach((e => this.overlays = this.overlays.remove(e))),
10772
- this.Er.delete(n)), PersistencePromise.resolve();
10788
+ this.dr.delete(n)), PersistencePromise.resolve();
10773
10789
  }
10774
10790
  getOverlaysForCollection(e, t, n) {
10775
10791
  const r = __PRIVATE_newOverlayMap(), i = t.length + 1, s = new DocumentKey(t.child("")), o = this.overlays.getIteratorFrom(s);
@@ -10798,17 +10814,17 @@ class OverlayedDocument {
10798
10814
  }
10799
10815
  return PersistencePromise.resolve(o);
10800
10816
  }
10801
- Tt(e, t, n) {
10817
+ It(e, t, n) {
10802
10818
  // Remove the association of the overlay to its batch id.
10803
10819
  const r = this.overlays.get(n.key);
10804
10820
  if (null !== r) {
10805
- const e = this.Er.get(r.largestBatchId).delete(n.key);
10806
- this.Er.set(r.largestBatchId, e);
10821
+ const e = this.dr.get(r.largestBatchId).delete(n.key);
10822
+ this.dr.set(r.largestBatchId, e);
10807
10823
  }
10808
10824
  this.overlays = this.overlays.insert(n.key, new Overlay(t, n));
10809
10825
  // Create the association of this overlay to the given largestBatchId.
10810
- let i = this.Er.get(t);
10811
- void 0 === i && (i = __PRIVATE_documentKeySet(), this.Er.set(t, i)), this.Er.set(t, i.add(n.key));
10826
+ let i = this.dr.get(t);
10827
+ void 0 === i && (i = __PRIVATE_documentKeySet(), this.dr.set(t, i)), this.dr.set(t, i.add(n.key));
10812
10828
  }
10813
10829
  }
10814
10830
 
@@ -10872,16 +10888,16 @@ class OverlayedDocument {
10872
10888
  */ class __PRIVATE_ReferenceSet {
10873
10889
  constructor() {
10874
10890
  // A set of outstanding references to a document sorted by key.
10875
- this.dr = new SortedSet(__PRIVATE_DocReference.Ar),
10891
+ this.Er = new SortedSet(__PRIVATE_DocReference.Ar),
10876
10892
  // A set of outstanding references to a document sorted by target id.
10877
10893
  this.Rr = new SortedSet(__PRIVATE_DocReference.Vr);
10878
10894
  }
10879
10895
  /** Returns true if the reference set contains no references. */ isEmpty() {
10880
- return this.dr.isEmpty();
10896
+ return this.Er.isEmpty();
10881
10897
  }
10882
10898
  /** Adds a reference to the given document key for the given ID. */ addReference(e, t) {
10883
10899
  const n = new __PRIVATE_DocReference(e, t);
10884
- this.dr = this.dr.add(n), this.Rr = this.Rr.add(n);
10900
+ this.Er = this.Er.add(n), this.Rr = this.Rr.add(n);
10885
10901
  }
10886
10902
  /** Add references to the given document keys for the given ID. */ mr(e, t) {
10887
10903
  e.forEach((e => this.addReference(e, t)));
@@ -10905,10 +10921,10 @@ class OverlayedDocument {
10905
10921
  })), i;
10906
10922
  }
10907
10923
  wr() {
10908
- this.dr.forEach((e => this.gr(e)));
10924
+ this.Er.forEach((e => this.gr(e)));
10909
10925
  }
10910
10926
  gr(e) {
10911
- this.dr = this.dr.delete(e), this.Rr = this.Rr.delete(e);
10927
+ this.Er = this.Er.delete(e), this.Rr = this.Rr.delete(e);
10912
10928
  }
10913
10929
  Sr(e) {
10914
10930
  const t = new DocumentKey(new ResourcePath([])), n = new __PRIVATE_DocReference(t, e), r = new __PRIVATE_DocReference(t, e + 1);
@@ -10918,7 +10934,7 @@ class OverlayedDocument {
10918
10934
  })), i;
10919
10935
  }
10920
10936
  containsKey(e) {
10921
- const t = new __PRIVATE_DocReference(e, 0), n = this.dr.firstAfterOrEqual(t);
10937
+ const t = new __PRIVATE_DocReference(e, 0), n = this.Er.firstAfterOrEqual(t);
10922
10938
  return null !== n && e.isEqual(n.key);
10923
10939
  }
10924
10940
  }
@@ -11051,7 +11067,7 @@ class __PRIVATE_DocReference {
11051
11067
  this.vr = n;
11052
11068
  }));
11053
11069
  }
11054
- Ln(e) {
11070
+ Bn(e) {
11055
11071
  // No-op since the memory mutation queue does not maintain a separate cache.
11056
11072
  }
11057
11073
  containsKey(e, t) {
@@ -11115,6 +11131,9 @@ class __PRIVATE_DocReference {
11115
11131
  * See the License for the specific language governing permissions and
11116
11132
  * limitations under the License.
11117
11133
  */
11134
+ /**
11135
+ * The smallest value representable by a 64-bit signed integer (long).
11136
+ */
11118
11137
  /**
11119
11138
  * The memory-only RemoteDocumentCache for IndexedDb. To construct, invoke
11120
11139
  * `newMemoryRemoteDocumentCache()`.
@@ -11173,8 +11192,11 @@ class __PRIVATE_MemoryRemoteDocumentCacheImpl {
11173
11192
  let i = __PRIVATE_mutableDocumentMap();
11174
11193
  // Documents are ordered by key, so we can use a prefix scan to narrow down
11175
11194
  // the documents we need to match the query against.
11176
- const s = t.path, o = new DocumentKey(s.child("")), _ = this.docs.getIteratorFrom(o);
11177
- for (;_.hasNext(); ) {
11195
+ const s = t.path, o = new DocumentKey(s.child("__id-9223372036854775808__")), _ = this.docs.getIteratorFrom(o);
11196
+ // Document keys are ordered first by numeric value ("__id<Long>__"),
11197
+ // then lexicographically by string value. Start the iterator at the minimum
11198
+ // possible Document key value.
11199
+ for (;_.hasNext(); ) {
11178
11200
  const {key: e, value: {document: o}} = _.getNext();
11179
11201
  if (!s.isPrefixOf(e.path)) break;
11180
11202
  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())));
@@ -11186,7 +11208,7 @@ class __PRIVATE_MemoryRemoteDocumentCacheImpl {
11186
11208
  // is enabled.
11187
11209
  fail();
11188
11210
  }
11189
- Lr(e, t) {
11211
+ Br(e, t) {
11190
11212
  return PersistencePromise.forEach(this.docs, (e => t(e)));
11191
11213
  }
11192
11214
  newChangeBuffer(e) {
@@ -11248,7 +11270,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11248
11270
  /**
11249
11271
  * Maps a target to the data about that target
11250
11272
  */
11251
- this.Br = new ObjectMap((e => __PRIVATE_canonifyTarget(e)), __PRIVATE_targetEquals),
11273
+ this.Lr = new ObjectMap((e => __PRIVATE_canonifyTarget(e)), __PRIVATE_targetEquals),
11252
11274
  /** The last received snapshot version. */
11253
11275
  this.lastRemoteSnapshotVersion = SnapshotVersion.min(),
11254
11276
  /** The highest numbered target ID encountered. */
@@ -11262,7 +11284,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11262
11284
  this.qr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Qr = __PRIVATE_TargetIdGenerator.qn();
11263
11285
  }
11264
11286
  forEachTarget(e, t) {
11265
- return this.Br.forEach(((e, n) => t(n))), PersistencePromise.resolve();
11287
+ return this.Lr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
11266
11288
  }
11267
11289
  getLastRemoteSnapshotVersion(e) {
11268
11290
  return PersistencePromise.resolve(this.lastRemoteSnapshotVersion);
@@ -11278,7 +11300,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11278
11300
  PersistencePromise.resolve();
11279
11301
  }
11280
11302
  Un(e) {
11281
- this.Br.set(e.target, e);
11303
+ this.Lr.set(e.target, e);
11282
11304
  const t = e.targetId;
11283
11305
  t > this.highestTargetId && (this.Qr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11284
11306
  e.sequenceNumber > this.kr && (this.kr = e.sequenceNumber);
@@ -11290,14 +11312,14 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11290
11312
  return this.Un(t), PersistencePromise.resolve();
11291
11313
  }
11292
11314
  removeTargetData(e, t) {
11293
- return this.Br.delete(t.target), this.qr.yr(t.targetId), this.targetCount -= 1,
11315
+ return this.Lr.delete(t.target), this.qr.yr(t.targetId), this.targetCount -= 1,
11294
11316
  PersistencePromise.resolve();
11295
11317
  }
11296
11318
  removeTargets(e, t, n) {
11297
11319
  let r = 0;
11298
11320
  const i = [];
11299
- return this.Br.forEach(((s, o) => {
11300
- o.sequenceNumber <= t && null === n.get(o.targetId) && (this.Br.delete(s), i.push(this.removeMatchingKeysForTargetId(e, o.targetId)),
11321
+ return this.Lr.forEach(((s, o) => {
11322
+ o.sequenceNumber <= t && null === n.get(o.targetId) && (this.Lr.delete(s), i.push(this.removeMatchingKeysForTargetId(e, o.targetId)),
11301
11323
  r++);
11302
11324
  })), PersistencePromise.waitFor(i).next((() => r));
11303
11325
  }
@@ -11305,7 +11327,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11305
11327
  return PersistencePromise.resolve(this.targetCount);
11306
11328
  }
11307
11329
  getTargetData(e, t) {
11308
- const n = this.Br.get(t) || null;
11330
+ const n = this.Lr.get(t) || null;
11309
11331
  return PersistencePromise.resolve(n);
11310
11332
  }
11311
11333
  addMatchingKeys(e, t, n) {
@@ -11523,7 +11545,7 @@ class __PRIVATE_MemoryLruDelegate {
11523
11545
  removeOrphanedDocuments(e, t) {
11524
11546
  let n = 0;
11525
11547
  const r = this.persistence.getRemoteDocumentCache(), i = r.newChangeBuffer();
11526
- return r.Lr(e, (r => this.ir(e, r, t).next((e => {
11548
+ return r.Br(e, (r => this.ir(e, r, t).next((e => {
11527
11549
  e || (n++, i.removeEntry(r, SnapshotVersion.min()));
11528
11550
  })))).next((() => i.apply(e))).next((() => n));
11529
11551
  }
@@ -11687,9 +11709,9 @@ class __PRIVATE_MemoryLruDelegate {
11687
11709
  }(e);
11688
11710
  }))), n < 13 && r >= 13 && (s = s.next((() => function __PRIVATE_createRemoteDocumentCache(e) {
11689
11711
  const t = e.createObjectStore("remoteDocumentsV14", {
11690
- keyPath: L
11712
+ keyPath: B
11691
11713
  });
11692
- t.createIndex("documentKeyIndex", B), t.createIndex("collectionGroupIndex", k);
11714
+ t.createIndex("documentKeyIndex", L), t.createIndex("collectionGroupIndex", k);
11693
11715
  }(e))).next((() => this.ui(e, i))).next((() => e.deleteObjectStore("remoteDocuments")))),
11694
11716
  n < 14 && r >= 14 && (s = s.next((() => this.ci(e, i)))), n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11695
11717
  e.createObjectStore("indexConfiguration", {
@@ -11928,20 +11950,20 @@ class __PRIVATE_IndexedDbPersistence {
11928
11950
  */
11929
11951
  u, c = 17) {
11930
11952
  if (this.allowTabSynchronization = e, this.persistenceKey = t, this.clientId = n,
11931
- this.li = i, this.window = s, this.document = o, this.hi = a, this.Pi = u, this.Ti = c,
11953
+ this.li = i, this.window = s, this.document = o, this.hi = a, this.Pi = u, this.Ii = c,
11932
11954
  this.$r = null, this.Ur = !1, this.isPrimary = !1, this.networkEnabled = !0,
11933
11955
  /** Our window.unload handler, if registered. */
11934
- this.Ii = null, this.inForeground = !1,
11956
+ this.Ti = null, this.inForeground = !1,
11935
11957
  /** Our 'visibilitychange' listener if registered. */
11936
- this.Ei = null,
11937
- /** The client metadata refresh task. */
11938
11958
  this.di = null,
11959
+ /** The client metadata refresh task. */
11960
+ this.Ei = null,
11939
11961
  /** The last time we garbage collected the client metadata object store. */
11940
11962
  this.Ai = Number.NEGATIVE_INFINITY,
11941
11963
  /** A listener to notify on primary state changes. */
11942
11964
  this.Ri = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.p()) throw new FirestoreError(C.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
11943
11965
  this.referenceDelegate = new __PRIVATE_IndexedDbLruDelegateImpl(this, r), this.Vi = t + "main",
11944
- this.serializer = new __PRIVATE_LocalSerializer(_), this.mi = new __PRIVATE_SimpleDb(this.Vi, this.Ti, new __PRIVATE_SchemaConverter(this.serializer)),
11966
+ this.serializer = new __PRIVATE_LocalSerializer(_), this.mi = new __PRIVATE_SimpleDb(this.Vi, this.Ii, new __PRIVATE_SchemaConverter(this.serializer)),
11945
11967
  this.Wr = new __PRIVATE_IndexedDbGlobalsCache, this.Gr = new __PRIVATE_IndexedDbTargetCache(this.referenceDelegate, this.serializer),
11946
11968
  this.remoteDocumentCache = __PRIVATE_newIndexedDbRemoteDocumentCache(this.serializer),
11947
11969
  this.jr = new __PRIVATE_IndexedDbBundleCache, this.window && this.window.localStorage ? this.fi = this.window.localStorage : (this.fi = null,
@@ -11984,7 +12006,7 @@ class __PRIVATE_IndexedDbPersistence {
11984
12006
  *
11985
12007
  * PORTING NOTE: This is only used for Web multi-tab.
11986
12008
  */ setDatabaseDeletedListener(e) {
11987
- this.mi.L((async t => {
12009
+ this.mi.B((async t => {
11988
12010
  // Check if an attempt is made to delete IndexedDB.
11989
12011
  null === t.newVersion && await e();
11990
12012
  }));
@@ -12056,14 +12078,14 @@ class __PRIVATE_IndexedDbPersistence {
12056
12078
  // Ideally we'd delete the IndexedDb and LocalStorage zombie entries for
12057
12079
  // the client atomically, but we can't. So we opt to delete the IndexedDb
12058
12080
  // entries first to avoid potentially reviving a zombied client.
12059
- if (this.fi) for (const t of e) this.fi.removeItem(this.Li(t.clientId));
12081
+ if (this.fi) for (const t of e) this.fi.removeItem(this.Bi(t.clientId));
12060
12082
  }
12061
12083
  }
12062
12084
  /**
12063
12085
  * Schedules a recurring timer to update the client metadata and to either
12064
12086
  * extend or acquire the primary lease if the client is eligible.
12065
12087
  */ wi() {
12066
- this.di = this.li.enqueueAfterDelay("client_metadata_refresh" /* TimerId.ClientMetadataRefresh */ , 4e3, (() => this.gi().then((() => this.xi())).then((() => this.wi()))));
12088
+ this.Ei = this.li.enqueueAfterDelay("client_metadata_refresh" /* TimerId.ClientMetadataRefresh */ , 4e3, (() => this.gi().then((() => this.xi())).then((() => this.wi()))));
12067
12089
  }
12068
12090
  /** Checks whether `client` is the local client. */ Fi(e) {
12069
12091
  return !!e && e.ownerId === this.clientId;
@@ -12086,7 +12108,7 @@ class __PRIVATE_IndexedDbPersistence {
12086
12108
  // - every clients network is disabled and no other client's tab is in
12087
12109
  // the foreground.
12088
12110
  // - the `forceOwningTab` setting was passed in.
12089
- if (null !== t && this.Oi(t.leaseTimestampMs, 5e3) && !this.Bi(t.ownerId)) {
12111
+ if (null !== t && this.Oi(t.leaseTimestampMs, 5e3) && !this.Li(t.ownerId)) {
12090
12112
  if (this.Fi(t) && this.networkEnabled) return !0;
12091
12113
  if (!this.Fi(t)) {
12092
12114
  if (!t.allowTabSynchronization)
@@ -12118,7 +12140,7 @@ class __PRIVATE_IndexedDbPersistence {
12118
12140
  async shutdown() {
12119
12141
  // The shutdown() operations are idempotent and can be called even when
12120
12142
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12121
- this.Ur = !1, this.ki(), this.di && (this.di.cancel(), this.di = null), this.qi(),
12143
+ this.Ur = !1, this.ki(), this.Ei && (this.Ei.cancel(), this.Ei = null), this.qi(),
12122
12144
  this.Qi(),
12123
12145
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12124
12146
  // has obtained the primary lease.
@@ -12134,7 +12156,7 @@ class __PRIVATE_IndexedDbPersistence {
12134
12156
  * Returns clients that are not zombied and have an updateTime within the
12135
12157
  * provided threshold.
12136
12158
  */ Ni(e, t) {
12137
- return e.filter((e => this.Oi(e.updateTimeMs, t) && !this.Bi(e.clientId)));
12159
+ return e.filter((e => this.Oi(e.updateTimeMs, t) && !this.Li(e.clientId)));
12138
12160
  }
12139
12161
  /**
12140
12162
  * Returns the IDs of the clients that are currently active. If multi-tab
@@ -12175,7 +12197,7 @@ class __PRIVATE_IndexedDbPersistence {
12175
12197
  /** Returns the object stores for the provided schema. */
12176
12198
  function __PRIVATE_getObjectStores(e) {
12177
12199
  return 17 === e ? re : 16 === e ? ne : 15 === e ? te : 14 === e ? ee : 13 === e ? X : 12 === e ? Z : 11 === e ? Y : void fail();
12178
- }(this.Ti);
12200
+ }(this.Ii);
12179
12201
  let s;
12180
12202
  // Do all transactions as readwrite against all object stores, since we
12181
12203
  // are the only reader/writer.
@@ -12195,7 +12217,7 @@ class __PRIVATE_IndexedDbPersistence {
12195
12217
  // be turned off.
12196
12218
  Ui(e) {
12197
12219
  return __PRIVATE_primaryClientStore(e).get("owner").next((e => {
12198
- if (null !== e && this.Oi(e.leaseTimestampMs, 5e3) && !this.Bi(e.ownerId) && !this.Fi(e) && !(this.Pi || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(C.FAILED_PRECONDITION, fe);
12220
+ if (null !== e && this.Oi(e.leaseTimestampMs, 5e3) && !this.Li(e.ownerId) && !this.Fi(e) && !(this.Pi || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(C.FAILED_PRECONDITION, fe);
12199
12221
  }));
12200
12222
  }
12201
12223
  /**
@@ -12223,13 +12245,13 @@ class __PRIVATE_IndexedDbPersistence {
12223
12245
  !1));
12224
12246
  }
12225
12247
  pi() {
12226
- null !== this.document && "function" == typeof this.document.addEventListener && (this.Ei = () => {
12248
+ null !== this.document && "function" == typeof this.document.addEventListener && (this.di = () => {
12227
12249
  this.li.enqueueAndForget((() => (this.inForeground = "visible" === this.document.visibilityState,
12228
12250
  this.gi())));
12229
- }, this.document.addEventListener("visibilitychange", this.Ei), this.inForeground = "visible" === this.document.visibilityState);
12251
+ }, this.document.addEventListener("visibilitychange", this.di), this.inForeground = "visible" === this.document.visibilityState);
12230
12252
  }
12231
12253
  qi() {
12232
- this.Ei && (this.document.removeEventListener("visibilitychange", this.Ei), this.Ei = null);
12254
+ this.di && (this.document.removeEventListener("visibilitychange", this.di), this.di = null);
12233
12255
  }
12234
12256
  /**
12235
12257
  * Attaches a window.unload handler that will synchronously write our
@@ -12242,7 +12264,7 @@ class __PRIVATE_IndexedDbPersistence {
12242
12264
  * handler.
12243
12265
  */ yi() {
12244
12266
  var e;
12245
- "function" == typeof (null === (e = this.window) || void 0 === e ? void 0 : e.addEventListener) && (this.Ii = () => {
12267
+ "function" == typeof (null === (e = this.window) || void 0 === e ? void 0 : e.addEventListener) && (this.Ti = () => {
12246
12268
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12247
12269
  // accesses internal state. We execute this code directly during shutdown
12248
12270
  // to make sure it gets a chance to run.
@@ -12254,19 +12276,19 @@ class __PRIVATE_IndexedDbPersistence {
12254
12276
  // the next page load.
12255
12277
  // See https://bugs.webkit.org/show_bug.cgi?id=226547
12256
12278
  this.li.enterRestrictedMode(/* purgeExistingTasks= */ !0), this.li.enqueueAndForget((() => this.shutdown()));
12257
- }, this.window.addEventListener("pagehide", this.Ii));
12279
+ }, this.window.addEventListener("pagehide", this.Ti));
12258
12280
  }
12259
12281
  Qi() {
12260
- this.Ii && (this.window.removeEventListener("pagehide", this.Ii), this.Ii = null);
12282
+ this.Ti && (this.window.removeEventListener("pagehide", this.Ti), this.Ti = null);
12261
12283
  }
12262
12284
  /**
12263
12285
  * Returns whether a client is "zombied" based on its LocalStorage entry.
12264
12286
  * Clients become zombied when their tab closes without running all of the
12265
12287
  * cleanup logic in `shutdown()`.
12266
- */ Bi(e) {
12288
+ */ Li(e) {
12267
12289
  var t;
12268
12290
  try {
12269
- const n = null !== (null === (t = this.fi) || void 0 === t ? void 0 : t.getItem(this.Li(e)));
12291
+ const n = null !== (null === (t = this.fi) || void 0 === t ? void 0 : t.getItem(this.Bi(e)));
12270
12292
  return __PRIVATE_logDebug("IndexedDbPersistence", `Client '${e}' ${n ? "is" : "is not"} zombied in LocalStorage`),
12271
12293
  n;
12272
12294
  } catch (e) {
@@ -12280,7 +12302,7 @@ class __PRIVATE_IndexedDbPersistence {
12280
12302
  * clients are ignored during primary tab selection.
12281
12303
  */ ki() {
12282
12304
  if (this.fi) try {
12283
- this.fi.setItem(this.Li(this.clientId), String(Date.now()));
12305
+ this.fi.setItem(this.Bi(this.clientId), String(Date.now()));
12284
12306
  } catch (e) {
12285
12307
  // Gracefully handle if LocalStorage isn't available / working.
12286
12308
  __PRIVATE_logError("Failed to set zombie client id.", e);
@@ -12288,12 +12310,12 @@ class __PRIVATE_IndexedDbPersistence {
12288
12310
  }
12289
12311
  /** Removes the zombied client entry if it exists. */ Ki() {
12290
12312
  if (this.fi) try {
12291
- this.fi.removeItem(this.Li(this.clientId));
12313
+ this.fi.removeItem(this.Bi(this.clientId));
12292
12314
  } catch (e) {
12293
12315
  // Ignore
12294
12316
  }
12295
12317
  }
12296
- Li(e) {
12318
+ Bi(e) {
12297
12319
  return `firestore_zombie_${this.persistenceKey}_${e}`;
12298
12320
  }
12299
12321
  }
@@ -12691,7 +12713,7 @@ async function __PRIVATE_localStoreHandleUserChange(e, t) {
12691
12713
  // Return the set of all (potentially) changed documents and the list
12692
12714
  // of mutation batch IDs that were affected by change.
12693
12715
  return n.localDocuments.getDocuments(e, o).next((e => ({
12694
- Ts: e,
12716
+ Is: e,
12695
12717
  removedBatchIds: i,
12696
12718
  addedBatchIds: s
12697
12719
  })));
@@ -12833,7 +12855,7 @@ function __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e) {
12833
12855
  // Each loop iteration only affects its "own" doc, so it's safe to get all
12834
12856
  // the remote documents in advance in a single call.
12835
12857
  o.push(__PRIVATE_populateDocumentChangeBuffer(e, s, t.documentUpdates).next((e => {
12836
- _ = e.Is, a = e.Es;
12858
+ _ = e.Ts, a = e.ds;
12837
12859
  }))), !r.isEqual(SnapshotVersion.min())) {
12838
12860
  const t = n.Gr.getLastRemoteSnapshotVersion(e).next((t => n.Gr.setTargetsMetadata(e, e.currentSequenceNumber, r)));
12839
12861
  o.push(t);
@@ -12870,8 +12892,8 @@ function __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e) {
12870
12892
  t.removeEntry(n, s.readTime), r = r.insert(n, s)) : !o.isValidDocument() || s.version.compareTo(o.version) > 0 || 0 === s.version.compareTo(o.version) && o.hasPendingWrites ? (t.addEntry(s),
12871
12893
  r = r.insert(n, s)) : __PRIVATE_logDebug("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", o.version, " Watch version:", s.version);
12872
12894
  })), {
12873
- Is: r,
12874
- Es: i
12895
+ Ts: r,
12896
+ ds: i
12875
12897
  };
12876
12898
  }));
12877
12899
  }
@@ -12970,7 +12992,7 @@ async function __PRIVATE_localStoreReleaseTarget(e, t, n) {
12970
12992
  })).next((() => r._s.getDocumentsMatchingQuery(e, t, n ? i : SnapshotVersion.min(), n ? s : __PRIVATE_documentKeySet()))).next((e => (__PRIVATE_setMaxReadTime(r, __PRIVATE_queryCollectionGroup(t), e),
12971
12993
  {
12972
12994
  documents: e,
12973
- ds: s
12995
+ Es: s
12974
12996
  })))));
12975
12997
  }
12976
12998
 
@@ -13039,7 +13061,7 @@ async function __PRIVATE_localStoreApplyBundledDocuments(e, t, n, r) {
13039
13061
  // Allocates a target to hold all document keys from the bundle, such that
13040
13062
  // they will not get garbage collected right away.
13041
13063
  return i.persistence.runTransaction("Apply bundle documents", "readwrite", (e => __PRIVATE_populateDocumentChangeBuffer(e, _, o).next((t => (_.apply(e),
13042
- 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))))));
13064
+ t))).next((t => i.Gr.removeMatchingKeysForTargetId(e, a.targetId).next((() => i.Gr.addMatchingKeys(e, s, a.targetId))).next((() => i.localDocuments.getLocalViewOfDocuments(e, t.Ts, t.ds))).next((() => t.Ts))))));
13043
13065
  }
13044
13066
 
13045
13067
  /**
@@ -13278,7 +13300,7 @@ class __PRIVATE_LocalClientState {
13278
13300
  // format of the key is:
13279
13301
  // firestore_bundle_loaded_v2_<persistenceKey>
13280
13302
  // The version ending with "v2" stores the list of modified collection groups.
13281
- (this.persistenceKey), this.Ls = function createBundleLoadedKey(e) {
13303
+ (this.persistenceKey), this.Bs = function createBundleLoadedKey(e) {
13282
13304
  return `firestore_bundle_loaded_v2_${e}`;
13283
13305
  }
13284
13306
  // The WebStorage key prefix for the key that stores the last sequence number allocated. The key
@@ -13307,7 +13329,7 @@ class __PRIVATE_LocalClientState {
13307
13329
  n && (this.Ds = this.Ds.insert(n.clientId, n));
13308
13330
  }
13309
13331
  }
13310
- this.Bs();
13332
+ this.Ls();
13311
13333
  // Check if there is an existing online state and call the callback handler
13312
13334
  // if applicable.
13313
13335
  const t = this.storage.getItem(this.Ns);
@@ -13356,10 +13378,10 @@ class __PRIVATE_LocalClientState {
13356
13378
  }
13357
13379
  // If the query is listening to cache only, the target ID should not be registered with the
13358
13380
  // local Firestore client as an active watch target.
13359
- return t && this.Us.ps(e), this.Bs(), n;
13381
+ return t && this.Us.ps(e), this.Ls(), n;
13360
13382
  }
13361
13383
  removeLocalQueryTarget(e) {
13362
- this.Us.ys(e), this.Bs();
13384
+ this.Us.ys(e), this.Ls();
13363
13385
  }
13364
13386
  isLocalQueryTarget(e) {
13365
13387
  return this.Us.activeTargetIds.has(e);
@@ -13446,7 +13468,7 @@ class __PRIVATE_LocalClientState {
13446
13468
  * isolated and no synchronization is performed.
13447
13469
  */ (t.newValue);
13448
13470
  e !== __PRIVATE_ListenSequence.oe && this.sequenceNumberHandler(e);
13449
- } else if (t.key === this.Ls) {
13471
+ } else if (t.key === this.Bs) {
13450
13472
  const e = this.no(t.newValue);
13451
13473
  await Promise.all(e.map((e => this.syncEngine.ro(e))));
13452
13474
  }
@@ -13457,7 +13479,7 @@ class __PRIVATE_LocalClientState {
13457
13479
  get Us() {
13458
13480
  return this.Ds.get(this.ws);
13459
13481
  }
13460
- Bs() {
13482
+ Ls() {
13461
13483
  this.setItem(this.Cs, this.Us.gs());
13462
13484
  }
13463
13485
  Ks(e, t, n) {
@@ -13481,7 +13503,7 @@ class __PRIVATE_LocalClientState {
13481
13503
  }
13482
13504
  zs(e) {
13483
13505
  const t = JSON.stringify(Array.from(e));
13484
- this.setItem(this.Ls, t);
13506
+ this.setItem(this.Bs, t);
13485
13507
  }
13486
13508
  /**
13487
13509
  * Parses a client state key in WebStorage. Returns null if the key does not
@@ -13648,24 +13670,24 @@ class __PRIVATE_MemorySharedClientState {
13648
13670
  */
13649
13671
  class __PRIVATE_BrowserConnectivityMonitor {
13650
13672
  constructor() {
13651
- this.co = () => this.lo(), this.ho = () => this.Po(), this.To = [], this.Io();
13673
+ this.co = () => this.lo(), this.ho = () => this.Po(), this.Io = [], this.To();
13652
13674
  }
13653
13675
  uo(e) {
13654
- this.To.push(e);
13676
+ this.Io.push(e);
13655
13677
  }
13656
13678
  shutdown() {
13657
13679
  window.removeEventListener("online", this.co), window.removeEventListener("offline", this.ho);
13658
13680
  }
13659
- Io() {
13681
+ To() {
13660
13682
  window.addEventListener("online", this.co), window.addEventListener("offline", this.ho);
13661
13683
  }
13662
13684
  lo() {
13663
13685
  __PRIVATE_logDebug("ConnectivityMonitor", "Network connectivity changed: AVAILABLE");
13664
- for (const e of this.To) e(0 /* NetworkStatus.AVAILABLE */);
13686
+ for (const e of this.Io) e(0 /* NetworkStatus.AVAILABLE */);
13665
13687
  }
13666
13688
  Po() {
13667
13689
  __PRIVATE_logDebug("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE");
13668
- for (const e of this.To) e(1 /* NetworkStatus.UNAVAILABLE */);
13690
+ for (const e of this.Io) e(1 /* NetworkStatus.UNAVAILABLE */);
13669
13691
  }
13670
13692
  // TODO(chenbrian): Consider passing in window either into this component or
13671
13693
  // here for testing via FakeWindow.
@@ -13848,7 +13870,7 @@ class __PRIVATE_RestConnection {
13848
13870
  "google-cloud-resource-prefix": this.Mo,
13849
13871
  "x-goog-request-params": this.xo
13850
13872
  };
13851
- return this.Lo(_, r, i), this.Bo(e, o, _, n).then((t => (__PRIVATE_logDebug("RestConnection", `Received RPC '${e}' ${s}: `, t),
13873
+ return this.Bo(_, r, i), this.Lo(e, o, _, n).then((t => (__PRIVATE_logDebug("RestConnection", `Received RPC '${e}' ${s}: `, t),
13852
13874
  t)), (t => {
13853
13875
  throw __PRIVATE_logWarn("RestConnection", `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13854
13876
  t;
@@ -13862,7 +13884,7 @@ class __PRIVATE_RestConnection {
13862
13884
  /**
13863
13885
  * Modifies the headers for a request, adding any authorization token if
13864
13886
  * present and any additional headers for the request.
13865
- */ Lo(e, t, n) {
13887
+ */ Bo(e, t, n) {
13866
13888
  e["X-Goog-Api-Client"] =
13867
13889
  // SDK_VERSION is updated to different value at runtime depending on the entry point,
13868
13890
  // so we need to get its value when we need it in a function.
@@ -13892,7 +13914,7 @@ class __PRIVATE_RestConnection {
13892
13914
  super(e), this.forceLongPolling = e.forceLongPolling, this.autoDetectLongPolling = e.autoDetectLongPolling,
13893
13915
  this.useFetchStreams = e.useFetchStreams, this.longPollingOptions = e.longPollingOptions;
13894
13916
  }
13895
- Bo(e, t, n, r) {
13917
+ Lo(e, t, n, r) {
13896
13918
  const i = __PRIVATE_generateUniqueDebugId();
13897
13919
  return new Promise(((s, o) => {
13898
13920
  const _ = new V;
@@ -13966,7 +13988,7 @@ class __PRIVATE_RestConnection {
13966
13988
  detectBufferingProxy: this.autoDetectLongPolling
13967
13989
  }, a = this.longPollingOptions.timeoutSeconds;
13968
13990
  void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.useFetchStreams = !0),
13969
- this.Lo(_.initMessageHeaders, t, n),
13991
+ this.Bo(_.initMessageHeaders, t, n),
13970
13992
  // Sending the custom headers we just added to request.initMessageHeaders
13971
13993
  // (Authorization, etc.) will trigger the browser to make a CORS preflight
13972
13994
  // request because the XHR will no longer meet the criteria for a "simple"
@@ -14408,7 +14430,7 @@ class __PRIVATE_PersistentStream {
14408
14430
  */ P_() {}
14409
14431
  auth() {
14410
14432
  this.state = 1 /* PersistentStreamState.Starting */;
14411
- const e = this.T_(this.Xo), t = this.Xo;
14433
+ const e = this.I_(this.Xo), t = this.Xo;
14412
14434
  // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.
14413
14435
  Promise.all([ this.authCredentialsProvider.getToken(), this.appCheckCredentialsProvider.getToken() ]).then((([e, n]) => {
14414
14436
  // Stream can be stopped while waiting for authentication.
@@ -14419,23 +14441,23 @@ class __PRIVATE_PersistentStream {
14419
14441
  // Normally we'd have to schedule the callback on the AsyncQueue.
14420
14442
  // However, the following calls are safe to be called outside the
14421
14443
  // AsyncQueue since they don't chain asynchronous calls
14422
- this.I_(e, n);
14444
+ this.T_(e, n);
14423
14445
  }), (t => {
14424
14446
  e((() => {
14425
14447
  const e = new FirestoreError(C.UNKNOWN, "Fetching auth token failed: " + t.message);
14426
- return this.E_(e);
14448
+ return this.d_(e);
14427
14449
  }));
14428
14450
  }));
14429
14451
  }
14430
- I_(e, t) {
14431
- const n = this.T_(this.Xo);
14432
- this.stream = this.d_(e, t), this.stream.Ro((() => {
14452
+ T_(e, t) {
14453
+ const n = this.I_(this.Xo);
14454
+ this.stream = this.E_(e, t), this.stream.Ro((() => {
14433
14455
  n((() => this.listener.Ro()));
14434
14456
  })), this.stream.mo((() => {
14435
14457
  n((() => (this.state = 2 /* PersistentStreamState.Open */ , this.t_ = this.li.enqueueAfterDelay(this.Zo, 1e4, (() => (this.s_() && (this.state = 3 /* PersistentStreamState.Healthy */),
14436
14458
  Promise.resolve()))), this.listener.mo())));
14437
14459
  })), this.stream.po((e => {
14438
- n((() => this.E_(e)));
14460
+ n((() => this.d_(e)));
14439
14461
  })), this.stream.onMessage((e => {
14440
14462
  n((() => 1 == ++this.n_ ? this.A_(e) : this.onNext(e)));
14441
14463
  }));
@@ -14446,7 +14468,7 @@ class __PRIVATE_PersistentStream {
14446
14468
  }));
14447
14469
  }
14448
14470
  // Visible for tests
14449
- E_(e) {
14471
+ d_(e) {
14450
14472
  // In theory the stream could close cleanly, however, in our current model
14451
14473
  // we never expect this to happen because if we stop a stream ourselves,
14452
14474
  // this callback will never be called. To prevent cases where we retry
@@ -14459,7 +14481,7 @@ class __PRIVATE_PersistentStream {
14459
14481
  * AsyncQueue but only runs them if closeCount remains unchanged. This allows
14460
14482
  * us to turn auth / stream callbacks into no-ops if the stream is closed /
14461
14483
  * re-opened, etc.
14462
- */ T_(e) {
14484
+ */ I_(e) {
14463
14485
  return t => {
14464
14486
  this.li.enqueueAndForget((() => this.Xo === e ? t() : (__PRIVATE_logDebug("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."),
14465
14487
  Promise.resolve())));
@@ -14478,7 +14500,7 @@ class __PRIVATE_PersistentStream {
14478
14500
  super(e, "listen_stream_connection_backoff" /* TimerId.ListenStreamConnectionBackoff */ , "listen_stream_idle" /* TimerId.ListenStreamIdle */ , "health_check_timeout" /* TimerId.HealthCheckTimeout */ , t, n, r, s),
14479
14501
  this.serializer = i;
14480
14502
  }
14481
- d_(e, t) {
14503
+ E_(e, t) {
14482
14504
  return this.connection.qo("Listen", e, t);
14483
14505
  }
14484
14506
  A_(e) {
@@ -14572,7 +14594,7 @@ class __PRIVATE_PersistentStream {
14572
14594
  P_() {
14573
14595
  this.f_ && this.g_([]);
14574
14596
  }
14575
- d_(e, t) {
14597
+ E_(e, t) {
14576
14598
  return this.connection.qo("Write", e, t);
14577
14599
  }
14578
14600
  A_(e) {
@@ -14783,7 +14805,7 @@ class __PRIVATE_OnlineStateTracker {
14783
14805
  * purely based on order, and so we can just shift() writes from the front of
14784
14806
  * the writePipeline as we receive responses.
14785
14807
  */
14786
- this.L_ = [],
14808
+ this.B_ = [],
14787
14809
  /**
14788
14810
  * A mapping of watched targets that the client cares about tracking and the
14789
14811
  * user has explicitly called a 'listen' for this target.
@@ -14793,7 +14815,7 @@ class __PRIVATE_OnlineStateTracker {
14793
14815
  * to the server. The targets removed with unlistens are removed eagerly
14794
14816
  * without waiting for confirmation from the listen stream.
14795
14817
  */
14796
- this.B_ = new Map,
14818
+ this.L_ = new Map,
14797
14819
  /**
14798
14820
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14799
14821
  * RemoteStore may start its network connections.
@@ -14840,9 +14862,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14840
14862
  */
14841
14863
  function __PRIVATE_remoteStoreListen(e, t) {
14842
14864
  const n = __PRIVATE_debugCast(e);
14843
- n.B_.has(t.targetId) || (
14865
+ n.L_.has(t.targetId) || (
14844
14866
  // Mark this as something the client is currently listening for.
14845
- n.B_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14867
+ n.L_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14846
14868
  // The listen will be sent in onWatchStreamOpen
14847
14869
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).s_() && __PRIVATE_sendWatchRequest(n, t));
14848
14870
  }
@@ -14852,7 +14874,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14852
14874
  * not being listened to.
14853
14875
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14854
14876
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14855
- n.B_.delete(t), r.s_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.B_.size && (r.s_() ? r.a_() : __PRIVATE_canUseNetwork(n) &&
14877
+ n.L_.delete(t), r.s_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.L_.size && (r.s_() ? r.a_() : __PRIVATE_canUseNetwork(n) &&
14856
14878
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14857
14879
  // have no listeners, since without any listens to send we cannot
14858
14880
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -14881,7 +14903,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14881
14903
  function __PRIVATE_startWatchStream(e) {
14882
14904
  e.U_ = new __PRIVATE_WatchChangeAggregator({
14883
14905
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14884
- ut: t => e.B_.get(t) || null,
14906
+ ut: t => e.L_.get(t) || null,
14885
14907
  nt: () => e.datastore.serializer.databaseId
14886
14908
  }), __PRIVATE_ensureWatchStream(e).start(), e.K_.F_();
14887
14909
  }
@@ -14890,7 +14912,7 @@ function __PRIVATE_startWatchStream(e) {
14890
14912
  * Returns whether the watch stream should be started because it's necessary
14891
14913
  * and has not yet been started.
14892
14914
  */ function __PRIVATE_shouldStartWatchStream(e) {
14893
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).i_() && e.B_.size > 0;
14915
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).i_() && e.L_.size > 0;
14894
14916
  }
14895
14917
 
14896
14918
  function __PRIVATE_canUseNetwork(e) {
@@ -14907,7 +14929,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
14907
14929
  }
14908
14930
 
14909
14931
  async function __PRIVATE_onWatchStreamOpen(e) {
14910
- e.B_.forEach(((t, n) => {
14932
+ e.L_.forEach(((t, n) => {
14911
14933
  __PRIVATE_sendWatchRequest(e, t);
14912
14934
  }));
14913
14935
  }
@@ -14935,7 +14957,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14935
14957
  const n = t.cause;
14936
14958
  for (const r of t.targetIds)
14937
14959
  // A watched target might have been removed already.
14938
- e.B_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.B_.delete(r), e.U_.removeTarget(r));
14960
+ e.L_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.L_.delete(r), e.U_.removeTarget(r));
14939
14961
  }
14940
14962
  /**
14941
14963
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -14966,21 +14988,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14966
14988
  // persistent view of these when applying the completed RemoteEvent.
14967
14989
  return n.targetChanges.forEach(((n, r) => {
14968
14990
  if (n.resumeToken.approximateByteSize() > 0) {
14969
- const i = e.B_.get(r);
14991
+ const i = e.L_.get(r);
14970
14992
  // A watched target might have been removed already.
14971
- i && e.B_.set(r, i.withResumeToken(n.resumeToken, t));
14993
+ i && e.L_.set(r, i.withResumeToken(n.resumeToken, t));
14972
14994
  }
14973
14995
  })),
14974
14996
  // Re-establish listens for the targets that have been invalidated by
14975
14997
  // existence filter mismatches.
14976
14998
  n.targetMismatches.forEach(((t, n) => {
14977
- const r = e.B_.get(t);
14999
+ const r = e.L_.get(t);
14978
15000
  if (!r)
14979
15001
  // A watched target might have been removed already.
14980
15002
  return;
14981
15003
  // Clear the resume token for the target, since we're in a known mismatch
14982
15004
  // state.
14983
- e.B_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15005
+ e.L_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
14984
15006
  // Cause a hard reset by unwatching and rewatching immediately, but
14985
15007
  // deliberately don't send a resume token so that we get a full update.
14986
15008
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15031,11 +15053,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15031
15053
 
15032
15054
  async function __PRIVATE_fillWritePipeline(e) {
15033
15055
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15034
- let r = t.L_.length > 0 ? t.L_[t.L_.length - 1].batchId : -1;
15056
+ let r = t.B_.length > 0 ? t.B_[t.B_.length - 1].batchId : -1;
15035
15057
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15036
15058
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15037
15059
  if (null === e) {
15038
- 0 === t.L_.length && n.a_();
15060
+ 0 === t.B_.length && n.a_();
15039
15061
  break;
15040
15062
  }
15041
15063
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15049,20 +15071,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15049
15071
  * Returns true if we can add to the write pipeline (i.e. the network is
15050
15072
  * enabled and the write pipeline is not full).
15051
15073
  */ function __PRIVATE_canAddToWritePipeline(e) {
15052
- return __PRIVATE_canUseNetwork(e) && e.L_.length < 10;
15074
+ return __PRIVATE_canUseNetwork(e) && e.B_.length < 10;
15053
15075
  }
15054
15076
 
15055
15077
  /**
15056
15078
  * Queues additional writes to be sent to the write stream, sending them
15057
15079
  * immediately if the write stream is established.
15058
15080
  */ function __PRIVATE_addToWritePipeline(e, t) {
15059
- e.L_.push(t);
15081
+ e.B_.push(t);
15060
15082
  const n = __PRIVATE_ensureWriteStream(e);
15061
15083
  n.s_() && n.f_ && n.g_(t.mutations);
15062
15084
  }
15063
15085
 
15064
15086
  function __PRIVATE_shouldStartWriteStream(e) {
15065
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).i_() && e.L_.length > 0;
15087
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).i_() && e.B_.length > 0;
15066
15088
  }
15067
15089
 
15068
15090
  function __PRIVATE_startWriteStream(e) {
@@ -15076,11 +15098,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15076
15098
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15077
15099
  const t = __PRIVATE_ensureWriteStream(e);
15078
15100
  // Send the write pipeline now that the stream is established.
15079
- for (const n of e.L_) t.g_(n.mutations);
15101
+ for (const n of e.B_) t.g_(n.mutations);
15080
15102
  }
15081
15103
 
15082
15104
  async function __PRIVATE_onMutationResult(e, t, n) {
15083
- const r = e.L_.shift(), i = MutationBatchResult.from(r, t, n);
15105
+ const r = e.B_.shift(), i = MutationBatchResult.from(r, t, n);
15084
15106
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15085
15107
  // It's possible that with the completion of this mutation another
15086
15108
  // slot has freed up.
@@ -15100,7 +15122,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15100
15122
  }(t.code)) {
15101
15123
  // This was a permanent error, the request itself was the problem
15102
15124
  // so it's not going to succeed if we resend it.
15103
- const n = e.L_.shift();
15125
+ const n = e.B_.shift();
15104
15126
  // In this case it's also unlikely that the server itself is melting
15105
15127
  // down -- this was just a bad request so inhibit backoff on the next
15106
15128
  // restart.
@@ -15199,8 +15221,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15199
15221
  }), e.q_.push((async t => {
15200
15222
  t ? (e.G_.__(),
15201
15223
  // This will start the write stream if necessary.
15202
- await __PRIVATE_fillWritePipeline(e)) : (await e.G_.stop(), e.L_.length > 0 && (__PRIVATE_logDebug("RemoteStore", `Stopping write stream with ${e.L_.length} pending writes`),
15203
- e.L_ = []));
15224
+ await __PRIVATE_fillWritePipeline(e)) : (await e.G_.stop(), e.B_.length > 0 && (__PRIVATE_logDebug("RemoteStore", `Stopping write stream with ${e.B_.length} pending writes`),
15225
+ e.B_ = []));
15204
15226
  }))), e.G_;
15205
15227
  }
15206
15228
 
@@ -15803,7 +15825,7 @@ class __PRIVATE_QueryListener {
15803
15825
  return t !== this.progress.documentsLoaded ? (this.progress.documentsLoaded = t,
15804
15826
  Object.assign({}, this.progress)) : null;
15805
15827
  }
15806
- Ta(e) {
15828
+ Ia(e) {
15807
15829
  const t = new Map, n = new __PRIVATE_BundleConverterImpl(this.serializer);
15808
15830
  for (const r of e) if (r.metadata.queries) {
15809
15831
  const e = n.As(r.metadata.name);
@@ -15817,12 +15839,12 @@ class __PRIVATE_QueryListener {
15817
15839
  /**
15818
15840
  * Update the progress to 'Success' and return the updated progress.
15819
15841
  */ async complete() {
15820
- const e = await __PRIVATE_localStoreApplyBundledDocuments(this.localStore, new __PRIVATE_BundleConverterImpl(this.serializer), this.documents, this.ha.id), t = this.Ta(this.documents);
15842
+ const e = await __PRIVATE_localStoreApplyBundledDocuments(this.localStore, new __PRIVATE_BundleConverterImpl(this.serializer), this.documents, this.ha.id), t = this.Ia(this.documents);
15821
15843
  for (const e of this.queries) await __PRIVATE_localStoreSaveNamedQuery(this.localStore, e, t.get(e.name));
15822
15844
  return this.progress.taskState = "Success", {
15823
15845
  progress: this.progress,
15824
- Ia: this.collectionGroups,
15825
- Ea: e
15846
+ Ta: this.collectionGroups,
15847
+ da: e
15826
15848
  };
15827
15849
  }
15828
15850
  }
@@ -15880,7 +15902,7 @@ class __PRIVATE_RemovedLimboDocument {
15880
15902
  constructor(e,
15881
15903
  /** Documents included in the remote target */
15882
15904
  t) {
15883
- this.query = e, this.da = t, this.Aa = null, this.hasCachedResults = !1,
15905
+ this.query = e, this.Ea = t, this.Aa = null, this.hasCachedResults = !1,
15884
15906
  /**
15885
15907
  * A flag whether the view is current with the backend. A view is considered
15886
15908
  * current after it has seen the current flag from the backend and did not
@@ -15898,7 +15920,7 @@ class __PRIVATE_RemovedLimboDocument {
15898
15920
  * The set of remote documents that the server has told us belongs to the target associated with
15899
15921
  * this view.
15900
15922
  */ get fa() {
15901
- return this.da;
15923
+ return this.Ea;
15902
15924
  }
15903
15925
  /**
15904
15926
  * Iterates over a set of doc changes, applies the query limit, and computes
@@ -16072,7 +16094,7 @@ class __PRIVATE_RemovedLimboDocument {
16072
16094
  * Returns whether the doc for the given key should be in limbo.
16073
16095
  */ Da(e) {
16074
16096
  // If the remote end says it's part of this query, it's not in limbo.
16075
- return !this.da.has(e) && (
16097
+ return !this.Ea.has(e) && (
16076
16098
  // The local store doesn't think it's a result, so it shouldn't be in limbo.
16077
16099
  !!this.ma.has(e) && !this.ma.get(e).hasLocalMutations);
16078
16100
  }
@@ -16080,8 +16102,8 @@ class __PRIVATE_RemovedLimboDocument {
16080
16102
  * Updates syncedDocuments, current, and limbo docs based on the given change.
16081
16103
  * Returns the list of changes to which docs are in limbo.
16082
16104
  */ wa(e) {
16083
- e && (e.addedDocuments.forEach((e => this.da = this.da.add(e))), e.modifiedDocuments.forEach((e => {})),
16084
- e.removedDocuments.forEach((e => this.da = this.da.delete(e))), this.current = e.current);
16105
+ e && (e.addedDocuments.forEach((e => this.Ea = this.Ea.add(e))), e.modifiedDocuments.forEach((e => {})),
16106
+ e.removedDocuments.forEach((e => this.Ea = this.Ea.delete(e))), this.current = e.current);
16085
16107
  }
16086
16108
  Sa() {
16087
16109
  // We can only determine limbo documents when we're in-sync with the server.
@@ -16121,7 +16143,7 @@ class __PRIVATE_RemovedLimboDocument {
16121
16143
  */
16122
16144
  // PORTING NOTE: Multi-tab only.
16123
16145
  va(e) {
16124
- this.da = e.ds, this.Ra = __PRIVATE_documentKeySet();
16146
+ this.Ea = e.Es, this.Ra = __PRIVATE_documentKeySet();
16125
16147
  const t = this.ga(e.documents);
16126
16148
  return this.applyChanges(t, /* limboResolutionEnabled= */ !0);
16127
16149
  }
@@ -16208,12 +16230,12 @@ class __PRIVATE_QueryView {
16208
16230
  * Keeps track of the target ID for each document that is in limbo with an
16209
16231
  * active target.
16210
16232
  */
16211
- this.La = new SortedMap(DocumentKey.comparator),
16233
+ this.Ba = new SortedMap(DocumentKey.comparator),
16212
16234
  /**
16213
16235
  * Keeps track of the information about an active limbo resolution for each
16214
16236
  * active target ID that was started for the purpose of limbo resolution.
16215
16237
  */
16216
- this.Ba = new Map, this.ka = new __PRIVATE_ReferenceSet,
16238
+ this.La = new Map, this.ka = new __PRIVATE_ReferenceSet,
16217
16239
  /** Stores user completion handlers, indexed by User and BatchId. */
16218
16240
  this.qa = {},
16219
16241
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
@@ -16282,7 +16304,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16282
16304
  return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.ba), _.snapshot;
16283
16305
  }(e, t, n, r);
16284
16306
  const s = await __PRIVATE_localStoreExecuteQuery(e.localStore, t,
16285
- /* 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(_,
16307
+ /* 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(_,
16286
16308
  /* limboResolutionEnabled= */ e.isPrimaryClient, a);
16287
16309
  __PRIVATE_updateTrackedLimbos(e, n, u.ba);
16288
16310
  const c = new __PRIVATE_QueryView(t, n, o);
@@ -16397,7 +16419,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16397
16419
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16398
16420
  // Update `receivedDocument` as appropriate for any limbo targets.
16399
16421
  t.targetChanges.forEach(((e, t) => {
16400
- const r = n.Ba.get(t);
16422
+ const r = n.La.get(t);
16401
16423
  r && (
16402
16424
  // Since this is a limbo resolution lookup, it's for a single document
16403
16425
  // and it could be added, modified, or removed, but not a combination.
@@ -16451,7 +16473,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16451
16473
  const r = __PRIVATE_debugCast(e);
16452
16474
  // PORTING NOTE: Multi-tab only.
16453
16475
  r.sharedClientState.updateQueryState(t, "rejected", n);
16454
- const i = r.Ba.get(t), s = i && i.key;
16476
+ const i = r.La.get(t), s = i && i.key;
16455
16477
  if (s) {
16456
16478
  // TODO(klimt): We really only should do the following on permission
16457
16479
  // denied errors, but we don't have the cause code here.
@@ -16473,7 +16495,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16473
16495
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16474
16496
  // this query when the RemoteStore restarts the Watch stream, which should
16475
16497
  // re-trigger the target failure.
16476
- r.La = r.La.remove(s), r.Ba.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16498
+ r.Ba = r.Ba.remove(s), r.La.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16477
16499
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16478
16500
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16479
16501
  }
@@ -16579,9 +16601,9 @@ function __PRIVATE_removeLimboTarget(e, t) {
16579
16601
  e.Na.delete(t.path.canonicalString());
16580
16602
  // It's possible that the target already got removed because the query failed. In that case,
16581
16603
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16582
- const n = e.La.get(t);
16583
- null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.La = e.La.remove(t),
16584
- e.Ba.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16604
+ const n = e.Ba.get(t);
16605
+ null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.Ba = e.Ba.remove(t),
16606
+ e.La.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16585
16607
  }
16586
16608
 
16587
16609
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
@@ -16596,7 +16618,7 @@ function __PRIVATE_updateTrackedLimbos(e, t, n) {
16596
16618
 
16597
16619
  function __PRIVATE_trackLimboChange(e, t) {
16598
16620
  const n = t.key, r = n.path.canonicalString();
16599
- e.La.get(n) || e.Na.has(r) || (__PRIVATE_logDebug("SyncEngine", "New document in limbo: " + n),
16621
+ e.Ba.get(n) || e.Na.has(r) || (__PRIVATE_logDebug("SyncEngine", "New document in limbo: " + n),
16600
16622
  e.Na.add(r), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16601
16623
  }
16602
16624
 
@@ -16608,11 +16630,11 @@ function __PRIVATE_trackLimboChange(e, t) {
16608
16630
  * with "resource exhausted" errors which can lead to pathological client
16609
16631
  * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
16610
16632
  */ function __PRIVATE_pumpEnqueuedLimboResolutions(e) {
16611
- for (;e.Na.size > 0 && e.La.size < e.maxConcurrentLimboResolutions; ) {
16633
+ for (;e.Na.size > 0 && e.Ba.size < e.maxConcurrentLimboResolutions; ) {
16612
16634
  const t = e.Na.values().next().value;
16613
16635
  e.Na.delete(t);
16614
16636
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.Ka.next();
16615
- 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));
16637
+ 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));
16616
16638
  }
16617
16639
  }
16618
16640
 
@@ -16675,12 +16697,12 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16675
16697
  })), e.Qa.clear();
16676
16698
  }(n, "'waitForPendingWrites' promise is rejected due to a user change."),
16677
16699
  // TODO(b/114226417): Consider calling this only in the primary tab.
16678
- n.sharedClientState.handleUserChange(t, e.removedBatchIds, e.addedBatchIds), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(n, e.Ts);
16700
+ n.sharedClientState.handleUserChange(t, e.removedBatchIds, e.addedBatchIds), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(n, e.Is);
16679
16701
  }
16680
16702
  }
16681
16703
 
16682
16704
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16683
- const n = __PRIVATE_debugCast(e), r = n.Ba.get(t);
16705
+ const n = __PRIVATE_debugCast(e), r = n.La.get(t);
16684
16706
  if (r && r.Fa) return __PRIVATE_documentKeySet().add(r.key);
16685
16707
  {
16686
16708
  let e = __PRIVATE_documentKeySet();
@@ -16732,7 +16754,7 @@ async function __PRIVATE_syncEngineApplyBatchState(e, t, n, r) {
16732
16754
  // other clients.
16733
16755
  __PRIVATE_processUserCallback(i, t, r || null), __PRIVATE_triggerPendingWritesCallbacks(i, t),
16734
16756
  function __PRIVATE_localStoreRemoveCachedMutationBatchMetadata(e, t) {
16735
- __PRIVATE_debugCast(__PRIVATE_debugCast(e).mutationQueue).Ln(t);
16757
+ __PRIVATE_debugCast(__PRIVATE_debugCast(e).mutationQueue).Bn(t);
16736
16758
  }
16737
16759
  // PORTING NOTE: Multi-Tab only.
16738
16760
  (i.localStore, t)) : fail(), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(i, s)) :
@@ -16772,9 +16794,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16772
16794
  // PORTING NOTE: Multi-Tab only.
16773
16795
  function __PRIVATE_resetLimboDocuments(e) {
16774
16796
  const t = __PRIVATE_debugCast(e);
16775
- t.Ba.forEach(((e, n) => {
16797
+ t.La.forEach(((e, n) => {
16776
16798
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16777
- })), t.ka.wr(), t.Ba = new Map, t.La = new SortedMap(DocumentKey.comparator);
16799
+ })), t.ka.wr(), t.La = new Map, t.Ba = new SortedMap(DocumentKey.comparator);
16778
16800
  }
16779
16801
  /**
16780
16802
  * Reconcile the query views of the provided query targets with the state from
@@ -16947,7 +16969,7 @@ function __PRIVATE_syncEngineEnsureWriteCallbacks(e) {
16947
16969
  e && n._updateProgress(e), s = await t.Ga();
16948
16970
  }
16949
16971
  const o = await i.complete();
16950
- return await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, o.Ea,
16972
+ return await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, o.da,
16951
16973
  /* remoteEvent */ void 0),
16952
16974
  // Save metadata, so loading the same bundle will skip.
16953
16975
  await function __PRIVATE_localStoreSaveBundle(e, t) {
@@ -16957,7 +16979,7 @@ function __PRIVATE_syncEngineEnsureWriteCallbacks(e) {
16957
16979
  /**
16958
16980
  * Returns a promise of a `NamedQuery` associated with given query name. Promise
16959
16981
  * resolves to undefined if no persisted data can be found.
16960
- */ (e.localStore, r), n._completeWith(o.progress), Promise.resolve(o.Ia);
16982
+ */ (e.localStore, r), n._completeWith(o.progress), Promise.resolve(o.Ta);
16961
16983
  } catch (e) {
16962
16984
  return __PRIVATE_logWarn("SyncEngine", `Loading bundle failed with ${e}`), n._failWith(e),
16963
16985
  Promise.resolve(new Set);
@@ -17581,10 +17603,10 @@ class Transaction$2 {
17581
17603
  }
17582
17604
  }
17583
17605
  Pu(e) {
17584
- this.uu > 0 && this.Tu(e) ? (this.uu -= 1, this.asyncQueue.enqueueAndForget((() => (this.lu(),
17606
+ this.uu > 0 && this.Iu(e) ? (this.uu -= 1, this.asyncQueue.enqueueAndForget((() => (this.lu(),
17585
17607
  Promise.resolve())))) : this.deferred.reject(e);
17586
17608
  }
17587
- Tu(e) {
17609
+ Iu(e) {
17588
17610
  if ("FirebaseError" === e.name) {
17589
17611
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
17590
17612
  // non-matching document versions with ABORTED. These errors should be retried.
@@ -17836,7 +17858,7 @@ function __PRIVATE_firestoreClientGetDocumentsFromLocalCache(e, t) {
17836
17858
  return e.asyncQueue.enqueueAndForget((async () => async function __PRIVATE_executeQueryFromCache(e, t, n) {
17837
17859
  try {
17838
17860
  const r = await __PRIVATE_localStoreExecuteQuery(e, t,
17839
- /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.ds), s = i.ga(r.documents), o = i.applyChanges(s,
17861
+ /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.Es), s = i.ga(r.documents), o = i.applyChanges(s,
17840
17862
  /* limboResolutionEnabled= */ !1);
17841
17863
  n.resolve(o.snapshot);
17842
17864
  } catch (e) {
@@ -18386,7 +18408,7 @@ class Firestore$1 {
18386
18408
  if ("string" == typeof r.mockUserToken) t = r.mockUserToken, n = User.MOCK_USER; else {
18387
18409
  // Let createMockUserToken validate first (catches common mistakes like
18388
18410
  // invalid field "uid" and missing field "sub" / "user_id".)
18389
- t = T(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
18411
+ t = I(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
18390
18412
  const s = r.mockUserToken.sub || r.mockUserToken.user_id;
18391
18413
  if (!s) throw new FirestoreError(C.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
18392
18414
  n = new User(s);
@@ -18503,7 +18525,7 @@ class Firestore$1 {
18503
18525
  }
18504
18526
 
18505
18527
  function collection(e, t, ...n) {
18506
- if (e = I(e), __PRIVATE_validateNonEmptyArgument("collection", "path", t), e instanceof Firestore$1) {
18528
+ if (e = T(e), __PRIVATE_validateNonEmptyArgument("collection", "path", t), e instanceof Firestore$1) {
18507
18529
  const r = ResourcePath.fromString(t, ...n);
18508
18530
  return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
18509
18531
  }
@@ -18537,7 +18559,7 @@ function collection(e, t, ...n) {
18537
18559
  }
18538
18560
 
18539
18561
  function doc(e, t, ...n) {
18540
- if (e = I(e),
18562
+ if (e = T(e),
18541
18563
  // We allow omission of 'pathString' but explicitly prohibit passing in both
18542
18564
  // 'undefined' and 'null'.
18543
18565
  1 === arguments.length && (t = __PRIVATE_AutoId.newId()), __PRIVATE_validateNonEmptyArgument("doc", "path", t),
@@ -18561,7 +18583,7 @@ function doc(e, t, ...n) {
18561
18583
  * @returns true if the references point to the same location in the same
18562
18584
  * Firestore database.
18563
18585
  */ function refEqual(e, t) {
18564
- return e = I(e), t = I(t), (e instanceof DocumentReference || e instanceof CollectionReference) && (t instanceof DocumentReference || t instanceof CollectionReference) && (e.firestore === t.firestore && e.path === t.path && e.converter === t.converter);
18586
+ return e = T(e), t = T(t), (e instanceof DocumentReference || e instanceof CollectionReference) && (t instanceof DocumentReference || t instanceof CollectionReference) && (e.firestore === t.firestore && e.path === t.path && e.converter === t.converter);
18565
18587
  }
18566
18588
 
18567
18589
  /**
@@ -18573,7 +18595,7 @@ function doc(e, t, ...n) {
18573
18595
  * @returns true if the references point to the same location in the same
18574
18596
  * Firestore database.
18575
18597
  */ function queryEqual(e, t) {
18576
- return e = I(e), t = I(t), e instanceof Query && t instanceof Query && (e.firestore === t.firestore && __PRIVATE_queryEquals(e._query, t._query) && e.converter === t.converter);
18598
+ return e = T(e), t = T(t), e instanceof Query && t instanceof Query && (e.firestore === t.firestore && __PRIVATE_queryEquals(e._query, t._query) && e.converter === t.converter);
18577
18599
  }
18578
18600
 
18579
18601
  /**
@@ -18595,13 +18617,13 @@ function doc(e, t, ...n) {
18595
18617
  constructor(e = Promise.resolve()) {
18596
18618
  // A list of retryable operations. Retryable operations are run in order and
18597
18619
  // retried with backoff.
18598
- this.Iu = [],
18620
+ this.Tu = [],
18599
18621
  // Is this AsyncQueue being shut down? Once it is set to true, it will not
18600
18622
  // be changed again.
18601
- this.Eu = !1,
18623
+ this.du = !1,
18602
18624
  // Operations scheduled to be queued in the future. Operations are
18603
18625
  // automatically removed after they are run or canceled.
18604
- this.du = [],
18626
+ this.Eu = [],
18605
18627
  // visible for testing
18606
18628
  this.Au = null,
18607
18629
  // Flag set while there's an outstanding AsyncQueue operation, used for
@@ -18625,7 +18647,7 @@ function doc(e, t, ...n) {
18625
18647
  t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.fu);
18626
18648
  }
18627
18649
  get isShuttingDown() {
18628
- return this.Eu;
18650
+ return this.du;
18629
18651
  }
18630
18652
  /**
18631
18653
  * Adds a new operation to the queue without waiting for it to complete (i.e.
@@ -18640,39 +18662,39 @@ function doc(e, t, ...n) {
18640
18662
  this.yu(e);
18641
18663
  }
18642
18664
  enterRestrictedMode(e) {
18643
- if (!this.Eu) {
18644
- this.Eu = !0, this.Vu = e || !1;
18665
+ if (!this.du) {
18666
+ this.du = !0, this.Vu = e || !1;
18645
18667
  const t = getDocument();
18646
18668
  t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.fu);
18647
18669
  }
18648
18670
  }
18649
18671
  enqueue(e) {
18650
- if (this.pu(), this.Eu)
18672
+ if (this.pu(), this.du)
18651
18673
  // Return a Promise which never resolves.
18652
18674
  return new Promise((() => {}));
18653
18675
  // Create a deferred Promise that we can return to the callee. This
18654
18676
  // allows us to return a "hanging Promise" only to the callee and still
18655
18677
  // advance the queue even when the operation is not run.
18656
18678
  const t = new __PRIVATE_Deferred;
18657
- return this.yu((() => this.Eu && this.Vu ? Promise.resolve() : (e().then(t.resolve, t.reject),
18679
+ return this.yu((() => this.du && this.Vu ? Promise.resolve() : (e().then(t.resolve, t.reject),
18658
18680
  t.promise))).then((() => t.promise));
18659
18681
  }
18660
18682
  enqueueRetryable(e) {
18661
- this.enqueueAndForget((() => (this.Iu.push(e), this.wu())));
18683
+ this.enqueueAndForget((() => (this.Tu.push(e), this.wu())));
18662
18684
  }
18663
18685
  /**
18664
18686
  * Runs the next operation from the retryable queue. If the operation fails,
18665
18687
  * reschedules with backoff.
18666
18688
  */ async wu() {
18667
- if (0 !== this.Iu.length) {
18689
+ if (0 !== this.Tu.length) {
18668
18690
  try {
18669
- await this.Iu[0](), this.Iu.shift(), this.r_.reset();
18691
+ await this.Tu[0](), this.Tu.shift(), this.r_.reset();
18670
18692
  } catch (e) {
18671
18693
  if (!__PRIVATE_isIndexedDbTransactionError(e)) throw e;
18672
18694
  // Failure will be handled by AsyncQueue
18673
18695
  __PRIVATE_logDebug("AsyncQueue", "Operation failed with retryable error: " + e);
18674
18696
  }
18675
- this.Iu.length > 0 &&
18697
+ this.Tu.length > 0 &&
18676
18698
  // If there are additional operations, we re-schedule `retryNextOp()`.
18677
18699
  // This is necessary to run retryable operations that failed during
18678
18700
  // their initial attempt since we don't know whether they are already
@@ -18728,7 +18750,7 @@ function doc(e, t, ...n) {
18728
18750
  // Fast-forward delays for timerIds that have been overridden.
18729
18751
  this.mu.indexOf(e) > -1 && (t = 0);
18730
18752
  const r = DelayedOperation.createAndSchedule(this, e, t, n, (e => this.Su(e)));
18731
- return this.du.push(r), r;
18753
+ return this.Eu.push(r), r;
18732
18754
  }
18733
18755
  pu() {
18734
18756
  this.Au && fail();
@@ -18751,7 +18773,7 @@ function doc(e, t, ...n) {
18751
18773
  * For Tests: Determine if a delayed operation with a particular TimerId
18752
18774
  * exists.
18753
18775
  */ Du(e) {
18754
- for (const t of this.du) if (t.timerId === e) return !0;
18776
+ for (const t of this.Eu) if (t.timerId === e) return !0;
18755
18777
  return !1;
18756
18778
  }
18757
18779
  /**
@@ -18765,8 +18787,8 @@ function doc(e, t, ...n) {
18765
18787
  return this.bu().then((() => {
18766
18788
  // Run ops in the same order they'd run if they ran naturally.
18767
18789
  /* eslint-disable-next-line @typescript-eslint/no-floating-promises */
18768
- this.du.sort(((e, t) => e.targetTimeMs - t.targetTimeMs));
18769
- for (const t of this.du) if (t.skipDelay(), "all" /* TimerId.All */ !== e && t.timerId === e) break;
18790
+ this.Eu.sort(((e, t) => e.targetTimeMs - t.targetTimeMs));
18791
+ for (const t of this.Eu) if (t.skipDelay(), "all" /* TimerId.All */ !== e && t.timerId === e) break;
18770
18792
  return this.bu();
18771
18793
  }));
18772
18794
  }
@@ -18777,8 +18799,8 @@ function doc(e, t, ...n) {
18777
18799
  }
18778
18800
  /** Called once a DelayedOperation is run or canceled. */ Su(e) {
18779
18801
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
18780
- const t = this.du.indexOf(e);
18781
- /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ this.du.splice(t, 1);
18802
+ const t = this.Eu.indexOf(e);
18803
+ /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ this.Eu.splice(t, 1);
18782
18804
  }
18783
18805
  }
18784
18806
 
@@ -18947,7 +18969,7 @@ class LoadBundleTask {
18947
18969
  const e = r.getImmediate({
18948
18970
  identifier: n
18949
18971
  }), i = r.getOptions(n);
18950
- if (E(i, t)) return e;
18972
+ if (d(i, t)) return e;
18951
18973
  throw new FirestoreError(C.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.");
18952
18974
  }
18953
18975
  if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(C.INVALID_ARGUMENT, "cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");
@@ -18963,7 +18985,7 @@ function getFirestore(t, n) {
18963
18985
  identifier: i
18964
18986
  });
18965
18987
  if (!s._initialized) {
18966
- const e = d("firestore");
18988
+ const e = E("firestore");
18967
18989
  e && connectFirestoreEmulator(s, ...e);
18968
18990
  }
18969
18991
  return s;
@@ -19646,9 +19668,9 @@ function __PRIVATE_isWrite(e) {
19646
19668
  path: n,
19647
19669
  Nu: !1
19648
19670
  });
19649
- return r.Lu(e), r;
19671
+ return r.Bu(e), r;
19650
19672
  }
19651
- Bu(e) {
19673
+ Lu(e) {
19652
19674
  var t;
19653
19675
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.xu({
19654
19676
  path: n,
@@ -19673,9 +19695,9 @@ function __PRIVATE_isWrite(e) {
19673
19695
  Fu() {
19674
19696
  // TODO(b/34871131): Remove null check once we have proper paths for fields
19675
19697
  // within arrays.
19676
- if (this.path) for (let e = 0; e < this.path.length; e++) this.Lu(this.path.get(e));
19698
+ if (this.path) for (let e = 0; e < this.path.length; e++) this.Bu(this.path.get(e));
19677
19699
  }
19678
- Lu(e) {
19700
+ Bu(e) {
19679
19701
  if (0 === e.length) throw this.qu("Document fields must not be empty");
19680
19702
  if (__PRIVATE_isWrite(this.Mu) && ve.test(e)) throw this.qu('Document fields cannot begin and end with "__"');
19681
19703
  }
@@ -19777,7 +19799,7 @@ class __PRIVATE_ArrayUnionFieldValueImpl extends FieldValue {
19777
19799
  return new FieldTransform(e.path, r);
19778
19800
  }
19779
19801
  isEqual(e) {
19780
- return e instanceof __PRIVATE_ArrayUnionFieldValueImpl && E(this.Uu, e.Uu);
19802
+ return e instanceof __PRIVATE_ArrayUnionFieldValueImpl && d(this.Uu, e.Uu);
19781
19803
  }
19782
19804
  }
19783
19805
 
@@ -19791,7 +19813,7 @@ class __PRIVATE_ArrayRemoveFieldValueImpl extends FieldValue {
19791
19813
  return new FieldTransform(e.path, r);
19792
19814
  }
19793
19815
  isEqual(e) {
19794
- return e instanceof __PRIVATE_ArrayRemoveFieldValueImpl && E(this.Uu, e.Uu);
19816
+ return e instanceof __PRIVATE_ArrayRemoveFieldValueImpl && d(this.Uu, e.Uu);
19795
19817
  }
19796
19818
  }
19797
19819
 
@@ -19816,8 +19838,8 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19816
19838
  const _ = __PRIVATE_fieldPathFromDotSeparatedString(t, e, n);
19817
19839
  // For Compat types, we have to "extract" the underlying types before
19818
19840
  // performing validation.
19819
- r = I(r);
19820
- const a = i.Bu(_);
19841
+ r = T(r);
19842
+ const a = i.Lu(_);
19821
19843
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19822
19844
  // Add it to the field mask, but don't add anything to updateData.
19823
19845
  s.push(_); else {
@@ -19842,8 +19864,8 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19842
19864
  let n = a[e];
19843
19865
  // For Compat types, we have to "extract" the underlying types before
19844
19866
  // performing validation.
19845
- n = I(n);
19846
- const r = o.Bu(t);
19867
+ n = T(n);
19868
+ const r = o.Lu(t);
19847
19869
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19848
19870
  // Add it to the field mask, but don't add anything to updateData.
19849
19871
  u.push(t); else {
@@ -19877,7 +19899,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19877
19899
  if (__PRIVATE_looksLikeJsonObject(
19878
19900
  // Unwrap the API type from the Compat SDK. This will return the API type
19879
19901
  // from firestore-exp.
19880
- e = I(e))) return __PRIVATE_validatePlainObject("Unsupported field value:", t, e),
19902
+ e = T(e))) return __PRIVATE_validatePlainObject("Unsupported field value:", t, e),
19881
19903
  __PRIVATE_parseObject(e, t);
19882
19904
  if (e instanceof FieldValue)
19883
19905
  // FieldValues usually parse into transforms (except deleteField())
@@ -19937,7 +19959,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19937
19959
  }(e, t);
19938
19960
  }
19939
19961
  return function __PRIVATE_parseScalarValue(e, t) {
19940
- if (null === (e = I(e))) return {
19962
+ if (null === (e = T(e))) return {
19941
19963
  nullValue: "NULL_VALUE"
19942
19964
  };
19943
19965
  if ("number" == typeof e) return toNumber(t.serializer, e);
@@ -20046,7 +20068,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
20046
20068
  if ((
20047
20069
  // If required, replace the FieldPath Compat class with the firestore-exp
20048
20070
  // FieldPath.
20049
- t = I(t)) instanceof FieldPath) return t._internalPath;
20071
+ t = T(t)) instanceof FieldPath) return t._internalPath;
20050
20072
  if ("string" == typeof t) return __PRIVATE_fieldPathFromDotSeparatedString(e, t);
20051
20073
  throw __PRIVATE_createError("Field path arguments must be of type string or ", e,
20052
20074
  /* hasConverter= */ !1,
@@ -20581,7 +20603,7 @@ function endAt(...e) {
20581
20603
  }
20582
20604
 
20583
20605
  /** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
20584
- if (n[0] = I(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
20606
+ if (n[0] = T(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
20585
20607
  if (!r) throw new FirestoreError(C.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
20586
20608
  const s = [];
20587
20609
  // Because people expect to continue/end a query at the exact document
@@ -20637,7 +20659,7 @@ function endAt(...e) {
20637
20659
  }
20638
20660
 
20639
20661
  function __PRIVATE_parseDocumentIdValue(e, t, n) {
20640
- if ("string" == typeof (n = I(n))) {
20662
+ if ("string" == typeof (n = T(n))) {
20641
20663
  if ("" === n) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
20642
20664
  if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
20643
20665
  const r = t.path.child(ResourcePath.fromString(n));
@@ -20895,7 +20917,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
20895
20917
  * @returns `true` if the objects are "equal", as defined above, or `false`
20896
20918
  * otherwise.
20897
20919
  */ function aggregateQuerySnapshotEqual(e, t) {
20898
- return queryEqual(e.query, t.query) && E(e.data(), t.data());
20920
+ return queryEqual(e.query, t.query) && d(e.data(), t.data());
20899
20921
  }
20900
20922
 
20901
20923
  /**
@@ -21264,7 +21286,7 @@ function updateDoc(e, t, n, ...r) {
21264
21286
  o = "string" == typeof (
21265
21287
  // For Compat types, we have to "extract" the underlying types before
21266
21288
  // performing validation.
21267
- t = I(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(s, "updateDoc", e._key, t, n, r) : __PRIVATE_parseUpdateData(s, "updateDoc", e._key, t);
21289
+ t = T(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(s, "updateDoc", e._key, t, n, r) : __PRIVATE_parseUpdateData(s, "updateDoc", e._key, t);
21268
21290
  return executeWrite(i, [ o.toMutation(e._key, Precondition.exists(!0)) ]);
21269
21291
  }
21270
21292
 
@@ -21294,7 +21316,7 @@ function updateDoc(e, t, n, ...r) {
21294
21316
 
21295
21317
  function onSnapshot(e, ...t) {
21296
21318
  var n, r, i;
21297
- e = I(e);
21319
+ e = T(e);
21298
21320
  let s = {
21299
21321
  includeMetadataChanges: !1,
21300
21322
  source: "default"
@@ -21665,7 +21687,7 @@ class WriteBatch {
21665
21687
  // For Compat types, we have to "extract" the underlying types before
21666
21688
  // performing validation.
21667
21689
  let s;
21668
- return s = "string" == typeof (t = I(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "WriteBatch.update", i._key, t, n, r) : __PRIVATE_parseUpdateData(this._dataReader, "WriteBatch.update", i._key, t),
21690
+ return s = "string" == typeof (t = T(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "WriteBatch.update", i._key, t, n, r) : __PRIVATE_parseUpdateData(this._dataReader, "WriteBatch.update", i._key, t),
21669
21691
  this._mutations.push(s.toMutation(i._key, Precondition.exists(!0))), this;
21670
21692
  }
21671
21693
  /**
@@ -21699,7 +21721,7 @@ class WriteBatch {
21699
21721
  }
21700
21722
 
21701
21723
  function __PRIVATE_validateReference(e, t) {
21702
- if ((e = I(e)).firestore !== t) throw new FirestoreError(C.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
21724
+ if ((e = T(e)).firestore !== t) throw new FirestoreError(C.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
21703
21725
  return e;
21704
21726
  }
21705
21727
 
@@ -21780,7 +21802,7 @@ class Transaction extends class Transaction$1 {
21780
21802
  // For Compat types, we have to "extract" the underlying types before
21781
21803
  // performing validation.
21782
21804
  let s;
21783
- return s = "string" == typeof (t = I(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "Transaction.update", i._key, t, n, r) : __PRIVATE_parseUpdateData(this._dataReader, "Transaction.update", i._key, t),
21805
+ return s = "string" == typeof (t = T(t)) || t instanceof FieldPath ? __PRIVATE_parseUpdateVarargs(this._dataReader, "Transaction.update", i._key, t, n, r) : __PRIVATE_parseUpdateData(this._dataReader, "Transaction.update", i._key, t),
21784
21806
  this._transaction.update(i._key, s), this;
21785
21807
  }
21786
21808
  /**
@@ -22211,8 +22233,8 @@ function _internalQueryToProtoQueryTarget(e) {
22211
22233
  }
22212
22234
  static get instance() {
22213
22235
  return xe || (xe = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
22214
- if (Ie) throw new Error("a TestingHooksSpi instance is already set");
22215
- Ie = e;
22236
+ if (Te) throw new Error("a TestingHooksSpi instance is already set");
22237
+ Te = e;
22216
22238
  }(xe)), xe;
22217
22239
  }
22218
22240
  tt(e) {
@@ -22252,9 +22274,9 @@ let xe = null;
22252
22274
  return r = Object.assign({
22253
22275
  useFetchStreams: t
22254
22276
  }, r), s._setSettings(r), s;
22255
- }), "PUBLIC").setMultipleInstances(!0)), r(b, "4.7.5", e),
22277
+ }), "PUBLIC").setMultipleInstances(!0)), r(b, "4.7.6-canary.144bc3709", e),
22256
22278
  // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
22257
- r(b, "4.7.5", "esm2017");
22279
+ r(b, "4.7.6-canary.144bc3709", "esm2017");
22258
22280
  }("rn", /* useFetchStreams= */ !1);
22259
22281
 
22260
22282
  export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, De 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 };