@firebase/firestore 4.6.0-canary.84f9ff008 → 4.6.0-canary.b74d8a211

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.
Files changed (36) hide show
  1. package/dist/firestore/src/remote/connection.d.ts +6 -2
  2. package/dist/firestore/src/remote/persistent_stream.d.ts +5 -0
  3. package/dist/firestore/src/remote/stream_bridge.d.ts +3 -0
  4. package/dist/firestore/test/integration/remote/stream.test.d.ts +2 -1
  5. package/dist/index.cjs.js +599 -584
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.esm2017.js +599 -584
  8. package/dist/index.esm2017.js.map +1 -1
  9. package/dist/index.esm5.js +1697 -1676
  10. package/dist/index.esm5.js.map +1 -1
  11. package/dist/index.node.cjs.js +23 -2
  12. package/dist/index.node.cjs.js.map +1 -1
  13. package/dist/index.node.mjs +23 -2
  14. package/dist/index.node.mjs.map +1 -1
  15. package/dist/index.rn.js +599 -584
  16. package/dist/index.rn.js.map +1 -1
  17. package/dist/lite/firestore/src/remote/connection.d.ts +6 -2
  18. package/dist/lite/firestore/src/remote/persistent_stream.d.ts +5 -0
  19. package/dist/lite/firestore/src/remote/stream_bridge.d.ts +3 -0
  20. package/dist/lite/firestore/test/integration/remote/stream.test.d.ts +2 -1
  21. package/dist/lite/index.browser.esm2017.js +2 -2
  22. package/dist/lite/index.browser.esm5.js +2 -2
  23. package/dist/lite/index.cjs.js +2 -2
  24. package/dist/lite/index.node.cjs.js +2 -2
  25. package/dist/lite/index.node.mjs +2 -2
  26. package/dist/lite/index.rn.esm2017.js +2 -2
  27. package/dist/lite/packages/firestore/src/remote/connection.d.ts +6 -2
  28. package/dist/lite/packages/firestore/src/remote/persistent_stream.d.ts +5 -0
  29. package/dist/lite/packages/firestore/src/remote/stream_bridge.d.ts +3 -0
  30. package/dist/lite/packages/firestore/test/integration/remote/stream.test.d.ts +2 -1
  31. package/dist/packages/firestore/dist/index.esm2017.d.ts +67 -67
  32. package/dist/packages/firestore/src/remote/connection.d.ts +6 -2
  33. package/dist/packages/firestore/src/remote/persistent_stream.d.ts +5 -0
  34. package/dist/packages/firestore/src/remote/stream_bridge.d.ts +3 -0
  35. package/dist/packages/firestore/test/integration/remote/stream.test.d.ts +2 -1
  36. package/package.json +9 -9
package/dist/index.cjs.js CHANGED
@@ -70,7 +70,7 @@ User.MOCK_USER = new User("mock-user");
70
70
  * See the License for the specific language governing permissions and
71
71
  * limitations under the License.
72
72
  */
73
- let S = "10.11.0-canary.84f9ff008";
73
+ let S = "10.11.0-canary.b74d8a211";
74
74
 
75
75
  /**
76
76
  * @license
@@ -13600,8 +13600,11 @@ class __PRIVATE_StreamBridge {
13600
13600
  Io(e) {
13601
13601
  this.To = e;
13602
13602
  }
13603
+ Eo(e) {
13604
+ this.Ao = e;
13605
+ }
13603
13606
  onMessage(e) {
13604
- this.Eo = e;
13607
+ this.Ro = e;
13605
13608
  }
13606
13609
  close() {
13607
13610
  this.lo();
@@ -13609,14 +13612,17 @@ class __PRIVATE_StreamBridge {
13609
13612
  send(e) {
13610
13613
  this.co(e);
13611
13614
  }
13612
- Ao() {
13615
+ Vo() {
13613
13616
  this.Po();
13614
13617
  }
13615
- Ro(e) {
13616
- this.To(e);
13618
+ mo() {
13619
+ this.To();
13620
+ }
13621
+ fo(e) {
13622
+ this.Ao(e);
13617
13623
  }
13618
- Vo(e) {
13619
- this.Eo(e);
13624
+ po(e) {
13625
+ this.Ro(e);
13620
13626
  }
13621
13627
  }
13622
13628
 
@@ -13646,35 +13652,35 @@ class __PRIVATE_RestConnection {
13646
13652
  constructor(e) {
13647
13653
  this.databaseInfo = e, this.databaseId = e.databaseId;
13648
13654
  const t = e.ssl ? "https" : "http", n = encodeURIComponent(this.databaseId.projectId), r = encodeURIComponent(this.databaseId.database);
13649
- this.mo = t + "://" + e.host, this.fo = `projects/${n}/databases/${r}`, this.po = "(default)" === this.databaseId.database ? `project_id=${n}` : `project_id=${n}&database_id=${r}`;
13655
+ this.yo = t + "://" + e.host, this.wo = `projects/${n}/databases/${r}`, this.So = "(default)" === this.databaseId.database ? `project_id=${n}` : `project_id=${n}&database_id=${r}`;
13650
13656
  }
13651
- get yo() {
13657
+ get bo() {
13652
13658
  // Both `invokeRPC()` and `invokeStreamingRPC()` use their `path` arguments to determine
13653
13659
  // where to run the query, and expect the `request` to NOT specify the "path".
13654
13660
  return !1;
13655
13661
  }
13656
- wo(e, t, n, r, i) {
13657
- const s = __PRIVATE_generateUniqueDebugId(), o = this.So(e, t.toUriEncodedString());
13662
+ Do(e, t, n, r, i) {
13663
+ const s = __PRIVATE_generateUniqueDebugId(), o = this.Co(e, t.toUriEncodedString());
13658
13664
  __PRIVATE_logDebug("RestConnection", `Sending RPC '${e}' ${s}:`, o, n);
13659
13665
  const _ = {
13660
- "google-cloud-resource-prefix": this.fo,
13661
- "x-goog-request-params": this.po
13666
+ "google-cloud-resource-prefix": this.wo,
13667
+ "x-goog-request-params": this.So
13662
13668
  };
13663
- return this.bo(_, r, i), this.Do(e, o, _, n).then((t => (__PRIVATE_logDebug("RestConnection", `Received RPC '${e}' ${s}: `, t),
13669
+ return this.vo(_, r, i), this.Fo(e, o, _, n).then((t => (__PRIVATE_logDebug("RestConnection", `Received RPC '${e}' ${s}: `, t),
13664
13670
  t)), (t => {
13665
13671
  throw __PRIVATE_logWarn("RestConnection", `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13666
13672
  t;
13667
13673
  }));
13668
13674
  }
13669
- Co(e, t, n, r, i, s) {
13675
+ Mo(e, t, n, r, i, s) {
13670
13676
  // The REST API automatically aggregates all of the streamed results, so we
13671
13677
  // can just use the normal invoke() method.
13672
- return this.wo(e, t, n, r, i);
13678
+ return this.Do(e, t, n, r, i);
13673
13679
  }
13674
13680
  /**
13675
13681
  * Modifies the headers for a request, adding any authorization token if
13676
13682
  * present and any additional headers for the request.
13677
- */ bo(e, t, n) {
13683
+ */ vo(e, t, n) {
13678
13684
  e["X-Goog-Api-Client"] =
13679
13685
  // SDK_VERSION is updated to different value at runtime depending on the entry point,
13680
13686
  // so we need to get its value when we need it in a function.
@@ -13688,9 +13694,9 @@ class __PRIVATE_RestConnection {
13688
13694
  e["Content-Type"] = "text/plain", this.databaseInfo.appId && (e["X-Firebase-GMPID"] = this.databaseInfo.appId),
13689
13695
  t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
13690
13696
  }
13691
- So(e, t) {
13697
+ Co(e, t) {
13692
13698
  const n = Ve[e];
13693
- return `${this.mo}/v1/${t}:${n}`;
13699
+ return `${this.yo}/v1/${t}:${n}`;
13694
13700
  }
13695
13701
  /**
13696
13702
  * Closes and cleans up any resources associated with the connection. This
@@ -13704,7 +13710,7 @@ class __PRIVATE_RestConnection {
13704
13710
  super(e), this.forceLongPolling = e.forceLongPolling, this.autoDetectLongPolling = e.autoDetectLongPolling,
13705
13711
  this.useFetchStreams = e.useFetchStreams, this.longPollingOptions = e.longPollingOptions;
13706
13712
  }
13707
- Do(e, t, n, r) {
13713
+ Fo(e, t, n, r) {
13708
13714
  const i = __PRIVATE_generateUniqueDebugId();
13709
13715
  return new Promise(((s, o) => {
13710
13716
  const _ = new webchannelWrapper.XhrIo;
@@ -13752,8 +13758,8 @@ class __PRIVATE_RestConnection {
13752
13758
  __PRIVATE_logDebug(me, `RPC '${e}' ${i} sending request:`, r), _.send(t, "POST", a, n, 15);
13753
13759
  }));
13754
13760
  }
13755
- vo(e, t, n) {
13756
- const r = __PRIVATE_generateUniqueDebugId(), i = [ this.mo, "/", "google.firestore.v1.Firestore", "/", e, "/channel" ], s = webchannelWrapper.createWebChannelTransport(), o = webchannelWrapper.getStatEventTarget(), _ = {
13761
+ xo(e, t, n) {
13762
+ const r = __PRIVATE_generateUniqueDebugId(), i = [ this.yo, "/", "google.firestore.v1.Firestore", "/", e, "/channel" ], s = webchannelWrapper.createWebChannelTransport(), o = webchannelWrapper.getStatEventTarget(), _ = {
13757
13763
  // Required for backend stickiness, routing behavior is based on this
13758
13764
  // parameter.
13759
13765
  httpSessionIdParam: "gsessionid",
@@ -13778,7 +13784,7 @@ class __PRIVATE_RestConnection {
13778
13784
  detectBufferingProxy: this.autoDetectLongPolling
13779
13785
  }, a = this.longPollingOptions.timeoutSeconds;
13780
13786
  void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.useFetchStreams = !0),
13781
- this.bo(_.initMessageHeaders, t, n),
13787
+ this.vo(_.initMessageHeaders, t, n),
13782
13788
  // Sending the custom headers we just added to request.initMessageHeaders
13783
13789
  // (Authorization, etc.) will trigger the browser to make a CORS preflight
13784
13790
  // request because the XHR will no longer meet the criteria for a "simple"
@@ -13826,13 +13832,13 @@ class __PRIVATE_RestConnection {
13826
13832
  // Note that eventually this function could go away if we are confident
13827
13833
  // enough the code is exception free.
13828
13834
  return __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.OPEN, (() => {
13829
- h || __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} transport opened.`);
13835
+ h || (__PRIVATE_logDebug(me, `RPC '${e}' stream ${r} transport opened.`), P.Vo());
13830
13836
  })), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.CLOSE, (() => {
13831
13837
  h || (h = !0, __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} transport closed`),
13832
- P.Ro());
13838
+ P.fo());
13833
13839
  })), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.ERROR, (t => {
13834
13840
  h || (h = !0, __PRIVATE_logWarn(me, `RPC '${e}' stream ${r} transport errored:`, t),
13835
- P.Ro(new FirestoreError(D.UNAVAILABLE, "The operation could not be completed")));
13841
+ P.fo(new FirestoreError(D.UNAVAILABLE, "The operation could not be completed")));
13836
13842
  })), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.MESSAGE, (t => {
13837
13843
  var n;
13838
13844
  if (!h) {
@@ -13863,8 +13869,8 @@ class __PRIVATE_RestConnection {
13863
13869
  }(t), i = o.message;
13864
13870
  void 0 === n && (n = D.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
13865
13871
  // Mark closed so no further events are propagated
13866
- h = !0, P.Ro(new FirestoreError(n, i)), c.close();
13867
- } else __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} received:`, i), P.Vo(i);
13872
+ h = !0, P.fo(new FirestoreError(n, i)), c.close();
13873
+ } else __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} received:`, i), P.po(i);
13868
13874
  }
13869
13875
  })), __PRIVATE_unguardedEventListen(o, webchannelWrapper.Event.STAT_EVENT, (t => {
13870
13876
  t.stat === webchannelWrapper.Stat.PROXY ? __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === webchannelWrapper.Stat.NOPROXY && __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} detected no buffering proxy`);
@@ -13873,7 +13879,7 @@ class __PRIVATE_RestConnection {
13873
13879
  // but because we want to send the first message with the WebChannel
13874
13880
  // handshake we pretend the channel opened here (asynchronously), and
13875
13881
  // then delay the actual open until the first message is sent.
13876
- P.Ao();
13882
+ P.mo();
13877
13883
  }), 0), P;
13878
13884
  }
13879
13885
  }
@@ -13993,10 +13999,10 @@ class __PRIVATE_ExponentialBackoff {
13993
13999
  * Note that jitter will still be applied, so the actual delay could be as
13994
14000
  * much as 1.5*maxDelayMs.
13995
14001
  */ , i = 6e4) {
13996
- this.si = e, this.timerId = t, this.Fo = n, this.Mo = r, this.xo = i, this.Oo = 0,
13997
- this.No = null,
14002
+ this.si = e, this.timerId = t, this.Oo = n, this.No = r, this.Lo = i, this.Bo = 0,
14003
+ this.ko = null,
13998
14004
  /** The last backoff attempt, as epoch milliseconds. */
13999
- this.Lo = Date.now(), this.reset();
14005
+ this.qo = Date.now(), this.reset();
14000
14006
  }
14001
14007
  /**
14002
14008
  * Resets the backoff delay.
@@ -14005,40 +14011,40 @@ class __PRIVATE_ExponentialBackoff {
14005
14011
  * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and
14006
14012
  * subsequent ones will increase according to the backoffFactor.
14007
14013
  */ reset() {
14008
- this.Oo = 0;
14014
+ this.Bo = 0;
14009
14015
  }
14010
14016
  /**
14011
14017
  * Resets the backoff delay to the maximum delay (e.g. for use after a
14012
14018
  * RESOURCE_EXHAUSTED error).
14013
- */ Bo() {
14014
- this.Oo = this.xo;
14019
+ */ Qo() {
14020
+ this.Bo = this.Lo;
14015
14021
  }
14016
14022
  /**
14017
14023
  * Returns a promise that resolves after currentDelayMs, and increases the
14018
14024
  * delay for any subsequent attempts. If there was a pending backoff operation
14019
14025
  * already, it will be canceled.
14020
- */ ko(e) {
14026
+ */ Ko(e) {
14021
14027
  // Cancel any pending backoff operation.
14022
14028
  this.cancel();
14023
14029
  // First schedule using the current base (which may be 0 and should be
14024
14030
  // honored as such).
14025
- const t = Math.floor(this.Oo + this.qo()), n = Math.max(0, Date.now() - this.Lo), r = Math.max(0, t - n);
14031
+ const t = Math.floor(this.Bo + this.$o()), n = Math.max(0, Date.now() - this.qo), r = Math.max(0, t - n);
14026
14032
  // Guard against lastAttemptTime being in the future due to a clock change.
14027
- r > 0 && __PRIVATE_logDebug("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.Oo} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),
14028
- this.No = this.si.enqueueAfterDelay(this.timerId, r, (() => (this.Lo = Date.now(),
14033
+ r > 0 && __PRIVATE_logDebug("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.Bo} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),
14034
+ this.ko = this.si.enqueueAfterDelay(this.timerId, r, (() => (this.qo = Date.now(),
14029
14035
  e()))),
14030
14036
  // Apply backoff factor to determine next delay and ensure it is within
14031
14037
  // bounds.
14032
- this.Oo *= this.Mo, this.Oo < this.Fo && (this.Oo = this.Fo), this.Oo > this.xo && (this.Oo = this.xo);
14038
+ this.Bo *= this.No, this.Bo < this.Oo && (this.Bo = this.Oo), this.Bo > this.Lo && (this.Bo = this.Lo);
14033
14039
  }
14034
- Qo() {
14035
- null !== this.No && (this.No.skipDelay(), this.No = null);
14040
+ Uo() {
14041
+ null !== this.ko && (this.ko.skipDelay(), this.ko = null);
14036
14042
  }
14037
14043
  cancel() {
14038
- null !== this.No && (this.No.cancel(), this.No = null);
14044
+ null !== this.ko && (this.ko.cancel(), this.ko = null);
14039
14045
  }
14040
- /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ qo() {
14041
- return (Math.random() - .5) * this.Oo;
14046
+ /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ $o() {
14047
+ return (Math.random() - .5) * this.Bo;
14042
14048
  }
14043
14049
  }
14044
14050
 
@@ -14092,14 +14098,14 @@ class __PRIVATE_ExponentialBackoff {
14092
14098
  */
14093
14099
  class __PRIVATE_PersistentStream {
14094
14100
  constructor(e, t, n, r, i, s, o, _) {
14095
- this.si = e, this.Ko = n, this.$o = r, this.connection = i, this.authCredentialsProvider = s,
14101
+ this.si = e, this.Wo = n, this.Go = r, this.connection = i, this.authCredentialsProvider = s,
14096
14102
  this.appCheckCredentialsProvider = o, this.listener = _, this.state = 0 /* PersistentStreamState.Initial */ ,
14097
14103
  /**
14098
14104
  * A close count that's incremented every time the stream is closed; used by
14099
14105
  * getCloseGuardedDispatcher() to invalidate callbacks that happen after
14100
14106
  * close.
14101
14107
  */
14102
- this.Uo = 0, this.Wo = null, this.Go = null, this.stream = null, this.zo = new __PRIVATE_ExponentialBackoff(e, t);
14108
+ this.zo = 0, this.jo = null, this.Ho = null, this.stream = null, this.Jo = new __PRIVATE_ExponentialBackoff(e, t);
14103
14109
  }
14104
14110
  /**
14105
14111
  * Returns true if start() has been called and no error has occurred. True
@@ -14107,13 +14113,13 @@ class __PRIVATE_PersistentStream {
14107
14113
  * encompasses respecting backoff, getting auth tokens, and starting the
14108
14114
  * actual RPC). Use isOpen() to determine if the stream is open and ready for
14109
14115
  * outbound requests.
14110
- */ jo() {
14111
- return 1 /* PersistentStreamState.Starting */ === this.state || 5 /* PersistentStreamState.Backoff */ === this.state || this.Ho();
14116
+ */ Yo() {
14117
+ return 1 /* PersistentStreamState.Starting */ === this.state || 5 /* PersistentStreamState.Backoff */ === this.state || this.Zo();
14112
14118
  }
14113
14119
  /**
14114
14120
  * Returns true if the underlying RPC is open (the onOpen() listener has been
14115
14121
  * called) and the stream is ready for outbound requests.
14116
- */ Ho() {
14122
+ */ Zo() {
14117
14123
  return 2 /* PersistentStreamState.Open */ === this.state || 3 /* PersistentStreamState.Healthy */ === this.state;
14118
14124
  }
14119
14125
  /**
@@ -14123,7 +14129,7 @@ class __PRIVATE_PersistentStream {
14123
14129
  *
14124
14130
  * When start returns, isStarted() will return true.
14125
14131
  */ start() {
14126
- 4 /* PersistentStreamState.Error */ !== this.state ? this.auth() : this.Jo();
14132
+ 4 /* PersistentStreamState.Error */ !== this.state ? this.auth() : this.Xo();
14127
14133
  }
14128
14134
  /**
14129
14135
  * Stops the RPC. This call is idempotent and allowed regardless of the
@@ -14131,7 +14137,7 @@ class __PRIVATE_PersistentStream {
14131
14137
  *
14132
14138
  * When stop returns, isStarted() and isOpen() will both return false.
14133
14139
  */ async stop() {
14134
- this.jo() && await this.close(0 /* PersistentStreamState.Initial */);
14140
+ this.Yo() && await this.close(0 /* PersistentStreamState.Initial */);
14135
14141
  }
14136
14142
  /**
14137
14143
  * After an error the stream will usually back off on the next attempt to
@@ -14140,8 +14146,8 @@ class __PRIVATE_PersistentStream {
14140
14146
  *
14141
14147
  * Each error will call the onClose() listener. That function can decide to
14142
14148
  * inhibit backoff if required.
14143
- */ Yo() {
14144
- this.state = 0 /* PersistentStreamState.Initial */ , this.zo.reset();
14149
+ */ e_() {
14150
+ this.state = 0 /* PersistentStreamState.Initial */ , this.Jo.reset();
14145
14151
  }
14146
14152
  /**
14147
14153
  * Marks this stream as idle. If no further actions are performed on the
@@ -14152,25 +14158,25 @@ class __PRIVATE_PersistentStream {
14152
14158
  *
14153
14159
  * Only streams that are in state 'Open' can be marked idle, as all other
14154
14160
  * states imply pending network operations.
14155
- */ Zo() {
14161
+ */ t_() {
14156
14162
  // Starts the idle time if we are in state 'Open' and are not yet already
14157
14163
  // running a timer (in which case the previous idle timeout still applies).
14158
- this.Ho() && null === this.Wo && (this.Wo = this.si.enqueueAfterDelay(this.Ko, 6e4, (() => this.Xo())));
14164
+ this.Zo() && null === this.jo && (this.jo = this.si.enqueueAfterDelay(this.Wo, 6e4, (() => this.n_())));
14159
14165
  }
14160
- /** Sends a message to the underlying stream. */ e_(e) {
14161
- this.t_(), this.stream.send(e);
14166
+ /** Sends a message to the underlying stream. */ r_(e) {
14167
+ this.i_(), this.stream.send(e);
14162
14168
  }
14163
- /** Called by the idle timer when the stream should close due to inactivity. */ async Xo() {
14164
- if (this.Ho())
14169
+ /** Called by the idle timer when the stream should close due to inactivity. */ async n_() {
14170
+ if (this.Zo())
14165
14171
  // When timing out an idle stream there's no reason to force the stream into backoff when
14166
14172
  // it restarts so set the stream state to Initial instead of Error.
14167
14173
  return this.close(0 /* PersistentStreamState.Initial */);
14168
14174
  }
14169
- /** Marks the stream as active again. */ t_() {
14170
- this.Wo && (this.Wo.cancel(), this.Wo = null);
14175
+ /** Marks the stream as active again. */ i_() {
14176
+ this.jo && (this.jo.cancel(), this.jo = null);
14171
14177
  }
14172
- /** Cancels the health check delayed operation. */ n_() {
14173
- this.Go && (this.Go.cancel(), this.Go = null);
14178
+ /** Cancels the health check delayed operation. */ s_() {
14179
+ this.Ho && (this.Ho.cancel(), this.Ho = null);
14174
14180
  }
14175
14181
  /**
14176
14182
  * Closes the stream and cleans up as necessary:
@@ -14186,15 +14192,15 @@ class __PRIVATE_PersistentStream {
14186
14192
  * @param error - the error the connection was closed with.
14187
14193
  */ async close(e, t) {
14188
14194
  // Cancel any outstanding timers (they're guaranteed not to execute).
14189
- this.t_(), this.n_(), this.zo.cancel(),
14195
+ this.i_(), this.s_(), this.Jo.cancel(),
14190
14196
  // Invalidates any stream-related callbacks (e.g. from auth or the
14191
14197
  // underlying stream), guaranteeing they won't execute.
14192
- this.Uo++, 4 /* PersistentStreamState.Error */ !== e ?
14198
+ this.zo++, 4 /* PersistentStreamState.Error */ !== e ?
14193
14199
  // If this is an intentional close ensure we don't delay our next connection attempt.
14194
- this.zo.reset() : t && t.code === D.RESOURCE_EXHAUSTED ? (
14200
+ this.Jo.reset() : t && t.code === D.RESOURCE_EXHAUSTED ? (
14195
14201
  // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
14196
14202
  __PRIVATE_logError(t.toString()), __PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),
14197
- this.zo.Bo()) : t && t.code === D.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
14203
+ this.Jo.Qo()) : t && t.code === D.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
14198
14204
  // "unauthenticated" error means the token was rejected. This should rarely
14199
14205
  // happen since both Auth and AppCheck ensure a sufficient TTL when we
14200
14206
  // request a token. If a user manually resets their system clock this can
@@ -14203,56 +14209,58 @@ class __PRIVATE_PersistentStream {
14203
14209
  // to ensure that we fetch a new token.
14204
14210
  this.authCredentialsProvider.invalidateToken(), this.appCheckCredentialsProvider.invalidateToken()),
14205
14211
  // Clean up the underlying stream because we are no longer interested in events.
14206
- null !== this.stream && (this.r_(), this.stream.close(), this.stream = null),
14212
+ null !== this.stream && (this.o_(), this.stream.close(), this.stream = null),
14207
14213
  // This state must be assigned before calling onClose() to allow the callback to
14208
14214
  // inhibit backoff or otherwise manipulate the state in its non-started state.
14209
14215
  this.state = e,
14210
14216
  // Notify the listener that the stream closed.
14211
- await this.listener.Io(t);
14217
+ await this.listener.Eo(t);
14212
14218
  }
14213
14219
  /**
14214
14220
  * Can be overridden to perform additional cleanup before the stream is closed.
14215
14221
  * Calling super.tearDown() is not required.
14216
- */ r_() {}
14222
+ */ o_() {}
14217
14223
  auth() {
14218
14224
  this.state = 1 /* PersistentStreamState.Starting */;
14219
- const e = this.i_(this.Uo), t = this.Uo;
14225
+ const e = this.__(this.zo), t = this.zo;
14220
14226
  // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.
14221
14227
  Promise.all([ this.authCredentialsProvider.getToken(), this.appCheckCredentialsProvider.getToken() ]).then((([e, n]) => {
14222
14228
  // Stream can be stopped while waiting for authentication.
14223
14229
  // TODO(mikelehen): We really should just use dispatchIfNotClosed
14224
14230
  // and let this dispatch onto the queue, but that opened a spec test can
14225
14231
  // of worms that I don't want to deal with in this PR.
14226
- this.Uo === t &&
14232
+ this.zo === t &&
14227
14233
  // Normally we'd have to schedule the callback on the AsyncQueue.
14228
14234
  // However, the following calls are safe to be called outside the
14229
14235
  // AsyncQueue since they don't chain asynchronous calls
14230
- this.s_(e, n);
14236
+ this.a_(e, n);
14231
14237
  }), (t => {
14232
14238
  e((() => {
14233
14239
  const e = new FirestoreError(D.UNKNOWN, "Fetching auth token failed: " + t.message);
14234
- return this.o_(e);
14240
+ return this.u_(e);
14235
14241
  }));
14236
14242
  }));
14237
14243
  }
14238
- s_(e, t) {
14239
- const n = this.i_(this.Uo);
14240
- this.stream = this.__(e, t), this.stream.ho((() => {
14241
- n((() => (this.state = 2 /* PersistentStreamState.Open */ , this.Go = this.si.enqueueAfterDelay(this.$o, 1e4, (() => (this.Ho() && (this.state = 3 /* PersistentStreamState.Healthy */),
14242
- Promise.resolve()))), this.listener.ho())));
14243
- })), this.stream.Io((e => {
14244
- n((() => this.o_(e)));
14244
+ a_(e, t) {
14245
+ const n = this.__(this.zo);
14246
+ this.stream = this.c_(e, t), this.stream.ho((() => {
14247
+ n((() => this.listener.ho()));
14248
+ })), this.stream.Io((() => {
14249
+ n((() => (this.state = 2 /* PersistentStreamState.Open */ , this.Ho = this.si.enqueueAfterDelay(this.Go, 1e4, (() => (this.Zo() && (this.state = 3 /* PersistentStreamState.Healthy */),
14250
+ Promise.resolve()))), this.listener.Io())));
14251
+ })), this.stream.Eo((e => {
14252
+ n((() => this.u_(e)));
14245
14253
  })), this.stream.onMessage((e => {
14246
14254
  n((() => this.onMessage(e)));
14247
14255
  }));
14248
14256
  }
14249
- Jo() {
14250
- this.state = 5 /* PersistentStreamState.Backoff */ , this.zo.ko((async () => {
14257
+ Xo() {
14258
+ this.state = 5 /* PersistentStreamState.Backoff */ , this.Jo.Ko((async () => {
14251
14259
  this.state = 0 /* PersistentStreamState.Initial */ , this.start();
14252
14260
  }));
14253
14261
  }
14254
14262
  // Visible for tests
14255
- o_(e) {
14263
+ u_(e) {
14256
14264
  // In theory the stream could close cleanly, however, in our current model
14257
14265
  // we never expect this to happen because if we stop a stream ourselves,
14258
14266
  // this callback will never be called. To prevent cases where we retry
@@ -14265,9 +14273,9 @@ class __PRIVATE_PersistentStream {
14265
14273
  * AsyncQueue but only runs them if closeCount remains unchanged. This allows
14266
14274
  * us to turn auth / stream callbacks into no-ops if the stream is closed /
14267
14275
  * re-opened, etc.
14268
- */ i_(e) {
14276
+ */ __(e) {
14269
14277
  return t => {
14270
- this.si.enqueueAndForget((() => this.Uo === e ? t() : (__PRIVATE_logDebug("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."),
14278
+ this.si.enqueueAndForget((() => this.zo === e ? t() : (__PRIVATE_logDebug("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."),
14271
14279
  Promise.resolve())));
14272
14280
  };
14273
14281
  }
@@ -14284,12 +14292,12 @@ class __PRIVATE_PersistentStream {
14284
14292
  super(e, "listen_stream_connection_backoff" /* TimerId.ListenStreamConnectionBackoff */ , "listen_stream_idle" /* TimerId.ListenStreamIdle */ , "health_check_timeout" /* TimerId.HealthCheckTimeout */ , t, n, r, s),
14285
14293
  this.serializer = i;
14286
14294
  }
14287
- __(e, t) {
14288
- return this.connection.vo("Listen", e, t);
14295
+ c_(e, t) {
14296
+ return this.connection.xo("Listen", e, t);
14289
14297
  }
14290
14298
  onMessage(e) {
14291
14299
  // A successful response means the stream is healthy
14292
- this.zo.reset();
14300
+ this.Jo.reset();
14293
14301
  const t = __PRIVATE_fromWatchChange(this.serializer, e), n = function __PRIVATE_versionFromListenResponse(e) {
14294
14302
  // We have only reached a consistent snapshot for the entire stream if there
14295
14303
  // is a read_time set and it applies to all targets (i.e. the list of
@@ -14298,14 +14306,14 @@ class __PRIVATE_PersistentStream {
14298
14306
  const t = e.targetChange;
14299
14307
  return t.targetIds && t.targetIds.length ? SnapshotVersion.min() : t.readTime ? __PRIVATE_fromVersion(t.readTime) : SnapshotVersion.min();
14300
14308
  }(e);
14301
- return this.listener.a_(t, n);
14309
+ return this.listener.l_(t, n);
14302
14310
  }
14303
14311
  /**
14304
14312
  * Registers interest in the results of the given target. If the target
14305
14313
  * includes a resumeToken it will be included in the request. Results that
14306
14314
  * affect the target will be streamed back as WatchChange messages that
14307
14315
  * reference the targetId.
14308
- */ u_(e) {
14316
+ */ h_(e) {
14309
14317
  const t = {};
14310
14318
  t.database = __PRIVATE_getEncodedDatabaseId(this.serializer), t.addTarget = function __PRIVATE_toTarget(e, t) {
14311
14319
  let n;
@@ -14329,15 +14337,15 @@ class __PRIVATE_PersistentStream {
14329
14337
  return n;
14330
14338
  }(this.serializer, e);
14331
14339
  const n = __PRIVATE_toListenRequestLabels(this.serializer, e);
14332
- n && (t.labels = n), this.e_(t);
14340
+ n && (t.labels = n), this.r_(t);
14333
14341
  }
14334
14342
  /**
14335
14343
  * Unregisters interest in the results of the target associated with the
14336
14344
  * given targetId.
14337
- */ c_(e) {
14345
+ */ P_(e) {
14338
14346
  const t = {};
14339
14347
  t.database = __PRIVATE_getEncodedDatabaseId(this.serializer), t.removeTarget = e,
14340
- this.e_(t);
14348
+ this.r_(t);
14341
14349
  }
14342
14350
  }
14343
14351
 
@@ -14360,55 +14368,55 @@ class __PRIVATE_PersistentStream {
14360
14368
  */ class __PRIVATE_PersistentWriteStream extends __PRIVATE_PersistentStream {
14361
14369
  constructor(e, t, n, r, i, s) {
14362
14370
  super(e, "write_stream_connection_backoff" /* TimerId.WriteStreamConnectionBackoff */ , "write_stream_idle" /* TimerId.WriteStreamIdle */ , "health_check_timeout" /* TimerId.HealthCheckTimeout */ , t, n, r, s),
14363
- this.serializer = i, this.l_ = !1;
14371
+ this.serializer = i, this.I_ = !1;
14364
14372
  }
14365
14373
  /**
14366
14374
  * Tracks whether or not a handshake has been successfully exchanged and
14367
14375
  * the stream is ready to accept mutations.
14368
- */ get h_() {
14369
- return this.l_;
14376
+ */ get T_() {
14377
+ return this.I_;
14370
14378
  }
14371
14379
  // Override of PersistentStream.start
14372
14380
  start() {
14373
- this.l_ = !1, this.lastStreamToken = void 0, super.start();
14381
+ this.I_ = !1, this.lastStreamToken = void 0, super.start();
14374
14382
  }
14375
- r_() {
14376
- this.l_ && this.P_([]);
14383
+ o_() {
14384
+ this.I_ && this.E_([]);
14377
14385
  }
14378
- __(e, t) {
14379
- return this.connection.vo("Write", e, t);
14386
+ c_(e, t) {
14387
+ return this.connection.xo("Write", e, t);
14380
14388
  }
14381
14389
  onMessage(e) {
14382
14390
  if (
14383
14391
  // Always capture the last stream token.
14384
- __PRIVATE_hardAssert(!!e.streamToken), this.lastStreamToken = e.streamToken, this.l_) {
14392
+ __PRIVATE_hardAssert(!!e.streamToken), this.lastStreamToken = e.streamToken, this.I_) {
14385
14393
  // A successful first write response means the stream is healthy,
14386
14394
  // Note, that we could consider a successful handshake healthy, however,
14387
14395
  // the write itself might be causing an error we want to back off from.
14388
- this.zo.reset();
14396
+ this.Jo.reset();
14389
14397
  const t = __PRIVATE_fromWriteResults(e.writeResults, e.commitTime), n = __PRIVATE_fromVersion(e.commitTime);
14390
- return this.listener.I_(n, t);
14398
+ return this.listener.d_(n, t);
14391
14399
  }
14392
14400
  // The first response is always the handshake response
14393
- return __PRIVATE_hardAssert(!e.writeResults || 0 === e.writeResults.length), this.l_ = !0,
14394
- this.listener.T_();
14401
+ return __PRIVATE_hardAssert(!e.writeResults || 0 === e.writeResults.length), this.I_ = !0,
14402
+ this.listener.A_();
14395
14403
  }
14396
14404
  /**
14397
14405
  * Sends an initial streamToken to the server, performing the handshake
14398
14406
  * required to make the StreamingWrite RPC work. Subsequent
14399
14407
  * calls should wait until onHandshakeComplete was called.
14400
- */ E_() {
14408
+ */ R_() {
14401
14409
  // TODO(dimond): Support stream resumption. We intentionally do not set the
14402
14410
  // stream token on the handshake, ignoring any stream token we might have.
14403
14411
  const e = {};
14404
- e.database = __PRIVATE_getEncodedDatabaseId(this.serializer), this.e_(e);
14412
+ e.database = __PRIVATE_getEncodedDatabaseId(this.serializer), this.r_(e);
14405
14413
  }
14406
- /** Sends a group of mutations to the Firestore backend to apply. */ P_(e) {
14414
+ /** Sends a group of mutations to the Firestore backend to apply. */ E_(e) {
14407
14415
  const t = {
14408
14416
  streamToken: this.lastStreamToken,
14409
14417
  writes: e.map((e => toMutation(this.serializer, e)))
14410
14418
  };
14411
- this.e_(t);
14419
+ this.r_(t);
14412
14420
  }
14413
14421
  }
14414
14422
 
@@ -14440,25 +14448,25 @@ class __PRIVATE_PersistentStream {
14440
14448
  class __PRIVATE_DatastoreImpl extends class Datastore {} {
14441
14449
  constructor(e, t, n, r) {
14442
14450
  super(), this.authCredentials = e, this.appCheckCredentials = t, this.connection = n,
14443
- this.serializer = r, this.d_ = !1;
14451
+ this.serializer = r, this.V_ = !1;
14444
14452
  }
14445
- A_() {
14446
- if (this.d_) throw new FirestoreError(D.FAILED_PRECONDITION, "The client has already been terminated.");
14453
+ m_() {
14454
+ if (this.V_) throw new FirestoreError(D.FAILED_PRECONDITION, "The client has already been terminated.");
14447
14455
  }
14448
- /** Invokes the provided RPC with auth and AppCheck tokens. */ wo(e, t, n, r) {
14449
- return this.A_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.wo(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {
14456
+ /** Invokes the provided RPC with auth and AppCheck tokens. */ Do(e, t, n, r) {
14457
+ return this.m_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.Do(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {
14450
14458
  throw "FirebaseError" === e.name ? (e.code === D.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
14451
14459
  this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(D.UNKNOWN, e.toString());
14452
14460
  }));
14453
14461
  }
14454
- /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ Co(e, t, n, r, i) {
14455
- return this.A_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, o]) => this.connection.Co(e, __PRIVATE_toResourcePath(t, n), r, s, o, i))).catch((e => {
14462
+ /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ Mo(e, t, n, r, i) {
14463
+ return this.m_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, o]) => this.connection.Mo(e, __PRIVATE_toResourcePath(t, n), r, s, o, i))).catch((e => {
14456
14464
  throw "FirebaseError" === e.name ? (e.code === D.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
14457
14465
  this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(D.UNKNOWN, e.toString());
14458
14466
  }));
14459
14467
  }
14460
14468
  terminate() {
14461
- this.d_ = !0, this.connection.terminate();
14469
+ this.V_ = !0, this.connection.terminate();
14462
14470
  }
14463
14471
  }
14464
14472
 
@@ -14466,7 +14474,7 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
14466
14474
  // firestore-exp client.
14467
14475
  async function __PRIVATE_invokeRunAggregationQueryRpc(e, t, n) {
14468
14476
  var r;
14469
- const i = __PRIVATE_debugCast(e), {request: s, R_: o, parent: _} = function __PRIVATE_toRunAggregationQueryRequest(e, t, n) {
14477
+ const i = __PRIVATE_debugCast(e), {request: s, f_: o, parent: _} = function __PRIVATE_toRunAggregationQueryRequest(e, t, n) {
14470
14478
  const {_t: r, parent: i} = __PRIVATE_toQueryTarget(e, t), s = {}, o = [];
14471
14479
  let _ = 0;
14472
14480
  return n.forEach((e => {
@@ -14496,7 +14504,7 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(e, t, n) {
14496
14504
  },
14497
14505
  parent: r.parent
14498
14506
  },
14499
- R_: s,
14507
+ f_: s,
14500
14508
  parent: i
14501
14509
  };
14502
14510
  }(i.serializer, function __PRIVATE_queryToAggregateTarget(e) {
@@ -14505,8 +14513,8 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(e, t, n) {
14505
14513
  // Do not include implicit order-bys for aggregate queries.
14506
14514
  t.he = __PRIVATE__queryToTarget(t, e.explicitOrderBy)), t.he;
14507
14515
  }(t), n);
14508
- i.connection.yo || delete s.parent;
14509
- const a = (await i.Co("RunAggregationQuery", i.serializer.databaseId, _, s,
14516
+ i.connection.bo || delete s.parent;
14517
+ const a = (await i.Mo("RunAggregationQuery", i.serializer.databaseId, _, s,
14510
14518
  /*expectedResponseCount=*/ 1)).filter((e => !!e.result));
14511
14519
  // Omit RunAggregationQueryResponse that only contain readTimes.
14512
14520
  __PRIVATE_hardAssert(1 === a.length);
@@ -14538,19 +14546,19 @@ class __PRIVATE_OnlineStateTracker {
14538
14546
  * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to
14539
14547
  * Offline.
14540
14548
  */
14541
- this.V_ = 0,
14549
+ this.g_ = 0,
14542
14550
  /**
14543
14551
  * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we
14544
14552
  * transition from OnlineState.Unknown to OnlineState.Offline without waiting
14545
14553
  * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times).
14546
14554
  */
14547
- this.m_ = null,
14555
+ this.p_ = null,
14548
14556
  /**
14549
14557
  * Whether the client should log a warning message if it fails to connect to
14550
14558
  * the backend (initially true, cleared after a successful stream, or if we've
14551
14559
  * logged the message already).
14552
14560
  */
14553
- this.f_ = !0;
14561
+ this.y_ = !0;
14554
14562
  }
14555
14563
  /**
14556
14564
  * Called by RemoteStore when a watch stream is started (including on each
@@ -14558,9 +14566,9 @@ class __PRIVATE_OnlineStateTracker {
14558
14566
  *
14559
14567
  * If this is the first attempt, it sets the OnlineState to Unknown and starts
14560
14568
  * the onlineStateTimer.
14561
- */ g_() {
14562
- 0 === this.V_ && (this.p_("Unknown" /* OnlineState.Unknown */), this.m_ = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* TimerId.OnlineStateTimeout */ , 1e4, (() => (this.m_ = null,
14563
- this.y_("Backend didn't respond within 10 seconds."), this.p_("Offline" /* OnlineState.Offline */),
14569
+ */ w_() {
14570
+ 0 === this.g_ && (this.S_("Unknown" /* OnlineState.Unknown */), this.p_ = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* TimerId.OnlineStateTimeout */ , 1e4, (() => (this.p_ = null,
14571
+ this.b_("Backend didn't respond within 10 seconds."), this.S_("Offline" /* OnlineState.Offline */),
14564
14572
  Promise.resolve()))));
14565
14573
  }
14566
14574
  /**
@@ -14568,10 +14576,10 @@ class __PRIVATE_OnlineStateTracker {
14568
14576
  * failure. The first failure moves us to the 'Unknown' state. We then may
14569
14577
  * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we
14570
14578
  * actually transition to the 'Offline' state.
14571
- */ w_(e) {
14572
- "Online" /* OnlineState.Online */ === this.state ? this.p_("Unknown" /* OnlineState.Unknown */) : (this.V_++,
14573
- this.V_ >= 1 && (this.S_(), this.y_(`Connection failed 1 times. Most recent error: ${e.toString()}`),
14574
- this.p_("Offline" /* OnlineState.Offline */)));
14579
+ */ D_(e) {
14580
+ "Online" /* OnlineState.Online */ === this.state ? this.S_("Unknown" /* OnlineState.Unknown */) : (this.g_++,
14581
+ this.g_ >= 1 && (this.C_(), this.b_(`Connection failed 1 times. Most recent error: ${e.toString()}`),
14582
+ this.S_("Offline" /* OnlineState.Offline */)));
14575
14583
  }
14576
14584
  /**
14577
14585
  * Explicitly sets the OnlineState to the specified state.
@@ -14580,20 +14588,20 @@ class __PRIVATE_OnlineStateTracker {
14580
14588
  * Offline heuristics, so must not be used in place of
14581
14589
  * handleWatchStreamStart() and handleWatchStreamFailure().
14582
14590
  */ set(e) {
14583
- this.S_(), this.V_ = 0, "Online" /* OnlineState.Online */ === e && (
14591
+ this.C_(), this.g_ = 0, "Online" /* OnlineState.Online */ === e && (
14584
14592
  // We've connected to watch at least once. Don't warn the developer
14585
14593
  // about being offline going forward.
14586
- this.f_ = !1), this.p_(e);
14594
+ this.y_ = !1), this.S_(e);
14587
14595
  }
14588
- p_(e) {
14596
+ S_(e) {
14589
14597
  e !== this.state && (this.state = e, this.onlineStateHandler(e));
14590
14598
  }
14591
- y_(e) {
14599
+ b_(e) {
14592
14600
  const t = `Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;
14593
- this.f_ ? (__PRIVATE_logError(t), this.f_ = !1) : __PRIVATE_logDebug("OnlineStateTracker", t);
14601
+ this.y_ ? (__PRIVATE_logError(t), this.y_ = !1) : __PRIVATE_logDebug("OnlineStateTracker", t);
14594
14602
  }
14595
- S_() {
14596
- null !== this.m_ && (this.m_.cancel(), this.m_ = null);
14603
+ C_() {
14604
+ null !== this.p_ && (this.p_.cancel(), this.p_ = null);
14597
14605
  }
14598
14606
  }
14599
14607
 
@@ -14638,7 +14646,7 @@ class __PRIVATE_OnlineStateTracker {
14638
14646
  * purely based on order, and so we can just shift() writes from the front of
14639
14647
  * the writePipeline as we receive responses.
14640
14648
  */
14641
- this.b_ = [],
14649
+ this.v_ = [],
14642
14650
  /**
14643
14651
  * A mapping of watched targets that the client cares about tracking and the
14644
14652
  * user has explicitly called a 'listen' for this target.
@@ -14648,12 +14656,12 @@ class __PRIVATE_OnlineStateTracker {
14648
14656
  * to the server. The targets removed with unlistens are removed eagerly
14649
14657
  * without waiting for confirmation from the listen stream.
14650
14658
  */
14651
- this.D_ = new Map,
14659
+ this.F_ = new Map,
14652
14660
  /**
14653
14661
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14654
14662
  * RemoteStore may start its network connections.
14655
14663
  */
14656
- this.C_ = new Set,
14664
+ this.M_ = new Set,
14657
14665
  /**
14658
14666
  * Event handlers that get called when the network is disabled or enabled.
14659
14667
  *
@@ -14661,7 +14669,7 @@ class __PRIVATE_OnlineStateTracker {
14661
14669
  * underlying streams (to support tree-shakeable streams). On Android and iOS,
14662
14670
  * the streams are created during construction of RemoteStore.
14663
14671
  */
14664
- this.v_ = [], this.F_ = i, this.F_.ro((e => {
14672
+ this.x_ = [], this.O_ = i, this.O_.ro((e => {
14665
14673
  n.enqueueAndForget((async () => {
14666
14674
  // Porting Note: Unlike iOS, `restartNetwork()` is called even when the
14667
14675
  // network becomes unreachable as we don't have any other way to tear
@@ -14669,24 +14677,24 @@ class __PRIVATE_OnlineStateTracker {
14669
14677
  __PRIVATE_canUseNetwork(this) && (__PRIVATE_logDebug("RemoteStore", "Restarting streams for network reachability change."),
14670
14678
  await async function __PRIVATE_restartNetwork(e) {
14671
14679
  const t = __PRIVATE_debugCast(e);
14672
- t.C_.add(4 /* OfflineCause.ConnectivityChange */), await __PRIVATE_disableNetworkInternal(t),
14673
- t.M_.set("Unknown" /* OnlineState.Unknown */), t.C_.delete(4 /* OfflineCause.ConnectivityChange */),
14680
+ t.M_.add(4 /* OfflineCause.ConnectivityChange */), await __PRIVATE_disableNetworkInternal(t),
14681
+ t.N_.set("Unknown" /* OnlineState.Unknown */), t.M_.delete(4 /* OfflineCause.ConnectivityChange */),
14674
14682
  await __PRIVATE_enableNetworkInternal(t);
14675
14683
  }(this));
14676
14684
  }));
14677
- })), this.M_ = new __PRIVATE_OnlineStateTracker(n, r);
14685
+ })), this.N_ = new __PRIVATE_OnlineStateTracker(n, r);
14678
14686
  }
14679
14687
  }
14680
14688
 
14681
14689
  async function __PRIVATE_enableNetworkInternal(e) {
14682
- if (__PRIVATE_canUseNetwork(e)) for (const t of e.v_) await t(/* enabled= */ !0);
14690
+ if (__PRIVATE_canUseNetwork(e)) for (const t of e.x_) await t(/* enabled= */ !0);
14683
14691
  }
14684
14692
 
14685
14693
  /**
14686
14694
  * Temporarily disables the network. The network can be re-enabled using
14687
14695
  * enableNetwork().
14688
14696
  */ async function __PRIVATE_disableNetworkInternal(e) {
14689
- for (const t of e.v_) await t(/* enabled= */ !1);
14697
+ for (const t of e.x_) await t(/* enabled= */ !1);
14690
14698
  }
14691
14699
 
14692
14700
  /**
@@ -14695,11 +14703,11 @@ async function __PRIVATE_enableNetworkInternal(e) {
14695
14703
  */
14696
14704
  function __PRIVATE_remoteStoreListen(e, t) {
14697
14705
  const n = __PRIVATE_debugCast(e);
14698
- n.D_.has(t.targetId) || (
14706
+ n.F_.has(t.targetId) || (
14699
14707
  // Mark this as something the client is currently listening for.
14700
- n.D_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14708
+ n.F_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14701
14709
  // The listen will be sent in onWatchStreamOpen
14702
- __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).Ho() && __PRIVATE_sendWatchRequest(n, t));
14710
+ __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).Zo() && __PRIVATE_sendWatchRequest(n, t));
14703
14711
  }
14704
14712
 
14705
14713
  /**
@@ -14707,22 +14715,22 @@ function __PRIVATE_remoteStoreListen(e, t) {
14707
14715
  * not being listened to.
14708
14716
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14709
14717
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14710
- n.D_.delete(t), r.Ho() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.D_.size && (r.Ho() ? r.Zo() : __PRIVATE_canUseNetwork(n) &&
14718
+ n.F_.delete(t), r.Zo() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.F_.size && (r.Zo() ? r.t_() : __PRIVATE_canUseNetwork(n) &&
14711
14719
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14712
14720
  // have no listeners, since without any listens to send we cannot
14713
14721
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
14714
- n.M_.set("Unknown" /* OnlineState.Unknown */));
14722
+ n.N_.set("Unknown" /* OnlineState.Unknown */));
14715
14723
  }
14716
14724
 
14717
14725
  /**
14718
14726
  * We need to increment the the expected number of pending responses we're due
14719
14727
  * from watch so we wait for the ack to process any messages from this target.
14720
14728
  */ function __PRIVATE_sendWatchRequest(e, t) {
14721
- if (e.x_.xe(t.targetId), t.resumeToken.approximateByteSize() > 0 || t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
14729
+ if (e.L_.xe(t.targetId), t.resumeToken.approximateByteSize() > 0 || t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
14722
14730
  const n = e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;
14723
14731
  t = t.withExpectedCount(n);
14724
14732
  }
14725
- __PRIVATE_ensureWatchStream(e).u_(t);
14733
+ __PRIVATE_ensureWatchStream(e).h_(t);
14726
14734
  }
14727
14735
 
14728
14736
  /**
@@ -14730,34 +14738,39 @@ function __PRIVATE_remoteStoreListen(e, t) {
14730
14738
  * from watch so we wait for the removal on the server before we process any
14731
14739
  * messages from this target.
14732
14740
  */ function __PRIVATE_sendUnwatchRequest(e, t) {
14733
- e.x_.xe(t), __PRIVATE_ensureWatchStream(e).c_(t);
14741
+ e.L_.xe(t), __PRIVATE_ensureWatchStream(e).P_(t);
14734
14742
  }
14735
14743
 
14736
14744
  function __PRIVATE_startWatchStream(e) {
14737
- e.x_ = new __PRIVATE_WatchChangeAggregator({
14745
+ e.L_ = new __PRIVATE_WatchChangeAggregator({
14738
14746
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14739
- ot: t => e.D_.get(t) || null,
14747
+ ot: t => e.F_.get(t) || null,
14740
14748
  tt: () => e.datastore.serializer.databaseId
14741
- }), __PRIVATE_ensureWatchStream(e).start(), e.M_.g_();
14749
+ }), __PRIVATE_ensureWatchStream(e).start(), e.N_.w_();
14742
14750
  }
14743
14751
 
14744
14752
  /**
14745
14753
  * Returns whether the watch stream should be started because it's necessary
14746
14754
  * and has not yet been started.
14747
14755
  */ function __PRIVATE_shouldStartWatchStream(e) {
14748
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).jo() && e.D_.size > 0;
14756
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).Yo() && e.F_.size > 0;
14749
14757
  }
14750
14758
 
14751
14759
  function __PRIVATE_canUseNetwork(e) {
14752
- return 0 === __PRIVATE_debugCast(e).C_.size;
14760
+ return 0 === __PRIVATE_debugCast(e).M_.size;
14753
14761
  }
14754
14762
 
14755
14763
  function __PRIVATE_cleanUpWatchStreamState(e) {
14756
- e.x_ = void 0;
14764
+ e.L_ = void 0;
14765
+ }
14766
+
14767
+ async function __PRIVATE_onWatchStreamConnected(e) {
14768
+ // Mark the client as online since we got a "connected" notification.
14769
+ e.N_.set("Online" /* OnlineState.Online */);
14757
14770
  }
14758
14771
 
14759
14772
  async function __PRIVATE_onWatchStreamOpen(e) {
14760
- e.D_.forEach(((t, n) => {
14773
+ e.F_.forEach(((t, n) => {
14761
14774
  __PRIVATE_sendWatchRequest(e, t);
14762
14775
  }));
14763
14776
  }
@@ -14765,17 +14778,17 @@ async function __PRIVATE_onWatchStreamOpen(e) {
14765
14778
  async function __PRIVATE_onWatchStreamClose(e, t) {
14766
14779
  __PRIVATE_cleanUpWatchStreamState(e),
14767
14780
  // If we still need the watch stream, retry the connection.
14768
- __PRIVATE_shouldStartWatchStream(e) ? (e.M_.w_(t), __PRIVATE_startWatchStream(e)) :
14781
+ __PRIVATE_shouldStartWatchStream(e) ? (e.N_.D_(t), __PRIVATE_startWatchStream(e)) :
14769
14782
  // No need to restart watch stream because there are no active targets.
14770
14783
  // The online state is set to unknown because there is no active attempt
14771
14784
  // at establishing a connection
14772
- e.M_.set("Unknown" /* OnlineState.Unknown */);
14785
+ e.N_.set("Unknown" /* OnlineState.Unknown */);
14773
14786
  }
14774
14787
 
14775
14788
  async function __PRIVATE_onWatchStreamChange(e, t, n) {
14776
14789
  if (
14777
14790
  // Mark the client as online since we got a message from the server
14778
- e.M_.set("Online" /* OnlineState.Online */), t instanceof __PRIVATE_WatchTargetChange && 2 /* WatchTargetChangeState.Removed */ === t.state && t.cause)
14791
+ e.N_.set("Online" /* OnlineState.Online */), t instanceof __PRIVATE_WatchTargetChange && 2 /* WatchTargetChangeState.Removed */ === t.state && t.cause)
14779
14792
  // There was an error on a target, don't wait for a consistent snapshot
14780
14793
  // to raise events
14781
14794
  try {
@@ -14785,7 +14798,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14785
14798
  const n = t.cause;
14786
14799
  for (const r of t.targetIds)
14787
14800
  // A watched target might have been removed already.
14788
- e.D_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.D_.delete(r), e.x_.removeTarget(r));
14801
+ e.F_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.F_.delete(r), e.L_.removeTarget(r));
14789
14802
  }
14790
14803
  /**
14791
14804
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -14798,7 +14811,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14798
14811
  } catch (n) {
14799
14812
  __PRIVATE_logDebug("RemoteStore", "Failed to remove targets %s: %s ", t.targetIds.join(","), n),
14800
14813
  await __PRIVATE_disableNetworkUntilRecovery(e, n);
14801
- } else if (t instanceof __PRIVATE_DocumentWatchChange ? e.x_.Ke(t) : t instanceof __PRIVATE_ExistenceFilterChange ? e.x_.He(t) : e.x_.We(t),
14814
+ } else if (t instanceof __PRIVATE_DocumentWatchChange ? e.L_.Ke(t) : t instanceof __PRIVATE_ExistenceFilterChange ? e.L_.He(t) : e.L_.We(t),
14802
14815
  !n.isEqual(SnapshotVersion.min())) try {
14803
14816
  const t = await __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore);
14804
14817
  n.compareTo(t) >= 0 &&
@@ -14811,26 +14824,26 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14811
14824
  * SyncEngine.
14812
14825
  */
14813
14826
  function __PRIVATE_raiseWatchSnapshot(e, t) {
14814
- const n = e.x_.rt(t);
14827
+ const n = e.L_.rt(t);
14815
14828
  // Update in-memory resume tokens. LocalStore will update the
14816
14829
  // persistent view of these when applying the completed RemoteEvent.
14817
14830
  return n.targetChanges.forEach(((n, r) => {
14818
14831
  if (n.resumeToken.approximateByteSize() > 0) {
14819
- const i = e.D_.get(r);
14832
+ const i = e.F_.get(r);
14820
14833
  // A watched target might have been removed already.
14821
- i && e.D_.set(r, i.withResumeToken(n.resumeToken, t));
14834
+ i && e.F_.set(r, i.withResumeToken(n.resumeToken, t));
14822
14835
  }
14823
14836
  })),
14824
14837
  // Re-establish listens for the targets that have been invalidated by
14825
14838
  // existence filter mismatches.
14826
14839
  n.targetMismatches.forEach(((t, n) => {
14827
- const r = e.D_.get(t);
14840
+ const r = e.F_.get(t);
14828
14841
  if (!r)
14829
14842
  // A watched target might have been removed already.
14830
14843
  return;
14831
14844
  // Clear the resume token for the target, since we're in a known mismatch
14832
14845
  // state.
14833
- e.D_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
14846
+ e.F_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
14834
14847
  // Cause a hard reset by unwatching and rewatching immediately, but
14835
14848
  // deliberately don't send a resume token so that we get a full update.
14836
14849
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -14857,9 +14870,9 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14857
14870
  * any retry attempt.
14858
14871
  */ async function __PRIVATE_disableNetworkUntilRecovery(e, t, n) {
14859
14872
  if (!__PRIVATE_isIndexedDbTransactionError(t)) throw t;
14860
- e.C_.add(1 /* OfflineCause.IndexedDbFailed */),
14873
+ e.M_.add(1 /* OfflineCause.IndexedDbFailed */),
14861
14874
  // Disable network and raise offline snapshots
14862
- await __PRIVATE_disableNetworkInternal(e), e.M_.set("Offline" /* OnlineState.Offline */),
14875
+ await __PRIVATE_disableNetworkInternal(e), e.N_.set("Offline" /* OnlineState.Offline */),
14863
14876
  n || (
14864
14877
  // Use a simple read operation to determine if IndexedDB recovered.
14865
14878
  // Ideally, we would expose a health check directly on SimpleDb, but
@@ -14867,7 +14880,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14867
14880
  n = () => __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore)),
14868
14881
  // Probe IndexedDB periodically and re-enable network
14869
14882
  e.asyncQueue.enqueueRetryable((async () => {
14870
- __PRIVATE_logDebug("RemoteStore", "Retrying IndexedDB access"), await n(), e.C_.delete(1 /* OfflineCause.IndexedDbFailed */),
14883
+ __PRIVATE_logDebug("RemoteStore", "Retrying IndexedDB access"), await n(), e.M_.delete(1 /* OfflineCause.IndexedDbFailed */),
14871
14884
  await __PRIVATE_enableNetworkInternal(e);
14872
14885
  }));
14873
14886
  }
@@ -14881,11 +14894,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
14881
14894
 
14882
14895
  async function __PRIVATE_fillWritePipeline(e) {
14883
14896
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
14884
- let r = t.b_.length > 0 ? t.b_[t.b_.length - 1].batchId : -1;
14897
+ let r = t.v_.length > 0 ? t.v_[t.v_.length - 1].batchId : -1;
14885
14898
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
14886
14899
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
14887
14900
  if (null === e) {
14888
- 0 === t.b_.length && n.Zo();
14901
+ 0 === t.v_.length && n.t_();
14889
14902
  break;
14890
14903
  }
14891
14904
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -14899,20 +14912,20 @@ async function __PRIVATE_fillWritePipeline(e) {
14899
14912
  * Returns true if we can add to the write pipeline (i.e. the network is
14900
14913
  * enabled and the write pipeline is not full).
14901
14914
  */ function __PRIVATE_canAddToWritePipeline(e) {
14902
- return __PRIVATE_canUseNetwork(e) && e.b_.length < 10;
14915
+ return __PRIVATE_canUseNetwork(e) && e.v_.length < 10;
14903
14916
  }
14904
14917
 
14905
14918
  /**
14906
14919
  * Queues additional writes to be sent to the write stream, sending them
14907
14920
  * immediately if the write stream is established.
14908
14921
  */ function __PRIVATE_addToWritePipeline(e, t) {
14909
- e.b_.push(t);
14922
+ e.v_.push(t);
14910
14923
  const n = __PRIVATE_ensureWriteStream(e);
14911
- n.Ho() && n.h_ && n.P_(t.mutations);
14924
+ n.Zo() && n.T_ && n.E_(t.mutations);
14912
14925
  }
14913
14926
 
14914
14927
  function __PRIVATE_shouldStartWriteStream(e) {
14915
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).jo() && e.b_.length > 0;
14928
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).Yo() && e.v_.length > 0;
14916
14929
  }
14917
14930
 
14918
14931
  function __PRIVATE_startWriteStream(e) {
@@ -14920,17 +14933,17 @@ function __PRIVATE_startWriteStream(e) {
14920
14933
  }
14921
14934
 
14922
14935
  async function __PRIVATE_onWriteStreamOpen(e) {
14923
- __PRIVATE_ensureWriteStream(e).E_();
14936
+ __PRIVATE_ensureWriteStream(e).R_();
14924
14937
  }
14925
14938
 
14926
14939
  async function __PRIVATE_onWriteHandshakeComplete(e) {
14927
14940
  const t = __PRIVATE_ensureWriteStream(e);
14928
14941
  // Send the write pipeline now that the stream is established.
14929
- for (const n of e.b_) t.P_(n.mutations);
14942
+ for (const n of e.v_) t.E_(n.mutations);
14930
14943
  }
14931
14944
 
14932
14945
  async function __PRIVATE_onMutationResult(e, t, n) {
14933
- const r = e.b_.shift(), i = MutationBatchResult.from(r, t, n);
14946
+ const r = e.v_.shift(), i = MutationBatchResult.from(r, t, n);
14934
14947
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
14935
14948
  // It's possible that with the completion of this mutation another
14936
14949
  // slot has freed up.
@@ -14940,7 +14953,7 @@ async function __PRIVATE_onMutationResult(e, t, n) {
14940
14953
  async function __PRIVATE_onWriteStreamClose(e, t) {
14941
14954
  // If the write stream closed after the write handshake completes, a write
14942
14955
  // operation failed and we fail the pending operation.
14943
- t && __PRIVATE_ensureWriteStream(e).h_ &&
14956
+ t && __PRIVATE_ensureWriteStream(e).T_ &&
14944
14957
  // This error affects the actual write.
14945
14958
  await async function __PRIVATE_handleWriteError(e, t) {
14946
14959
  // Only handle permanent errors here. If it's transient, just let the retry
@@ -14950,11 +14963,11 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
14950
14963
  }(t.code)) {
14951
14964
  // This was a permanent error, the request itself was the problem
14952
14965
  // so it's not going to succeed if we resend it.
14953
- const n = e.b_.shift();
14966
+ const n = e.v_.shift();
14954
14967
  // In this case it's also unlikely that the server itself is melting
14955
14968
  // down -- this was just a bad request so inhibit backoff on the next
14956
14969
  // restart.
14957
- __PRIVATE_ensureWriteStream(e).Yo(), await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.rejectFailedWrite(n.batchId, t))),
14970
+ __PRIVATE_ensureWriteStream(e).e_(), await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.rejectFailedWrite(n.batchId, t))),
14958
14971
  // It's possible that with the completion of this mutation
14959
14972
  // another slot has freed up.
14960
14973
  await __PRIVATE_fillWritePipeline(e);
@@ -14972,19 +14985,19 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
14972
14985
  // Tear down and re-create our network streams. This will ensure we get a
14973
14986
  // fresh auth token for the new user and re-fill the write pipeline with
14974
14987
  // new mutations from the LocalStore (since mutations are per-user).
14975
- n.C_.add(3 /* OfflineCause.CredentialChange */), await __PRIVATE_disableNetworkInternal(n),
14988
+ n.M_.add(3 /* OfflineCause.CredentialChange */), await __PRIVATE_disableNetworkInternal(n),
14976
14989
  r &&
14977
14990
  // Don't set the network status to Unknown if we are offline.
14978
- n.M_.set("Unknown" /* OnlineState.Unknown */), await n.remoteSyncer.handleCredentialChange(t),
14979
- n.C_.delete(3 /* OfflineCause.CredentialChange */), await __PRIVATE_enableNetworkInternal(n);
14991
+ n.N_.set("Unknown" /* OnlineState.Unknown */), await n.remoteSyncer.handleCredentialChange(t),
14992
+ n.M_.delete(3 /* OfflineCause.CredentialChange */), await __PRIVATE_enableNetworkInternal(n);
14980
14993
  }
14981
14994
 
14982
14995
  /**
14983
14996
  * Toggles the network state when the client gains or loses its primary lease.
14984
14997
  */ async function __PRIVATE_remoteStoreApplyPrimaryState(e, t) {
14985
14998
  const n = __PRIVATE_debugCast(e);
14986
- t ? (n.C_.delete(2 /* OfflineCause.IsSecondary */), await __PRIVATE_enableNetworkInternal(n)) : t || (n.C_.add(2 /* OfflineCause.IsSecondary */),
14987
- await __PRIVATE_disableNetworkInternal(n), n.M_.set("Unknown" /* OnlineState.Unknown */));
14999
+ t ? (n.M_.delete(2 /* OfflineCause.IsSecondary */), await __PRIVATE_enableNetworkInternal(n)) : t || (n.M_.add(2 /* OfflineCause.IsSecondary */),
15000
+ await __PRIVATE_disableNetworkInternal(n), n.N_.set("Unknown" /* OnlineState.Unknown */));
14988
15001
  }
14989
15002
 
14990
15003
  /**
@@ -14995,11 +15008,11 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
14995
15008
  * PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.
14996
15009
  * This is not done on Web to allow it to be tree-shaken.
14997
15010
  */ function __PRIVATE_ensureWatchStream(e) {
14998
- return e.O_ || (
15011
+ return e.B_ || (
14999
15012
  // Create stream (but note that it is not started yet).
15000
- e.O_ = function __PRIVATE_newPersistentWatchStream(e, t, n) {
15013
+ e.B_ = function __PRIVATE_newPersistentWatchStream(e, t, n) {
15001
15014
  const r = __PRIVATE_debugCast(e);
15002
- return r.A_(), new __PRIVATE_PersistentListenStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);
15015
+ return r.m_(), new __PRIVATE_PersistentListenStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);
15003
15016
  }
15004
15017
  /**
15005
15018
  * @license
@@ -15017,13 +15030,14 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15017
15030
  * See the License for the specific language governing permissions and
15018
15031
  * limitations under the License.
15019
15032
  */ (e.datastore, e.asyncQueue, {
15020
- ho: __PRIVATE_onWatchStreamOpen.bind(null, e),
15021
- Io: __PRIVATE_onWatchStreamClose.bind(null, e),
15022
- a_: __PRIVATE_onWatchStreamChange.bind(null, e)
15023
- }), e.v_.push((async t => {
15024
- t ? (e.O_.Yo(), __PRIVATE_shouldStartWatchStream(e) ? __PRIVATE_startWatchStream(e) : e.M_.set("Unknown" /* OnlineState.Unknown */)) : (await e.O_.stop(),
15033
+ ho: __PRIVATE_onWatchStreamConnected.bind(null, e),
15034
+ Io: __PRIVATE_onWatchStreamOpen.bind(null, e),
15035
+ Eo: __PRIVATE_onWatchStreamClose.bind(null, e),
15036
+ l_: __PRIVATE_onWatchStreamChange.bind(null, e)
15037
+ }), e.x_.push((async t => {
15038
+ t ? (e.B_.e_(), __PRIVATE_shouldStartWatchStream(e) ? __PRIVATE_startWatchStream(e) : e.N_.set("Unknown" /* OnlineState.Unknown */)) : (await e.B_.stop(),
15025
15039
  __PRIVATE_cleanUpWatchStreamState(e));
15026
- }))), e.O_;
15040
+ }))), e.B_;
15027
15041
  }
15028
15042
 
15029
15043
  /**
@@ -15034,22 +15048,23 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15034
15048
  * PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup.
15035
15049
  * This is not done on Web to allow it to be tree-shaken.
15036
15050
  */ function __PRIVATE_ensureWriteStream(e) {
15037
- return e.N_ || (
15051
+ return e.k_ || (
15038
15052
  // Create stream (but note that it is not started yet).
15039
- e.N_ = function __PRIVATE_newPersistentWriteStream(e, t, n) {
15053
+ e.k_ = function __PRIVATE_newPersistentWriteStream(e, t, n) {
15040
15054
  const r = __PRIVATE_debugCast(e);
15041
- return r.A_(), new __PRIVATE_PersistentWriteStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);
15055
+ return r.m_(), new __PRIVATE_PersistentWriteStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);
15042
15056
  }(e.datastore, e.asyncQueue, {
15043
- ho: __PRIVATE_onWriteStreamOpen.bind(null, e),
15044
- Io: __PRIVATE_onWriteStreamClose.bind(null, e),
15045
- T_: __PRIVATE_onWriteHandshakeComplete.bind(null, e),
15046
- I_: __PRIVATE_onMutationResult.bind(null, e)
15047
- }), e.v_.push((async t => {
15048
- t ? (e.N_.Yo(),
15057
+ ho: () => Promise.resolve(),
15058
+ Io: __PRIVATE_onWriteStreamOpen.bind(null, e),
15059
+ Eo: __PRIVATE_onWriteStreamClose.bind(null, e),
15060
+ A_: __PRIVATE_onWriteHandshakeComplete.bind(null, e),
15061
+ d_: __PRIVATE_onMutationResult.bind(null, e)
15062
+ }), e.x_.push((async t => {
15063
+ t ? (e.k_.e_(),
15049
15064
  // This will start the write stream if necessary.
15050
- await __PRIVATE_fillWritePipeline(e)) : (await e.N_.stop(), e.b_.length > 0 && (__PRIVATE_logDebug("RemoteStore", `Stopping write stream with ${e.b_.length} pending writes`),
15051
- e.b_ = []));
15052
- }))), e.N_;
15065
+ await __PRIVATE_fillWritePipeline(e)) : (await e.k_.stop(), e.v_.length > 0 && (__PRIVATE_logDebug("RemoteStore", `Stopping write stream with ${e.v_.length} pending writes`),
15066
+ e.v_ = []));
15067
+ }))), e.k_;
15053
15068
  }
15054
15069
 
15055
15070
  /**
@@ -15262,25 +15277,25 @@ class DelayedOperation {
15262
15277
  * duplicate events for the same doc.
15263
15278
  */ class __PRIVATE_DocumentChangeSet {
15264
15279
  constructor() {
15265
- this.L_ = new SortedMap(DocumentKey.comparator);
15280
+ this.q_ = new SortedMap(DocumentKey.comparator);
15266
15281
  }
15267
15282
  track(e) {
15268
- const t = e.doc.key, n = this.L_.get(t);
15283
+ const t = e.doc.key, n = this.q_.get(t);
15269
15284
  n ?
15270
15285
  // Merge the new change with the existing change.
15271
- 0 /* ChangeType.Added */ !== e.type && 3 /* ChangeType.Metadata */ === n.type ? this.L_ = this.L_.insert(t, e) : 3 /* ChangeType.Metadata */ === e.type && 1 /* ChangeType.Removed */ !== n.type ? this.L_ = this.L_.insert(t, {
15286
+ 0 /* ChangeType.Added */ !== e.type && 3 /* ChangeType.Metadata */ === n.type ? this.q_ = this.q_.insert(t, e) : 3 /* ChangeType.Metadata */ === e.type && 1 /* ChangeType.Removed */ !== n.type ? this.q_ = this.q_.insert(t, {
15272
15287
  type: n.type,
15273
15288
  doc: e.doc
15274
- }) : 2 /* ChangeType.Modified */ === e.type && 2 /* ChangeType.Modified */ === n.type ? this.L_ = this.L_.insert(t, {
15289
+ }) : 2 /* ChangeType.Modified */ === e.type && 2 /* ChangeType.Modified */ === n.type ? this.q_ = this.q_.insert(t, {
15275
15290
  type: 2 /* ChangeType.Modified */ ,
15276
15291
  doc: e.doc
15277
- }) : 2 /* ChangeType.Modified */ === e.type && 0 /* ChangeType.Added */ === n.type ? this.L_ = this.L_.insert(t, {
15292
+ }) : 2 /* ChangeType.Modified */ === e.type && 0 /* ChangeType.Added */ === n.type ? this.q_ = this.q_.insert(t, {
15278
15293
  type: 0 /* ChangeType.Added */ ,
15279
15294
  doc: e.doc
15280
- }) : 1 /* ChangeType.Removed */ === e.type && 0 /* ChangeType.Added */ === n.type ? this.L_ = this.L_.remove(t) : 1 /* ChangeType.Removed */ === e.type && 2 /* ChangeType.Modified */ === n.type ? this.L_ = this.L_.insert(t, {
15295
+ }) : 1 /* ChangeType.Removed */ === e.type && 0 /* ChangeType.Added */ === n.type ? this.q_ = this.q_.remove(t) : 1 /* ChangeType.Removed */ === e.type && 2 /* ChangeType.Modified */ === n.type ? this.q_ = this.q_.insert(t, {
15281
15296
  type: 1 /* ChangeType.Removed */ ,
15282
15297
  doc: n.doc
15283
- }) : 0 /* ChangeType.Added */ === e.type && 1 /* ChangeType.Removed */ === n.type ? this.L_ = this.L_.insert(t, {
15298
+ }) : 0 /* ChangeType.Added */ === e.type && 1 /* ChangeType.Removed */ === n.type ? this.q_ = this.q_.insert(t, {
15284
15299
  type: 2 /* ChangeType.Modified */ ,
15285
15300
  doc: e.doc
15286
15301
  }) :
@@ -15291,11 +15306,11 @@ class DelayedOperation {
15291
15306
  // Removed->Modified
15292
15307
  // Metadata->Added
15293
15308
  // Removed->Metadata
15294
- fail() : this.L_ = this.L_.insert(t, e);
15309
+ fail() : this.q_ = this.q_.insert(t, e);
15295
15310
  }
15296
- B_() {
15311
+ Q_() {
15297
15312
  const e = [];
15298
- return this.L_.inorderTraversal(((t, n) => {
15313
+ return this.q_.inorderTraversal(((t, n) => {
15299
15314
  e.push(n);
15300
15315
  })), e;
15301
15316
  }
@@ -15351,18 +15366,18 @@ class ViewSnapshot {
15351
15366
  * tracked by EventManager.
15352
15367
  */ class __PRIVATE_QueryListenersInfo {
15353
15368
  constructor() {
15354
- this.k_ = void 0, this.q_ = [];
15369
+ this.K_ = void 0, this.U_ = [];
15355
15370
  }
15356
15371
  // Helper methods that checks if the query has listeners that listening to remote store
15357
- Q_() {
15358
- return this.q_.some((e => e.K_()));
15372
+ W_() {
15373
+ return this.U_.some((e => e.G_()));
15359
15374
  }
15360
15375
  }
15361
15376
 
15362
15377
  class __PRIVATE_EventManagerImpl {
15363
15378
  constructor() {
15364
15379
  this.queries = new ObjectMap((e => __PRIVATE_canonifyQuery(e)), __PRIVATE_queryEquals),
15365
- this.onlineState = "Unknown" /* OnlineState.Unknown */ , this.U_ = new Set;
15380
+ this.onlineState = "Unknown" /* OnlineState.Unknown */ , this.z_ = new Set;
15366
15381
  }
15367
15382
  }
15368
15383
 
@@ -15371,19 +15386,19 @@ async function __PRIVATE_eventManagerListen(e, t) {
15371
15386
  let r = 3 /* ListenerSetupAction.NoActionRequired */;
15372
15387
  const i = t.query;
15373
15388
  let s = n.queries.get(i);
15374
- s ? !s.Q_() && t.K_() && (
15389
+ s ? !s.W_() && t.G_() && (
15375
15390
  // Query has been listening to local cache, and tries to add a new listener sourced from watch.
15376
15391
  r = 2 /* ListenerSetupAction.RequireWatchConnectionOnly */) : (s = new __PRIVATE_QueryListenersInfo,
15377
- r = t.K_() ? 0 /* ListenerSetupAction.InitializeLocalListenAndRequireWatchConnection */ : 1 /* ListenerSetupAction.InitializeLocalListenOnly */);
15392
+ r = t.G_() ? 0 /* ListenerSetupAction.InitializeLocalListenAndRequireWatchConnection */ : 1 /* ListenerSetupAction.InitializeLocalListenOnly */);
15378
15393
  try {
15379
15394
  switch (r) {
15380
15395
  case 0 /* ListenerSetupAction.InitializeLocalListenAndRequireWatchConnection */ :
15381
- s.k_ = await n.onListen(i,
15396
+ s.K_ = await n.onListen(i,
15382
15397
  /** enableRemoteListen= */ !0);
15383
15398
  break;
15384
15399
 
15385
15400
  case 1 /* ListenerSetupAction.InitializeLocalListenOnly */ :
15386
- s.k_ = await n.onListen(i,
15401
+ s.K_ = await n.onListen(i,
15387
15402
  /** enableRemoteListen= */ !1);
15388
15403
  break;
15389
15404
 
@@ -15394,10 +15409,10 @@ async function __PRIVATE_eventManagerListen(e, t) {
15394
15409
  const n = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Initialization of query '${__PRIVATE_stringifyQuery(t.query)}' failed`);
15395
15410
  return void t.onError(n);
15396
15411
  }
15397
- if (n.queries.set(i, s), s.q_.push(t),
15412
+ if (n.queries.set(i, s), s.U_.push(t),
15398
15413
  // Run global snapshot listeners if a consistent snapshot has been emitted.
15399
- t.W_(n.onlineState), s.k_) {
15400
- t.G_(s.k_) && __PRIVATE_raiseSnapshotsInSyncEvent(n);
15414
+ t.j_(n.onlineState), s.K_) {
15415
+ t.H_(s.K_) && __PRIVATE_raiseSnapshotsInSyncEvent(n);
15401
15416
  }
15402
15417
  }
15403
15418
 
@@ -15406,8 +15421,8 @@ async function __PRIVATE_eventManagerUnlisten(e, t) {
15406
15421
  let i = 3 /* ListenerRemovalAction.NoActionRequired */;
15407
15422
  const s = n.queries.get(r);
15408
15423
  if (s) {
15409
- const e = s.q_.indexOf(t);
15410
- e >= 0 && (s.q_.splice(e, 1), 0 === s.q_.length ? i = t.K_() ? 0 /* ListenerRemovalAction.TerminateLocalListenAndRequireWatchDisconnection */ : 1 /* ListenerRemovalAction.TerminateLocalListenOnly */ : !s.Q_() && t.K_() && (
15424
+ const e = s.U_.indexOf(t);
15425
+ e >= 0 && (s.U_.splice(e, 1), 0 === s.U_.length ? i = t.G_() ? 0 /* ListenerRemovalAction.TerminateLocalListenAndRequireWatchDisconnection */ : 1 /* ListenerRemovalAction.TerminateLocalListenOnly */ : !s.W_() && t.G_() && (
15411
15426
  // The removed listener is the last one that sourced from watch.
15412
15427
  i = 2 /* ListenerRemovalAction.RequireWatchDisconnectionOnly */));
15413
15428
  }
@@ -15434,8 +15449,8 @@ function __PRIVATE_eventManagerOnWatchChange(e, t) {
15434
15449
  for (const e of t) {
15435
15450
  const t = e.query, i = n.queries.get(t);
15436
15451
  if (i) {
15437
- for (const t of i.q_) t.G_(e) && (r = !0);
15438
- i.k_ = e;
15452
+ for (const t of i.U_) t.H_(e) && (r = !0);
15453
+ i.K_ = e;
15439
15454
  }
15440
15455
  }
15441
15456
  r && __PRIVATE_raiseSnapshotsInSyncEvent(n);
@@ -15443,7 +15458,7 @@ function __PRIVATE_eventManagerOnWatchChange(e, t) {
15443
15458
 
15444
15459
  function __PRIVATE_eventManagerOnWatchError(e, t, n) {
15445
15460
  const r = __PRIVATE_debugCast(e), i = r.queries.get(t);
15446
- if (i) for (const e of i.q_) e.onError(n);
15461
+ if (i) for (const e of i.U_) e.onError(n);
15447
15462
  // Remove all listeners. NOTE: We don't need to call syncEngine.unlisten()
15448
15463
  // after an error.
15449
15464
  r.queries.delete(t);
@@ -15451,7 +15466,7 @@ function __PRIVATE_eventManagerOnWatchError(e, t, n) {
15451
15466
 
15452
15467
  // Call all global snapshot listeners that have been set.
15453
15468
  function __PRIVATE_raiseSnapshotsInSyncEvent(e) {
15454
- e.U_.forEach((e => {
15469
+ e.z_.forEach((e => {
15455
15470
  e.next();
15456
15471
  }));
15457
15472
  }
@@ -15459,7 +15474,7 @@ function __PRIVATE_raiseSnapshotsInSyncEvent(e) {
15459
15474
  var fe, ge;
15460
15475
 
15461
15476
  /** Listen to both cache and server changes */
15462
- (ge = fe || (fe = {})).z_ = "default",
15477
+ (ge = fe || (fe = {})).J_ = "default",
15463
15478
  /** Listen to changes in cache only */
15464
15479
  ge.Cache = "cache";
15465
15480
 
@@ -15471,12 +15486,12 @@ ge.Cache = "cache";
15471
15486
  */
15472
15487
  class __PRIVATE_QueryListener {
15473
15488
  constructor(e, t, n) {
15474
- this.query = e, this.j_ = t,
15489
+ this.query = e, this.Y_ = t,
15475
15490
  /**
15476
15491
  * Initial snapshots (e.g. from cache) may not be propagated to the wrapped
15477
15492
  * observer. This flag is set to true once we've actually raised an event.
15478
15493
  */
15479
- this.H_ = !1, this.J_ = null, this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
15494
+ this.Z_ = !1, this.X_ = null, this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
15480
15495
  this.options = n || {};
15481
15496
  }
15482
15497
  /**
@@ -15484,7 +15499,7 @@ class __PRIVATE_QueryListener {
15484
15499
  * if applicable (depending on what changed, whether the user has opted into
15485
15500
  * metadata-only changes, etc.). Returns true if a user-facing event was
15486
15501
  * indeed raised.
15487
- */ G_(e) {
15502
+ */ H_(e) {
15488
15503
  if (!this.options.includeMetadataChanges) {
15489
15504
  // Remove the metadata only changes.
15490
15505
  const t = [];
@@ -15493,49 +15508,49 @@ class __PRIVATE_QueryListener {
15493
15508
  /* excludesMetadataChanges= */ !0, e.hasCachedResults);
15494
15509
  }
15495
15510
  let t = !1;
15496
- return this.H_ ? this.Y_(e) && (this.j_.next(e), t = !0) : this.Z_(e, this.onlineState) && (this.X_(e),
15497
- t = !0), this.J_ = e, t;
15511
+ return this.Z_ ? this.ea(e) && (this.Y_.next(e), t = !0) : this.ta(e, this.onlineState) && (this.na(e),
15512
+ t = !0), this.X_ = e, t;
15498
15513
  }
15499
15514
  onError(e) {
15500
- this.j_.error(e);
15515
+ this.Y_.error(e);
15501
15516
  }
15502
- /** Returns whether a snapshot was raised. */ W_(e) {
15517
+ /** Returns whether a snapshot was raised. */ j_(e) {
15503
15518
  this.onlineState = e;
15504
15519
  let t = !1;
15505
- return this.J_ && !this.H_ && this.Z_(this.J_, e) && (this.X_(this.J_), t = !0),
15520
+ return this.X_ && !this.Z_ && this.ta(this.X_, e) && (this.na(this.X_), t = !0),
15506
15521
  t;
15507
15522
  }
15508
- Z_(e, t) {
15523
+ ta(e, t) {
15509
15524
  // Always raise the first event when we're synced
15510
15525
  if (!e.fromCache) return !0;
15511
15526
  // Always raise event if listening to cache
15512
- if (!this.K_()) return !0;
15527
+ if (!this.G_()) return !0;
15513
15528
  // NOTE: We consider OnlineState.Unknown as online (it should become Offline
15514
15529
  // or Online if we wait long enough).
15515
15530
  const n = "Offline" /* OnlineState.Offline */ !== t;
15516
15531
  // Don't raise the event if we're online, aren't synced yet (checked
15517
15532
  // above) and are waiting for a sync.
15518
- return (!this.options.ea || !n) && (!e.docs.isEmpty() || e.hasCachedResults || "Offline" /* OnlineState.Offline */ === t);
15533
+ return (!this.options.ra || !n) && (!e.docs.isEmpty() || e.hasCachedResults || "Offline" /* OnlineState.Offline */ === t);
15519
15534
  // Raise data from cache if we have any documents, have cached results before,
15520
15535
  // or we are offline.
15521
15536
  }
15522
- Y_(e) {
15537
+ ea(e) {
15523
15538
  // We don't need to handle includeDocumentMetadataChanges here because
15524
15539
  // the Metadata only changes have already been stripped out if needed.
15525
15540
  // At this point the only changes we will see are the ones we should
15526
15541
  // propagate.
15527
15542
  if (e.docChanges.length > 0) return !0;
15528
- const t = this.J_ && this.J_.hasPendingWrites !== e.hasPendingWrites;
15543
+ const t = this.X_ && this.X_.hasPendingWrites !== e.hasPendingWrites;
15529
15544
  return !(!e.syncStateChanged && !t) && !0 === this.options.includeMetadataChanges;
15530
15545
  // Generally we should have hit one of the cases above, but it's possible
15531
15546
  // to get here if there were only metadata docChanges and they got
15532
15547
  // stripped out.
15533
15548
  }
15534
- X_(e) {
15549
+ na(e) {
15535
15550
  e = ViewSnapshot.fromInitialDocuments(e.query, e.docs, e.mutatedKeys, e.fromCache, e.hasCachedResults),
15536
- this.H_ = !0, this.j_.next(e);
15551
+ this.Z_ = !0, this.Y_.next(e);
15537
15552
  }
15538
- K_() {
15553
+ G_() {
15539
15554
  return this.options.source !== fe.Cache;
15540
15555
  }
15541
15556
  }
@@ -15563,10 +15578,10 @@ class __PRIVATE_QueryListener {
15563
15578
  constructor(e,
15564
15579
  // How many bytes this element takes to store in the bundle.
15565
15580
  t) {
15566
- this.ta = e, this.byteLength = t;
15581
+ this.ia = e, this.byteLength = t;
15567
15582
  }
15568
- na() {
15569
- return "metadata" in this.ta;
15583
+ sa() {
15584
+ return "metadata" in this.ia;
15570
15585
  }
15571
15586
  }
15572
15587
 
@@ -15610,7 +15625,7 @@ class __PRIVATE_QueryListener {
15610
15625
  * storage and provide progress update while loading.
15611
15626
  */ class __PRIVATE_BundleLoader {
15612
15627
  constructor(e, t, n) {
15613
- this.ra = e, this.localStore = t, this.serializer = n,
15628
+ this.oa = e, this.localStore = t, this.serializer = n,
15614
15629
  /** Batched queries to be saved into storage */
15615
15630
  this.queries = [],
15616
15631
  /** Batched documents to be saved into storage */
@@ -15623,21 +15638,21 @@ class __PRIVATE_QueryListener {
15623
15638
  *
15624
15639
  * Returns a new progress if adding the element leads to a new progress,
15625
15640
  * otherwise returns null.
15626
- */ ia(e) {
15641
+ */ _a(e) {
15627
15642
  this.progress.bytesLoaded += e.byteLength;
15628
15643
  let t = this.progress.documentsLoaded;
15629
- if (e.ta.namedQuery) this.queries.push(e.ta.namedQuery); else if (e.ta.documentMetadata) {
15644
+ if (e.ia.namedQuery) this.queries.push(e.ia.namedQuery); else if (e.ia.documentMetadata) {
15630
15645
  this.documents.push({
15631
- metadata: e.ta.documentMetadata
15632
- }), e.ta.documentMetadata.exists || ++t;
15633
- const n = ResourcePath.fromString(e.ta.documentMetadata.name);
15646
+ metadata: e.ia.documentMetadata
15647
+ }), e.ia.documentMetadata.exists || ++t;
15648
+ const n = ResourcePath.fromString(e.ia.documentMetadata.name);
15634
15649
  this.collectionGroups.add(n.get(n.length - 2));
15635
- } else e.ta.document && (this.documents[this.documents.length - 1].document = e.ta.document,
15650
+ } else e.ia.document && (this.documents[this.documents.length - 1].document = e.ia.document,
15636
15651
  ++t);
15637
15652
  return t !== this.progress.documentsLoaded ? (this.progress.documentsLoaded = t,
15638
15653
  Object.assign({}, this.progress)) : null;
15639
15654
  }
15640
- sa(e) {
15655
+ aa(e) {
15641
15656
  const t = new Map, n = new __PRIVATE_BundleConverterImpl(this.serializer);
15642
15657
  for (const r of e) if (r.metadata.queries) {
15643
15658
  const e = n.hs(r.metadata.name);
@@ -15651,12 +15666,12 @@ class __PRIVATE_QueryListener {
15651
15666
  /**
15652
15667
  * Update the progress to 'Success' and return the updated progress.
15653
15668
  */ async complete() {
15654
- const e = await __PRIVATE_localStoreApplyBundledDocuments(this.localStore, new __PRIVATE_BundleConverterImpl(this.serializer), this.documents, this.ra.id), t = this.sa(this.documents);
15669
+ const e = await __PRIVATE_localStoreApplyBundledDocuments(this.localStore, new __PRIVATE_BundleConverterImpl(this.serializer), this.documents, this.oa.id), t = this.aa(this.documents);
15655
15670
  for (const e of this.queries) await __PRIVATE_localStoreSaveNamedQuery(this.localStore, e, t.get(e.name));
15656
15671
  return this.progress.taskState = "Success", {
15657
15672
  progress: this.progress,
15658
- oa: this.collectionGroups,
15659
- _a: e
15673
+ ua: this.collectionGroups,
15674
+ ca: e
15660
15675
  };
15661
15676
  }
15662
15677
  }
@@ -15714,7 +15729,7 @@ class __PRIVATE_RemovedLimboDocument {
15714
15729
  constructor(e,
15715
15730
  /** Documents included in the remote target */
15716
15731
  t) {
15717
- this.query = e, this.aa = t, this.ua = null, this.hasCachedResults = !1,
15732
+ this.query = e, this.la = t, this.ha = null, this.hasCachedResults = !1,
15718
15733
  /**
15719
15734
  * A flag whether the view is current with the backend. A view is considered
15720
15735
  * current after it has seen the current flag from the backend and did not
@@ -15723,16 +15738,16 @@ class __PRIVATE_RemovedLimboDocument {
15723
15738
  */
15724
15739
  this.current = !1,
15725
15740
  /** Documents in the view but not in the remote target */
15726
- this.ca = __PRIVATE_documentKeySet(),
15741
+ this.Pa = __PRIVATE_documentKeySet(),
15727
15742
  /** Document Keys that have local changes */
15728
- this.mutatedKeys = __PRIVATE_documentKeySet(), this.la = __PRIVATE_newQueryComparator(e),
15729
- this.ha = new DocumentSet(this.la);
15743
+ this.mutatedKeys = __PRIVATE_documentKeySet(), this.Ia = __PRIVATE_newQueryComparator(e),
15744
+ this.Ta = new DocumentSet(this.Ia);
15730
15745
  }
15731
15746
  /**
15732
15747
  * The set of remote documents that the server has told us belongs to the target associated with
15733
15748
  * this view.
15734
- */ get Pa() {
15735
- return this.aa;
15749
+ */ get Ea() {
15750
+ return this.la;
15736
15751
  }
15737
15752
  /**
15738
15753
  * Iterates over a set of doc changes, applies the query limit, and computes
@@ -15743,8 +15758,8 @@ class __PRIVATE_RemovedLimboDocument {
15743
15758
  * @param previousChanges - If this is being called with a refill, then start
15744
15759
  * with this set of docs and changes instead of the current view.
15745
15760
  * @returns a new set of docs, changes, and refill flag.
15746
- */ Ia(e, t) {
15747
- const n = t ? t.Ta : new __PRIVATE_DocumentChangeSet, r = t ? t.ha : this.ha;
15761
+ */ da(e, t) {
15762
+ const n = t ? t.Aa : new __PRIVATE_DocumentChangeSet, r = t ? t.Ta : this.Ta;
15748
15763
  let i = t ? t.mutatedKeys : this.mutatedKeys, s = r, o = !1;
15749
15764
  // Track the last doc in a (full) limit. This is necessary, because some
15750
15765
  // update (a delete, or an update moving a doc past the old limit) might
@@ -15767,10 +15782,10 @@ class __PRIVATE_RemovedLimboDocument {
15767
15782
  u.data.isEqual(c.data) ? l !== h && (n.track({
15768
15783
  type: 3 /* ChangeType.Metadata */ ,
15769
15784
  doc: c
15770
- }), P = !0) : this.Ea(u, c) || (n.track({
15785
+ }), P = !0) : this.Ra(u, c) || (n.track({
15771
15786
  type: 2 /* ChangeType.Modified */ ,
15772
15787
  doc: c
15773
- }), P = !0, (_ && this.la(c, _) > 0 || a && this.la(c, a) < 0) && (
15788
+ }), P = !0, (_ && this.Ia(c, _) > 0 || a && this.Ia(c, a) < 0) && (
15774
15789
  // This doc moved from inside the limit to outside the limit.
15775
15790
  // That means there may be some other doc in the local cache
15776
15791
  // that should be included instead.
@@ -15795,13 +15810,13 @@ class __PRIVATE_RemovedLimboDocument {
15795
15810
  });
15796
15811
  }
15797
15812
  return {
15798
- ha: s,
15799
- Ta: n,
15813
+ Ta: s,
15814
+ Aa: n,
15800
15815
  Zi: o,
15801
15816
  mutatedKeys: i
15802
15817
  };
15803
15818
  }
15804
- Ea(e, t) {
15819
+ Ra(e, t) {
15805
15820
  // We suppress the initial change event for documents that were modified as
15806
15821
  // part of a write acknowledgment (e.g. when the value of a server transform
15807
15822
  // is applied) as Watch will send us the same document again.
@@ -15826,10 +15841,10 @@ class __PRIVATE_RemovedLimboDocument {
15826
15841
  */
15827
15842
  // PORTING NOTE: The iOS/Android clients always compute limbo document changes.
15828
15843
  applyChanges(e, t, n, r) {
15829
- const i = this.ha;
15830
- this.ha = e.ha, this.mutatedKeys = e.mutatedKeys;
15844
+ const i = this.Ta;
15845
+ this.Ta = e.Ta, this.mutatedKeys = e.mutatedKeys;
15831
15846
  // Sort changes based on type and query comparator
15832
- const s = e.Ta.B_();
15847
+ const s = e.Aa.Q_();
15833
15848
  s.sort(((e, t) => function __PRIVATE_compareChangeType(e, t) {
15834
15849
  const order = e => {
15835
15850
  switch (e) {
@@ -15867,70 +15882,70 @@ class __PRIVATE_RemovedLimboDocument {
15867
15882
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15868
15883
  * See the License for the specific language governing permissions and
15869
15884
  * limitations under the License.
15870
- */ (e.type, t.type) || this.la(e.doc, t.doc))), this.da(n), r = null != r && r;
15871
- const o = t && !r ? this.Aa() : [], _ = 0 === this.ca.size && this.current && !r ? 1 /* SyncState.Synced */ : 0 /* SyncState.Local */ , a = _ !== this.ua;
15885
+ */ (e.type, t.type) || this.Ia(e.doc, t.doc))), this.Va(n), r = null != r && r;
15886
+ const o = t && !r ? this.ma() : [], _ = 0 === this.Pa.size && this.current && !r ? 1 /* SyncState.Synced */ : 0 /* SyncState.Local */ , a = _ !== this.ha;
15872
15887
  // We are at synced state if there is no limbo docs are waiting to be resolved, view is current
15873
15888
  // with the backend, and the query is not pending to reset due to existence filter mismatch.
15874
- if (this.ua = _, 0 !== s.length || a) {
15889
+ if (this.ha = _, 0 !== s.length || a) {
15875
15890
  return {
15876
- snapshot: new ViewSnapshot(this.query, e.ha, i, s, e.mutatedKeys, 0 /* SyncState.Local */ === _, a,
15891
+ snapshot: new ViewSnapshot(this.query, e.Ta, i, s, e.mutatedKeys, 0 /* SyncState.Local */ === _, a,
15877
15892
  /* excludesMetadataChanges= */ !1, !!n && n.resumeToken.approximateByteSize() > 0),
15878
- Ra: o
15893
+ fa: o
15879
15894
  };
15880
15895
  }
15881
15896
  // no changes
15882
15897
  return {
15883
- Ra: o
15898
+ fa: o
15884
15899
  };
15885
15900
  }
15886
15901
  /**
15887
15902
  * Applies an OnlineState change to the view, potentially generating a
15888
15903
  * ViewChange if the view's syncState changes as a result.
15889
- */ W_(e) {
15904
+ */ j_(e) {
15890
15905
  return this.current && "Offline" /* OnlineState.Offline */ === e ? (
15891
15906
  // If we're offline, set `current` to false and then call applyChanges()
15892
15907
  // to refresh our syncState and generate a ViewChange as appropriate. We
15893
15908
  // are guaranteed to get a new TargetChange that sets `current` back to
15894
15909
  // true once the client is back online.
15895
15910
  this.current = !1, this.applyChanges({
15896
- ha: this.ha,
15897
- Ta: new __PRIVATE_DocumentChangeSet,
15911
+ Ta: this.Ta,
15912
+ Aa: new __PRIVATE_DocumentChangeSet,
15898
15913
  mutatedKeys: this.mutatedKeys,
15899
15914
  Zi: !1
15900
15915
  },
15901
15916
  /* limboResolutionEnabled= */ !1)) : {
15902
- Ra: []
15917
+ fa: []
15903
15918
  };
15904
15919
  }
15905
15920
  /**
15906
15921
  * Returns whether the doc for the given key should be in limbo.
15907
- */ Va(e) {
15922
+ */ ga(e) {
15908
15923
  // If the remote end says it's part of this query, it's not in limbo.
15909
- return !this.aa.has(e) && (
15924
+ return !this.la.has(e) && (
15910
15925
  // The local store doesn't think it's a result, so it shouldn't be in limbo.
15911
- !!this.ha.has(e) && !this.ha.get(e).hasLocalMutations);
15926
+ !!this.Ta.has(e) && !this.Ta.get(e).hasLocalMutations);
15912
15927
  }
15913
15928
  /**
15914
15929
  * Updates syncedDocuments, current, and limbo docs based on the given change.
15915
15930
  * Returns the list of changes to which docs are in limbo.
15916
- */ da(e) {
15917
- e && (e.addedDocuments.forEach((e => this.aa = this.aa.add(e))), e.modifiedDocuments.forEach((e => {})),
15918
- e.removedDocuments.forEach((e => this.aa = this.aa.delete(e))), this.current = e.current);
15931
+ */ Va(e) {
15932
+ e && (e.addedDocuments.forEach((e => this.la = this.la.add(e))), e.modifiedDocuments.forEach((e => {})),
15933
+ e.removedDocuments.forEach((e => this.la = this.la.delete(e))), this.current = e.current);
15919
15934
  }
15920
- Aa() {
15935
+ ma() {
15921
15936
  // We can only determine limbo documents when we're in-sync with the server.
15922
15937
  if (!this.current) return [];
15923
15938
  // TODO(klimt): Do this incrementally so that it's not quadratic when
15924
15939
  // updating many documents.
15925
- const e = this.ca;
15926
- this.ca = __PRIVATE_documentKeySet(), this.ha.forEach((e => {
15927
- this.Va(e.key) && (this.ca = this.ca.add(e.key));
15940
+ const e = this.Pa;
15941
+ this.Pa = __PRIVATE_documentKeySet(), this.Ta.forEach((e => {
15942
+ this.ga(e.key) && (this.Pa = this.Pa.add(e.key));
15928
15943
  }));
15929
15944
  // Diff the new limbo docs with the old limbo docs.
15930
15945
  const t = [];
15931
15946
  return e.forEach((e => {
15932
- this.ca.has(e) || t.push(new __PRIVATE_RemovedLimboDocument(e));
15933
- })), this.ca.forEach((n => {
15947
+ this.Pa.has(e) || t.push(new __PRIVATE_RemovedLimboDocument(e));
15948
+ })), this.Pa.forEach((n => {
15934
15949
  e.has(n) || t.push(new __PRIVATE_AddedLimboDocument(n));
15935
15950
  })), t;
15936
15951
  }
@@ -15954,9 +15969,9 @@ class __PRIVATE_RemovedLimboDocument {
15954
15969
  * @returns The ViewChange that resulted from this synchronization.
15955
15970
  */
15956
15971
  // PORTING NOTE: Multi-tab only.
15957
- ma(e) {
15958
- this.aa = e.ls, this.ca = __PRIVATE_documentKeySet();
15959
- const t = this.Ia(e.documents);
15972
+ pa(e) {
15973
+ this.la = e.ls, this.Pa = __PRIVATE_documentKeySet();
15974
+ const t = this.da(e.documents);
15960
15975
  return this.applyChanges(t, /* limboResolutionEnabled= */ !0);
15961
15976
  }
15962
15977
  /**
@@ -15965,8 +15980,8 @@ class __PRIVATE_RemovedLimboDocument {
15965
15980
  * `hasPendingWrites` status of the already established view.
15966
15981
  */
15967
15982
  // PORTING NOTE: Multi-tab only.
15968
- fa() {
15969
- return ViewSnapshot.fromInitialDocuments(this.query, this.ha, this.mutatedKeys, 0 /* SyncState.Local */ === this.ua, this.hasCachedResults);
15983
+ ya() {
15984
+ return ViewSnapshot.fromInitialDocuments(this.query, this.Ta, this.mutatedKeys, 0 /* SyncState.Local */ === this.ha, this.hasCachedResults);
15970
15985
  }
15971
15986
  }
15972
15987
 
@@ -16005,7 +16020,7 @@ class __PRIVATE_QueryView {
16005
16020
  * decide whether it needs to manufacture a delete event for the target once
16006
16021
  * the target is CURRENT.
16007
16022
  */
16008
- this.ga = !1;
16023
+ this.wa = !1;
16009
16024
  }
16010
16025
  }
16011
16026
 
@@ -16026,8 +16041,8 @@ class __PRIVATE_QueryView {
16026
16041
  // PORTING NOTE: Manages state synchronization in multi-tab environments.
16027
16042
  r, i, s) {
16028
16043
  this.localStore = e, this.remoteStore = t, this.eventManager = n, this.sharedClientState = r,
16029
- this.currentUser = i, this.maxConcurrentLimboResolutions = s, this.pa = {}, this.ya = new ObjectMap((e => __PRIVATE_canonifyQuery(e)), __PRIVATE_queryEquals),
16030
- this.wa = new Map,
16044
+ this.currentUser = i, this.maxConcurrentLimboResolutions = s, this.Sa = {}, this.ba = new ObjectMap((e => __PRIVATE_canonifyQuery(e)), __PRIVATE_queryEquals),
16045
+ this.Da = new Map,
16031
16046
  /**
16032
16047
  * The keys of documents that are in limbo for which we haven't yet started a
16033
16048
  * limbo resolution query. The strings in this set are the result of calling
@@ -16037,28 +16052,28 @@ class __PRIVATE_QueryView {
16037
16052
  * of arbitrary elements and it also maintains insertion order, providing the
16038
16053
  * desired queue-like FIFO semantics.
16039
16054
  */
16040
- this.Sa = new Set,
16055
+ this.Ca = new Set,
16041
16056
  /**
16042
16057
  * Keeps track of the target ID for each document that is in limbo with an
16043
16058
  * active target.
16044
16059
  */
16045
- this.ba = new SortedMap(DocumentKey.comparator),
16060
+ this.va = new SortedMap(DocumentKey.comparator),
16046
16061
  /**
16047
16062
  * Keeps track of the information about an active limbo resolution for each
16048
16063
  * active target ID that was started for the purpose of limbo resolution.
16049
16064
  */
16050
- this.Da = new Map, this.Ca = new __PRIVATE_ReferenceSet,
16065
+ this.Fa = new Map, this.Ma = new __PRIVATE_ReferenceSet,
16051
16066
  /** Stores user completion handlers, indexed by User and BatchId. */
16052
- this.va = {},
16067
+ this.xa = {},
16053
16068
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
16054
- this.Fa = new Map, this.Ma = __PRIVATE_TargetIdGenerator.Nn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16069
+ this.Oa = new Map, this.Na = __PRIVATE_TargetIdGenerator.Nn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16055
16070
  // The primary state is set to `true` or `false` immediately after Firestore
16056
16071
  // startup. In the interim, a client should only be considered primary if
16057
16072
  // `isPrimary` is true.
16058
- this.xa = void 0;
16073
+ this.La = void 0;
16059
16074
  }
16060
16075
  get isPrimaryClient() {
16061
- return !0 === this.xa;
16076
+ return !0 === this.La;
16062
16077
  }
16063
16078
  }
16064
16079
 
@@ -16070,7 +16085,7 @@ class __PRIVATE_QueryView {
16070
16085
  async function __PRIVATE_syncEngineListen(e, t, n = !0) {
16071
16086
  const r = __PRIVATE_ensureWatchCallbacks(e);
16072
16087
  let i;
16073
- const s = r.ya.get(t);
16088
+ const s = r.ba.get(t);
16074
16089
  return s ? (
16075
16090
  // PORTING NOTE: With Multi-Tab Web, it is possible that a query view
16076
16091
  // already exists when EventManager calls us for the first time. This
@@ -16078,7 +16093,7 @@ async function __PRIVATE_syncEngineListen(e, t, n = !0) {
16078
16093
  // behalf of another tab and the user of the primary also starts listening
16079
16094
  // to the query. EventManager will not have an assigned target ID in this
16080
16095
  // case and calls `listen` to obtain this ID.
16081
- r.sharedClientState.addLocalQueryTarget(s.targetId), i = s.view.fa()) : i = await __PRIVATE_allocateTargetAndMaybeListen(r, t, n,
16096
+ r.sharedClientState.addLocalQueryTarget(s.targetId), i = s.view.ya()) : i = await __PRIVATE_allocateTargetAndMaybeListen(r, t, n,
16082
16097
  /** shouldInitializeView= */ !0), i;
16083
16098
  }
16084
16099
 
@@ -16103,30 +16118,30 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16103
16118
  // PORTING NOTE: On Web only, we inject the code that registers new Limbo
16104
16119
  // targets based on view changes. This allows us to only depend on Limbo
16105
16120
  // changes when user code includes queries.
16106
- e.Oa = (t, n, r) => async function __PRIVATE_applyDocChanges(e, t, n, r) {
16107
- let i = t.view.Ia(n);
16121
+ e.Ba = (t, n, r) => async function __PRIVATE_applyDocChanges(e, t, n, r) {
16122
+ let i = t.view.da(n);
16108
16123
  i.Zi && (
16109
16124
  // The query has a limit and some docs were removed, so we need
16110
16125
  // to re-run the query against the local store to make sure we
16111
16126
  // didn't lose any good docs that had been past the limit.
16112
16127
  i = await __PRIVATE_localStoreExecuteQuery(e.localStore, t.query,
16113
- /* usePreviousResults= */ !1).then((({documents: e}) => t.view.Ia(e, i))));
16128
+ /* usePreviousResults= */ !1).then((({documents: e}) => t.view.da(e, i))));
16114
16129
  const s = r && r.targetChanges.get(t.targetId), o = r && null != r.targetMismatches.get(t.targetId), _ = t.view.applyChanges(i,
16115
16130
  /* limboResolutionEnabled= */ e.isPrimaryClient, s, o);
16116
- return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.Ra), _.snapshot;
16131
+ return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.fa), _.snapshot;
16117
16132
  }(e, t, n, r);
16118
16133
  const s = await __PRIVATE_localStoreExecuteQuery(e.localStore, t,
16119
- /* usePreviousResults= */ !0), o = new __PRIVATE_View(t, s.ls), _ = o.Ia(s.documents), a = TargetChange.createSynthesizedTargetChangeForCurrentChange(n, r && "Offline" /* OnlineState.Offline */ !== e.onlineState, i), u = o.applyChanges(_,
16134
+ /* usePreviousResults= */ !0), o = new __PRIVATE_View(t, s.ls), _ = o.da(s.documents), a = TargetChange.createSynthesizedTargetChangeForCurrentChange(n, r && "Offline" /* OnlineState.Offline */ !== e.onlineState, i), u = o.applyChanges(_,
16120
16135
  /* limboResolutionEnabled= */ e.isPrimaryClient, a);
16121
- __PRIVATE_updateTrackedLimbos(e, n, u.Ra);
16136
+ __PRIVATE_updateTrackedLimbos(e, n, u.fa);
16122
16137
  const c = new __PRIVATE_QueryView(t, n, o);
16123
- return e.ya.set(t, c), e.wa.has(n) ? e.wa.get(n).push(t) : e.wa.set(n, [ t ]), u.snapshot;
16138
+ return e.ba.set(t, c), e.Da.has(n) ? e.Da.get(n).push(t) : e.Da.set(n, [ t ]), u.snapshot;
16124
16139
  }
16125
16140
 
16126
16141
  /** Stops listening to the query. */ async function __PRIVATE_syncEngineUnlisten(e, t, n) {
16127
- const r = __PRIVATE_debugCast(e), i = r.ya.get(t), s = r.wa.get(i.targetId);
16128
- if (s.length > 1) return r.wa.set(i.targetId, s.filter((e => !__PRIVATE_queryEquals(e, t)))),
16129
- void r.ya.delete(t);
16142
+ const r = __PRIVATE_debugCast(e), i = r.ba.get(t), s = r.Da.get(i.targetId);
16143
+ if (s.length > 1) return r.Da.set(i.targetId, s.filter((e => !__PRIVATE_queryEquals(e, t)))),
16144
+ void r.ba.delete(t);
16130
16145
  // No other queries are mapped to the target, clean up the query and the target.
16131
16146
  if (r.isPrimaryClient) {
16132
16147
  // We need to remove the local query target first to allow us to verify
@@ -16142,7 +16157,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16142
16157
  }
16143
16158
 
16144
16159
  /** Unlistens to the remote store while still listening to the cache. */ async function __PRIVATE_triggerRemoteStoreUnlisten(e, t) {
16145
- const n = __PRIVATE_debugCast(e), r = n.ya.get(t), i = n.wa.get(r.targetId);
16160
+ const n = __PRIVATE_debugCast(e), r = n.ba.get(t), i = n.Da.get(r.targetId);
16146
16161
  n.isPrimaryClient && 1 === i.length && (
16147
16162
  // PORTING NOTE: Unregister the target ID with local Firestore client as
16148
16163
  // watch target.
@@ -16204,9 +16219,9 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16204
16219
  })));
16205
16220
  }(r.localStore, t);
16206
16221
  r.sharedClientState.addPendingMutation(e.batchId), function __PRIVATE_addMutationCallback(e, t, n) {
16207
- let r = e.va[e.currentUser.toKey()];
16222
+ let r = e.xa[e.currentUser.toKey()];
16208
16223
  r || (r = new SortedMap(__PRIVATE_primitiveComparator));
16209
- r = r.insert(t, n), e.va[e.currentUser.toKey()] = r;
16224
+ r = r.insert(t, n), e.xa[e.currentUser.toKey()] = r;
16210
16225
  }
16211
16226
  /**
16212
16227
  * Resolves or rejects the user callback for the given batch and then discards
@@ -16231,13 +16246,13 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16231
16246
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16232
16247
  // Update `receivedDocument` as appropriate for any limbo targets.
16233
16248
  t.targetChanges.forEach(((e, t) => {
16234
- const r = n.Da.get(t);
16249
+ const r = n.Fa.get(t);
16235
16250
  r && (
16236
16251
  // Since this is a limbo resolution lookup, it's for a single document
16237
16252
  // and it could be added, modified, or removed, but not a combination.
16238
16253
  __PRIVATE_hardAssert(e.addedDocuments.size + e.modifiedDocuments.size + e.removedDocuments.size <= 1),
16239
- e.addedDocuments.size > 0 ? r.ga = !0 : e.modifiedDocuments.size > 0 ? __PRIVATE_hardAssert(r.ga) : e.removedDocuments.size > 0 && (__PRIVATE_hardAssert(r.ga),
16240
- r.ga = !1));
16254
+ e.addedDocuments.size > 0 ? r.wa = !0 : e.modifiedDocuments.size > 0 ? __PRIVATE_hardAssert(r.wa) : e.removedDocuments.size > 0 && (__PRIVATE_hardAssert(r.wa),
16255
+ r.wa = !1));
16241
16256
  })), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(n, e, t);
16242
16257
  } catch (e) {
16243
16258
  await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);
@@ -16255,19 +16270,19 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16255
16270
  // SharedClientState.
16256
16271
  if (r.isPrimaryClient && 0 /* OnlineStateSource.RemoteStore */ === n || !r.isPrimaryClient && 1 /* OnlineStateSource.SharedClientState */ === n) {
16257
16272
  const e = [];
16258
- r.ya.forEach(((n, r) => {
16259
- const i = r.view.W_(t);
16273
+ r.ba.forEach(((n, r) => {
16274
+ const i = r.view.j_(t);
16260
16275
  i.snapshot && e.push(i.snapshot);
16261
16276
  })), function __PRIVATE_eventManagerOnOnlineStateChange(e, t) {
16262
16277
  const n = __PRIVATE_debugCast(e);
16263
16278
  n.onlineState = t;
16264
16279
  let r = !1;
16265
16280
  n.queries.forEach(((e, n) => {
16266
- for (const e of n.q_)
16281
+ for (const e of n.U_)
16267
16282
  // Run global snapshot listeners if a consistent snapshot has been emitted.
16268
- e.W_(t) && (r = !0);
16283
+ e.j_(t) && (r = !0);
16269
16284
  })), r && __PRIVATE_raiseSnapshotsInSyncEvent(n);
16270
- }(r.eventManager, t), e.length && r.pa.a_(e), r.onlineState = t, r.isPrimaryClient && r.sharedClientState.setOnlineState(t);
16285
+ }(r.eventManager, t), e.length && r.Sa.l_(e), r.onlineState = t, r.isPrimaryClient && r.sharedClientState.setOnlineState(t);
16271
16286
  }
16272
16287
  }
16273
16288
 
@@ -16285,7 +16300,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16285
16300
  const r = __PRIVATE_debugCast(e);
16286
16301
  // PORTING NOTE: Multi-tab only.
16287
16302
  r.sharedClientState.updateQueryState(t, "rejected", n);
16288
- const i = r.Da.get(t), s = i && i.key;
16303
+ const i = r.Fa.get(t), s = i && i.key;
16289
16304
  if (s) {
16290
16305
  // TODO(klimt): We really only should do the following on permission
16291
16306
  // denied errors, but we don't have the cause code here.
@@ -16307,7 +16322,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16307
16322
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16308
16323
  // this query when the RemoteStore restarts the Watch stream, which should
16309
16324
  // re-trigger the target failure.
16310
- r.ba = r.ba.remove(s), r.Da.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16325
+ r.va = r.va.remove(s), r.Fa.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16311
16326
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16312
16327
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16313
16328
  }
@@ -16369,8 +16384,8 @@ async function __PRIVATE_syncEngineRejectFailedWrite(e, t, n) {
16369
16384
  if (-1 === e)
16370
16385
  // Trigger the callback right away if there is no pending writes at the moment.
16371
16386
  return void t.resolve();
16372
- const r = n.Fa.get(e) || [];
16373
- r.push(t), n.Fa.set(e, r);
16387
+ const r = n.Oa.get(e) || [];
16388
+ r.push(t), n.Oa.set(e, r);
16374
16389
  } catch (e) {
16375
16390
  const n = __PRIVATE_wrapInUserErrorIfRecoverable(e, "Initialization of waitForPendingWrites() operation failed");
16376
16391
  t.reject(n);
@@ -16381,28 +16396,28 @@ async function __PRIVATE_syncEngineRejectFailedWrite(e, t, n) {
16381
16396
  * Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
16382
16397
  * if there are any.
16383
16398
  */ function __PRIVATE_triggerPendingWritesCallbacks(e, t) {
16384
- (e.Fa.get(t) || []).forEach((e => {
16399
+ (e.Oa.get(t) || []).forEach((e => {
16385
16400
  e.resolve();
16386
- })), e.Fa.delete(t);
16401
+ })), e.Oa.delete(t);
16387
16402
  }
16388
16403
 
16389
16404
  /** Reject all outstanding callbacks waiting for pending writes to complete. */ function __PRIVATE_processUserCallback(e, t, n) {
16390
16405
  const r = __PRIVATE_debugCast(e);
16391
- let i = r.va[r.currentUser.toKey()];
16406
+ let i = r.xa[r.currentUser.toKey()];
16392
16407
  // NOTE: Mutations restored from persistence won't have callbacks, so it's
16393
16408
  // okay for there to be no callback for this ID.
16394
16409
  if (i) {
16395
16410
  const e = i.get(t);
16396
- e && (n ? e.reject(n) : e.resolve(), i = i.remove(t)), r.va[r.currentUser.toKey()] = i;
16411
+ e && (n ? e.reject(n) : e.resolve(), i = i.remove(t)), r.xa[r.currentUser.toKey()] = i;
16397
16412
  }
16398
16413
  }
16399
16414
 
16400
16415
  function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16401
16416
  e.sharedClientState.removeLocalQueryTarget(t);
16402
- for (const r of e.wa.get(t)) e.ya.delete(r), n && e.pa.Na(r, n);
16403
- if (e.wa.delete(t), e.isPrimaryClient) {
16404
- e.Ca.Rr(t).forEach((t => {
16405
- e.Ca.containsKey(t) ||
16417
+ for (const r of e.Da.get(t)) e.ba.delete(r), n && e.Sa.ka(r, n);
16418
+ if (e.Da.delete(t), e.isPrimaryClient) {
16419
+ e.Ma.Rr(t).forEach((t => {
16420
+ e.Ma.containsKey(t) ||
16406
16421
  // We removed the last reference for this key
16407
16422
  __PRIVATE_removeLimboTarget(e, t);
16408
16423
  }));
@@ -16410,19 +16425,19 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16410
16425
  }
16411
16426
 
16412
16427
  function __PRIVATE_removeLimboTarget(e, t) {
16413
- e.Sa.delete(t.path.canonicalString());
16428
+ e.Ca.delete(t.path.canonicalString());
16414
16429
  // It's possible that the target already got removed because the query failed. In that case,
16415
16430
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16416
- const n = e.ba.get(t);
16417
- null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.ba = e.ba.remove(t),
16418
- e.Da.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16431
+ const n = e.va.get(t);
16432
+ null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.va = e.va.remove(t),
16433
+ e.Fa.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16419
16434
  }
16420
16435
 
16421
16436
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16422
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ca.addReference(r.key, t),
16437
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ma.addReference(r.key, t),
16423
16438
  __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {
16424
- __PRIVATE_logDebug("SyncEngine", "Document no longer in limbo: " + r.key), e.Ca.removeReference(r.key, t);
16425
- e.Ca.containsKey(r.key) ||
16439
+ __PRIVATE_logDebug("SyncEngine", "Document no longer in limbo: " + r.key), e.Ma.removeReference(r.key, t);
16440
+ e.Ma.containsKey(r.key) ||
16426
16441
  // We removed the last reference for this key
16427
16442
  __PRIVATE_removeLimboTarget(e, r.key);
16428
16443
  } else fail();
@@ -16430,8 +16445,8 @@ function __PRIVATE_updateTrackedLimbos(e, t, n) {
16430
16445
 
16431
16446
  function __PRIVATE_trackLimboChange(e, t) {
16432
16447
  const n = t.key, r = n.path.canonicalString();
16433
- e.ba.get(n) || e.Sa.has(r) || (__PRIVATE_logDebug("SyncEngine", "New document in limbo: " + n),
16434
- e.Sa.add(r), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16448
+ e.va.get(n) || e.Ca.has(r) || (__PRIVATE_logDebug("SyncEngine", "New document in limbo: " + n),
16449
+ e.Ca.add(r), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16435
16450
  }
16436
16451
 
16437
16452
  /**
@@ -16442,18 +16457,18 @@ function __PRIVATE_trackLimboChange(e, t) {
16442
16457
  * with "resource exhausted" errors which can lead to pathological client
16443
16458
  * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
16444
16459
  */ function __PRIVATE_pumpEnqueuedLimboResolutions(e) {
16445
- for (;e.Sa.size > 0 && e.ba.size < e.maxConcurrentLimboResolutions; ) {
16446
- const t = e.Sa.values().next().value;
16447
- e.Sa.delete(t);
16448
- const n = new DocumentKey(ResourcePath.fromString(t)), r = e.Ma.next();
16449
- e.Da.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));
16460
+ for (;e.Ca.size > 0 && e.va.size < e.maxConcurrentLimboResolutions; ) {
16461
+ const t = e.Ca.values().next().value;
16462
+ e.Ca.delete(t);
16463
+ const n = new DocumentKey(ResourcePath.fromString(t)), r = e.Na.next();
16464
+ e.Fa.set(r, new LimboResolution(n)), e.va = e.va.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.oe));
16450
16465
  }
16451
16466
  }
16452
16467
 
16453
16468
  async function __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, t, n) {
16454
16469
  const r = __PRIVATE_debugCast(e), i = [], s = [], o = [];
16455
- r.ya.isEmpty() || (r.ya.forEach(((e, _) => {
16456
- o.push(r.Oa(_, t, n).then((e => {
16470
+ r.ba.isEmpty() || (r.ba.forEach(((e, _) => {
16471
+ o.push(r.Ba(_, t, n).then((e => {
16457
16472
  // Update views if there are actual changes.
16458
16473
  if (
16459
16474
  // If there are changes, or we are handling a global snapshot, notify
@@ -16465,7 +16480,7 @@ async function __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, t, n) {
16465
16480
  s.push(t);
16466
16481
  }
16467
16482
  })));
16468
- })), await Promise.all(o), r.pa.a_(i), await async function __PRIVATE_localStoreNotifyLocalViewChanges(e, t) {
16483
+ })), await Promise.all(o), r.Sa.l_(i), await async function __PRIVATE_localStoreNotifyLocalViewChanges(e, t) {
16469
16484
  const n = __PRIVATE_debugCast(e);
16470
16485
  try {
16471
16486
  await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (e => PersistencePromise.forEach(t, (t => PersistencePromise.forEach(t.ki, (r => n.persistence.referenceDelegate.addReference(e, t.targetId, r))).next((() => PersistencePromise.forEach(t.qi, (r => n.persistence.referenceDelegate.removeReference(e, t.targetId, r)))))))));
@@ -16496,11 +16511,11 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16496
16511
  n.currentUser = t,
16497
16512
  // Fails tasks waiting for pending writes requested by previous user.
16498
16513
  function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {
16499
- e.Fa.forEach((e => {
16514
+ e.Oa.forEach((e => {
16500
16515
  e.forEach((e => {
16501
16516
  e.reject(new FirestoreError(D.CANCELLED, t));
16502
16517
  }));
16503
- })), e.Fa.clear();
16518
+ })), e.Oa.clear();
16504
16519
  }(n, "'waitForPendingWrites' promise is rejected due to a user change."),
16505
16520
  // TODO(b/114226417): Consider calling this only in the primary tab.
16506
16521
  n.sharedClientState.handleUserChange(t, e.removedBatchIds, e.addedBatchIds), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(n, e._s);
@@ -16508,15 +16523,15 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16508
16523
  }
16509
16524
 
16510
16525
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16511
- const n = __PRIVATE_debugCast(e), r = n.Da.get(t);
16512
- if (r && r.ga) return __PRIVATE_documentKeySet().add(r.key);
16526
+ const n = __PRIVATE_debugCast(e), r = n.Fa.get(t);
16527
+ if (r && r.wa) return __PRIVATE_documentKeySet().add(r.key);
16513
16528
  {
16514
16529
  let e = __PRIVATE_documentKeySet();
16515
- const r = n.wa.get(t);
16530
+ const r = n.Da.get(t);
16516
16531
  if (!r) return e;
16517
16532
  for (const t of r) {
16518
- const r = n.ya.get(t);
16519
- e = e.unionWith(r.view.Pa);
16533
+ const r = n.ba.get(t);
16534
+ e = e.unionWith(r.view.Ea);
16520
16535
  }
16521
16536
  return e;
16522
16537
  }
@@ -16527,8 +16542,8 @@ function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16527
16542
  * from persistence.
16528
16543
  */ async function __PRIVATE_synchronizeViewAndComputeSnapshot(e, t) {
16529
16544
  const n = __PRIVATE_debugCast(e), r = await __PRIVATE_localStoreExecuteQuery(n.localStore, t.query,
16530
- /* usePreviousResults= */ !0), i = t.view.ma(r);
16531
- return n.isPrimaryClient && __PRIVATE_updateTrackedLimbos(n, t.targetId, i.Ra),
16545
+ /* usePreviousResults= */ !0), i = t.view.pa(r);
16546
+ return n.isPrimaryClient && __PRIVATE_updateTrackedLimbos(n, t.targetId, i.fa),
16532
16547
  i;
16533
16548
  }
16534
16549
 
@@ -16579,7 +16594,7 @@ async function __PRIVATE_syncEngineApplyBatchState(e, t, n, r) {
16579
16594
  async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16580
16595
  const n = __PRIVATE_debugCast(e);
16581
16596
  if (__PRIVATE_ensureWatchCallbacks(n), __PRIVATE_syncEngineEnsureWriteCallbacks(n),
16582
- !0 === t && !0 !== n.xa) {
16597
+ !0 === t && !0 !== n.La) {
16583
16598
  // Secondary tabs only maintain Views for their local listeners and the
16584
16599
  // Views internal state may not be 100% populated (in particular
16585
16600
  // secondary tabs don't track syncedDocuments, the set of documents the
@@ -16587,12 +16602,12 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16587
16602
  // primary, we need to need to make sure that all views for all targets
16588
16603
  // match the state on disk.
16589
16604
  const e = n.sharedClientState.getAllActiveQueryTargets(), t = await __PRIVATE_synchronizeQueryViewsAndRaiseSnapshots(n, e.toArray());
16590
- n.xa = !0, await __PRIVATE_remoteStoreApplyPrimaryState(n.remoteStore, !0);
16605
+ n.La = !0, await __PRIVATE_remoteStoreApplyPrimaryState(n.remoteStore, !0);
16591
16606
  for (const e of t) __PRIVATE_remoteStoreListen(n.remoteStore, e);
16592
- } else if (!1 === t && !1 !== n.xa) {
16607
+ } else if (!1 === t && !1 !== n.La) {
16593
16608
  const e = [];
16594
16609
  let t = Promise.resolve();
16595
- n.wa.forEach(((r, i) => {
16610
+ n.Da.forEach(((r, i) => {
16596
16611
  n.sharedClientState.isLocalQueryTarget(i) ? e.push(i) : t = t.then((() => (__PRIVATE_removeAndCleanupTarget(n, i),
16597
16612
  __PRIVATE_localStoreReleaseTarget(n.localStore, i,
16598
16613
  /*keepPersistedTargetData=*/ !0)))), __PRIVATE_remoteStoreUnlisten(n.remoteStore, i);
@@ -16600,9 +16615,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16600
16615
  // PORTING NOTE: Multi-Tab only.
16601
16616
  function __PRIVATE_resetLimboDocuments(e) {
16602
16617
  const t = __PRIVATE_debugCast(e);
16603
- t.Da.forEach(((e, n) => {
16618
+ t.Fa.forEach(((e, n) => {
16604
16619
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16605
- })), t.Ca.Vr(), t.Da = new Map, t.ba = new SortedMap(DocumentKey.comparator);
16620
+ })), t.Ma.Vr(), t.Fa = new Map, t.va = new SortedMap(DocumentKey.comparator);
16606
16621
  }
16607
16622
  /**
16608
16623
  * Reconcile the query views of the provided query targets with the state from
@@ -16615,7 +16630,7 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16615
16630
  * tab to a primary tab
16616
16631
  */
16617
16632
  // PORTING NOTE: Multi-Tab only.
16618
- (n), n.xa = !1, await __PRIVATE_remoteStoreApplyPrimaryState(n.remoteStore, !1);
16633
+ (n), n.La = !1, await __PRIVATE_remoteStoreApplyPrimaryState(n.remoteStore, !1);
16619
16634
  }
16620
16635
  }
16621
16636
 
@@ -16623,7 +16638,7 @@ async function __PRIVATE_synchronizeQueryViewsAndRaiseSnapshots(e, t, n) {
16623
16638
  const r = __PRIVATE_debugCast(e), i = [], s = [];
16624
16639
  for (const e of t) {
16625
16640
  let t;
16626
- const n = r.wa.get(e);
16641
+ const n = r.Da.get(e);
16627
16642
  if (n && 0 !== n.length) {
16628
16643
  // For queries that have a local View, we fetch their current state
16629
16644
  // from LocalStore (as the resume token and the snapshot version
@@ -16631,7 +16646,7 @@ async function __PRIVATE_synchronizeQueryViewsAndRaiseSnapshots(e, t, n) {
16631
16646
  // state (the list of syncedDocuments may have gotten out of sync).
16632
16647
  t = await __PRIVATE_localStoreAllocateTarget(r.localStore, __PRIVATE_queryToTarget(n[0]));
16633
16648
  for (const e of n) {
16634
- const t = r.ya.get(e), n = await __PRIVATE_synchronizeViewAndComputeSnapshot(r, t);
16649
+ const t = r.ba.get(e), n = await __PRIVATE_synchronizeViewAndComputeSnapshot(r, t);
16635
16650
  n.snapshot && s.push(n.snapshot);
16636
16651
  }
16637
16652
  } else {
@@ -16643,7 +16658,7 @@ async function __PRIVATE_synchronizeQueryViewsAndRaiseSnapshots(e, t, n) {
16643
16658
  }
16644
16659
  i.push(t);
16645
16660
  }
16646
- return r.pa.a_(s), i;
16661
+ return r.Sa.l_(s), i;
16647
16662
  }
16648
16663
 
16649
16664
  /**
@@ -16673,11 +16688,11 @@ function __PRIVATE_syncEngineGetActiveClients(e) {
16673
16688
  // PORTING NOTE: Multi-Tab only.
16674
16689
  async function __PRIVATE_syncEngineApplyTargetState(e, t, n, r) {
16675
16690
  const i = __PRIVATE_debugCast(e);
16676
- if (i.xa)
16691
+ if (i.La)
16677
16692
  // If we receive a target state notification via WebStorage, we are
16678
16693
  // either already secondary or another tab has taken the primary lease.
16679
16694
  return void __PRIVATE_logDebug("SyncEngine", "Ignoring unexpected query state notification.");
16680
- const s = i.wa.get(t);
16695
+ const s = i.Da.get(t);
16681
16696
  if (s && s.length > 0) switch (n) {
16682
16697
  case "current":
16683
16698
  case "not-current":
@@ -16699,9 +16714,9 @@ async function __PRIVATE_syncEngineApplyTargetState(e, t, n, r) {
16699
16714
 
16700
16715
  /** Adds or removes Watch targets for queries from different tabs. */ async function __PRIVATE_syncEngineApplyActiveTargetsChange(e, t, n) {
16701
16716
  const r = __PRIVATE_ensureWatchCallbacks(e);
16702
- if (r.xa) {
16717
+ if (r.La) {
16703
16718
  for (const e of t) {
16704
- if (r.wa.has(e) && r.sharedClientState.isActiveQueryTarget(e)) {
16719
+ if (r.Da.has(e) && r.sharedClientState.isActiveQueryTarget(e)) {
16705
16720
  __PRIVATE_logDebug("SyncEngine", "Adding an already active target " + e);
16706
16721
  continue;
16707
16722
  }
@@ -16712,7 +16727,7 @@ async function __PRIVATE_syncEngineApplyTargetState(e, t, n, r) {
16712
16727
  for (const e of n)
16713
16728
  // Check that the target is still active since the target might have been
16714
16729
  // removed if it has been rejected by the backend.
16715
- r.wa.has(e) &&
16730
+ r.Da.has(e) &&
16716
16731
  // Release queries that are still active.
16717
16732
  await __PRIVATE_localStoreReleaseTarget(r.localStore, e,
16718
16733
  /* keepPersistedTargetData */ !1).then((() => {
@@ -16726,7 +16741,7 @@ function __PRIVATE_ensureWatchCallbacks(e) {
16726
16741
  return t.remoteStore.remoteSyncer.applyRemoteEvent = __PRIVATE_syncEngineApplyRemoteEvent.bind(null, t),
16727
16742
  t.remoteStore.remoteSyncer.getRemoteKeysForTarget = __PRIVATE_syncEngineGetRemoteKeysForTarget.bind(null, t),
16728
16743
  t.remoteStore.remoteSyncer.rejectListen = __PRIVATE_syncEngineRejectListen.bind(null, t),
16729
- t.pa.a_ = __PRIVATE_eventManagerOnWatchChange.bind(null, t.eventManager), t.pa.Na = __PRIVATE_eventManagerOnWatchError.bind(null, t.eventManager),
16744
+ t.Sa.l_ = __PRIVATE_eventManagerOnWatchChange.bind(null, t.eventManager), t.Sa.ka = __PRIVATE_eventManagerOnWatchError.bind(null, t.eventManager),
16730
16745
  t;
16731
16746
  }
16732
16747
 
@@ -16769,13 +16784,13 @@ function __PRIVATE_syncEngineEnsureWriteCallbacks(e) {
16769
16784
  }(r)), Promise.resolve(new Set);
16770
16785
  n._updateProgress(__PRIVATE_bundleInitialProgress(r));
16771
16786
  const i = new __PRIVATE_BundleLoader(r, e.localStore, t.serializer);
16772
- let s = await t.La();
16787
+ let s = await t.qa();
16773
16788
  for (;s; ) {
16774
- const e = await i.ia(s);
16775
- e && n._updateProgress(e), s = await t.La();
16789
+ const e = await i._a(s);
16790
+ e && n._updateProgress(e), s = await t.qa();
16776
16791
  }
16777
16792
  const o = await i.complete();
16778
- return await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, o._a,
16793
+ return await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, o.ca,
16779
16794
  /* remoteEvent */ void 0),
16780
16795
  // Save metadata, so loading the same bundle will skip.
16781
16796
  await function __PRIVATE_localStoreSaveBundle(e, t) {
@@ -16785,7 +16800,7 @@ function __PRIVATE_syncEngineEnsureWriteCallbacks(e) {
16785
16800
  /**
16786
16801
  * Returns a promise of a `NamedQuery` associated with given query name. Promise
16787
16802
  * resolves to undefined if no persisted data can be found.
16788
- */ (e.localStore, r), n._completeWith(o.progress), Promise.resolve(o.oa);
16803
+ */ (e.localStore, r), n._completeWith(o.progress), Promise.resolve(o.ua);
16789
16804
  } catch (e) {
16790
16805
  return __PRIVATE_logWarn("SyncEngine", `Loading bundle failed with ${e}`), n._failWith(e),
16791
16806
  Promise.resolve(new Set);
@@ -16865,12 +16880,12 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
16865
16880
  * Provides all components needed for Firestore with IndexedDB persistence.
16866
16881
  */ class __PRIVATE_IndexedDbOfflineComponentProvider extends MemoryOfflineComponentProvider {
16867
16882
  constructor(e, t, n) {
16868
- super(), this.Ba = e, this.cacheSizeBytes = t, this.forceOwnership = n, this.synchronizeTabs = !1;
16883
+ super(), this.Qa = e, this.cacheSizeBytes = t, this.forceOwnership = n, this.synchronizeTabs = !1;
16869
16884
  }
16870
16885
  async initialize(e) {
16871
- await super.initialize(e), await this.Ba.initialize(this, e),
16886
+ await super.initialize(e), await this.Qa.initialize(this, e),
16872
16887
  // Enqueue writes from a previous session
16873
- await __PRIVATE_syncEngineEnsureWriteCallbacks(this.Ba.syncEngine), await __PRIVATE_fillWritePipeline(this.Ba.remoteStore),
16888
+ await __PRIVATE_syncEngineEnsureWriteCallbacks(this.Qa.syncEngine), await __PRIVATE_fillWritePipeline(this.Qa.remoteStore),
16874
16889
  // NOTE: This will immediately call the listener, so we make sure to
16875
16890
  // set it after localStore / remoteStore are started.
16876
16891
  await this.persistence.mi((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(),
@@ -16906,11 +16921,11 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
16906
16921
  * `synchronizeTabs` will be enabled.
16907
16922
  */ class __PRIVATE_MultiTabOfflineComponentProvider extends __PRIVATE_IndexedDbOfflineComponentProvider {
16908
16923
  constructor(e, t) {
16909
- super(e, t, /* forceOwnership= */ !1), this.Ba = e, this.cacheSizeBytes = t, this.synchronizeTabs = !0;
16924
+ super(e, t, /* forceOwnership= */ !1), this.Qa = e, this.cacheSizeBytes = t, this.synchronizeTabs = !0;
16910
16925
  }
16911
16926
  async initialize(e) {
16912
16927
  await super.initialize(e);
16913
- const t = this.Ba.syncEngine;
16928
+ const t = this.Qa.syncEngine;
16914
16929
  this.sharedClientState instanceof __PRIVATE_WebStorageSharedClientState && (this.sharedClientState.syncEngine = {
16915
16930
  Ys: __PRIVATE_syncEngineApplyBatchState.bind(null, t),
16916
16931
  Zs: __PRIVATE_syncEngineApplyTargetState.bind(null, t),
@@ -16921,7 +16936,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
16921
16936
  // NOTE: This will immediately call the listener, so we make sure to
16922
16937
  // set it after localStore / remoteStore are started.
16923
16938
  await this.persistence.mi((async e => {
16924
- await __PRIVATE_syncEngineApplyPrimaryState(this.Ba.syncEngine, e), this.gcScheduler && (e && !this.gcScheduler.started ? this.gcScheduler.start() : e || this.gcScheduler.stop()),
16939
+ await __PRIVATE_syncEngineApplyPrimaryState(this.Qa.syncEngine, e), this.gcScheduler && (e && !this.gcScheduler.started ? this.gcScheduler.start() : e || this.gcScheduler.stop()),
16925
16940
  this.indexBackfillerScheduler && (e && !this.indexBackfillerScheduler.started ? this.indexBackfillerScheduler.start() : e || this.indexBackfillerScheduler.stop());
16926
16941
  }));
16927
16942
  }
@@ -16972,18 +16987,18 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
16972
16987
  // PORTING NOTE: Manages state synchronization in multi-tab environments.
16973
16988
  r, i, s, o) {
16974
16989
  const _ = new __PRIVATE_SyncEngineImpl(e, t, n, r, i, s);
16975
- return o && (_.xa = !0), _;
16990
+ return o && (_.La = !0), _;
16976
16991
  }(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, e.initialUser, e.maxConcurrentLimboResolutions, t);
16977
16992
  }
16978
16993
  async terminate() {
16979
16994
  var e;
16980
16995
  await async function __PRIVATE_remoteStoreShutdown(e) {
16981
16996
  const t = __PRIVATE_debugCast(e);
16982
- __PRIVATE_logDebug("RemoteStore", "RemoteStore shutting down."), t.C_.add(5 /* OfflineCause.Shutdown */),
16983
- await __PRIVATE_disableNetworkInternal(t), t.F_.shutdown(),
16997
+ __PRIVATE_logDebug("RemoteStore", "RemoteStore shutting down."), t.M_.add(5 /* OfflineCause.Shutdown */),
16998
+ await __PRIVATE_disableNetworkInternal(t), t.O_.shutdown(),
16984
16999
  // Set the OnlineState to Unknown (rather than Offline) to avoid potentially
16985
17000
  // triggering spurious listener events with cached data, etc.
16986
- t.M_.set("Unknown" /* OnlineState.Unknown */);
17001
+ t.N_.set("Unknown" /* OnlineState.Unknown */);
16987
17002
  }(this.remoteStore), null === (e = this.datastore) || void 0 === e || e.terminate();
16988
17003
  }
16989
17004
  }
@@ -17091,15 +17106,15 @@ class __PRIVATE_AsyncObserver {
17091
17106
  this.muted = !1;
17092
17107
  }
17093
17108
  next(e) {
17094
- this.observer.next && this.ka(this.observer.next, e);
17109
+ this.observer.next && this.Ka(this.observer.next, e);
17095
17110
  }
17096
17111
  error(e) {
17097
- this.observer.error ? this.ka(this.observer.error, e) : __PRIVATE_logError("Uncaught Error in snapshot listener:", e.toString());
17112
+ this.observer.error ? this.Ka(this.observer.error, e) : __PRIVATE_logError("Uncaught Error in snapshot listener:", e.toString());
17098
17113
  }
17099
- qa() {
17114
+ $a() {
17100
17115
  this.muted = !0;
17101
17116
  }
17102
- ka(e, t) {
17117
+ Ka(e, t) {
17103
17118
  this.muted || setTimeout((() => {
17104
17119
  this.muted || e(t);
17105
17120
  }), 0);
@@ -17131,30 +17146,30 @@ class __PRIVATE_AsyncObserver {
17131
17146
  constructor(
17132
17147
  /** The reader to read from underlying binary bundle data source. */
17133
17148
  e, t) {
17134
- this.Qa = e, this.serializer = t,
17149
+ this.Ua = e, this.serializer = t,
17135
17150
  /** Cached bundle metadata. */
17136
17151
  this.metadata = new __PRIVATE_Deferred,
17137
17152
  /**
17138
17153
  * Internal buffer to hold bundle content, accumulating incomplete element
17139
17154
  * content.
17140
17155
  */
17141
- this.buffer = new Uint8Array, this.Ka = function __PRIVATE_newTextDecoder() {
17156
+ this.buffer = new Uint8Array, this.Wa = function __PRIVATE_newTextDecoder() {
17142
17157
  return new TextDecoder("utf-8");
17143
17158
  }(),
17144
17159
  // Read the metadata (which is the first element).
17145
- this.$a().then((e => {
17146
- e && e.na() ? this.metadata.resolve(e.ta.metadata) : this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is\n ${JSON.stringify(null == e ? void 0 : e.ta)}`));
17160
+ this.Ga().then((e => {
17161
+ e && e.sa() ? this.metadata.resolve(e.ia.metadata) : this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is\n ${JSON.stringify(null == e ? void 0 : e.ia)}`));
17147
17162
  }), (e => this.metadata.reject(e)));
17148
17163
  }
17149
17164
  close() {
17150
- return this.Qa.cancel();
17165
+ return this.Ua.cancel();
17151
17166
  }
17152
17167
  async getMetadata() {
17153
17168
  return this.metadata.promise;
17154
17169
  }
17155
- async La() {
17170
+ async qa() {
17156
17171
  // Makes sure metadata is read before proceeding.
17157
- return await this.getMetadata(), this.$a();
17172
+ return await this.getMetadata(), this.Ga();
17158
17173
  }
17159
17174
  /**
17160
17175
  * Reads from the head of internal buffer, and pulling more data from
@@ -17165,15 +17180,15 @@ class __PRIVATE_AsyncObserver {
17165
17180
  *
17166
17181
  * Returns either the bundled element, or null if we have reached the end of
17167
17182
  * the stream.
17168
- */ async $a() {
17169
- const e = await this.Ua();
17183
+ */ async Ga() {
17184
+ const e = await this.za();
17170
17185
  if (null === e) return null;
17171
- const t = this.Ka.decode(e), n = Number(t);
17172
- isNaN(n) && this.Wa(`length string (${t}) is not valid number`);
17173
- const r = await this.Ga(n);
17186
+ const t = this.Wa.decode(e), n = Number(t);
17187
+ isNaN(n) && this.ja(`length string (${t}) is not valid number`);
17188
+ const r = await this.Ha(n);
17174
17189
  return new __PRIVATE_SizedBundleElement(JSON.parse(r), e.length + n);
17175
17190
  }
17176
- /** First index of '{' from the underlying buffer. */ za() {
17191
+ /** First index of '{' from the underlying buffer. */ Ja() {
17177
17192
  return this.buffer.findIndex((e => e === "{".charCodeAt(0)));
17178
17193
  }
17179
17194
  /**
@@ -17181,17 +17196,17 @@ class __PRIVATE_AsyncObserver {
17181
17196
  * return the content.
17182
17197
  *
17183
17198
  * If reached end of the stream, returns a null.
17184
- */ async Ua() {
17185
- for (;this.za() < 0; ) {
17186
- if (await this.ja()) break;
17199
+ */ async za() {
17200
+ for (;this.Ja() < 0; ) {
17201
+ if (await this.Ya()) break;
17187
17202
  }
17188
17203
  // Broke out of the loop because underlying stream is closed, and there
17189
17204
  // happens to be no more data to process.
17190
17205
  if (0 === this.buffer.length) return null;
17191
- const e = this.za();
17206
+ const e = this.Ja();
17192
17207
  // Broke out of the loop because underlying stream is closed, but still
17193
17208
  // cannot find an open bracket.
17194
- e < 0 && this.Wa("Reached the end of bundle when a length string is expected.");
17209
+ e < 0 && this.ja("Reached the end of bundle when a length string is expected.");
17195
17210
  const t = this.buffer.slice(0, e);
17196
17211
  // Update the internal buffer to drop the read length.
17197
17212
  return this.buffer = this.buffer.slice(e), t;
@@ -17201,23 +17216,23 @@ class __PRIVATE_AsyncObserver {
17201
17216
  * number of bytes, pulling more data from the underlying stream if needed.
17202
17217
  *
17203
17218
  * Returns a string decoded from the read bytes.
17204
- */ async Ga(e) {
17219
+ */ async Ha(e) {
17205
17220
  for (;this.buffer.length < e; ) {
17206
- await this.ja() && this.Wa("Reached the end of bundle when more is expected.");
17221
+ await this.Ya() && this.ja("Reached the end of bundle when more is expected.");
17207
17222
  }
17208
- const t = this.Ka.decode(this.buffer.slice(0, e));
17223
+ const t = this.Wa.decode(this.buffer.slice(0, e));
17209
17224
  // Update the internal buffer to drop the read json string.
17210
17225
  return this.buffer = this.buffer.slice(e), t;
17211
17226
  }
17212
- Wa(e) {
17227
+ ja(e) {
17213
17228
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
17214
- throw this.Qa.cancel(), new Error(`Invalid bundle format: ${e}`);
17229
+ throw this.Ua.cancel(), new Error(`Invalid bundle format: ${e}`);
17215
17230
  }
17216
17231
  /**
17217
17232
  * Pulls more data from underlying stream to internal buffer.
17218
17233
  * Returns a boolean indicating whether the stream is finished.
17219
- */ async ja() {
17220
- const e = await this.Qa.read();
17234
+ */ async Ya() {
17235
+ const e = await this.Ua.read();
17221
17236
  if (!e.done) {
17222
17237
  const t = new Uint8Array(this.buffer.length + e.value.length);
17223
17238
  t.set(this.buffer), t.set(e.value, this.buffer.length), this.buffer = t;
@@ -17270,7 +17285,7 @@ class Transaction$2 {
17270
17285
  const t = await async function __PRIVATE_invokeBatchGetDocumentsRpc(e, t) {
17271
17286
  const n = __PRIVATE_debugCast(e), r = {
17272
17287
  documents: t.map((e => __PRIVATE_toName(n.serializer, e)))
17273
- }, i = await n.Co("BatchGetDocuments", n.serializer.databaseId, ResourcePath.emptyPath(), r, t.length), s = new Map;
17288
+ }, i = await n.Mo("BatchGetDocuments", n.serializer.databaseId, ResourcePath.emptyPath(), r, t.length), s = new Map;
17274
17289
  i.forEach((e => {
17275
17290
  const t = __PRIVATE_fromBatchGetDocumentsResponse(n.serializer, e);
17276
17291
  s.set(t.key.toString(), t);
@@ -17313,7 +17328,7 @@ class Transaction$2 {
17313
17328
  const n = __PRIVATE_debugCast(e), r = {
17314
17329
  writes: t.map((e => toMutation(n.serializer, e)))
17315
17330
  };
17316
- await n.wo("Commit", n.serializer.databaseId, ResourcePath.emptyPath(), r);
17331
+ await n.Do("Commit", n.serializer.databaseId, ResourcePath.emptyPath(), r);
17317
17332
  }(this.datastore, this.mutations), this.committed = !0;
17318
17333
  }
17319
17334
  recordVersion(e) {
@@ -17390,26 +17405,26 @@ class Transaction$2 {
17390
17405
  */ class __PRIVATE_TransactionRunner {
17391
17406
  constructor(e, t, n, r, i) {
17392
17407
  this.asyncQueue = e, this.datastore = t, this.options = n, this.updateFunction = r,
17393
- this.deferred = i, this.Ha = n.maxAttempts, this.zo = new __PRIVATE_ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
17408
+ this.deferred = i, this.Za = n.maxAttempts, this.Jo = new __PRIVATE_ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
17394
17409
  }
17395
- /** Runs the transaction and sets the result on deferred. */ Ja() {
17396
- this.Ha -= 1, this.Ya();
17410
+ /** Runs the transaction and sets the result on deferred. */ Xa() {
17411
+ this.Za -= 1, this.eu();
17397
17412
  }
17398
- Ya() {
17399
- this.zo.ko((async () => {
17400
- const e = new Transaction$2(this.datastore), t = this.Za(e);
17413
+ eu() {
17414
+ this.Jo.Ko((async () => {
17415
+ const e = new Transaction$2(this.datastore), t = this.tu(e);
17401
17416
  t && t.then((t => {
17402
17417
  this.asyncQueue.enqueueAndForget((() => e.commit().then((() => {
17403
17418
  this.deferred.resolve(t);
17404
17419
  })).catch((e => {
17405
- this.Xa(e);
17420
+ this.nu(e);
17406
17421
  }))));
17407
17422
  })).catch((e => {
17408
- this.Xa(e);
17423
+ this.nu(e);
17409
17424
  }));
17410
17425
  }));
17411
17426
  }
17412
- Za(e) {
17427
+ tu(e) {
17413
17428
  try {
17414
17429
  const t = this.updateFunction(e);
17415
17430
  return !__PRIVATE_isNullOrUndefined(t) && t.catch && t.then ? t : (this.deferred.reject(Error("Transaction callback must return a Promise")),
@@ -17419,11 +17434,11 @@ class Transaction$2 {
17419
17434
  return this.deferred.reject(e), null;
17420
17435
  }
17421
17436
  }
17422
- Xa(e) {
17423
- this.Ha > 0 && this.eu(e) ? (this.Ha -= 1, this.asyncQueue.enqueueAndForget((() => (this.Ya(),
17437
+ nu(e) {
17438
+ this.Za > 0 && this.ru(e) ? (this.Za -= 1, this.asyncQueue.enqueueAndForget((() => (this.eu(),
17424
17439
  Promise.resolve())))) : this.deferred.reject(e);
17425
17440
  }
17426
- eu(e) {
17441
+ ru(e) {
17427
17442
  if ("FirebaseError" === e.name) {
17428
17443
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
17429
17444
  // non-matching document versions with ABORTED. These errors should be retried.
@@ -17608,7 +17623,7 @@ async function __PRIVATE_getEventManager(e) {
17608
17623
  const t = await __PRIVATE_getPersistence(e), n = await __PRIVATE_getRemoteStore(e);
17609
17624
  return t.setNetworkEnabled(!0), function __PRIVATE_remoteStoreEnableNetwork(e) {
17610
17625
  const t = __PRIVATE_debugCast(e);
17611
- return t.C_.delete(0 /* OfflineCause.UserDisabled */), __PRIVATE_enableNetworkInternal(t);
17626
+ return t.M_.delete(0 /* OfflineCause.UserDisabled */), __PRIVATE_enableNetworkInternal(t);
17612
17627
  }(n);
17613
17628
  }));
17614
17629
  }
@@ -17618,9 +17633,9 @@ async function __PRIVATE_getEventManager(e) {
17618
17633
  const t = await __PRIVATE_getPersistence(e), n = await __PRIVATE_getRemoteStore(e);
17619
17634
  return t.setNetworkEnabled(!1), async function __PRIVATE_remoteStoreDisableNetwork(e) {
17620
17635
  const t = __PRIVATE_debugCast(e);
17621
- t.C_.add(0 /* OfflineCause.UserDisabled */), await __PRIVATE_disableNetworkInternal(t),
17636
+ t.M_.add(0 /* OfflineCause.UserDisabled */), await __PRIVATE_disableNetworkInternal(t),
17622
17637
  // Set the OnlineState to Offline so get()s return from cache, etc.
17623
- t.M_.set("Offline" /* OnlineState.Offline */);
17638
+ t.N_.set("Offline" /* OnlineState.Offline */);
17624
17639
  }(n);
17625
17640
  }));
17626
17641
  }
@@ -17671,7 +17686,7 @@ function __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {
17671
17686
  error: e => i.reject(e)
17672
17687
  }), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {
17673
17688
  includeMetadataChanges: !0,
17674
- ea: !0
17689
+ ra: !0
17675
17690
  });
17676
17691
  return __PRIVATE_eventManagerListen(e, o);
17677
17692
  }(await __PRIVATE_getEventManager(e), e.asyncQueue, t, n, r))), r.promise;
@@ -17682,7 +17697,7 @@ function __PRIVATE_firestoreClientGetDocumentsFromLocalCache(e, t) {
17682
17697
  return e.asyncQueue.enqueueAndForget((async () => async function __PRIVATE_executeQueryFromCache(e, t, n) {
17683
17698
  try {
17684
17699
  const r = await __PRIVATE_localStoreExecuteQuery(e, t,
17685
- /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.ls), s = i.Ia(r.documents), o = i.applyChanges(s,
17700
+ /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.ls), s = i.da(r.documents), o = i.applyChanges(s,
17686
17701
  /* limboResolutionEnabled= */ !1);
17687
17702
  n.resolve(o.snapshot);
17688
17703
  } catch (e) {
@@ -17708,7 +17723,7 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
17708
17723
  error: e => i.reject(e)
17709
17724
  }), o = new __PRIVATE_QueryListener(n, s, {
17710
17725
  includeMetadataChanges: !0,
17711
- ea: !0
17726
+ ra: !0
17712
17727
  });
17713
17728
  return __PRIVATE_eventManagerListen(e, o);
17714
17729
  }(await __PRIVATE_getEventManager(e), e.asyncQueue, t, n, r))), r.promise;
@@ -17717,13 +17732,13 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
17717
17732
  function __PRIVATE_firestoreClientAddSnapshotsInSyncListener(e, t) {
17718
17733
  const n = new __PRIVATE_AsyncObserver(t);
17719
17734
  return e.asyncQueue.enqueueAndForget((async () => function __PRIVATE_addSnapshotsInSyncListener(e, t) {
17720
- __PRIVATE_debugCast(e).U_.add(t),
17735
+ __PRIVATE_debugCast(e).z_.add(t),
17721
17736
  // Immediately fire an initial event, indicating all existing listeners
17722
17737
  // are in-sync.
17723
17738
  t.next();
17724
17739
  }(await __PRIVATE_getEventManager(e), n))), () => {
17725
- n.qa(), e.asyncQueue.enqueueAndForget((async () => function __PRIVATE_removeSnapshotsInSyncListener(e, t) {
17726
- __PRIVATE_debugCast(e).U_.delete(t);
17740
+ n.$a(), e.asyncQueue.enqueueAndForget((async () => function __PRIVATE_removeSnapshotsInSyncListener(e, t) {
17741
+ __PRIVATE_debugCast(e).z_.delete(t);
17727
17742
  }(await __PRIVATE_getEventManager(e), n)));
17728
17743
  };
17729
17744
  }
@@ -18388,40 +18403,40 @@ function doc(e, t, ...n) {
18388
18403
  */ class __PRIVATE_AsyncQueueImpl {
18389
18404
  constructor() {
18390
18405
  // The last promise in the queue.
18391
- this.tu = Promise.resolve(),
18406
+ this.iu = Promise.resolve(),
18392
18407
  // A list of retryable operations. Retryable operations are run in order and
18393
18408
  // retried with backoff.
18394
- this.nu = [],
18409
+ this.su = [],
18395
18410
  // Is this AsyncQueue being shut down? Once it is set to true, it will not
18396
18411
  // be changed again.
18397
- this.ru = !1,
18412
+ this.ou = !1,
18398
18413
  // Operations scheduled to be queued in the future. Operations are
18399
18414
  // automatically removed after they are run or canceled.
18400
- this.iu = [],
18415
+ this._u = [],
18401
18416
  // visible for testing
18402
- this.su = null,
18417
+ this.au = null,
18403
18418
  // Flag set while there's an outstanding AsyncQueue operation, used for
18404
18419
  // assertion sanity-checks.
18405
- this.ou = !1,
18420
+ this.uu = !1,
18406
18421
  // Enabled during shutdown on Safari to prevent future access to IndexedDB.
18407
- this._u = !1,
18422
+ this.cu = !1,
18408
18423
  // List of TimerIds to fast-forward delays for.
18409
- this.au = [],
18424
+ this.lu = [],
18410
18425
  // Backoff timer used to schedule retries for retryable operations
18411
- this.zo = new __PRIVATE_ExponentialBackoff(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
18426
+ this.Jo = new __PRIVATE_ExponentialBackoff(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
18412
18427
  // Visibility handler that triggers an immediate retry of all retryable
18413
18428
  // operations. Meant to speed up recovery when we regain file system access
18414
18429
  // after page comes into foreground.
18415
- this.uu = () => {
18430
+ this.hu = () => {
18416
18431
  const e = getDocument();
18417
18432
  e && __PRIVATE_logDebug("AsyncQueue", "Visibility state changed to " + e.visibilityState),
18418
- this.zo.Qo();
18433
+ this.Jo.Uo();
18419
18434
  };
18420
18435
  const e = getDocument();
18421
- e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.uu);
18436
+ e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.hu);
18422
18437
  }
18423
18438
  get isShuttingDown() {
18424
- return this.ru;
18439
+ return this.ou;
18425
18440
  }
18426
18441
  /**
18427
18442
  * Adds a new operation to the queue without waiting for it to complete (i.e.
@@ -18431,44 +18446,44 @@ function doc(e, t, ...n) {
18431
18446
  this.enqueue(e);
18432
18447
  }
18433
18448
  enqueueAndForgetEvenWhileRestricted(e) {
18434
- this.cu(),
18449
+ this.Pu(),
18435
18450
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
18436
- this.lu(e);
18451
+ this.Iu(e);
18437
18452
  }
18438
18453
  enterRestrictedMode(e) {
18439
- if (!this.ru) {
18440
- this.ru = !0, this._u = e || !1;
18454
+ if (!this.ou) {
18455
+ this.ou = !0, this.cu = e || !1;
18441
18456
  const t = getDocument();
18442
- t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.uu);
18457
+ t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.hu);
18443
18458
  }
18444
18459
  }
18445
18460
  enqueue(e) {
18446
- if (this.cu(), this.ru)
18461
+ if (this.Pu(), this.ou)
18447
18462
  // Return a Promise which never resolves.
18448
18463
  return new Promise((() => {}));
18449
18464
  // Create a deferred Promise that we can return to the callee. This
18450
18465
  // allows us to return a "hanging Promise" only to the callee and still
18451
18466
  // advance the queue even when the operation is not run.
18452
18467
  const t = new __PRIVATE_Deferred;
18453
- return this.lu((() => this.ru && this._u ? Promise.resolve() : (e().then(t.resolve, t.reject),
18468
+ return this.Iu((() => this.ou && this.cu ? Promise.resolve() : (e().then(t.resolve, t.reject),
18454
18469
  t.promise))).then((() => t.promise));
18455
18470
  }
18456
18471
  enqueueRetryable(e) {
18457
- this.enqueueAndForget((() => (this.nu.push(e), this.hu())));
18472
+ this.enqueueAndForget((() => (this.su.push(e), this.Tu())));
18458
18473
  }
18459
18474
  /**
18460
18475
  * Runs the next operation from the retryable queue. If the operation fails,
18461
18476
  * reschedules with backoff.
18462
- */ async hu() {
18463
- if (0 !== this.nu.length) {
18477
+ */ async Tu() {
18478
+ if (0 !== this.su.length) {
18464
18479
  try {
18465
- await this.nu[0](), this.nu.shift(), this.zo.reset();
18480
+ await this.su[0](), this.su.shift(), this.Jo.reset();
18466
18481
  } catch (e) {
18467
18482
  if (!__PRIVATE_isIndexedDbTransactionError(e)) throw e;
18468
18483
  // Failure will be handled by AsyncQueue
18469
18484
  __PRIVATE_logDebug("AsyncQueue", "Operation failed with retryable error: " + e);
18470
18485
  }
18471
- this.nu.length > 0 &&
18486
+ this.su.length > 0 &&
18472
18487
  // If there are additional operations, we re-schedule `retryNextOp()`.
18473
18488
  // This is necessary to run retryable operations that failed during
18474
18489
  // their initial attempt since we don't know whether they are already
@@ -18479,12 +18494,12 @@ function doc(e, t, ...n) {
18479
18494
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
18480
18495
  // new backoff on every call, there is only ever a single additional
18481
18496
  // operation in the queue.
18482
- this.zo.ko((() => this.hu()));
18497
+ this.Jo.Ko((() => this.Tu()));
18483
18498
  }
18484
18499
  }
18485
- lu(e) {
18486
- const t = this.tu.then((() => (this.ou = !0, e().catch((e => {
18487
- this.su = e, this.ou = !1;
18500
+ Iu(e) {
18501
+ const t = this.iu.then((() => (this.uu = !0, e().catch((e => {
18502
+ this.au = e, this.uu = !1;
18488
18503
  const t =
18489
18504
  /**
18490
18505
  * Chrome includes Error.message in Error.stack. Other browsers do not.
@@ -18516,38 +18531,38 @@ function doc(e, t, ...n) {
18516
18531
  // all further attempts to chain (via .then) will just short-circuit
18517
18532
  // and return the rejected Promise.
18518
18533
  throw __PRIVATE_logError("INTERNAL UNHANDLED ERROR: ", t), e;
18519
- })).then((e => (this.ou = !1, e))))));
18520
- return this.tu = t, t;
18534
+ })).then((e => (this.uu = !1, e))))));
18535
+ return this.iu = t, t;
18521
18536
  }
18522
18537
  enqueueAfterDelay(e, t, n) {
18523
- this.cu(),
18538
+ this.Pu(),
18524
18539
  // Fast-forward delays for timerIds that have been overriden.
18525
- this.au.indexOf(e) > -1 && (t = 0);
18526
- const r = DelayedOperation.createAndSchedule(this, e, t, n, (e => this.Pu(e)));
18527
- return this.iu.push(r), r;
18540
+ this.lu.indexOf(e) > -1 && (t = 0);
18541
+ const r = DelayedOperation.createAndSchedule(this, e, t, n, (e => this.Eu(e)));
18542
+ return this._u.push(r), r;
18528
18543
  }
18529
- cu() {
18530
- this.su && fail();
18544
+ Pu() {
18545
+ this.au && fail();
18531
18546
  }
18532
18547
  verifyOperationInProgress() {}
18533
18548
  /**
18534
18549
  * Waits until all currently queued tasks are finished executing. Delayed
18535
18550
  * operations are not run.
18536
- */ async Iu() {
18551
+ */ async du() {
18537
18552
  // Operations in the queue prior to draining may have enqueued additional
18538
18553
  // operations. Keep draining the queue until the tail is no longer advanced,
18539
18554
  // which indicates that no more new operations were enqueued and that all
18540
18555
  // operations were executed.
18541
18556
  let e;
18542
18557
  do {
18543
- e = this.tu, await e;
18544
- } while (e !== this.tu);
18558
+ e = this.iu, await e;
18559
+ } while (e !== this.iu);
18545
18560
  }
18546
18561
  /**
18547
18562
  * For Tests: Determine if a delayed operation with a particular TimerId
18548
18563
  * exists.
18549
- */ Tu(e) {
18550
- for (const t of this.iu) if (t.timerId === e) return !0;
18564
+ */ Au(e) {
18565
+ for (const t of this._u) if (t.timerId === e) return !0;
18551
18566
  return !1;
18552
18567
  }
18553
18568
  /**
@@ -18556,24 +18571,24 @@ function doc(e, t, ...n) {
18556
18571
  * @param lastTimerId - Delayed operations up to and including this TimerId
18557
18572
  * will be drained. Pass TimerId.All to run all delayed operations.
18558
18573
  * @returns a Promise that resolves once all operations have been run.
18559
- */ Eu(e) {
18574
+ */ Ru(e) {
18560
18575
  // Note that draining may generate more delayed ops, so we do that first.
18561
- return this.Iu().then((() => {
18576
+ return this.du().then((() => {
18562
18577
  // Run ops in the same order they'd run if they ran naturally.
18563
- this.iu.sort(((e, t) => e.targetTimeMs - t.targetTimeMs));
18564
- for (const t of this.iu) if (t.skipDelay(), "all" /* TimerId.All */ !== e && t.timerId === e) break;
18565
- return this.Iu();
18578
+ this._u.sort(((e, t) => e.targetTimeMs - t.targetTimeMs));
18579
+ for (const t of this._u) if (t.skipDelay(), "all" /* TimerId.All */ !== e && t.timerId === e) break;
18580
+ return this.du();
18566
18581
  }));
18567
18582
  }
18568
18583
  /**
18569
18584
  * For Tests: Skip all subsequent delays for a timer id.
18570
- */ du(e) {
18571
- this.au.push(e);
18585
+ */ Vu(e) {
18586
+ this.lu.push(e);
18572
18587
  }
18573
- /** Called once a DelayedOperation is run or canceled. */ Pu(e) {
18588
+ /** Called once a DelayedOperation is run or canceled. */ Eu(e) {
18574
18589
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
18575
- const t = this.iu.indexOf(e);
18576
- this.iu.splice(t, 1);
18590
+ const t = this._u.indexOf(e);
18591
+ this._u.splice(t, 1);
18577
18592
  }
18578
18593
  }
18579
18594
 
@@ -19387,55 +19402,55 @@ function __PRIVATE_isWrite(e) {
19387
19402
  this.settings = e, this.databaseId = t, this.serializer = n, this.ignoreUndefinedProperties = r,
19388
19403
  // Minor hack: If fieldTransforms is undefined, we assume this is an
19389
19404
  // external call and we need to validate the entire path.
19390
- void 0 === i && this.Au(), this.fieldTransforms = i || [], this.fieldMask = s || [];
19405
+ void 0 === i && this.mu(), this.fieldTransforms = i || [], this.fieldMask = s || [];
19391
19406
  }
19392
19407
  get path() {
19393
19408
  return this.settings.path;
19394
19409
  }
19395
- get Ru() {
19396
- return this.settings.Ru;
19410
+ get fu() {
19411
+ return this.settings.fu;
19397
19412
  }
19398
- /** Returns a new context with the specified settings overwritten. */ Vu(e) {
19413
+ /** Returns a new context with the specified settings overwritten. */ gu(e) {
19399
19414
  return new __PRIVATE_ParseContextImpl(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.serializer, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
19400
19415
  }
19401
- mu(e) {
19416
+ pu(e) {
19402
19417
  var t;
19403
- const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.Vu({
19418
+ const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.gu({
19404
19419
  path: n,
19405
- fu: !1
19420
+ yu: !1
19406
19421
  });
19407
- return r.gu(e), r;
19422
+ return r.wu(e), r;
19408
19423
  }
19409
- pu(e) {
19424
+ Su(e) {
19410
19425
  var t;
19411
- const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.Vu({
19426
+ const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.gu({
19412
19427
  path: n,
19413
- fu: !1
19428
+ yu: !1
19414
19429
  });
19415
- return r.Au(), r;
19430
+ return r.mu(), r;
19416
19431
  }
19417
- yu(e) {
19432
+ bu(e) {
19418
19433
  // TODO(b/34871131): We don't support array paths right now; so make path
19419
19434
  // undefined.
19420
- return this.Vu({
19435
+ return this.gu({
19421
19436
  path: void 0,
19422
- fu: !0
19437
+ yu: !0
19423
19438
  });
19424
19439
  }
19425
- wu(e) {
19426
- return __PRIVATE_createError(e, this.settings.methodName, this.settings.Su || !1, this.path, this.settings.bu);
19440
+ Du(e) {
19441
+ return __PRIVATE_createError(e, this.settings.methodName, this.settings.Cu || !1, this.path, this.settings.vu);
19427
19442
  }
19428
19443
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(e) {
19429
19444
  return void 0 !== this.fieldMask.find((t => e.isPrefixOf(t))) || void 0 !== this.fieldTransforms.find((t => e.isPrefixOf(t.field)));
19430
19445
  }
19431
- Au() {
19446
+ mu() {
19432
19447
  // TODO(b/34871131): Remove null check once we have proper paths for fields
19433
19448
  // within arrays.
19434
- if (this.path) for (let e = 0; e < this.path.length; e++) this.gu(this.path.get(e));
19449
+ if (this.path) for (let e = 0; e < this.path.length; e++) this.wu(this.path.get(e));
19435
19450
  }
19436
- gu(e) {
19437
- if (0 === e.length) throw this.wu("Document fields must not be empty");
19438
- if (__PRIVATE_isWrite(this.Ru) && we.test(e)) throw this.wu('Document fields cannot begin and end with "__"');
19451
+ wu(e) {
19452
+ if (0 === e.length) throw this.Du("Document fields must not be empty");
19453
+ if (__PRIVATE_isWrite(this.fu) && we.test(e)) throw this.Du('Document fields cannot begin and end with "__"');
19439
19454
  }
19440
19455
  }
19441
19456
 
@@ -19446,14 +19461,14 @@ function __PRIVATE_isWrite(e) {
19446
19461
  constructor(e, t, n) {
19447
19462
  this.databaseId = e, this.ignoreUndefinedProperties = t, this.serializer = n || __PRIVATE_newSerializer(e);
19448
19463
  }
19449
- /** Creates a new top-level parse context. */ Du(e, t, n, r = !1) {
19464
+ /** Creates a new top-level parse context. */ Fu(e, t, n, r = !1) {
19450
19465
  return new __PRIVATE_ParseContextImpl({
19451
- Ru: e,
19466
+ fu: e,
19452
19467
  methodName: t,
19453
- bu: n,
19468
+ vu: n,
19454
19469
  path: FieldPath$1.emptyPath(),
19455
- fu: !1,
19456
- Su: r
19470
+ yu: !1,
19471
+ Cu: r
19457
19472
  }, this.databaseId, this.serializer, this.ignoreUndefinedProperties);
19458
19473
  }
19459
19474
  }
@@ -19464,7 +19479,7 @@ function __PRIVATE_newUserDataReader(e) {
19464
19479
  }
19465
19480
 
19466
19481
  /** Parse document data from a set() call. */ function __PRIVATE_parseSetData(e, t, n, r, i, s = {}) {
19467
- const o = e.Du(s.merge || s.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , t, n, i);
19482
+ const o = e.Fu(s.merge || s.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , t, n, i);
19468
19483
  __PRIVATE_validatePlainObject("Data must be an object, but it was:", o, r);
19469
19484
  const _ = __PRIVATE_parseObject(r, o);
19470
19485
  let a, u;
@@ -19482,7 +19497,7 @@ function __PRIVATE_newUserDataReader(e) {
19482
19497
 
19483
19498
  class __PRIVATE_DeleteFieldValueImpl extends FieldValue {
19484
19499
  _toFieldTransform(e) {
19485
- if (2 /* UserDataSource.MergeSet */ !== e.Ru) throw 1 /* UserDataSource.Update */ === e.Ru ? e.wu(`${this._methodName}() can only appear at the top level of your update data`) : e.wu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
19500
+ if (2 /* UserDataSource.MergeSet */ !== e.fu) throw 1 /* UserDataSource.Update */ === e.fu ? e.Du(`${this._methodName}() can only appear at the top level of your update data`) : e.Du(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
19486
19501
  // No transform to add for a delete, but we need to add it to our
19487
19502
  // fieldMask so it gets deleted.
19488
19503
  return e.fieldMask.push(e.path), null;
@@ -19509,10 +19524,10 @@ class __PRIVATE_DeleteFieldValueImpl extends FieldValue {
19509
19524
  * @param arrayElement - Whether or not the FieldValue has an array.
19510
19525
  */ function __PRIVATE_createSentinelChildContext(e, t, n) {
19511
19526
  return new __PRIVATE_ParseContextImpl({
19512
- Ru: 3 /* UserDataSource.Argument */ ,
19513
- bu: t.settings.bu,
19527
+ fu: 3 /* UserDataSource.Argument */ ,
19528
+ vu: t.settings.vu,
19514
19529
  methodName: e._methodName,
19515
- fu: n
19530
+ yu: n
19516
19531
  }, t.databaseId, t.serializer, t.ignoreUndefinedProperties);
19517
19532
  }
19518
19533
 
@@ -19527,47 +19542,47 @@ class __PRIVATE_ServerTimestampFieldValueImpl extends FieldValue {
19527
19542
 
19528
19543
  class __PRIVATE_ArrayUnionFieldValueImpl extends FieldValue {
19529
19544
  constructor(e, t) {
19530
- super(e), this.Cu = t;
19545
+ super(e), this.Mu = t;
19531
19546
  }
19532
19547
  _toFieldTransform(e) {
19533
19548
  const t = __PRIVATE_createSentinelChildContext(this, e,
19534
- /*array=*/ !0), n = this.Cu.map((e => __PRIVATE_parseData(e, t))), r = new __PRIVATE_ArrayUnionTransformOperation(n);
19549
+ /*array=*/ !0), n = this.Mu.map((e => __PRIVATE_parseData(e, t))), r = new __PRIVATE_ArrayUnionTransformOperation(n);
19535
19550
  return new FieldTransform(e.path, r);
19536
19551
  }
19537
19552
  isEqual(e) {
19538
- return e instanceof __PRIVATE_ArrayUnionFieldValueImpl && util.deepEqual(this.Cu, e.Cu);
19553
+ return e instanceof __PRIVATE_ArrayUnionFieldValueImpl && util.deepEqual(this.Mu, e.Mu);
19539
19554
  }
19540
19555
  }
19541
19556
 
19542
19557
  class __PRIVATE_ArrayRemoveFieldValueImpl extends FieldValue {
19543
19558
  constructor(e, t) {
19544
- super(e), this.Cu = t;
19559
+ super(e), this.Mu = t;
19545
19560
  }
19546
19561
  _toFieldTransform(e) {
19547
19562
  const t = __PRIVATE_createSentinelChildContext(this, e,
19548
- /*array=*/ !0), n = this.Cu.map((e => __PRIVATE_parseData(e, t))), r = new __PRIVATE_ArrayRemoveTransformOperation(n);
19563
+ /*array=*/ !0), n = this.Mu.map((e => __PRIVATE_parseData(e, t))), r = new __PRIVATE_ArrayRemoveTransformOperation(n);
19549
19564
  return new FieldTransform(e.path, r);
19550
19565
  }
19551
19566
  isEqual(e) {
19552
- return e instanceof __PRIVATE_ArrayRemoveFieldValueImpl && util.deepEqual(this.Cu, e.Cu);
19567
+ return e instanceof __PRIVATE_ArrayRemoveFieldValueImpl && util.deepEqual(this.Mu, e.Mu);
19553
19568
  }
19554
19569
  }
19555
19570
 
19556
19571
  class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19557
19572
  constructor(e, t) {
19558
- super(e), this.vu = t;
19573
+ super(e), this.xu = t;
19559
19574
  }
19560
19575
  _toFieldTransform(e) {
19561
- const t = new __PRIVATE_NumericIncrementTransformOperation(e.serializer, toNumber(e.serializer, this.vu));
19576
+ const t = new __PRIVATE_NumericIncrementTransformOperation(e.serializer, toNumber(e.serializer, this.xu));
19562
19577
  return new FieldTransform(e.path, t);
19563
19578
  }
19564
19579
  isEqual(e) {
19565
- return e instanceof __PRIVATE_NumericIncrementFieldValueImpl && this.vu === e.vu;
19580
+ return e instanceof __PRIVATE_NumericIncrementFieldValueImpl && this.xu === e.xu;
19566
19581
  }
19567
19582
  }
19568
19583
 
19569
19584
  /** Parse update data from an update() call. */ function __PRIVATE_parseUpdateData(e, t, n, r) {
19570
- const i = e.Du(1 /* UserDataSource.Update */ , t, n);
19585
+ const i = e.Fu(1 /* UserDataSource.Update */ , t, n);
19571
19586
  __PRIVATE_validatePlainObject("Data must be an object, but it was:", i, r);
19572
19587
  const s = [], o = ObjectValue.empty();
19573
19588
  forEach(r, ((e, r) => {
@@ -19575,7 +19590,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19575
19590
  // For Compat types, we have to "extract" the underlying types before
19576
19591
  // performing validation.
19577
19592
  r = util.getModularInstance(r);
19578
- const a = i.pu(_);
19593
+ const a = i.Su(_);
19579
19594
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19580
19595
  // Add it to the field mask, but don't add anything to updateData.
19581
19596
  s.push(_); else {
@@ -19588,7 +19603,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19588
19603
  }
19589
19604
 
19590
19605
  /** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(e, t, n, r, i, s) {
19591
- const o = e.Du(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
19606
+ const o = e.Fu(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
19592
19607
  if (s.length % 2 != 0) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);
19593
19608
  for (let e = 0; e < s.length; e += 2) _.push(__PRIVATE_fieldPathFromArgument$1(t, s[e])),
19594
19609
  a.push(s[e + 1]);
@@ -19601,7 +19616,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19601
19616
  // For Compat types, we have to "extract" the underlying types before
19602
19617
  // performing validation.
19603
19618
  n = util.getModularInstance(n);
19604
- const r = o.pu(t);
19619
+ const r = o.Su(t);
19605
19620
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19606
19621
  // Add it to the field mask, but don't add anything to updateData.
19607
19622
  u.push(t); else {
@@ -19620,7 +19635,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19620
19635
  * @param allowArrays - Whether the query value is an array that may directly
19621
19636
  * contain additional arrays (e.g. the operand of an `in` query).
19622
19637
  */ function __PRIVATE_parseQueryValue(e, t, n, r = !1) {
19623
- return __PRIVATE_parseData(n, e.Du(r ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , t));
19638
+ return __PRIVATE_parseData(n, e.Fu(r ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , t));
19624
19639
  }
19625
19640
 
19626
19641
  /**
@@ -19649,8 +19664,8 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19649
19664
  */
19650
19665
  return function __PRIVATE_parseSentinelFieldValue(e, t) {
19651
19666
  // Sentinels are only supported with writes, and not within arrays.
19652
- if (!__PRIVATE_isWrite(t.Ru)) throw t.wu(`${e._methodName}() can only be used with update() and set()`);
19653
- if (!t.path) throw t.wu(`${e._methodName}() is not currently supported inside arrays`);
19667
+ if (!__PRIVATE_isWrite(t.fu)) throw t.Du(`${e._methodName}() can only be used with update() and set()`);
19668
+ if (!t.path) throw t.Du(`${e._methodName}() is not currently supported inside arrays`);
19654
19669
  const n = e._toFieldTransform(t);
19655
19670
  n && t.fieldTransforms.push(n);
19656
19671
  }
@@ -19674,12 +19689,12 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19674
19689
  // the set of values to be included for the IN query) that may directly
19675
19690
  // contain additional arrays (each representing an individual field
19676
19691
  // value), so we disable this validation.
19677
- if (t.settings.fu && 4 /* UserDataSource.ArrayArgument */ !== t.Ru) throw t.wu("Nested arrays are not supported");
19692
+ if (t.settings.yu && 4 /* UserDataSource.ArrayArgument */ !== t.fu) throw t.Du("Nested arrays are not supported");
19678
19693
  return function __PRIVATE_parseArray(e, t) {
19679
19694
  const n = [];
19680
19695
  let r = 0;
19681
19696
  for (const i of e) {
19682
- let e = __PRIVATE_parseData(i, t.yu(r));
19697
+ let e = __PRIVATE_parseData(i, t.bu(r));
19683
19698
  null == e && (
19684
19699
  // Just include nulls in the array for fields being replaced with a
19685
19700
  // sentinel.
@@ -19731,12 +19746,12 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19731
19746
  };
19732
19747
  if (e instanceof DocumentReference) {
19733
19748
  const n = t.databaseId, r = e.firestore._databaseId;
19734
- if (!r.isEqual(n)) throw t.wu(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
19749
+ if (!r.isEqual(n)) throw t.Du(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
19735
19750
  return {
19736
19751
  referenceValue: __PRIVATE_toResourceName(e.firestore._databaseId || t.databaseId, e._key.path)
19737
19752
  };
19738
19753
  }
19739
- throw t.wu(`Unsupported field value: ${__PRIVATE_valueDescription(e)}`);
19754
+ throw t.Du(`Unsupported field value: ${__PRIVATE_valueDescription(e)}`);
19740
19755
  }
19741
19756
  /**
19742
19757
  * Checks whether an object looks like a JSON object that should be converted
@@ -19753,7 +19768,7 @@ function __PRIVATE_parseObject(e, t) {
19753
19768
  // If we encounter an empty object, we explicitly add it to the update
19754
19769
  // mask to ensure that the server creates a map entry.
19755
19770
  t.path && t.path.length > 0 && t.fieldMask.push(t.path) : forEach(e, ((e, r) => {
19756
- const i = __PRIVATE_parseData(r, t.mu(e));
19771
+ const i = __PRIVATE_parseData(r, t.pu(e));
19757
19772
  null != i && (n[e] = i);
19758
19773
  })), {
19759
19774
  mapValue: {
@@ -19771,7 +19786,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
19771
19786
  return "object" == typeof e && null !== e && (Object.getPrototypeOf(e) === Object.prototype || null === Object.getPrototypeOf(e));
19772
19787
  }(n)) {
19773
19788
  const r = __PRIVATE_valueDescription(n);
19774
- throw "an object" === r ? t.wu(e + " a custom object") : t.wu(e + " " + r);
19789
+ throw "an object" === r ? t.Du(e + " a custom object") : t.Du(e + " " + r);
19775
19790
  }
19776
19791
  }
19777
19792
 
@@ -21058,7 +21073,7 @@ function onSnapshot(e, ...t) {
21058
21073
  const i = new __PRIVATE_AsyncObserver(r), s = new __PRIVATE_QueryListener(t, i, n);
21059
21074
  return e.asyncQueue.enqueueAndForget((async () => __PRIVATE_eventManagerListen(await __PRIVATE_getEventManager(e), s))),
21060
21075
  () => {
21061
- i.qa(), e.asyncQueue.enqueueAndForget((async () => __PRIVATE_eventManagerUnlisten(await __PRIVATE_getEventManager(e), s)));
21076
+ i.$a(), e.asyncQueue.enqueueAndForget((async () => __PRIVATE_eventManagerUnlisten(await __PRIVATE_getEventManager(e), s)));
21062
21077
  };
21063
21078
  }(ensureFirestoreConfigured(u), c, _, a);
21064
21079
  }
@@ -21575,7 +21590,7 @@ class Transaction extends class Transaction$1 {
21575
21590
  const r = new __PRIVATE_Deferred;
21576
21591
  return e.asyncQueue.enqueueAndForget((async () => {
21577
21592
  const i = await __PRIVATE_getDatastore(e);
21578
- new __PRIVATE_TransactionRunner(e.asyncQueue, i, n, t, r).Ja();
21593
+ new __PRIVATE_TransactionRunner(e.asyncQueue, i, n, t, r).Xa();
21579
21594
  })), r.promise;
21580
21595
  }(ensureFirestoreConfigured(e), (n => t(new Transaction(e, n))), r);
21581
21596
  }
@@ -21881,7 +21896,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
21881
21896
  * The implementation of `TestingHooksSpi`.
21882
21897
  */ class __PRIVATE_TestingHooksSpiImpl {
21883
21898
  constructor() {
21884
- this.Fu = new Map;
21899
+ this.Ou = new Map;
21885
21900
  }
21886
21901
  static get instance() {
21887
21902
  return Ce || (Ce = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
@@ -21890,10 +21905,10 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
21890
21905
  }(Ce)), Ce;
21891
21906
  }
21892
21907
  et(e) {
21893
- this.Fu.forEach((t => t(e)));
21908
+ this.Ou.forEach((t => t(e)));
21894
21909
  }
21895
21910
  onExistenceFilterMismatch(e) {
21896
- const t = Symbol(), n = this.Fu;
21911
+ const t = Symbol(), n = this.Ou;
21897
21912
  return n.set(t, e), () => n.delete(t);
21898
21913
  }
21899
21914
  }
@@ -21915,9 +21930,9 @@ let Ce = null;
21915
21930
  return r = Object.assign({
21916
21931
  useFetchStreams: t
21917
21932
  }, r), s._setSettings(r), s;
21918
- }), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(w, "4.6.0-canary.84f9ff008", e),
21933
+ }), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(w, "4.6.0-canary.b74d8a211", e),
21919
21934
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
21920
- app.registerVersion(w, "4.6.0-canary.84f9ff008", "cjs2017");
21935
+ app.registerVersion(w, "4.6.0-canary.b74d8a211", "cjs2017");
21921
21936
  }();
21922
21937
 
21923
21938
  exports.AbstractUserDataWriter = AbstractUserDataWriter;