@firebase/firestore 1.14.0-canary.daf63c2c → 1.14.0

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.
@@ -45,7 +45,7 @@ import { XhrIo as _, EventType as l, ErrorCode as d, createWebChannelTransport a
45
45
  /**
46
46
  * Simple wrapper around a nullable UID. Mostly exists to make code more
47
47
  * readable.
48
- */ class E {
48
+ */ class w {
49
49
  constructor(t) {
50
50
  this.uid = t;
51
51
  }
@@ -63,10 +63,10 @@ import { XhrIo as _, EventType as l, ErrorCode as d, createWebChannelTransport a
63
63
  }
64
64
  }
65
65
 
66
- /** A user with a null UID. */ E.UNAUTHENTICATED = new E(null),
66
+ /** A user with a null UID. */ w.UNAUTHENTICATED = new w(null),
67
67
  // TODO(mikelehen): Look into getting a proper uid-equivalent for
68
68
  // non-FirebaseAuth providers.
69
- E.i = new E("google-credentials-uid"), E.o = new E("first-party-uid");
69
+ w.i = new w("google-credentials-uid"), w.o = new w("first-party-uid");
70
70
 
71
71
  /**
72
72
  * @license
@@ -84,7 +84,7 @@ E.i = new E("google-credentials-uid"), E.o = new E("first-party-uid");
84
84
  * See the License for the specific language governing permissions and
85
85
  * limitations under the License.
86
86
  */
87
- const w = {
87
+ const E = {
88
88
  // Causes are copied from:
89
89
  // https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h
90
90
  /** Not an error; returned on success. */
@@ -251,7 +251,7 @@ const w = {
251
251
  l(t) {
252
252
  this.u = t,
253
253
  // Fire with initial user.
254
- t(E.UNAUTHENTICATED);
254
+ t(w.UNAUTHENTICATED);
255
255
  }
256
256
  T() {
257
257
  this.u = null;
@@ -266,7 +266,7 @@ class P {
266
266
  */
267
267
  this.m = null,
268
268
  /** Tracks the current User. */
269
- this.currentUser = E.UNAUTHENTICATED, this.I = !1,
269
+ this.currentUser = w.UNAUTHENTICATED, this.I = !1,
270
270
  /**
271
271
  * Counter used to detect if the token changed while a getToken request was
272
272
  * outstanding.
@@ -294,7 +294,7 @@ class P {
294
294
  // Cancel the request since the token changed while the request was
295
295
  // outstanding so the response is potentially for a previous user (which
296
296
  // user, we can't be sure).
297
- if (this.R !== t) throw new I(w.ABORTED, "getToken aborted due to token change.");
297
+ if (this.R !== t) throw new I(E.ABORTED, "getToken aborted due to token change.");
298
298
  return e ? (Ce("string" == typeof e.accessToken, "Invalid tokenData returned from getToken():" + e),
299
299
  new R(e.accessToken, this.currentUser)) : null;
300
300
  }) : Promise.resolve(null);
@@ -316,7 +316,7 @@ class P {
316
316
  // to guarantee to get the actual user.
317
317
  A() {
318
318
  const t = this.auth && this.auth.getUid();
319
- return Ce(null === t || "string" == typeof t, "Received invalid UID: " + t), new E(t);
319
+ return Ce(null === t || "string" == typeof t, "Received invalid UID: " + t), new w(t);
320
320
  }
321
321
  }
322
322
 
@@ -328,7 +328,7 @@ class P {
328
328
  * safer to keep the implementation as-is.
329
329
  */ class V {
330
330
  constructor(t, e) {
331
- this.P = t, this.V = e, this.type = "FirstParty", this.user = E.o;
331
+ this.P = t, this.V = e, this.type = "FirstParty", this.user = w.o;
332
332
  }
333
333
  get h() {
334
334
  const t = {
@@ -351,7 +351,7 @@ class P {
351
351
  }
352
352
  l(t) {
353
353
  // Fire with initial uid.
354
- t(E.o);
354
+ t(w.o);
355
355
  }
356
356
  T() {}
357
357
  _() {}
@@ -362,11 +362,11 @@ class P {
362
362
  * the credentials passed in.
363
363
  */ class p {
364
364
  constructor(t, e) {
365
- if (this.seconds = t, this.nanoseconds = e, e < 0) throw new I(w.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e);
366
- if (e >= 1e9) throw new I(w.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e);
367
- if (t < -62135596800) throw new I(w.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t);
365
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new I(E.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e);
366
+ if (e >= 1e9) throw new I(E.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e);
367
+ if (t < -62135596800) throw new I(E.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t);
368
368
  // This will break in the year 10,000.
369
- if (t >= 253402300800) throw new I(w.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t);
369
+ if (t >= 253402300800) throw new I(E.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t);
370
370
  }
371
371
  static now() {
372
372
  return p.fromMillis(Date.now());
@@ -546,7 +546,7 @@ class b {
546
546
  // NOTE: The client is ignorant of any path segments containing escape
547
547
  // sequences (e.g. __id123__) and just passes them through raw (they exist
548
548
  // for legacy reasons and should not be used frequently).
549
- if (t.indexOf("//") >= 0) throw new I(w.INVALID_ARGUMENT, `Invalid path (${t}). Paths must not contain // in them.`);
549
+ if (t.indexOf("//") >= 0) throw new I(E.INVALID_ARGUMENT, `Invalid path (${t}). Paths must not contain // in them.`);
550
550
  // We may still have an empty segment at the beginning or end if they had a
551
551
  // leading or trailing slash (which we allow).
552
552
  const e = t.split("/").filter(t => t.length > 0);
@@ -598,20 +598,20 @@ const S = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
598
598
  const e = [];
599
599
  let s = "", n = 0;
600
600
  const i = () => {
601
- if (0 === s.length) throw new I(w.INVALID_ARGUMENT, `Invalid field path (${t}). Paths must not be empty, begin ` + "with '.', end with '.', or contain '..'");
601
+ if (0 === s.length) throw new I(E.INVALID_ARGUMENT, `Invalid field path (${t}). Paths must not be empty, begin ` + "with '.', end with '.', or contain '..'");
602
602
  e.push(s), s = "";
603
603
  };
604
604
  let r = !1;
605
605
  for (;n < t.length; ) {
606
606
  const e = t[n];
607
607
  if ("\\" === e) {
608
- if (n + 1 === t.length) throw new I(w.INVALID_ARGUMENT, "Path has trailing escape character: " + t);
608
+ if (n + 1 === t.length) throw new I(E.INVALID_ARGUMENT, "Path has trailing escape character: " + t);
609
609
  const e = t[n + 1];
610
- if ("\\" !== e && "." !== e && "`" !== e) throw new I(w.INVALID_ARGUMENT, "Path has invalid escape sequence: " + t);
610
+ if ("\\" !== e && "." !== e && "`" !== e) throw new I(E.INVALID_ARGUMENT, "Path has invalid escape sequence: " + t);
611
611
  s += e, n += 2;
612
612
  } else "`" === e ? (r = !r, n++) : "." !== e || r ? (s += e, n++) : (i(), n++);
613
613
  }
614
- if (i(), r) throw new I(w.INVALID_ARGUMENT, "Unterminated ` in path: " + t);
614
+ if (i(), r) throw new I(E.INVALID_ARGUMENT, "Unterminated ` in path: " + t);
615
615
  return new D(e);
616
616
  }
617
617
  }
@@ -779,7 +779,7 @@ class k {
779
779
  // An iterator over an LLRBNode.
780
780
  class N {
781
781
  constructor(t, e, s, n) {
782
- this.Tt = n, this.Et = [];
782
+ this.Tt = n, this.wt = [];
783
783
  let i = 1;
784
784
  for (;!t.U(); ) if (i = e ? s(t.key, e) : 1,
785
785
  // flip the comparison if we're going in reverse
@@ -789,30 +789,30 @@ class N {
789
789
  if (0 === i) {
790
790
  // This node is exactly equal to our start key. Push it on the stack,
791
791
  // but stop iterating;
792
- this.Et.push(t);
792
+ this.wt.push(t);
793
793
  break;
794
794
  }
795
795
  // This node is greater than our start key, add it to the stack and move
796
796
  // to the next one
797
- this.Et.push(t), t = this.Tt ? t.right : t.left;
797
+ this.wt.push(t), t = this.Tt ? t.right : t.left;
798
798
  }
799
799
  }
800
- wt() {
801
- let t = this.Et.pop();
800
+ Et() {
801
+ let t = this.wt.pop();
802
802
  const e = {
803
803
  key: t.key,
804
804
  value: t.value
805
805
  };
806
- if (this.Tt) for (t = t.left; !t.U(); ) this.Et.push(t), t = t.right; else for (t = t.right; !t.U(); ) this.Et.push(t),
806
+ if (this.Tt) for (t = t.left; !t.U(); ) this.wt.push(t), t = t.right; else for (t = t.right; !t.U(); ) this.wt.push(t),
807
807
  t = t.left;
808
808
  return e;
809
809
  }
810
810
  It() {
811
- return this.Et.length > 0;
811
+ return this.wt.length > 0;
812
812
  }
813
813
  Rt() {
814
- if (0 === this.Et.length) return null;
815
- const t = this.Et[this.Et.length - 1];
814
+ if (0 === this.wt.length) return null;
815
+ const t = this.wt[this.wt.length - 1];
816
816
  return {
817
817
  key: t.key,
818
818
  value: t.value
@@ -1047,7 +1047,7 @@ class $ {
1047
1047
  /** Iterates over `elem`s such that: range[0] <= elem < range[1]. */ Ct(t, e) {
1048
1048
  const s = this.data.lt(t[0]);
1049
1049
  for (;s.It(); ) {
1050
- const n = s.wt();
1050
+ const n = s.Et();
1051
1051
  if (this.F(n.key, t[1]) >= 0) return;
1052
1052
  e(n.key);
1053
1053
  }
@@ -1057,12 +1057,12 @@ class $ {
1057
1057
  */ kt(t, e) {
1058
1058
  let s;
1059
1059
  for (s = void 0 !== e ? this.data.lt(e) : this.data._t(); s.It(); ) {
1060
- if (!t(s.wt().key)) return;
1060
+ if (!t(s.Et().key)) return;
1061
1061
  }
1062
1062
  }
1063
1063
  /** Finds the least element greater than or equal to `elem`. */ Nt(t) {
1064
1064
  const e = this.data.lt(t);
1065
- return e.It() ? e.wt().key : null;
1065
+ return e.It() ? e.Et().key : null;
1066
1066
  }
1067
1067
  _t() {
1068
1068
  return new M(this.data._t());
@@ -1091,7 +1091,7 @@ class $ {
1091
1091
  if (this.size !== t.size) return !1;
1092
1092
  const e = this.data._t(), s = t.data._t();
1093
1093
  for (;e.It(); ) {
1094
- const t = e.wt().key, n = s.wt().key;
1094
+ const t = e.Et().key, n = s.Et().key;
1095
1095
  if (0 !== this.F(t, n)) return !1;
1096
1096
  }
1097
1097
  return !0;
@@ -1116,8 +1116,8 @@ class M {
1116
1116
  constructor(t) {
1117
1117
  this.$t = t;
1118
1118
  }
1119
- wt() {
1120
- return this.$t.wt().key;
1119
+ Et() {
1120
+ return this.$t.Et().key;
1121
1121
  }
1122
1122
  It() {
1123
1123
  return this.$t.It();
@@ -1844,15 +1844,15 @@ function dt(t) {
1844
1844
  * Encodes a precondition for a mutation. This follows the model that the
1845
1845
  * backend accepts with the special case of an explicit "empty" precondition
1846
1846
  * (meaning no precondition).
1847
- */ class Et {
1847
+ */ class wt {
1848
1848
  constructor(t, e) {
1849
1849
  this.updateTime = t, this.exists = e;
1850
1850
  }
1851
1851
  /** Creates a new Precondition with an exists flag. */ static exists(t) {
1852
- return new Et(void 0, t);
1852
+ return new wt(void 0, t);
1853
1853
  }
1854
1854
  /** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
1855
- return new Et(t);
1855
+ return new wt(t);
1856
1856
  }
1857
1857
  /** Returns whether this Precondition is empty. */ get Ht() {
1858
1858
  return void 0 === this.updateTime && void 0 === this.exists;
@@ -1868,7 +1868,7 @@ function dt(t) {
1868
1868
  }
1869
1869
  }
1870
1870
 
1871
- Et.NONE = new Et;
1871
+ wt.NONE = new wt;
1872
1872
 
1873
1873
  /**
1874
1874
  * A mutation describes a self-contained change to a document. Mutations can
@@ -1919,7 +1919,7 @@ Et.NONE = new Et;
1919
1919
  * applyToLocalView() to implement the actual behavior of applying the mutation
1920
1920
  * to some source document.
1921
1921
  */
1922
- class wt {
1922
+ class Et {
1923
1923
  Yt(t) {}
1924
1924
  /**
1925
1925
  * Returns the version from the given document for use as the result of a
@@ -1934,7 +1934,7 @@ class wt {
1934
1934
  /**
1935
1935
  * A mutation that creates or replaces the document at the given key with the
1936
1936
  * object value contents.
1937
- */ class It extends wt {
1937
+ */ class It extends Et {
1938
1938
  constructor(t, e, s) {
1939
1939
  super(), this.key = t, this.value = e, this.Zt = s, this.type = 0 /* Set */;
1940
1940
  }
@@ -1950,7 +1950,7 @@ class wt {
1950
1950
  }
1951
1951
  Bt(t, e, s) {
1952
1952
  if (this.Yt(t), !this.Zt.Jt(t)) return t;
1953
- const n = wt.Xt(t);
1953
+ const n = Et.Xt(t);
1954
1954
  return new bt(this.key, n, this.value, {
1955
1955
  te: !0
1956
1956
  });
@@ -1975,7 +1975,7 @@ class wt {
1975
1975
  * is deleted.
1976
1976
  * * When a field is not in the mask but is in the values, the values map is
1977
1977
  * ignored.
1978
- */ class Rt extends wt {
1978
+ */ class Rt extends Et {
1979
1979
  constructor(t, e, s, n) {
1980
1980
  super(), this.key = t, this.data = e, this.se = s, this.Zt = n, this.type = 1 /* Patch */;
1981
1981
  }
@@ -1993,7 +1993,7 @@ class wt {
1993
1993
  }
1994
1994
  Bt(t, e, s) {
1995
1995
  if (this.Yt(t), !this.Zt.Jt(t)) return t;
1996
- const n = wt.Xt(t), i = this.ne(t);
1996
+ const n = Et.Xt(t), i = this.ne(t);
1997
1997
  return new bt(this.key, n, i, {
1998
1998
  te: !0
1999
1999
  });
@@ -2031,13 +2031,13 @@ class wt {
2031
2031
  * It is somewhat similar to a PatchMutation in that it patches specific fields
2032
2032
  * and has no effect when applied to a null or NoDocument (see comment on
2033
2033
  * Mutation for rationale).
2034
- */ class At extends wt {
2034
+ */ class At extends Et {
2035
2035
  constructor(t, e) {
2036
2036
  super(), this.key = t, this.fieldTransforms = e, this.type = 2 /* Transform */ ,
2037
2037
  // NOTE: We set a precondition of exists: true as a safety-check, since we
2038
2038
  // always combine TransformMutations with a SetMutation or PatchMutation which
2039
2039
  // (if successful) should end up with an existing document.
2040
- this.Zt = Et.exists(!0);
2040
+ this.Zt = wt.exists(!0);
2041
2041
  }
2042
2042
  Ut(t, e) {
2043
2043
  if (this.Yt(t), Ce(null != e.transformResults, "Transform results missing for TransformMutation."),
@@ -2131,7 +2131,7 @@ class wt {
2131
2131
  }
2132
2132
  }
2133
2133
 
2134
- /** A mutation that deletes the document at the given key. */ class Pt extends wt {
2134
+ /** A mutation that deletes the document at the given key. */ class Pt extends Et {
2135
2135
  constructor(t, e) {
2136
2136
  super(), this.key = t, this.Zt = e, this.type = 3 /* Delete */;
2137
2137
  }
@@ -2160,7 +2160,7 @@ class wt {
2160
2160
  *
2161
2161
  * The `verify` operation is only used in Transactions, and this class serves
2162
2162
  * primarily to facilitate serialization into protos.
2163
- */ class Vt extends wt {
2163
+ */ class Vt extends Et {
2164
2164
  constructor(t, e) {
2165
2165
  super(), this.key = t, this.Zt = e, this.type = 4 /* Verify */;
2166
2166
  }
@@ -2362,7 +2362,7 @@ class pt {
2362
2362
  constructor(t, e) {
2363
2363
  this.key = t, this.version = e;
2364
2364
  }
2365
- static Ee(t, e) {
2365
+ static we(t, e) {
2366
2366
  return C.F(t.key, e.key);
2367
2367
  }
2368
2368
  }
@@ -2372,22 +2372,22 @@ class pt {
2372
2372
  * data has local mutations applied to it.
2373
2373
  */ class bt extends yt {
2374
2374
  constructor(t, e, s, n) {
2375
- super(t, e), this.we = s, this.te = !!n.te, this.hasCommittedMutations = !!n.hasCommittedMutations;
2375
+ super(t, e), this.Ee = s, this.te = !!n.te, this.hasCommittedMutations = !!n.hasCommittedMutations;
2376
2376
  }
2377
2377
  field(t) {
2378
- return this.we.field(t);
2378
+ return this.Ee.field(t);
2379
2379
  }
2380
2380
  data() {
2381
- return this.we;
2381
+ return this.Ee;
2382
2382
  }
2383
2383
  Ie() {
2384
- return this.we.proto;
2384
+ return this.Ee.proto;
2385
2385
  }
2386
2386
  isEqual(t) {
2387
- return t instanceof bt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.te === t.te && this.hasCommittedMutations === t.hasCommittedMutations && this.we.isEqual(t.we);
2387
+ return t instanceof bt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.te === t.te && this.hasCommittedMutations === t.hasCommittedMutations && this.Ee.isEqual(t.Ee);
2388
2388
  }
2389
2389
  toString() {
2390
- return `Document(${this.key}, ${this.version}, ${this.we.toString()}, ` + `{hasLocalMutations: ${this.te}}), ` + `{hasCommittedMutations: ${this.hasCommittedMutations}})`;
2390
+ return `Document(${this.key}, ${this.version}, ${this.Ee.toString()}, ` + `{hasLocalMutations: ${this.te}}), ` + `{hasCommittedMutations: ${this.hasCommittedMutations}})`;
2391
2391
  }
2392
2392
  get hasPendingWrites() {
2393
2393
  return this.te || this.hasCommittedMutations;
@@ -2735,11 +2735,11 @@ class Nt extends class {} {
2735
2735
  */ static create(t, e, s) {
2736
2736
  if (t.Y()) return e === kt.IN ? new $t(t, s) : new Ft(t, e, s);
2737
2737
  if (ot(s)) {
2738
- if (e !== kt.EQUAL) throw new I(w.INVALID_ARGUMENT, "Invalid query. Null supports only equality comparisons.");
2738
+ if (e !== kt.EQUAL) throw new I(E.INVALID_ARGUMENT, "Invalid query. Null supports only equality comparisons.");
2739
2739
  return new Nt(t, e, s);
2740
2740
  }
2741
2741
  if (ht(s)) {
2742
- if (e !== kt.EQUAL) throw new I(w.INVALID_ARGUMENT, "Invalid query. NaN supports only equality comparisons.");
2742
+ if (e !== kt.EQUAL) throw new I(E.INVALID_ARGUMENT, "Invalid query. NaN supports only equality comparisons.");
2743
2743
  return new Nt(t, e, s);
2744
2744
  }
2745
2745
  return e === kt.ARRAY_CONTAINS ? new Mt(t, s) : e === kt.IN ? new Lt(t, s) : e === kt.ARRAY_CONTAINS_ANY ? new Ot(t, s) : new Nt(t, e, s);
@@ -2902,7 +2902,7 @@ class Bt {
2902
2902
  this.field = t, void 0 === e && (e = xt.ASCENDING), this.dir = e, this.Xe = t.Y();
2903
2903
  }
2904
2904
  compare(t, e) {
2905
- const s = this.Xe ? bt.Ee(t, e) : bt.Re(this.field, t, e);
2905
+ const s = this.Xe ? bt.we(t, e) : bt.Re(this.field, t, e);
2906
2906
  switch (this.dir) {
2907
2907
  case xt.ASCENDING:
2908
2908
  return s;
@@ -3052,32 +3052,32 @@ class Wt {
3052
3052
  */
3053
3053
  function zt(t) {
3054
3054
  switch (t) {
3055
- case w.OK:
3055
+ case E.OK:
3056
3056
  return De("Treated status OK as error");
3057
3057
 
3058
- case w.CANCELLED:
3059
- case w.UNKNOWN:
3060
- case w.DEADLINE_EXCEEDED:
3061
- case w.RESOURCE_EXHAUSTED:
3062
- case w.INTERNAL:
3063
- case w.UNAVAILABLE:
3058
+ case E.CANCELLED:
3059
+ case E.UNKNOWN:
3060
+ case E.DEADLINE_EXCEEDED:
3061
+ case E.RESOURCE_EXHAUSTED:
3062
+ case E.INTERNAL:
3063
+ case E.UNAVAILABLE:
3064
3064
  // Unauthenticated means something went wrong with our token and we need
3065
3065
  // to retry with new credentials which will happen automatically.
3066
- case w.UNAUTHENTICATED:
3066
+ case E.UNAUTHENTICATED:
3067
3067
  return !1;
3068
3068
 
3069
- case w.INVALID_ARGUMENT:
3070
- case w.NOT_FOUND:
3071
- case w.ALREADY_EXISTS:
3072
- case w.PERMISSION_DENIED:
3073
- case w.FAILED_PRECONDITION:
3069
+ case E.INVALID_ARGUMENT:
3070
+ case E.NOT_FOUND:
3071
+ case E.ALREADY_EXISTS:
3072
+ case E.PERMISSION_DENIED:
3073
+ case E.FAILED_PRECONDITION:
3074
3074
  // Aborted might be retried in some scenarios, but that is dependant on
3075
3075
  // the context and should handled individually by the calling code.
3076
3076
  // See https://cloud.google.com/apis/design/errors.
3077
- case w.ABORTED:
3078
- case w.OUT_OF_RANGE:
3079
- case w.UNIMPLEMENTED:
3080
- case w.DATA_LOSS:
3077
+ case E.ABORTED:
3078
+ case E.OUT_OF_RANGE:
3079
+ case E.UNIMPLEMENTED:
3080
+ case E.DATA_LOSS:
3081
3081
  return !0;
3082
3082
 
3083
3083
  default:
@@ -3108,58 +3108,58 @@ function Ht(t) {
3108
3108
  if (void 0 === t)
3109
3109
  // This shouldn't normally happen, but in certain error cases (like trying
3110
3110
  // to send invalid proto messages) we may get an error with no GRPC code.
3111
- return ve("GRPC error has no .code"), w.UNKNOWN;
3111
+ return ve("GRPC error has no .code"), E.UNKNOWN;
3112
3112
  switch (t) {
3113
3113
  case Kt.OK:
3114
- return w.OK;
3114
+ return E.OK;
3115
3115
 
3116
3116
  case Kt.CANCELLED:
3117
- return w.CANCELLED;
3117
+ return E.CANCELLED;
3118
3118
 
3119
3119
  case Kt.UNKNOWN:
3120
- return w.UNKNOWN;
3120
+ return E.UNKNOWN;
3121
3121
 
3122
3122
  case Kt.DEADLINE_EXCEEDED:
3123
- return w.DEADLINE_EXCEEDED;
3123
+ return E.DEADLINE_EXCEEDED;
3124
3124
 
3125
3125
  case Kt.RESOURCE_EXHAUSTED:
3126
- return w.RESOURCE_EXHAUSTED;
3126
+ return E.RESOURCE_EXHAUSTED;
3127
3127
 
3128
3128
  case Kt.INTERNAL:
3129
- return w.INTERNAL;
3129
+ return E.INTERNAL;
3130
3130
 
3131
3131
  case Kt.UNAVAILABLE:
3132
- return w.UNAVAILABLE;
3132
+ return E.UNAVAILABLE;
3133
3133
 
3134
3134
  case Kt.UNAUTHENTICATED:
3135
- return w.UNAUTHENTICATED;
3135
+ return E.UNAUTHENTICATED;
3136
3136
 
3137
3137
  case Kt.INVALID_ARGUMENT:
3138
- return w.INVALID_ARGUMENT;
3138
+ return E.INVALID_ARGUMENT;
3139
3139
 
3140
3140
  case Kt.NOT_FOUND:
3141
- return w.NOT_FOUND;
3141
+ return E.NOT_FOUND;
3142
3142
 
3143
3143
  case Kt.ALREADY_EXISTS:
3144
- return w.ALREADY_EXISTS;
3144
+ return E.ALREADY_EXISTS;
3145
3145
 
3146
3146
  case Kt.PERMISSION_DENIED:
3147
- return w.PERMISSION_DENIED;
3147
+ return E.PERMISSION_DENIED;
3148
3148
 
3149
3149
  case Kt.FAILED_PRECONDITION:
3150
- return w.FAILED_PRECONDITION;
3150
+ return E.FAILED_PRECONDITION;
3151
3151
 
3152
3152
  case Kt.ABORTED:
3153
- return w.ABORTED;
3153
+ return E.ABORTED;
3154
3154
 
3155
3155
  case Kt.OUT_OF_RANGE:
3156
- return w.OUT_OF_RANGE;
3156
+ return E.OUT_OF_RANGE;
3157
3157
 
3158
3158
  case Kt.UNIMPLEMENTED:
3159
- return w.UNIMPLEMENTED;
3159
+ return E.UNIMPLEMENTED;
3160
3160
 
3161
3161
  case Kt.DATA_LOSS:
3162
- return w.DATA_LOSS;
3162
+ return E.DATA_LOSS;
3163
3163
 
3164
3164
  default:
3165
3165
  return De("Unknown status code: " + t);
@@ -3311,7 +3311,7 @@ function oe() {
3311
3311
  if (this.size !== t.size) return !1;
3312
3312
  const e = this.os._t(), s = t.os._t();
3313
3313
  for (;e.It(); ) {
3314
- const t = e.wt().key, n = s.wt().key;
3314
+ const t = e.Et().key, n = s.Et().key;
3315
3315
  if (!t.isEqual(n)) return !1;
3316
3316
  }
3317
3317
  return !0;
@@ -3460,7 +3460,7 @@ class ue {
3460
3460
  * A set of which document updates are due only to limbo resolution targets.
3461
3461
  */
3462
3462
  i) {
3463
- this.ts = t, this.Ts = e, this.ms = s, this.Es = n, this.ws = i;
3463
+ this.ts = t, this.Ts = e, this.ms = s, this.ws = n, this.Es = i;
3464
3464
  }
3465
3465
  /**
3466
3466
  * HACK: Views require RemoteEvents in order to determine whether the view is
@@ -3598,7 +3598,7 @@ class fe {
3598
3598
  * These changes are continuously updated as we receive document updates and
3599
3599
  * always reflect the current set of changes against the last issued snapshot.
3600
3600
  */
3601
- this.Ss = we(),
3601
+ this.Ss = Ee(),
3602
3602
  /** See public getters for explanations of these fields. */
3603
3603
  this.Ds = B.xt, this.Cs = !1,
3604
3604
  /**
@@ -3662,7 +3662,7 @@ class fe {
3662
3662
  /**
3663
3663
  * Resets the document changes and sets `hasPendingChanges` to false.
3664
3664
  */ Ls() {
3665
- this.ks = !1, this.Ss = we();
3665
+ this.ks = !1, this.Ss = Ee();
3666
3666
  }
3667
3667
  Os(t, e) {
3668
3668
  this.ks = !0, this.Ss = this.Ss.it(t, e);
@@ -3692,7 +3692,7 @@ class me {
3692
3692
  /** Keeps track of the documents to update since the last raised snapshot. */
3693
3693
  this.js = Yt(),
3694
3694
  /** A mapping of document keys to their set of target IDs. */
3695
- this.Ks = Ee(),
3695
+ this.Ks = we(),
3696
3696
  /**
3697
3697
  * A list of targets with existence filter mismatches. These targets are
3698
3698
  * known to be inconsistent and their listens needs to be re-established by
@@ -3820,7 +3820,7 @@ class me {
3820
3820
  }), n && (s = s.add(t));
3821
3821
  });
3822
3822
  const n = new ce(t, e, this.Gs, this.js, s);
3823
- return this.js = Yt(), this.Ks = Ee(), this.Gs = new $(Ne), n;
3823
+ return this.js = Yt(), this.Ks = we(), this.Gs = new $(Ne), n;
3824
3824
  }
3825
3825
  /**
3826
3826
  * Adds the provided document to the internal list of document updates and
@@ -3905,11 +3905,11 @@ class me {
3905
3905
  }
3906
3906
  }
3907
3907
 
3908
- function Ee() {
3908
+ function we() {
3909
3909
  return new k(C.F);
3910
3910
  }
3911
3911
 
3912
- function we() {
3912
+ function Ee() {
3913
3913
  return new k(C.F);
3914
3914
  }
3915
3915
 
@@ -3951,7 +3951,7 @@ class Ae {
3951
3951
  this.cn = t, this.options = e;
3952
3952
  }
3953
3953
  _n(t) {
3954
- const e = void 0 === t.code ? w.UNKNOWN : Ht(t.code);
3954
+ const e = void 0 === t.code ? E.UNKNOWN : Ht(t.code);
3955
3955
  return new I(e, t.message || "");
3956
3956
  }
3957
3957
  /**
@@ -4029,7 +4029,7 @@ class Ae {
4029
4029
  }
4030
4030
  /**
4031
4031
  * Returns a ByteString based on the proto string value.
4032
- */ En(t) {
4032
+ */ wn(t) {
4033
4033
  return this.options.dn ? (Ce(void 0 === t || "string" == typeof t, "value must be undefined or a string when using proto3 Json"),
4034
4034
  B.fromBase64String(t || "")) : (Ce(void 0 === t || t instanceof Uint8Array, "value must be undefined or Uint8Array"),
4035
4035
  B.fromUint8Array(t || new Uint8Array));
@@ -4040,7 +4040,7 @@ class Ae {
4040
4040
  fromVersion(t) {
4041
4041
  return Ce(!!t, "Trying to deserialize version that isn't set"), y.v(this.v(t));
4042
4042
  }
4043
- wn(t, e) {
4043
+ En(t, e) {
4044
4044
  return this.In(e || this.cn).child("documents").child(t).K();
4045
4045
  }
4046
4046
  Rn(t) {
@@ -4048,7 +4048,7 @@ class Ae {
4048
4048
  return Ce(Pe(e), "Tried to deserialize invalid key " + e.toString()), e;
4049
4049
  }
4050
4050
  An(t) {
4051
- return this.wn(t.path);
4051
+ return this.En(t.path);
4052
4052
  }
4053
4053
  tt(t) {
4054
4054
  const e = this.Rn(t);
@@ -4057,7 +4057,7 @@ class Ae {
4057
4057
  new C(this.Pn(e));
4058
4058
  }
4059
4059
  Vn(t) {
4060
- return this.wn(t);
4060
+ return this.En(t);
4061
4061
  }
4062
4062
  gn(t) {
4063
4063
  const e = this.Rn(t);
@@ -4125,7 +4125,7 @@ class Ae {
4125
4125
  t.targetChange;
4126
4126
  // proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE'
4127
4127
  // if unset
4128
- const s = this.Nn(t.targetChange.targetChangeType || "NO_CHANGE"), n = t.targetChange.targetIds || [], i = this.En(t.targetChange.resumeToken), r = t.targetChange.cause, o = r && this._n(r);
4128
+ const s = this.Nn(t.targetChange.targetChangeType || "NO_CHANGE"), n = t.targetChange.targetIds || [], i = this.wn(t.targetChange.resumeToken), r = t.targetChange.cause, o = r && this._n(r);
4129
4129
  e = new fe(s, n, i, o || null);
4130
4130
  } else if ("documentChange" in t) {
4131
4131
  t.documentChange;
@@ -4195,7 +4195,7 @@ class Ae {
4195
4195
  return t.Zt.Ht || (e.currentDocument = this.On(t.Zt)), e;
4196
4196
  }
4197
4197
  xn(t) {
4198
- const e = t.currentDocument ? this.Bn(t.currentDocument) : Et.NONE;
4198
+ const e = t.currentDocument ? this.Bn(t.currentDocument) : wt.NONE;
4199
4199
  if (t.update) {
4200
4200
  t.update.name;
4201
4201
  const s = this.tt(t.update.name), n = new gt({
@@ -4232,7 +4232,7 @@ class Ae {
4232
4232
  } : De("Unknown precondition");
4233
4233
  }
4234
4234
  Bn(t) {
4235
- return void 0 !== t.updateTime ? Et.updateTime(this.fromVersion(t.updateTime)) : void 0 !== t.exists ? Et.exists(t.exists) : Et.NONE;
4235
+ return void 0 !== t.updateTime ? wt.updateTime(this.fromVersion(t.updateTime)) : void 0 !== t.exists ? wt.exists(t.exists) : wt.NONE;
4236
4236
  }
4237
4237
  Qn(t, e) {
4238
4238
  // NOTE: Deletes don't have an updateTime.
@@ -4739,7 +4739,7 @@ class Le {
4739
4739
  constructor(t, e) {
4740
4740
  this.projectId = t, this.database = e || "(default)";
4741
4741
  }
4742
- get Ei() {
4742
+ get wi() {
4743
4743
  return "(default)" === this.database;
4744
4744
  }
4745
4745
  isEqual(t) {
@@ -4773,7 +4773,7 @@ class Le {
4773
4773
  * automatically handles collisions of keys.
4774
4774
  */ class Oe {
4775
4775
  constructor(t) {
4776
- this.wi = t,
4776
+ this.Ei = t,
4777
4777
  /**
4778
4778
  * The inner map for a key -> value pair. Due to the possibility of
4779
4779
  * collisions we keep a list of entries that we do a linear search through
@@ -4783,14 +4783,14 @@ class Le {
4783
4783
  this.Ii = {};
4784
4784
  }
4785
4785
  /** Get a value for this key, or undefined if it does not exist. */ get(t) {
4786
- const e = this.wi(t), s = this.Ii[e];
4786
+ const e = this.Ei(t), s = this.Ii[e];
4787
4787
  if (void 0 !== s) for (const [e, n] of s) if (e.isEqual(t)) return n;
4788
4788
  }
4789
4789
  has(t) {
4790
4790
  return void 0 !== this.get(t);
4791
4791
  }
4792
4792
  /** Put this key and value in the map. */ set(t, e) {
4793
- const s = this.wi(t), n = this.Ii[s];
4793
+ const s = this.Ei(t), n = this.Ii[s];
4794
4794
  if (void 0 !== n) {
4795
4795
  for (let s = 0; s < n.length; s++) if (n[s][0].isEqual(t)) return void (n[s] = [ t, e ]);
4796
4796
  n.push([ t, e ]);
@@ -4799,7 +4799,7 @@ class Le {
4799
4799
  /**
4800
4800
  * Remove this key from the map. Returns a boolean if anything was deleted.
4801
4801
  */ delete(t) {
4802
- const e = this.wi(t), s = this.Ii[e];
4802
+ const e = this.Ei(t), s = this.Ii[e];
4803
4803
  if (void 0 === s) return !1;
4804
4804
  for (let n = 0; n < s.length; n++) if (s[n][0].isEqual(t)) return 1 === s.length ? delete this.Ii[e] : s.splice(n, 1),
4805
4805
  !0;
@@ -4959,7 +4959,7 @@ class xe {
4959
4959
  */ class Ue {
4960
4960
  constructor() {
4961
4961
  // A set of outstanding references to a document sorted by key.
4962
- this.pi = new $(qe.Ee),
4962
+ this.pi = new $(qe.we),
4963
4963
  // A set of outstanding references to a document sorted by target id.
4964
4964
  this.yi = new $(qe.bi);
4965
4965
  }
@@ -5014,7 +5014,7 @@ class qe {
5014
5014
  constructor(t, e) {
5015
5015
  this.key = t, this.Li = e;
5016
5016
  }
5017
- /** Compare by key then by ID */ static Ee(t, e) {
5017
+ /** Compare by key then by ID */ static we(t, e) {
5018
5018
  return C.F(t.key, e.key) || Ne(t.Li, e.Li);
5019
5019
  }
5020
5020
  /** Compare by ID then by key */ static bi(t, e) {
@@ -5331,7 +5331,7 @@ class qe {
5331
5331
  * Similar to `getDocuments`, but creates the local view from the given
5332
5332
  * `baseDocs` without retrieving documents from the local store.
5333
5333
  */ mr(t, e) {
5334
- return this.ar.Er(t, e).next(s => {
5334
+ return this.ar.wr(t, e).next(s => {
5335
5335
  const n = this.dr(t, e, s);
5336
5336
  let i = Yt();
5337
5337
  return n.forEach((t, e) => {
@@ -5347,7 +5347,7 @@ class qe {
5347
5347
  * @param query The query to match documents against.
5348
5348
  * @param sinceReadTime If not set to SnapshotVersion.MIN, return only
5349
5349
  * documents that have been read since this snapshot version (exclusive).
5350
- */ wr(t, e, s) {
5350
+ */ Er(t, e, s) {
5351
5351
  return e.Pe() ? this.Ir(t, e.path) : e.He() ? this.Rr(t, e, s) : this.Ar(t, e, s);
5352
5352
  }
5353
5353
  Ir(t, e) {
@@ -5372,7 +5372,7 @@ class qe {
5372
5372
  Ar(t, e, s) {
5373
5373
  // Query the remote documents and overlay mutations.
5374
5374
  let n, i;
5375
- return this.hr.wr(t, e, s).next(s => (n = s, this.ar.Vr(t, e))).next(e => (i = e,
5375
+ return this.hr.Er(t, e, s).next(s => (n = s, this.ar.Vr(t, e))).next(e => (i = e,
5376
5376
  this.gr(t, i, n).next(t => {
5377
5377
  n = t;
5378
5378
  for (const t of i) for (const e of t.mutations) {
@@ -5562,7 +5562,7 @@ class Je {
5562
5562
  * As long as the operation has not yet been run, calling cancel() provides a
5563
5563
  * guarantee that the operation will not be run.
5564
5564
  */ cancel(t) {
5565
- null !== this.xr && (this.clearTimeout(), this.Lr.reject(new I(w.CANCELLED, "Operation cancelled" + (t ? ": " + t : ""))));
5565
+ null !== this.xr && (this.clearTimeout(), this.Lr.reject(new I(E.CANCELLED, "Operation cancelled" + (t ? ": " + t : ""))));
5566
5566
  }
5567
5567
  Br() {
5568
5568
  this.Nr.qr(() => null !== this.xr ? (this.clearTimeout(), this.op().then(t => this.Lr.resolve(t))) : Promise.resolve());
@@ -5775,7 +5775,7 @@ class ss {
5775
5775
  // A cap on the total number of sequence numbers that will be collected. This prevents
5776
5776
  // us from collecting a huge number of sequence numbers if the cache has grown very large.
5777
5777
  s) {
5778
- this.mo = t, this.Eo = e, this.wo = s;
5778
+ this.mo = t, this.wo = e, this.Eo = s;
5779
5779
  }
5780
5780
  static Io(t) {
5781
5781
  return new ss(t, ss.Ro, ss.Ao);
@@ -5844,10 +5844,10 @@ class ns {
5844
5844
  Qo(t, e) {
5845
5845
  let n, i, r, o, h, a, u;
5846
5846
  const c = Date.now();
5847
- return this.$o(t, this.Do.Eo).next(e => (
5847
+ return this.$o(t, this.Do.wo).next(e => (
5848
5848
  // Cap at the configured max
5849
- e > this.Do.wo ? (be("LruGarbageCollector", "Capping sequence numbers to collect down " + `to the maximum of ${this.Do.wo} ` + `from ${e}`),
5850
- i = this.Do.wo) : i = e, o = Date.now(), this.Lo(t, i))).next(s => (n = s, h = Date.now(),
5849
+ e > this.Do.Eo ? (be("LruGarbageCollector", "Capping sequence numbers to collect down " + `to the maximum of ${this.Do.Eo} ` + `from ${e}`),
5850
+ i = this.Do.Eo) : i = e, o = Date.now(), this.Lo(t, i))).next(s => (n = s, h = Date.now(),
5851
5851
  this.xo(t, n, e))).next(e => (r = e, a = Date.now(), this.Bo(t, n))).next(t => {
5852
5852
  if (u = Date.now(), pe() <= s.DEBUG) {
5853
5853
  be("LruGarbageCollector", "LRU Garbage Collection\n" + `\tCounted targets in ${o - c}ms\n` + `\tDetermined least recently used ${i} in ` + `${h - o}ms\n` + `\tRemoved ${r} targets in ` + `${a - h}ms\n` + `\tRemoved ${t} documents in ` + `${u - a}ms\n` + `Total Duration: ${u - c}ms`);
@@ -6016,7 +6016,7 @@ class rs {
6016
6016
  // NOTE: The base state should only be applied if there's some
6017
6017
  // existing document to override, so use a Precondition of
6018
6018
  // exists=true
6019
- r.push(new Rt(e.key, t, t.se(), Et.exists(!0)));
6019
+ r.push(new Rt(e.key, t, t.se(), wt.exists(!0)));
6020
6020
  }
6021
6021
  return this.ar.dh(i, e, r, t);
6022
6022
  })).then(t => {
@@ -6047,8 +6047,8 @@ class rs {
6047
6047
  * @returns The resulting (modified) documents.
6048
6048
  */ mh(t) {
6049
6049
  return this.persistence.runTransaction("Acknowledge batch", "readwrite-primary", e => {
6050
- const s = t.batch.keys(), n = this.Xo.Eh({
6051
- wh: !0
6050
+ const s = t.batch.keys(), n = this.Xo.wh({
6051
+ Eh: !0
6052
6052
  });
6053
6053
  return this.ar.mh(e, t.batch, t.streamToken).next(() => this.Ih(e, t, n)).next(() => n.apply(e)).next(() => this.ar.Rh(e)).next(() => this.sh.Tr(e, s));
6054
6054
  });
@@ -6098,8 +6098,8 @@ class rs {
6098
6098
  const e = t.ts;
6099
6099
  let s = this.Ko;
6100
6100
  return this.persistence.runTransaction("Apply remote event", "readwrite-primary", n => {
6101
- const i = this.Xo.Eh({
6102
- wh: !0
6101
+ const i = this.Xo.wh({
6102
+ Eh: !0
6103
6103
  });
6104
6104
  // Reset newTargetDataByTargetMap in case this transaction gets re-run.
6105
6105
  s = this.Ko;
@@ -6126,13 +6126,13 @@ class rs {
6126
6126
  // can synthesize remote events when we get permission denied errors while
6127
6127
  // trying to resolve the state of a locally cached document that is in
6128
6128
  // limbo.
6129
- if (t.Es.forEach((t, e) => {
6129
+ if (t.ws.forEach((t, e) => {
6130
6130
  h = h.add(t);
6131
6131
  }),
6132
6132
  // Each loop iteration only affects its "own" doc, so it's safe to get all the remote
6133
6133
  // documents in advance in a single call.
6134
6134
  r.push(i.getEntries(n, h).next(s => {
6135
- t.Es.forEach((h, a) => {
6135
+ t.ws.forEach((h, a) => {
6136
6136
  const u = s.get(h);
6137
6137
  // Note: The order of the steps below is important, since we want
6138
6138
  // to ensure that rejected limbo resolutions (which fabricate
@@ -6144,7 +6144,7 @@ class rs {
6144
6144
  // access.
6145
6145
  i.Zi(h, e), o = o.it(h, a)) : null == u || a.version.D(u.version) > 0 || 0 === a.version.D(u.version) && u.hasPendingWrites ? (i.Yi(a, e),
6146
6146
  o = o.it(h, a)) : be("LocalStore", "Ignoring outdated watch update for ", h, ". Current version:", u.version, " Watch version:", a.version),
6147
- t.ws.has(h) && r.push(this.persistence.Jo.Fh(n, h));
6147
+ t.Es.has(h) && r.push(this.persistence.Jo.Fh(n, h));
6148
6148
  });
6149
6149
  })), !e.isEqual(y.MIN)) {
6150
6150
  const t = this.th.bh(n).next(t => this.th.$h(n, n.Ch, e));
@@ -6277,7 +6277,7 @@ class rs {
6277
6277
  if (t) return s = t.lastLimboFreeSnapshotVersion, this.th.Gh(i, t.targetId).next(t => {
6278
6278
  n = t;
6279
6279
  });
6280
- }).next(() => this.Wo.wr(i, t, e ? s : y.MIN, e ? n : ie())).next(t => ({
6280
+ }).next(() => this.Wo.Er(i, t, e ? s : y.MIN, e ? n : ie())).next(t => ({
6281
6281
  documents: t,
6282
6282
  zh: n
6283
6283
  })));
@@ -6364,7 +6364,7 @@ class rs {
6364
6364
  * @return A Promise that resolves after we recovered, or the original error.
6365
6365
  */
6366
6366
  async function os(t) {
6367
- if (t.code !== w.FAILED_PRECONDITION || t.message !== je) throw t;
6367
+ if (t.code !== E.FAILED_PRECONDITION || t.message !== je) throw t;
6368
6368
  be("LocalStore", "Unexpectedly lost primary lease");
6369
6369
  }
6370
6370
 
@@ -6391,7 +6391,7 @@ async function os(t) {
6391
6391
  * parameter validation is performed:
6392
6392
  * validateNoArgs('myFunction', arguments);
6393
6393
  */ function hs(t, e) {
6394
- if (0 !== e.length) throw new I(w.INVALID_ARGUMENT, `Function ${t}() does not support arguments, ` + "but was called with " + ps(e.length, "argument") + ".");
6394
+ if (0 !== e.length) throw new I(E.INVALID_ARGUMENT, `Function ${t}() does not support arguments, ` + "but was called with " + ps(e.length, "argument") + ".");
6395
6395
  }
6396
6396
 
6397
6397
  /**
@@ -6401,7 +6401,7 @@ async function os(t) {
6401
6401
  * parameter validation is performed:
6402
6402
  * validateExactNumberOfArgs('myFunction', arguments, 2);
6403
6403
  */ function as(t, e, s) {
6404
- if (e.length !== s) throw new I(w.INVALID_ARGUMENT, `Function ${t}() requires ` + ps(s, "argument") + ", but was called with " + ps(e.length, "argument") + ".");
6404
+ if (e.length !== s) throw new I(E.INVALID_ARGUMENT, `Function ${t}() requires ` + ps(s, "argument") + ", but was called with " + ps(e.length, "argument") + ".");
6405
6405
  }
6406
6406
 
6407
6407
  /**
@@ -6412,7 +6412,7 @@ async function os(t) {
6412
6412
  * parameter validation is performed:
6413
6413
  * validateAtLeastNumberOfArgs('myFunction', arguments, 2);
6414
6414
  */ function us(t, e, s) {
6415
- if (e.length < s) throw new I(w.INVALID_ARGUMENT, `Function ${t}() requires at least ` + ps(s, "argument") + ", but was called with " + ps(e.length, "argument") + ".");
6415
+ if (e.length < s) throw new I(E.INVALID_ARGUMENT, `Function ${t}() requires at least ` + ps(s, "argument") + ", but was called with " + ps(e.length, "argument") + ".");
6416
6416
  }
6417
6417
 
6418
6418
  /**
@@ -6423,7 +6423,7 @@ async function os(t) {
6423
6423
  * parameter validation is performed:
6424
6424
  * validateBetweenNumberOfArgs('myFunction', arguments, 2, 3);
6425
6425
  */ function cs(t, e, s, n) {
6426
- if (e.length < s || e.length > n) throw new I(w.INVALID_ARGUMENT, `Function ${t}() requires between ${s} and ` + `${n} arguments, but was called with ` + ps(e.length, "argument") + ".");
6426
+ if (e.length < s || e.length > n) throw new I(E.INVALID_ARGUMENT, `Function ${t}() requires between ${s} and ` + `${n} arguments, but was called with ` + ps(e.length, "argument") + ".");
6427
6427
  }
6428
6428
 
6429
6429
  /**
@@ -6435,7 +6435,7 @@ async function os(t) {
6435
6435
  * using typeof checks.
6436
6436
  */
6437
6437
  function _s(t, e, s, n) {
6438
- Es(t, e, `${gs(s)} argument`, n);
6438
+ ws(t, e, `${gs(s)} argument`, n);
6439
6439
  }
6440
6440
 
6441
6441
  /**
@@ -6449,7 +6449,7 @@ function _s(t, e, s, n) {
6449
6449
  * Validates the provided named option has the native JavaScript type using
6450
6450
  * typeof checks.
6451
6451
  */ function ds(t, e, s, n) {
6452
- Es(t, e, `${s} option`, n);
6452
+ ws(t, e, `${s} option`, n);
6453
6453
  }
6454
6454
 
6455
6455
  /**
@@ -6461,8 +6461,8 @@ function _s(t, e, s, n) {
6461
6461
 
6462
6462
  function Ts(t, e, s, n, i) {
6463
6463
  void 0 !== n && function(t, e, s, n, i) {
6464
- if (!(n instanceof Array)) throw new I(w.INVALID_ARGUMENT, `Function ${t}() requires its ${e} ` + `option to be an array, but it was: ${Is(n)}`);
6465
- for (let r = 0; r < n.length; ++r) if (!i(n[r])) throw new I(w.INVALID_ARGUMENT, `Function ${t}() requires all ${e} ` + `elements to be ${s}, but the value at index ${r} ` + `was: ${Is(n[r])}`);
6464
+ if (!(n instanceof Array)) throw new I(E.INVALID_ARGUMENT, `Function ${t}() requires its ${e} ` + `option to be an array, but it was: ${Is(n)}`);
6465
+ for (let r = 0; r < n.length; ++r) if (!i(n[r])) throw new I(E.INVALID_ARGUMENT, `Function ${t}() requires all ${e} ` + `elements to be ${s}, but the value at index ${r} ` + `was: ${Is(n[r])}`);
6466
6466
  }(t, e, s, n, i);
6467
6467
  }
6468
6468
 
@@ -6481,7 +6481,7 @@ function ms(t, e, s, n, i) {
6481
6481
  r.push(Is(t));
6482
6482
  }
6483
6483
  const o = Is(n);
6484
- throw new I(w.INVALID_ARGUMENT, `Invalid value ${o} provided to function ${t}() for option ` + `"${s}". Acceptable values: ${r.join(", ")}`);
6484
+ throw new I(E.INVALID_ARGUMENT, `Invalid value ${o} provided to function ${t}() for option ` + `"${s}". Acceptable values: ${r.join(", ")}`);
6485
6485
  }(t, 0, s, n, i);
6486
6486
  }
6487
6487
 
@@ -6494,19 +6494,19 @@ function ms(t, e, s, n, i) {
6494
6494
  * @param argument Arugment to validate.
6495
6495
  */
6496
6496
  /** Helper to validate the type of a provided input. */
6497
- function Es(t, e, s, n) {
6497
+ function ws(t, e, s, n) {
6498
6498
  let i = !1;
6499
- if (i = "object" === e ? ws(n) : "non-empty string" === e ? "string" == typeof n && "" !== n : typeof n === e,
6499
+ if (i = "object" === e ? Es(n) : "non-empty string" === e ? "string" == typeof n && "" !== n : typeof n === e,
6500
6500
  !i) {
6501
6501
  const i = Is(n);
6502
- throw new I(w.INVALID_ARGUMENT, `Function ${t}() requires its ${s} ` + `to be of type ${e}, but it was: ${i}`);
6502
+ throw new I(E.INVALID_ARGUMENT, `Function ${t}() requires its ${s} ` + `to be of type ${e}, but it was: ${i}`);
6503
6503
  }
6504
6504
  }
6505
6505
 
6506
6506
  /**
6507
6507
  * Returns true if it's a non-null object without a custom prototype
6508
6508
  * (i.e. excludes Array, Date, etc.).
6509
- */ function ws(t) {
6509
+ */ function Es(t) {
6510
6510
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
6511
6511
  }
6512
6512
 
@@ -6536,7 +6536,7 @@ function Es(t, e, s, n) {
6536
6536
  }
6537
6537
 
6538
6538
  function Rs(t, e, s) {
6539
- if (void 0 === s) throw new I(w.INVALID_ARGUMENT, `Function ${t}() requires a valid ${gs(e)} ` + "argument, but it was undefined.");
6539
+ if (void 0 === s) throw new I(E.INVALID_ARGUMENT, `Function ${t}() requires a valid ${gs(e)} ` + "argument, but it was undefined.");
6540
6540
  }
6541
6541
 
6542
6542
  /**
@@ -6544,7 +6544,7 @@ function Rs(t, e, s) {
6544
6544
  * values match the expected keys and types provided in optionTypes.
6545
6545
  */ function As(t, e, s) {
6546
6546
  O(e, (e, n) => {
6547
- if (s.indexOf(e) < 0) throw new I(w.INVALID_ARGUMENT, `Unknown option '${e}' passed to function ${t}(). ` + "Available options: " + s.join(", "));
6547
+ if (s.indexOf(e) < 0) throw new I(E.INVALID_ARGUMENT, `Unknown option '${e}' passed to function ${t}(). ` + "Available options: " + s.join(", "));
6548
6548
  });
6549
6549
  }
6550
6550
 
@@ -6553,11 +6553,11 @@ function Rs(t, e, s) {
6553
6553
  * an instanceof check.
6554
6554
  */ function Ps(t, e, s, n) {
6555
6555
  const i = Is(n);
6556
- return new I(w.INVALID_ARGUMENT, `Function ${t}() requires its ${gs(s)} ` + `argument to be a ${e}, but it was: ${i}`);
6556
+ return new I(E.INVALID_ARGUMENT, `Function ${t}() requires its ${gs(s)} ` + `argument to be a ${e}, but it was: ${i}`);
6557
6557
  }
6558
6558
 
6559
6559
  function Vs(t, e, s) {
6560
- if (s <= 0) throw new I(w.INVALID_ARGUMENT, `Function "${t}()" requires its ${gs(e)} argument to be a positive number, but it was: ${s}.`);
6560
+ if (s <= 0) throw new I(E.INVALID_ARGUMENT, `Function "${t}()" requires its ${gs(e)} argument to be a positive number, but it was: ${s}.`);
6561
6561
  }
6562
6562
 
6563
6563
  /** Converts a number to its english word representation */ function gs(t) {
@@ -6611,7 +6611,7 @@ function Vs(t, e, s) {
6611
6611
  */ function ys(t, e) {
6612
6612
  function s() {
6613
6613
  let t = "This constructor is private.";
6614
- throw e && (t += " ", t += e), new I(w.INVALID_ARGUMENT, t);
6614
+ throw e && (t += " ", t += e), new I(E.INVALID_ARGUMENT, t);
6615
6615
  }
6616
6616
  // Make sure instanceof checks work and all methods are exposed on the public
6617
6617
  // constructor
@@ -6638,11 +6638,11 @@ function Vs(t, e, s) {
6638
6638
  * limitations under the License.
6639
6639
  */
6640
6640
  /** Helper function to assert Uint8Array is available at runtime. */ function bs() {
6641
- if ("undefined" == typeof Uint8Array) throw new I(w.UNIMPLEMENTED, "Uint8Arrays are not available in this environment.");
6641
+ if ("undefined" == typeof Uint8Array) throw new I(E.UNIMPLEMENTED, "Uint8Arrays are not available in this environment.");
6642
6642
  }
6643
6643
 
6644
6644
  /** Helper function to assert Base64 functions are available at runtime. */ function vs() {
6645
- if (!Ve.Lt().ia) throw new I(w.UNIMPLEMENTED, "Blobs are unavailable in Firestore in this environment.");
6645
+ if (!Ve.Lt().ia) throw new I(E.UNIMPLEMENTED, "Blobs are unavailable in Firestore in this environment.");
6646
6646
  }
6647
6647
 
6648
6648
  /**
@@ -6663,7 +6663,7 @@ class Ss {
6663
6663
  try {
6664
6664
  return new Ss(B.fromBase64String(t));
6665
6665
  } catch (t) {
6666
- throw new I(w.INVALID_ARGUMENT, "Failed to construct Blob from Base64 string: " + t);
6666
+ throw new I(E.INVALID_ARGUMENT, "Failed to construct Blob from Base64 string: " + t);
6667
6667
  }
6668
6668
  }
6669
6669
  static fromUint8Array(t) {
@@ -6725,9 +6725,9 @@ const Ds = ys(Ss, "Use Blob.fromUint8Array() or Blob.fromBase64String() instead.
6725
6725
  */
6726
6726
  constructor(...t) {
6727
6727
  !function(t, e, s, n) {
6728
- if (!(e instanceof Array) || e.length < n) throw new I(w.INVALID_ARGUMENT, `Function ${t}() requires its ${s} argument to be an ` + "array with at least " + `${ps(n, "element")}.`);
6728
+ if (!(e instanceof Array) || e.length < n) throw new I(E.INVALID_ARGUMENT, `Function ${t}() requires its ${s} argument to be an ` + "array with at least " + `${ps(n, "element")}.`);
6729
6729
  }("FieldPath", t, "fieldNames", 1);
6730
- for (let e = 0; e < t.length; ++e) if (_s("FieldPath", "string", e, t[e]), 0 === t[e].length) throw new I(w.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty.");
6730
+ for (let e = 0; e < t.length; ++e) if (_s("FieldPath", "string", e, t[e]), 0 === t[e].length) throw new I(E.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty.");
6731
6731
  this.oa = new D(t);
6732
6732
  }
6733
6733
  static documentId() {
@@ -6868,8 +6868,8 @@ const xs = ys(Ns, "Use FieldValue.<field>() instead.");
6868
6868
  */ class Bs {
6869
6869
  constructor(t, e) {
6870
6870
  if (as("GeoPoint", arguments, 2), _s("GeoPoint", "number", 1, t), _s("GeoPoint", "number", 2, e),
6871
- !isFinite(t) || t < -90 || t > 90) throw new I(w.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + t);
6872
- if (!isFinite(e) || e < -180 || e > 180) throw new I(w.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + e);
6871
+ !isFinite(t) || t < -90 || t > 90) throw new I(E.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + t);
6872
+ if (!isFinite(e) || e < -180 || e > 180) throw new I(E.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + e);
6873
6873
  this._a = t, this.la = e;
6874
6874
  }
6875
6875
  /**
@@ -6980,10 +6980,10 @@ function Ws(t) {
6980
6980
  void 0 === i && this.ma(), this.Ta = void 0 !== n && n, this.fieldTransforms = i || [],
6981
6981
  this.se = r || [];
6982
6982
  }
6983
- Ea(t) {
6983
+ wa(t) {
6984
6984
  const e = null == this.path ? null : this.path.child(t), s = new js(this.fa, this.methodName, e,
6985
6985
  /*arrayElement=*/ !1, this.fieldTransforms, this.se);
6986
- return s.wa(t), s;
6986
+ return s.Ea(t), s;
6987
6987
  }
6988
6988
  Ia(t) {
6989
6989
  const e = null == this.path ? null : this.path.child(t), s = new js(this.fa, this.methodName, e,
@@ -6999,7 +6999,7 @@ function Ws(t) {
6999
6999
  }
7000
7000
  Aa(t) {
7001
7001
  const e = null === this.path || this.path.U() ? "" : ` (found in field ${this.path.toString()})`;
7002
- return new I(w.INVALID_ARGUMENT, `Function ${this.methodName}() called with invalid data. ` + t + e);
7002
+ return new I(E.INVALID_ARGUMENT, `Function ${this.methodName}() called with invalid data. ` + t + e);
7003
7003
  }
7004
7004
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
7005
7005
  return void 0 !== this.se.find(e => t.q(e)) || void 0 !== this.fieldTransforms.find(e => t.q(e.field));
@@ -7007,9 +7007,9 @@ function Ws(t) {
7007
7007
  ma() {
7008
7008
  // TODO(b/34871131): Remove null check once we have proper paths for fields
7009
7009
  // within arrays.
7010
- if (null !== this.path) for (let t = 0; t < this.path.length; t++) this.wa(this.path.get(t));
7010
+ if (null !== this.path) for (let t = 0; t < this.path.length; t++) this.Ea(this.path.get(t));
7011
7011
  }
7012
- wa(t) {
7012
+ Ea(t) {
7013
7013
  if (0 === t.length) throw this.Aa("Document fields must not be empty");
7014
7014
  if (Ws(this.fa) && Us.test(t)) throw this.Aa('Document fields cannot begin and end with "__"');
7015
7015
  }
@@ -7052,7 +7052,7 @@ function Ws(t) {
7052
7052
  if ("string" != typeof i) throw De("Expected stringOrFieldPath to be a string or a FieldPath");
7053
7053
  s = Ys(t, i);
7054
7054
  }
7055
- if (!n.contains(s)) throw new I(w.INVALID_ARGUMENT, `Field '${s}' is specified in your field mask but missing from your input data.`);
7055
+ if (!n.contains(s)) throw new I(E.INVALID_ARGUMENT, `Field '${s}' is specified in your field mask but missing from your input data.`);
7056
7056
  e = e.add(s);
7057
7057
  }
7058
7058
  r = ft.Kt(e), o = n.fieldTransforms.filter(t => r.zt(t.field));
@@ -7078,7 +7078,7 @@ function Ws(t) {
7078
7078
  }
7079
7079
  /** Parse update data from a list of field/value arguments. */ Sa(t, e, s, n) {
7080
7080
  const i = new js(1 /* Update */ , t, D.H), r = [ Js(t, e) ], o = [ s ];
7081
- if (n.length % 2 != 0) throw new I(w.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number ` + "of arguments that alternate between field names and values.");
7081
+ if (n.length % 2 != 0) throw new I(E.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number ` + "of arguments that alternate between field names and values.");
7082
7082
  for (let e = 0; e < n.length; e += 2) r.push(Js(t, n[e])), o.push(n[e + 1]);
7083
7083
  let h = new $(D.F);
7084
7084
  const a = gt._e();
@@ -7150,7 +7150,7 @@ function Ws(t) {
7150
7150
  // If we encounter an empty object, we explicitly add it to the update
7151
7151
  // mask to ensure that the server creates a map entry.
7152
7152
  e.path && e.path.length > 0 && e.se.push(e.path) : O(t, (t, n) => {
7153
- const i = this.va(n, e.Ea(t));
7153
+ const i = this.va(n, e.wa(t));
7154
7154
  null != i && (s[t] = i);
7155
7155
  }), {
7156
7156
  mapValue: {
@@ -7239,7 +7239,7 @@ function Ws(t) {
7239
7239
  bytesValue: this.serializer.mn(t)
7240
7240
  };
7241
7241
  if (t instanceof Ks) return {
7242
- referenceValue: this.serializer.wn(t.key.path, t.cn)
7242
+ referenceValue: this.serializer.En(t.key.path, t.cn)
7243
7243
  };
7244
7244
  throw e.Aa(`Unsupported field value: ${Is(t)}`);
7245
7245
  }
@@ -7265,7 +7265,7 @@ function Ws(t) {
7265
7265
  }
7266
7266
 
7267
7267
  function Hs(t, e, s) {
7268
- if (!zs(s) || !ws(s)) {
7268
+ if (!zs(s) || !Es(s)) {
7269
7269
  const n = Is(s);
7270
7270
  throw "an object" === n ? e.Aa(t + " a custom object") : e.Aa(t + " " + n);
7271
7271
  }
@@ -7276,7 +7276,7 @@ function Hs(t, e, s) {
7276
7276
  */ function Js(t, e) {
7277
7277
  if (e instanceof Cs) return e.oa;
7278
7278
  if ("string" == typeof e) return Ys(t, e);
7279
- throw new I(w.INVALID_ARGUMENT, `Function ${t}() called with invalid data. ${"Field path arguments must be of type string or FieldPath."}`);
7279
+ throw new I(E.INVALID_ARGUMENT, `Function ${t}() called with invalid data. ${"Field path arguments must be of type string or FieldPath."}`);
7280
7280
  }
7281
7281
 
7282
7282
  /**
@@ -7288,16 +7288,16 @@ function Hs(t, e, s) {
7288
7288
  */ function Ys(t, e) {
7289
7289
  try {
7290
7290
  return function(t) {
7291
- if (t.search(ks) >= 0) throw new I(w.INVALID_ARGUMENT, `Invalid field path (${t}). Paths must not contain ` + "'~', '*', '/', '[', or ']'");
7291
+ if (t.search(ks) >= 0) throw new I(E.INVALID_ARGUMENT, `Invalid field path (${t}). Paths must not contain ` + "'~', '*', '/', '[', or ']'");
7292
7292
  try {
7293
7293
  return new Cs(...t.split("."));
7294
7294
  } catch (e) {
7295
- throw new I(w.INVALID_ARGUMENT, `Invalid field path (${t}). Paths must not be empty, ` + "begin with '.', end with '.', or contain '..'");
7295
+ throw new I(E.INVALID_ARGUMENT, `Invalid field path (${t}). Paths must not be empty, ` + "begin with '.', end with '.', or contain '..'");
7296
7296
  }
7297
7297
  }(e).oa;
7298
7298
  } catch (e) {
7299
7299
  const s = Xs(e);
7300
- throw new I(w.INVALID_ARGUMENT, `Function ${t}() called with invalid data. ${s}`);
7300
+ throw new I(E.INVALID_ARGUMENT, `Function ${t}() called with invalid data. ${s}`);
7301
7301
  }
7302
7302
  }
7303
7303
 
@@ -7547,10 +7547,10 @@ class tn {
7547
7547
  // underlying stream), guaranteeing they won't execute.
7548
7548
  this.za++, 3 /* Error */ !== t ?
7549
7549
  // If this is an intentional close ensure we don't delay our next connection attempt.
7550
- this.Ja.reset() : e && e.code === w.RESOURCE_EXHAUSTED ? (
7550
+ this.Ja.reset() : e && e.code === E.RESOURCE_EXHAUSTED ? (
7551
7551
  // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
7552
7552
  ve(e.toString()), ve("Using maximum backoff delay to prevent overloading the backend."),
7553
- this.Ja.qa()) : e && e.code === w.UNAUTHENTICATED &&
7553
+ this.Ja.qa()) : e && e.code === E.UNAUTHENTICATED &&
7554
7554
  // "unauthenticated" error means the token was rejected. Try force refreshing it in case it
7555
7555
  // just expired.
7556
7556
  this.Ga._(),
@@ -7582,7 +7582,7 @@ class tn {
7582
7582
  this.au(t);
7583
7583
  }, e => {
7584
7584
  t(() => {
7585
- const t = new I(w.UNKNOWN, "Fetching auth token failed: " + e.message);
7585
+ const t = new I(E.UNKNOWN, "Fetching auth token failed: " + e.message);
7586
7586
  return this.uu(t);
7587
7587
  });
7588
7588
  });
@@ -7696,7 +7696,7 @@ class tn {
7696
7696
  /**
7697
7697
  * Tracks whether or not a handshake has been successfully exchanged and
7698
7698
  * the stream is ready to accept mutations.
7699
- */ get Eu() {
7699
+ */ get wu() {
7700
7700
  return this.mu;
7701
7701
  }
7702
7702
  // Override of PersistentStream.start
@@ -7704,7 +7704,7 @@ class tn {
7704
7704
  this.mu = !1, super.start();
7705
7705
  }
7706
7706
  ru() {
7707
- this.mu && this.wu([]);
7707
+ this.mu && this.Eu([]);
7708
7708
  }
7709
7709
  cu(t) {
7710
7710
  return this.Ka.lu("Write", t);
@@ -7712,7 +7712,7 @@ class tn {
7712
7712
  onMessage(t) {
7713
7713
  if (
7714
7714
  // Always capture the last stream token.
7715
- Ce(!!t.streamToken, "Got a write response without a stream token"), this.lastStreamToken = this.serializer.En(t.streamToken),
7715
+ Ce(!!t.streamToken, "Got a write response without a stream token"), this.lastStreamToken = this.serializer.wn(t.streamToken),
7716
7716
  this.mu) {
7717
7717
  // A successful first write response means the stream is healthy,
7718
7718
  // Note, that we could consider a successful handshake healthy, however,
@@ -7735,7 +7735,7 @@ class tn {
7735
7735
  const t = {};
7736
7736
  t.database = this.serializer.pn, this.nu(t);
7737
7737
  }
7738
- /** Sends a group of mutations to the Firestore backend to apply. */ wu(t) {
7738
+ /** Sends a group of mutations to the Firestore backend to apply. */ Eu(t) {
7739
7739
  const e = {
7740
7740
  streamToken: this.serializer.mn(this.lastStreamToken),
7741
7741
  writes: t.map(t => this.serializer.$n(t))
@@ -7801,12 +7801,12 @@ class tn {
7801
7801
  }
7802
7802
  /** Gets an auth token and invokes the provided RPC. */ gu(t, e) {
7803
7803
  return this.credentials.getToken().then(s => this.Ka.gu(t, e, s)).catch(t => {
7804
- throw t.code === w.UNAUTHENTICATED && this.credentials._(), t;
7804
+ throw t.code === E.UNAUTHENTICATED && this.credentials._(), t;
7805
7805
  });
7806
7806
  }
7807
7807
  /** Gets an auth token and invokes the provided RPC with streamed results. */ yu(t, e) {
7808
7808
  return this.credentials.getToken().then(s => this.Ka.yu(t, e, s)).catch(t => {
7809
- throw t.code === w.UNAUTHENTICATED && this.credentials._(), t;
7809
+ throw t.code === E.UNAUTHENTICATED && this.credentials._(), t;
7810
7810
  });
7811
7811
  }
7812
7812
  }
@@ -7849,7 +7849,7 @@ class tn {
7849
7849
  this.Cu = new Set;
7850
7850
  }
7851
7851
  async pu(t) {
7852
- if (this.ku(), this.mutations.length > 0) throw new I(w.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes.");
7852
+ if (this.ku(), this.mutations.length > 0) throw new I(E.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes.");
7853
7853
  const e = await this.bu.pu(t);
7854
7854
  return e.forEach(t => {
7855
7855
  t instanceof vt || t instanceof bt ? this.Nu(t) : De("Document in a transaction was a " + t.constructor.name);
@@ -7893,7 +7893,7 @@ class tn {
7893
7893
  if (null !== s) {
7894
7894
  if (!e.isEqual(s))
7895
7895
  // This transaction will fail no matter what.
7896
- throw new I(w.ABORTED, "Document version changed between two reads.");
7896
+ throw new I(E.ABORTED, "Document version changed between two reads.");
7897
7897
  } else this.vu = this.vu.it(t.key, e);
7898
7898
  }
7899
7899
  /**
@@ -7901,7 +7901,7 @@ class tn {
7901
7901
  * as a precondition, or no precondition if it was not read.
7902
7902
  */ Zt(t) {
7903
7903
  const e = this.vu.get(t);
7904
- return !this.Cu.has(t) && e ? Et.updateTime(e) : Et.NONE;
7904
+ return !this.Cu.has(t) && e ? wt.updateTime(e) : wt.NONE;
7905
7905
  }
7906
7906
  /**
7907
7907
  * Returns the precondition for a document if the operation is an update.
@@ -7920,13 +7920,13 @@ class tn {
7920
7920
  // express that to the backend, we have to validate locally.
7921
7921
  // Note: this can change once we can send separate verify writes in the
7922
7922
  // transaction.
7923
- throw new I(w.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
7923
+ throw new I(E.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
7924
7924
  // Document exists, base precondition on document update time.
7925
- return Et.updateTime(e);
7925
+ return wt.updateTime(e);
7926
7926
  }
7927
7927
  // Document was not read, so we just use the preconditions for a blind
7928
7928
  // update.
7929
- return Et.exists(!0);
7929
+ return wt.exists(!0);
7930
7930
  }
7931
7931
  write(t) {
7932
7932
  this.ku(), this.mutations = this.mutations.concat(t);
@@ -8229,21 +8229,21 @@ class hn {
8229
8229
  this.Xu.set("Online" /* Online */), t instanceof fe && 2 /* Removed */ === t.state && t.cause)
8230
8230
  // There was an error on a target, don't wait for a consistent snapshot
8231
8231
  // to raise events
8232
- return this.Ec(t);
8232
+ return this.wc(t);
8233
8233
  if (t instanceof le ? this.Gu.zs(t) : t instanceof de ? this.Gu.sn(t) : this.Gu.Ys(t),
8234
8234
  !e.isEqual(y.MIN)) {
8235
8235
  const t = await this.Wu.bh();
8236
8236
  e.D(t) >= 0 &&
8237
8237
  // We have received a target change with a global snapshot if the snapshot
8238
8238
  // version is not equal to SnapshotVersion.MIN.
8239
- await this.wc(e);
8239
+ await this.Ec(e);
8240
8240
  }
8241
8241
  }
8242
8242
  /**
8243
8243
  * Takes a batch of changes from the Datastore, repackages them as a
8244
8244
  * RemoteEvent, and passes that on to the listener, which is typically the
8245
8245
  * SyncEngine.
8246
- */ wc(t) {
8246
+ */ Ec(t) {
8247
8247
  const e = this.Gu.rn(t);
8248
8248
  // Update in-memory resume tokens. LocalStore will update the
8249
8249
  // persistent view of these when applying the completed RemoteEvent.
@@ -8276,7 +8276,7 @@ class hn {
8276
8276
  this.dc(s);
8277
8277
  }), this.mc.vh(e);
8278
8278
  }
8279
- /** Handles an error on a target */ Ec(t) {
8279
+ /** Handles an error on a target */ wc(t) {
8280
8280
  const e = t.cause;
8281
8281
  let s = Promise.resolve();
8282
8282
  return t.targetIds.forEach(t => {
@@ -8314,7 +8314,7 @@ class hn {
8314
8314
  * Queues additional writes to be sent to the write stream, sending them
8315
8315
  * immediately if the write stream is established.
8316
8316
  */ Ac(t) {
8317
- this.ju.push(t), this.nc.Xa() && this.nc.Eu && this.nc.wu(t.mutations);
8317
+ this.ju.push(t), this.nc.Xa() && this.nc.wu && this.nc.Eu(t.mutations);
8318
8318
  }
8319
8319
  Pc() {
8320
8320
  return this.Ju() && !this.nc.Ya() && this.ju.length > 0;
@@ -8329,7 +8329,7 @@ class hn {
8329
8329
  // Record the stream token.
8330
8330
  return this.Wu.yh(this.nc.lastStreamToken).then(() => {
8331
8331
  // Send the write pipeline now that the stream is established.
8332
- for (const t of this.ju) this.nc.wu(t.mutations);
8332
+ for (const t of this.ju) this.nc.Eu(t.mutations);
8333
8333
  }).catch(os);
8334
8334
  }
8335
8335
  Iu(t, e) {
@@ -8343,7 +8343,7 @@ class hn {
8343
8343
  // A promise that is resolved after we processed the error
8344
8344
  let e;
8345
8345
  // This error affects the actual write.
8346
- return e = this.nc.Eu ? this.yc(t) : this.bc(t), e.then(() => {
8346
+ return e = this.nc.wu ? this.yc(t) : this.bc(t), e.then(() => {
8347
8347
  // The write stream might have been started by refilling the write
8348
8348
  // pipeline for failed writes
8349
8349
  this.Pc() && this.Vc();
@@ -8361,7 +8361,7 @@ class hn {
8361
8361
  async yc(t) {
8362
8362
  // Only handle permanent errors here. If it's transient, just let the retry
8363
8363
  // logic kick in.
8364
- if (zt(e = t.code) && e !== w.ABORTED) {
8364
+ if (zt(e = t.code) && e !== E.ABORTED) {
8365
8365
  // This was a permanent error, the request itself was the problem
8366
8366
  // so it's not going to succeed if we resend it.
8367
8367
  const e = this.ju.shift();
@@ -8590,7 +8590,7 @@ class Tn {
8590
8590
  * Captures WebStorage events that occur before `start()` is called. These
8591
8591
  * events are replayed once `WebStorageSharedClientState` is started.
8592
8592
  */
8593
- this.Bc = [], !mn.Uc(this.platform)) throw new I(w.UNIMPLEMENTED, "LocalStorage is not available on this platform.");
8593
+ this.Bc = [], !mn.Uc(this.platform)) throw new I(E.UNIMPLEMENTED, "LocalStorage is not available on this platform.");
8594
8594
  // Escape the special characters mentioned here:
8595
8595
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
8596
8596
  const r = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -8757,8 +8757,8 @@ class Tn {
8757
8757
  }
8758
8758
  } else if (this.Kc.test(t.key)) {
8759
8759
  if (null !== t.newValue) {
8760
- const e = this.E_(t.key, t.newValue);
8761
- if (e) return this.w_(e);
8760
+ const e = this.w_(t.key, t.newValue);
8761
+ if (e) return this.E_(e);
8762
8762
  }
8763
8763
  } else if (t.key === this.Gc) {
8764
8764
  if (null !== t.newValue) {
@@ -8831,12 +8831,12 @@ class Tn {
8831
8831
  * could not be parsed.
8832
8832
  */ T_(t, e) {
8833
8833
  const s = this.jc.exec(t), n = Number(s[1]), i = void 0 !== s[2] ? s[2] : null;
8834
- return _n.kc(new E(i), n, e);
8834
+ return _n.kc(new w(i), n, e);
8835
8835
  }
8836
8836
  /**
8837
8837
  * Parses a query target state from WebStorage. Returns 'null' if the value
8838
8838
  * could not be parsed.
8839
- */ E_(t, e) {
8839
+ */ w_(t, e) {
8840
8840
  const s = this.Kc.exec(t), n = Number(s[1]);
8841
8841
  return ln.kc(n, e);
8842
8842
  }
@@ -8850,7 +8850,7 @@ class Tn {
8850
8850
  if (t.user.uid === this.currentUser.uid) return this.mc.I_(t.batchId, t.state, t.error);
8851
8851
  be("SharedClientState", `Ignoring mutation for non-active user ${t.user.uid}`);
8852
8852
  }
8853
- w_(t) {
8853
+ E_(t) {
8854
8854
  return this.mc.R_(t.targetId, t.state, t.error);
8855
8855
  }
8856
8856
  d_(t, e) {
@@ -8873,7 +8873,7 @@ class Tn {
8873
8873
  }
8874
8874
  }
8875
8875
 
8876
- class En {
8876
+ class wn {
8877
8877
  constructor() {
8878
8878
  this.P_ = new Tn, this.V_ = {}, this.mc = null, this.$u = null, this.vr = null;
8879
8879
  }
@@ -8948,7 +8948,7 @@ class En {
8948
8948
  * generate in-memory target IDs that are transient and can be reused after a
8949
8949
  * restart.
8950
8950
  */
8951
- class wn {
8951
+ class En {
8952
8952
  constructor(t) {
8953
8953
  this.g_ = t;
8954
8954
  }
@@ -8960,11 +8960,11 @@ class wn {
8960
8960
  // as there is no differentiation in the protocol layer between an unset
8961
8961
  // number and the number '0'. If we were to sent a target with target ID
8962
8962
  // '0', the backend would consider it unset and replace it with its own ID.
8963
- return new wn(0);
8963
+ return new En(0);
8964
8964
  }
8965
8965
  static y_() {
8966
8966
  // Sync engine assigns target IDs for limbo document detection.
8967
- return new wn(-1);
8967
+ return new En(-1);
8968
8968
  }
8969
8969
  }
8970
8970
 
@@ -9397,7 +9397,7 @@ class Vn {
9397
9397
  /** Stores user completion handlers, indexed by User and BatchId. */
9398
9398
  this.hl = {},
9399
9399
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
9400
- this.al = new Map, this.ul = wn.y_(),
9400
+ this.al = new Map, this.ul = En.y_(),
9401
9401
  // The primary state is set to `true` or `false` immediately after Firestore
9402
9402
  // startup. In the interim, a client should only be considered primary if
9403
9403
  // `isPrimary` is true.
@@ -9480,7 +9480,7 @@ class Vn {
9480
9480
  */ async write(t, e) {
9481
9481
  this._l("write()");
9482
9482
  const s = await this.Wu.lh(t);
9483
- this.X_.Zc(s.batchId), this.ml(s.batchId, e), await this.El(s.zi), await this.W_.uc();
9483
+ this.X_.Zc(s.batchId), this.ml(s.batchId, e), await this.wl(s.zi), await this.W_.uc();
9484
9484
  }
9485
9485
  /**
9486
9486
  * Takes an updateFunction in which a set of reads and writes can be performed
@@ -9514,7 +9514,7 @@ class Vn {
9514
9514
  Ce(t.Ps.size + t.Vs.size + t.gs.size <= 1, "Limbo resolution for single document contains multiple changes."),
9515
9515
  t.Ps.size > 0 ? s.Y_ = !0 : t.Vs.size > 0 ? Ce(s.Y_, "Received change for limbo target document without add.") : t.gs.size > 0 && (Ce(s.Y_, "Received remove for limbo target document without add."),
9516
9516
  s.Y_ = !1));
9517
- }), await this.El(e, t);
9517
+ }), await this.wl(e, t);
9518
9518
  } catch (t) {
9519
9519
  await os(t);
9520
9520
  }
@@ -9533,7 +9533,7 @@ class Vn {
9533
9533
  this.el.forEach((s, n) => {
9534
9534
  const i = n.view.B_(t);
9535
9535
  i.snapshot && e.push(i.snapshot);
9536
- }), this.tl.wl(t), this.tl.du(e), this.onlineState = t, this.isPrimary && this.X_.c_(t);
9536
+ }), this.tl.El(t), this.tl.du(e), this.onlineState = t, this.isPrimary && this.X_.c_(t);
9537
9537
  }
9538
9538
  }
9539
9539
  async Ic(t, e) {
@@ -9571,7 +9571,7 @@ class Vn {
9571
9571
  await this.W_.uc() : "acknowledged" === e || "rejected" === e ? (
9572
9572
  // NOTE: Both these methods are no-ops for batches that originated from
9573
9573
  // other clients.
9574
- this.Rl(t, s || null), this.Wu.Yh(t)) : De(`Unknown batchState: ${e}`), await this.El(n)) :
9574
+ this.Rl(t, s || null), this.Wu.Yh(t)) : De(`Unknown batchState: ${e}`), await this.wl(n)) :
9575
9575
  // A throttled tab may not have seen the mutation before it was completed
9576
9576
  // and removed from the mutation queue, in which case we won't have cached
9577
9577
  // the affected documents. In this case we can safely ignore the update
@@ -9591,7 +9591,7 @@ class Vn {
9591
9591
  this.Rl(e, /*error=*/ null), this.Al(e);
9592
9592
  try {
9593
9593
  const s = await this.Wu.mh(t);
9594
- this.X_.e_(e, "acknowledged"), await this.El(s);
9594
+ this.X_.e_(e, "acknowledged"), await this.wl(s);
9595
9595
  } catch (t) {
9596
9596
  await os(t);
9597
9597
  }
@@ -9605,7 +9605,7 @@ class Vn {
9605
9605
  this.Rl(t, e), this.Al(t);
9606
9606
  try {
9607
9607
  const s = await this.Wu.Ah(t);
9608
- this.X_.e_(t, "rejected", e), await this.El(s);
9608
+ this.X_.e_(t, "rejected", e), await this.wl(s);
9609
9609
  } catch (e) {
9610
9610
  await os(e);
9611
9611
  }
@@ -9633,7 +9633,7 @@ class Vn {
9633
9633
  /** Reject all outstanding callbacks waiting for pending writes to complete. */ Vl(t) {
9634
9634
  this.al.forEach(e => {
9635
9635
  e.forEach(e => {
9636
- e.reject(new I(w.CANCELLED, t));
9636
+ e.reject(new I(E.CANCELLED, t));
9637
9637
  });
9638
9638
  }), this.al.clear();
9639
9639
  }
@@ -9705,7 +9705,7 @@ class Vn {
9705
9705
  vl() {
9706
9706
  return this.nl;
9707
9707
  }
9708
- async El(t, e) {
9708
+ async wl(t, e) {
9709
9709
  const s = [], n = [], i = [];
9710
9710
  this.el.forEach((r, o) => {
9711
9711
  i.push(Promise.resolve().then(() => {
@@ -9734,7 +9734,7 @@ class Vn {
9734
9734
  this.Vl("'waitForPendingWrites' promise is rejected due to a user change.");
9735
9735
  const e = await this.Wu.oh(t);
9736
9736
  // TODO(b/114226417): Consider calling this only in the primary tab.
9737
- this.X_.oh(t, e.uh, e._h), await this.El(e.ah);
9737
+ this.X_.oh(t, e.uh, e._h), await this.wl(e.ah);
9738
9738
  }
9739
9739
  await this.W_.Dc();
9740
9740
  }
@@ -9827,7 +9827,7 @@ class Vn {
9827
9827
  case "not-current":
9828
9828
  {
9829
9829
  const s = await this.Wu.ea(), n = ce.Is(t, "current" === e);
9830
- await this.El(s, n);
9830
+ await this.wl(s, n);
9831
9831
  break;
9832
9832
  }
9833
9833
 
@@ -9957,7 +9957,7 @@ class Vn {
9957
9957
  // after an error.
9958
9958
  this.Fl.delete(t);
9959
9959
  }
9960
- wl(t) {
9960
+ El(t) {
9961
9961
  this.onlineState = t;
9962
9962
  let e = !1;
9963
9963
  this.Fl.forEach((s, n) => {
@@ -10089,14 +10089,14 @@ class Vn {
10089
10089
  ih(t) {
10090
10090
  this.Gl = t;
10091
10091
  }
10092
- wr(t, e, n, i) {
10092
+ Er(t, e, n, i) {
10093
10093
  // Queries that match all documents don't benefit from using
10094
10094
  // IndexFreeQueries. It is more efficient to scan all documents in a
10095
10095
  // collection, rather than to perform individual lookups.
10096
10096
  return e.Oe() || n.isEqual(y.MIN) ? this.zl(t, e) : this.Gl.Tr(t, i).next(r => {
10097
10097
  const o = this.Hl(e, r);
10098
10098
  return (e.je() || e.Ke()) && this.M_(e.ge, o, i, n) ? this.zl(t, e) : (pe() <= s.DEBUG && be("IndexFreeQueryEngine", "Re-using previous result from %s to execute query: %s", n.toString(), e.toString()),
10099
- this.Gl.wr(t, e, n).next(t => (
10099
+ this.Gl.Er(t, e, n).next(t => (
10100
10100
  // We merge `previousResults` into `updateResults`, since
10101
10101
  // `updateResults` is already a DocumentMap. If a document is
10102
10102
  // contained in both lists, then its contents are the same.
@@ -10142,7 +10142,7 @@ class Vn {
10142
10142
  }
10143
10143
  zl(t, e) {
10144
10144
  return pe() <= s.DEBUG && be("IndexFreeQueryEngine", "Using full collection scan to execute query: %s", e.toString()),
10145
- this.Gl.wr(t, e, y.MIN);
10145
+ this.Gl.Er(t, e, y.MIN);
10146
10146
  }
10147
10147
  }
10148
10148
 
@@ -10293,10 +10293,10 @@ class Fn {
10293
10293
  const e = t.target.result;
10294
10294
  n(new Fn(e));
10295
10295
  }, r.onblocked = () => {
10296
- i(new I(w.FAILED_PRECONDITION, "Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."));
10296
+ i(new I(E.FAILED_PRECONDITION, "Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."));
10297
10297
  }, r.onerror = t => {
10298
10298
  const e = t.target.error;
10299
- "VersionError" === e.name ? i(new I(w.FAILED_PRECONDITION, "A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")) : i(e);
10299
+ "VersionError" === e.name ? i(new I(E.FAILED_PRECONDITION, "A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")) : i(e);
10300
10300
  }, r.onupgradeneeded = e => {
10301
10301
  be("SimpleDb", 'Database "' + t + '" requires upgrade from version:', e.oldVersion);
10302
10302
  const n = e.target.result;
@@ -10549,7 +10549,7 @@ class Fn {
10549
10549
  *
10550
10550
  * The provided callback should return `true` to continue iteration, and
10551
10551
  * `false` otherwise.
10552
- */ Ed(t) {
10552
+ */ wd(t) {
10553
10553
  const e = this.cursor({});
10554
10554
  return new Qe((s, n) => {
10555
10555
  e.onerror = t => {
@@ -10669,7 +10669,7 @@ function Bn(t) {
10669
10669
  * view of the documents that were previously affected by the mutation.
10670
10670
  */
10671
10671
  // PORTING NOTE: Multi-tab only.
10672
- this.wd = {};
10672
+ this.Ed = {};
10673
10673
  }
10674
10674
  /**
10675
10675
  * Creates a new mutation queue for the given user.
@@ -10731,7 +10731,7 @@ function Bn(t) {
10731
10731
  return c.forEach(e => {
10732
10732
  u.push(this.ur.Vd(t, e));
10733
10733
  }), t.rr(() => {
10734
- this.wd[o] = h.keys();
10734
+ this.Ed[o] = h.keys();
10735
10735
  }), Qe.Ki(u).next(() => h);
10736
10736
  });
10737
10737
  }
@@ -10740,10 +10740,10 @@ function Bn(t) {
10740
10740
  this.serializer.gd(t)) : null);
10741
10741
  }
10742
10742
  Th(t, e) {
10743
- return this.wd[e] ? Qe.resolve(this.wd[e]) : this.Ph(t, e).next(t => {
10743
+ return this.Ed[e] ? Qe.resolve(this.Ed[e]) : this.Ph(t, e).next(t => {
10744
10744
  if (t) {
10745
10745
  const s = t.keys();
10746
- return this.wd[e] = s, s;
10746
+ return this.Ed[e] = s, s;
10747
10747
  }
10748
10748
  return null;
10749
10749
  });
@@ -10799,7 +10799,7 @@ function Bn(t) {
10799
10799
  r.done();
10800
10800
  }).next(() => i);
10801
10801
  }
10802
- Er(t, e) {
10802
+ wr(t, e) {
10803
10803
  let s = new $(Ne);
10804
10804
  const n = [];
10805
10805
  return e.forEach(e => {
@@ -10855,7 +10855,7 @@ function Bn(t) {
10855
10855
  }), Qe.forEach(s, e => this.Jo.bd(t, e))));
10856
10856
  }
10857
10857
  Xh(t) {
10858
- delete this.wd[t];
10858
+ delete this.Ed[t];
10859
10859
  }
10860
10860
  Rh(t) {
10861
10861
  return this.Rd(t).next(e => {
@@ -10968,7 +10968,7 @@ function Qn(t, e, s) {
10968
10968
  // out to have a meaningful performance impact.
10969
10969
  Qh(t) {
10970
10970
  return this.vd(t).next(e => {
10971
- const s = new wn(e.highestTargetId);
10971
+ const s = new En(e.highestTargetId);
10972
10972
  return e.highestTargetId = s.next(), this.Sd(t, e).next(() => e.highestTargetId);
10973
10973
  });
10974
10974
  }
@@ -11017,7 +11017,7 @@ function Qn(t, e, s) {
11017
11017
  return Hn(t.yd);
11018
11018
  }
11019
11019
  Sd(t, e) {
11020
- return (s = t, vi.ed(s, wi.store)).put(wi.key, e);
11020
+ return (s = t, vi.ed(s, Ei.store)).put(Ei.key, e);
11021
11021
  /**
11022
11022
  * Helper to get a typed SimpleDbStore for the target globals object store.
11023
11023
  */
@@ -11061,7 +11061,7 @@ function Qn(t, e, s) {
11061
11061
  const n = [], i = Yn(t);
11062
11062
  return e.forEach(e => {
11063
11063
  const r = Dn(e.path);
11064
- n.push(i.put(new Ei(s, r))), n.push(this.Jo.vi(t, e));
11064
+ n.push(i.put(new wi(s, r))), n.push(this.Jo.vi(t, e));
11065
11065
  }), Qe.Ki(n);
11066
11066
  }
11067
11067
  Sh(t, e, s) {
@@ -11098,7 +11098,7 @@ function Qn(t, e, s) {
11098
11098
  /*upperOpen=*/ !0);
11099
11099
  let i = 0;
11100
11100
  return Yn(t).md({
11101
- index: Ei.documentTargetsIndex,
11101
+ index: wi.documentTargetsIndex,
11102
11102
  Td: !0,
11103
11103
  range: n
11104
11104
  }, ([t, e], s, n) => {
@@ -11120,7 +11120,7 @@ function Qn(t, e, s) {
11120
11120
  }
11121
11121
 
11122
11122
  function Hn(t) {
11123
- return Fn.ed(t, wi.store).get(wi.key).next(t => (Ce(null !== t, "Missing metadata row."),
11123
+ return Fn.ed(t, Ei.store).get(Ei.key).next(t => (Ce(null !== t, "Missing metadata row."),
11124
11124
  t));
11125
11125
  }
11126
11126
 
@@ -11131,7 +11131,7 @@ function Jn(t) {
11131
11131
  /**
11132
11132
  * Helper to get a typed SimpleDbStore for the document target object store.
11133
11133
  */ function Yn(t) {
11134
- return vi.ed(t, Ei.store);
11134
+ return vi.ed(t, wi.store);
11135
11135
  }
11136
11136
 
11137
11137
  /**
@@ -11226,25 +11226,25 @@ function Jn(t) {
11226
11226
  qd(t, e, s) {
11227
11227
  if (e.U()) return Qe.resolve();
11228
11228
  const n = IDBKeyRange.bound(e.first().path.j(), e.last().path.j()), i = e._t();
11229
- let r = i.wt();
11229
+ let r = i.Et();
11230
11230
  return ti(t).md({
11231
11231
  range: n
11232
11232
  }, (t, e, n) => {
11233
11233
  const o = C.nt(t);
11234
11234
  // Go through keys not found in cache.
11235
- for (;r && C.F(r, o) < 0; ) s(r, null), r = i.wt();
11235
+ for (;r && C.F(r, o) < 0; ) s(r, null), r = i.Et();
11236
11236
  r && r.isEqual(o) && (
11237
11237
  // Key found in cache.
11238
- s(r, e), r = i.It() ? i.wt() : null),
11238
+ s(r, e), r = i.It() ? i.Et() : null),
11239
11239
  // Skip to the next key (if there is one).
11240
11240
  r ? n.ud(r.path.j()) : n.done();
11241
11241
  }).next(() => {
11242
11242
  // The rest of the keys are not in the cache. One case where `iterate`
11243
11243
  // above won't go through them is when the cache is empty.
11244
- for (;r; ) s(r, null), r = i.It() ? i.wt() : null;
11244
+ for (;r; ) s(r, null), r = i.It() ? i.Et() : null;
11245
11245
  });
11246
11246
  }
11247
- wr(t, e, s) {
11247
+ Er(t, e, s) {
11248
11248
  let n = te();
11249
11249
  const i = e.path.length + 1, r = {};
11250
11250
  if (s.isEqual(y.MIN)) {
@@ -11298,8 +11298,8 @@ function Jn(t) {
11298
11298
  e.readTime && (s = this.serializer.zd(e.readTime)), n.done();
11299
11299
  }).next(() => s);
11300
11300
  }
11301
- Eh(t) {
11302
- return new Xn.Hd(this, !!t && t.wh);
11301
+ wh(t) {
11302
+ return new Xn.Hd(this, !!t && t.Eh);
11303
11303
  }
11304
11304
  Jd(t) {
11305
11305
  return this.getMetadata(t).next(t => t.byteSize);
@@ -11379,7 +11379,7 @@ function ei(t) {
11379
11379
  * `getNewDocumentChanges()`.
11380
11380
  */
11381
11381
  constructor(t, e) {
11382
- super(), this.Yd = t, this.wh = e,
11382
+ super(), this.Yd = t, this.Eh = e,
11383
11383
  // A map of document sizes prior to applying the changes in this buffer.
11384
11384
  this.Xd = new Oe(t => t.toString());
11385
11385
  }
@@ -11393,7 +11393,7 @@ function ei(t) {
11393
11393
  n = n.add(i.path.L());
11394
11394
  const a = si(h);
11395
11395
  s += a - o, e.push(this.Yd.Yi(t, i, h));
11396
- } else if (s -= o, this.wh) {
11396
+ } else if (s -= o, this.Eh) {
11397
11397
  // In order to track removals, we store a "sentinel delete" in the
11398
11398
  // RemoteDocumentCache. This entry is represented by a NoDocument
11399
11399
  // with a version of 0 and ignored by `maybeDecodeDocument()` but
@@ -11540,7 +11540,7 @@ class ni {
11540
11540
  // Brand new clients don't need to drop and recreate--only clients that
11541
11541
  // potentially have corrupt data.
11542
11542
  0 !== s && (!function(t) {
11543
- t.deleteObjectStore(Ei.store), t.deleteObjectStore(mi.store), t.deleteObjectStore(wi.store);
11543
+ t.deleteObjectStore(wi.store), t.deleteObjectStore(mi.store), t.deleteObjectStore(Ei.store);
11544
11544
  }(t), Ri(t)), r = r.next(() =>
11545
11545
  /**
11546
11546
  * Creates the target global singleton row.
@@ -11548,11 +11548,11 @@ class ni {
11548
11548
  * @param {IDBTransaction} txn The version upgrade transaction for indexeddb
11549
11549
  */
11550
11550
  function(t) {
11551
- const e = t.store(wi.store), s = new wi(
11551
+ const e = t.store(Ei.store), s = new Ei(
11552
11552
  /*highestTargetId=*/ 0,
11553
11553
  /*lastListenSequenceNumber=*/ 0, y.MIN.k(),
11554
11554
  /*targetCount=*/ 0);
11555
- return e.put(wi.key, s);
11555
+ return e.put(Ei.key, s);
11556
11556
  }
11557
11557
  /**
11558
11558
  * Creates indices on the RemoteDocuments store used for both multi-tab
@@ -11649,7 +11649,7 @@ class ni {
11649
11649
  * Ensures that every document in the remote document cache has a corresponding sentinel row
11650
11650
  * with a sequence number. Missing rows are given the most recently used sequence number.
11651
11651
  */ ensureSequenceNumbers(t) {
11652
- const e = t.store(Ei.store), s = t.store(fi.store);
11652
+ const e = t.store(wi.store), s = t.store(fi.store);
11653
11653
  return Jn(t).next(t => {
11654
11654
  const n = [];
11655
11655
  return s.md((s, i) => {
@@ -11659,7 +11659,7 @@ class ni {
11659
11659
  /**
11660
11660
  * Wrapper class to store timestamps (seconds and nanos) in IndexedDb objects.
11661
11661
  */ (r);
11662
- n.push(e.get(o).next(s => s ? Qe.resolve() : (s => e.put(new Ei(0, Dn(s), t)))(r)));
11662
+ n.push(e.get(o).next(s => s ? Qe.resolve() : (s => e.put(new wi(0, Dn(s), t)))(r)));
11663
11663
  }).next(() => Qe.Ki(n));
11664
11664
  });
11665
11665
  }
@@ -12052,7 +12052,7 @@ mi.queryTargetsKeyPath = [ "canonicalId", "targetId" ];
12052
12052
  * documents and their sequence numbers can be identified efficiently via a scan
12053
12053
  * of this store.
12054
12054
  */
12055
- class Ei {
12055
+ class wi {
12056
12056
  constructor(
12057
12057
  /**
12058
12058
  * The targetId identifying a target or 0 for a sentinel row.
@@ -12072,13 +12072,13 @@ class Ei {
12072
12072
  }
12073
12073
  }
12074
12074
 
12075
- /** Name of the IndexedDb object store. */ Ei.store = "targetDocuments",
12075
+ /** Name of the IndexedDb object store. */ wi.store = "targetDocuments",
12076
12076
  /** Keys are automatically assigned via the targetId, path properties. */
12077
- Ei.keyPath = [ "targetId", "path" ],
12077
+ wi.keyPath = [ "targetId", "path" ],
12078
12078
  /** The index name for the reverse index. */
12079
- Ei.documentTargetsIndex = "documentTargetsIndex",
12079
+ wi.documentTargetsIndex = "documentTargetsIndex",
12080
12080
  /** We also need to create the reverse index for these properties. */
12081
- Ei.documentTargetsKeyPath = [ "path", "targetId" ];
12081
+ wi.documentTargetsKeyPath = [ "path", "targetId" ];
12082
12082
 
12083
12083
  /**
12084
12084
  * A record of global state tracked across all Targets, tracked separately
@@ -12086,7 +12086,7 @@ Ei.documentTargetsKeyPath = [ "path", "targetId" ];
12086
12086
  *
12087
12087
  * This should be kept in-sync with the proto used in the iOS client.
12088
12088
  */
12089
- class wi {
12089
+ class Ei {
12090
12090
  constructor(
12091
12091
  /**
12092
12092
  * The highest numbered target id across all targets.
@@ -12121,7 +12121,7 @@ class wi {
12121
12121
  /**
12122
12122
  * The key string used for the single object that exists in the
12123
12123
  * DbTargetGlobal store.
12124
- */ wi.key = "targetGlobalKey", wi.store = "targetGlobal";
12124
+ */ Ei.key = "targetGlobalKey", Ei.store = "targetGlobal";
12125
12125
 
12126
12126
  /**
12127
12127
  * An object representing an association between a Collection id (e.g. 'messages')
@@ -12145,9 +12145,9 @@ class Ii {
12145
12145
  }
12146
12146
 
12147
12147
  /** Name of the IndexedDb object store. */ function Ri(t) {
12148
- t.createObjectStore(Ei.store, {
12149
- keyPath: Ei.keyPath
12150
- }).createIndex(Ei.documentTargetsIndex, Ei.documentTargetsKeyPath, {
12148
+ t.createObjectStore(wi.store, {
12149
+ keyPath: wi.keyPath
12150
+ }).createIndex(wi.documentTargetsIndex, wi.documentTargetsKeyPath, {
12151
12151
  unique: !0
12152
12152
  }),
12153
12153
  // NOTE: This is unique only because the TargetId is the suffix.
@@ -12155,7 +12155,7 @@ class Ii {
12155
12155
  keyPath: mi.keyPath
12156
12156
  }).createIndex(mi.queryTargetsIndexName, mi.queryTargetsKeyPath, {
12157
12157
  unique: !0
12158
- }), t.createObjectStore(wi.store);
12158
+ }), t.createObjectStore(Ei.store);
12159
12159
  }
12160
12160
 
12161
12161
  Ii.store = "collectionParents",
@@ -12182,7 +12182,7 @@ class Ai {
12182
12182
  /** Keys are automatically assigned via the clientId properties. */
12183
12183
  Ai.keyPath = "clientId";
12184
12184
 
12185
- const Pi = [ ...[ ...[ ...[ ui.store, ci.store, _i.store, fi.store, mi.store, ai.store, wi.store, Ei.store ], Ai.store ], Ti.store ], Ii.store ];
12185
+ const Pi = [ ...[ ...[ ...[ ui.store, ci.store, _i.store, fi.store, mi.store, ai.store, Ei.store, wi.store ], Ai.store ], Ti.store ], Ii.store ];
12186
12186
 
12187
12187
  // V2 is no longer usable (see comment at top of file)
12188
12188
  // Visible for testing
@@ -12452,28 +12452,29 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12452
12452
  /** A listener to notify on primary state changes. */
12453
12453
  this.lf = t => Promise.resolve(), this.Jo = new Ci(this, i), this.df = e + vi.ff,
12454
12454
  this.serializer = new pi(o), this.document = n.document, this.th = new Gn(this.Jo, this.serializer),
12455
- this.ur = new Vi, this.hr = new Xn(this.serializer, this.ur), !n.window || !n.window.localStorage) throw new I(w.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
12455
+ this.ur = new Vi, this.hr = new Xn(this.serializer, this.ur), !n.window || !n.window.localStorage) throw new I(E.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
12456
12456
  this.window = n.window, this.Tf = this.window.localStorage;
12457
12457
  }
12458
12458
  static ed(t, e) {
12459
12459
  if (t instanceof bi) return Fn.ed(t.yd, e);
12460
12460
  throw De("IndexedDbPersistence must use instances of IndexedDbTransaction");
12461
12461
  }
12462
- static mf(t) {
12463
- if (!vi.Uc()) throw new I(w.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
12464
- return new vi(t.allowTabSynchronization, t.persistenceKey, t.clientId, t.platform, t.Ef, t.$a, t.serializer, t.rf);
12462
+ static async mf(t) {
12463
+ if (!vi.Uc()) throw new I(E.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
12464
+ const e = new vi(t.allowTabSynchronization, t.persistenceKey, t.clientId, t.platform, t.wf, t.$a, t.serializer, t.rf);
12465
+ return await e.start(), e;
12465
12466
  }
12466
12467
  /**
12467
12468
  * Attempt to start IndexedDb persistence.
12468
12469
  *
12469
12470
  * @return {Promise<void>} Whether persistence was enabled.
12470
12471
  */ start() {
12471
- return Fn.Yl(this.df, ri, new oi(this.serializer)).then(t => (this.wf = t, this.If())).then(() => (this.Rf(),
12472
- this.Af(), this.Pf(), this.wf.runTransaction("readonly", [ wi.store ], t => Jn(t)))).then(t => {
12472
+ return Fn.Yl(this.df, ri, new oi(this.serializer)).then(t => (this.Ef = t, this.If())).then(() => (this.Rf(),
12473
+ this.Af(), this.Pf(), this.Ef.runTransaction("readonly", [ Ei.store ], t => Jn(t)))).then(t => {
12473
12474
  this.Vf = new He(t, this.rf);
12474
12475
  }).then(() => {
12475
12476
  this.hf = !0;
12476
- }).catch(t => (this.wf && this.wf.close(), Promise.reject(t)));
12477
+ }).catch(t => (this.Ef && this.Ef.close(), Promise.reject(t)));
12477
12478
  }
12478
12479
  gf(t) {
12479
12480
  return this.lf = async e => {
@@ -12481,7 +12482,7 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12481
12482
  }, t(this.isPrimary);
12482
12483
  }
12483
12484
  pf(t) {
12484
- this.wf.sd(async e => {
12485
+ this.Ef.sd(async e => {
12485
12486
  // Check if an attempt is made to delete IndexedDB.
12486
12487
  null === e.newVersion && await t();
12487
12488
  });
@@ -12500,7 +12501,7 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12500
12501
  * primary state listener if the client either newly obtained or released its
12501
12502
  * primary lease.
12502
12503
  */ If() {
12503
- return this.wf.runTransaction("readwrite", Pi, t => Di(t).put(new Ai(this.clientId, Date.now(), this.networkEnabled, this.inForeground)).next(() => {
12504
+ return this.Ef.runTransaction("readwrite", Pi, t => Di(t).put(new Ai(this.clientId, Date.now(), this.networkEnabled, this.inForeground)).next(() => {
12504
12505
  if (this.isPrimary) return this.yf(t).next(t => {
12505
12506
  t || (this.isPrimary = !1, this.$a.qr(() => this.lf(!1)));
12506
12507
  });
@@ -12582,7 +12583,7 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12582
12583
  // settings is not supported.
12583
12584
  // TODO(b/114226234): Remove this check when `synchronizeTabs` can
12584
12585
  // no longer be turned off.
12585
- throw new I(w.FAILED_PRECONDITION, yi);
12586
+ throw new I(E.FAILED_PRECONDITION, yi);
12586
12587
  return !1;
12587
12588
  }
12588
12589
  }
@@ -12600,8 +12601,8 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12600
12601
  // The shutdown() operations are idempotent and can be called even when
12601
12602
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12602
12603
  this.hf = !1, this.Lf(), this.cf && (this.cf.cancel(), this.cf = null), this.Of(),
12603
- this.xf(), await this.wf.runTransaction("readwrite", [ ai.store, Ai.store ], t => this.vf(t).next(() => this.Cf(t))),
12604
- this.wf.close(),
12604
+ this.xf(), await this.Ef.runTransaction("readwrite", [ ai.store, Ai.store ], t => this.vf(t).next(() => this.Cf(t))),
12605
+ this.Ef.close(),
12605
12606
  // Remove the entry marking the client as zombied from LocalStorage since
12606
12607
  // we successfully deleted its metadata from IndexedDb.
12607
12608
  this.Bf();
@@ -12613,7 +12614,7 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12613
12614
  return t.filter(t => this.Nf(t.updateTimeMs, e) && !this.Mf(t.clientId));
12614
12615
  }
12615
12616
  Jh() {
12616
- return this.wf.runTransaction("readonly", [ Ai.store ], t => Di(t).ld().next(t => this.Ff(t, 18e5).map(t => t.clientId)));
12617
+ return this.Ef.runTransaction("readonly", [ Ai.store ], t => Di(t).ld().next(t => this.Ff(t, 18e5).map(t => t.clientId)));
12617
12618
  }
12618
12619
  static async clearPersistence(t) {
12619
12620
  if (!vi.Uc()) return Promise.resolve();
@@ -12641,10 +12642,10 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12641
12642
  let i;
12642
12643
  // Do all transactions as readwrite against all object stores, since we
12643
12644
  // are the only reader/writer.
12644
- return this.wf.runTransaction(n, Pi, n => (i = new bi(n, this.Vf.next()),
12645
+ return this.Ef.runTransaction(n, Pi, n => (i = new bi(n, this.Vf.next()),
12645
12646
  "readwrite-primary" === e ? this.yf(n).next(t => !!t || this.bf(n)).next(e => {
12646
12647
  if (!e) throw ve(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
12647
- this.$a.qr(() => this.lf(!1)), new I(w.FAILED_PRECONDITION, je);
12648
+ this.$a.qr(() => this.lf(!1)), new I(E.FAILED_PRECONDITION, je);
12648
12649
  return s(i);
12649
12650
  }).next(t => this.Sf(n).next(() => t)) : this.Uf(n).next(() => s(i)))).then(t => (i.or(),
12650
12651
  t));
@@ -12657,7 +12658,7 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12657
12658
  // be turned off.
12658
12659
  Uf(t) {
12659
12660
  return Si(t).get(ai.key).next(t => {
12660
- if (null !== t && this.Nf(t.leaseTimestampMs, 5e3) && !this.Mf(t.ownerId) && !this.Df(t) && !t.allowTabSynchronization) throw new I(w.FAILED_PRECONDITION, yi);
12661
+ if (null !== t && this.Nf(t.leaseTimestampMs, 5e3) && !this.Mf(t.ownerId) && !this.Df(t) && !t.allowTabSynchronization) throw new I(E.FAILED_PRECONDITION, yi);
12661
12662
  });
12662
12663
  }
12663
12664
  /**
@@ -12680,7 +12681,7 @@ const yi = "Another tab has exclusive access to the persistence layer. To allow
12680
12681
  // projectIDs are DNS-compatible names and cannot contain dots
12681
12682
  // so there's no danger of collisions.
12682
12683
  let e = t.cn.projectId;
12683
- return t.cn.Ei || (e += "." + t.cn.database), "firestore/" + t.persistenceKey + "/" + e + "/";
12684
+ return t.cn.wi || (e += "." + t.cn.database), "firestore/" + t.persistenceKey + "/" + e + "/";
12684
12685
  }
12685
12686
  /** Checks the primary lease and removes it if we are the current primary. */ vf(t) {
12686
12687
  const e = Si(t);
@@ -12820,11 +12821,11 @@ class Ci {
12820
12821
  */ Kf(t, e) {
12821
12822
  return this.Qf.Mi(e) ? Qe.resolve(!0) : function(t, e) {
12822
12823
  let s = !1;
12823
- return Kn(t).Ed(n => qn(t, n, e).next(t => (t && (s = !0), Qe.resolve(!t)))).next(() => s);
12824
+ return Kn(t).wd(n => qn(t, n, e).next(t => (t && (s = !0), Qe.resolve(!t)))).next(() => s);
12824
12825
  }(t, e);
12825
12826
  }
12826
12827
  Bo(t, e) {
12827
- const s = this.db.Zo().Eh(), n = [];
12828
+ const s = this.db.Zo().wh(), n = [];
12828
12829
  let i = 0;
12829
12830
  return this.jf(t, (r, o) => {
12830
12831
  if (o <= e) {
@@ -12854,7 +12855,7 @@ class Ci {
12854
12855
  const s = Yn(t);
12855
12856
  let n, i = He.kr;
12856
12857
  return s.md({
12857
- index: Ei.documentTargetsIndex
12858
+ index: wi.documentTargetsIndex
12858
12859
  }, ([t, s], {path: r, sequenceNumber: o}) => {
12859
12860
  0 === t ? (
12860
12861
  // if nextToReport is valid, report it, this is a new key so the
@@ -12887,7 +12888,7 @@ function ki(t, e) {
12887
12888
  * store.
12888
12889
  */
12889
12890
  function(t, e) {
12890
- return new Ei(0, Dn(t.path), e);
12891
+ return new wi(0, Dn(t.path), e);
12891
12892
  }(e, t.Ch));
12892
12893
  }
12893
12894
 
@@ -12922,7 +12923,7 @@ function ki(t, e) {
12922
12923
  */
12923
12924
  this.lastStreamToken = B.xt,
12924
12925
  /** An ordered mapping between documents and the mutations batch IDs. */
12925
- this.zf = new $(qe.Ee);
12926
+ this.zf = new $(qe.we);
12926
12927
  }
12927
12928
  Rd(t) {
12928
12929
  return Qe.resolve(0 === this.ar.length);
@@ -12977,7 +12978,7 @@ function ki(t, e) {
12977
12978
  i.push(e);
12978
12979
  }), Qe.resolve(i);
12979
12980
  }
12980
- Er(t, e) {
12981
+ wr(t, e) {
12981
12982
  let s = new $(Ne);
12982
12983
  return e.forEach(t => {
12983
12984
  const e = new qe(t, 0), n = new qe(t, Number.POSITIVE_INFINITY);
@@ -13138,13 +13139,13 @@ function ki(t, e) {
13138
13139
  s = s.it(t, e ? e.Ud : null);
13139
13140
  }), Qe.resolve(s);
13140
13141
  }
13141
- wr(t, e, s) {
13142
+ Er(t, e, s) {
13142
13143
  let n = te();
13143
13144
  // Documents are ordered by key, so we can use a prefix scan to narrow down
13144
13145
  // the documents we need to match the query against.
13145
13146
  const i = new C(e.path.child("")), r = this.docs.lt(i);
13146
13147
  for (;r.It(); ) {
13147
- const {key: t, value: {Ud: i, readTime: o}} = r.wt();
13148
+ const {key: t, value: {Ud: i, readTime: o}} = r.Et();
13148
13149
  if (!e.path.q(t.path)) break;
13149
13150
  o.D(s) <= 0 || i instanceof bt && e.matches(i) && (n = n.it(i.key, i));
13150
13151
  }
@@ -13159,7 +13160,7 @@ function ki(t, e) {
13159
13160
  na(t) {
13160
13161
  return Qe.resolve(y.MIN);
13161
13162
  }
13162
- Eh(t) {
13163
+ wh(t) {
13163
13164
  // `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps
13164
13165
  // a separate changelog and does not need special handling for removals.
13165
13166
  return new Fi.Hd(this);
@@ -13222,7 +13223,7 @@ class $i {
13222
13223
  * A ordered bidirectional mapping between documents and the remote target
13223
13224
  * IDs.
13224
13225
  */
13225
- this.nT = new Ue, this.targetCount = 0, this.iT = wn.p_();
13226
+ this.nT = new Ue, this.targetCount = 0, this.iT = En.p_();
13226
13227
  }
13227
13228
  Xs(t, e) {
13228
13229
  return this.eT.forEach((t, s) => e(s)), Qe.resolve();
@@ -13243,7 +13244,7 @@ class $i {
13243
13244
  Cd(t) {
13244
13245
  this.eT.set(t.target, t);
13245
13246
  const e = t.targetId;
13246
- e > this.highestTargetId && (this.iT = new wn(e), this.highestTargetId = e), t.sequenceNumber > this.sT && (this.sT = t.sequenceNumber);
13247
+ e > this.highestTargetId && (this.iT = new En(e), this.highestTargetId = e), t.sequenceNumber > this.sT && (this.sT = t.sequenceNumber);
13247
13248
  }
13248
13249
  Wh(t, e) {
13249
13250
  return this.Cd(e), this.targetCount += 1, Qe.resolve();
@@ -13333,9 +13334,6 @@ class Mi {
13333
13334
  this.Jo = e(this), this.th = new $i(this);
13334
13335
  this.ur = new ni, this.hr = new Fi(this.ur, t => this.Jo.oT(t));
13335
13336
  }
13336
- start() {
13337
- return Promise.resolve();
13338
- }
13339
13337
  lc() {
13340
13338
  // No durable state to ensure is closed on shutdown.
13341
13339
  return this.hf = !1, Promise.resolve();
@@ -13423,7 +13421,7 @@ class Oi {
13423
13421
  }
13424
13422
  aT(t) {
13425
13423
  // Remove newly orphaned documents.
13426
- const e = this.persistence.Zo().Eh();
13424
+ const e = this.persistence.Zo().wh();
13427
13425
  return Qe.forEach(this.lT, s => this.dT(t, s).next(t => {
13428
13426
  t || e.Zi(s);
13429
13427
  })).next(() => (this.cT = null, e.apply(t)));
@@ -13459,79 +13457,55 @@ class Oi {
13459
13457
  * limitations under the License.
13460
13458
  */
13461
13459
  /**
13462
- * Provides all components needed for Firestore with in-memory persistence.
13463
- * Uses EagerGC garbage collection.
13464
- */
13465
- class xi {
13466
- async initialize(t) {
13467
- this.X_ = this.fT(t), this.persistence = this.TT(t), await this.persistence.start(),
13468
- this.mT = this.ET(t), this.Wu = this.wT(t), this.W_ = this.IT(t), this.mc = this.RT(t),
13469
- this.AT = this.PT(t), this.X_.$u = t => this.mc.B_(t, 1 /* SharedClientState */),
13470
- this.W_.mc = this.mc, this.X_.mc = this.mc, await this.X_.start(), await this.W_.start(),
13471
- await this.Wu.start(),
13460
+ * Provides all components needed for Firestore with IndexedDB persistence.
13461
+ */ class xi {
13462
+ async initialize(t, e, s, n, i, r, o, h) {
13463
+ const a = vi.qf(e), u = s.fT(e.cn);
13464
+ if (!mn.Uc(s)) throw new I(E.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
13465
+ this.X_ = h.synchronizeTabs ? new mn(t, s, a, i, r) : new wn, this.X_.$u = t => this.mc.B_(t, 1 /* SharedClientState */),
13466
+ this.persistence = await vi.mf({
13467
+ allowTabSynchronization: h.synchronizeTabs,
13468
+ persistenceKey: a,
13469
+ clientId: i,
13470
+ platform: s,
13471
+ $a: t,
13472
+ serializer: u,
13473
+ wf: ss.Io(h.cacheSizeBytes),
13474
+ rf: this.X_
13475
+ });
13476
+ const c = this.persistence.Jo.bo;
13477
+ this.TT = new ns(c, t), this.Wu = new rs(this.persistence, new Sn, r), this.W_ = new hn(this.Wu, n, t, t => this.mc.B_(t, 0 /* RemoteStore */), s.mT()),
13478
+ this.mc = new pn(this.Wu, this.W_, this.X_, r, o), this.wT = new bn(this.mc), this.W_.mc = this.mc,
13479
+ this.X_.mc = this.mc, await this.X_.start(), await this.W_.start(), await this.Wu.start(),
13472
13480
  // NOTE: This will immediately call the listener, so we make sure to
13473
13481
  // set it after localStore / remoteStore are started.
13474
13482
  await this.persistence.gf(async t => {
13475
- await this.mc.Cc(t), this.mT && (t && !this.mT.ko ? this.mT.start(this.Wu) : t || this.mT.stop());
13483
+ await this.mc.Cc(t), t && !this.TT.ko ? this.TT.start(this.Wu) : t || this.TT.stop();
13476
13484
  });
13477
13485
  }
13478
- PT(t) {
13479
- return new bn(this.mc);
13480
- }
13481
- ET(t) {
13482
- return null;
13483
- }
13484
- wT(t) {
13485
- return new rs(this.persistence, new Sn, t.VT);
13486
- }
13487
- TT(t) {
13488
- return new Mi(t.clientId, Oi._T);
13489
- }
13490
- IT(t) {
13491
- return new hn(this.Wu, t.bu, t.Nr, t => this.mc.B_(t, 0 /* RemoteStore */), t.platform.gT());
13492
- }
13493
- fT(t) {
13494
- return new En;
13495
- }
13496
- RT(t) {
13497
- return new pn(this.Wu, this.W_, this.X_, t.VT, t.Z_);
13498
- }
13499
13486
  clearPersistence(t) {
13500
- throw new I(w.FAILED_PRECONDITION, "You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.");
13487
+ const e = vi.qf(t);
13488
+ return vi.clearPersistence(e);
13501
13489
  }
13502
13490
  }
13503
13491
 
13492
+ const Bi = "You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.";
13493
+
13504
13494
  /**
13505
- * Provides all components needed for Firestore with IndexedDB persistence.
13506
- */ class Bi extends xi {
13507
- ET(t) {
13508
- const e = this.persistence.Jo.bo;
13509
- return new ns(e, t.Nr);
13510
- }
13511
- TT(t) {
13512
- const e = vi.qf(t.pT), s = t.platform.yT(t.pT.cn);
13513
- return vi.mf({
13514
- allowTabSynchronization: t.bT.synchronizeTabs,
13515
- persistenceKey: e,
13516
- clientId: t.clientId,
13517
- platform: t.platform,
13518
- $a: t.Nr,
13519
- serializer: s,
13520
- Ef: ss.Io(t.bT.cacheSizeBytes),
13521
- rf: this.X_
13522
- });
13495
+ * Provides all components needed for Firestore with in-memory persistence.
13496
+ */ class Ui {
13497
+ constructor(t = Oi._T) {
13498
+ this.ET = t;
13523
13499
  }
13524
- fT(t) {
13525
- if (t.bT.synchronizeTabs) {
13526
- if (!mn.Uc(t.platform)) throw new I(w.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
13527
- const e = vi.qf(t.pT);
13528
- return new mn(t.Nr, t.platform, e, t.clientId, t.VT);
13529
- }
13530
- return new En;
13500
+ async initialize(t, e, s, n, i, r, o, h) {
13501
+ if (h.IT) throw new I(E.FAILED_PRECONDITION, Bi);
13502
+ this.persistence = new Mi(i, this.ET), this.TT = null, this.X_ = new wn, this.Wu = new rs(this.persistence, new Sn, r),
13503
+ this.W_ = new hn(this.Wu, n, t, t => this.mc.B_(t, 0 /* RemoteStore */), s.mT()),
13504
+ this.mc = new pn(this.Wu, this.W_, this.X_, r, o), this.wT = new bn(this.mc), this.W_.mc = this.mc,
13505
+ await this.W_.start(), await this.W_.Cc(!0), await this.mc.Cc(!0);
13531
13506
  }
13532
- clearPersistence(t) {
13533
- const e = vi.qf(t);
13534
- return vi.clearPersistence(e);
13507
+ clearPersistence() {
13508
+ throw new I(E.FAILED_PRECONDITION, Bi);
13535
13509
  }
13536
13510
  }
13537
13511
 
@@ -13556,7 +13530,7 @@ class xi {
13556
13530
  * pieces of the client SDK architecture. It is responsible for creating the
13557
13531
  * async queue that is shared by all of the other components in the system.
13558
13532
  */
13559
- class Ui {
13533
+ class qi {
13560
13534
  constructor(t, e, s,
13561
13535
  /**
13562
13536
  * Asynchronous queue responsible for all of our internal processing. When
@@ -13567,7 +13541,7 @@ class Ui {
13567
13541
  * an async I/O to complete).
13568
13542
  */
13569
13543
  n) {
13570
- this.platform = t, this.pT = e, this.credentials = s, this.Nr = n, this.clientId = ke.mi();
13544
+ this.platform = t, this.RT = e, this.credentials = s, this.Nr = n, this.clientId = ke.mi();
13571
13545
  }
13572
13546
  /**
13573
13547
  * Starts up the FirestoreClient, returning only whether or not enabling
@@ -13605,7 +13579,7 @@ class Ui {
13605
13579
  * start for any reason. If usePersistence is false this is
13606
13580
  * unconditionally resolved.
13607
13581
  */ start(t, e) {
13608
- this.vT();
13582
+ this.AT();
13609
13583
  // We defer our initialization until we get the current user from
13610
13584
  // setChangeListener(). We block the async queue until we got the initial
13611
13585
  // user and the initialization is completed. This will prevent any scheduled
@@ -13624,14 +13598,14 @@ class Ui {
13624
13598
  // need to await the completion of initializationDone because the result of
13625
13599
  // this method should not reflect any other kind of failure to start.
13626
13600
  return this.credentials.l(r => {
13627
- if (!i) return i = !0, be("FirestoreClient", "Initializing. user=", r.uid), this.ST(t, e, r, n).then(s.resolve, s.reject);
13601
+ if (!i) return i = !0, be("FirestoreClient", "Initializing. user=", r.uid), this.PT(t, e, r, n).then(s.resolve, s.reject);
13628
13602
  this.Nr.qr(() => this.Dc(r));
13629
13603
  }),
13630
13604
  // Block the async queue until initialization is done
13631
13605
  this.Nr.qr(() => s.promise), n.promise;
13632
13606
  }
13633
13607
  /** Enables the network connection and requeues all pending operations. */ enableNetwork() {
13634
- return this.vT(), this.Nr.enqueue(() => this.mc.enableNetwork());
13608
+ return this.AT(), this.Nr.enqueue(() => this.mc.enableNetwork());
13635
13609
  }
13636
13610
  /**
13637
13611
  * Initializes persistent storage, attempting to use IndexedDB if
@@ -13652,23 +13626,15 @@ class Ui {
13652
13626
  * @returns a Promise indicating whether or not initialization should
13653
13627
  * continue, i.e. that one of the persistence implementations actually
13654
13628
  * succeeded.
13655
- */ async ST(t, e, s, n) {
13629
+ */ async PT(t, e, s, n) {
13656
13630
  try {
13657
13631
  // TODO(mrschmidt): Ideally, ComponentProvider would also initialize
13658
13632
  // Datastore (without duplicating the initializing logic once per
13659
13633
  // provider).
13660
- const i = await this.platform.DT(this.pT), r = this.platform.yT(this.pT.cn), o = new nn(this.Nr, i, this.credentials, r);
13661
- await t.initialize({
13662
- Nr: this.Nr,
13663
- pT: this.pT,
13664
- platform: this.platform,
13665
- bu: o,
13666
- clientId: this.clientId,
13667
- VT: s,
13668
- Z_: 100,
13669
- bT: e
13670
- }), this.persistence = t.persistence, this.X_ = t.X_, this.Wu = t.Wu, this.W_ = t.W_,
13671
- this.mc = t.mc, this.mT = t.mT, this.CT = t.AT,
13634
+ const i = await this.platform.VT(this.RT), r = this.platform.fT(this.RT.cn), o = new nn(this.Nr, i, this.credentials, r);
13635
+ await t.initialize(this.Nr, this.RT, this.platform, o, this.clientId, s, 100, e),
13636
+ this.persistence = t.persistence, this.X_ = t.X_, this.Wu = t.Wu, this.W_ = t.W_,
13637
+ this.mc = t.mc, this.TT = t.TT, this.gT = t.wT,
13672
13638
  // When a user calls clearPersistence() in one client, all other clients
13673
13639
  // need to be terminated to allow the delete to succeed.
13674
13640
  this.persistence.pf(async () => {
@@ -13679,18 +13645,18 @@ class Ui {
13679
13645
  if (
13680
13646
  // Regardless of whether or not the retry succeeds, from an user
13681
13647
  // perspective, offline persistence has failed.
13682
- n.reject(t), !this.kT(t)) throw t;
13648
+ n.reject(t), !this.pT(t)) throw t;
13683
13649
  return console.warn("Error enabling offline persistence. Falling back to persistence disabled: " + t),
13684
- this.ST(new xi, {
13685
- NT: !1
13650
+ this.PT(new Ui, {
13651
+ IT: !1
13686
13652
  }, s, n);
13687
13653
  }
13688
13654
  }
13689
13655
  /**
13690
13656
  * Decides whether the provided error allows us to gracefully disable
13691
13657
  * persistence (as opposed to crashing the client).
13692
- */ kT(t) {
13693
- return "FirebaseError" === t.name ? t.code === w.FAILED_PRECONDITION || t.code === w.UNIMPLEMENTED : !("undefined" != typeof DOMException && t instanceof DOMException) || (
13658
+ */ pT(t) {
13659
+ return "FirebaseError" === t.name ? t.code === E.FAILED_PRECONDITION || t.code === E.UNIMPLEMENTED : !("undefined" != typeof DOMException && t instanceof DOMException) || (
13694
13660
  // When the browser is out of quota we could get either quota exceeded
13695
13661
  // or an aborted error depending on whether the error happened during
13696
13662
  // schema migration.
@@ -13702,20 +13668,20 @@ class Ui {
13702
13668
  /**
13703
13669
  * Checks that the client has not been terminated. Ensures that other methods on
13704
13670
  * this class cannot be called after the client is terminated.
13705
- */ vT() {
13706
- if (this.Nr.Hr) throw new I(w.FAILED_PRECONDITION, "The client has already been terminated.");
13671
+ */ AT() {
13672
+ if (this.Nr.Hr) throw new I(E.FAILED_PRECONDITION, "The client has already been terminated.");
13707
13673
  }
13708
13674
  Dc(t) {
13709
13675
  return this.Nr.no(), be("FirestoreClient", "Credential Changed. Current user: " + t.uid),
13710
13676
  this.mc.Dc(t);
13711
13677
  }
13712
13678
  /** Disables the network connection. Pending operations will not complete. */ disableNetwork() {
13713
- return this.vT(), this.Nr.enqueue(() => this.mc.disableNetwork());
13679
+ return this.AT(), this.Nr.enqueue(() => this.mc.disableNetwork());
13714
13680
  }
13715
13681
  terminate() {
13716
13682
  return this.Nr.to(async () => {
13717
13683
  // PORTING NOTE: LocalStore does not need an explicit shutdown on web.
13718
- this.mT && this.mT.stop(), await this.W_.lc(), await this.X_.lc(), await this.persistence.lc(),
13684
+ this.TT && this.TT.stop(), await this.W_.lc(), await this.X_.lc(), await this.persistence.lc(),
13719
13685
  // `removeChangeListener` must be called after shutting down the
13720
13686
  // RemoteStore as it will prevent the RemoteStore from retrieving
13721
13687
  // auth tokens.
@@ -13727,29 +13693,29 @@ class Ui {
13727
13693
  * method was called received server acknowledgement. An acknowledgement can be either acceptance
13728
13694
  * or rejection.
13729
13695
  */ waitForPendingWrites() {
13730
- this.vT();
13696
+ this.AT();
13731
13697
  const t = new Je;
13732
13698
  return this.Nr.qr(() => this.mc.Pl(t)), t.promise;
13733
13699
  }
13734
13700
  listen(t, e, s) {
13735
- this.vT();
13701
+ this.AT();
13736
13702
  const n = new vn(t, e, s);
13737
- return this.Nr.qr(() => this.CT.listen(n)), n;
13703
+ return this.Nr.qr(() => this.gT.listen(n)), n;
13738
13704
  }
13739
13705
  fc(t) {
13740
13706
  // Checks for termination but does not raise error, allowing unlisten after
13741
13707
  // termination to be a no-op.
13742
- this.FT || this.Nr.qr(() => this.CT.fc(t));
13708
+ this.yT || this.Nr.qr(() => this.gT.fc(t));
13743
13709
  }
13744
- $T(t) {
13745
- return this.vT(), this.Nr.enqueue(() => this.Wu.Bh(t)).then(t => {
13710
+ bT(t) {
13711
+ return this.AT(), this.Nr.enqueue(() => this.Wu.Bh(t)).then(t => {
13746
13712
  if (t instanceof bt) return t;
13747
13713
  if (t instanceof vt) return null;
13748
- throw new I(w.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)");
13714
+ throw new I(E.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)");
13749
13715
  });
13750
13716
  }
13751
- MT(t) {
13752
- return this.vT(), this.Nr.enqueue(async () => {
13717
+ vT(t) {
13718
+ return this.AT(), this.Nr.enqueue(async () => {
13753
13719
  const e = await this.Wu.Kh(t,
13754
13720
  /* usePreviousResults= */ !0), s = new An(t, e.zh), n = s.k_(e.documents);
13755
13721
  return s.nr(n,
@@ -13757,29 +13723,29 @@ class Ui {
13757
13723
  });
13758
13724
  }
13759
13725
  write(t) {
13760
- this.vT();
13726
+ this.AT();
13761
13727
  const e = new Je;
13762
13728
  return this.Nr.qr(() => this.mc.write(t, e)), e.promise;
13763
13729
  }
13764
13730
  cn() {
13765
- return this.pT.cn;
13731
+ return this.RT.cn;
13766
13732
  }
13767
13733
  Ol(t) {
13768
- this.vT(), this.Nr.qr(() => (this.CT.Ol(t), Promise.resolve()));
13734
+ this.AT(), this.Nr.qr(() => (this.gT.Ol(t), Promise.resolve()));
13769
13735
  }
13770
13736
  xl(t) {
13771
13737
  // Checks for shutdown but does not raise error, allowing remove after
13772
13738
  // shutdown to be a no-op.
13773
- this.FT || this.CT.xl(t);
13739
+ this.yT || this.gT.xl(t);
13774
13740
  }
13775
- get FT() {
13741
+ get yT() {
13776
13742
  // Technically, the asyncQueue is still running, but only accepting operations
13777
13743
  // related to termination or supposed to be run after termination. It is effectively
13778
13744
  // terminated to the eyes of users.
13779
13745
  return this.Nr.Hr;
13780
13746
  }
13781
13747
  transaction(t) {
13782
- this.vT();
13748
+ this.AT();
13783
13749
  const e = new Je;
13784
13750
  return this.Nr.qr(() => (this.mc.runTransaction(this.Nr, t, e), Promise.resolve())),
13785
13751
  e.promise;
@@ -13806,7 +13772,7 @@ class Ui {
13806
13772
  * A wrapper implementation of Observer<T> that will dispatch events
13807
13773
  * asynchronously. To allow immediate silencing, a mute call is added which
13808
13774
  * causes events scheduled to no longer be raised.
13809
- */ class qi {
13775
+ */ class Qi {
13810
13776
  constructor(t) {
13811
13777
  this.observer = t,
13812
13778
  /**
@@ -13816,15 +13782,15 @@ class Ui {
13816
13782
  this.muted = !1;
13817
13783
  }
13818
13784
  next(t) {
13819
- this.LT(this.observer.next, t);
13785
+ this.ST(this.observer.next, t);
13820
13786
  }
13821
13787
  error(t) {
13822
- this.LT(this.observer.error, t);
13788
+ this.ST(this.observer.error, t);
13823
13789
  }
13824
- OT() {
13790
+ DT() {
13825
13791
  this.muted = !0;
13826
13792
  }
13827
- LT(t, e) {
13793
+ ST(t, e) {
13828
13794
  this.muted || setTimeout(() => {
13829
13795
  this.muted || t(e);
13830
13796
  }, 0);
@@ -13846,7 +13812,7 @@ class Ui {
13846
13812
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13847
13813
  * See the License for the specific language governing permissions and
13848
13814
  * limitations under the License.
13849
- */ function Qi(t) {
13815
+ */ function Wi(t) {
13850
13816
  /**
13851
13817
  * Returns true if obj is an object and contains at least one of the specified
13852
13818
  * methods.
@@ -13879,11 +13845,11 @@ class Ui {
13879
13845
  */ (t, [ "next", "error", "complete" ]);
13880
13846
  }
13881
13847
 
13882
- class Wi {
13848
+ class ji {
13883
13849
  constructor(t, e, s, n) {
13884
- this.firestore = t, this.timestampsInSnapshots = e, this.xT = s, this.converter = n;
13850
+ this.firestore = t, this.timestampsInSnapshots = e, this.CT = s, this.converter = n;
13885
13851
  }
13886
- BT(t) {
13852
+ kT(t) {
13887
13853
  switch (G(t)) {
13888
13854
  case 0 /* NullValue */ :
13889
13855
  return null;
@@ -13895,10 +13861,10 @@ class Wi {
13895
13861
  return et(t.integerValue || t.doubleValue);
13896
13862
 
13897
13863
  case 3 /* TimestampValue */ :
13898
- return this.UT(t.timestampValue);
13864
+ return this.NT(t.timestampValue);
13899
13865
 
13900
13866
  case 4 /* ServerTimestampValue */ :
13901
- return this.qT(t);
13867
+ return this.FT(t);
13902
13868
 
13903
13869
  case 5 /* StringValue */ :
13904
13870
  return t.stringValue;
@@ -13907,58 +13873,58 @@ class Wi {
13907
13873
  return new Ss(st(t.bytesValue));
13908
13874
 
13909
13875
  case 7 /* RefValue */ :
13910
- return this.QT(t.referenceValue);
13876
+ return this.$T(t.referenceValue);
13911
13877
 
13912
13878
  case 8 /* GeoPointValue */ :
13913
13879
  return new Bs(t.geoPointValue.latitude, t.geoPointValue.longitude);
13914
13880
 
13915
13881
  case 9 /* ArrayValue */ :
13916
- return this.WT(t.arrayValue);
13882
+ return this.MT(t.arrayValue);
13917
13883
 
13918
13884
  case 10 /* ObjectValue */ :
13919
- return this.jT(t.mapValue);
13885
+ return this.LT(t.mapValue);
13920
13886
 
13921
13887
  default:
13922
13888
  throw De("Invalid value type: " + JSON.stringify(t));
13923
13889
  }
13924
13890
  }
13925
- jT(t) {
13891
+ LT(t) {
13926
13892
  const e = {};
13927
13893
  return O(t.fields || {}, (t, s) => {
13928
- e[t] = this.BT(s);
13894
+ e[t] = this.kT(s);
13929
13895
  }), e;
13930
13896
  }
13931
- WT(t) {
13932
- return (t.values || []).map(t => this.BT(t));
13897
+ MT(t) {
13898
+ return (t.values || []).map(t => this.kT(t));
13933
13899
  }
13934
- qT(t) {
13935
- switch (this.xT) {
13900
+ FT(t) {
13901
+ switch (this.CT) {
13936
13902
  case "previous":
13937
13903
  const e = function t(e) {
13938
13904
  const s = e.mapValue.fields.__previous_value__;
13939
13905
  return W(s) ? t(s) : s;
13940
13906
  }(t);
13941
- return null == e ? null : this.BT(e);
13907
+ return null == e ? null : this.kT(e);
13942
13908
 
13943
13909
  case "estimate":
13944
- return this.UT(j(t));
13910
+ return this.NT(j(t));
13945
13911
 
13946
13912
  default:
13947
13913
  return null;
13948
13914
  }
13949
13915
  }
13950
- UT(t) {
13916
+ NT(t) {
13951
13917
  const e = tt(t), s = new p(e.seconds, e.nanos);
13952
13918
  return this.timestampsInSnapshots ? s : s.toDate();
13953
13919
  }
13954
- QT(t) {
13920
+ $T(t) {
13955
13921
  const e = v.G(t);
13956
13922
  Ce(Pe(e), "ReferenceValue is not valid " + t);
13957
13923
  const s = new Le(e.get(1), e.get(3)), n = new C(e.M(5));
13958
- return s.isEqual(this.firestore.KT) ||
13924
+ return s.isEqual(this.firestore.OT) ||
13959
13925
  // TODO(b/64130202): Somehow support foreign references.
13960
- ve(`Document ${n} contains a document ` + "reference within a different database (" + `${s.projectId}/${s.database}) which is not ` + "supported. It will be treated as a reference in the current " + `database (${this.firestore.KT.projectId}/${this.firestore.KT.database}) ` + "instead."),
13961
- new Ji(n, this.firestore, this.converter);
13926
+ ve(`Document ${n} contains a document ` + "reference within a different database (" + `${s.projectId}/${s.database}) which is not ` + "supported. It will be treated as a reference in the current " + `database (${this.firestore.OT.projectId}/${this.firestore.OT.database}) ` + "instead."),
13927
+ new Yi(n, this.firestore, this.converter);
13962
13928
  }
13963
13929
  }
13964
13930
 
@@ -13979,18 +13945,18 @@ class Wi {
13979
13945
  * limitations under the License.
13980
13946
  */
13981
13947
  // settings() defaults:
13982
- const ji = ss.Po;
13948
+ const Ki = ss.Po;
13983
13949
 
13984
13950
  /**
13985
13951
  * A concrete type describing all the values that can be applied via a
13986
13952
  * user-supplied firestore.Settings object. This is a separate type so that
13987
13953
  * defaults can be supplied and the value can be checked for equality.
13988
13954
  */
13989
- class Ki {
13955
+ class Gi {
13990
13956
  constructor(t) {
13991
13957
  var e, s;
13992
13958
  if (void 0 === t.host) {
13993
- if (void 0 !== t.ssl) throw new I(w.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
13959
+ if (void 0 !== t.ssl) throw new I(E.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
13994
13960
  this.host = "firestore.googleapis.com", this.ssl = !0;
13995
13961
  } else ds("settings", "non-empty string", "host", t.host), this.host = t.host, fs("settings", "boolean", "ssl", t.ssl),
13996
13962
  this.ssl = null === (e = t.ssl) || void 0 === e || e;
@@ -14002,7 +13968,7 @@ class Ki {
14002
13968
  !0 === t.timestampsInSnapshots ? ve("The setting 'timestampsInSnapshots: true' is no longer required and should be removed.") : !1 === t.timestampsInSnapshots && ve("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),
14003
13969
  this.timestampsInSnapshots = null === (s = t.timestampsInSnapshots) || void 0 === s || s,
14004
13970
  fs("settings", "number", "cacheSizeBytes", t.cacheSizeBytes), void 0 === t.cacheSizeBytes) this.cacheSizeBytes = ss.po; else {
14005
- if (t.cacheSizeBytes !== ji && t.cacheSizeBytes < ss.Vo) throw new I(w.INVALID_ARGUMENT, `cacheSizeBytes must be at least ${ss.Vo}`);
13971
+ if (t.cacheSizeBytes !== Ki && t.cacheSizeBytes < ss.Vo) throw new I(E.INVALID_ARGUMENT, `cacheSizeBytes must be at least ${ss.Vo}`);
14006
13972
  this.cacheSizeBytes = t.cacheSizeBytes;
14007
13973
  }
14008
13974
  fs("settings", "boolean", "experimentalForceLongPolling", t.experimentalForceLongPolling),
@@ -14015,52 +13981,52 @@ class Ki {
14015
13981
 
14016
13982
  /**
14017
13983
  * The root reference to the database.
14018
- */ class Gi {
13984
+ */ class zi {
14019
13985
  // Note: We are using `MemoryComponentProvider` as a default
14020
13986
  // ComponentProvider to ensure backwards compatibility with the format
14021
13987
  // expected by the console build.
14022
- constructor(t, e, s = new xi) {
14023
- if (this.GT = null,
13988
+ constructor(t, e, s = new Ui) {
13989
+ if (this.xT = null,
14024
13990
  // Public for use in tests.
14025
13991
  // TODO(mikelehen): Use modularized initialization instead.
14026
- this.zT = new Xe, this.INTERNAL = {
13992
+ this.BT = new Xe, this.INTERNAL = {
14027
13993
  delete: async () => {
14028
13994
  // The client must be initalized to ensure that all subsequent API usage
14029
13995
  // throws an exception.
14030
- this.HT(), await this.JT.terminate();
13996
+ this.UT(), await this.qT.terminate();
14031
13997
  }
14032
13998
  }, "object" == typeof t.options) {
14033
13999
  // This is very likely a Firebase app object
14034
14000
  // TODO(b/34177605): Can we somehow use instanceof?
14035
14001
  const s = t;
14036
- this.GT = s, this.KT = Gi.YT(s), this.XT = s.name, this.ZT = new P(e);
14002
+ this.xT = s, this.OT = zi.QT(s), this.WT = s.name, this.jT = new P(e);
14037
14003
  } else {
14038
14004
  const e = t;
14039
- if (!e.projectId) throw new I(w.INVALID_ARGUMENT, "Must provide projectId");
14040
- this.KT = new Le(e.projectId, e.database),
14005
+ if (!e.projectId) throw new I(E.INVALID_ARGUMENT, "Must provide projectId");
14006
+ this.OT = new Le(e.projectId, e.database),
14041
14007
  // Use a default persistenceKey that lines up with FirebaseApp.
14042
- this.XT = "[DEFAULT]", this.ZT = new A;
14008
+ this.WT = "[DEFAULT]", this.jT = new A;
14043
14009
  }
14044
- this.tm = s, this.em = new Ki({}), this.sm = this.nm(this.KT);
14010
+ this.KT = s, this.GT = new Gi({}), this.zT = this.HT(this.OT);
14045
14011
  }
14046
14012
  settings(t) {
14047
14013
  as("Firestore.settings", arguments, 1), _s("Firestore.settings", "object", 1, t);
14048
- const e = new Ki(t);
14049
- if (this.JT && !this.em.isEqual(e)) throw new I(w.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");
14050
- this.em = e, void 0 !== e.credentials && (this.ZT = function(t) {
14014
+ const e = new Gi(t);
14015
+ if (this.qT && !this.GT.isEqual(e)) throw new I(E.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");
14016
+ this.GT = e, void 0 !== e.credentials && (this.jT = function(t) {
14051
14017
  if (!t) return new A;
14052
14018
  switch (t.type) {
14053
14019
  case "gapi":
14054
- const e = t.im;
14020
+ const e = t.JT;
14055
14021
  // Make sure this really is a Gapi client.
14056
14022
  return Ce(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty), "unexpected gapi interface"),
14057
14023
  new g(e, t.V || "0");
14058
14024
 
14059
14025
  case "provider":
14060
- return t.im;
14026
+ return t.JT;
14061
14027
 
14062
14028
  default:
14063
- throw new I(w.INVALID_ARGUMENT, "makeCredentialsProvider failed due to invalid credential type");
14029
+ throw new I(E.INVALID_ARGUMENT, "makeCredentialsProvider failed due to invalid credential type");
14064
14030
  }
14065
14031
  }
14066
14032
  /**
@@ -14083,30 +14049,30 @@ class Ki {
14083
14049
  (e.credentials));
14084
14050
  }
14085
14051
  enableNetwork() {
14086
- return this.HT(), this.JT.enableNetwork();
14052
+ return this.UT(), this.qT.enableNetwork();
14087
14053
  }
14088
14054
  disableNetwork() {
14089
- return this.HT(), this.JT.disableNetwork();
14055
+ return this.UT(), this.qT.disableNetwork();
14090
14056
  }
14091
14057
  enablePersistence(t) {
14092
14058
  var e, s;
14093
- if (this.JT) throw new I(w.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");
14059
+ if (this.qT) throw new I(E.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");
14094
14060
  let n = !1;
14095
14061
  return t && (void 0 !== t.experimentalTabSynchronization && ve("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."),
14096
14062
  n = null !== (s = null !== (e = t.synchronizeTabs) && void 0 !== e ? e : t.experimentalTabSynchronization) && void 0 !== s && s),
14097
- this.rm(this.tm, {
14098
- NT: !0,
14099
- cacheSizeBytes: this.em.cacheSizeBytes,
14063
+ this.YT(this.KT, {
14064
+ IT: !0,
14065
+ cacheSizeBytes: this.GT.cacheSizeBytes,
14100
14066
  synchronizeTabs: n
14101
14067
  });
14102
14068
  }
14103
14069
  async clearPersistence() {
14104
- if (void 0 !== this.JT && !this.JT.FT) throw new I(w.FAILED_PRECONDITION, "Persistence cannot be cleared after this Firestore instance is initialized.");
14070
+ if (void 0 !== this.qT && !this.qT.yT) throw new I(E.FAILED_PRECONDITION, "Persistence cannot be cleared after this Firestore instance is initialized.");
14105
14071
  const t = new Je;
14106
- return this.zT.Jr(async () => {
14072
+ return this.BT.Jr(async () => {
14107
14073
  try {
14108
- const e = this.om();
14109
- await this.tm.clearPersistence(e), t.resolve();
14074
+ const e = this.XT();
14075
+ await this.KT.clearPersistence(e), t.resolve();
14110
14076
  } catch (e) {
14111
14077
  t.reject(e);
14112
14078
  }
@@ -14115,24 +14081,24 @@ class Ki {
14115
14081
  terminate() {
14116
14082
  return this.app._removeServiceInstance("firestore"), this.INTERNAL.delete();
14117
14083
  }
14118
- get hm() {
14119
- return this.HT(), this.JT.FT;
14084
+ get ZT() {
14085
+ return this.UT(), this.qT.yT;
14120
14086
  }
14121
14087
  waitForPendingWrites() {
14122
- return this.HT(), this.JT.waitForPendingWrites();
14088
+ return this.UT(), this.qT.waitForPendingWrites();
14123
14089
  }
14124
14090
  onSnapshotsInSync(t) {
14125
- if (this.HT(), Qi(t)) return this.am(t);
14091
+ if (this.UT(), Wi(t)) return this.tm(t);
14126
14092
  {
14127
14093
  _s("Firestore.onSnapshotsInSync", "function", 1, t);
14128
14094
  const e = {
14129
14095
  next: t
14130
14096
  };
14131
- return this.am(e);
14097
+ return this.tm(e);
14132
14098
  }
14133
14099
  }
14134
- am(t) {
14135
- const e = new qi({
14100
+ tm(t) {
14101
+ const e = new Qi({
14136
14102
  next: () => {
14137
14103
  t.next && t.next();
14138
14104
  },
@@ -14140,72 +14106,72 @@ class Ki {
14140
14106
  throw De("Uncaught Error in onSnapshotsInSync");
14141
14107
  }
14142
14108
  });
14143
- return this.JT.Ol(e), () => {
14144
- e.OT(), this.JT.xl(e);
14109
+ return this.qT.Ol(e), () => {
14110
+ e.DT(), this.qT.xl(e);
14145
14111
  };
14146
14112
  }
14147
- HT() {
14148
- return this.JT ||
14113
+ UT() {
14114
+ return this.qT ||
14149
14115
  // Kick off starting the client but don't actually wait for it.
14150
14116
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
14151
- this.rm(new xi, {
14152
- NT: !1
14153
- }), this.JT;
14117
+ this.YT(new Ui, {
14118
+ IT: !1
14119
+ }), this.qT;
14154
14120
  }
14155
- om() {
14156
- return new Me(this.KT, this.XT, this.em.host, this.em.ssl, this.em.forceLongPolling);
14121
+ XT() {
14122
+ return new Me(this.OT, this.WT, this.GT.host, this.GT.ssl, this.GT.forceLongPolling);
14157
14123
  }
14158
- rm(t, e) {
14159
- const s = this.om();
14160
- return this.JT = new Ui(Ve.Lt(), s, this.ZT, this.zT), this.JT.start(t, e);
14124
+ YT(t, e) {
14125
+ const s = this.XT();
14126
+ return this.qT = new qi(Ve.Lt(), s, this.jT, this.BT), this.qT.start(t, e);
14161
14127
  }
14162
- nm(t) {
14128
+ HT(t) {
14163
14129
  const e = new Ae(t, {
14164
14130
  dn: Ve.Lt().dn
14165
14131
  });
14166
14132
  return new Gs(e, e => {
14167
- if (e instanceof Ji) {
14168
- const s = t, n = e.firestore.KT;
14169
- if (!n.isEqual(s)) throw new I(w.INVALID_ARGUMENT, "Document reference is for database " + `${n.projectId}/${n.database} but should be ` + `for database ${s.projectId}/${s.database}`);
14170
- return new Ks(t, e.um);
14133
+ if (e instanceof Yi) {
14134
+ const s = t, n = e.firestore.OT;
14135
+ if (!n.isEqual(s)) throw new I(E.INVALID_ARGUMENT, "Document reference is for database " + `${n.projectId}/${n.database} but should be ` + `for database ${s.projectId}/${s.database}`);
14136
+ return new Ks(t, e.em);
14171
14137
  }
14172
14138
  return e;
14173
14139
  });
14174
14140
  }
14175
- static YT(t) {
14176
- if (e = t.options, s = "projectId", !Object.prototype.hasOwnProperty.call(e, s)) throw new I(w.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
14141
+ static QT(t) {
14142
+ if (e = t.options, s = "projectId", !Object.prototype.hasOwnProperty.call(e, s)) throw new I(E.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
14177
14143
  var e, s;
14178
14144
  // Export the classes with a private constructor (it will fail if invoked
14179
14145
  // at runtime). Note that this still allows instanceof checks.
14180
14146
  // We're treating the variables as class names, so disable checking for lower
14181
14147
  // case variable names.
14182
14148
  const n = t.options.projectId;
14183
- if (!n || "string" != typeof n) throw new I(w.INVALID_ARGUMENT, "projectId must be a string in FirebaseApp.options");
14149
+ if (!n || "string" != typeof n) throw new I(E.INVALID_ARGUMENT, "projectId must be a string in FirebaseApp.options");
14184
14150
  return new Le(n);
14185
14151
  }
14186
14152
  get app() {
14187
- if (!this.GT) throw new I(w.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
14188
- return this.GT;
14153
+ if (!this.xT) throw new I(E.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
14154
+ return this.xT;
14189
14155
  }
14190
14156
  collection(t) {
14191
14157
  return as("Firestore.collection", arguments, 1), _s("Firestore.collection", "non-empty string", 1, t),
14192
- this.HT(), new sr(v.G(t), this);
14158
+ this.UT(), new nr(v.G(t), this);
14193
14159
  }
14194
14160
  doc(t) {
14195
14161
  return as("Firestore.doc", arguments, 1), _s("Firestore.doc", "non-empty string", 1, t),
14196
- this.HT(), Ji.cm(v.G(t), this);
14162
+ this.UT(), Yi.sm(v.G(t), this);
14197
14163
  }
14198
14164
  collectionGroup(t) {
14199
14165
  if (as("Firestore.collectionGroup", arguments, 1), _s("Firestore.collectionGroup", "non-empty string", 1, t),
14200
- t.indexOf("/") >= 0) throw new I(w.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function ` + "Firestore.collectionGroup(). Collection IDs must not contain '/'.");
14201
- return this.HT(), new tr(new Ct(v.H, t), this);
14166
+ t.indexOf("/") >= 0) throw new I(E.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function ` + "Firestore.collectionGroup(). Collection IDs must not contain '/'.");
14167
+ return this.UT(), new er(new Ct(v.H, t), this);
14202
14168
  }
14203
14169
  runTransaction(t) {
14204
14170
  return as("Firestore.runTransaction", arguments, 1), _s("Firestore.runTransaction", "function", 1, t),
14205
- this.HT().transaction(e => t(new zi(this, e)));
14171
+ this.UT().transaction(e => t(new Hi(this, e)));
14206
14172
  }
14207
14173
  batch() {
14208
- return this.HT(), new Hi(this);
14174
+ return this.UT(), new Ji(this);
14209
14175
  }
14210
14176
  static get logLevel() {
14211
14177
  switch (pe()) {
@@ -14236,180 +14202,180 @@ class Ki {
14236
14202
  break;
14237
14203
 
14238
14204
  default:
14239
- throw new I(w.INVALID_ARGUMENT, "Invalid log level: " + t);
14205
+ throw new I(E.INVALID_ARGUMENT, "Invalid log level: " + t);
14240
14206
  }
14241
14207
  }
14242
14208
  // Note: this is not a property because the minifier can't work correctly with
14243
14209
  // the way TypeScript compiler outputs properties.
14244
- _m() {
14245
- return this.em.timestampsInSnapshots;
14210
+ nm() {
14211
+ return this.GT.timestampsInSnapshots;
14246
14212
  }
14247
14213
  }
14248
14214
 
14249
14215
  /**
14250
14216
  * A reference to a transaction.
14251
- */ class zi {
14217
+ */ class Hi {
14252
14218
  constructor(t, e) {
14253
- this.lm = t, this.dm = e;
14219
+ this.im = t, this.rm = e;
14254
14220
  }
14255
14221
  get(t) {
14256
14222
  as("Transaction.get", arguments, 1);
14257
- const e = or("Transaction.get", t, this.lm);
14258
- return this.dm.pu([ e.um ]).then(t => {
14223
+ const e = hr("Transaction.get", t, this.im);
14224
+ return this.rm.pu([ e.em ]).then(t => {
14259
14225
  if (!t || 1 !== t.length) return De("Mismatch in docs returned from document lookup.");
14260
14226
  const s = t[0];
14261
- if (s instanceof vt) return new Xi(this.lm, e.um, null,
14227
+ if (s instanceof vt) return new Zi(this.im, e.em, null,
14262
14228
  /* fromCache= */ !1,
14263
- /* hasPendingWrites= */ !1, e.fm);
14264
- if (s instanceof bt) return new Xi(this.lm, e.um, s,
14229
+ /* hasPendingWrites= */ !1, e.om);
14230
+ if (s instanceof bt) return new Zi(this.im, e.em, s,
14265
14231
  /* fromCache= */ !1,
14266
- /* hasPendingWrites= */ !1, e.fm);
14232
+ /* hasPendingWrites= */ !1, e.om);
14267
14233
  throw De(`BatchGetDocumentsRequest returned unexpected document type: ${s.constructor.name}`);
14268
14234
  });
14269
14235
  }
14270
14236
  set(t, e, s) {
14271
14237
  cs("Transaction.set", arguments, 2, 3);
14272
- const n = or("Transaction.set", t, this.lm);
14273
- s = nr("Transaction.set", s);
14274
- const [i, r] = ar(n.fm, e, "Transaction.set"), o = s.merge || s.mergeFields ? this.lm.sm.pa(r, i, s.mergeFields) : this.lm.sm.Va(r, i);
14275
- return this.dm.set(n.um, o), this;
14238
+ const n = hr("Transaction.set", t, this.im);
14239
+ s = ir("Transaction.set", s);
14240
+ const [i, r] = ur(n.om, e, "Transaction.set"), o = s.merge || s.mergeFields ? this.im.zT.pa(r, i, s.mergeFields) : this.im.zT.Va(r, i);
14241
+ return this.rm.set(n.em, o), this;
14276
14242
  }
14277
14243
  update(t, e, s, ...n) {
14278
14244
  let i, r;
14279
14245
  return "string" == typeof e || e instanceof Cs ? (us("Transaction.update", arguments, 3),
14280
- i = or("Transaction.update", t, this.lm), r = this.lm.sm.Sa("Transaction.update", e, s, n)) : (as("Transaction.update", arguments, 2),
14281
- i = or("Transaction.update", t, this.lm), r = this.lm.sm.ya("Transaction.update", e)),
14282
- this.dm.update(i.um, r), this;
14246
+ i = hr("Transaction.update", t, this.im), r = this.im.zT.Sa("Transaction.update", e, s, n)) : (as("Transaction.update", arguments, 2),
14247
+ i = hr("Transaction.update", t, this.im), r = this.im.zT.ya("Transaction.update", e)),
14248
+ this.rm.update(i.em, r), this;
14283
14249
  }
14284
14250
  delete(t) {
14285
14251
  as("Transaction.delete", arguments, 1);
14286
- const e = or("Transaction.delete", t, this.lm);
14287
- return this.dm.delete(e.um), this;
14252
+ const e = hr("Transaction.delete", t, this.im);
14253
+ return this.rm.delete(e.em), this;
14288
14254
  }
14289
14255
  }
14290
14256
 
14291
- class Hi {
14257
+ class Ji {
14292
14258
  constructor(t) {
14293
- this.lm = t, this.Tm = [], this.mm = !1;
14259
+ this.im = t, this.hm = [], this.am = !1;
14294
14260
  }
14295
14261
  set(t, e, s) {
14296
- cs("WriteBatch.set", arguments, 2, 3), this.Em();
14297
- const n = or("WriteBatch.set", t, this.lm);
14298
- s = nr("WriteBatch.set", s);
14299
- const [i, r] = ar(n.fm, e, "WriteBatch.set"), o = s.merge || s.mergeFields ? this.lm.sm.pa(r, i, s.mergeFields) : this.lm.sm.Va(r, i);
14300
- return this.Tm = this.Tm.concat(o.da(n.um, Et.NONE)), this;
14262
+ cs("WriteBatch.set", arguments, 2, 3), this.um();
14263
+ const n = hr("WriteBatch.set", t, this.im);
14264
+ s = ir("WriteBatch.set", s);
14265
+ const [i, r] = ur(n.om, e, "WriteBatch.set"), o = s.merge || s.mergeFields ? this.im.zT.pa(r, i, s.mergeFields) : this.im.zT.Va(r, i);
14266
+ return this.hm = this.hm.concat(o.da(n.em, wt.NONE)), this;
14301
14267
  }
14302
14268
  update(t, e, s, ...n) {
14303
14269
  let i, r;
14304
- return this.Em(), "string" == typeof e || e instanceof Cs ? (us("WriteBatch.update", arguments, 3),
14305
- i = or("WriteBatch.update", t, this.lm), r = this.lm.sm.Sa("WriteBatch.update", e, s, n)) : (as("WriteBatch.update", arguments, 2),
14306
- i = or("WriteBatch.update", t, this.lm), r = this.lm.sm.ya("WriteBatch.update", e)),
14307
- this.Tm = this.Tm.concat(r.da(i.um, Et.exists(!0))), this;
14270
+ return this.um(), "string" == typeof e || e instanceof Cs ? (us("WriteBatch.update", arguments, 3),
14271
+ i = hr("WriteBatch.update", t, this.im), r = this.im.zT.Sa("WriteBatch.update", e, s, n)) : (as("WriteBatch.update", arguments, 2),
14272
+ i = hr("WriteBatch.update", t, this.im), r = this.im.zT.ya("WriteBatch.update", e)),
14273
+ this.hm = this.hm.concat(r.da(i.em, wt.exists(!0))), this;
14308
14274
  }
14309
14275
  delete(t) {
14310
- as("WriteBatch.delete", arguments, 1), this.Em();
14311
- const e = or("WriteBatch.delete", t, this.lm);
14312
- return this.Tm = this.Tm.concat(new Pt(e.um, Et.NONE)), this;
14276
+ as("WriteBatch.delete", arguments, 1), this.um();
14277
+ const e = hr("WriteBatch.delete", t, this.im);
14278
+ return this.hm = this.hm.concat(new Pt(e.em, wt.NONE)), this;
14313
14279
  }
14314
14280
  commit() {
14315
- return this.Em(), this.mm = !0, this.Tm.length > 0 ? this.lm.HT().write(this.Tm) : Promise.resolve();
14281
+ return this.um(), this.am = !0, this.hm.length > 0 ? this.im.UT().write(this.hm) : Promise.resolve();
14316
14282
  }
14317
- Em() {
14318
- if (this.mm) throw new I(w.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
14283
+ um() {
14284
+ if (this.am) throw new I(E.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
14319
14285
  }
14320
14286
  }
14321
14287
 
14322
14288
  /**
14323
14289
  * A reference to a particular document in a collection in the database.
14324
- */ class Ji {
14290
+ */ class Yi {
14325
14291
  constructor(t, e, s) {
14326
- this.um = t, this.firestore = e, this.fm = s, this.JT = this.firestore.HT();
14292
+ this.em = t, this.firestore = e, this.om = s, this.qT = this.firestore.UT();
14327
14293
  }
14328
- static cm(t, e, s) {
14329
- if (t.length % 2 != 0) throw new I(w.INVALID_ARGUMENT, "Invalid document reference. Document references must have an even number of segments, but " + `${t.K()} has ${t.length}`);
14330
- return new Ji(new C(t), e, s);
14294
+ static sm(t, e, s) {
14295
+ if (t.length % 2 != 0) throw new I(E.INVALID_ARGUMENT, "Invalid document reference. Document references must have an even number of segments, but " + `${t.K()} has ${t.length}`);
14296
+ return new Yi(new C(t), e, s);
14331
14297
  }
14332
14298
  get id() {
14333
- return this.um.path.B();
14299
+ return this.em.path.B();
14334
14300
  }
14335
14301
  get parent() {
14336
- return new sr(this.um.path.L(), this.firestore, this.fm);
14302
+ return new nr(this.em.path.L(), this.firestore, this.om);
14337
14303
  }
14338
14304
  get path() {
14339
- return this.um.path.K();
14305
+ return this.em.path.K();
14340
14306
  }
14341
14307
  collection(t) {
14342
14308
  if (as("DocumentReference.collection", arguments, 1), _s("DocumentReference.collection", "non-empty string", 1, t),
14343
- !t) throw new I(w.INVALID_ARGUMENT, "Must provide a non-empty collection name to collection()");
14309
+ !t) throw new I(E.INVALID_ARGUMENT, "Must provide a non-empty collection name to collection()");
14344
14310
  const e = v.G(t);
14345
- return new sr(this.um.path.child(e), this.firestore);
14311
+ return new nr(this.em.path.child(e), this.firestore);
14346
14312
  }
14347
14313
  isEqual(t) {
14348
- if (!(t instanceof Ji)) throw Ps("isEqual", "DocumentReference", 1, t);
14349
- return this.firestore === t.firestore && this.um.isEqual(t.um) && this.fm === t.fm;
14314
+ if (!(t instanceof Yi)) throw Ps("isEqual", "DocumentReference", 1, t);
14315
+ return this.firestore === t.firestore && this.em.isEqual(t.em) && this.om === t.om;
14350
14316
  }
14351
14317
  set(t, e) {
14352
- cs("DocumentReference.set", arguments, 1, 2), e = nr("DocumentReference.set", e);
14353
- const [s, n] = ar(this.fm, t, "DocumentReference.set"), i = e.merge || e.mergeFields ? this.firestore.sm.pa(n, s, e.mergeFields) : this.firestore.sm.Va(n, s);
14354
- return this.JT.write(i.da(this.um, Et.NONE));
14318
+ cs("DocumentReference.set", arguments, 1, 2), e = ir("DocumentReference.set", e);
14319
+ const [s, n] = ur(this.om, t, "DocumentReference.set"), i = e.merge || e.mergeFields ? this.firestore.zT.pa(n, s, e.mergeFields) : this.firestore.zT.Va(n, s);
14320
+ return this.qT.write(i.da(this.em, wt.NONE));
14355
14321
  }
14356
14322
  update(t, e, ...s) {
14357
14323
  let n;
14358
14324
  return "string" == typeof t || t instanceof Cs ? (us("DocumentReference.update", arguments, 2),
14359
- n = this.firestore.sm.Sa("DocumentReference.update", t, e, s)) : (as("DocumentReference.update", arguments, 1),
14360
- n = this.firestore.sm.ya("DocumentReference.update", t)), this.JT.write(n.da(this.um, Et.exists(!0)));
14325
+ n = this.firestore.zT.Sa("DocumentReference.update", t, e, s)) : (as("DocumentReference.update", arguments, 1),
14326
+ n = this.firestore.zT.ya("DocumentReference.update", t)), this.qT.write(n.da(this.em, wt.exists(!0)));
14361
14327
  }
14362
14328
  delete() {
14363
- return as("DocumentReference.delete", arguments, 0), this.JT.write([ new Pt(this.um, Et.NONE) ]);
14329
+ return as("DocumentReference.delete", arguments, 0), this.qT.write([ new Pt(this.em, wt.NONE) ]);
14364
14330
  }
14365
14331
  onSnapshot(...t) {
14366
14332
  cs("DocumentReference.onSnapshot", arguments, 1, 4);
14367
14333
  let e, s = {
14368
14334
  includeMetadataChanges: !1
14369
14335
  }, n = 0;
14370
- "object" != typeof t[n] || Qi(t[n]) || (s = t[n], As("DocumentReference.onSnapshot", s, [ "includeMetadataChanges" ]),
14336
+ "object" != typeof t[n] || Wi(t[n]) || (s = t[n], As("DocumentReference.onSnapshot", s, [ "includeMetadataChanges" ]),
14371
14337
  fs("DocumentReference.onSnapshot", "boolean", "includeMetadataChanges", s.includeMetadataChanges),
14372
14338
  n++);
14373
14339
  const i = {
14374
14340
  includeMetadataChanges: s.includeMetadataChanges
14375
14341
  };
14376
- return Qi(t[n]) ? e = t[n] : (_s("DocumentReference.onSnapshot", "function", n, t[n]),
14342
+ return Wi(t[n]) ? e = t[n] : (_s("DocumentReference.onSnapshot", "function", n, t[n]),
14377
14343
  ls("DocumentReference.onSnapshot", "function", n + 1, t[n + 1]), ls("DocumentReference.onSnapshot", "function", n + 2, t[n + 2]),
14378
14344
  e = {
14379
14345
  next: t[n],
14380
14346
  error: t[n + 1],
14381
14347
  complete: t[n + 2]
14382
- }), this.wm(i, e);
14348
+ }), this.cm(i, e);
14383
14349
  }
14384
- wm(t, e) {
14350
+ cm(t, e) {
14385
14351
  let s = t => {
14386
14352
  console.error("Uncaught Error in onSnapshot:", t);
14387
14353
  };
14388
14354
  e.error && (s = e.error.bind(e));
14389
- const n = new qi({
14355
+ const n = new Qi({
14390
14356
  next: t => {
14391
14357
  if (e.next) {
14392
- const s = t.docs.get(this.um);
14393
- e.next(new Xi(this.firestore, this.um, s, t.fromCache, t.hasPendingWrites, this.fm));
14358
+ const s = t.docs.get(this.em);
14359
+ e.next(new Zi(this.firestore, this.em, s, t.fromCache, t.hasPendingWrites, this.om));
14394
14360
  }
14395
14361
  },
14396
14362
  error: s
14397
- }), i = this.JT.listen(Ct.ve(this.um.path), n, t);
14363
+ }), i = this.qT.listen(Ct.ve(this.em.path), n, t);
14398
14364
  return () => {
14399
- n.OT(), this.JT.fc(i);
14365
+ n.DT(), this.qT.fc(i);
14400
14366
  };
14401
14367
  }
14402
14368
  get(t) {
14403
- return cs("DocumentReference.get", arguments, 0, 1), rr("DocumentReference.get", t),
14369
+ return cs("DocumentReference.get", arguments, 0, 1), or("DocumentReference.get", t),
14404
14370
  new Promise((e, s) => {
14405
- t && "cache" === t.source ? this.firestore.HT().$T(this.um).then(t => {
14406
- e(new Xi(this.firestore, this.um, t,
14407
- /*fromCache=*/ !0, t instanceof bt && t.te, this.fm));
14408
- }, s) : this.Im(e, s, t);
14371
+ t && "cache" === t.source ? this.firestore.UT().bT(this.em).then(t => {
14372
+ e(new Zi(this.firestore, this.em, t,
14373
+ /*fromCache=*/ !0, t instanceof bt && t.te, this.om));
14374
+ }, s) : this._m(e, s, t);
14409
14375
  });
14410
14376
  }
14411
- Im(t, e, s) {
14412
- const n = this.wm({
14377
+ _m(t, e, s) {
14378
+ const n = this.cm({
14413
14379
  includeMetadataChanges: !0,
14414
14380
  Kl: !0
14415
14381
  }, {
@@ -14424,17 +14390,17 @@ class Hi {
14424
14390
  // the server so we can deliver that even when you're
14425
14391
  // offline 2) Actually reject the Promise in the online case
14426
14392
  // if the document doesn't exist.
14427
- e(new I(w.UNAVAILABLE, "Failed to get document because the client is offline.")) : i.exists && i.metadata.fromCache && s && "server" === s.source ? e(new I(w.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : t(i);
14393
+ e(new I(E.UNAVAILABLE, "Failed to get document because the client is offline.")) : i.exists && i.metadata.fromCache && s && "server" === s.source ? e(new I(E.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : t(i);
14428
14394
  },
14429
14395
  error: e
14430
14396
  });
14431
14397
  }
14432
14398
  withConverter(t) {
14433
- return new Ji(this.um, this.firestore, t);
14399
+ return new Yi(this.em, this.firestore, t);
14434
14400
  }
14435
14401
  }
14436
14402
 
14437
- class Yi {
14403
+ class Xi {
14438
14404
  constructor(t, e) {
14439
14405
  this.hasPendingWrites = t, this.fromCache = e;
14440
14406
  }
@@ -14443,146 +14409,146 @@ class Yi {
14443
14409
  }
14444
14410
  }
14445
14411
 
14446
- class Xi {
14412
+ class Zi {
14447
14413
  constructor(t, e, s, n, i, r) {
14448
- this.lm = t, this.um = e, this.Rm = s, this.Am = n, this.Pm = i, this.fm = r;
14414
+ this.im = t, this.em = e, this.lm = s, this.dm = n, this.fm = i, this.om = r;
14449
14415
  }
14450
14416
  data(t) {
14451
- if (cs("DocumentSnapshot.data", arguments, 0, 1), t = ir("DocumentSnapshot.data", t),
14452
- this.Rm) {
14417
+ if (cs("DocumentSnapshot.data", arguments, 0, 1), t = rr("DocumentSnapshot.data", t),
14418
+ this.lm) {
14453
14419
  // We only want to use the converter and create a new DocumentSnapshot
14454
14420
  // if a converter has been provided.
14455
- if (this.fm) {
14456
- const e = new Zi(this.lm, this.um, this.Rm, this.Am, this.Pm);
14457
- return this.fm.fromFirestore(e, t);
14421
+ if (this.om) {
14422
+ const e = new tr(this.im, this.em, this.lm, this.dm, this.fm);
14423
+ return this.om.fromFirestore(e, t);
14458
14424
  }
14459
- return new Wi(this.lm, this.lm._m(), t.serverTimestamps,
14460
- /* converter= */ void 0).BT(this.Rm.Ie());
14425
+ return new ji(this.im, this.im.nm(), t.serverTimestamps,
14426
+ /* converter= */ void 0).kT(this.lm.Ie());
14461
14427
  }
14462
14428
  }
14463
14429
  get(t, e) {
14464
- if (cs("DocumentSnapshot.get", arguments, 1, 2), e = ir("DocumentSnapshot.get", e),
14465
- this.Rm) {
14466
- const s = this.Rm.data().field(Js("DocumentSnapshot.get", t));
14430
+ if (cs("DocumentSnapshot.get", arguments, 1, 2), e = rr("DocumentSnapshot.get", e),
14431
+ this.lm) {
14432
+ const s = this.lm.data().field(Js("DocumentSnapshot.get", t));
14467
14433
  if (null !== s) {
14468
- return new Wi(this.lm, this.lm._m(), e.serverTimestamps, this.fm).BT(s);
14434
+ return new ji(this.im, this.im.nm(), e.serverTimestamps, this.om).kT(s);
14469
14435
  }
14470
14436
  }
14471
14437
  }
14472
14438
  get id() {
14473
- return this.um.path.B();
14439
+ return this.em.path.B();
14474
14440
  }
14475
14441
  get ref() {
14476
- return new Ji(this.um, this.lm, this.fm);
14442
+ return new Yi(this.em, this.im, this.om);
14477
14443
  }
14478
14444
  get exists() {
14479
- return null !== this.Rm;
14445
+ return null !== this.lm;
14480
14446
  }
14481
14447
  get metadata() {
14482
- return new Yi(this.Pm, this.Am);
14448
+ return new Xi(this.fm, this.dm);
14483
14449
  }
14484
14450
  isEqual(t) {
14485
- if (!(t instanceof Xi)) throw Ps("isEqual", "DocumentSnapshot", 1, t);
14486
- return this.lm === t.lm && this.Am === t.Am && this.um.isEqual(t.um) && (null === this.Rm ? null === t.Rm : this.Rm.isEqual(t.Rm)) && this.fm === t.fm;
14451
+ if (!(t instanceof Zi)) throw Ps("isEqual", "DocumentSnapshot", 1, t);
14452
+ return this.im === t.im && this.dm === t.dm && this.em.isEqual(t.em) && (null === this.lm ? null === t.lm : this.lm.isEqual(t.lm)) && this.om === t.om;
14487
14453
  }
14488
14454
  }
14489
14455
 
14490
- class Zi extends Xi {
14456
+ class tr extends Zi {
14491
14457
  data(t) {
14492
14458
  return super.data(t);
14493
14459
  }
14494
14460
  }
14495
14461
 
14496
- class tr {
14462
+ class er {
14497
14463
  constructor(t, e, s) {
14498
- this.Vm = t, this.firestore = e, this.fm = s;
14464
+ this.Tm = t, this.firestore = e, this.om = s;
14499
14465
  }
14500
14466
  where(t, e, s) {
14501
14467
  as("Query.where", arguments, 3), Rs("Query.where", 3, s);
14502
14468
  let n;
14503
14469
  !function(t, e, s, n) {
14504
- if (!e.some(t => t === n)) throw new I(w.INVALID_ARGUMENT, `Invalid value ${Is(n)} provided to function ` + `${t}() for its ${gs(s)} argument. Acceptable ` + `values: ${e.join(", ")}`);
14470
+ if (!e.some(t => t === n)) throw new I(E.INVALID_ARGUMENT, `Invalid value ${Is(n)} provided to function ` + `${t}() for its ${gs(s)} argument. Acceptable ` + `values: ${e.join(", ")}`);
14505
14471
  }("Query.where", [ "<", "<=", "==", ">=", ">", "array-contains", "in", "array-contains-any" ], 2, e);
14506
14472
  const i = Js("Query.where", t), r = kt.G(e);
14507
14473
  if (i.Y()) {
14508
- if (r === kt.ARRAY_CONTAINS || r === kt.ARRAY_CONTAINS_ANY) throw new I(w.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r.toString()}' ` + "queries on FieldPath.documentId().");
14474
+ if (r === kt.ARRAY_CONTAINS || r === kt.ARRAY_CONTAINS_ANY) throw new I(E.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r.toString()}' ` + "queries on FieldPath.documentId().");
14509
14475
  if (r === kt.IN) {
14510
- this.gm(s, r);
14476
+ this.mm(s, r);
14511
14477
  const t = [];
14512
- for (const e of s) t.push(this.pm(e));
14478
+ for (const e of s) t.push(this.wm(e));
14513
14479
  n = {
14514
14480
  arrayValue: {
14515
14481
  values: t
14516
14482
  }
14517
14483
  };
14518
- } else n = this.pm(s);
14519
- } else r !== kt.IN && r !== kt.ARRAY_CONTAINS_ANY || this.gm(s, r), n = this.firestore.sm.Da("Query.where", s,
14484
+ } else n = this.wm(s);
14485
+ } else r !== kt.IN && r !== kt.ARRAY_CONTAINS_ANY || this.mm(s, r), n = this.firestore.zT.Da("Query.where", s,
14520
14486
  // We only allow nested arrays for IN queries.
14521
14487
  /** allowArrays = */ r === kt.IN);
14522
14488
  const o = Nt.create(i, r, n);
14523
- return this.ym(o), new tr(this.Vm.Ce(o), this.firestore, this.fm);
14489
+ return this.Em(o), new er(this.Tm.Ce(o), this.firestore, this.om);
14524
14490
  }
14525
14491
  orderBy(t, e) {
14526
14492
  let s;
14527
14493
  if (cs("Query.orderBy", arguments, 1, 2), ls("Query.orderBy", "non-empty string", 2, e),
14528
14494
  void 0 === e || "asc" === e) s = xt.ASCENDING; else {
14529
- if ("desc" !== e) throw new I(w.INVALID_ARGUMENT, `Function Query.orderBy() has unknown direction '${e}', ` + "expected 'asc' or 'desc'.");
14495
+ if ("desc" !== e) throw new I(E.INVALID_ARGUMENT, `Function Query.orderBy() has unknown direction '${e}', ` + "expected 'asc' or 'desc'.");
14530
14496
  s = xt.DESCENDING;
14531
14497
  }
14532
- if (null !== this.Vm.startAt) throw new I(w.INVALID_ARGUMENT, "Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");
14533
- if (null !== this.Vm.endAt) throw new I(w.INVALID_ARGUMENT, "Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");
14498
+ if (null !== this.Tm.startAt) throw new I(E.INVALID_ARGUMENT, "Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");
14499
+ if (null !== this.Tm.endAt) throw new I(E.INVALID_ARGUMENT, "Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");
14534
14500
  const n = Js("Query.orderBy", t), i = new Ut(n, s);
14535
- return this.bm(i), new tr(this.Vm.ke(i), this.firestore, this.fm);
14501
+ return this.Im(i), new er(this.Tm.ke(i), this.firestore, this.om);
14536
14502
  }
14537
14503
  limit(t) {
14538
14504
  return as("Query.limit", arguments, 1), _s("Query.limit", "number", 1, t), Vs("Query.limit", 1, t),
14539
- new tr(this.Vm.Ne(t), this.firestore, this.fm);
14505
+ new er(this.Tm.Ne(t), this.firestore, this.om);
14540
14506
  }
14541
14507
  limitToLast(t) {
14542
14508
  return as("Query.limitToLast", arguments, 1), _s("Query.limitToLast", "number", 1, t),
14543
- Vs("Query.limitToLast", 1, t), new tr(this.Vm.Fe(t), this.firestore, this.fm);
14509
+ Vs("Query.limitToLast", 1, t), new er(this.Tm.Fe(t), this.firestore, this.om);
14544
14510
  }
14545
14511
  startAt(t, ...e) {
14546
14512
  us("Query.startAt", arguments, 1);
14547
- const s = this.vm("Query.startAt", t, e,
14513
+ const s = this.Rm("Query.startAt", t, e,
14548
14514
  /*before=*/ !0);
14549
- return new tr(this.Vm.$e(s), this.firestore, this.fm);
14515
+ return new er(this.Tm.$e(s), this.firestore, this.om);
14550
14516
  }
14551
14517
  startAfter(t, ...e) {
14552
14518
  us("Query.startAfter", arguments, 1);
14553
- const s = this.vm("Query.startAfter", t, e,
14519
+ const s = this.Rm("Query.startAfter", t, e,
14554
14520
  /*before=*/ !1);
14555
- return new tr(this.Vm.$e(s), this.firestore, this.fm);
14521
+ return new er(this.Tm.$e(s), this.firestore, this.om);
14556
14522
  }
14557
14523
  endBefore(t, ...e) {
14558
14524
  us("Query.endBefore", arguments, 1);
14559
- const s = this.vm("Query.endBefore", t, e,
14525
+ const s = this.Rm("Query.endBefore", t, e,
14560
14526
  /*before=*/ !0);
14561
- return new tr(this.Vm.Me(s), this.firestore, this.fm);
14527
+ return new er(this.Tm.Me(s), this.firestore, this.om);
14562
14528
  }
14563
14529
  endAt(t, ...e) {
14564
14530
  us("Query.endAt", arguments, 1);
14565
- const s = this.vm("Query.endAt", t, e,
14531
+ const s = this.Rm("Query.endAt", t, e,
14566
14532
  /*before=*/ !1);
14567
- return new tr(this.Vm.Me(s), this.firestore, this.fm);
14533
+ return new er(this.Tm.Me(s), this.firestore, this.om);
14568
14534
  }
14569
14535
  isEqual(t) {
14570
- if (!(t instanceof tr)) throw Ps("isEqual", "Query", 1, t);
14571
- return this.firestore === t.firestore && this.Vm.isEqual(t.Vm);
14536
+ if (!(t instanceof er)) throw Ps("isEqual", "Query", 1, t);
14537
+ return this.firestore === t.firestore && this.Tm.isEqual(t.Tm);
14572
14538
  }
14573
14539
  withConverter(t) {
14574
- return new tr(this.Vm, this.firestore, t);
14540
+ return new er(this.Tm, this.firestore, t);
14575
14541
  }
14576
- /** Helper function to create a bound from a document or fields */ vm(t, e, s, n) {
14577
- if (Rs(t, 1, e), e instanceof Xi) {
14578
- if (s.length > 0) throw new I(w.INVALID_ARGUMENT, `Too many arguments provided to ${t}().`);
14542
+ /** Helper function to create a bound from a document or fields */ Rm(t, e, s, n) {
14543
+ if (Rs(t, 1, e), e instanceof Zi) {
14544
+ if (s.length > 0) throw new I(E.INVALID_ARGUMENT, `Too many arguments provided to ${t}().`);
14579
14545
  const i = e;
14580
- if (!i.exists) throw new I(w.NOT_FOUND, "Can't use a DocumentSnapshot that doesn't exist for " + `${t}().`);
14581
- return this.Sm(i.Rm, n);
14546
+ if (!i.exists) throw new I(E.NOT_FOUND, "Can't use a DocumentSnapshot that doesn't exist for " + `${t}().`);
14547
+ return this.Am(i.lm, n);
14582
14548
  }
14583
14549
  {
14584
14550
  const i = [ e ].concat(s);
14585
- return this.Dm(t, i, n);
14551
+ return this.Pm(t, i, n);
14586
14552
  }
14587
14553
  }
14588
14554
  /**
@@ -14595,7 +14561,7 @@ class tr {
14595
14561
  * Will throw if the document does not contain all fields of the order by
14596
14562
  * of the query or if any of the fields in the order by are an uncommitted
14597
14563
  * server timestamp.
14598
- */ Sm(t, e) {
14564
+ */ Am(t, e) {
14599
14565
  const s = [];
14600
14566
  // Because people expect to continue/end a query at the exact document
14601
14567
  // provided, we need to use the implicit sort order rather than the explicit
@@ -14604,12 +14570,12 @@ class tr {
14604
14570
  // the provided document. Without the key (by using the explicit sort
14605
14571
  // orders), multiple documents could match the position, yielding duplicate
14606
14572
  // results.
14607
- for (const e of this.Vm.orderBy) if (e.field.Y()) s.push(nt(this.firestore.KT, t.key)); else {
14573
+ for (const e of this.Tm.orderBy) if (e.field.Y()) s.push(nt(this.firestore.OT, t.key)); else {
14608
14574
  const n = t.field(e.field);
14609
- if (W(n)) throw new I(w.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
14575
+ if (W(n)) throw new I(E.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
14610
14576
  if (null === n) {
14611
14577
  const t = e.field.K();
14612
- throw new I(w.INVALID_ARGUMENT, "Invalid query. You are trying to start or end a query using a " + `document for which the field '${t}' (used as the ` + "orderBy) does not exist.");
14578
+ throw new I(E.INVALID_ARGUMENT, "Invalid query. You are trying to start or end a query using a " + `document for which the field '${t}' (used as the ` + "orderBy) does not exist.");
14613
14579
  }
14614
14580
  s.push(n);
14615
14581
  }
@@ -14617,22 +14583,22 @@ class tr {
14617
14583
  }
14618
14584
  /**
14619
14585
  * Converts a list of field values to a Bound for the given query.
14620
- */ Dm(t, e, s) {
14586
+ */ Pm(t, e, s) {
14621
14587
  // Use explicit order by's because it has to match the query the user made
14622
- const n = this.Vm.Ve;
14623
- if (e.length > n.length) throw new I(w.INVALID_ARGUMENT, `Too many arguments provided to ${t}(). ` + "The number of arguments must be less than or equal to the number of Query.orderBy() clauses");
14588
+ const n = this.Tm.Ve;
14589
+ if (e.length > n.length) throw new I(E.INVALID_ARGUMENT, `Too many arguments provided to ${t}(). ` + "The number of arguments must be less than or equal to the number of Query.orderBy() clauses");
14624
14590
  const i = [];
14625
14591
  for (let s = 0; s < e.length; s++) {
14626
14592
  const r = e[s];
14627
14593
  if (n[s].field.Y()) {
14628
- if ("string" != typeof r) throw new I(w.INVALID_ARGUMENT, "Invalid query. Expected a string for document ID in " + `${t}(), but got a ${typeof r}`);
14629
- if (!this.Vm.He() && -1 !== r.indexOf("/")) throw new I(w.INVALID_ARGUMENT, "Invalid query. When querying a collection and ordering by FieldPath.documentId(), " + `the value passed to ${t}() must be a plain document ID, but ` + `'${r}' contains a slash.`);
14630
- const e = this.Vm.path.child(v.G(r));
14631
- if (!C.st(e)) throw new I(w.INVALID_ARGUMENT, "Invalid query. When querying a collection group and ordering by " + `FieldPath.documentId(), the value passed to ${t}() must result in a ` + `valid document path, but '${e}' is not because it contains an odd number ` + "of segments.");
14594
+ if ("string" != typeof r) throw new I(E.INVALID_ARGUMENT, "Invalid query. Expected a string for document ID in " + `${t}(), but got a ${typeof r}`);
14595
+ if (!this.Tm.He() && -1 !== r.indexOf("/")) throw new I(E.INVALID_ARGUMENT, "Invalid query. When querying a collection and ordering by FieldPath.documentId(), " + `the value passed to ${t}() must be a plain document ID, but ` + `'${r}' contains a slash.`);
14596
+ const e = this.Tm.path.child(v.G(r));
14597
+ if (!C.st(e)) throw new I(E.INVALID_ARGUMENT, "Invalid query. When querying a collection group and ordering by " + `FieldPath.documentId(), the value passed to ${t}() must result in a ` + `valid document path, but '${e}' is not because it contains an odd number ` + "of segments.");
14632
14598
  const s = new C(e);
14633
- i.push(nt(this.firestore.KT, s));
14599
+ i.push(nt(this.firestore.OT, s));
14634
14600
  } else {
14635
- const e = this.firestore.sm.Da(t, r);
14601
+ const e = this.firestore.zT.Da(t, r);
14636
14602
  i.push(e);
14637
14603
  }
14638
14604
  }
@@ -14641,49 +14607,49 @@ class tr {
14641
14607
  onSnapshot(...t) {
14642
14608
  cs("Query.onSnapshot", arguments, 1, 4);
14643
14609
  let e, s = {}, n = 0;
14644
- return "object" != typeof t[n] || Qi(t[n]) || (s = t[n], As("Query.onSnapshot", s, [ "includeMetadataChanges" ]),
14610
+ return "object" != typeof t[n] || Wi(t[n]) || (s = t[n], As("Query.onSnapshot", s, [ "includeMetadataChanges" ]),
14645
14611
  fs("Query.onSnapshot", "boolean", "includeMetadataChanges", s.includeMetadataChanges),
14646
- n++), Qi(t[n]) ? e = t[n] : (_s("Query.onSnapshot", "function", n, t[n]), ls("Query.onSnapshot", "function", n + 1, t[n + 1]),
14612
+ n++), Wi(t[n]) ? e = t[n] : (_s("Query.onSnapshot", "function", n, t[n]), ls("Query.onSnapshot", "function", n + 1, t[n + 1]),
14647
14613
  ls("Query.onSnapshot", "function", n + 2, t[n + 2]), e = {
14648
14614
  next: t[n],
14649
14615
  error: t[n + 1],
14650
14616
  complete: t[n + 2]
14651
- }), this.Cm(this.Vm), this.wm(s, e);
14617
+ }), this.Vm(this.Tm), this.cm(s, e);
14652
14618
  }
14653
- wm(t, e) {
14619
+ cm(t, e) {
14654
14620
  let s = t => {
14655
14621
  console.error("Uncaught Error in onSnapshot:", t);
14656
14622
  };
14657
14623
  e.error && (s = e.error.bind(e));
14658
- const n = new qi({
14624
+ const n = new Qi({
14659
14625
  next: t => {
14660
- e.next && e.next(new er(this.firestore, this.Vm, t, this.fm));
14626
+ e.next && e.next(new sr(this.firestore, this.Tm, t, this.om));
14661
14627
  },
14662
14628
  error: s
14663
- }), i = this.firestore.HT(), r = i.listen(this.Vm, n, t);
14629
+ }), i = this.firestore.UT(), r = i.listen(this.Tm, n, t);
14664
14630
  return () => {
14665
- n.OT(), i.fc(r);
14631
+ n.DT(), i.fc(r);
14666
14632
  };
14667
14633
  }
14668
- Cm(t) {
14669
- if (t.Ke() && 0 === t.Ve.length) throw new I(w.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
14634
+ Vm(t) {
14635
+ if (t.Ke() && 0 === t.Ve.length) throw new I(E.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
14670
14636
  }
14671
14637
  get(t) {
14672
- return cs("Query.get", arguments, 0, 1), rr("Query.get", t), this.Cm(this.Vm), new Promise((e, s) => {
14673
- t && "cache" === t.source ? this.firestore.HT().MT(this.Vm).then(t => {
14674
- e(new er(this.firestore, this.Vm, t, this.fm));
14675
- }, s) : this.Im(e, s, t);
14638
+ return cs("Query.get", arguments, 0, 1), or("Query.get", t), this.Vm(this.Tm), new Promise((e, s) => {
14639
+ t && "cache" === t.source ? this.firestore.UT().vT(this.Tm).then(t => {
14640
+ e(new sr(this.firestore, this.Tm, t, this.om));
14641
+ }, s) : this._m(e, s, t);
14676
14642
  });
14677
14643
  }
14678
- Im(t, e, s) {
14679
- const n = this.wm({
14644
+ _m(t, e, s) {
14645
+ const n = this.cm({
14680
14646
  includeMetadataChanges: !0,
14681
14647
  Kl: !0
14682
14648
  }, {
14683
14649
  next: i => {
14684
14650
  // Remove query first before passing event to user to avoid
14685
14651
  // user actions affecting the now stale query.
14686
- n(), i.metadata.fromCache && s && "server" === s.source ? e(new I(w.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : t(i);
14652
+ n(), i.metadata.fromCache && s && "server" === s.source ? e(new I(E.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : t(i);
14687
14653
  },
14688
14654
  error: e
14689
14655
  });
@@ -14692,88 +14658,88 @@ class tr {
14692
14658
  * Parses the given documentIdValue into a ReferenceValue, throwing
14693
14659
  * appropriate errors if the value is anything other than a DocumentReference
14694
14660
  * or String, or if the string is malformed.
14695
- */ pm(t) {
14661
+ */ wm(t) {
14696
14662
  if ("string" == typeof t) {
14697
- if ("" === t) throw new I(w.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");
14698
- if (!this.Vm.He() && -1 !== t.indexOf("/")) throw new I(w.INVALID_ARGUMENT, "Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but " + `'${t}' contains a '/' character.`);
14699
- const e = this.Vm.path.child(v.G(t));
14700
- if (!C.st(e)) throw new I(w.INVALID_ARGUMENT, "Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, " + `but '${e}' is not because it has an odd number of segments (${e.length}).`);
14701
- return nt(this.firestore.KT, new C(e));
14663
+ if ("" === t) throw new I(E.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");
14664
+ if (!this.Tm.He() && -1 !== t.indexOf("/")) throw new I(E.INVALID_ARGUMENT, "Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but " + `'${t}' contains a '/' character.`);
14665
+ const e = this.Tm.path.child(v.G(t));
14666
+ if (!C.st(e)) throw new I(E.INVALID_ARGUMENT, "Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, " + `but '${e}' is not because it has an odd number of segments (${e.length}).`);
14667
+ return nt(this.firestore.OT, new C(e));
14702
14668
  }
14703
- if (t instanceof Ji) {
14669
+ if (t instanceof Yi) {
14704
14670
  const e = t;
14705
- return nt(this.firestore.KT, e.um);
14671
+ return nt(this.firestore.OT, e.em);
14706
14672
  }
14707
- throw new I(w.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: " + `${Is(t)}.`);
14673
+ throw new I(E.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: " + `${Is(t)}.`);
14708
14674
  }
14709
14675
  /**
14710
14676
  * Validates that the value passed into a disjunctrive filter satisfies all
14711
14677
  * array requirements.
14712
- */ gm(t, e) {
14713
- if (!Array.isArray(t) || 0 === t.length) throw new I(w.INVALID_ARGUMENT, "Invalid Query. A non-empty array is required for " + `'${e.toString()}' filters.`);
14714
- if (t.length > 10) throw new I(w.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters support a ` + "maximum of 10 elements in the value array.");
14715
- if (t.indexOf(null) >= 0) throw new I(w.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters cannot contain 'null' ` + "in the value array.");
14716
- if (t.filter(t => Number.isNaN(t)).length > 0) throw new I(w.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters cannot contain 'NaN' ` + "in the value array.");
14678
+ */ mm(t, e) {
14679
+ if (!Array.isArray(t) || 0 === t.length) throw new I(E.INVALID_ARGUMENT, "Invalid Query. A non-empty array is required for " + `'${e.toString()}' filters.`);
14680
+ if (t.length > 10) throw new I(E.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters support a ` + "maximum of 10 elements in the value array.");
14681
+ if (t.indexOf(null) >= 0) throw new I(E.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters cannot contain 'null' ` + "in the value array.");
14682
+ if (t.filter(t => Number.isNaN(t)).length > 0) throw new I(E.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters cannot contain 'NaN' ` + "in the value array.");
14717
14683
  }
14718
- ym(t) {
14684
+ Em(t) {
14719
14685
  if (t instanceof Nt) {
14720
14686
  const e = [ kt.ARRAY_CONTAINS, kt.ARRAY_CONTAINS_ANY ], s = [ kt.IN, kt.ARRAY_CONTAINS_ANY ], n = e.indexOf(t.op) >= 0, i = s.indexOf(t.op) >= 0;
14721
14687
  if (t.Ge()) {
14722
- const e = this.Vm.Se();
14723
- if (null !== e && !e.isEqual(t.field)) throw new I(w.INVALID_ARGUMENT, "Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have" + ` inequality filters on '${e.toString()}'` + ` and '${t.field.toString()}'`);
14724
- const s = this.Vm.De();
14725
- null !== s && this.km(t.field, s);
14688
+ const e = this.Tm.Se();
14689
+ if (null !== e && !e.isEqual(t.field)) throw new I(E.INVALID_ARGUMENT, "Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have" + ` inequality filters on '${e.toString()}'` + ` and '${t.field.toString()}'`);
14690
+ const s = this.Tm.De();
14691
+ null !== s && this.gm(t.field, s);
14726
14692
  } else if (i || n) {
14727
14693
  // You can have at most 1 disjunctive filter and 1 array filter. Check if
14728
14694
  // the new filter conflicts with an existing one.
14729
14695
  let r = null;
14730
- if (i && (r = this.Vm.ze(s)), null === r && n && (r = this.Vm.ze(e)), null != r)
14696
+ if (i && (r = this.Tm.ze(s)), null === r && n && (r = this.Tm.ze(e)), null != r)
14731
14697
  // We special case when it's a duplicate op to give a slightly clearer error message.
14732
- throw r === t.op ? new I(w.INVALID_ARGUMENT, "Invalid query. You cannot use more than one " + `'${t.op.toString()}' filter.`) : new I(w.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters ` + `with '${r.toString()}' filters.`);
14698
+ throw r === t.op ? new I(E.INVALID_ARGUMENT, "Invalid query. You cannot use more than one " + `'${t.op.toString()}' filter.`) : new I(E.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters ` + `with '${r.toString()}' filters.`);
14733
14699
  }
14734
14700
  }
14735
14701
  }
14736
- bm(t) {
14737
- if (null === this.Vm.De()) {
14702
+ Im(t) {
14703
+ if (null === this.Tm.De()) {
14738
14704
  // This is the first order by. It must match any inequality.
14739
- const e = this.Vm.Se();
14740
- null !== e && this.km(e, t.field);
14705
+ const e = this.Tm.Se();
14706
+ null !== e && this.gm(e, t.field);
14741
14707
  }
14742
14708
  }
14743
- km(t, e) {
14744
- if (!e.isEqual(t)) throw new I(w.INVALID_ARGUMENT, "Invalid query. You have a where filter with an inequality " + `(<, <=, >, or >=) on field '${t.toString()}' ` + `and so you must also use '${t.toString()}' ` + "as your first Query.orderBy(), but your first Query.orderBy() " + `is on field '${e.toString()}' instead.`);
14709
+ gm(t, e) {
14710
+ if (!e.isEqual(t)) throw new I(E.INVALID_ARGUMENT, "Invalid query. You have a where filter with an inequality " + `(<, <=, >, or >=) on field '${t.toString()}' ` + `and so you must also use '${t.toString()}' ` + "as your first Query.orderBy(), but your first Query.orderBy() " + `is on field '${e.toString()}' instead.`);
14745
14711
  }
14746
14712
  }
14747
14713
 
14748
- class er {
14714
+ class sr {
14749
14715
  constructor(t, e, s, n) {
14750
- this.lm = t, this.Nm = e, this.Fm = s, this.fm = n, this.$m = null, this.Mm = null,
14751
- this.metadata = new Yi(s.hasPendingWrites, s.fromCache);
14716
+ this.im = t, this.pm = e, this.ym = s, this.om = n, this.bm = null, this.vm = null,
14717
+ this.metadata = new Xi(s.hasPendingWrites, s.fromCache);
14752
14718
  }
14753
14719
  get docs() {
14754
14720
  const t = [];
14755
14721
  return this.forEach(e => t.push(e)), t;
14756
14722
  }
14757
14723
  get empty() {
14758
- return this.Fm.docs.U();
14724
+ return this.ym.docs.U();
14759
14725
  }
14760
14726
  get size() {
14761
- return this.Fm.docs.size;
14727
+ return this.ym.docs.size;
14762
14728
  }
14763
14729
  forEach(t, e) {
14764
14730
  cs("QuerySnapshot.forEach", arguments, 1, 2), _s("QuerySnapshot.forEach", "function", 1, t),
14765
- this.Fm.docs.forEach(s => {
14766
- t.call(e, this.Lm(s));
14731
+ this.ym.docs.forEach(s => {
14732
+ t.call(e, this.Sm(s));
14767
14733
  });
14768
14734
  }
14769
14735
  get query() {
14770
- return new tr(this.Nm, this.lm, this.fm);
14736
+ return new er(this.pm, this.im, this.om);
14771
14737
  }
14772
14738
  docChanges(t) {
14773
14739
  t && (As("QuerySnapshot.docChanges", t, [ "includeMetadataChanges" ]), fs("QuerySnapshot.docChanges", "boolean", "includeMetadataChanges", t.includeMetadataChanges));
14774
14740
  const e = !(!t || !t.includeMetadataChanges);
14775
- if (e && this.Fm.ds) throw new I(w.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
14776
- return this.$m && this.Mm === e || (this.$m =
14741
+ if (e && this.ym.ds) throw new I(E.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
14742
+ return this.bm && this.vm === e || (this.bm =
14777
14743
  /**
14778
14744
  * Calculates the array of firestore.DocumentChange's for a given ViewSnapshot.
14779
14745
  *
@@ -14785,7 +14751,7 @@ class er {
14785
14751
  // fast
14786
14752
  let e, i = 0;
14787
14753
  return s.docChanges.map(r => {
14788
- const o = new Zi(t, r.doc.key, r.doc, s.fromCache, s._s.has(r.doc.key), n);
14754
+ const o = new tr(t, r.doc.key, r.doc, s.fromCache, s._s.has(r.doc.key), n);
14789
14755
  return e = r.doc, {
14790
14756
  type: "added",
14791
14757
  doc: o,
@@ -14799,88 +14765,88 @@ class er {
14799
14765
  // to lookup the index of a document.
14800
14766
  let i = s.cs;
14801
14767
  return s.docChanges.filter(t => e || 3 /* Metadata */ !== t.type).map(e => {
14802
- const r = new Zi(t, e.doc.key, e.doc, s.fromCache, s._s.has(e.doc.key), n);
14768
+ const r = new tr(t, e.doc.key, e.doc, s.fromCache, s._s.has(e.doc.key), n);
14803
14769
  let o = -1, h = -1;
14804
14770
  return 0 /* Added */ !== e.type && (o = i.indexOf(e.doc.key), i = i.delete(e.doc.key)),
14805
14771
  1 /* Removed */ !== e.type && (i = i.add(e.doc), h = i.indexOf(e.doc.key)), {
14806
- type: hr(e.type),
14772
+ type: ar(e.type),
14807
14773
  doc: r,
14808
14774
  oldIndex: o,
14809
14775
  newIndex: h
14810
14776
  };
14811
14777
  });
14812
14778
  }
14813
- }(this.lm, e, this.Fm, this.fm), this.Mm = e), this.$m;
14779
+ }(this.im, e, this.ym, this.om), this.vm = e), this.bm;
14814
14780
  }
14815
14781
  /** Check the equality. The call can be very expensive. */ isEqual(t) {
14816
- if (!(t instanceof er)) throw Ps("isEqual", "QuerySnapshot", 1, t);
14817
- return this.lm === t.lm && this.Nm.isEqual(t.Nm) && this.Fm.isEqual(t.Fm) && this.fm === t.fm;
14782
+ if (!(t instanceof sr)) throw Ps("isEqual", "QuerySnapshot", 1, t);
14783
+ return this.im === t.im && this.pm.isEqual(t.pm) && this.ym.isEqual(t.ym) && this.om === t.om;
14818
14784
  }
14819
- Lm(t) {
14820
- return new Zi(this.lm, t.key, t, this.metadata.fromCache, this.Fm._s.has(t.key), this.fm);
14785
+ Sm(t) {
14786
+ return new tr(this.im, t.key, t, this.metadata.fromCache, this.ym._s.has(t.key), this.om);
14821
14787
  }
14822
14788
  }
14823
14789
 
14824
- class sr extends tr {
14790
+ class nr extends er {
14825
14791
  constructor(t, e, s) {
14826
- if (super(Ct.ve(t), e, s), this.Om = t, t.length % 2 != 1) throw new I(w.INVALID_ARGUMENT, "Invalid collection reference. Collection references must have an odd number of segments, but " + `${t.K()} has ${t.length}`);
14792
+ if (super(Ct.ve(t), e, s), this.Dm = t, t.length % 2 != 1) throw new I(E.INVALID_ARGUMENT, "Invalid collection reference. Collection references must have an odd number of segments, but " + `${t.K()} has ${t.length}`);
14827
14793
  }
14828
14794
  get id() {
14829
- return this.Vm.path.B();
14795
+ return this.Tm.path.B();
14830
14796
  }
14831
14797
  get parent() {
14832
- const t = this.Vm.path.L();
14833
- return t.U() ? null : new Ji(new C(t), this.firestore);
14798
+ const t = this.Tm.path.L();
14799
+ return t.U() ? null : new Yi(new C(t), this.firestore);
14834
14800
  }
14835
14801
  get path() {
14836
- return this.Vm.path.K();
14802
+ return this.Tm.path.K();
14837
14803
  }
14838
14804
  doc(t) {
14839
14805
  if (cs("CollectionReference.doc", arguments, 0, 1),
14840
14806
  // We allow omission of 'pathString' but explicitly prohibit passing in both
14841
14807
  // 'undefined' and 'null'.
14842
14808
  0 === arguments.length && (t = ke.mi()), _s("CollectionReference.doc", "non-empty string", 1, t),
14843
- "" === t) throw new I(w.INVALID_ARGUMENT, "Document path must be a non-empty string");
14809
+ "" === t) throw new I(E.INVALID_ARGUMENT, "Document path must be a non-empty string");
14844
14810
  const e = v.G(t);
14845
- return Ji.cm(this.Vm.path.child(e), this.firestore, this.fm);
14811
+ return Yi.sm(this.Tm.path.child(e), this.firestore, this.om);
14846
14812
  }
14847
14813
  add(t) {
14848
- as("CollectionReference.add", arguments, 1), _s("CollectionReference.add", "object", 1, this.fm ? this.fm.toFirestore(t) : t);
14814
+ as("CollectionReference.add", arguments, 1), _s("CollectionReference.add", "object", 1, this.om ? this.om.toFirestore(t) : t);
14849
14815
  const e = this.doc();
14850
14816
  return e.set(t).then(() => e);
14851
14817
  }
14852
14818
  withConverter(t) {
14853
- return new sr(this.Om, this.firestore, t);
14819
+ return new nr(this.Dm, this.firestore, t);
14854
14820
  }
14855
14821
  }
14856
14822
 
14857
- function nr(t, e) {
14823
+ function ir(t, e) {
14858
14824
  if (void 0 === e) return {
14859
14825
  merge: !1
14860
14826
  };
14861
14827
  if (As(t, e, [ "merge", "mergeFields" ]), fs(t, "boolean", "merge", e.merge), Ts(t, "mergeFields", "a string or a FieldPath", e.mergeFields, t => "string" == typeof t || t instanceof Cs),
14862
- void 0 !== e.mergeFields && void 0 !== e.merge) throw new I(w.INVALID_ARGUMENT, `Invalid options passed to function ${t}(): You cannot specify both "merge" ` + 'and "mergeFields".');
14828
+ void 0 !== e.mergeFields && void 0 !== e.merge) throw new I(E.INVALID_ARGUMENT, `Invalid options passed to function ${t}(): You cannot specify both "merge" ` + 'and "mergeFields".');
14863
14829
  return e;
14864
14830
  }
14865
14831
 
14866
- function ir(t, e) {
14832
+ function rr(t, e) {
14867
14833
  return void 0 === e ? {} : (As(t, e, [ "serverTimestamps" ]), ms(t, 0, "serverTimestamps", e.serverTimestamps, [ "estimate", "previous", "none" ]),
14868
14834
  e);
14869
14835
  }
14870
14836
 
14871
- function rr(t, e) {
14837
+ function or(t, e) {
14872
14838
  ls(t, "object", 1, e), e && (As(t, e, [ "source" ]), ms(t, 0, "source", e.source, [ "default", "server", "cache" ]));
14873
14839
  }
14874
14840
 
14875
- function or(t, e, s) {
14876
- if (e instanceof Ji) {
14877
- if (e.firestore !== s) throw new I(w.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
14841
+ function hr(t, e, s) {
14842
+ if (e instanceof Yi) {
14843
+ if (e.firestore !== s) throw new I(E.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
14878
14844
  return e;
14879
14845
  }
14880
14846
  throw Ps(t, "DocumentReference", 1, e);
14881
14847
  }
14882
14848
 
14883
- function hr(t) {
14849
+ function ar(t) {
14884
14850
  switch (t) {
14885
14851
  case 0 /* Added */ :
14886
14852
  return "added";
@@ -14905,28 +14871,28 @@ function hr(t) {
14905
14871
  * because we want to provide the user with a more specific error message if
14906
14872
  * their set() or fails due to invalid data originating from a toFirestore()
14907
14873
  * call.
14908
- */ function ar(t, e, s) {
14874
+ */ function ur(t, e, s) {
14909
14875
  let n;
14910
14876
  return t ? (n = t.toFirestore(e), s = "toFirestore() in " + s) : n = e, [ n, s ];
14911
14877
  }
14912
14878
 
14913
- const ur = ys(Gi, "Use firebase.firestore() instead."), cr = ys(zi, "Use firebase.firestore().runTransaction() instead."), _r = ys(Hi, "Use firebase.firestore().batch() instead."), lr = ys(Ji, "Use firebase.firestore().doc() instead."), dr = ys(Xi), fr = ys(Zi), Tr = ys(tr), mr = ys(er), Er = ys(sr, "Use firebase.firestore().collection() instead."), wr = {
14914
- Firestore: ur,
14879
+ const cr = ys(zi, "Use firebase.firestore() instead."), _r = ys(Hi, "Use firebase.firestore().runTransaction() instead."), lr = ys(Ji, "Use firebase.firestore().batch() instead."), dr = ys(Yi, "Use firebase.firestore().doc() instead."), fr = ys(Zi), Tr = ys(tr), mr = ys(er), wr = ys(sr), Er = ys(nr, "Use firebase.firestore().collection() instead."), Ir = {
14880
+ Firestore: cr,
14915
14881
  GeoPoint: Bs,
14916
14882
  Timestamp: p,
14917
14883
  Blob: Ds,
14918
- Transaction: cr,
14919
- WriteBatch: _r,
14920
- DocumentReference: lr,
14921
- DocumentSnapshot: dr,
14922
- Query: Tr,
14923
- QueryDocumentSnapshot: fr,
14924
- QuerySnapshot: mr,
14884
+ Transaction: _r,
14885
+ WriteBatch: lr,
14886
+ DocumentReference: dr,
14887
+ DocumentSnapshot: fr,
14888
+ Query: mr,
14889
+ QueryDocumentSnapshot: Tr,
14890
+ QuerySnapshot: wr,
14925
14891
  CollectionReference: Er,
14926
14892
  FieldPath: Cs,
14927
14893
  FieldValue: xs,
14928
- setLogLevel: Gi.setLogLevel,
14929
- CACHE_SIZE_UNLIMITED: ji
14894
+ setLogLevel: zi.setLogLevel,
14895
+ CACHE_SIZE_UNLIMITED: Ki
14930
14896
  };
14931
14897
 
14932
14898
  /**
@@ -14945,7 +14911,7 @@ const ur = ys(Gi, "Use firebase.firestore() instead."), cr = ys(zi, "Use firebas
14945
14911
  * See the License for the specific language governing permissions and
14946
14912
  * limitations under the License.
14947
14913
  */
14948
- class Ir {
14914
+ class Rr {
14949
14915
  Hu(t) {
14950
14916
  // No-op.
14951
14917
  }
@@ -14973,26 +14939,26 @@ class Ir {
14973
14939
  /**
14974
14940
  * Browser implementation of ConnectivityMonitor.
14975
14941
  */
14976
- class Rr {
14942
+ class Ar {
14977
14943
  constructor() {
14978
- this.xm = () => this.Bm(), this.Um = () => this.qm(), this.Qm = [], this.Wm();
14944
+ this.Cm = () => this.km(), this.Nm = () => this.Fm(), this.$m = [], this.Mm();
14979
14945
  }
14980
14946
  Hu(t) {
14981
- this.Qm.push(t);
14947
+ this.$m.push(t);
14982
14948
  }
14983
14949
  lc() {
14984
- window.removeEventListener("online", this.xm), window.removeEventListener("offline", this.Um);
14950
+ window.removeEventListener("online", this.Cm), window.removeEventListener("offline", this.Nm);
14985
14951
  }
14986
- Wm() {
14987
- window.addEventListener("online", this.xm), window.addEventListener("offline", this.Um);
14952
+ Mm() {
14953
+ window.addEventListener("online", this.Cm), window.addEventListener("offline", this.Nm);
14988
14954
  }
14989
- Bm() {
14955
+ km() {
14990
14956
  be("ConnectivityMonitor", "Network connectivity changed: AVAILABLE");
14991
- for (const t of this.Qm) t(0 /* AVAILABLE */);
14957
+ for (const t of this.$m) t(0 /* AVAILABLE */);
14992
14958
  }
14993
- qm() {
14959
+ Fm() {
14994
14960
  be("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE");
14995
- for (const t of this.Qm) t(1 /* UNAVAILABLE */);
14961
+ for (const t of this.$m) t(1 /* UNAVAILABLE */);
14996
14962
  }
14997
14963
  // TODO(chenbrian): Consider passing in window either into this component or
14998
14964
  // here for testing via FakeWindow.
@@ -15022,33 +14988,33 @@ class Rr {
15022
14988
  * Provides a simple helper class that implements the Stream interface to
15023
14989
  * bridge to other implementations that are streams but do not implement the
15024
14990
  * interface. The stream callbacks are invoked with the callOn... methods.
15025
- */ class Ar {
14991
+ */ class Pr {
15026
14992
  constructor(t) {
15027
- this.jm = t.jm, this.Km = t.Km;
14993
+ this.Lm = t.Lm, this.Om = t.Om;
15028
14994
  }
15029
14995
  _u(t) {
15030
- this.Gm = t;
14996
+ this.xm = t;
15031
14997
  }
15032
14998
  ou(t) {
15033
- this.zm = t;
14999
+ this.Bm = t;
15034
15000
  }
15035
15001
  onMessage(t) {
15036
- this.Hm = t;
15002
+ this.Um = t;
15037
15003
  }
15038
15004
  close() {
15039
- this.Km();
15005
+ this.Om();
15040
15006
  }
15041
15007
  send(t) {
15042
- this.jm(t);
15008
+ this.Lm(t);
15043
15009
  }
15044
- Jm() {
15045
- this.Gm();
15010
+ qm() {
15011
+ this.xm();
15046
15012
  }
15047
- Ym(t) {
15048
- this.zm(t);
15013
+ Qm(t) {
15014
+ this.Bm(t);
15049
15015
  }
15050
- Xm(t) {
15051
- this.Hm(t);
15016
+ Wm(t) {
15017
+ this.Um(t);
15052
15018
  }
15053
15019
  }
15054
15020
 
@@ -15067,26 +15033,26 @@ class Rr {
15067
15033
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15068
15034
  * See the License for the specific language governing permissions and
15069
15035
  * limitations under the License.
15070
- */ const Pr = {
15036
+ */ const Vr = {
15071
15037
  BatchGetDocuments: "batchGet",
15072
15038
  Commit: "commit"
15073
- }, Vr = "gl-js/ fire/" + m;
15039
+ }, gr = "gl-js/ fire/" + m;
15074
15040
 
15075
- class gr {
15041
+ class pr {
15076
15042
  constructor(t) {
15077
15043
  this.cn = t.cn;
15078
15044
  const e = t.ssl ? "https" : "http";
15079
- this.Zm = e + "://" + t.host, this.forceLongPolling = t.forceLongPolling;
15045
+ this.jm = e + "://" + t.host, this.forceLongPolling = t.forceLongPolling;
15080
15046
  }
15081
15047
  /**
15082
15048
  * Modifies the headers for a request, adding any authorization token if
15083
15049
  * present and any additional headers for the request.
15084
- */ tE(t, e) {
15050
+ */ Km(t, e) {
15085
15051
  if (e) for (const s in e.h) e.h.hasOwnProperty(s) && (t[s] = e.h[s]);
15086
- t["X-Goog-Api-Client"] = Vr;
15052
+ t["X-Goog-Api-Client"] = gr;
15087
15053
  }
15088
15054
  gu(t, e, s) {
15089
- const n = this.eE(t);
15055
+ const n = this.Gm(t);
15090
15056
  return new Promise((i, r) => {
15091
15057
  const o = new _;
15092
15058
  o.listenOnce(l.COMPLETE, () => {
@@ -15098,7 +15064,7 @@ class gr {
15098
15064
  break;
15099
15065
 
15100
15066
  case d.TIMEOUT:
15101
- be("Connection", 'RPC "' + t + '" timed out'), r(new I(w.DEADLINE_EXCEEDED, "Request time out"));
15067
+ be("Connection", 'RPC "' + t + '" timed out'), r(new I(E.DEADLINE_EXCEEDED, "Request time out"));
15102
15068
  break;
15103
15069
 
15104
15070
  case d.HTTP_ERROR:
@@ -15109,14 +15075,14 @@ class gr {
15109
15075
  if (t && t.status && t.message) {
15110
15076
  const e = function(t) {
15111
15077
  const e = t.toLowerCase().replace("_", "-");
15112
- return Object.values(w).indexOf(e) >= 0 ? e : w.UNKNOWN;
15078
+ return Object.values(E).indexOf(e) >= 0 ? e : E.UNKNOWN;
15113
15079
  }(t.status);
15114
15080
  r(new I(e, t.message));
15115
- } else r(new I(w.UNKNOWN, "Server responded with status " + o.getStatus()));
15081
+ } else r(new I(E.UNKNOWN, "Server responded with status " + o.getStatus()));
15116
15082
  } else
15117
15083
  // If we received an HTTP_ERROR but there's no status code,
15118
15084
  // it's most probably a connection issue
15119
- be("Connection", 'RPC "' + t + '" failed'), r(new I(w.UNAVAILABLE, "Connection failed."));
15085
+ be("Connection", 'RPC "' + t + '" failed'), r(new I(E.UNAVAILABLE, "Connection failed."));
15120
15086
  break;
15121
15087
 
15122
15088
  default:
@@ -15141,7 +15107,7 @@ class gr {
15141
15107
  const u = {
15142
15108
  "Content-Type": "text/plain"
15143
15109
  };
15144
- this.tE(u, s), o.send(n, "POST", a, u, 15);
15110
+ this.Km(u, s), o.send(n, "POST", a, u, 15);
15145
15111
  });
15146
15112
  }
15147
15113
  yu(t, e, s) {
@@ -15150,7 +15116,7 @@ class gr {
15150
15116
  return this.gu(t, e, s);
15151
15117
  }
15152
15118
  lu(t, e) {
15153
- const s = [ this.Zm, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], n = f(), c = {
15119
+ const s = [ this.jm, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], n = f(), c = {
15154
15120
  // Required for backend stickiness, routing behavior is based on this
15155
15121
  // parameter.
15156
15122
  httpSessionIdParam: "gsessionid",
@@ -15173,7 +15139,7 @@ class gr {
15173
15139
  },
15174
15140
  forceLongPolling: this.forceLongPolling
15175
15141
  };
15176
- this.tE(c.initMessageHeaders, e),
15142
+ this.Km(c.initMessageHeaders, e),
15177
15143
  // Sending the custom headers we just added to request.initMessageHeaders
15178
15144
  // (Authorization, etc.) will trigger the browser to make a CORS preflight
15179
15145
  // request because the XHR will no longer meet the criteria for a "simple"
@@ -15202,12 +15168,12 @@ class gr {
15202
15168
  // A flag to determine whether the stream was closed (by us or through an
15203
15169
  // error/close event) to avoid delivering multiple close events or sending
15204
15170
  // on a closed stream
15205
- const E = new Ar({
15206
- jm: t => {
15171
+ const w = new Pr({
15172
+ Lm: t => {
15207
15173
  m ? be("Connection", "Not sending because WebChannel is closed:", t) : (d || (be("Connection", "Opening WebChannel transport."),
15208
15174
  l.open(), d = !0), be("Connection", "WebChannel sending:", t), l.send(t));
15209
15175
  },
15210
- Km: () => l.close()
15176
+ Om: () => l.close()
15211
15177
  }), R = (t, e) => {
15212
15178
  // TODO(dimond): closure typing seems broken because WebChannel does
15213
15179
  // not implement goog.events.Listenable
@@ -15228,9 +15194,9 @@ class gr {
15228
15194
  return R(T.EventType.OPEN, () => {
15229
15195
  m || be("Connection", "WebChannel transport opened.");
15230
15196
  }), R(T.EventType.CLOSE, () => {
15231
- m || (m = !0, be("Connection", "WebChannel transport closed"), E.Ym());
15197
+ m || (m = !0, be("Connection", "WebChannel transport closed"), w.Qm());
15232
15198
  }), R(T.EventType.ERROR, t => {
15233
- m || (m = !0, be("Connection", "WebChannel transport errored:", t), E.Ym(new I(w.UNAVAILABLE, "The operation could not be completed")));
15199
+ m || (m = !0, be("Connection", "WebChannel transport errored:", t), w.Qm(new I(E.UNAVAILABLE, "The operation could not be completed")));
15234
15200
  }), R(T.EventType.MESSAGE, t => {
15235
15201
  var e;
15236
15202
  if (!m) {
@@ -15252,23 +15218,23 @@ class gr {
15252
15218
  const e = Kt[t];
15253
15219
  if (void 0 !== e) return Ht(e);
15254
15220
  }(t), s = i.message;
15255
- void 0 === e && (e = w.INTERNAL, s = "Unknown error status: " + t + " with message " + i.message),
15221
+ void 0 === e && (e = E.INTERNAL, s = "Unknown error status: " + t + " with message " + i.message),
15256
15222
  // Mark closed so no further events are propagated
15257
- m = !0, E.Ym(new I(e, s)), l.close();
15258
- } else be("Connection", "WebChannel received:", s), E.Xm(s);
15223
+ m = !0, w.Qm(new I(e, s)), l.close();
15224
+ } else be("Connection", "WebChannel received:", s), w.Wm(s);
15259
15225
  }
15260
15226
  }), setTimeout(() => {
15261
15227
  // Technically we could/should wait for the WebChannel opened event,
15262
15228
  // but because we want to send the first message with the WebChannel
15263
15229
  // handshake we pretend the channel opened here (asynchronously), and
15264
15230
  // then delay the actual open until the first message is sent.
15265
- E.Jm();
15266
- }, 0), E;
15231
+ w.qm();
15232
+ }, 0), w;
15267
15233
  }
15268
15234
  // visible for testing
15269
- eE(t) {
15270
- const e = Pr[t];
15271
- return this.Zm + "/v1/projects/" + this.cn.projectId + "/databases/" + this.cn.database + "/documents:" + e;
15235
+ Gm(t) {
15236
+ const e = Vr[t];
15237
+ return this.jm + "/v1/projects/" + this.cn.projectId + "/databases/" + this.cn.database + "/documents:" + e;
15272
15238
  }
15273
15239
  }
15274
15240
 
@@ -15308,7 +15274,7 @@ class gr {
15308
15274
  * Registers the main Firestore build with the components framework.
15309
15275
  * Persistence can be enabled via `firebase.firestore().enablePersistence()`.
15310
15276
  */
15311
- function pr(t) {
15277
+ function yr(t) {
15312
15278
  !
15313
15279
  /**
15314
15280
  * Configures Firestore as part of the Firebase SDK by calling registerService.
@@ -15321,8 +15287,8 @@ function pr(t) {
15321
15287
  t.INTERNAL.registerComponent(new c("firestore", t => {
15322
15288
  const s = t.getProvider("app").getImmediate();
15323
15289
  return e(s, t.getProvider("auth-internal"));
15324
- }, "PUBLIC" /* PUBLIC */).setServiceProps(Object.assign({}, wr)));
15325
- }(t, (t, e) => new Gi(t, e, new Bi)), t.registerVersion("@firebase/firestore", "1.14.0-canary.daf63c2c");
15290
+ }, "PUBLIC" /* PUBLIC */).setServiceProps(Object.assign({}, Ir)));
15291
+ }(t, (t, e) => new zi(t, e, new xi)), t.registerVersion("@firebase/firestore", "1.14.0");
15326
15292
  }
15327
15293
 
15328
15294
  /**
@@ -15358,13 +15324,13 @@ Ve.fi(new class {
15358
15324
  get window() {
15359
15325
  return "undefined" != typeof window ? window : null;
15360
15326
  }
15361
- DT(t) {
15362
- return Promise.resolve(new gr(t));
15327
+ VT(t) {
15328
+ return Promise.resolve(new pr(t));
15363
15329
  }
15364
- gT() {
15365
- return Rr.Uc() ? new Rr : new Ir;
15330
+ mT() {
15331
+ return Ar.Uc() ? new Ar : new Rr;
15366
15332
  }
15367
- yT(t) {
15333
+ fT(t) {
15368
15334
  return new Ae(t, {
15369
15335
  dn: !0
15370
15336
  });
@@ -15378,7 +15344,7 @@ Ve.fi(new class {
15378
15344
  btoa(t) {
15379
15345
  return btoa(t);
15380
15346
  }
15381
- }), pr(t);
15347
+ }), yr(t);
15382
15348
 
15383
- export { pr as __PRIVATE_registerFirestore };
15349
+ export { yr as __PRIVATE_registerFirestore };
15384
15350
  //# sourceMappingURL=index.esm2017.js.map