@stoker-platform/web-client 0.5.36 → 0.5.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { getApp as it, registerVersion as xm, initializeApp as zn, setLogLevel as Qr, onLog as Nm } from "firebase/app";
2
2
  import { isSupported as Fm, initializeAnalytics as Dm, setConsent as Mm } from "firebase/analytics";
3
- import { getAuth as fr, validatePassword as _d, initializeAuth as Oc, indexedDBLocalPersistence as Pm, browserLocalPersistence as qm, browserSessionPersistence as Ec, inMemoryPersistence as Sc, beforeAuthStateChanged as Lm, connectAuthEmulator as $m, onAuthStateChanged as Bn, getIdTokenResult as jm, signOut as vd, signInWithEmailAndPassword as Um, getMultiFactorResolver as Vm, TotpMultiFactorGenerator as Xa, signInWithCustomToken as Wm, multiFactor as Tc } from "firebase/auth";
3
+ import { getAuth as dr, validatePassword as _d, initializeAuth as Oc, indexedDBLocalPersistence as Pm, browserLocalPersistence as qm, browserSessionPersistence as Ec, inMemoryPersistence as Sc, beforeAuthStateChanged as Lm, connectAuthEmulator as $m, onAuthStateChanged as Bn, getIdTokenResult as jm, signOut as vd, signInWithEmailAndPassword as Um, getMultiFactorResolver as Vm, TotpMultiFactorGenerator as Xa, signInWithCustomToken as Wm, multiFactor as Tc } from "firebase/auth";
4
4
  import { getDatabase as wd, onValue as zm, ref as Bm, connectDatabaseEmulator as Zm } from "firebase/database";
5
- import { getFirestore as We, where as ye, query as me, collection as qr, and as Xr, or as Rc, onSnapshot as dr, doc as ke, Timestamp as Bt, setDoc as Gm, getDoc as bd, orderBy as rt, limit as Xt, startAfter as eo, endBefore as to, limitToLast as Nr, getDocsFromCache as Od, getDocsFromServer as Hm, getDocs as Km, getCountFromServer as Ed, getDocFromCache as Ym, getDocFromServer as Jm, writeBatch as Ao, serverTimestamp as Lr, deleteField as Cn, arrayRemove as ko, arrayUnion as Io, collectionGroup as Qm, connectFirestoreEmulator as Cc, persistentLocalCache as Ac, persistentSingleTabManager as kc, persistentMultipleTabManager as Ic, memoryEagerGarbageCollector as Xm, memoryLruGarbageCollector as ep, memoryLocalCache as tp, initializeFirestore as Zn, getPersistentCacheIndexManager as rp, enablePersistentCacheIndexAutoCreation as np, terminate as sp, clearIndexedDbPersistence as xc, waitForPendingWrites as ip, onSnapshotsInSync as Sd, startAt as ap, endAt as op, addDoc as Td } from "firebase/firestore";
5
+ import { getFirestore as We, where as ye, query as he, collection as qr, and as Xr, or as Rc, onSnapshot as hr, doc as ke, Timestamp as Bt, setDoc as Gm, getDoc as bd, orderBy as rt, limit as Xt, startAfter as eo, endBefore as to, limitToLast as Fr, getDocsFromCache as Od, getDocsFromServer as Hm, getDocs as Km, getCountFromServer as Ed, getDocFromCache as Ym, getDocFromServer as Jm, writeBatch as Ao, serverTimestamp as Lr, deleteField as Cn, arrayRemove as ko, arrayUnion as Io, collectionGroup as Qm, connectFirestoreEmulator as Cc, persistentLocalCache as Ac, persistentSingleTabManager as kc, persistentMultipleTabManager as Ic, memoryEagerGarbageCollector as Xm, memoryLruGarbageCollector as ep, memoryLocalCache as tp, initializeFirestore as Zn, getPersistentCacheIndexManager as rp, enablePersistentCacheIndexAutoCreation as np, terminate as sp, clearIndexedDbPersistence as xc, waitForPendingWrites as ip, onSnapshotsInSync as Sd, startAt as ap, endAt as op, addDoc as Td } from "firebase/firestore";
6
6
  import { connectStorageEmulator as cp, getStorage as lp } from "firebase/storage";
7
7
  import { getFunctions as Ue, httpsCallable as Je, connectFunctionsEmulator as up } from "firebase/functions";
8
8
  import { ReCaptchaEnterpriseProvider as fp, initializeAppCheck as Gn, onTokenChanged as Hn } from "firebase/app-check";
9
9
  import { getPerformance as dp } from "firebase/performance";
10
10
  import { getRemoteConfig as hp, fetchAndActivate as mp } from "firebase/remote-config";
11
- const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
11
+ const pp = "0.5.38", yp = (r) => !!r.auth, vt = (r, e) => {
12
12
  if (e?.operations)
13
13
  return e.operations.includes(r);
14
14
  }, An = (r, e) => e ? e.Role ? r.access?.includes(e.Role) : !1 : !0, gp = (r, e) => e ? !e.Role || r.restrictCreate === !0 ? !1 : typeof r.restrictCreate == "object" ? r.restrictCreate?.includes(e.Role) : !0 : !0, _p = (r, e) => e ? !e.Role || r.restrictUpdate === !0 ? !1 : typeof r.restrictUpdate == "object" ? r.restrictUpdate?.includes(e.Role) : !0 : !0, re = (r, e) => r.filter((t) => t.name === e)[0], _e = (r) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(r.type), Rd = (r, e) => {
@@ -41,7 +41,7 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
41
41
  const l = t.collections?.[c.collection], f = e.collections[c.collection].access.entityRestrictions;
42
42
  if (!f)
43
43
  throw new Error("PERMISSION_DENIED");
44
- const h = f.restrictions?.find((d) => d.type === a.type && d.roles.some((m) => m.role === t.Role));
44
+ const h = f.restrictions?.find((d) => d.type === a.type && d.roles.some((p) => p.role === t.Role));
45
45
  if (!h)
46
46
  throw new Error("PERMISSION_DENIED");
47
47
  h.roles.forEach((d) => {
@@ -66,36 +66,36 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
66
66
  return;
67
67
  }
68
68
  const u = Rd(e, s), f = xo(e, s), h = Cd(e, t, s);
69
- u?.filter((g) => g.type === "Record_Owner").forEach((g) => {
70
- "operations" in g && g.operations && !g.operations.includes(r) || i.Created_By !== n && (l = !1);
71
- }), u?.filter((g) => g.type === "Record_User").forEach((g) => {
72
- if ("operations" in g && g.operations && !g.operations.includes(r))
69
+ u?.filter((m) => m.type === "Record_Owner").forEach((m) => {
70
+ "operations" in m && m.operations && !m.operations.includes(r) || i.Created_By !== n && (l = !1);
71
+ }), u?.filter((m) => m.type === "Record_User").forEach((m) => {
72
+ if ("operations" in m && m.operations && !m.operations.includes(r))
73
73
  return;
74
- const C = re(o, g.collectionField);
75
- i[`${C.name}_Array`]?.includes(s.Doc_ID) || (l = !1);
76
- }), u?.filter((g) => g.type === "Record_Property").forEach((g) => {
77
- if ("operations" in g && g.operations && !g.operations.includes(r))
74
+ const T = re(o, m.collectionField);
75
+ i[`${T.name}_Array`]?.includes(s.Doc_ID) || (l = !1);
76
+ }), u?.filter((m) => m.type === "Record_Property").forEach((m) => {
77
+ if ("operations" in m && m.operations && !m.operations.includes(r))
78
78
  return;
79
- const C = re(o, g.propertyField), R = g.roles.find((v) => v.role === s.Role);
80
- C.type === "Array" ? R.values?.some((v) => i[C.name].includes(v)) || (l = !1) : R.values?.includes(i[C.name]) || (l = !1);
79
+ const T = re(o, m.propertyField), R = m.roles.find((v) => v.role === s.Role);
80
+ T.type === "Array" ? R.values?.some((v) => i[T.name].includes(v)) || (l = !1) : R.values?.includes(i[T.name]) || (l = !1);
81
81
  });
82
- let d = !0, m = !1;
83
- f?.filter((g) => g.type === "Individual").forEach(() => {
84
- m = !0, c?.individualEntities?.includes(i.id) || (d = !1);
82
+ let d = !0, p = !1;
83
+ f?.filter((m) => m.type === "Individual").forEach(() => {
84
+ p = !0, c?.individualEntities?.includes(i.id) || (d = !1);
85
85
  });
86
86
  let E = !0, y = !1;
87
- if (f?.filter((g) => g.type === "Parent").forEach((g) => {
87
+ if (f?.filter((m) => m.type === "Parent").forEach((m) => {
88
88
  y = !0;
89
- const C = re(o, g.collectionField);
90
- c?.parentEntities?.some((R) => i[`${C.name}_Array`].includes(R)) || (E = !1);
91
- }), f?.filter((g) => g.type === "Parent_Property").forEach((g) => {
89
+ const T = re(o, m.collectionField);
90
+ c?.parentEntities?.some((R) => i[`${T.name}_Array`].includes(R)) || (E = !1);
91
+ }), f?.filter((m) => m.type === "Parent_Property").forEach((m) => {
92
92
  y = !0;
93
- const C = re(o, g.collectionField), R = re(o, g.propertyField);
93
+ const T = re(o, m.collectionField), R = re(o, m.propertyField);
94
94
  Object.entries(c?.parentPropertyEntities || {}).some((v) => {
95
- const [A, p] = v;
96
- return A === i[R.name] && i[`${C.name}_Array`].some((k) => p.includes(k));
95
+ const [C, g] = v;
96
+ return C === i[R.name] && i[`${T.name}_Array`].some((k) => g.includes(k));
97
97
  }) || (E = !1);
98
- }), m && y) {
98
+ }), p && y) {
99
99
  if (!(d || E)) {
100
100
  l = !1;
101
101
  return;
@@ -105,41 +105,41 @@ const pp = "0.5.35", yp = (r) => !!r.auth, vt = (r, e) => {
105
105
  return;
106
106
  }
107
107
  let _ = !0, S = !1;
108
- h?.filter((g) => g.parentFilter.type === "Individual").forEach((g) => {
108
+ h?.filter((m) => m.parentFilter.type === "Individual").forEach((m) => {
109
109
  S = !0;
110
- const { parentFilter: C } = g, R = re(o, C.collectionField), v = s.collections?.[R.collection];
110
+ const { parentFilter: T } = m, R = re(o, T.collectionField), v = s.collections?.[R.collection];
111
111
  if (!v) {
112
112
  l = !1;
113
113
  return;
114
114
  }
115
- v.individualEntities?.some((A) => i[`${R.name}_Array`].includes(A)) || (_ = !1);
115
+ v.individualEntities?.some((C) => i[`${R.name}_Array`].includes(C)) || (_ = !1);
116
116
  });
117
- let T = !0, P = !1;
118
- if (h?.filter((g) => g.parentFilter.type === "Parent").forEach((g) => {
119
- P = !0;
120
- const { parentFilter: C } = g, R = re(o, C.collectionField), v = re(o, C.parentCollectionField), A = s.collections?.[R.collection];
121
- if (!A) {
117
+ let A = !0, F = !1;
118
+ if (h?.filter((m) => m.parentFilter.type === "Parent").forEach((m) => {
119
+ F = !0;
120
+ const { parentFilter: T } = m, R = re(o, T.collectionField), v = re(o, T.parentCollectionField), C = s.collections?.[R.collection];
121
+ if (!C) {
122
122
  l = !1;
123
123
  return;
124
124
  }
125
- A.parentEntities?.some((p) => i[`${v.name}_Array`].includes(p)) || (T = !1);
126
- }), h?.filter((g) => g.parentFilter.type === "Parent_Property").forEach((g) => {
127
- P = !0;
128
- const { parentFilter: C } = g, R = re(o, C.collectionField), v = re(o, C.parentPropertyField), A = re(o, C.parentCollectionField), p = s.collections?.[R.collection];
129
- if (!p) {
125
+ C.parentEntities?.some((g) => i[`${v.name}_Array`].includes(g)) || (A = !1);
126
+ }), h?.filter((m) => m.parentFilter.type === "Parent_Property").forEach((m) => {
127
+ F = !0;
128
+ const { parentFilter: T } = m, R = re(o, T.collectionField), v = re(o, T.parentPropertyField), C = re(o, T.parentCollectionField), g = s.collections?.[R.collection];
129
+ if (!g) {
130
130
  l = !1;
131
131
  return;
132
132
  }
133
- Object.entries(p.parentPropertyEntities || {}).some((k) => {
133
+ Object.entries(g.parentPropertyEntities || {}).some((k) => {
134
134
  const [I, b] = k;
135
- return I === i[v.name] && i[`${A.name}_Array`].some((w) => b.includes(w));
136
- }) || (T = !1);
137
- }), S && P) {
138
- if (!(_ || T)) {
135
+ return I === i[v.name] && i[`${C.name}_Array`].some((w) => b.includes(w));
136
+ }) || (A = !1);
137
+ }), S && F) {
138
+ if (!(_ || A)) {
139
139
  l = !1;
140
140
  return;
141
141
  }
142
- } else if (!_ || !T) {
142
+ } else if (!_ || !A) {
143
143
  l = !1;
144
144
  return;
145
145
  }
@@ -313,7 +313,7 @@ function kd() {
313
313
  return os = r, os;
314
314
  }
315
315
  var cs, Bc;
316
- function ct() {
316
+ function lt() {
317
317
  if (Bc) return cs;
318
318
  Bc = 1;
319
319
  var r = kd(), e = typeof self == "object" && self && self.Object === Object && self, t = r || e || Function("return this")();
@@ -323,7 +323,7 @@ var ls, Zc;
323
323
  function Wr() {
324
324
  if (Zc) return ls;
325
325
  Zc = 1;
326
- var r = ct(), e = r.Symbol;
326
+ var r = lt(), e = r.Symbol;
327
327
  return ls = e, ls;
328
328
  }
329
329
  var us, Gc;
@@ -354,7 +354,7 @@ function Ip() {
354
354
  return fs = t, fs;
355
355
  }
356
356
  var ds, Kc;
357
- function hr() {
357
+ function mr() {
358
358
  if (Kc) return ds;
359
359
  Kc = 1;
360
360
  var r = Wr(), e = kp(), t = Ip(), n = "[object Null]", s = "[object Undefined]", i = r ? r.toStringTag : void 0;
@@ -377,7 +377,7 @@ var ms, Jc;
377
377
  function No() {
378
378
  if (Jc) return ms;
379
379
  Jc = 1;
380
- var r = hr(), e = wt(), t = "[object AsyncFunction]", n = "[object Function]", s = "[object GeneratorFunction]", i = "[object Proxy]";
380
+ var r = mr(), e = wt(), t = "[object AsyncFunction]", n = "[object Function]", s = "[object GeneratorFunction]", i = "[object Proxy]";
381
381
  function a(o) {
382
382
  if (!e(o))
383
383
  return !1;
@@ -390,7 +390,7 @@ var ps, Qc;
390
390
  function xp() {
391
391
  if (Qc) return ps;
392
392
  Qc = 1;
393
- var r = ct(), e = r["__core-js_shared__"];
393
+ var r = lt(), e = r["__core-js_shared__"];
394
394
  return ps = e, ps;
395
395
  }
396
396
  var ys, Xc;
@@ -465,7 +465,7 @@ var bs, sl;
465
465
  function Fo() {
466
466
  if (sl) return bs;
467
467
  sl = 1;
468
- var r = Zt(), e = ct(), t = r(e, "Map");
468
+ var r = Zt(), e = lt(), t = r(e, "Map");
469
469
  return bs = t, bs;
470
470
  }
471
471
  var Os, il;
@@ -723,32 +723,32 @@ function xd() {
723
723
  Cl = 1;
724
724
  var r = Yp(), e = Jp(), t = Qp(), n = 1, s = 2;
725
725
  function i(a, o, c, l, u, f) {
726
- var h = c & n, d = a.length, m = o.length;
727
- if (d != m && !(h && m > d))
726
+ var h = c & n, d = a.length, p = o.length;
727
+ if (d != p && !(h && p > d))
728
728
  return !1;
729
729
  var E = f.get(a), y = f.get(o);
730
730
  if (E && y)
731
731
  return E == o && y == a;
732
- var _ = -1, S = !0, T = c & s ? new r() : void 0;
732
+ var _ = -1, S = !0, A = c & s ? new r() : void 0;
733
733
  for (f.set(a, o), f.set(o, a); ++_ < d; ) {
734
- var P = a[_], g = o[_];
734
+ var F = a[_], m = o[_];
735
735
  if (l)
736
- var C = h ? l(g, P, _, o, a, f) : l(P, g, _, a, o, f);
737
- if (C !== void 0) {
738
- if (C)
736
+ var T = h ? l(m, F, _, o, a, f) : l(F, m, _, a, o, f);
737
+ if (T !== void 0) {
738
+ if (T)
739
739
  continue;
740
740
  S = !1;
741
741
  break;
742
742
  }
743
- if (T) {
743
+ if (A) {
744
744
  if (!e(o, function(R, v) {
745
- if (!t(T, v) && (P === R || u(P, R, c, l, f)))
746
- return T.push(v);
745
+ if (!t(A, v) && (F === R || u(F, R, c, l, f)))
746
+ return A.push(v);
747
747
  })) {
748
748
  S = !1;
749
749
  break;
750
750
  }
751
- } else if (!(P === g || u(P, g, c, l, f))) {
751
+ } else if (!(F === m || u(F, m, c, l, f))) {
752
752
  S = !1;
753
753
  break;
754
754
  }
@@ -761,7 +761,7 @@ var Bs, Al;
761
761
  function Nd() {
762
762
  if (Al) return Bs;
763
763
  Al = 1;
764
- var r = ct(), e = r.Uint8Array;
764
+ var r = lt(), e = r.Uint8Array;
765
765
  return Bs = e, Bs;
766
766
  }
767
767
  var Zs, kl;
@@ -792,43 +792,43 @@ var Hs, xl;
792
792
  function ty() {
793
793
  if (xl) return Hs;
794
794
  xl = 1;
795
- var r = Wr(), e = Nd(), t = Vr(), n = xd(), s = Xp(), i = ey(), a = 1, o = 2, c = "[object Boolean]", l = "[object Date]", u = "[object Error]", f = "[object Map]", h = "[object Number]", d = "[object RegExp]", m = "[object Set]", E = "[object String]", y = "[object Symbol]", _ = "[object ArrayBuffer]", S = "[object DataView]", T = r ? r.prototype : void 0, P = T ? T.valueOf : void 0;
796
- function g(C, R, v, A, p, k, I) {
795
+ var r = Wr(), e = Nd(), t = Vr(), n = xd(), s = Xp(), i = ey(), a = 1, o = 2, c = "[object Boolean]", l = "[object Date]", u = "[object Error]", f = "[object Map]", h = "[object Number]", d = "[object RegExp]", p = "[object Set]", E = "[object String]", y = "[object Symbol]", _ = "[object ArrayBuffer]", S = "[object DataView]", A = r ? r.prototype : void 0, F = A ? A.valueOf : void 0;
796
+ function m(T, R, v, C, g, k, I) {
797
797
  switch (v) {
798
798
  case S:
799
- if (C.byteLength != R.byteLength || C.byteOffset != R.byteOffset)
799
+ if (T.byteLength != R.byteLength || T.byteOffset != R.byteOffset)
800
800
  return !1;
801
- C = C.buffer, R = R.buffer;
801
+ T = T.buffer, R = R.buffer;
802
802
  case _:
803
- return !(C.byteLength != R.byteLength || !k(new e(C), new e(R)));
803
+ return !(T.byteLength != R.byteLength || !k(new e(T), new e(R)));
804
804
  case c:
805
805
  case l:
806
806
  case h:
807
- return t(+C, +R);
807
+ return t(+T, +R);
808
808
  case u:
809
- return C.name == R.name && C.message == R.message;
809
+ return T.name == R.name && T.message == R.message;
810
810
  case d:
811
811
  case E:
812
- return C == R + "";
812
+ return T == R + "";
813
813
  case f:
814
814
  var b = s;
815
- case m:
816
- var w = A & a;
817
- if (b || (b = i), C.size != R.size && !w)
815
+ case p:
816
+ var w = C & a;
817
+ if (b || (b = i), T.size != R.size && !w)
818
818
  return !1;
819
- var O = I.get(C);
819
+ var O = I.get(T);
820
820
  if (O)
821
821
  return O == R;
822
- A |= o, I.set(C, R);
823
- var x = n(b(C), b(R), A, p, k, I);
824
- return I.delete(C), x;
822
+ C |= o, I.set(T, R);
823
+ var x = n(b(T), b(R), C, g, k, I);
824
+ return I.delete(T), x;
825
825
  case y:
826
- if (P)
827
- return P.call(C) == P.call(R);
826
+ if (F)
827
+ return F.call(T) == F.call(R);
828
828
  }
829
829
  return !1;
830
830
  }
831
- return Hs = g, Hs;
831
+ return Hs = m, Hs;
832
832
  }
833
833
  var Ks, Nl;
834
834
  function Fd() {
@@ -916,7 +916,7 @@ var ni, jl;
916
916
  function sy() {
917
917
  if (jl) return ni;
918
918
  jl = 1;
919
- var r = hr(), e = bt(), t = "[object Arguments]";
919
+ var r = mr(), e = bt(), t = "[object Arguments]";
920
920
  function n(s) {
921
921
  return e(s) && r(s) == t;
922
922
  }
@@ -933,7 +933,7 @@ function Pd() {
933
933
  };
934
934
  return si = i, si;
935
935
  }
936
- var Er = { exports: {} }, ii, Vl;
936
+ var Sr = { exports: {} }, ii, Vl;
937
937
  function iy() {
938
938
  if (Vl) return ii;
939
939
  Vl = 1;
@@ -942,13 +942,13 @@ function iy() {
942
942
  }
943
943
  return ii = r, ii;
944
944
  }
945
- Er.exports;
945
+ Sr.exports;
946
946
  var Wl;
947
947
  function Mn() {
948
948
  return Wl || (Wl = 1, (function(r, e) {
949
- var t = ct(), n = iy(), s = e && !e.nodeType && e, i = s && !0 && r && !r.nodeType && r, a = i && i.exports === s, o = a ? t.Buffer : void 0, c = o ? o.isBuffer : void 0, l = c || n;
949
+ var t = lt(), n = iy(), s = e && !e.nodeType && e, i = s && !0 && r && !r.nodeType && r, a = i && i.exports === s, o = a ? t.Buffer : void 0, c = o ? o.isBuffer : void 0, l = c || n;
950
950
  r.exports = l;
951
- })(Er, Er.exports)), Er.exports;
951
+ })(Sr, Sr.exports)), Sr.exports;
952
952
  }
953
953
  var ai, zl;
954
954
  function qo() {
@@ -975,8 +975,8 @@ var ci, Zl;
975
975
  function ay() {
976
976
  if (Zl) return ci;
977
977
  Zl = 1;
978
- var r = hr(), e = qd(), t = bt(), n = "[object Arguments]", s = "[object Array]", i = "[object Boolean]", a = "[object Date]", o = "[object Error]", c = "[object Function]", l = "[object Map]", u = "[object Number]", f = "[object Object]", h = "[object RegExp]", d = "[object Set]", m = "[object String]", E = "[object WeakMap]", y = "[object ArrayBuffer]", _ = "[object DataView]", S = "[object Float32Array]", T = "[object Float64Array]", P = "[object Int8Array]", g = "[object Int16Array]", C = "[object Int32Array]", R = "[object Uint8Array]", v = "[object Uint8ClampedArray]", A = "[object Uint16Array]", p = "[object Uint32Array]", k = {};
979
- k[S] = k[T] = k[P] = k[g] = k[C] = k[R] = k[v] = k[A] = k[p] = !0, k[n] = k[s] = k[y] = k[i] = k[_] = k[a] = k[o] = k[c] = k[l] = k[u] = k[f] = k[h] = k[d] = k[m] = k[E] = !1;
978
+ var r = mr(), e = qd(), t = bt(), n = "[object Arguments]", s = "[object Array]", i = "[object Boolean]", a = "[object Date]", o = "[object Error]", c = "[object Function]", l = "[object Map]", u = "[object Number]", f = "[object Object]", h = "[object RegExp]", d = "[object Set]", p = "[object String]", E = "[object WeakMap]", y = "[object ArrayBuffer]", _ = "[object DataView]", S = "[object Float32Array]", A = "[object Float64Array]", F = "[object Int8Array]", m = "[object Int16Array]", T = "[object Int32Array]", R = "[object Uint8Array]", v = "[object Uint8ClampedArray]", C = "[object Uint16Array]", g = "[object Uint32Array]", k = {};
979
+ k[S] = k[A] = k[F] = k[m] = k[T] = k[R] = k[v] = k[C] = k[g] = !0, k[n] = k[s] = k[y] = k[i] = k[_] = k[a] = k[o] = k[c] = k[l] = k[u] = k[f] = k[h] = k[d] = k[p] = k[E] = !1;
980
980
  function I(b) {
981
981
  return t(b) && e(b.length) && !!k[r(b)];
982
982
  }
@@ -993,8 +993,8 @@ function Lo() {
993
993
  }
994
994
  return li = r, li;
995
995
  }
996
- var Sr = { exports: {} };
997
- Sr.exports;
996
+ var Tr = { exports: {} };
997
+ Tr.exports;
998
998
  var Hl;
999
999
  function $o() {
1000
1000
  return Hl || (Hl = 1, (function(r, e) {
@@ -1006,7 +1006,7 @@ function $o() {
1006
1006
  }
1007
1007
  })();
1008
1008
  r.exports = o;
1009
- })(Sr, Sr.exports)), Sr.exports;
1009
+ })(Tr, Tr.exports)), Tr.exports;
1010
1010
  }
1011
1011
  var ui, Kl;
1012
1012
  function jo() {
@@ -1021,12 +1021,12 @@ function Ld() {
1021
1021
  Yl = 1;
1022
1022
  var r = ny(), e = Pd(), t = Dt(), n = Mn(), s = qo(), i = jo(), a = Object.prototype, o = a.hasOwnProperty;
1023
1023
  function c(l, u) {
1024
- var f = t(l), h = !f && e(l), d = !f && !h && n(l), m = !f && !h && !d && i(l), E = f || h || d || m, y = E ? r(l.length, String) : [], _ = y.length;
1024
+ var f = t(l), h = !f && e(l), d = !f && !h && n(l), p = !f && !h && !d && i(l), E = f || h || d || p, y = E ? r(l.length, String) : [], _ = y.length;
1025
1025
  for (var S in l)
1026
1026
  (u || o.call(l, S)) && !(E && // Safari 9 has enumerable `arguments.length` in strict mode.
1027
1027
  (S == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1028
1028
  d && (S == "offset" || S == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1029
- m && (S == "buffer" || S == "byteLength" || S == "byteOffset") || // Skip index properties.
1029
+ p && (S == "buffer" || S == "byteLength" || S == "byteOffset") || // Skip index properties.
1030
1030
  s(S, _))) && y.push(S);
1031
1031
  return y;
1032
1032
  }
@@ -1112,7 +1112,7 @@ function ly() {
1112
1112
  su = 1;
1113
1113
  var r = jd(), e = 1, t = Object.prototype, n = t.hasOwnProperty;
1114
1114
  function s(i, a, o, c, l, u) {
1115
- var f = o & e, h = r(i), d = h.length, m = r(a), E = m.length;
1115
+ var f = o & e, h = r(i), d = h.length, p = r(a), E = p.length;
1116
1116
  if (d != E && !f)
1117
1117
  return !1;
1118
1118
  for (var y = d; y--; ) {
@@ -1120,27 +1120,27 @@ function ly() {
1120
1120
  if (!(f ? _ in a : n.call(a, _)))
1121
1121
  return !1;
1122
1122
  }
1123
- var S = u.get(i), T = u.get(a);
1124
- if (S && T)
1125
- return S == a && T == i;
1126
- var P = !0;
1123
+ var S = u.get(i), A = u.get(a);
1124
+ if (S && A)
1125
+ return S == a && A == i;
1126
+ var F = !0;
1127
1127
  u.set(i, a), u.set(a, i);
1128
- for (var g = f; ++y < d; ) {
1128
+ for (var m = f; ++y < d; ) {
1129
1129
  _ = h[y];
1130
- var C = i[_], R = a[_];
1130
+ var T = i[_], R = a[_];
1131
1131
  if (c)
1132
- var v = f ? c(R, C, _, a, i, u) : c(C, R, _, i, a, u);
1133
- if (!(v === void 0 ? C === R || l(C, R, o, c, u) : v)) {
1134
- P = !1;
1132
+ var v = f ? c(R, T, _, a, i, u) : c(T, R, _, i, a, u);
1133
+ if (!(v === void 0 ? T === R || l(T, R, o, c, u) : v)) {
1134
+ F = !1;
1135
1135
  break;
1136
1136
  }
1137
- g || (g = _ == "constructor");
1137
+ m || (m = _ == "constructor");
1138
1138
  }
1139
- if (P && !g) {
1140
- var A = i.constructor, p = a.constructor;
1141
- A != p && "constructor" in i && "constructor" in a && !(typeof A == "function" && A instanceof A && typeof p == "function" && p instanceof p) && (P = !1);
1139
+ if (F && !m) {
1140
+ var C = i.constructor, g = a.constructor;
1141
+ C != g && "constructor" in i && "constructor" in a && !(typeof C == "function" && C instanceof C && typeof g == "function" && g instanceof g) && (F = !1);
1142
1142
  }
1143
- return u.delete(i), u.delete(a), P;
1143
+ return u.delete(i), u.delete(a), F;
1144
1144
  }
1145
1145
  return vi = s, vi;
1146
1146
  }
@@ -1148,42 +1148,42 @@ var wi, iu;
1148
1148
  function uy() {
1149
1149
  if (iu) return wi;
1150
1150
  iu = 1;
1151
- var r = Zt(), e = ct(), t = r(e, "DataView");
1151
+ var r = Zt(), e = lt(), t = r(e, "DataView");
1152
1152
  return wi = t, wi;
1153
1153
  }
1154
1154
  var bi, au;
1155
1155
  function fy() {
1156
1156
  if (au) return bi;
1157
1157
  au = 1;
1158
- var r = Zt(), e = ct(), t = r(e, "Promise");
1158
+ var r = Zt(), e = lt(), t = r(e, "Promise");
1159
1159
  return bi = t, bi;
1160
1160
  }
1161
1161
  var Oi, ou;
1162
1162
  function dy() {
1163
1163
  if (ou) return Oi;
1164
1164
  ou = 1;
1165
- var r = Zt(), e = ct(), t = r(e, "Set");
1165
+ var r = Zt(), e = lt(), t = r(e, "Set");
1166
1166
  return Oi = t, Oi;
1167
1167
  }
1168
1168
  var Ei, cu;
1169
1169
  function hy() {
1170
1170
  if (cu) return Ei;
1171
1171
  cu = 1;
1172
- var r = Zt(), e = ct(), t = r(e, "WeakMap");
1172
+ var r = Zt(), e = lt(), t = r(e, "WeakMap");
1173
1173
  return Ei = t, Ei;
1174
1174
  }
1175
1175
  var Si, lu;
1176
1176
  function qn() {
1177
1177
  if (lu) return Si;
1178
1178
  lu = 1;
1179
- var r = uy(), e = Fo(), t = fy(), n = dy(), s = hy(), i = hr(), a = Id(), o = "[object Map]", c = "[object Object]", l = "[object Promise]", u = "[object Set]", f = "[object WeakMap]", h = "[object DataView]", d = a(r), m = a(e), E = a(t), y = a(n), _ = a(s), S = i;
1180
- return (r && S(new r(new ArrayBuffer(1))) != h || e && S(new e()) != o || t && S(t.resolve()) != l || n && S(new n()) != u || s && S(new s()) != f) && (S = function(T) {
1181
- var P = i(T), g = P == c ? T.constructor : void 0, C = g ? a(g) : "";
1182
- if (C)
1183
- switch (C) {
1179
+ var r = uy(), e = Fo(), t = fy(), n = dy(), s = hy(), i = mr(), a = Id(), o = "[object Map]", c = "[object Object]", l = "[object Promise]", u = "[object Set]", f = "[object WeakMap]", h = "[object DataView]", d = a(r), p = a(e), E = a(t), y = a(n), _ = a(s), S = i;
1180
+ return (r && S(new r(new ArrayBuffer(1))) != h || e && S(new e()) != o || t && S(t.resolve()) != l || n && S(new n()) != u || s && S(new s()) != f) && (S = function(A) {
1181
+ var F = i(A), m = F == c ? A.constructor : void 0, T = m ? a(m) : "";
1182
+ if (T)
1183
+ switch (T) {
1184
1184
  case d:
1185
1185
  return h;
1186
- case m:
1186
+ case p:
1187
1187
  return o;
1188
1188
  case E:
1189
1189
  return l;
@@ -1192,7 +1192,7 @@ function qn() {
1192
1192
  case _:
1193
1193
  return f;
1194
1194
  }
1195
- return P;
1195
+ return F;
1196
1196
  }), Si = S, Si;
1197
1197
  }
1198
1198
  var Ti, uu;
@@ -1200,27 +1200,27 @@ function my() {
1200
1200
  if (uu) return Ti;
1201
1201
  uu = 1;
1202
1202
  var r = Mo(), e = xd(), t = ty(), n = ly(), s = qn(), i = Dt(), a = Mn(), o = jo(), c = 1, l = "[object Arguments]", u = "[object Array]", f = "[object Object]", h = Object.prototype, d = h.hasOwnProperty;
1203
- function m(E, y, _, S, T, P) {
1204
- var g = i(E), C = i(y), R = g ? u : s(E), v = C ? u : s(y);
1203
+ function p(E, y, _, S, A, F) {
1204
+ var m = i(E), T = i(y), R = m ? u : s(E), v = T ? u : s(y);
1205
1205
  R = R == l ? f : R, v = v == l ? f : v;
1206
- var A = R == f, p = v == f, k = R == v;
1206
+ var C = R == f, g = v == f, k = R == v;
1207
1207
  if (k && a(E)) {
1208
1208
  if (!a(y))
1209
1209
  return !1;
1210
- g = !0, A = !1;
1210
+ m = !0, C = !1;
1211
1211
  }
1212
- if (k && !A)
1213
- return P || (P = new r()), g || o(E) ? e(E, y, _, S, T, P) : t(E, y, R, _, S, T, P);
1212
+ if (k && !C)
1213
+ return F || (F = new r()), m || o(E) ? e(E, y, _, S, A, F) : t(E, y, R, _, S, A, F);
1214
1214
  if (!(_ & c)) {
1215
- var I = A && d.call(E, "__wrapped__"), b = p && d.call(y, "__wrapped__");
1215
+ var I = C && d.call(E, "__wrapped__"), b = g && d.call(y, "__wrapped__");
1216
1216
  if (I || b) {
1217
1217
  var w = I ? E.value() : E, O = b ? y.value() : y;
1218
- return P || (P = new r()), T(w, O, _, S, P);
1218
+ return F || (F = new r()), A(w, O, _, S, F);
1219
1219
  }
1220
1220
  }
1221
- return k ? (P || (P = new r()), n(E, y, _, S, T, P)) : !1;
1221
+ return k ? (F || (F = new r()), n(E, y, _, S, A, F)) : !1;
1222
1222
  }
1223
- return Ti = m, Ti;
1223
+ return Ti = p, Ti;
1224
1224
  }
1225
1225
  var Ri, fu;
1226
1226
  function py() {
@@ -1246,9 +1246,9 @@ var gy = yy();
1246
1246
  const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
1247
1247
  const { access: l } = e, { permissionWriteRestrictions: u } = l;
1248
1248
  let f = !0, h = "";
1249
- const d = u?.filter((m) => n === m.userRole);
1250
- return d?.length && !d.some((m) => m.recordRole === s) ? (h = `User ${n} does not have write access to record with role ${s}`, f = !1, f) : (u?.forEach((m) => {
1251
- n === m.userRole && m.recordRole;
1249
+ const d = u?.filter((p) => n === p.userRole);
1250
+ return d?.length && !d.some((p) => p.recordRole === s) ? (h = `User ${n} does not have write access to record with role ${s}`, f = !1, f) : (u?.forEach((p) => {
1251
+ n === p.userRole && p.recordRole;
1252
1252
  }), h && console.error(`PERMISSION_DENIED: ${h}`), f);
1253
1253
  }, wy = (r, e, t, n, s, i, a, o, c, l, u) => {
1254
1254
  const { labels: f } = n;
@@ -1267,23 +1267,23 @@ const _y = /* @__PURE__ */ In(gy), vy = (r, e, t, n, s, i, a, o, c) => {
1267
1267
  }
1268
1268
  if (!u)
1269
1269
  throw new Error("PERMISSION_DENIED");
1270
- }, sr = (r) => r && (r._methodName === "deleteField" || r.constructor.name === "DeleteTransform"), tr = (r) => {
1270
+ }, ir = (r) => r && (r._methodName === "deleteField" || r.constructor.name === "DeleteTransform"), tr = (r) => {
1271
1271
  for (const e in r)
1272
- Object.prototype.hasOwnProperty.call(r, e) && (sr(r[e]) ? delete r[e] : typeof r[e] == "object" && r[e] !== null && tr(r[e]));
1272
+ Object.prototype.hasOwnProperty.call(r, e) && (ir(r[e]) ? delete r[e] : typeof r[e] == "object" && r[e] !== null && tr(r[e]));
1273
1273
  }, Oy = (r, e, t, n, s, i, a, o, c, l) => {
1274
1274
  const { labels: u, fields: f } = n, h = a?.collections?.[u.collection], d = { ...e, ...r };
1275
1275
  tr(d);
1276
- let m = !0, E = "";
1276
+ let p = !0, E = "";
1277
1277
  if (i && !h)
1278
1278
  throw new Error("PERMISSION_DENIED");
1279
- i && !vt("Update", h) && (m = !1, E = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1279
+ i && !vt("Update", h) && (p = !1, E = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1280
1280
  (!dn("Update", n, s, i, a, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1281
- !dn("Update", n, s, i, a, d)) && (m = !1, E = "Authenticated user does not have Update access to this document");
1281
+ !dn("Update", n, s, i, a, d)) && (p = !1, E = "Authenticated user does not have Update access to this document");
1282
1282
  for (const y of f) {
1283
1283
  const _ = r[y.name];
1284
- y.access && !An(y, a) && _ !== void 0 && (E = `Authenticated user does not have access to field ${y.name}`, m = !1), _ !== void 0 && !_p(y, a) && (E = `Authenticated user does not have Update access to field ${y.name}`, m = !1);
1284
+ y.access && !An(y, a) && _ !== void 0 && (E = `Authenticated user does not have access to field ${y.name}`, p = !1), _ !== void 0 && !_p(y, a) && (E = `Authenticated user does not have Update access to field ${y.name}`, p = !1);
1285
1285
  }
1286
- if (!m)
1286
+ if (!p)
1287
1287
  throw E && console.error(`PERMISSION_DENIED: ${E}`), new Error("PERMISSION_DENIED");
1288
1288
  }, Ey = (r, e, t, n, s, i) => {
1289
1289
  const { labels: a } = t, o = i.collections?.[a.collection];
@@ -1389,12 +1389,12 @@ function Cy() {
1389
1389
  var r = Ry(), e = r();
1390
1390
  return Ni = e, Ni;
1391
1391
  }
1392
- var Tr = { exports: {} };
1393
- Tr.exports;
1392
+ var Rr = { exports: {} };
1393
+ Rr.exports;
1394
1394
  var _u;
1395
1395
  function zd() {
1396
1396
  return _u || (_u = 1, (function(r, e) {
1397
- var t = ct(), n = e && !e.nodeType && e, s = n && !0 && r && !r.nodeType && r, i = s && s.exports === n, a = i ? t.Buffer : void 0, o = a ? a.allocUnsafe : void 0;
1397
+ var t = lt(), n = e && !e.nodeType && e, s = n && !0 && r && !r.nodeType && r, i = s && s.exports === n, a = i ? t.Buffer : void 0, o = a ? a.allocUnsafe : void 0;
1398
1398
  function c(l, u) {
1399
1399
  if (u)
1400
1400
  return l.slice();
@@ -1402,7 +1402,7 @@ function zd() {
1402
1402
  return l.copy(h), h;
1403
1403
  }
1404
1404
  r.exports = c;
1405
- })(Tr, Tr.exports)), Tr.exports;
1405
+ })(Rr, Rr.exports)), Rr.exports;
1406
1406
  }
1407
1407
  var Fi, vu;
1408
1408
  function zo() {
@@ -1488,7 +1488,7 @@ var ji, Ru;
1488
1488
  function Iy() {
1489
1489
  if (Ru) return ji;
1490
1490
  Ru = 1;
1491
- var r = hr(), e = Bo(), t = bt(), n = "[object Object]", s = Function.prototype, i = Object.prototype, a = s.toString, o = i.hasOwnProperty, c = a.call(Object);
1491
+ var r = mr(), e = Bo(), t = bt(), n = "[object Object]", s = Function.prototype, i = Object.prototype, a = s.toString, o = i.hasOwnProperty, c = a.call(Object);
1492
1492
  function l(u) {
1493
1493
  if (!t(u) || r(u) != n)
1494
1494
  return !1;
@@ -1589,19 +1589,19 @@ var Hi, Du;
1589
1589
  function Dy() {
1590
1590
  if (Du) return Hi;
1591
1591
  Du = 1;
1592
- var r = Wd(), e = zd(), t = Bd(), n = Zd(), s = Gd(), i = Pd(), a = Dt(), o = ky(), c = Mn(), l = No(), u = wt(), f = Iy(), h = jo(), d = Hd(), m = Fy();
1593
- function E(y, _, S, T, P, g, C) {
1594
- var R = d(y, S), v = d(_, S), A = C.get(v);
1595
- if (A) {
1596
- r(y, S, A);
1592
+ var r = Wd(), e = zd(), t = Bd(), n = Zd(), s = Gd(), i = Pd(), a = Dt(), o = ky(), c = Mn(), l = No(), u = wt(), f = Iy(), h = jo(), d = Hd(), p = Fy();
1593
+ function E(y, _, S, A, F, m, T) {
1594
+ var R = d(y, S), v = d(_, S), C = T.get(v);
1595
+ if (C) {
1596
+ r(y, S, C);
1597
1597
  return;
1598
1598
  }
1599
- var p = g ? g(R, v, S + "", y, _, C) : void 0, k = p === void 0;
1599
+ var g = m ? m(R, v, S + "", y, _, T) : void 0, k = g === void 0;
1600
1600
  if (k) {
1601
1601
  var I = a(v), b = !I && c(v), w = !I && !b && h(v);
1602
- p = v, I || b || w ? a(R) ? p = R : o(R) ? p = n(R) : b ? (k = !1, p = e(v, !0)) : w ? (k = !1, p = t(v, !0)) : p = [] : f(v) || i(v) ? (p = R, i(R) ? p = m(R) : (!u(R) || l(R)) && (p = s(v))) : k = !1;
1602
+ g = v, I || b || w ? a(R) ? g = R : o(R) ? g = n(R) : b ? (k = !1, g = e(v, !0)) : w ? (k = !1, g = t(v, !0)) : g = [] : f(v) || i(v) ? (g = R, i(R) ? g = p(R) : (!u(R) || l(R)) && (g = s(v))) : k = !1;
1603
1603
  }
1604
- k && (C.set(v, p), P(p, v, T, g, C), C.delete(v)), r(y, S, p);
1604
+ k && (T.set(v, g), F(g, v, A, m, T), T.delete(v)), r(y, S, g);
1605
1605
  }
1606
1606
  return Hi = E, Hi;
1607
1607
  }
@@ -1611,12 +1611,12 @@ function My() {
1611
1611
  Mu = 1;
1612
1612
  var r = Mo(), e = Wd(), t = Cy(), n = Dy(), s = wt(), i = Br(), a = Hd();
1613
1613
  function o(c, l, u, f, h) {
1614
- c !== l && t(l, function(d, m) {
1614
+ c !== l && t(l, function(d, p) {
1615
1615
  if (h || (h = new r()), s(d))
1616
- n(c, l, m, u, o, f, h);
1616
+ n(c, l, p, u, o, f, h);
1617
1617
  else {
1618
- var E = f ? f(a(c, m), d, m + "", c, l, h) : void 0;
1619
- E === void 0 && (E = d), e(c, m, E);
1618
+ var E = f ? f(a(c, p), d, p + "", c, l, h) : void 0;
1619
+ E === void 0 && (E = d), e(c, p, E);
1620
1620
  }
1621
1621
  }, i);
1622
1622
  }
@@ -1773,7 +1773,7 @@ var oa, Gu;
1773
1773
  function Go() {
1774
1774
  if (Gu) return oa;
1775
1775
  Gu = 1;
1776
- var r = hr(), e = bt(), t = "[object Symbol]";
1776
+ var r = mr(), e = bt(), t = "[object Symbol]";
1777
1777
  function n(s) {
1778
1778
  return typeof s == "symbol" || e(s) && r(s) == t;
1779
1779
  }
@@ -1907,14 +1907,14 @@ function ng() {
1907
1907
  return a;
1908
1908
  o = e(o, a);
1909
1909
  for (var u = -1, f = o.length, h = f - 1, d = a; d != null && ++u < f; ) {
1910
- var m = s(o[u]), E = c;
1911
- if (m === "__proto__" || m === "constructor" || m === "prototype")
1910
+ var p = s(o[u]), E = c;
1911
+ if (p === "__proto__" || p === "constructor" || p === "prototype")
1912
1912
  return a;
1913
1913
  if (u != h) {
1914
- var y = d[m];
1915
- E = l ? l(y, m, d) : void 0, E === void 0 && (E = n(y) ? y : t(o[u + 1]) ? [] : {});
1914
+ var y = d[p];
1915
+ E = l ? l(y, p, d) : void 0, E === void 0 && (E = n(y) ? y : t(o[u + 1]) ? [] : {});
1916
1916
  }
1917
- r(d, m, E), d = d[m];
1917
+ r(d, p, E), d = d[p];
1918
1918
  }
1919
1919
  return a;
1920
1920
  }
@@ -1931,11 +1931,11 @@ function sg() {
1931
1931
  return _a = e, _a;
1932
1932
  }
1933
1933
  var ig = sg();
1934
- const ag = /* @__PURE__ */ In(ig), Fr = {
1934
+ const ag = /* @__PURE__ */ In(ig), Dr = {
1935
1935
  global: {},
1936
1936
  collections: {}
1937
1937
  }, og = () => {
1938
- Fr.global = {}, Fr.collections = {};
1938
+ Dr.global = {}, Dr.collections = {};
1939
1939
  }, ve = async (r, e) => {
1940
1940
  let t = r;
1941
1941
  return r && (typeof r == "function" || typeof r.then == "function") && (e ? t = await r(...e) : t = await r()), t;
@@ -1943,7 +1943,7 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
1943
1943
  for (const u of e)
1944
1944
  if (u === "__proto__" || u === "constructor" || u === "prototype")
1945
1945
  throw new Error("Invalid config path: prototype pollution keys are not allowed");
1946
- let s = Fr, i = !0;
1946
+ let s = Dr, i = !0;
1947
1947
  for (const u of e) {
1948
1948
  if (u === void 0 || s[u] === void 0) {
1949
1949
  i = !1;
@@ -1964,7 +1964,7 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
1964
1964
  }
1965
1965
  let l;
1966
1966
  if (c && (l = await ve(o, t)), l) {
1967
- let u = Fr;
1967
+ let u = Dr;
1968
1968
  const f = {};
1969
1969
  for (let h = 0; h < e.length; h++) {
1970
1970
  const d = e[h];
@@ -1974,7 +1974,7 @@ const ag = /* @__PURE__ */ In(ig), Fr = {
1974
1974
  h === e.length - 1 ? ag(f, e.join("."), l) : (u[d] ||= {}, u = u[d]);
1975
1975
  }
1976
1976
  }
1977
- Gy(Fr, f);
1977
+ Gy(Dr, f);
1978
1978
  }
1979
1979
  return l;
1980
1980
  }, cg = (r, e, t) => {
@@ -2179,7 +2179,7 @@ const Ko = (r, e, t, n, s, i, a, o, c, l) => (r == "create" && (t.Collection_Pat
2179
2179
  n.forEach((i) => {
2180
2180
  if (_e(i))
2181
2181
  if (e[i.name]) {
2182
- if (sr(e[i.name]))
2182
+ if (ir(e[i.name]))
2183
2183
  e[`${i.name}_Array`] = e[i.name];
2184
2184
  else if (e[`${i.name}_Array`] = Object.keys(e[i.name]), i.includeFields)
2185
2185
  for (const a of i.includeFields) {
@@ -2192,13 +2192,13 @@ const Ko = (r, e, t, n, s, i, a, o, c, l) => (r == "create" && (t.Collection_Pat
2192
2192
  delete e[`${i.name}_Array`], delete e[`${i.name}_Single`];
2193
2193
  }), Qd(r, n).forEach((i) => {
2194
2194
  if (e[i.name])
2195
- if (sr(e[i.name]))
2195
+ if (ir(e[i.name]))
2196
2196
  e[`${i.name}_Single`] = e[i.name];
2197
2197
  else {
2198
2198
  const a = e[`${i.name}_Array`]?.[0];
2199
2199
  if (a) {
2200
2200
  const o = e[i.name][a] || {};
2201
- e[`${i.name}_Single`] = { ...o };
2201
+ e[`${i.name}_Single`] = { id: a, ...o };
2202
2202
  }
2203
2203
  }
2204
2204
  });
@@ -2526,12 +2526,12 @@ class qe {
2526
2526
  }
2527
2527
  const X = Object.freeze({
2528
2528
  status: "aborted"
2529
- }), Rr = (r) => ({ status: "dirty", value: r }), Qe = (r) => ({ status: "valid", value: r }), of = (r) => r.status === "aborted", cf = (r) => r.status === "dirty", ir = (r) => r.status === "valid", hn = (r) => typeof Promise < "u" && r instanceof Promise;
2529
+ }), Cr = (r) => ({ status: "dirty", value: r }), Qe = (r) => ({ status: "valid", value: r }), of = (r) => r.status === "aborted", cf = (r) => r.status === "dirty", ar = (r) => r.status === "valid", hn = (r) => typeof Promise < "u" && r instanceof Promise;
2530
2530
  var W;
2531
2531
  (function(r) {
2532
2532
  r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
2533
2533
  })(W || (W = {}));
2534
- class ot {
2534
+ class ct {
2535
2535
  constructor(e, t, n, s) {
2536
2536
  this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
2537
2537
  }
@@ -2540,7 +2540,7 @@ class ot {
2540
2540
  }
2541
2541
  }
2542
2542
  const lf = (r, e) => {
2543
- if (ir(e))
2543
+ if (ar(e))
2544
2544
  return { success: !0, data: e.value };
2545
2545
  if (!r.common.issues.length)
2546
2546
  throw new Error("Validation failed but no issues detected.");
@@ -2641,7 +2641,7 @@ class le {
2641
2641
  if (!this["~standard"].async)
2642
2642
  try {
2643
2643
  const n = this._parseSync({ data: e, path: [], parent: t });
2644
- return ir(n) ? {
2644
+ return ar(n) ? {
2645
2645
  value: n.value
2646
2646
  } : {
2647
2647
  issues: t.common.issues
@@ -2652,7 +2652,7 @@ class le {
2652
2652
  async: !0
2653
2653
  };
2654
2654
  }
2655
- return this._parseAsync({ data: e, path: [], parent: t }).then((n) => ir(n) ? {
2655
+ return this._parseAsync({ data: e, path: [], parent: t }).then((n) => ar(n) ? {
2656
2656
  value: n.value
2657
2657
  } : {
2658
2658
  issues: t.common.issues
@@ -2693,7 +2693,7 @@ class le {
2693
2693
  return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
2694
2694
  }
2695
2695
  _refinement(e) {
2696
- return new cr({
2696
+ return new lr({
2697
2697
  schema: this,
2698
2698
  typeName: Q.ZodEffects,
2699
2699
  effect: { type: "refinement", refinement: e }
@@ -2713,13 +2713,13 @@ class le {
2713
2713
  return It.create(this, this._def);
2714
2714
  }
2715
2715
  nullable() {
2716
- return lr.create(this, this._def);
2716
+ return ur.create(this, this._def);
2717
2717
  }
2718
2718
  nullish() {
2719
2719
  return this.nullable().optional();
2720
2720
  }
2721
2721
  array() {
2722
- return at.create(this);
2722
+ return ot.create(this);
2723
2723
  }
2724
2724
  promise() {
2725
2725
  return _n.create(this, this._def);
@@ -2731,7 +2731,7 @@ class le {
2731
2731
  return yn.create(this, e, this._def);
2732
2732
  }
2733
2733
  transform(e) {
2734
- return new cr({
2734
+ return new lr({
2735
2735
  ...ae(this._def),
2736
2736
  schema: this,
2737
2737
  typeName: Q.ZodEffects,
@@ -3206,7 +3206,7 @@ function Lg(r, e) {
3206
3206
  const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, i = Number.parseInt(r.toFixed(s).replace(".", "")), a = Number.parseInt(e.toFixed(s).replace(".", ""));
3207
3207
  return i % a / 10 ** s;
3208
3208
  }
3209
- class ar extends le {
3209
+ class or extends le {
3210
3210
  constructor() {
3211
3211
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
3212
3212
  }
@@ -3264,7 +3264,7 @@ class ar extends le {
3264
3264
  return this.setLimit("max", e, !1, W.toString(t));
3265
3265
  }
3266
3266
  setLimit(e, t, n, s) {
3267
- return new ar({
3267
+ return new or({
3268
3268
  ...this._def,
3269
3269
  checks: [
3270
3270
  ...this._def.checks,
@@ -3278,7 +3278,7 @@ class ar extends le {
3278
3278
  });
3279
3279
  }
3280
3280
  _addCheck(e) {
3281
- return new ar({
3281
+ return new or({
3282
3282
  ...this._def,
3283
3283
  checks: [...this._def.checks, e]
3284
3284
  });
@@ -3372,7 +3372,7 @@ class ar extends le {
3372
3372
  return Number.isFinite(t) && Number.isFinite(e);
3373
3373
  }
3374
3374
  }
3375
- ar.create = (r) => new ar({
3375
+ or.create = (r) => new or({
3376
3376
  checks: [],
3377
3377
  typeName: Q.ZodNumber,
3378
3378
  coerce: r?.coerce || !1,
@@ -3713,7 +3713,7 @@ mf.create = (r) => new mf({
3713
3713
  typeName: Q.ZodVoid,
3714
3714
  ...ae(r)
3715
3715
  });
3716
- class at extends le {
3716
+ class ot extends le {
3717
3717
  _parse(e) {
3718
3718
  const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
3719
3719
  if (t.parsedType !== V.array)
@@ -3749,27 +3749,27 @@ class at extends le {
3749
3749
  exact: !1,
3750
3750
  message: s.maxLength.message
3751
3751
  }), n.dirty()), t.common.async)
3752
- return Promise.all([...t.data].map((a, o) => s.type._parseAsync(new ot(t, a, t.path, o)))).then((a) => qe.mergeArray(n, a));
3753
- const i = [...t.data].map((a, o) => s.type._parseSync(new ot(t, a, t.path, o)));
3752
+ return Promise.all([...t.data].map((a, o) => s.type._parseAsync(new ct(t, a, t.path, o)))).then((a) => qe.mergeArray(n, a));
3753
+ const i = [...t.data].map((a, o) => s.type._parseSync(new ct(t, a, t.path, o)));
3754
3754
  return qe.mergeArray(n, i);
3755
3755
  }
3756
3756
  get element() {
3757
3757
  return this._def.type;
3758
3758
  }
3759
3759
  min(e, t) {
3760
- return new at({
3760
+ return new ot({
3761
3761
  ...this._def,
3762
3762
  minLength: { value: e, message: W.toString(t) }
3763
3763
  });
3764
3764
  }
3765
3765
  max(e, t) {
3766
- return new at({
3766
+ return new ot({
3767
3767
  ...this._def,
3768
3768
  maxLength: { value: e, message: W.toString(t) }
3769
3769
  });
3770
3770
  }
3771
3771
  length(e, t) {
3772
- return new at({
3772
+ return new ot({
3773
3773
  ...this._def,
3774
3774
  exactLength: { value: e, message: W.toString(t) }
3775
3775
  });
@@ -3778,7 +3778,7 @@ class at extends le {
3778
3778
  return this.min(1, e);
3779
3779
  }
3780
3780
  }
3781
- at.create = (r, e) => new at({
3781
+ ot.create = (r, e) => new ot({
3782
3782
  type: r,
3783
3783
  minLength: null,
3784
3784
  maxLength: null,
@@ -3797,10 +3797,10 @@ function Qt(r) {
3797
3797
  ...r._def,
3798
3798
  shape: () => e
3799
3799
  });
3800
- } else return r instanceof at ? new at({
3800
+ } else return r instanceof ot ? new ot({
3801
3801
  ...r._def,
3802
3802
  type: Qt(r.element)
3803
- }) : r instanceof It ? It.create(Qt(r.unwrap())) : r instanceof lr ? lr.create(Qt(r.unwrap())) : r instanceof Wt ? Wt.create(r.items.map((e) => Qt(e))) : r;
3803
+ }) : r instanceof It ? It.create(Qt(r.unwrap())) : r instanceof ur ? ur.create(Qt(r.unwrap())) : r instanceof Wt ? Wt.create(r.items.map((e) => Qt(e))) : r;
3804
3804
  }
3805
3805
  class Ce extends le {
3806
3806
  constructor() {
@@ -3830,7 +3830,7 @@ class Ce extends le {
3830
3830
  const u = i[l], f = s.data[l];
3831
3831
  c.push({
3832
3832
  key: { status: "valid", value: l },
3833
- value: u._parse(new ot(s, f, s.path, l)),
3833
+ value: u._parse(new ct(s, f, s.path, l)),
3834
3834
  alwaysSet: l in s.data
3835
3835
  });
3836
3836
  }
@@ -3855,7 +3855,7 @@ class Ce extends le {
3855
3855
  c.push({
3856
3856
  key: { status: "valid", value: u },
3857
3857
  value: l._parse(
3858
- new ot(s, f, s.path, u)
3858
+ new ct(s, f, s.path, u)
3859
3859
  //, ctx.child(key), value, getParsedType(value)
3860
3860
  ),
3861
3861
  alwaysSet: u in s.data
@@ -4252,7 +4252,7 @@ class Wt extends le {
4252
4252
  }), t.dirty());
4253
4253
  const i = [...n.data].map((a, o) => {
4254
4254
  const c = this._def.items[o] || this._def.rest;
4255
- return c ? c._parse(new ot(n, a, n.path, o)) : null;
4255
+ return c ? c._parse(new ct(n, a, n.path, o)) : null;
4256
4256
  }).filter((a) => !!a);
4257
4257
  return n.common.async ? Promise.all(i).then((a) => qe.mergeArray(t, a)) : qe.mergeArray(t, i);
4258
4258
  }
@@ -4294,8 +4294,8 @@ class gn extends le {
4294
4294
  const s = [], i = this._def.keyType, a = this._def.valueType;
4295
4295
  for (const o in n.data)
4296
4296
  s.push({
4297
- key: i._parse(new ot(n, o, n.path, o)),
4298
- value: a._parse(new ot(n, n.data[o], n.path, o)),
4297
+ key: i._parse(new ct(n, o, n.path, o)),
4298
+ value: a._parse(new ct(n, n.data[o], n.path, o)),
4299
4299
  alwaysSet: o in n.data
4300
4300
  });
4301
4301
  return n.common.async ? qe.mergeObjectAsync(t, s) : qe.mergeObjectSync(t, s);
@@ -4333,8 +4333,8 @@ class pf extends le {
4333
4333
  received: n.parsedType
4334
4334
  }), X;
4335
4335
  const s = this._def.keyType, i = this._def.valueType, a = [...n.data.entries()].map(([o, c], l) => ({
4336
- key: s._parse(new ot(n, o, n.path, [l, "key"])),
4337
- value: i._parse(new ot(n, c, n.path, [l, "value"]))
4336
+ key: s._parse(new ct(n, o, n.path, [l, "key"])),
4337
+ value: i._parse(new ct(n, c, n.path, [l, "value"]))
4338
4338
  }));
4339
4339
  if (n.common.async) {
4340
4340
  const o = /* @__PURE__ */ new Map();
@@ -4400,7 +4400,7 @@ class jr extends le {
4400
4400
  }
4401
4401
  return { status: t.value, value: l };
4402
4402
  }
4403
- const o = [...n.data.values()].map((c, l) => i._parse(new ot(n, c, n.path, l)));
4403
+ const o = [...n.data.values()].map((c, l) => i._parse(new ct(n, c, n.path, l)));
4404
4404
  return n.common.async ? Promise.all(o).then((c) => a(c)) : a(o);
4405
4405
  }
4406
4406
  min(e, t) {
@@ -4465,13 +4465,13 @@ ao.create = (r, e) => new ao({
4465
4465
  ...ae(e)
4466
4466
  });
4467
4467
  function nh(r, e) {
4468
- return new or({
4468
+ return new cr({
4469
4469
  values: r,
4470
4470
  typeName: Q.ZodEnum,
4471
4471
  ...ae(e)
4472
4472
  });
4473
4473
  }
4474
- class or extends le {
4474
+ class cr extends le {
4475
4475
  _parse(e) {
4476
4476
  if (typeof e.data != "string") {
4477
4477
  const t = this._getOrReturnCtx(e), n = this._def.values;
@@ -4513,19 +4513,19 @@ class or extends le {
4513
4513
  return e;
4514
4514
  }
4515
4515
  extract(e, t = this._def) {
4516
- return or.create(e, {
4516
+ return cr.create(e, {
4517
4517
  ...this._def,
4518
4518
  ...t
4519
4519
  });
4520
4520
  }
4521
4521
  exclude(e, t = this._def) {
4522
- return or.create(this.options.filter((n) => !e.includes(n)), {
4522
+ return cr.create(this.options.filter((n) => !e.includes(n)), {
4523
4523
  ...this._def,
4524
4524
  ...t
4525
4525
  });
4526
4526
  }
4527
4527
  }
4528
- or.create = nh;
4528
+ cr.create = nh;
4529
4529
  class gf extends le {
4530
4530
  _parse(e) {
4531
4531
  const t = fe.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
@@ -4580,7 +4580,7 @@ _n.create = (r, e) => new _n({
4580
4580
  typeName: Q.ZodPromise,
4581
4581
  ...ae(e)
4582
4582
  });
4583
- class cr extends le {
4583
+ class lr extends le {
4584
4584
  innerType() {
4585
4585
  return this._def.schema;
4586
4586
  }
@@ -4607,7 +4607,7 @@ class cr extends le {
4607
4607
  path: n.path,
4608
4608
  parent: n
4609
4609
  });
4610
- return c.status === "aborted" ? X : c.status === "dirty" || t.value === "dirty" ? Rr(c.value) : c;
4610
+ return c.status === "aborted" ? X : c.status === "dirty" || t.value === "dirty" ? Cr(c.value) : c;
4611
4611
  });
4612
4612
  {
4613
4613
  if (t.value === "aborted")
@@ -4617,7 +4617,7 @@ class cr extends le {
4617
4617
  path: n.path,
4618
4618
  parent: n
4619
4619
  });
4620
- return o.status === "aborted" ? X : o.status === "dirty" || t.value === "dirty" ? Rr(o.value) : o;
4620
+ return o.status === "aborted" ? X : o.status === "dirty" || t.value === "dirty" ? Cr(o.value) : o;
4621
4621
  }
4622
4622
  }
4623
4623
  if (s.type === "refinement") {
@@ -4646,27 +4646,27 @@ class cr extends le {
4646
4646
  path: n.path,
4647
4647
  parent: n
4648
4648
  });
4649
- if (!ir(a))
4649
+ if (!ar(a))
4650
4650
  return X;
4651
4651
  const o = s.transform(a.value, i);
4652
4652
  if (o instanceof Promise)
4653
4653
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
4654
4654
  return { status: t.value, value: o };
4655
4655
  } else
4656
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ir(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({
4656
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ar(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({
4657
4657
  status: t.value,
4658
4658
  value: o
4659
4659
  })) : X);
4660
4660
  fe.assertNever(s);
4661
4661
  }
4662
4662
  }
4663
- cr.create = (r, e, t) => new cr({
4663
+ lr.create = (r, e, t) => new lr({
4664
4664
  schema: r,
4665
4665
  typeName: Q.ZodEffects,
4666
4666
  effect: e,
4667
4667
  ...ae(t)
4668
4668
  });
4669
- cr.createWithPreprocess = (r, e, t) => new cr({
4669
+ lr.createWithPreprocess = (r, e, t) => new lr({
4670
4670
  schema: e,
4671
4671
  effect: { type: "preprocess", transform: r },
4672
4672
  typeName: Q.ZodEffects,
@@ -4685,7 +4685,7 @@ It.create = (r, e) => new It({
4685
4685
  typeName: Q.ZodOptional,
4686
4686
  ...ae(e)
4687
4687
  });
4688
- class lr extends le {
4688
+ class ur extends le {
4689
4689
  _parse(e) {
4690
4690
  return this._getType(e) === V.null ? Qe(null) : this._def.innerType._parse(e);
4691
4691
  }
@@ -4693,7 +4693,7 @@ class lr extends le {
4693
4693
  return this._def.innerType;
4694
4694
  }
4695
4695
  }
4696
- lr.create = (r, e) => new lr({
4696
+ ur.create = (r, e) => new ur({
4697
4697
  innerType: r,
4698
4698
  typeName: Q.ZodNullable,
4699
4699
  ...ae(e)
@@ -4801,7 +4801,7 @@ class Yo extends le {
4801
4801
  path: n.path,
4802
4802
  parent: n
4803
4803
  });
4804
- return i.status === "aborted" ? X : i.status === "dirty" ? (t.dirty(), Rr(i.value)) : this._def.out._parseAsync({
4804
+ return i.status === "aborted" ? X : i.status === "dirty" ? (t.dirty(), Cr(i.value)) : this._def.out._parseAsync({
4805
4805
  data: i.value,
4806
4806
  path: n.path,
4807
4807
  parent: n
@@ -4833,7 +4833,7 @@ class Yo extends le {
4833
4833
  }
4834
4834
  class lo extends le {
4835
4835
  _parse(e) {
4836
- const t = this._def.innerType._parse(e), n = (s) => (ir(s) && (s.value = Object.freeze(s.value)), s);
4836
+ const t = this._def.innerType._parse(e), n = (s) => (ar(s) && (s.value = Object.freeze(s.value)), s);
4837
4837
  return hn(t) ? t.then((s) => n(s)) : n(t);
4838
4838
  }
4839
4839
  unwrap() {
@@ -4849,48 +4849,49 @@ var Q;
4849
4849
  (function(r) {
4850
4850
  r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
4851
4851
  })(Q || (Q = {}));
4852
- const pt = yt.create, uo = ar.create, jg = no.create, Ut = so.create;
4852
+ const at = yt.create, uo = or.create, jg = no.create, Ut = so.create;
4853
4853
  Ft.create;
4854
- const Ln = at.create, sh = Ce.create, vn = pn.create;
4854
+ const Ln = ot.create, sh = Ce.create, vn = pn.create;
4855
4855
  yn.create;
4856
4856
  Wt.create;
4857
- const Jo = gn.create, fo = ao.create, ho = or.create;
4857
+ const Jo = gn.create, fo = ao.create, ho = cr.create;
4858
4858
  _n.create;
4859
4859
  It.create;
4860
- lr.create;
4860
+ ur.create;
4861
4861
  const on = () => Ut().refine((r) => r && (r.seconds !== void 0 && r.nanoseconds !== void 0 || r._seconds !== void 0 && r._nanoseconds !== void 0), {
4862
4862
  message: "Value is not a valid timestamp"
4863
4863
  }), vf = () => Ut().refine((r) => r && (r._methodName === "serverTimestamp" || r.constructor.name === "ServerTimestampTransform"), {
4864
4864
  message: "Value is not a valid server timestamp"
4865
- }), ih = (r, e) => {
4866
- const t = {};
4865
+ }), ih = (r, e, t) => {
4866
+ const n = {};
4867
4867
  if (r.includeFields) {
4868
- const n = e.collections[r.collection];
4869
- if (!n)
4868
+ const i = e.collections[r.collection];
4869
+ if (!i)
4870
4870
  return Jo(Ut());
4871
- r.includeFields.forEach((s) => {
4872
- const i = n.fields.find((o) => o.name === s);
4873
- if (!i)
4874
- throw new Error(`Field ${s} not found in collection ${r.collection}`);
4875
- t[s] = wn(n, i), Zr(n, [i]).size === 1 && (t[`${s}_Lowercase`] = wn(n, i, !0));
4871
+ r.includeFields.forEach((a) => {
4872
+ const o = i.fields.find((l) => l.name === a);
4873
+ if (!o)
4874
+ throw new Error(`Field ${a} not found in collection ${r.collection}`);
4875
+ n[a] = wn(i, o), Zr(i, [o]).size === 1 && (n[`${a}_Lowercase`] = wn(i, o, !0));
4876
4876
  });
4877
4877
  }
4878
- return sh({
4879
- Collection_Path: Ln(pt()),
4880
- ...t
4881
- });
4878
+ const s = {
4879
+ Collection_Path: Ln(at()),
4880
+ ...n
4881
+ };
4882
+ return t && (s.id = at().length(20)), sh(s);
4882
4883
  }, Ug = (r, e) => {
4883
4884
  let t = Jo(ih(r, e));
4884
4885
  return r.required || (t = t.optional()), t;
4885
4886
  }, Vg = (r) => {
4886
- let e = Ln(vn([pt().length(20), pt().length(28)]));
4887
+ let e = Ln(vn([at().length(20), at().length(28)]));
4887
4888
  return ["OneToOne", "OneToMany"].includes(r.type) ? e = e.max(1) : (r.min && (e = e.min(r.min)), r.max && (e = e.max(r.max)), r.length && (e = e.length(r.length))), r.required ? e = e.nonempty() : e = e.optional(), e;
4888
4889
  }, wn = (r, e, t) => {
4889
4890
  const { softDelete: n } = r, s = n?.timestampField;
4890
4891
  let i;
4891
4892
  switch (e.type) {
4892
4893
  case "String":
4893
- if (i = pt(), e.length && (i = i.length(e.length)), e.minlength && (i = i.min(e.minlength)), e.maxlength && (i = i.max(e.maxlength)), e.email && (i = i.email()), e.uuid && (i = i.uuid()), e.url && (i = i.url()), e.emoji && (i = i.emoji()), e.ip && (i = i.ip()), e.pattern && (i = i.regex(new RegExp(e.pattern))), t && (i = i.toLowerCase()), e.values)
4894
+ if (i = at(), e.length && (i = i.length(e.length)), e.minlength && (i = i.min(e.minlength)), e.maxlength && (i = i.max(e.maxlength)), e.email && (i = i.email()), e.uuid && (i = i.uuid()), e.url && (i = i.url()), e.emoji && (i = i.emoji()), e.ip && (i = i.ip()), e.pattern && (i = i.regex(new RegExp(e.pattern))), t && (i = i.toLowerCase()), e.values)
4894
4895
  if (t) {
4895
4896
  const a = e.values.map((o) => o.toLowerCase());
4896
4897
  i = ho(a);
@@ -4936,21 +4937,21 @@ const on = () => Ut().refine((r) => r && (r.seconds !== void 0 && r.nanoseconds
4936
4937
  return !_e(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
4937
4938
  }, Wg = (r, e, t) => {
4938
4939
  const n = {
4939
- Collection_Path: Ln(pt()),
4940
- Last_Write_App: pt(),
4940
+ Collection_Path: Ln(at()),
4941
+ Last_Write_App: at(),
4941
4942
  Last_Write_At: on(),
4942
4943
  Last_Save_At: vf(),
4943
- Last_Write_By: vn([pt().length(28), fo("System")]),
4944
+ Last_Write_By: vn([at().length(28), fo("System")]),
4944
4945
  Last_Write_Connection_Status: ho(["Online", "Offline"]),
4945
4946
  Last_Write_Version: uo().int(),
4946
- id: pt().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
4947
+ id: at().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
4947
4948
  Created_At: on(),
4948
- Created_By: vn([pt().length(28), fo("System")])
4949
+ Created_By: vn([at().length(28), fo("System")])
4949
4950
  };
4950
4951
  r === "create" && (n.Saved_At = vf()), r === "update" && (n.Saved_At = on(), n.Collection_Path = n.Collection_Path.optional(), n.id = n.id.optional(), n.Created_At = n.Created_At.optional(), n.Saved_At = n.Saved_At.optional(), n.Created_By = n.Created_By.optional());
4951
4952
  const s = Qd(e, e.fields), i = Array.from(s).map((c) => c.name);
4952
4953
  e.fields.forEach((c) => {
4953
- _e(c) ? (n[c.name] = Ug(c, t), n[`${c.name}_Array`] = Vg(c), i.includes(c.name) && (n[`${c.name}_Single`] = ih(c, t), c.required || (n[`${c.name}_Single`] = n[`${c.name}_Single`].optional())), c.length && (n[c.name] = n[c.name].refine((l) => c.length && l && Object.keys(l).length === c.length, {
4954
+ _e(c) ? (n[c.name] = Ug(c, t), n[`${c.name}_Array`] = Vg(c), i.includes(c.name) && (n[`${c.name}_Single`] = ih(c, t, !0), c.required || (n[`${c.name}_Single`] = n[`${c.name}_Single`].optional())), c.length && (n[c.name] = n[c.name].refine((l) => c.length && l && Object.keys(l).length === c.length, {
4954
4955
  message: `Value must contain ${c.length} item(s)`
4955
4956
  })), c.min && (n[c.name] = n[c.name].refine((l) => c.min && l && Object.keys(l).length >= c.min, {
4956
4957
  message: `Value must contain at least ${c.min} item(s)`
@@ -5231,7 +5232,7 @@ class $n extends Gr {
5231
5232
  }
5232
5233
  /** @override **/
5233
5234
  formatOffset(e, t) {
5234
- return Dr(this.offset(e), t);
5235
+ return Mr(this.offset(e), t);
5235
5236
  }
5236
5237
  /** @override **/
5237
5238
  offset(e) {
@@ -5376,7 +5377,7 @@ class _t extends Gr {
5376
5377
  * @return {string}
5377
5378
  */
5378
5379
  formatOffset(e, t) {
5379
- return Dr(this.offset(e), t);
5380
+ return Mr(this.offset(e), t);
5380
5381
  }
5381
5382
  /**
5382
5383
  * Return the offset in minutes for this zone at the specified timestamp.
@@ -5401,8 +5402,8 @@ class _t extends Gr {
5401
5402
  millisecond: 0
5402
5403
  });
5403
5404
  let d = +t;
5404
- const m = d % 1e3;
5405
- return d -= m >= 0 ? m : 1e3 + m, (h - d) / (60 * 1e3);
5405
+ const p = d % 1e3;
5406
+ return d -= p >= 0 ? p : 1e3 + p, (h - d) / (60 * 1e3);
5406
5407
  }
5407
5408
  /**
5408
5409
  * Return whether this Zone is equal to another zone
@@ -5446,9 +5447,9 @@ function t_(r, e = {}) {
5446
5447
  let i = _o.get(s);
5447
5448
  return i === void 0 && (i = new Intl.RelativeTimeFormat(r, e), _o.set(s, i)), i;
5448
5449
  }
5449
- let Cr = null;
5450
+ let Ar = null;
5450
5451
  function r_() {
5451
- return Cr || (Cr = new Intl.DateTimeFormat().resolvedOptions().locale, Cr);
5452
+ return Ar || (Ar = new Intl.DateTimeFormat().resolvedOptions().locale, Ar);
5452
5453
  }
5453
5454
  const vo = /* @__PURE__ */ new Map();
5454
5455
  function Rh(r) {
@@ -5579,9 +5580,9 @@ const Ch = {
5579
5580
  minimalDays: 4,
5580
5581
  weekend: [6, 7]
5581
5582
  };
5582
- class he {
5583
+ class me {
5583
5584
  static fromOpts(e) {
5584
- return he.create(
5585
+ return me.create(
5585
5586
  e.locale,
5586
5587
  e.numberingSystem,
5587
5588
  e.outputCalendar,
@@ -5591,13 +5592,13 @@ class he {
5591
5592
  }
5592
5593
  static create(e, t, n, s, i = !1) {
5593
5594
  const a = e || Ee.defaultLocale, o = a || (i ? "en-US" : r_()), c = t || Ee.defaultNumberingSystem, l = n || Ee.defaultOutputCalendar, u = Oo(s) || Ee.defaultWeekSettings;
5594
- return new he(o, c, l, u, a);
5595
+ return new me(o, c, l, u, a);
5595
5596
  }
5596
5597
  static resetCache() {
5597
- Cr = null, po.clear(), go.clear(), _o.clear(), vo.clear(), wo.clear();
5598
+ Ar = null, po.clear(), go.clear(), _o.clear(), vo.clear(), wo.clear();
5598
5599
  }
5599
5600
  static fromObject({ locale: e, numberingSystem: t, outputCalendar: n, weekSettings: s } = {}) {
5600
- return he.create(e, t, n, s);
5601
+ return me.create(e, t, n, s);
5601
5602
  }
5602
5603
  constructor(e, t, n, s, i) {
5603
5604
  const [a, o, c] = s_(e);
@@ -5611,7 +5612,7 @@ class he {
5611
5612
  return e && t ? "en" : "intl";
5612
5613
  }
5613
5614
  clone(e) {
5614
- return !e || Object.getOwnPropertyNames(e).length === 0 ? this : he.create(
5615
+ return !e || Object.getOwnPropertyNames(e).length === 0 ? this : me.create(
5615
5616
  e.locale || this.specifiedLocale,
5616
5617
  e.numberingSystem || this.numberingSystem,
5617
5618
  e.outputCalendar || this.outputCalendar,
@@ -5758,7 +5759,7 @@ class Pe extends Gr {
5758
5759
  * @type {string}
5759
5760
  */
5760
5761
  get name() {
5761
- return this.fixed === 0 ? "UTC" : `UTC${Dr(this.fixed, "narrow")}`;
5762
+ return this.fixed === 0 ? "UTC" : `UTC${Mr(this.fixed, "narrow")}`;
5762
5763
  }
5763
5764
  /**
5764
5765
  * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`
@@ -5767,7 +5768,7 @@ class Pe extends Gr {
5767
5768
  * @type {string}
5768
5769
  */
5769
5770
  get ianaName() {
5770
- return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Dr(-this.fixed, "narrow")}`;
5771
+ return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Mr(-this.fixed, "narrow")}`;
5771
5772
  }
5772
5773
  /**
5773
5774
  * Returns the offset's common name at the specified timestamp.
@@ -5787,7 +5788,7 @@ class Pe extends Gr {
5787
5788
  * @return {string}
5788
5789
  */
5789
5790
  formatOffset(e, t) {
5790
- return Dr(this.fixed, t);
5791
+ return Mr(this.fixed, t);
5791
5792
  }
5792
5793
  /**
5793
5794
  * Returns whether the offset is known to be fixed for the whole year:
@@ -6083,7 +6084,7 @@ class Ee {
6083
6084
  * @return {void}
6084
6085
  */
6085
6086
  static resetCaches() {
6086
- he.resetCache(), _t.resetCache(), B.resetCache(), p_();
6087
+ me.resetCache(), _t.resetCache(), B.resetCache(), p_();
6087
6088
  }
6088
6089
  }
6089
6090
  class nt {
@@ -6212,7 +6213,7 @@ function Ff(r, e, t) {
6212
6213
  function b_(r, e) {
6213
6214
  return e.reduce((t, n) => (t[n] = r[n], t), {});
6214
6215
  }
6215
- function ur(r, e) {
6216
+ function fr(r, e) {
6216
6217
  return Object.prototype.hasOwnProperty.call(r, e);
6217
6218
  }
6218
6219
  function Oo(r) {
@@ -6330,14 +6331,14 @@ function qh(r) {
6330
6331
  function Sn(r, e) {
6331
6332
  const t = {};
6332
6333
  for (const n in r)
6333
- if (ur(r, n)) {
6334
+ if (fr(r, n)) {
6334
6335
  const s = r[n];
6335
6336
  if (s == null) continue;
6336
6337
  t[e(n)] = qh(s);
6337
6338
  }
6338
6339
  return t;
6339
6340
  }
6340
- function Dr(r, e) {
6341
+ function Mr(r, e) {
6341
6342
  const t = Math.trunc(Math.abs(r / 60)), n = Math.trunc(Math.abs(r % 60)), s = r >= 0 ? "+" : "-";
6342
6343
  switch (e) {
6343
6344
  case "short":
@@ -6544,12 +6545,12 @@ class Fe {
6544
6545
  return t > 0 && (s.padTo = t), n && (s.signDisplay = n), this.loc.numberFormatter(s).format(e);
6545
6546
  }
6546
6547
  formatDateTimeFromString(e, t) {
6547
- const n = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (d, m) => this.loc.extract(e, d, m), a = (d) => e.isOffsetFixed && e.offset === 0 && d.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, d.format) : "", o = () => n ? k_(e) : i({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), c = (d, m) => n ? x_(e, d) : i(m ? { month: d } : { month: d, day: "numeric" }, "month"), l = (d, m) => n ? I_(e, d) : i(
6548
- m ? { weekday: d } : { weekday: d, month: "long", day: "numeric" },
6548
+ const n = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (d, p) => this.loc.extract(e, d, p), a = (d) => e.isOffsetFixed && e.offset === 0 && d.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, d.format) : "", o = () => n ? k_(e) : i({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), c = (d, p) => n ? x_(e, d) : i(p ? { month: d } : { month: d, day: "numeric" }, "month"), l = (d, p) => n ? I_(e, d) : i(
6549
+ p ? { weekday: d } : { weekday: d, month: "long", day: "numeric" },
6549
6550
  "weekday"
6550
6551
  ), u = (d) => {
6551
- const m = Fe.macroTokenToFormatOpts(d);
6552
- return m ? this.formatWithSystemDefault(e, m) : d;
6552
+ const p = Fe.macroTokenToFormatOpts(d);
6553
+ return p ? this.formatWithSystemDefault(e, p) : d;
6553
6554
  }, f = (d) => n ? N_(e, d) : i({ era: d }, "era"), h = (d) => {
6554
6555
  switch (d) {
6555
6556
  // ms
@@ -6720,9 +6721,9 @@ class Fe {
6720
6721
  }, i = (u, f) => (h) => {
6721
6722
  const d = s(h);
6722
6723
  if (d) {
6723
- const m = f.isNegativeDuration && d !== f.largestUnit ? n : 1;
6724
+ const p = f.isNegativeDuration && d !== f.largestUnit ? n : 1;
6724
6725
  let E;
6725
- return this.opts.signMode === "negativeLargestOnly" && d !== f.largestUnit ? E = "never" : this.opts.signMode === "all" ? E = "always" : E = "auto", this.num(u.get(d) * m, h.length, E);
6726
+ return this.opts.signMode === "negativeLargestOnly" && d !== f.largestUnit ? E = "never" : this.opts.signMode === "all" ? E = "always" : E = "auto", this.num(u.get(d) * p, h.length, E);
6726
6727
  } else
6727
6728
  return h;
6728
6729
  }, a = Fe.parseFormat(t), o = a.reduce(
@@ -6738,11 +6739,11 @@ class Fe {
6738
6739
  }
6739
6740
  }
6740
6741
  const Bh = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
6741
- function mr(...r) {
6742
+ function pr(...r) {
6742
6743
  const e = r.reduce((t, n) => t + n.source, "");
6743
6744
  return RegExp(`^${e}$`);
6744
6745
  }
6745
- function pr(...r) {
6746
+ function yr(...r) {
6746
6747
  return (e) => r.reduce(
6747
6748
  ([t, n, s], i) => {
6748
6749
  const [a, o, c] = i(e, s);
@@ -6751,7 +6752,7 @@ function pr(...r) {
6751
6752
  [{}, null, 1]
6752
6753
  ).slice(0, 2);
6753
6754
  }
6754
- function yr(r, ...e) {
6755
+ function gr(r, ...e) {
6755
6756
  if (r == null)
6756
6757
  return [null, null];
6757
6758
  for (const [t, n] of e) {
@@ -6784,7 +6785,7 @@ function W_(r, e) {
6784
6785
  day: nr(r, e + 2, 1)
6785
6786
  }, null, e + 3];
6786
6787
  }
6787
- function gr(r, e) {
6788
+ function _r(r, e) {
6788
6789
  return [{
6789
6790
  hours: nr(r, e, 0),
6790
6791
  minutes: nr(r, e + 1, 0),
@@ -6802,7 +6803,7 @@ function Yr(r, e) {
6802
6803
  }
6803
6804
  const z_ = RegExp(`^T?${nc.source}$`), B_ = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
6804
6805
  function Z_(r) {
6805
- const [e, t, n, s, i, a, o, c, l] = r, u = e[0] === "-", f = c && c[0] === "-", h = (d, m = !1) => d !== void 0 && (m || d && u) ? -d : d;
6806
+ const [e, t, n, s, i, a, o, c, l] = r, u = e[0] === "-", f = c && c[0] === "-", h = (d, p = !1) => d !== void 0 && (p || d && u) ? -d : d;
6806
6807
  return [
6807
6808
  {
6808
6809
  years: h(qt(t)),
@@ -6868,28 +6869,28 @@ function ev(r) {
6868
6869
  const [, e, t, n, s, i, a, o] = r;
6869
6870
  return [ic(e, o, t, n, s, i, a), Pe.utcInstance];
6870
6871
  }
6871
- const tv = mr(P_, sc), rv = mr(q_, sc), nv = mr(L_, sc), sv = mr(Hh), Yh = pr(
6872
+ const tv = pr(P_, sc), rv = pr(q_, sc), nv = pr(L_, sc), sv = pr(Hh), Yh = yr(
6872
6873
  W_,
6873
- gr,
6874
+ _r,
6874
6875
  Kr,
6875
6876
  Yr
6876
- ), iv = pr(
6877
+ ), iv = yr(
6877
6878
  $_,
6878
- gr,
6879
+ _r,
6879
6880
  Kr,
6880
6881
  Yr
6881
- ), av = pr(
6882
+ ), av = yr(
6882
6883
  j_,
6883
- gr,
6884
+ _r,
6884
6885
  Kr,
6885
6886
  Yr
6886
- ), ov = pr(
6887
- gr,
6887
+ ), ov = yr(
6888
+ _r,
6888
6889
  Kr,
6889
6890
  Yr
6890
6891
  );
6891
6892
  function cv(r) {
6892
- return yr(
6893
+ return gr(
6893
6894
  r,
6894
6895
  [tv, Yh],
6895
6896
  [rv, iv],
@@ -6898,10 +6899,10 @@ function cv(r) {
6898
6899
  );
6899
6900
  }
6900
6901
  function lv(r) {
6901
- return yr(Y_(r), [H_, K_]);
6902
+ return gr(Y_(r), [H_, K_]);
6902
6903
  }
6903
6904
  function uv(r) {
6904
- return yr(
6905
+ return gr(
6905
6906
  r,
6906
6907
  [J_, Pf],
6907
6908
  [Q_, Pf],
@@ -6909,19 +6910,19 @@ function uv(r) {
6909
6910
  );
6910
6911
  }
6911
6912
  function fv(r) {
6912
- return yr(r, [B_, Z_]);
6913
+ return gr(r, [B_, Z_]);
6913
6914
  }
6914
- const dv = pr(gr);
6915
+ const dv = yr(_r);
6915
6916
  function hv(r) {
6916
- return yr(r, [z_, dv]);
6917
+ return gr(r, [z_, dv]);
6917
6918
  }
6918
- const mv = mr(U_, V_), pv = mr(Kh), yv = pr(
6919
- gr,
6919
+ const mv = pr(U_, V_), pv = pr(Kh), yv = yr(
6920
+ _r,
6920
6921
  Kr,
6921
6922
  Yr
6922
6923
  );
6923
6924
  function gv(r) {
6924
- return yr(
6925
+ return gr(
6925
6926
  r,
6926
6927
  [mv, Yh],
6927
6928
  [pv, yv]
@@ -7013,7 +7014,7 @@ const qf = "Invalid Duration", Jh = {
7013
7014
  "seconds",
7014
7015
  "milliseconds"
7015
7016
  ], wv = Vt.slice(0).reverse();
7016
- function ft(r, e, t = !1) {
7017
+ function dt(r, e, t = !1) {
7017
7018
  const n = {
7018
7019
  values: t ? e.values : { ...r.values, ...e.values || {} },
7019
7020
  loc: r.loc.clone(e.loc),
@@ -7061,7 +7062,7 @@ class ue {
7061
7062
  constructor(e) {
7062
7063
  const t = e.conversionAccuracy === "longterm" || !1;
7063
7064
  let n = t ? vv : _v;
7064
- e.matrix && (n = e.matrix), this.values = e.values, this.loc = e.loc || he.create(), this.conversionAccuracy = t ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = n, this.isLuxonDuration = !0;
7065
+ e.matrix && (n = e.matrix), this.values = e.values, this.loc = e.loc || me.create(), this.conversionAccuracy = t ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = n, this.isLuxonDuration = !0;
7065
7066
  }
7066
7067
  /**
7067
7068
  * Create Duration from a number of milliseconds.
@@ -7102,7 +7103,7 @@ class ue {
7102
7103
  );
7103
7104
  return new ue({
7104
7105
  values: Sn(e, ue.normalizeUnit),
7105
- loc: he.fromObject(t),
7106
+ loc: me.fromObject(t),
7106
7107
  conversionAccuracy: t.conversionAccuracy,
7107
7108
  matrix: t.matrix
7108
7109
  });
@@ -7382,8 +7383,8 @@ class ue {
7382
7383
  if (!this.isValid) return this;
7383
7384
  const t = ue.fromDurationLike(e), n = {};
7384
7385
  for (const s of Vt)
7385
- (ur(t.values, s) || ur(this.values, s)) && (n[s] = t.get(s) + this.get(s));
7386
- return ft(this, { values: n }, !0);
7386
+ (fr(t.values, s) || fr(this.values, s)) && (n[s] = t.get(s) + this.get(s));
7387
+ return dt(this, { values: n }, !0);
7387
7388
  }
7388
7389
  /**
7389
7390
  * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.
@@ -7407,7 +7408,7 @@ class ue {
7407
7408
  const t = {};
7408
7409
  for (const n of Object.keys(this.values))
7409
7410
  t[n] = qh(e(this.values[n], n));
7410
- return ft(this, { values: t }, !0);
7411
+ return dt(this, { values: t }, !0);
7411
7412
  }
7412
7413
  /**
7413
7414
  * Get the value of unit.
@@ -7430,7 +7431,7 @@ class ue {
7430
7431
  set(e) {
7431
7432
  if (!this.isValid) return this;
7432
7433
  const t = { ...this.values, ...Sn(e, ue.normalizeUnit) };
7433
- return ft(this, { values: t });
7434
+ return dt(this, { values: t });
7434
7435
  }
7435
7436
  /**
7436
7437
  * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration.
@@ -7439,7 +7440,7 @@ class ue {
7439
7440
  */
7440
7441
  reconfigure({ locale: e, numberingSystem: t, conversionAccuracy: n, matrix: s } = {}) {
7441
7442
  const a = { loc: this.loc.clone({ locale: e, numberingSystem: t }), matrix: s, conversionAccuracy: n };
7442
- return ft(this, a);
7443
+ return dt(this, a);
7443
7444
  }
7444
7445
  /**
7445
7446
  * Return the length of the duration in the specified unit.
@@ -7470,7 +7471,7 @@ class ue {
7470
7471
  normalize() {
7471
7472
  if (!this.isValid) return this;
7472
7473
  const e = this.toObject();
7473
- return Lf(this.matrix, e), ft(this, { values: e }, !0);
7474
+ return Lf(this.matrix, e), dt(this, { values: e }, !0);
7474
7475
  }
7475
7476
  /**
7476
7477
  * Rescale units to its largest representation
@@ -7480,7 +7481,7 @@ class ue {
7480
7481
  rescale() {
7481
7482
  if (!this.isValid) return this;
7482
7483
  const e = $f(this.normalize().shiftToAll().toObject());
7483
- return ft(this, { values: e }, !0);
7484
+ return dt(this, { values: e }, !0);
7484
7485
  }
7485
7486
  /**
7486
7487
  * Convert this Duration into its representation in a different set of units.
@@ -7506,7 +7507,7 @@ class ue {
7506
7507
  } else xt(s[a]) && (n[a] = s[a]);
7507
7508
  for (const a in n)
7508
7509
  n[a] !== 0 && (t[i] += a === i ? n[a] : n[a] / this.matrix[i][a]);
7509
- return Lf(this.matrix, t), ft(this, { values: t }, !0);
7510
+ return Lf(this.matrix, t), dt(this, { values: t }, !0);
7510
7511
  }
7511
7512
  /**
7512
7513
  * Shift this Duration to all available units.
@@ -7535,7 +7536,7 @@ class ue {
7535
7536
  const e = {};
7536
7537
  for (const t of Object.keys(this.values))
7537
7538
  e[t] = this.values[t] === 0 ? 0 : -this.values[t];
7538
- return ft(this, { values: e }, !0);
7539
+ return dt(this, { values: e }, !0);
7539
7540
  }
7540
7541
  /**
7541
7542
  * Removes all units with values equal to 0 from this Duration.
@@ -7545,7 +7546,7 @@ class ue {
7545
7546
  removeZeros() {
7546
7547
  if (!this.isValid) return this;
7547
7548
  const e = $f(this.values);
7548
- return ft(this, { values: e }, !0);
7549
+ return dt(this, { values: e }, !0);
7549
7550
  }
7550
7551
  /**
7551
7552
  * Get the years.
@@ -7685,7 +7686,7 @@ class Oe {
7685
7686
  * @return {Interval}
7686
7687
  */
7687
7688
  static fromDateTimes(e, t) {
7688
- const n = br(e), s = br(t), i = bv(n, s);
7689
+ const n = Or(e), s = Or(t), i = bv(n, s);
7689
7690
  return i ?? new Oe({
7690
7691
  start: n,
7691
7692
  end: s
@@ -7698,7 +7699,7 @@ class Oe {
7698
7699
  * @return {Interval}
7699
7700
  */
7700
7701
  static after(e, t) {
7701
- const n = ue.fromDurationLike(t), s = br(e);
7702
+ const n = ue.fromDurationLike(t), s = Or(e);
7702
7703
  return Oe.fromDateTimes(s, s.plus(n));
7703
7704
  }
7704
7705
  /**
@@ -7708,7 +7709,7 @@ class Oe {
7708
7709
  * @return {Interval}
7709
7710
  */
7710
7711
  static before(e, t) {
7711
- const n = ue.fromDurationLike(t), s = br(e);
7712
+ const n = ue.fromDurationLike(t), s = Or(e);
7712
7713
  return Oe.fromDateTimes(s.minus(n), s);
7713
7714
  }
7714
7715
  /**
@@ -7878,7 +7879,7 @@ class Oe {
7878
7879
  */
7879
7880
  splitAt(...e) {
7880
7881
  if (!this.isValid) return [];
7881
- const t = e.map(br).filter((a) => this.contains(a)).sort((a, o) => a.toMillis() - o.toMillis()), n = [];
7882
+ const t = e.map(Or).filter((a) => this.contains(a)).sort((a, o) => a.toMillis() - o.toMillis()), n = [];
7882
7883
  let { s } = this, i = 0;
7883
7884
  for (; s < this.e; ) {
7884
7885
  const a = t[i] || this.e, o = +a > +this.e ? this.e : a;
@@ -8160,7 +8161,7 @@ class rn {
8160
8161
  * @returns {number} the start of the week, 1 for Monday through 7 for Sunday
8161
8162
  */
8162
8163
  static getStartOfWeek({ locale: e = null, locObj: t = null } = {}) {
8163
- return (t || he.create(e)).getStartOfWeek();
8164
+ return (t || me.create(e)).getStartOfWeek();
8164
8165
  }
8165
8166
  /**
8166
8167
  * Get the minimum number of days necessary in a week before it is considered part of the next year according
@@ -8171,7 +8172,7 @@ class rn {
8171
8172
  * @returns {number}
8172
8173
  */
8173
8174
  static getMinimumDaysInFirstWeek({ locale: e = null, locObj: t = null } = {}) {
8174
- return (t || he.create(e)).getMinDaysInFirstWeek();
8175
+ return (t || me.create(e)).getMinDaysInFirstWeek();
8175
8176
  }
8176
8177
  /**
8177
8178
  * Get the weekdays, which are considered the weekend according to the given locale
@@ -8181,7 +8182,7 @@ class rn {
8181
8182
  * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
8182
8183
  */
8183
8184
  static getWeekendWeekdays({ locale: e = null, locObj: t = null } = {}) {
8184
- return (t || he.create(e)).getWeekendDays().slice();
8185
+ return (t || me.create(e)).getWeekendDays().slice();
8185
8186
  }
8186
8187
  /**
8187
8188
  * Return an array of standalone month names.
@@ -8201,7 +8202,7 @@ class rn {
8201
8202
  * @return {Array}
8202
8203
  */
8203
8204
  static months(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null, outputCalendar: i = "gregory" } = {}) {
8204
- return (s || he.create(t, n, i)).months(e);
8205
+ return (s || me.create(t, n, i)).months(e);
8205
8206
  }
8206
8207
  /**
8207
8208
  * Return an array of format month names.
@@ -8217,7 +8218,7 @@ class rn {
8217
8218
  * @return {Array}
8218
8219
  */
8219
8220
  static monthsFormat(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null, outputCalendar: i = "gregory" } = {}) {
8220
- return (s || he.create(t, n, i)).months(e, !0);
8221
+ return (s || me.create(t, n, i)).months(e, !0);
8221
8222
  }
8222
8223
  /**
8223
8224
  * Return an array of standalone week names.
@@ -8234,7 +8235,7 @@ class rn {
8234
8235
  * @return {Array}
8235
8236
  */
8236
8237
  static weekdays(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null } = {}) {
8237
- return (s || he.create(t, n, null)).weekdays(e);
8238
+ return (s || me.create(t, n, null)).weekdays(e);
8238
8239
  }
8239
8240
  /**
8240
8241
  * Return an array of format week names.
@@ -8249,7 +8250,7 @@ class rn {
8249
8250
  * @return {Array}
8250
8251
  */
8251
8252
  static weekdaysFormat(e = "long", { locale: t = null, numberingSystem: n = null, locObj: s = null } = {}) {
8252
- return (s || he.create(t, n, null)).weekdays(e, !0);
8253
+ return (s || me.create(t, n, null)).weekdays(e, !0);
8253
8254
  }
8254
8255
  /**
8255
8256
  * Return an array of meridiems.
@@ -8260,7 +8261,7 @@ class rn {
8260
8261
  * @return {Array}
8261
8262
  */
8262
8263
  static meridiems({ locale: e = null } = {}) {
8263
- return he.create(e).meridiems();
8264
+ return me.create(e).meridiems();
8264
8265
  }
8265
8266
  /**
8266
8267
  * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.
@@ -8273,7 +8274,7 @@ class rn {
8273
8274
  * @return {Array}
8274
8275
  */
8275
8276
  static eras(e = "short", { locale: t = null } = {}) {
8276
- return he.create(t, null, "gregory").eras(e);
8277
+ return me.create(t, null, "gregory").eras(e);
8277
8278
  }
8278
8279
  /**
8279
8280
  * Return the set of available features in this environment.
@@ -8542,7 +8543,7 @@ function Nv(r, e, t) {
8542
8543
  const s = {};
8543
8544
  let i = 1;
8544
8545
  for (const a in t)
8545
- if (ur(t, a)) {
8546
+ if (fr(t, a)) {
8546
8547
  const o = t[a], c = o.groups ? o.groups + 1 : 1;
8547
8548
  !o.literal && o.token && (s[o.token.val[0]] = o.deser(n.slice(i, i + c))), i += c;
8548
8549
  }
@@ -8613,7 +8614,7 @@ class rm {
8613
8614
  explainFromTokens(e) {
8614
8615
  if (this.isValid) {
8615
8616
  const [t, n] = Nv(e, this.regex, this.handlers), [s, i, a] = n ? Fv(n) : [null, null, void 0];
8616
- if (ur(n, "a") && ur(n, "H"))
8617
+ if (fr(n, "a") && fr(n, "H"))
8617
8618
  throw new er(
8618
8619
  "Can't include meridiem when specifying 24-hour format"
8619
8620
  );
@@ -8651,7 +8652,7 @@ function sm(r, e) {
8651
8652
  return s.map((a) => Iv(a, r, i));
8652
8653
  }
8653
8654
  const Ra = "Invalid DateTime", Wf = 864e13;
8654
- function Ar(r) {
8655
+ function kr(r) {
8655
8656
  return new nt("unsupported zone", `the zone "${r.name}" is not supported`);
8656
8657
  }
8657
8658
  function Ca(r) {
@@ -8735,7 +8736,7 @@ function Jt(r, e, t, n, s, i) {
8735
8736
  );
8736
8737
  }
8737
8738
  function an(r, e, t = !0) {
8738
- return r.isValid ? Fe.create(he.create("en-US"), {
8739
+ return r.isValid ? Fe.create(me.create("en-US"), {
8739
8740
  allowZ: t,
8740
8741
  forceSimple: !0
8741
8742
  }).formatDateTimeFromString(r, e) : null;
@@ -8846,17 +8847,17 @@ function Zf(r) {
8846
8847
  }
8847
8848
  }
8848
8849
  function Uv(r) {
8849
- if (kr === void 0 && (kr = Ee.now()), r.type !== "iana")
8850
- return r.offset(kr);
8850
+ if (Ir === void 0 && (Ir = Ee.now()), r.type !== "iana")
8851
+ return r.offset(Ir);
8851
8852
  const e = r.name;
8852
8853
  let t = So.get(e);
8853
- return t === void 0 && (t = r.offset(kr), So.set(e, t)), t;
8854
+ return t === void 0 && (t = r.offset(Ir), So.set(e, t)), t;
8854
8855
  }
8855
8856
  function Gf(r, e) {
8856
8857
  const t = kt(e.zone, Ee.defaultZone);
8857
8858
  if (!t.isValid)
8858
- return B.invalid(Ar(t));
8859
- const n = he.fromObject(e);
8859
+ return B.invalid(kr(t));
8860
+ const n = me.fromObject(e);
8860
8861
  let s, i;
8861
8862
  if (J(r.year))
8862
8863
  s = Ee.now();
@@ -8886,7 +8887,7 @@ function Kf(r) {
8886
8887
  let e = {}, t;
8887
8888
  return r.length > 0 && typeof r[r.length - 1] == "object" ? (e = r[r.length - 1], t = Array.from(r).slice(0, r.length - 1)) : t = Array.from(r), [e, t];
8888
8889
  }
8889
- let kr;
8890
+ let Ir;
8890
8891
  const So = /* @__PURE__ */ new Map();
8891
8892
  class B {
8892
8893
  /**
@@ -8894,7 +8895,7 @@ class B {
8894
8895
  */
8895
8896
  constructor(e) {
8896
8897
  const t = e.zone || Ee.defaultZone;
8897
- let n = e.invalid || (Number.isNaN(e.ts) ? new nt("invalid input") : null) || (t.isValid ? null : Ar(t));
8898
+ let n = e.invalid || (Number.isNaN(e.ts) ? new nt("invalid input") : null) || (t.isValid ? null : kr(t));
8898
8899
  this.ts = J(e.ts) ? Ee.now() : e.ts;
8899
8900
  let s = null, i = null;
8900
8901
  if (!n)
@@ -8904,7 +8905,7 @@ class B {
8904
8905
  const o = xt(e.o) && !e.old ? e.o : t.offset(this.ts);
8905
8906
  s = sn(this.ts, o), n = Number.isNaN(s.year) ? new nt("invalid input") : null, s = n ? null : s, i = n ? null : o;
8906
8907
  }
8907
- this._zone = t, this.loc = e.loc || he.create(), this.invalid = n, this.weekData = null, this.localWeekData = null, this.c = s, this.o = i, this.isLuxonDateTime = !0;
8908
+ this._zone = t, this.loc = e.loc || me.create(), this.invalid = n, this.weekData = null, this.localWeekData = null, this.c = s, this.o = i, this.isLuxonDateTime = !0;
8908
8909
  }
8909
8910
  // CONSTRUCT
8910
8911
  /**
@@ -8986,8 +8987,8 @@ class B {
8986
8987
  return s.isValid ? new B({
8987
8988
  ts: n,
8988
8989
  zone: s,
8989
- loc: he.fromObject(t)
8990
- }) : B.invalid(Ar(s));
8990
+ loc: me.fromObject(t)
8991
+ }) : B.invalid(kr(s));
8991
8992
  }
8992
8993
  /**
8993
8994
  * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
@@ -9005,7 +9006,7 @@ class B {
9005
9006
  return e < -Wf || e > Wf ? B.invalid("Timestamp out of range") : new B({
9006
9007
  ts: e,
9007
9008
  zone: kt(t.zone, Ee.defaultZone),
9008
- loc: he.fromObject(t)
9009
+ loc: me.fromObject(t)
9009
9010
  });
9010
9011
  throw new Ne(
9011
9012
  `fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`
@@ -9027,7 +9028,7 @@ class B {
9027
9028
  return new B({
9028
9029
  ts: e * 1e3,
9029
9030
  zone: kt(t.zone, Ee.defaultZone),
9030
- loc: he.fromObject(t)
9031
+ loc: me.fromObject(t)
9031
9032
  });
9032
9033
  throw new Ne("fromSeconds requires a numerical input");
9033
9034
  }
@@ -9068,35 +9069,35 @@ class B {
9068
9069
  e = e || {};
9069
9070
  const n = kt(t.zone, Ee.defaultZone);
9070
9071
  if (!n.isValid)
9071
- return B.invalid(Ar(n));
9072
- const s = he.fromObject(t), i = Sn(e, Zf), { minDaysInFirstWeek: a, startOfWeek: o } = Nf(i, s), c = Ee.now(), l = J(t.specificOffset) ? n.offset(c) : t.specificOffset, u = !J(i.ordinal), f = !J(i.year), h = !J(i.month) || !J(i.day), d = f || h, m = i.weekYear || i.weekNumber;
9073
- if ((d || u) && m)
9072
+ return B.invalid(kr(n));
9073
+ const s = me.fromObject(t), i = Sn(e, Zf), { minDaysInFirstWeek: a, startOfWeek: o } = Nf(i, s), c = Ee.now(), l = J(t.specificOffset) ? n.offset(c) : t.specificOffset, u = !J(i.ordinal), f = !J(i.year), h = !J(i.month) || !J(i.day), d = f || h, p = i.weekYear || i.weekNumber;
9074
+ if ((d || u) && p)
9074
9075
  throw new er(
9075
9076
  "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
9076
9077
  );
9077
9078
  if (h && u)
9078
9079
  throw new er("Can't mix ordinal dates with month/day");
9079
- const E = m || i.weekday && !d;
9080
+ const E = p || i.weekday && !d;
9080
9081
  let y, _, S = sn(c, l);
9081
9082
  E ? (y = $v, _ = qv, S = On(S, a, o)) : u ? (y = jv, _ = Lv, S = Sa(S)) : (y = ln, _ = am);
9082
- let T = !1;
9083
- for (const p of y) {
9084
- const k = i[p];
9085
- J(k) ? T ? i[p] = _[p] : i[p] = S[p] : T = !0;
9086
- }
9087
- const P = E ? y_(i, a, o) : u ? g_(i) : Nh(i), g = P || Fh(i);
9088
- if (g)
9089
- return B.invalid(g);
9090
- const C = E ? If(i, a, o) : u ? xf(i) : i, [R, v] = cn(C, l, n), A = new B({
9083
+ let A = !1;
9084
+ for (const g of y) {
9085
+ const k = i[g];
9086
+ J(k) ? A ? i[g] = _[g] : i[g] = S[g] : A = !0;
9087
+ }
9088
+ const F = E ? y_(i, a, o) : u ? g_(i) : Nh(i), m = F || Fh(i);
9089
+ if (m)
9090
+ return B.invalid(m);
9091
+ const T = E ? If(i, a, o) : u ? xf(i) : i, [R, v] = cn(T, l, n), C = new B({
9091
9092
  ts: R,
9092
9093
  zone: n,
9093
9094
  o: v,
9094
9095
  loc: s
9095
9096
  });
9096
- return i.weekday && d && e.weekday !== A.weekday ? B.invalid(
9097
+ return i.weekday && d && e.weekday !== C.weekday ? B.invalid(
9097
9098
  "mismatched weekday",
9098
- `you can't specify both a weekday of ${i.weekday} and a date of ${A.toISO()}`
9099
- ) : A.isValid ? A : B.invalid(A.invalid);
9099
+ `you can't specify both a weekday of ${i.weekday} and a date of ${C.toISO()}`
9100
+ ) : C.isValid ? C : B.invalid(C.invalid);
9100
9101
  }
9101
9102
  /**
9102
9103
  * Create a DateTime from an ISO 8601 string
@@ -9175,7 +9176,7 @@ class B {
9175
9176
  static fromFormat(e, t, n = {}) {
9176
9177
  if (J(e) || J(t))
9177
9178
  throw new Ne("fromFormat requires an input string and a format");
9178
- const { locale: s = null, numberingSystem: i = null } = n, a = he.fromOpts({
9179
+ const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
9179
9180
  locale: s,
9180
9181
  numberingSystem: i,
9181
9182
  defaultToEN: !0
@@ -9242,7 +9243,7 @@ class B {
9242
9243
  * @returns {string}
9243
9244
  */
9244
9245
  static parseFormatForOpts(e, t = {}) {
9245
- const n = sm(e, he.fromObject(t));
9246
+ const n = sm(e, me.fromObject(t));
9246
9247
  return n ? n.map((s) => s ? s.val : null).join("") : null;
9247
9248
  }
9248
9249
  /**
@@ -9253,10 +9254,10 @@ class B {
9253
9254
  * @returns {string}
9254
9255
  */
9255
9256
  static expandFormat(e, t = {}) {
9256
- return tm(Fe.parseFormat(e), he.fromObject(t)).map((s) => s.val).join("");
9257
+ return tm(Fe.parseFormat(e), me.fromObject(t)).map((s) => s.val).join("");
9257
9258
  }
9258
9259
  static resetCache() {
9259
- kr = void 0, So.clear();
9260
+ Ir = void 0, So.clear();
9260
9261
  }
9261
9262
  // INFO
9262
9263
  /**
@@ -9664,7 +9665,7 @@ class B {
9664
9665
  }
9665
9666
  return Lt(this, { ts: s, zone: e });
9666
9667
  } else
9667
- return B.invalid(Ar(e));
9668
+ return B.invalid(kr(e));
9668
9669
  }
9669
9670
  /**
9670
9671
  * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.
@@ -10241,7 +10242,7 @@ class B {
10241
10242
  * @return {Object}
10242
10243
  */
10243
10244
  static fromFormatExplain(e, t, n = {}) {
10244
- const { locale: s = null, numberingSystem: i = null } = n, a = he.fromOpts({
10245
+ const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
10245
10246
  locale: s,
10246
10247
  numberingSystem: i,
10247
10248
  defaultToEN: !0
@@ -10267,7 +10268,7 @@ class B {
10267
10268
  * @returns {TokenParser} - opaque object to be used
10268
10269
  */
10269
10270
  static buildFormatParser(e, t = {}) {
10270
- const { locale: n = null, numberingSystem: s = null } = t, i = he.fromOpts({
10271
+ const { locale: n = null, numberingSystem: s = null } = t, i = me.fromOpts({
10271
10272
  locale: n,
10272
10273
  numberingSystem: s,
10273
10274
  defaultToEN: !0
@@ -10289,7 +10290,7 @@ class B {
10289
10290
  throw new Ne(
10290
10291
  "fromFormatParser requires an input string and a format parser"
10291
10292
  );
10292
- const { locale: s = null, numberingSystem: i = null } = n, a = he.fromOpts({
10293
+ const { locale: s = null, numberingSystem: i = null } = n, a = me.fromOpts({
10293
10294
  locale: s,
10294
10295
  numberingSystem: i,
10295
10296
  defaultToEN: !0
@@ -10464,7 +10465,7 @@ class B {
10464
10465
  return Th;
10465
10466
  }
10466
10467
  }
10467
- function br(r) {
10468
+ function Or(r) {
10468
10469
  if (B.isDateTime(r))
10469
10470
  return r;
10470
10471
  if (r && r.valueOf && xt(r.valueOf()))
@@ -10486,31 +10487,31 @@ const Yf = async (r, e) => {
10486
10487
  for (const o of n.fields)
10487
10488
  await Yf(o.custom?.preValidate, s);
10488
10489
  return Wg(r, t, i).parse(e), e;
10489
- }, ac = (r, e, t, n, s, i, a, o, c, l, u, f, h, d, m, E, y, _, S, T, P) => {
10490
- const { fields: g } = a;
10491
- g.filter((v) => "unique" in v && v.unique).forEach((v) => {
10490
+ }, ac = (r, e, t, n, s, i, a, o, c, l, u, f, h, d, p, E, y, _, S, A, F) => {
10491
+ const { fields: m } = a;
10492
+ m.filter((v) => "unique" in v && v.unique).forEach((v) => {
10492
10493
  r !== "delete" && (typeof s[v.name] == "string" || typeof s[v.name] == "number") && e.set(d(v, s[v.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||")), {
10493
10494
  id: n,
10494
10495
  Collection_Path: t
10495
10496
  });
10496
- }), g.forEach((v) => {
10497
+ }), m.forEach((v) => {
10497
10498
  if (cg(v, a, i)) {
10498
- const A = fg(v, a, i), p = {};
10499
- s[v.name] !== void 0 && (p[v.name] = s[v.name], _e(v) && (p[`${v.name}_Array`] = s[`${v.name}_Array`])), A.forEach((k) => {
10500
- s[k.name] !== void 0 && (_e(k) ? p[`${k.name}_Array`] = s[`${k.name}_Array`] : p[k.name] = s[k.name]);
10501
- }), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path = t, p.Collection_Path_String = t.join("/"), e.set(h(v), p)), r === "update" && e.update(h(v), p), r === "delete" && e.delete(h(v)));
10499
+ const C = fg(v, a, i), g = {};
10500
+ s[v.name] !== void 0 && (g[v.name] = s[v.name], _e(v) && (g[`${v.name}_Array`] = s[`${v.name}_Array`])), C.forEach((k) => {
10501
+ s[k.name] !== void 0 && (_e(k) ? g[`${k.name}_Array`] = s[`${k.name}_Array`] : g[k.name] = s[k.name]);
10502
+ }), Object.keys(g).length > 0 && (r === "create" && (g.Collection_Path = t, g.Collection_Path_String = t.join("/"), e.set(h(v), g)), r === "update" && e.update(h(v), g), r === "delete" && e.delete(h(v)));
10502
10503
  }
10503
10504
  });
10504
- const C = c[a.labels.collection];
10505
- for (const v of C) {
10506
- const A = dg(v, a), p = { ...s };
10507
- A.forEach((k) => {
10508
- delete p[k.name], delete p[`${k.name}_Array`], delete p[`${k.name}_Single`], delete p[`${k.name}_Lowercase`];
10509
- }), Object.keys(p).length > 0 && (r === "create" && (p.Collection_Path ||= t, p.Collection_Path_String = t.join("/"), e.set(m(v.key), p)), r === "update" && e.update(m(v.key), p), r === "delete" && e.delete(m(v.key)));
10505
+ const T = c[a.labels.collection];
10506
+ for (const v of T) {
10507
+ const C = dg(v, a), g = { ...s };
10508
+ C.forEach((k) => {
10509
+ delete g[k.name], delete g[`${k.name}_Array`], delete g[`${k.name}_Single`], delete g[`${k.name}_Lowercase`];
10510
+ }), Object.keys(g).length > 0 && (r === "create" && (g.Collection_Path ||= t, g.Collection_Path_String = t.join("/"), e.set(p(v.key), g)), r === "update" && e.update(p(v.key), g), r === "delete" && e.delete(p(v.key)));
10510
10511
  }
10511
10512
  if (r === "delete")
10512
10513
  return;
10513
- const R = g.filter((v) => _e(v) && v.twoWay);
10514
+ const R = m.filter((v) => _e(v) && v.twoWay);
10514
10515
  if (!o?.noTwoWay) {
10515
10516
  for (const v of R)
10516
10517
  throw new Error("VALIDATION_ERROR: batchSize is required");
@@ -10639,38 +10640,38 @@ var Ua, cd;
10639
10640
  function Qv() {
10640
10641
  if (cd) return Ua;
10641
10642
  cd = 1;
10642
- var r = zo(), e = Kv(), t = Yv(), n = Jv(), s = Bd(), i = "[object Boolean]", a = "[object Date]", o = "[object Map]", c = "[object Number]", l = "[object RegExp]", u = "[object Set]", f = "[object String]", h = "[object Symbol]", d = "[object ArrayBuffer]", m = "[object DataView]", E = "[object Float32Array]", y = "[object Float64Array]", _ = "[object Int8Array]", S = "[object Int16Array]", T = "[object Int32Array]", P = "[object Uint8Array]", g = "[object Uint8ClampedArray]", C = "[object Uint16Array]", R = "[object Uint32Array]";
10643
- function v(A, p, k) {
10644
- var I = A.constructor;
10645
- switch (p) {
10643
+ var r = zo(), e = Kv(), t = Yv(), n = Jv(), s = Bd(), i = "[object Boolean]", a = "[object Date]", o = "[object Map]", c = "[object Number]", l = "[object RegExp]", u = "[object Set]", f = "[object String]", h = "[object Symbol]", d = "[object ArrayBuffer]", p = "[object DataView]", E = "[object Float32Array]", y = "[object Float64Array]", _ = "[object Int8Array]", S = "[object Int16Array]", A = "[object Int32Array]", F = "[object Uint8Array]", m = "[object Uint8ClampedArray]", T = "[object Uint16Array]", R = "[object Uint32Array]";
10644
+ function v(C, g, k) {
10645
+ var I = C.constructor;
10646
+ switch (g) {
10646
10647
  case d:
10647
- return r(A);
10648
+ return r(C);
10648
10649
  case i:
10649
10650
  case a:
10650
- return new I(+A);
10651
- case m:
10652
- return e(A, k);
10651
+ return new I(+C);
10652
+ case p:
10653
+ return e(C, k);
10653
10654
  case E:
10654
10655
  case y:
10655
10656
  case _:
10656
10657
  case S:
10658
+ case A:
10659
+ case F:
10660
+ case m:
10657
10661
  case T:
10658
- case P:
10659
- case g:
10660
- case C:
10661
10662
  case R:
10662
- return s(A, k);
10663
+ return s(C, k);
10663
10664
  case o:
10664
10665
  return new I();
10665
10666
  case c:
10666
10667
  case f:
10667
- return new I(A);
10668
+ return new I(C);
10668
10669
  case l:
10669
- return t(A);
10670
+ return t(C);
10670
10671
  case u:
10671
10672
  return new I();
10672
10673
  case h:
10673
- return n(A);
10674
+ return n(C);
10674
10675
  }
10675
10676
  }
10676
10677
  return Ua = v, Ua;
@@ -10713,41 +10714,41 @@ var Za, hd;
10713
10714
  function nw() {
10714
10715
  if (hd) return Za;
10715
10716
  hd = 1;
10716
- var r = Mo(), e = Vv(), t = Zo(), n = Wv(), s = zv(), i = zd(), a = Zd(), o = Bv(), c = Zv(), l = jd(), u = Gv(), f = qn(), h = Hv(), d = Qv(), m = Gd(), E = Dt(), y = Mn(), _ = ew(), S = wt(), T = rw(), P = Vo(), g = Br(), C = 1, R = 2, v = 4, A = "[object Arguments]", p = "[object Array]", k = "[object Boolean]", I = "[object Date]", b = "[object Error]", w = "[object Function]", O = "[object GeneratorFunction]", x = "[object Map]", M = "[object Number]", D = "[object Object]", q = "[object RegExp]", z = "[object Set]", ee = "[object String]", oe = "[object Symbol]", F = "[object WeakMap]", te = "[object ArrayBuffer]", ne = "[object DataView]", Me = "[object Float32Array]", Se = "[object Float64Array]", Le = "[object Int8Array]", Ot = "[object Int16Array]", G = "[object Int32Array]", K = "[object Uint8Array]", j = "[object Uint8ClampedArray]", Y = "[object Uint16Array]", U = "[object Uint32Array]", Z = {};
10717
- Z[A] = Z[p] = Z[te] = Z[ne] = Z[k] = Z[I] = Z[Me] = Z[Se] = Z[Le] = Z[Ot] = Z[G] = Z[x] = Z[M] = Z[D] = Z[q] = Z[z] = Z[ee] = Z[oe] = Z[K] = Z[j] = Z[Y] = Z[U] = !0, Z[b] = Z[w] = Z[F] = !1;
10718
- function Te(H, ge, se, Xe, ut, Be) {
10719
- var xe, vr = ge & C, Re = ge & R, wr = ge & v;
10720
- if (se && (xe = ut ? se(H, Xe, ut, Be) : se(H)), xe !== void 0)
10717
+ var r = Mo(), e = Vv(), t = Zo(), n = Wv(), s = zv(), i = zd(), a = Zd(), o = Bv(), c = Zv(), l = jd(), u = Gv(), f = qn(), h = Hv(), d = Qv(), p = Gd(), E = Dt(), y = Mn(), _ = ew(), S = wt(), A = rw(), F = Vo(), m = Br(), T = 1, R = 2, v = 4, C = "[object Arguments]", g = "[object Array]", k = "[object Boolean]", I = "[object Date]", b = "[object Error]", w = "[object Function]", O = "[object GeneratorFunction]", x = "[object Map]", P = "[object Number]", M = "[object Object]", q = "[object RegExp]", z = "[object Set]", ee = "[object String]", oe = "[object Symbol]", D = "[object WeakMap]", te = "[object ArrayBuffer]", ne = "[object DataView]", Me = "[object Float32Array]", Se = "[object Float64Array]", Le = "[object Int8Array]", Ot = "[object Int16Array]", G = "[object Int32Array]", K = "[object Uint8Array]", j = "[object Uint8ClampedArray]", Y = "[object Uint16Array]", U = "[object Uint32Array]", Z = {};
10718
+ Z[C] = Z[g] = Z[te] = Z[ne] = Z[k] = Z[I] = Z[Me] = Z[Se] = Z[Le] = Z[Ot] = Z[G] = Z[x] = Z[P] = Z[M] = Z[q] = Z[z] = Z[ee] = Z[oe] = Z[K] = Z[j] = Z[Y] = Z[U] = !0, Z[b] = Z[w] = Z[D] = !1;
10719
+ function Te(H, ge, se, Xe, ft, Be) {
10720
+ var xe, wr = ge & T, Re = ge & R, br = ge & v;
10721
+ if (se && (xe = ft ? se(H, Xe, ft, Be) : se(H)), xe !== void 0)
10721
10722
  return xe;
10722
10723
  if (!S(H))
10723
10724
  return H;
10724
10725
  var _c = E(H);
10725
10726
  if (_c) {
10726
- if (xe = h(H), !vr)
10727
+ if (xe = h(H), !wr)
10727
10728
  return a(H, xe);
10728
10729
  } else {
10729
10730
  var Ht = f(H), vc = Ht == w || Ht == O;
10730
10731
  if (y(H))
10731
- return i(H, vr);
10732
- if (Ht == D || Ht == A || vc && !ut) {
10733
- if (xe = Re || vc ? {} : m(H), !vr)
10732
+ return i(H, wr);
10733
+ if (Ht == M || Ht == C || vc && !ft) {
10734
+ if (xe = Re || vc ? {} : p(H), !wr)
10734
10735
  return Re ? c(H, s(xe, H)) : o(H, n(xe, H));
10735
10736
  } else {
10736
10737
  if (!Z[Ht])
10737
- return ut ? H : {};
10738
- xe = d(H, Ht, vr);
10738
+ return ft ? H : {};
10739
+ xe = d(H, Ht, wr);
10739
10740
  }
10740
10741
  }
10741
10742
  Be || (Be = new r());
10742
10743
  var wc = Be.get(H);
10743
10744
  if (wc)
10744
10745
  return wc;
10745
- Be.set(H, xe), T(H) ? H.forEach(function(Et) {
10746
+ Be.set(H, xe), A(H) ? H.forEach(function(Et) {
10746
10747
  xe.add(Te(Et, ge, se, Et, H, Be));
10747
10748
  }) : _(H) && H.forEach(function(Et, Pt) {
10748
10749
  xe.set(Pt, Te(Et, ge, se, Pt, H, Be));
10749
10750
  });
10750
- var Im = wr ? Re ? u : l : Re ? g : P, bc = _c ? void 0 : Im(H);
10751
+ var Im = br ? Re ? u : l : Re ? m : F, bc = _c ? void 0 : Im(H);
10751
10752
  return e(bc || H, function(Et, Pt) {
10752
10753
  bc && (Pt = Et, Et = H[Pt]), t(xe, Pt, Te(Et, ge, se, Pt, H, Be));
10753
10754
  }), xe;
@@ -10854,93 +10855,94 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
10854
10855
  const n = We(), s = Mt(), i = Ve(), a = De(), o = r.at(-1);
10855
10856
  if (!o)
10856
10857
  throw new Error("EMPTY_PATH");
10857
- const c = i.collections[o], { labels: l, fields: u, preloadCache: f } = c, h = lt(o), d = a.collections?.[l.collection];
10858
+ const c = i.collections[o], { labels: l, fields: u, preloadCache: f } = c, h = ut(o), d = a.collections?.[l.collection];
10858
10859
  if (!a.Role)
10859
10860
  throw new Error("PERMISSION_DENIED");
10860
- const m = d && vt("Read", d), E = kn(c, i, a), y = Rd(c, a), _ = xo(c, a), S = Cd(c, i, a), T = (w = []) => {
10861
+ const p = d && vt("Read", d), E = kn(c, i, a), y = Rd(c, a), _ = xo(c, a), S = Cd(c, i, a), A = (w = []) => {
10861
10862
  const O = [];
10862
- if (m)
10863
- O.push(me(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${e.key}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
10864
- else if (E)
10863
+ if (p) {
10864
+ let x = he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${e.key}`), ...w);
10865
+ t || (x = he(x, ye("Collection_Path_String", "==", r.join("/")))), O.push(x);
10866
+ } else if (E)
10865
10867
  for (const x of E)
10866
- O.push(me(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${x.field}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
10868
+ O.push(he(qr(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${x.field}`), ye("Collection_Path_String", "==", r.join("/")), ...w));
10867
10869
  return O;
10868
- }, P = y.filter((w) => "operations" in w && w.operations ? w.operations.includes("Read") : !0);
10869
- if (t || P.length === 0 && _.length === 0 && S.length === 0)
10870
- return T();
10871
- let g = 0;
10872
- const C = (w) => {
10873
- w && (g === 0 ? g = w : g *= w);
10870
+ }, F = y.filter((w) => "operations" in w && w.operations ? w.operations.includes("Read") : !0);
10871
+ if (F.length === 0 && _.length === 0 && S.length === 0)
10872
+ return A();
10873
+ let m = 0;
10874
+ const T = (w) => {
10875
+ w && (m === 0 ? m = w : m *= w);
10874
10876
  };
10875
- if (P) {
10876
- for (const w of P)
10877
+ if (F) {
10878
+ for (const w of F)
10877
10879
  if (w.type === "Record_Property") {
10878
10880
  const O = w.roles.find((x) => x.role === a.Role);
10879
10881
  if (!O)
10880
10882
  throw new Error("PERMISSION_DENIED");
10881
- C(O.values?.length);
10883
+ T(O.values?.length);
10882
10884
  }
10883
10885
  }
10884
- f?.roles.includes(a.Role) && f.range && C(f.range.fields.length);
10886
+ f?.roles.includes(a.Role) && f.range && T(f.range.fields.length);
10885
10887
  const R = h.admin?.statusField;
10886
- R && !f?.roles.includes(a.Role) && C(Math.max(R.active?.length || 0, R.archived?.length || 0));
10887
- const v = g === 0 ? 30 : Math.max(1, Math.floor(30 / g)), A = [];
10888
- P.filter((w) => w.type === "Record_Owner").forEach(() => A.push(ye("Created_By", "==", a.User_ID))), P.filter((w) => w.type === "Record_User").forEach((w) => {
10888
+ R && !f?.roles.includes(a.Role) && T(Math.max(R.active?.length || 0, R.archived?.length || 0));
10889
+ const v = m === 0 ? 30 : Math.max(1, Math.floor(30 / m)), C = [];
10890
+ F.filter((w) => w.type === "Record_Owner").forEach(() => C.push(ye("Created_By", "==", a.User_ID))), F.filter((w) => w.type === "Record_User").forEach((w) => {
10889
10891
  if ("collectionField" in w) {
10890
10892
  const O = re(u, w.collectionField);
10891
- A.push(ye(`${O.name}_Array`, "array-contains", a.Doc_ID));
10893
+ C.push(ye(`${O.name}_Array`, "array-contains", a.Doc_ID));
10892
10894
  }
10893
- }), P.filter((w) => w.type === "Record_Property").forEach((w) => {
10895
+ }), F.filter((w) => w.type === "Record_Property").forEach((w) => {
10894
10896
  if ("propertyField" in w) {
10895
- const O = w.roles.find((M) => M.role === a.Role);
10897
+ const O = w.roles.find((P) => P.role === a.Role);
10896
10898
  if (!O)
10897
10899
  throw new Error("PERMISSION_DENIED");
10898
10900
  const x = re(u, w.propertyField);
10899
- x.type === "Array" ? A.push(ye(x.name, "array-contains-any", O.values)) : A.push(ye(x.name, "in", O.values));
10901
+ x.type === "Array" ? C.push(ye(x.name, "array-contains-any", O.values)) : C.push(ye(x.name, "in", O.values));
10900
10902
  }
10901
10903
  });
10902
- const p = [];
10904
+ const g = [];
10903
10905
  _.filter((w) => w.type === "Individual").forEach((w) => {
10904
10906
  const O = d?.individualEntities, x = [];
10905
10907
  if (O) {
10906
- const M = w.singleQuery ? w.singleQuery : v;
10907
- for (let D = 0; D < O.length; D += M) {
10908
- const q = O.slice(D, D + M);
10908
+ const P = w.singleQuery ? w.singleQuery : v;
10909
+ for (let M = 0; M < O.length; M += P) {
10910
+ const q = O.slice(M, M + P);
10909
10911
  x.push(q);
10910
10912
  }
10911
10913
  if (!w.singleQuery)
10912
- x.forEach((D) => {
10913
- p.push(...T(A.concat(ye("id", "in", D))));
10914
+ x.forEach((M) => {
10915
+ g.push(...A(C.concat(ye("id", "in", M))));
10914
10916
  });
10915
10917
  else {
10916
- if (O.length > M)
10918
+ if (O.length > P)
10917
10919
  throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${w.singleQuery} entities`);
10918
- A.push(ye("id", "in", O));
10920
+ C.push(ye("id", "in", O));
10919
10921
  }
10920
10922
  }
10921
10923
  }), S.filter((w) => w.parentFilter.type === "Individual").forEach((w) => {
10922
10924
  const { parentFilter: O, parentRestriction: x } = w;
10923
10925
  if ("collectionField" in O) {
10924
- const M = re(u, O.collectionField);
10925
- if ("collection" in M) {
10926
- const D = a.collections?.[M.collection];
10927
- if (!D)
10926
+ const P = re(u, O.collectionField);
10927
+ if ("collection" in P) {
10928
+ const M = a.collections?.[P.collection];
10929
+ if (!M)
10928
10930
  throw new Error("PERMISSION_DENIED");
10929
- const q = D?.individualEntities, z = [];
10931
+ const q = M?.individualEntities, z = [];
10930
10932
  if (q) {
10931
10933
  const ee = x.singleQuery ? x.singleQuery : v;
10932
10934
  for (let oe = 0; oe < q.length; oe += ee) {
10933
- const F = q.slice(oe, oe + ee);
10934
- z.push(F);
10935
+ const D = q.slice(oe, oe + ee);
10936
+ z.push(D);
10935
10937
  }
10936
10938
  if (!x.singleQuery)
10937
10939
  z.forEach((oe) => {
10938
- p.push(...T(A.concat(ye(`${M.name}_Array`, "array-contains-any", oe))));
10940
+ g.push(...A(C.concat(ye(`${P.name}_Array`, "array-contains-any", oe))));
10939
10941
  });
10940
10942
  else {
10941
10943
  if (q.length > ee)
10942
10944
  throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${x.singleQuery} entities`);
10943
- A.push(ye(`${M.name}_Array`, "array-contains-any", q));
10945
+ C.push(ye(`${P.name}_Array`, "array-contains-any", q));
10944
10946
  }
10945
10947
  }
10946
10948
  }
@@ -10951,21 +10953,21 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
10951
10953
  if ("collectionField" in w) {
10952
10954
  const O = re(u, w.collectionField);
10953
10955
  if ("collection" in O) {
10954
- const x = d?.parentEntities, M = [];
10956
+ const x = d?.parentEntities, P = [];
10955
10957
  if (x) {
10956
- const D = w.singleQuery ? w.singleQuery : v;
10957
- for (let q = 0; q < x.length; q += D) {
10958
- const z = x.slice(q, q + D);
10959
- M.push(z);
10958
+ const M = w.singleQuery ? w.singleQuery : v;
10959
+ for (let q = 0; q < x.length; q += M) {
10960
+ const z = x.slice(q, q + M);
10961
+ P.push(z);
10960
10962
  }
10961
10963
  if (!w.singleQuery)
10962
- M.forEach((q) => {
10963
- k.push(...T(A.concat(ye(`${O.name}_Array`, "array-contains-any", q))));
10964
+ P.forEach((q) => {
10965
+ k.push(...A(C.concat(ye(`${O.name}_Array`, "array-contains-any", q))));
10964
10966
  });
10965
10967
  else {
10966
- if (x && x.length > D)
10968
+ if (x && x.length > M)
10967
10969
  throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${w.singleQuery} entities`);
10968
- A.push(ye(`${O.name}_Array`, "array-contains-any", x));
10970
+ C.push(ye(`${O.name}_Array`, "array-contains-any", x));
10969
10971
  }
10970
10972
  }
10971
10973
  }
@@ -10973,26 +10975,26 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
10973
10975
  }), S.filter((w) => w.parentFilter.type === "Parent").forEach((w) => {
10974
10976
  const { parentFilter: O, parentRestriction: x } = w;
10975
10977
  if ("collectionField" in O && "parentCollectionField" in O) {
10976
- const M = re(u, O.collectionField), D = re(u, O.parentCollectionField);
10977
- if ("collection" in M && "collection" in D) {
10978
- const q = a.collections?.[M.collection];
10978
+ const P = re(u, O.collectionField), M = re(u, O.parentCollectionField);
10979
+ if ("collection" in P && "collection" in M) {
10980
+ const q = a.collections?.[P.collection];
10979
10981
  if (!q)
10980
10982
  throw new Error("PERMISSION_DENIED");
10981
10983
  const z = q.parentEntities, ee = [];
10982
10984
  if (z) {
10983
10985
  const oe = x.singleQuery ? x.singleQuery : v;
10984
- for (let F = 0; F < z.length; F += oe) {
10985
- const te = z.slice(F, F + oe);
10986
+ for (let D = 0; D < z.length; D += oe) {
10987
+ const te = z.slice(D, D + oe);
10986
10988
  ee.push(te);
10987
10989
  }
10988
10990
  if (!x.singleQuery)
10989
- ee.forEach((F) => {
10990
- k.push(...T(A.concat(ye(`${D.name}_Array`, "array-contains-any", F))));
10991
+ ee.forEach((D) => {
10992
+ k.push(...A(C.concat(ye(`${M.name}_Array`, "array-contains-any", D))));
10991
10993
  });
10992
10994
  else {
10993
10995
  if (z && z.length > oe)
10994
10996
  throw new Error(`INPUT_ERROR: Parent entity parentFilter with singleQuery set to true must not have more than ${x.singleQuery} entities`);
10995
- A.push(ye(`${D.name}_Array`, "array-contains-any", z));
10997
+ C.push(ye(`${M.name}_Array`, "array-contains-any", z));
10996
10998
  }
10997
10999
  }
10998
11000
  }
@@ -11003,8 +11005,8 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
11003
11005
  if ("collectionField" in w && "propertyField" in w) {
11004
11006
  const O = re(u, w.collectionField), x = re(u, w.propertyField);
11005
11007
  if ("collection" in O) {
11006
- const M = d?.parentPropertyEntities || {};
11007
- Object.entries(M).forEach(([D, q]) => {
11008
+ const P = d?.parentPropertyEntities || {};
11009
+ Object.entries(P).forEach(([M, q]) => {
11008
11010
  if (q.length > 0) {
11009
11011
  const z = [];
11010
11012
  for (let ee = 0; ee < q.length; ee += v) {
@@ -11012,9 +11014,9 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
11012
11014
  z.push(oe);
11013
11015
  }
11014
11016
  z.forEach((ee) => {
11015
- I.push(...T(A.concat([
11017
+ I.push(...A(C.concat([
11016
11018
  ye(`${O.name}_Array`, "array-contains-any", ee),
11017
- ye(x.name, "==", D)
11019
+ ye(x.name, "==", M)
11018
11020
  ])));
11019
11021
  });
11020
11022
  }
@@ -11024,23 +11026,23 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
11024
11026
  }), S.filter((w) => w.parentFilter.type === "Parent_Property").forEach((w) => {
11025
11027
  const { parentFilter: O } = w;
11026
11028
  if ("collectionField" in O && "parentCollectionField" in O && "parentPropertyField" in O) {
11027
- const x = re(u, O.collectionField), M = re(u, O.parentCollectionField), D = re(u, O.parentPropertyField);
11028
- if ("collection" in x && "collection" in M) {
11029
+ const x = re(u, O.collectionField), P = re(u, O.parentCollectionField), M = re(u, O.parentPropertyField);
11030
+ if ("collection" in x && "collection" in P) {
11029
11031
  const q = a.collections?.[x.collection];
11030
11032
  if (!q)
11031
11033
  throw new Error("PERMISSION_DENIED");
11032
11034
  const z = q.parentPropertyEntities || {};
11033
11035
  Object.entries(z).forEach(([ee, oe]) => {
11034
11036
  if (oe.length > 0) {
11035
- const F = [];
11037
+ const D = [];
11036
11038
  for (let te = 0; te < oe.length; te += v) {
11037
11039
  const ne = oe.slice(te, te + v);
11038
- F.push(ne);
11040
+ D.push(ne);
11039
11041
  }
11040
- F.forEach((te) => {
11041
- I.push(...T(A.concat([
11042
- ye(`${M.name}_Array`, "array-contains-any", te),
11043
- ye(D.name, "==", ee)
11042
+ D.forEach((te) => {
11043
+ I.push(...A(C.concat([
11044
+ ye(`${P.name}_Array`, "array-contains-any", te),
11045
+ ye(M.name, "==", ee)
11044
11046
  ])));
11045
11047
  });
11046
11048
  }
@@ -11048,96 +11050,98 @@ const we = /* @__PURE__ */ In(iw), Nt = (r) => {
11048
11050
  }
11049
11051
  }
11050
11052
  }));
11051
- const b = [...p, ...k, ...I];
11052
- return !_.length && !S.length ? T(A) : b;
11053
- }, fm = {}, Ir = {}, Zw = async (r) => {
11054
- for (const s of Object.keys(Ir))
11055
- delete Ir[s];
11053
+ const b = [...g, ...k, ...I];
11054
+ return !_.length && !S.length ? A(C) : b;
11055
+ }, fm = {}, xr = {}, Zw = async (r) => {
11056
+ for (const s of Object.keys(xr))
11057
+ delete xr[s];
11056
11058
  for (const s of Object.keys(r || {}))
11057
- Ir[s] = [], delete fm[s];
11059
+ xr[s] = [], delete fm[s];
11058
11060
  const e = await Ie(), t = await ie(e, ["global", "preload", "sync"]), n = await ie(e, ["global", "preload", "async"]);
11059
11061
  if (n)
11060
11062
  for (const s of n)
11061
- r?.[s] && Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11063
+ r?.[s] && sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11062
11064
  if (t)
11063
11065
  for (const s of t)
11064
- r?.[s] && await Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11066
+ r?.[s] && await sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11065
11067
  for (const s of Object.keys(r || {}))
11066
- n.includes(s) || t.includes(s) || await Mr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11067
- return Ir;
11068
- }, To = () => fm, lw = () => Ir, uw = async (r, e, t, n) => {
11069
- const { labels: s, preloadCache: i } = r, o = Jr()[s.collection], c = Ie(), l = lt(s.collection), u = De();
11070
- if (!u?.Role)
11068
+ n.includes(s) || t.includes(s) || await sr(s, r?.[s].constraints, r?.[s].range, r?.[s].orQueries, r);
11069
+ return xr;
11070
+ }, To = () => fm, lw = () => xr, uw = async (r, e, t, n, s) => {
11071
+ const { labels: i, preloadCache: a } = r, c = Jr()[i.collection], l = Ie(), u = ut(i.collection), f = De();
11072
+ if (!f?.Role)
11071
11073
  throw new Error("PERMISSION_DENIED");
11072
- if (!i?.roles.includes(u.Role))
11074
+ if (!a?.roles.includes(f.Role))
11073
11075
  return;
11074
- const f = lw();
11075
- f[s.collection] && f[s.collection].forEach((m) => m()), await ie(c, ["global", "timezone"]), e ||= await ie(l, [
11076
+ const h = lw();
11077
+ let d = i.collection;
11078
+ s && (d = s, h[d] ||= []), h[d] && h[d].forEach((y) => y()), await ie(l, ["global", "timezone"]), e ||= await ie(u, [
11076
11079
  "collections",
11077
- s.collection,
11080
+ i.collection,
11078
11081
  "custom",
11079
11082
  "preloadCacheConstraints"
11080
- ]), n ||= await ie(l, [
11083
+ ]), n ||= await ie(u, [
11081
11084
  "collections",
11082
- s.collection,
11085
+ i.collection,
11083
11086
  "custom",
11084
11087
  "preloadCacheOrQueries"
11085
- ]), t ||= i.range;
11086
- const h = oc([s.collection], o).map((m) => {
11088
+ ]), s || (t ||= a.range);
11089
+ const p = oc([i.collection], c, !!s).map((y) => {
11087
11090
  if (t) {
11088
- const { start: E, end: y } = aw(t), _ = t.fields.filter((T) => !t.ranges?.some((P) => P.includes(T))).map((T) => Xr(ye(T, ">=", E), ye(T, "<=", y))), S = t.ranges?.map((T) => Xr(ye(T[0], "<=", y), ye(T[1], ">=", E)));
11089
- m = me(m, Rc(..._, ...S || []));
11090
- }
11091
- return n && (m = me(m, Xr(Rc(...n.map((E) => ye(...E)))))), e && (m = me(m, Xr(...e.map((E) => ye(...E))))), m;
11092
- }), d = /* @__PURE__ */ new Map();
11093
- return new Promise((m, E) => {
11094
- if (h.length === 0) {
11095
- m({});
11091
+ const { start: _, end: S } = aw(t), A = t.fields.filter((m) => !t.ranges?.some((T) => T.includes(m))).map((m) => Xr(ye(m, ">=", _), ye(m, "<=", S))), F = t.ranges?.map((m) => Xr(ye(m[0], "<=", S), ye(m[1], ">=", _)));
11092
+ y = he(y, Rc(...A, ...F || []));
11093
+ }
11094
+ return n && (y = he(y, Xr(Rc(...n.map((_) => ye(..._)))))), e && (y = he(y, Xr(...e.map((_) => ye(..._))))), y;
11095
+ }), E = /* @__PURE__ */ new Map();
11096
+ return new Promise((y, _) => {
11097
+ if (p.length === 0) {
11098
+ y({});
11096
11099
  return;
11097
11100
  }
11098
- h.forEach((y) => {
11099
- let _ = !1;
11100
- const S = dr(y, { includeMetadataChanges: !0 }, (T) => {
11101
- (!T.metadata.fromCache || _) && (_ || (_ = !0, d.set(y, !0), d.size === h.length && m({})));
11102
- }, (T) => {
11103
- console.error(T), E(T);
11101
+ p.forEach((S) => {
11102
+ let A = !1;
11103
+ const F = hr(S, { includeMetadataChanges: !0 }, (m) => {
11104
+ (!m.metadata.fromCache || A) && (A || (A = !0, E.set(S, !0), E.size === p.length && y({})));
11105
+ }, (m) => {
11106
+ console.error(`${d} - ${m.message}`), _(m);
11104
11107
  });
11105
- f[s.collection].push(S);
11108
+ h[d].push(F);
11106
11109
  });
11107
11110
  });
11108
- }, Mr = async (r, e, t, n, s) => {
11109
- const i = Ve(), a = De();
11110
- if (!a?.Role)
11111
+ }, sr = async (r, e, t, n, s, i) => {
11112
+ const a = Ve(), o = De();
11113
+ if (!o?.Role)
11111
11114
  throw new Error("PERMISSION_DENIED");
11112
- const o = i.collections[r], { labels: c, preloadCache: l } = o, u = To();
11113
- if (u[c.collection] === "Loading" || !l?.roles.includes(a.Role))
11115
+ const c = a.collections[r], { labels: l, preloadCache: u } = c, f = To();
11116
+ let h = l.collection;
11117
+ if (i && (h = i), f[h] === "Loading" || !u?.roles.includes(o.Role))
11114
11118
  return;
11115
- const f = a.collections?.[r];
11116
- if (!(f && vt("Read", f) || kn(o, i, a).length > 0)) {
11117
- u[c.collection] = "Error";
11119
+ const d = o.collections?.[r];
11120
+ if (!(d && vt("Read", d) || kn(c, a, o).length > 0)) {
11121
+ f[h] = "Error";
11118
11122
  return;
11119
11123
  }
11120
- u[c.collection] = "Loading";
11121
- const h = new Event(`stoker:loading:${r}`);
11122
- document.dispatchEvent(h);
11124
+ f[h] = "Loading";
11125
+ const p = new Event(`stoker:loading:${r}`);
11126
+ document.dispatchEvent(p);
11123
11127
  try {
11124
- if (await uw(o, e, t, n), l?.relationCollections && await ve(l.relationCollections)) {
11125
- const E = jt(o, i, a);
11126
- for (const y of E)
11127
- if (!s?.[y]) {
11128
- if (!i.collections[y].preloadCache?.roles.includes(a.Role))
11128
+ if (await uw(c, e, t, n, i), u?.relationCollections && !i && await ve(u.relationCollections)) {
11129
+ const _ = jt(c, a, o);
11130
+ for (const S of _)
11131
+ if (!s?.[S]) {
11132
+ if (!a.collections[S].preloadCache?.roles.includes(o.Role))
11129
11133
  continue;
11130
- const S = To()[y];
11131
- if (S === "Loading" || S === "Loaded" || S === "Error")
11134
+ const F = To()[S];
11135
+ if (F === "Loading" || F === "Loaded" || F === "Error")
11132
11136
  continue;
11133
- S || await Mr(y, void 0, void 0, void 0, s);
11137
+ F || await sr(S, void 0, void 0, void 0, s);
11134
11138
  }
11135
11139
  }
11136
- u[c.collection] = "Loaded";
11137
- const d = new Event(`stoker:loaded:${r}`);
11138
- document.dispatchEvent(d);
11139
- } catch (d) {
11140
- throw u[c.collection] = "Error", d;
11140
+ f[h] = "Loaded";
11141
+ const E = new Event(`stoker:loaded:${r}`);
11142
+ document.dispatchEvent(E);
11143
+ } catch (E) {
11144
+ throw f[h] = "Error", E;
11141
11145
  }
11142
11146
  };
11143
11147
  let $t = null;
@@ -11147,15 +11151,15 @@ const fw = async (r, e) => {
11147
11151
  throw new Error("User document ID not found in claims");
11148
11152
  let o = !1, c = null;
11149
11153
  return await new Promise((u, f) => {
11150
- const h = dr(ke(s, "tenants", n, "system_user_permissions", r.uid), (d) => {
11154
+ const h = hr(ke(s, "tenants", n, "system_user_permissions", r.uid), (d) => {
11151
11155
  if (d.exists()) {
11152
11156
  if ($t = d.data(), $t.User_ID = d.id, !$t.Role)
11153
11157
  throw new Error("PERMISSION_DENIED");
11154
11158
  if (!o)
11155
11159
  o = !0, u();
11156
11160
  else {
11157
- const m = new Event("stoker:permissionsChange");
11158
- if (document.dispatchEvent(m), i.auth.signOutOnPermissionsChange)
11161
+ const p = new Event("stoker:permissionsChange");
11162
+ if (document.dispatchEvent(p), i.auth.signOutOnPermissionsChange)
11159
11163
  Em();
11160
11164
  else {
11161
11165
  const E = $t.collections;
@@ -11164,7 +11168,7 @@ const fw = async (r, e) => {
11164
11168
  // eslint-disable-next-line security/detect-object-injection
11165
11169
  a.collections[y] && c && // eslint-disable-next-line security/detect-object-injection
11166
11170
  (!c.collections?.[y] || // eslint-disable-next-line security/detect-object-injection
11167
- !_y(_, c.collections[y])) && Mr(y);
11171
+ !_y(_, c.collections[y])) && sr(y);
11168
11172
  }
11169
11173
  }
11170
11174
  c = $t;
@@ -11180,9 +11184,9 @@ const fw = async (r, e) => {
11180
11184
  }, cc = (r) => {
11181
11185
  if (typeof r == "object")
11182
11186
  for (const e in r)
11183
- Object.prototype.hasOwnProperty.call(r, e) && (sr(r[e]) ? r[e] = "_DELETE_FIELD" : cc(r[e]));
11187
+ Object.prototype.hasOwnProperty.call(r, e) && (ir(r[e]) ? r[e] = "_DELETE_FIELD" : cc(r[e]));
11184
11188
  }, Ye = async (r, e, t, n, s, i, a, o, c) => {
11185
- const l = Mt(), { labels: u } = i, f = Ie(), h = gc(), d = await ie(f, ["global", "firebase", "writeLogTTL"]), m = {
11189
+ const l = Mt(), { labels: u } = i, f = Ie(), h = gc(), d = await ie(f, ["global", "firebase", "writeLogTTL"]), p = {
11186
11190
  operation: r,
11187
11191
  collection: u.collection,
11188
11192
  docId: s,
@@ -11197,13 +11201,13 @@ const fw = async (r, e) => {
11197
11201
  data: {}
11198
11202
  };
11199
11203
  if (d) {
11200
- const S = /* @__PURE__ */ new Date(), T = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() + d));
11201
- m.TTL = Bt.fromDate(T);
11204
+ const S = /* @__PURE__ */ new Date(), A = new Date((/* @__PURE__ */ new Date()).setDate(S.getDate() + d));
11205
+ p.TTL = Bt.fromDate(A);
11202
11206
  }
11203
11207
  const E = we(t);
11204
- r !== "delete" && (m.data.data = E, e === "written" && cc(m.data.data)), r !== "delete" && e !== "written" && tr(E), r === "update" && (m.data.originalRecord = we(c)), r !== "delete" && ["started", "written"].includes(e) && (delete m.data.data.Saved_At, delete m.data.data.Last_Save_At), e === "failed" && (m.data.error = JSON.stringify(o));
11208
+ r !== "delete" && (p.data.data = E, e === "written" && cc(p.data.data)), r !== "delete" && e !== "written" && tr(E), r === "update" && (p.data.originalRecord = we(c)), r !== "delete" && ["started", "written"].includes(e) && (delete p.data.data.Saved_At, delete p.data.data.Last_Save_At), e === "failed" && (p.data.error = JSON.stringify(o));
11205
11209
  const y = t.Last_Write_At, _ = ke(h, "tenants", l, n.join("/"), s, "system_write_log", `${a}-${y.valueOf()}`);
11206
- Gm(_, m).catch((S) => {
11210
+ Gm(_, p).catch((S) => {
11207
11211
  console.error(`Error saving "${e}" ${r} log entry for record ${s} in ${u.collection} collection.`, { cause: S });
11208
11212
  });
11209
11213
  }, lc = async (r, e, t, n, s) => {
@@ -11212,7 +11216,7 @@ const fw = async (r, e) => {
11212
11216
  throw new Error("No role found in permissions");
11213
11217
  if (await Promise.all(c.map(async (u) => {
11214
11218
  if (!u.access || u.access.includes(s.Role)) {
11215
- if (t[u.name] === void 0 || sr(t[u.name]))
11219
+ if (t[u.name] === void 0 || ir(t[u.name]))
11216
11220
  return;
11217
11221
  const f = t[u.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
11218
11222
  if (!ow(f))
@@ -11236,8 +11240,8 @@ const fw = async (r, e) => {
11236
11240
  if (f)
11237
11241
  d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${t.key}`, e));
11238
11242
  else if (h)
11239
- for (const m of h)
11240
- d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${m.field}`, e));
11243
+ for (const p of h)
11244
+ d.push(ke(n, "tenants", s, "system_fields", l.collection, `${l.collection}-${p.field}`, e));
11241
11245
  return d;
11242
11246
  }, yd = (r) => r !== null && typeof r == "object" && !Array.isArray(r), hm = (r) => {
11243
11247
  const e = (t) => {
@@ -11285,15 +11289,15 @@ const fw = async (r, e) => {
11285
11289
  only: i,
11286
11290
  pagination: t.limit,
11287
11291
  noEmbeddingFields: a
11288
- }).catch((m) => {
11289
- throw m.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${h} for document at ${e.join("/")}`), m;
11292
+ }).catch((p) => {
11293
+ throw p.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${h} for document at ${e.join("/")}`), p;
11290
11294
  });
11291
11295
  r[h] = d.docs, s && await Promise.all(
11292
11296
  // eslint-disable-next-line security/detect-object-injection
11293
- r[h].map((m) => uc(m, [...e, h, m.id], s, n, i, a))
11297
+ r[h].map((p) => uc(p, [...e, h, p.id], s, n, i, a))
11294
11298
  ), u > 0 && await Promise.all(
11295
11299
  // eslint-disable-next-line security/detect-object-injection
11296
- r[h].map((m) => mm(m, [...e, h, m.id], { depth: u }, n, s, i, a))
11300
+ r[h].map((p) => mm(p, [...e, h, p.id], { depth: u }, n, s, i, a))
11297
11301
  );
11298
11302
  });
11299
11303
  await Promise.all(f);
@@ -11310,12 +11314,12 @@ const fw = async (r, e) => {
11310
11314
  continue;
11311
11315
  const h = Object.keys(f);
11312
11316
  for (const d of h) {
11313
- const m = f[d], E = _r(m.Collection_Path, d, { only: s, noEmbeddingFields: i }).then((y) => {
11317
+ const p = f[d], E = vr(p.Collection_Path, d, { only: s, noEmbeddingFields: i }).then((y) => {
11314
11318
  if (f[d] = y, c > 0)
11315
11319
  return uc(
11316
11320
  // eslint-disable-next-line security/detect-object-injection
11317
11321
  f[d],
11318
- [...m.Collection_Path, d],
11322
+ [...p.Collection_Path, d],
11319
11323
  { depth: c },
11320
11324
  n,
11321
11325
  s,
@@ -11344,10 +11348,10 @@ const fw = async (r, e) => {
11344
11348
  const n = r.at(-1);
11345
11349
  if (!n)
11346
11350
  throw new Error("EMPTY_PATH");
11347
- const s = Ve(!0), a = Jr()[n], o = s.collections[n], { labels: c, access: l, preloadCache: u } = o, { serverReadOnly: f } = l, h = Ie(), d = Object.keys(s.collections).includes(n), m = h.disabledCollections?.includes(n);
11348
- if (!d || m)
11351
+ const s = Ve(!0), a = Jr()[n], o = s.collections[n], { labels: c, access: l, preloadCache: u } = o, { serverReadOnly: f } = l, h = Ie(), d = Object.keys(s.collections).includes(n), p = h.disabledCollections?.includes(n);
11352
+ if (!d || p)
11349
11353
  throw new Error("COLLECTION_NOT_FOUND");
11350
- const E = await lt(c.collection), y = await ie(h, [
11354
+ const E = await ut(c.collection), y = await ie(h, [
11351
11355
  "global",
11352
11356
  "firebase",
11353
11357
  "serverTimestampOptions"
@@ -11356,11 +11360,11 @@ const fw = async (r, e) => {
11356
11360
  throw new Error("PERMISSIONS_DENIED");
11357
11361
  if (f?.includes(_.Role))
11358
11362
  return await hw(r, e, t);
11359
- const S = oc(r, a, t?.getAll);
11363
+ const S = oc(r, a);
11360
11364
  if (S.length === 0)
11361
11365
  return { cursor: {}, pages: 0, docs: [] };
11362
- let T = S.map((b) => me(b, ...e || []));
11363
- const P = t?.pagination?.startAfter || t?.pagination?.endBefore || {
11366
+ let A = S.map((b) => he(b, ...e || []));
11367
+ const F = t?.pagination?.startAfter || t?.pagination?.endBefore || {
11364
11368
  first: /* @__PURE__ */ new Map(),
11365
11369
  last: /* @__PURE__ */ new Map()
11366
11370
  };
@@ -11370,28 +11374,28 @@ const fw = async (r, e) => {
11370
11374
  const b = t.pagination.startAfter || t.pagination.endBefore, w = Ud(_.Role, o, s);
11371
11375
  if (b && w !== !0)
11372
11376
  throw new Error("INPUT_ERROR: Pagination is not allowed when using " + w);
11373
- t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ? T = T.map((O, x) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), eo(P.last.get(x)), Xt(t.pagination.number))) : T = T.map((O, x) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), to(P.first.get(x)), Nr(t.pagination.number))) : T = T.map((O) => me(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), Xt(t.pagination.number))) : !t.pagination.startAfter && !t.pagination.endBefore ? T = T.map((O) => me(O, Xt(t.pagination.number))) : t.pagination.startAfter ? T = T.map((O, x) => me(O, eo(P.last.get(x)), Xt(t.pagination.number))) : T = T.map((O, x) => me(O, to(P.first.get(x)), Nr(t.pagination.number)));
11377
+ t.pagination.orderByField && t.pagination.orderByDirection ? t.pagination.startAfter || t.pagination.endBefore ? t.pagination.startAfter ? A = A.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), eo(F.last.get(x)), Xt(t.pagination.number))) : A = A.map((O, x) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), to(F.first.get(x)), Fr(t.pagination.number))) : A = A.map((O) => he(O, rt(t.pagination.orderByField, t.pagination.orderByDirection), Xt(t.pagination.number))) : !t.pagination.startAfter && !t.pagination.endBefore ? A = A.map((O) => he(O, Xt(t.pagination.number))) : t.pagination.startAfter ? A = A.map((O, x) => he(O, eo(F.last.get(x)), Xt(t.pagination.number))) : A = A.map((O, x) => he(O, to(F.first.get(x)), Fr(t.pagination.number)));
11374
11378
  }
11375
- const g = { collection: c.collection };
11376
- await ce("preOperation", h, E, ["read", void 0, void 0, g]), await ce("preRead", h, E, [g, T, !0, !1]);
11377
- const v = /* @__PURE__ */ new Map(), A = T.map(async (b) => {
11379
+ const m = { collection: c.collection };
11380
+ await ce("preOperation", h, E, ["read", void 0, void 0, m]), await ce("preRead", h, E, [m, A, !0, !1]);
11381
+ const v = /* @__PURE__ */ new Map(), C = A.map(async (b) => {
11378
11382
  let w;
11379
11383
  return t?.only === "cache" ? w = await Od(b) : t?.only === "server" ? w = await Hm(b) : w = await Km(b), w;
11380
- }), p = await Promise.all(A);
11381
- for (const b of p) {
11384
+ }), g = await Promise.all(C);
11385
+ for (const b of g) {
11382
11386
  for (const w of b.docs) {
11383
11387
  v.has(w.id) || v.set(w.id, {});
11384
11388
  const O = w.data({ serverTimestamps: y || "none" }), x = v.get(w.id);
11385
11389
  x.id ||= w.id;
11386
- const M = { ...x, ...O };
11387
- delete M.Collection_Path_String, v.set(w.id, M);
11390
+ const P = { ...x, ...O };
11391
+ delete P.Collection_Path_String, v.set(w.id, P);
11388
11392
  }
11389
- P.first.set(p.indexOf(b), b.docs[0]), P.last.set(p.indexOf(b), b.docs.at(-1) || b.docs[0]);
11393
+ F.first.set(g.indexOf(b), b.docs[0]), F.last.set(g.indexOf(b), b.docs.at(-1) || b.docs[0]);
11390
11394
  }
11391
11395
  let k;
11392
11396
  if (t?.pagination && !u?.roles.includes(_?.Role) && !f?.includes(_?.Role)) {
11393
- let b = me(S[0], ...e || []);
11394
- t.pagination.orderByField && t.pagination.orderByDirection && (b = me(b, rt(t.pagination.orderByField, t.pagination.orderByDirection)));
11397
+ let b = he(S[0], ...e || []);
11398
+ t.pagination.orderByField && t.pagination.orderByDirection && (b = he(b, rt(t.pagination.orderByField, t.pagination.orderByDirection)));
11395
11399
  const w = await Ed(b).catch(() => {
11396
11400
  });
11397
11401
  if (w) {
@@ -11435,10 +11439,10 @@ const fw = async (r, e) => {
11435
11439
  b[q.name] = z;
11436
11440
  })), t?.noEmbeddingFields && q.type === "Embedding" && delete b[q.name];
11437
11441
  await Promise.all(x);
11438
- const M = ["read", b, b.id, g];
11439
- await ce("postOperation", h, E, M), await ce("postRead", h, E, [g, S, b, !1]);
11442
+ const P = ["read", b, b.id, m];
11443
+ await ce("postOperation", h, E, P), await ce("postRead", h, E, [m, S, b, !1]);
11440
11444
  }
11441
- return { cursor: P, pages: k, docs: Array.from(v.values()) };
11445
+ return { cursor: F, pages: k, docs: Array.from(v.values()) };
11442
11446
  }, mw = async (r, e, t) => {
11443
11447
  const n = it(), s = ze(), i = Ue(n, s.STOKER_FB_FUNCTIONS_REGION), l = (await Je(i, "stoker-readapi")({
11444
11448
  path: r,
@@ -11482,8 +11486,8 @@ const fw = async (r, e) => {
11482
11486
  const h = r[f.name];
11483
11487
  if (!h)
11484
11488
  continue;
11485
- for (const [d, m] of Object.entries(h)) {
11486
- const E = _r(m.Collection_Path, d, {
11489
+ for (const [d, p] of Object.entries(h)) {
11490
+ const E = vr(p.Collection_Path, d, {
11487
11491
  only: s,
11488
11492
  noComputedFields: i,
11489
11493
  noEmbeddingFields: a
@@ -11492,7 +11496,7 @@ const fw = async (r, e) => {
11492
11496
  return gm(
11493
11497
  // eslint-disable-next-line security/detect-object-injection
11494
11498
  h[d],
11495
- [...m.Collection_Path, d],
11499
+ [...p.Collection_Path, d],
11496
11500
  { depth: l },
11497
11501
  n,
11498
11502
  s,
@@ -11509,7 +11513,7 @@ const fw = async (r, e) => {
11509
11513
  }
11510
11514
  }
11511
11515
  await Promise.all(u);
11512
- }, _r = async (r, e, t) => {
11516
+ }, vr = async (r, e, t) => {
11513
11517
  if (t?.subcollections?.depth && t.subcollections.depth > 10)
11514
11518
  throw new Error("INPUT_ERROR: Subcollections depth cannot exceed 10");
11515
11519
  if (t?.relations?.depth && t.relations.depth > 10)
@@ -11524,27 +11528,27 @@ const fw = async (r, e) => {
11524
11528
  "global",
11525
11529
  "firebase",
11526
11530
  "serverTimestampOptions"
11527
- ]), f = s.collections[n], { labels: h, access: d } = f, { serverReadOnly: m } = d, E = lt(h.collection), y = De();
11531
+ ]), f = s.collections[n], { labels: h, access: d } = f, { serverReadOnly: p } = d, E = ut(h.collection), y = De();
11528
11532
  if (!y?.Role)
11529
11533
  throw new Error("PERMISSIONS_DENIED");
11530
- if (m?.includes(y.Role))
11534
+ if (p?.includes(y.Role))
11531
11535
  return await mw(r, e, t);
11532
11536
  const _ = dm(r, e, a);
11533
11537
  if (_.length === 0)
11534
11538
  throw new Error("PERMISSION_DENIED");
11535
11539
  const S = { collection: h.collection };
11536
11540
  await ce("preOperation", o, E, ["read", void 0, e, S]), await ce("preRead", o, E, [S, _, !1, !1]);
11537
- let g = {};
11538
- const C = _.map(async (I) => {
11541
+ let m = {};
11542
+ const T = _.map(async (I) => {
11539
11543
  let b;
11540
11544
  if (t?.only === "cache" ? b = await Ym(I) : t?.only === "server" ? b = await Jm(I) : b = await bd(I), !b.exists())
11541
11545
  throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${r?.join("/") || h.collection}`);
11542
11546
  return { id: b.id, data: b.data({ serverTimestamps: u || "none" }) };
11543
- }), R = await Promise.all(C);
11547
+ }), R = await Promise.all(T);
11544
11548
  for (const I of R)
11545
- g.id ||= I.id, g = { ...g, ...I.data }, delete g.Collection_Path_String;
11546
- const v = [], A = r ? [...r, e] : [h.collection, e];
11547
- if (t?.subcollections && v.push(ym(g, A, we(t.subcollections), s, we(t?.relations), t?.only)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((I) => {
11549
+ m.id ||= I.id, m = { ...m, ...I.data }, delete m.Collection_Path_String;
11550
+ const v = [], C = r ? [...r, e] : [h.collection, e];
11551
+ if (t?.subcollections && v.push(ym(m, C, we(t.subcollections), s, we(t?.relations), t?.only)), t?.relations && (t.relations.fields && (t.relations.fields = t.relations.fields.map((I) => {
11548
11552
  if (typeof I == "string") {
11549
11553
  const b = f.fields.find((w) => w.name === I);
11550
11554
  if (b)
@@ -11552,13 +11556,13 @@ const fw = async (r, e) => {
11552
11556
  throw new Error(`SCHEMA_ERROR: Field ${I} not found in collection ${n}`);
11553
11557
  }
11554
11558
  return I;
11555
- })), v.push(gm(g, A, we(t.relations), s, t?.only, t?.noComputedFields, t?.noEmbeddingFields))), await Promise.all(v), !t?.noComputedFields)
11559
+ })), v.push(gm(m, C, we(t.relations), s, t?.only, t?.noComputedFields, t?.noEmbeddingFields))), await Promise.all(v), !t?.noComputedFields)
11556
11560
  for (const I of f.fields)
11557
- I.type === "Computed" && (g[I.name] = await I.formula(g));
11561
+ I.type === "Computed" && (m[I.name] = await I.formula(m));
11558
11562
  if (t?.noEmbeddingFields)
11559
11563
  for (const I of f.fields)
11560
- I.type === "Embedding" && delete g[I.name];
11561
- return await ce("postOperation", o, E, ["read", g, e, S]), await ce("postRead", o, E, [S, _, g, !1]), g;
11564
+ I.type === "Embedding" && delete m[I.name];
11565
+ return await ce("postOperation", o, E, ["read", m, e, S]), await ce("postRead", o, E, [S, _, m, !1]), m;
11562
11566
  }, pw = (r) => r !== null && typeof r == "object", _m = (r) => {
11563
11567
  const e = (t) => {
11564
11568
  Object.entries(t).forEach(([n, s]) => {
@@ -11579,32 +11583,32 @@ const fw = async (r, e) => {
11579
11583
  user: n
11580
11584
  })).data?.result;
11581
11585
  }, fc = async (r, e, t, n, s, i) => {
11582
- const a = Mt(), o = Ve(), c = Ve(!0), l = yc(), u = Ie(), f = fr(), h = We(), d = De();
11586
+ const a = Mt(), o = Ve(), c = Ve(!0), l = yc(), u = Ie(), f = dr(), h = We(), d = De();
11583
11587
  if (r.length === 0)
11584
11588
  throw new Error("EMPTY_PATH");
11585
- const m = r.at(-1), E = Object.keys(o.collections).includes(m), y = u.disabledCollections?.includes(m);
11589
+ const p = r.at(-1), E = Object.keys(o.collections).includes(p), y = u.disabledCollections?.includes(p);
11586
11590
  if (!E || y)
11587
11591
  throw new Error("COLLECTION_NOT_FOUND");
11588
- const _ = o.collections[m], { labels: S, access: T, fields: P, enableWriteLog: g } = _, { serverWriteOnly: C } = T, R = lt(S.collection), v = await ie(u, ["global", "appName"]), A = s?.retry, p = f.currentUser;
11589
- if (!p)
11592
+ const _ = o.collections[p], { labels: S, access: A, fields: F, enableWriteLog: m } = _, { serverWriteOnly: T } = A, R = ut(S.collection), v = await ie(u, ["global", "appName"]), C = s?.retry, g = f.currentUser;
11593
+ if (!g)
11590
11594
  throw new Error("NOT_AUTHENTICATED");
11591
11595
  if (!d)
11592
11596
  throw new Error("PERMISSION_DENIED");
11593
11597
  if (bm(e))
11594
11598
  throw new Error("RECORD_BUSY");
11595
- i = A?.originalRecord || i || await _r(r, e, { noComputedFields: !0, noEmbeddingFields: !0 });
11596
- for (const F of c.collections[m].fields)
11597
- F.type === "Computed" && (delete t[F.name], delete i[F.name]);
11599
+ i = C?.originalRecord || i || await vr(r, e, { noComputedFields: !0, noEmbeddingFields: !0 });
11600
+ for (const D of c.collections[p].fields)
11601
+ D.type === "Computed" && (delete t[D.name], delete i[D.name]);
11598
11602
  const k = Ao(h), I = { collection: S.collection }, b = _.auth && n?.operation === "create", w = _.auth && n?.operation === "delete", O = _.auth && !b && !w && (n?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL), x = await ie(R, [
11599
11603
  "collections",
11600
11604
  S.collection,
11601
11605
  "custom",
11602
11606
  "disableOfflineUpdate"
11603
- ]), M = () => {
11604
- if (zt() === "Offline" && (x || C || _.auth && (b || O || w)))
11607
+ ]), P = () => {
11608
+ if (zt() === "Offline" && (x || T || _.auth && (b || O || w)))
11605
11609
  throw new Error("CLIENT_OFFLINE");
11606
11610
  };
11607
- if (M(), C || b || O || w) {
11611
+ if (P(), T || b || O || w) {
11608
11612
  if (b) {
11609
11613
  if (!n.password)
11610
11614
  throw new Error("VALIDATION_ERROR: Password is required");
@@ -11613,7 +11617,7 @@ const fw = async (r, e) => {
11613
11617
  if (n.password !== n.passwordConfirm)
11614
11618
  throw new Error("VALIDATION_ERROR: Passwords do not match");
11615
11619
  if (!await ie(u, ["global", "firebase", "enableEmulators"])) {
11616
- M();
11620
+ P();
11617
11621
  try {
11618
11622
  const { isValid: Me } = await _d(f, n.password);
11619
11623
  if (!Me)
@@ -11623,86 +11627,86 @@ const fw = async (r, e) => {
11623
11627
  }
11624
11628
  }
11625
11629
  }
11626
- const F = [
11630
+ const D = [
11627
11631
  "update",
11628
11632
  { ...i, ...t },
11629
11633
  I,
11630
11634
  k,
11631
11635
  we(i)
11632
11636
  ];
11633
- return await ce("preValidate", u, R, F), await yw(r, e, t, n ? { operation: n.operation, permissions: n.permissions, password: n.password } : void 0);
11637
+ return await ce("preValidate", u, R, D), await yw(r, e, t, n ? { operation: n.operation, permissions: n.permissions, password: n.password } : void 0);
11634
11638
  }
11635
11639
  delete t.id;
11636
- const D = Ko("update", r, t, o, v, zt(), p.uid, Bt.now(), Lr(), !!A);
11637
- for (const F of P)
11638
- !_e(F) && sr(D[F.name]) && F.nullable && (D[F.name] = null);
11639
- if (Nt(D), Nt(i), !A && g && Ye("update", "started", D, r, e, _, p.uid, void 0, i), !A) {
11640
- const F = [
11640
+ const M = Ko("update", r, t, o, v, zt(), g.uid, Bt.now(), Lr(), !!C);
11641
+ for (const D of F)
11642
+ !_e(D) && ir(M[D.name]) && D.nullable && (M[D.name] = null);
11643
+ if (Nt(M), Nt(i), !C && m && Ye("update", "started", M, r, e, _, g.uid, void 0, i), !C) {
11644
+ const D = [
11641
11645
  "update",
11642
- D,
11646
+ M,
11643
11647
  e,
11644
11648
  I,
11645
11649
  k,
11646
11650
  we(i)
11647
11651
  ];
11648
- await ce("preOperation", u, R, F);
11649
- const te = ["update", D, e, I, k, we(i)];
11652
+ await ce("preOperation", u, R, D);
11653
+ const te = ["update", M, e, I, k, we(i)];
11650
11654
  await ce("preWrite", u, R, te);
11651
11655
  }
11652
- if (Xd(_, D, o), eh(_, D), !A)
11656
+ if (Xd(_, M, o), eh(_, M), !C)
11653
11657
  try {
11654
- const F = { ...i, ...D };
11655
- tr(F), await om("update", F, _, R, ["update", F, I, k, we(i)], o), x && (M(), await lc("update", e, D, _, d));
11656
- } catch (F) {
11657
- throw new Error(`VALIDATION_ERROR: ${F.message}`);
11658
+ const D = { ...i, ...M };
11659
+ tr(D), await om("update", D, _, R, ["update", D, I, k, we(i)], o), x && (P(), await lc("update", e, M, _, d));
11660
+ } catch (D) {
11661
+ throw new Error(`VALIDATION_ERROR: ${D.message}`);
11658
11662
  }
11659
- if (Oy(D, i, e, _, o, p.uid, d), Nt(D), ac("update", k, r, e, D, o, _, s, l, Io, ko, Cn, (F) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${F.name}`, e), (F, te) => ke(h, "tenants", a, "system_unique", S.collection, `Unique-${S.collection}-${F.name}`, te), (F) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${F}`, e)), k.update(ke(h, "tenants", a, r.join("/"), e), D), !A && g && Ye("update", "written", D, r, e, _, p.uid, void 0, i), await dc("update", r, e, D, I, _, R, k, p.uid, g || !1, d, !!A, i), A?.type === "unique") {
11660
- const F = { ...i, ...D };
11661
- return tr(F), { id: e, ...F };
11663
+ if (Oy(M, i, e, _, o, g.uid, d), Nt(M), ac("update", k, r, e, M, o, _, s, l, Io, ko, Cn, (D) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${D.name}`, e), (D, te) => ke(h, "tenants", a, "system_unique", S.collection, `Unique-${S.collection}-${D.name}`, te), (D) => ke(h, "tenants", a, "system_fields", S.collection, `${S.collection}-${D}`, e)), k.update(ke(h, "tenants", a, r.join("/"), e), M), !C && m && Ye("update", "written", M, r, e, _, g.uid, void 0, i), await dc("update", r, e, M, I, _, R, k, g.uid, m || !1, d, !!C, i), C?.type === "unique") {
11664
+ const D = { ...i, ...M };
11665
+ return tr(D), { id: e, ...D };
11662
11666
  }
11663
- g && Ye("update", "success", D, r, e, _, p.uid, void 0, i);
11664
- const q = ["update", D, e, I, !!A, we(i)], z = [...q];
11667
+ m && Ye("update", "success", M, r, e, _, g.uid, void 0, i);
11668
+ const q = ["update", M, e, I, !!C, we(i)], z = [...q];
11665
11669
  await ce("postWrite", u, R, q), await ce("postOperation", u, R, z);
11666
- const ee = { ...i, ...D };
11670
+ const ee = { ...i, ...M };
11667
11671
  return tr(ee), { id: e, ...ee };
11668
11672
  }, dc = async (r, e, t, n, s, i, a, o, c, l, u, f, h) => {
11669
- const d = Ve(), m = Ie(), { labels: E } = i;
11673
+ const d = Ve(), p = Ie(), { labels: E } = i;
11670
11674
  let y = 0;
11671
11675
  const _ = async () => {
11672
11676
  try {
11673
11677
  await we(o).commit();
11674
11678
  return;
11675
11679
  } catch (S) {
11676
- let T;
11677
- const P = await ie(a, [
11680
+ let A;
11681
+ const F = await ie(a, [
11678
11682
  "collections",
11679
11683
  E.collection,
11680
11684
  "custom",
11681
11685
  "autoCorrectUnique"
11682
11686
  ]);
11683
- if (S.code === "unavailable" && await ve(m.onIndexedDBConnectionLost), r !== "delete" && S.code === "permission-denied")
11687
+ if (S.code === "unavailable" && await ve(p.onIndexedDBConnectionLost), r !== "delete" && S.code === "permission-denied")
11684
11688
  try {
11685
11689
  await lc(r, t, n, i, u);
11686
- } catch (A) {
11687
- const p = A.message.split(", "), k = [], I = [];
11690
+ } catch (C) {
11691
+ const g = C.message.split(", "), k = [], I = [];
11688
11692
  let b = !1;
11689
- for (const w of p) {
11690
- const O = w.split(" ")[0], x = d.collections[E.collection].fields.find((M) => M.name === O);
11693
+ for (const w of g) {
11694
+ const O = w.split(" ")[0], x = d.collections[E.collection].fields.find((P) => P.name === O);
11691
11695
  if (!x)
11692
11696
  throw new Error(`SCHEMA_ERROR: Field ${O} not found in ${E.collection} schema`);
11693
11697
  x.type === "Number" && k.push(w), x.type === "String" && I.push(w);
11694
11698
  }
11695
- if ((!P || k.length > 0) && (T = new Error(`VALIDATION_ERROR: ${p.join(", ")}`)), P && I.length > 0) {
11699
+ if ((!F || k.length > 0) && (A = new Error(`VALIDATION_ERROR: ${g.join(", ")}`)), F && I.length > 0) {
11696
11700
  for (const w of I) {
11697
11701
  const O = w.split(" ")[0];
11698
- if (d.collections[E.collection].fields.find((D) => D.name === O).type === "Number")
11702
+ if (d.collections[E.collection].fields.find((M) => M.name === O).type === "Number")
11699
11703
  continue;
11700
- let M = 1;
11701
- n[O].match(/ - DUPLICATE-\d+/) ? (M = parseInt(
11704
+ let P = 1;
11705
+ n[O].match(/ - DUPLICATE-\d+/) ? (P = parseInt(
11702
11706
  // eslint-disable-next-line security/detect-object-injection
11703
11707
  n[O].match(/ - DUPLICATE-\d+/)[0].split("-")[2]
11704
11708
  ), n[O] = // eslint-disable-next-line security/detect-object-injection
11705
- n[O].replace(/ - DUPLICATE-\d+/g, "") + ` - DUPLICATE-${M + 1}`) : n[O] = n[O] + " - DUPLICATE-1", M < 10 ? b = !0 : T = new Error(p.map((D) => D.replace(/ - DUPLICATE-\d+/g, "")).join(", "));
11709
+ n[O].replace(/ - DUPLICATE-\d+/g, "") + ` - DUPLICATE-${P + 1}`) : n[O] = n[O] + " - DUPLICATE-1", P < 10 ? b = !0 : A = new Error(g.map((M) => M.replace(/ - DUPLICATE-\d+/g, "")).join(", "));
11706
11710
  }
11707
11711
  if (b) {
11708
11712
  r === "create" && await vm(e, n, void 0, { retry: { type: "unique", docId: t } }), r === "update" && await fc(e, t, n, void 0, {
@@ -11716,17 +11720,17 @@ const fw = async (r, e) => {
11716
11720
  }
11717
11721
  }
11718
11722
  }
11719
- const g = T || S, C = [
11723
+ const m = A || S, T = [
11720
11724
  r,
11721
11725
  n,
11722
11726
  t,
11723
11727
  s,
11724
- g,
11728
+ m,
11725
11729
  o,
11726
11730
  f,
11727
11731
  y,
11728
11732
  r === "update" ? h : void 0
11729
- ], R = S.code === "unavailable", v = await ce("postWriteError", m, a, C);
11733
+ ], R = S.code === "unavailable", v = await ce("postWriteError", p, a, T);
11730
11734
  if (v?.resolved)
11731
11735
  return;
11732
11736
  if (!R && v?.retry) {
@@ -11741,11 +11745,11 @@ const fw = async (r, e) => {
11741
11745
  t,
11742
11746
  i,
11743
11747
  c,
11744
- g,
11748
+ m,
11745
11749
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11746
11750
  r === "update" ? h : void 0
11747
11751
  );
11748
- throw g;
11752
+ throw m;
11749
11753
  }
11750
11754
  };
11751
11755
  await _();
@@ -11759,29 +11763,29 @@ const fw = async (r, e) => {
11759
11763
  id: n
11760
11764
  })).data?.result;
11761
11765
  }, vm = async (r, e, t, n, s, i) => {
11762
- const a = Mt(), o = Ve(), c = yc(), l = Ie(), u = fr(), f = We(), h = De();
11766
+ const a = Mt(), o = Ve(), c = yc(), l = Ie(), u = dr(), f = We(), h = De();
11763
11767
  if (r.length === 0)
11764
11768
  throw new Error("EMPTY_PATH");
11765
- const d = r.at(-1), m = Object.keys(o.collections).includes(d), E = l.disabledCollections?.includes(d);
11766
- if (!m || E)
11769
+ const d = r.at(-1), p = Object.keys(o.collections).includes(d), E = l.disabledCollections?.includes(d);
11770
+ if (!p || E)
11767
11771
  throw new Error("COLLECTION_NOT_FOUND");
11768
- const y = o.collections[d], { labels: _, access: S, enableWriteLog: T, softDelete: P } = y, { serverWriteOnly: g } = S, C = lt(_.collection), R = await ie(l, ["global", "appName"]), v = n?.retry, A = u.currentUser;
11769
- if (!A)
11772
+ const y = o.collections[d], { labels: _, access: S, enableWriteLog: A, softDelete: F } = y, { serverWriteOnly: m } = S, T = ut(_.collection), R = await ie(l, ["global", "appName"]), v = n?.retry, C = u.currentUser;
11773
+ if (!C)
11770
11774
  throw new Error("NOT_AUTHENTICATED");
11771
11775
  if (!h)
11772
11776
  throw new Error("PERMISSION_DENIED");
11773
- const p = await ie(C, [
11777
+ const g = await ie(T, [
11774
11778
  "collections",
11775
11779
  _.collection,
11776
11780
  "custom",
11777
11781
  "disableOfflineCreate"
11778
11782
  ]), k = () => {
11779
- if (zt() === "Offline" && (p || g || y.auth && t))
11783
+ if (zt() === "Offline" && (g || m || y.auth && t))
11780
11784
  throw new Error("CLIENT_OFFLINE");
11781
11785
  };
11782
11786
  k();
11783
11787
  const I = Ao(f), b = v?.docId || s || ke(qr(f, "tenants", a, _.collection)).id, w = { collection: _.collection };
11784
- if (g || y.auth && t) {
11788
+ if (m || y.auth && t) {
11785
11789
  if (k(), y.auth && t) {
11786
11790
  if (!t.password)
11787
11791
  throw new Error("VALIDATION_ERROR: Password is required");
@@ -11800,21 +11804,21 @@ const fw = async (r, e) => {
11800
11804
  }
11801
11805
  }
11802
11806
  }
11803
- return await ce("preValidate", l, C, ["create", e, w, I]), i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0, b);
11807
+ return await ce("preValidate", l, T, ["create", e, w, I]), i && i(), await gw(r, e, t ? { permissions: t.permissions, password: t.password } : void 0, b);
11804
11808
  }
11805
11809
  e.id = b;
11806
- const O = Ko("create", r, e, o, R, zt(), A.uid, Bt.now(), Lr(), !!v);
11807
- if (P && (O[P.archivedField] = !1), Nt(O), !v && T && Ye("create", "started", O, r, b, y, A.uid), v || (await ce("preOperation", l, C, ["create", O, b, w, I]), await ce("preWrite", l, C, ["create", O, b, w, I])), Xd(y, O, o), eh(y, O), v || await hg(O, y, C, h.Role), !v)
11810
+ const O = Ko("create", r, e, o, R, zt(), C.uid, Bt.now(), Lr(), !!v);
11811
+ if (F && (O[F.archivedField] = !1), Nt(O), !v && A && Ye("create", "started", O, r, b, y, C.uid), v || (await ce("preOperation", l, T, ["create", O, b, w, I]), await ce("preWrite", l, T, ["create", O, b, w, I])), Xd(y, O, o), eh(y, O), v || await hg(O, y, T, h.Role), !v)
11808
11812
  try {
11809
- await om("create", O, y, C, ["create", O, w, I], o), p && (k(), await lc("create", b, O, y, h));
11813
+ await om("create", O, y, T, ["create", O, w, I], o), g && (k(), await lc("create", b, O, y, h));
11810
11814
  } catch (q) {
11811
11815
  throw new Error(`VALIDATION_ERROR: ${q.message}`);
11812
11816
  }
11813
- if (i && i(), Nt(O), by(O, b, y, o, A.uid, h), ac("create", I, r, b, O, o, y, n, c, Io, ko, Cn, (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q.name}`, b), (q, z) => ke(f, "tenants", a, "system_unique", _.collection, `Unique-${_.collection}-${q.name}`, z), (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q}`, b)), I.set(ke(f, "tenants", a, r.join("/"), b), O), !v && T && Ye("create", "written", O, r, b, y, A.uid), await dc("create", r, b, O, w, y, C, I, A.uid, T || !1, h, !!v), v?.type === "unique")
11817
+ if (i && i(), Nt(O), by(O, b, y, o, C.uid, h), ac("create", I, r, b, O, o, y, n, c, Io, ko, Cn, (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q.name}`, b), (q, z) => ke(f, "tenants", a, "system_unique", _.collection, `Unique-${_.collection}-${q.name}`, z), (q) => ke(f, "tenants", a, "system_fields", _.collection, `${_.collection}-${q}`, b)), I.set(ke(f, "tenants", a, r.join("/"), b), O), !v && A && Ye("create", "written", O, r, b, y, C.uid), await dc("create", r, b, O, w, y, T, I, C.uid, A || !1, h, !!v), v?.type === "unique")
11814
11818
  return { id: b, ...O };
11815
- T && Ye("create", "success", O, r, b, y, A.uid);
11816
- const x = ["create", O, b, w, !!v], M = [...x];
11817
- return await ce("postWrite", l, C, x), await ce("postOperation", l, C, M), { id: b, ...O };
11819
+ A && Ye("create", "success", O, r, b, y, C.uid);
11820
+ const x = ["create", O, b, w, !!v], P = [...x];
11821
+ return await ce("postWrite", l, T, x), await ce("postOperation", l, T, P), { id: b, ...O };
11818
11822
  }, _w = async (r, e) => {
11819
11823
  const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
11820
11824
  return (await Je(s, "stoker-writeapi", { timeout: 540 * 1e3 })({
@@ -11823,14 +11827,14 @@ const fw = async (r, e) => {
11823
11827
  id: e
11824
11828
  })).data?.result;
11825
11829
  }, vw = async (r, e, t) => {
11826
- const n = Mt(), s = Ve(), i = yc(), a = fr(), o = We(), c = Ie(), l = De();
11830
+ const n = Mt(), s = Ve(), i = yc(), a = dr(), o = We(), c = Ie(), l = De();
11827
11831
  if (r.length === 0)
11828
11832
  throw new Error("EMPTY_PATH");
11829
11833
  const u = r.at(-1), f = Object.keys(s.collections).includes(u), h = c.disabledCollections?.includes(u);
11830
11834
  if (!f || h)
11831
11835
  throw new Error("COLLECTION_NOT_FOUND");
11832
- const d = s.collections[u], { labels: m, access: E, enableWriteLog: y, softDelete: _ } = d, { serverWriteOnly: S } = E, T = lt(m.collection), P = await ie(c, ["global", "appName"]), g = t?.retry, C = a.currentUser;
11833
- if (!C)
11836
+ const d = s.collections[u], { labels: p, access: E, enableWriteLog: y, softDelete: _ } = d, { serverWriteOnly: S } = E, A = ut(p.collection), F = await ie(c, ["global", "appName"]), m = t?.retry, T = a.currentUser;
11837
+ if (!T)
11834
11838
  throw new Error("NOT_AUTHENTICATED");
11835
11839
  if (!l)
11836
11840
  throw new Error("PERMISSION_DENIED");
@@ -11839,9 +11843,9 @@ const fw = async (r, e) => {
11839
11843
  [_.archivedField]: !0,
11840
11844
  [_.timestampField]: Lr()
11841
11845
  });
11842
- const R = await ie(T, [
11846
+ const R = await ie(A, [
11843
11847
  "collections",
11844
- m.collection,
11848
+ p.collection,
11845
11849
  "custom",
11846
11850
  "disableOfflineDelete"
11847
11851
  ]);
@@ -11850,19 +11854,19 @@ const fw = async (r, e) => {
11850
11854
  throw new Error("CLIENT_OFFLINE");
11851
11855
  })(), bm(e))
11852
11856
  throw new Error("RECORD_BUSY");
11853
- let A;
11857
+ let C;
11854
11858
  try {
11855
- A = await _r(r, e);
11856
- } catch (M) {
11857
- throw y && g?.record && M.message.indexOf("NOT_FOUND") !== -1 && await Ye("delete", "failed", g?.record, r, e, d, C.uid, M), M;
11859
+ C = await vr(r, e);
11860
+ } catch (P) {
11861
+ throw y && m?.record && P.message.indexOf("NOT_FOUND") !== -1 && await Ye("delete", "failed", m?.record, r, e, d, T.uid, P), P;
11858
11862
  }
11859
- if (S || d.auth && A.User_ID)
11863
+ if (S || d.auth && C.User_ID)
11860
11864
  return await _w(r, e);
11861
- delete A.id;
11862
- const p = Ao(o), k = { collection: m.collection }, I = Ko("delete", r, A, s, P, zt(), C.uid, Bt.now(), Lr(), !!g);
11863
- Nt(I), !g && y && Ye("delete", "started", I, r, e, d, C.uid), g || (await ce("preOperation", c, T, ["delete", I, e, k, p]), await ce("preWrite", c, T, ["delete", I, e, k, p])), Nt(I), Ey(I, e, d, s, C.uid, l), ac("delete", p, r, e, I, s, d, t, i, Io, ko, Cn, (M) => ke(o, "tenants", n, "system_fields", m.collection, `${m.collection}-${M.name}`, e), (M, D) => ke(o, "tenants", n, "system_unique", m.collection, `Unique-${m.collection}-${M.name}`, D), (M) => ke(o, "tenants", n, "system_fields", m.collection, `${m.collection}-${M}`, e)), p.delete(ke(o, "tenants", n, r.join("/"), e)), !g && y && Ye("delete", "written", I, r, e, d, C.uid), await dc("delete", r, e, I, k, d, T, p, C.uid, y || !1, l, !!g), y && Ye("delete", "success", { ...I, ...g?.record || {} }, r, e, d, C.uid);
11864
- const w = ["delete", I, e, k, !!g], O = [...w];
11865
- return await ce("postWrite", c, T, w), await ce("postOperation", c, T, O), { id: e, ...I };
11865
+ delete C.id;
11866
+ const g = Ao(o), k = { collection: p.collection }, I = Ko("delete", r, C, s, F, zt(), T.uid, Bt.now(), Lr(), !!m);
11867
+ Nt(I), !m && y && Ye("delete", "started", I, r, e, d, T.uid), m || (await ce("preOperation", c, A, ["delete", I, e, k, g]), await ce("preWrite", c, A, ["delete", I, e, k, g])), Nt(I), Ey(I, e, d, s, T.uid, l), ac("delete", g, r, e, I, s, d, t, i, Io, ko, Cn, (P) => ke(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${P.name}`, e), (P, M) => ke(o, "tenants", n, "system_unique", p.collection, `Unique-${p.collection}-${P.name}`, M), (P) => ke(o, "tenants", n, "system_fields", p.collection, `${p.collection}-${P}`, e)), g.delete(ke(o, "tenants", n, r.join("/"), e)), !m && y && Ye("delete", "written", I, r, e, d, T.uid), await dc("delete", r, e, I, k, d, A, g, T.uid, y || !1, l, !!m), y && Ye("delete", "success", { ...I, ...m?.record || {} }, r, e, d, T.uid);
11868
+ const w = ["delete", I, e, k, !!m], O = [...w];
11869
+ return await ce("postWrite", c, A, w), await ce("postOperation", c, A, O), { id: e, ...I };
11866
11870
  }, wm = (r) => {
11867
11871
  if (typeof r == "object")
11868
11872
  for (const e in r)
@@ -11871,18 +11875,18 @@ const fw = async (r, e) => {
11871
11875
  const t = it(), n = ze(), s = Ue(t, n.STOKER_FB_FUNCTIONS_REGION);
11872
11876
  return (await Je(s, r)(e)).data;
11873
11877
  };
11874
- let mt = {};
11878
+ let pt = {};
11875
11879
  const bw = async (r, e) => {
11876
- const t = fr(), n = gc(), s = t.currentUser;
11880
+ const t = dr(), n = gc(), s = t.currentUser;
11877
11881
  if (s?.uid !== e.uid)
11878
11882
  return;
11879
- const i = await Od(me(Qm(n, "system_write_log"), ye("status", "==", "written"), ye("user", "==", e.uid), rt("Last_Write_At", "asc")));
11883
+ const i = await Od(he(Qm(n, "system_write_log"), ye("status", "==", "written"), ye("user", "==", e.uid), rt("Last_Write_At", "asc")));
11880
11884
  await new Promise((o) => setTimeout(o, 1e4));
11881
11885
  const a = Om();
11882
11886
  if (a?.version)
11883
11887
  for (const o of i.docs) {
11884
- mt[o.id] ??= 0;
11885
- const c = o.data(), { data: l, operation: u, docId: f, collection: h, Collection_Path: d, Last_Write_Version: m } = c;
11888
+ pt[o.id] ??= 0;
11889
+ const c = o.data(), { data: l, operation: u, docId: f, collection: h, Collection_Path: d, Last_Write_Version: p } = c;
11886
11890
  await new Promise((_) => setTimeout(_, 1e3));
11887
11891
  const E = await ww("stoker-writelog", {
11888
11892
  path: d,
@@ -11893,7 +11897,7 @@ const bw = async (r, e) => {
11893
11897
  continue;
11894
11898
  if (s?.uid !== e.uid)
11895
11899
  return;
11896
- if (a.force && m !== a.version) {
11900
+ if (a.force && p !== a.version) {
11897
11901
  Ye(
11898
11902
  u,
11899
11903
  "failed",
@@ -11904,32 +11908,32 @@ const bw = async (r, e) => {
11904
11908
  // eslint-disable-next-line security/detect-object-injection
11905
11909
  r.collections[h],
11906
11910
  e.uid,
11907
- `Version mismatch- write log version ${m} not compatible with forced version ${a.version}`,
11911
+ `Version mismatch- write log version ${p} not compatible with forced version ${a.version}`,
11908
11912
  u === "update" ? l.originalRecord : void 0
11909
11913
  );
11910
11914
  continue;
11911
11915
  }
11912
11916
  const y = localStorage.getItem(`stoker-retry-${f}`);
11913
11917
  if (y !== "done" && !(y && Date.now() - parseInt(y) < 1e4)) {
11914
- if (localStorage.setItem(`stoker-retry-${f}`, Date.now().toString()), console.info(`Retrying pending ${u} operation: ${o.ref.path}`), u === "create" && (mt[f]++, await vm(d, l.data, void 0, {
11918
+ if (localStorage.setItem(`stoker-retry-${f}`, Date.now().toString()), console.info(`Retrying pending ${u} operation: ${o.ref.path}`), u === "create" && (pt[f]++, await vm(d, l.data, void 0, {
11915
11919
  retry: {
11916
11920
  type: "offline",
11917
11921
  docId: f
11918
11922
  }
11919
11923
  }).catch((_) => {
11920
11924
  console.error(_);
11921
- }), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done")), u === "update") {
11925
+ }), pt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done")), u === "update") {
11922
11926
  const _ = r.collections[h], { softDelete: S } = _;
11923
- S && l.data?.[S.archivedField] && l.data?.[S.archivedField] !== l.originalRecord?.[S.archivedField] && (l.data[S.timestampField] = Lr()), l.data && wm(l.data), mt[f]++, await fc(d, f, l.data, void 0, {
11927
+ S && l.data?.[S.archivedField] && l.data?.[S.archivedField] !== l.originalRecord?.[S.archivedField] && (l.data[S.timestampField] = Lr()), l.data && wm(l.data), pt[f]++, await fc(d, f, l.data, void 0, {
11924
11928
  retry: {
11925
11929
  type: "offline",
11926
11930
  originalRecord: l.originalRecord
11927
11931
  }
11928
- }).catch((T) => {
11929
- console.error(T);
11930
- }), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done");
11932
+ }).catch((A) => {
11933
+ console.error(A);
11934
+ }), pt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done");
11931
11935
  }
11932
- u === "delete" && (mt[f]++, await vw(d, f, {
11936
+ u === "delete" && (pt[f]++, await vw(d, f, {
11933
11937
  retry: {
11934
11938
  type: "offline",
11935
11939
  record: {
@@ -11942,16 +11946,16 @@ const bw = async (r, e) => {
11942
11946
  }
11943
11947
  }).catch((_) => {
11944
11948
  console.error(_);
11945
- }), mt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done"));
11949
+ }), pt[f]--, localStorage.setItem(`stoker-retry-${f}`, "done"));
11946
11950
  }
11947
11951
  }
11948
- }, bm = (r) => !!mt[r], Ow = () => {
11949
- mt = {};
11952
+ }, bm = (r) => !!pt[r], Ow = () => {
11953
+ pt = {};
11950
11954
  };
11951
11955
  let fn, Ka = 0;
11952
11956
  const Ew = async () => {
11953
11957
  const r = Am(), e = Ie();
11954
- return dr(ke(r, "system_deployment", "latest_deploy"), (n) => {
11958
+ return hr(ke(r, "system_deployment", "latest_deploy"), (n) => {
11955
11959
  if (n.exists())
11956
11960
  fn = n.data(), Ka++, Ka > 1 && (fn.refresh ? window.location.reload() : ve(e.onVersionUpdate, [fn, Ka]));
11957
11961
  else
@@ -11963,7 +11967,7 @@ const Ew = async () => {
11963
11967
  let Ro;
11964
11968
  const Sw = async () => {
11965
11969
  const r = Ie(), e = Am();
11966
- dr(ke(e, "system_deployment", "maintenance_mode"), (t) => {
11970
+ hr(ke(e, "system_deployment", "maintenance_mode"), (t) => {
11967
11971
  if (t.exists())
11968
11972
  Ro = t.data(), ve(r.onMaintenanceUpdate, [Ro.active ? "on" : "off"]);
11969
11973
  else
@@ -11972,17 +11976,17 @@ const Sw = async () => {
11972
11976
  throw new Error("Error getting maintenance status", { cause: t.message });
11973
11977
  });
11974
11978
  }, Tw = () => Ro;
11975
- let xr, Or = null;
11979
+ let Nr, Er = null;
11976
11980
  const Rw = () => {
11977
11981
  const r = wd(), e = Ie();
11978
11982
  let t = !1;
11979
11983
  return zm(Bm(r, ".info/connected"), (s) => {
11980
- s.val() === !0 ? (Or && (clearTimeout(Or), Or = null), xr = "Online", ve(e.onConnectionStatusChange, [xr, !t]), t || (t = !0)) : !Or && t && (Or = setTimeout(() => {
11981
- xr = "Offline", ve(e.onConnectionStatusChange, [xr]);
11984
+ s.val() === !0 ? (Er && (clearTimeout(Er), Er = null), Nr = "Online", ve(e.onConnectionStatusChange, [Nr, !t]), t || (t = !0)) : !Er && t && (Er = setTimeout(() => {
11985
+ Nr = "Offline", ve(e.onConnectionStatusChange, [Nr]);
11982
11986
  }, 5e3));
11983
11987
  });
11984
- }, zt = () => xr, Cw = () => navigator.onLine ? "Online" : "Offline", Em = async () => {
11985
- const r = Ie(), e = fr(), t = e.currentUser;
11988
+ }, zt = () => Nr, Cw = () => navigator.onLine ? "Online" : "Offline", Em = async () => {
11989
+ const r = Ie(), e = dr(), t = e.currentUser;
11986
11990
  if (r.preLogout && await ve(r.preLogout, [t]) === !1)
11987
11991
  throw new Error("Operation cancelled by preLogout");
11988
11992
  try {
@@ -12003,10 +12007,10 @@ const Rw = () => {
12003
12007
  e(n);
12004
12008
  });
12005
12009
  };
12006
- let dt, hc, Tt, Sm, pe, Tm, Pr, mc, pc, $e, Rm, Rn = [], be;
12010
+ let ht, hc, Tt, Sm, pe, Tm, Pr, mc, pc, $e, Rm, Rn = [], be;
12007
12011
  const Ya = {
12008
12012
  firestoreWriteApp: {}
12009
- }, ht = {
12013
+ }, mt = {
12010
12014
  main: {},
12011
12015
  firestoreWrite: {}
12012
12016
  }, Ge = {
@@ -12035,7 +12039,7 @@ const Ya = {
12035
12039
  for (const t of Object.values(e.collections))
12036
12040
  for (const n of t.fields)
12037
12041
  if (n.type === "Computed") {
12038
- const s = Ty(n, lt(t.labels.collection));
12042
+ const s = Ty(n, ut(t.labels.collection));
12039
12043
  s.formula && (n.formula = s.formula);
12040
12044
  }
12041
12045
  } else
@@ -12069,7 +12073,7 @@ const Ya = {
12069
12073
  return At.firestoreWrite;
12070
12074
  },
12071
12075
  getFirestoreWriteAuth() {
12072
- return ht.firestoreWrite;
12076
+ return mt.firestoreWrite;
12073
12077
  },
12074
12078
  getFirestoreWrite() {
12075
12079
  return Ge.firestoreWrite;
@@ -12084,28 +12088,28 @@ const Ya = {
12084
12088
  };
12085
12089
  let gd = !1;
12086
12090
  const Gw = async (r, e, t, n) => {
12087
- if (be = t, dt)
12091
+ if (be = t, ht)
12088
12092
  return console.error("Stoker is already initialized."), !0;
12089
12093
  xm("stoker-client", pp, "web"), Tt = be.MODE, pe = r.default("web", Co, n), Sm = await ie(pe, ["global", "timezone"]), ie(pe, ["global", "roles"]), ie(pe, ["global", "appName"]), ie(pe, ["global", "auth", "enableMultiFactorAuth"]);
12090
12094
  const s = JSON.parse(be.STOKER_FB_WEB_APP_CONFIG), i = await ie(pe, ["global", "firebase", "GDPRSettings"]);
12091
- dt = zn(s, {
12095
+ ht = zn(s, {
12092
12096
  automaticDataCollectionEnabled: i || !0
12093
12097
  });
12094
- const a = dp(dt);
12098
+ const a = dp(ht);
12095
12099
  Tt === "development" && (a.instrumentationEnabled = !1, a.dataCollectionEnabled = !1);
12096
12100
  const o = ["firestoreWrite"];
12097
- for (const p of o)
12098
- Ya[`${p}App`] = zn(s, p);
12101
+ for (const g of o)
12102
+ Ya[`${g}App`] = zn(s, g);
12099
12103
  const { firestoreWriteApp: c } = Ya, l = zn(s, "maintenance");
12100
12104
  Ge.maintenance = We(l);
12101
12105
  const u = hp();
12102
12106
  if (u.settings.minimumFetchIntervalMillis = 36e5, await mp(u), be.STOKER_FB_ENABLE_APP_CHECK === "true" && be.STOKER_FB_APP_CHECK_KEY) {
12103
12107
  (Tt === "development" || window.location.hostname === "localhost") && (globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = !0);
12104
- const p = {
12108
+ const g = {
12105
12109
  provider: new fp(be.STOKER_FB_APP_CHECK_KEY),
12106
12110
  isTokenAutoRefreshEnabled: !0
12107
12111
  };
12108
- At.main = Gn(dt, p), At.firestoreWrite = Gn(c, p), At.maintenance = Gn(l, p);
12112
+ At.main = Gn(ht, g), At.firestoreWrite = Gn(c, g), At.maintenance = Gn(l, g);
12109
12113
  let k = !1;
12110
12114
  const I = (b, w) => {
12111
12115
  if (console.log(`App Check token error detected for ${w}`), !k)
@@ -12133,7 +12137,7 @@ const Gw = async (r, e, t, n) => {
12133
12137
  "global",
12134
12138
  "firebase",
12135
12139
  "analyticsConsentSettings"
12136
- ]), m = await ie(pe, [
12140
+ ]), p = await ie(pe, [
12137
12141
  "global",
12138
12142
  "firebase",
12139
12143
  "enableEmulators"
@@ -12147,24 +12151,24 @@ const Gw = async (r, e, t, n) => {
12147
12151
  "firebase",
12148
12152
  "logLevel",
12149
12153
  "prod"
12150
- ]), S = await Fm().catch((p) => {
12151
- throw new Error("Error checking analytics support.", { cause: p });
12154
+ ]), S = await Fm().catch((g) => {
12155
+ throw new Error("Error checking analytics support.", { cause: g });
12152
12156
  });
12153
- Tt === "production" && f && S && Dm(dt, h || {}), d && Mm(d);
12154
- const T = await ie(pe, [
12157
+ Tt === "production" && f && S && Dm(ht, h || {}), d && Mm(d);
12158
+ const A = await ie(pe, [
12155
12159
  "global",
12156
12160
  "auth",
12157
12161
  "authPersistenceType"
12158
- ]), g = {
12162
+ ]), m = {
12159
12163
  popupRedirectResolver: void 0,
12160
- persistence: T === "LOCAL" ? [Pm, qm, Ec] : T === "SESSION" ? [Ec, Sc] : [Sc]
12164
+ persistence: A === "LOCAL" ? [Pm, qm, Ec] : A === "SESSION" ? [Ec, Sc] : [Sc]
12161
12165
  };
12162
- ht.main = Oc(dt, g);
12163
- for (const p of o)
12164
- ht[p] = Oc(Ya[`${p}App`], g);
12165
- const { main: C } = ht;
12166
- Lm(C, async (p) => {
12167
- if (p && await ve(pe.preLogin, [p]) === !1)
12166
+ mt.main = Oc(ht, m);
12167
+ for (const g of o)
12168
+ mt[g] = Oc(Ya[`${g}App`], m);
12169
+ const { main: T } = mt;
12170
+ Lm(T, async (g) => {
12171
+ if (g && await ve(pe.preLogin, [g]) === !1)
12168
12172
  throw new Error("Operation cancelled by preLogin");
12169
12173
  });
12170
12174
  const R = await ie(pe, [
@@ -12172,31 +12176,31 @@ const Gw = async (r, e, t, n) => {
12172
12176
  "firebase",
12173
12177
  "disableIndividualEmulators"
12174
12178
  ]);
12175
- if (Tt === "development" && m) {
12179
+ if (Tt === "development" && p) {
12176
12180
  if (!R?.includes("Auth")) {
12177
- const p = be.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(be.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
12178
- for (const k of Object.values(ht))
12179
- $m(k, `http://localhost:${p}`);
12181
+ const g = be.STOKER_FB_EMULATOR_AUTH_PORT ? parseInt(be.STOKER_FB_EMULATOR_AUTH_PORT) : 9099;
12182
+ for (const k of Object.values(mt))
12183
+ $m(k, `http://localhost:${g}`);
12180
12184
  }
12181
12185
  if (!R?.includes("Database")) {
12182
- const p = be.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(be.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
12183
- Zm(wd(), "localhost", p);
12186
+ const g = be.STOKER_FB_EMULATOR_DATABASE_PORT ? parseInt(be.STOKER_FB_EMULATOR_DATABASE_PORT) : 9e3;
12187
+ Zm(wd(), "localhost", g);
12184
12188
  }
12185
12189
  if (!R?.includes("Firestore")) {
12186
- const p = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12187
- Cc(Ge.maintenance, "localhost", p);
12190
+ const g = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12191
+ Cc(Ge.maintenance, "localhost", g);
12188
12192
  }
12189
12193
  if (!R?.includes("Storage")) {
12190
- const p = be.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(be.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
12191
- cp(lp(), "localhost", p);
12194
+ const g = be.STOKER_FB_EMULATOR_STORAGE_PORT ? parseInt(be.STOKER_FB_EMULATOR_STORAGE_PORT) : 9199;
12195
+ cp(lp(), "localhost", g);
12192
12196
  }
12193
12197
  if (!R?.includes("Functions")) {
12194
- const p = be.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(be.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
12195
- up(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "localhost", p);
12198
+ const g = be.STOKER_FB_EMULATOR_FUNCTIONS_PORT ? parseInt(be.STOKER_FB_EMULATOR_FUNCTIONS_PORT) : 5001;
12199
+ up(Ue(ht, be.STOKER_FB_FUNCTIONS_REGION), "localhost", g);
12196
12200
  }
12197
12201
  }
12198
12202
  if (Ew(), Sw(), Rw(), Tt === "development" && (y ? Qr(y) : Qr("debug")), Tt === "production" && (_ ? Qr(_) : Qr("error")), E) {
12199
- const p = Bn(C, async (k) => {
12203
+ const g = Bn(T, async (k) => {
12200
12204
  if (k) {
12201
12205
  const I = JSON.parse(be.STOKER_FB_WEB_APP_CONFIG);
12202
12206
  Nm(() => {
@@ -12204,18 +12208,18 @@ const Gw = async (r, e, t, n) => {
12204
12208
  });
12205
12209
  }
12206
12210
  });
12207
- Rn.push(p);
12211
+ Rn.push(g);
12208
12212
  }
12209
- await Promise.all(Object.values(ht).map((p) => p.authStateReady().catch((k) => {
12210
- throw new Error(`Error waiting for auth state in ${p.app.name}.`, { cause: k });
12213
+ await Promise.all(Object.values(mt).map((g) => g.authStateReady().catch((k) => {
12214
+ throw new Error(`Error waiting for auth state in ${g.app.name}.`, { cause: k });
12211
12215
  })));
12212
12216
  let v = !1;
12213
- for (const p of Object.values(ht))
12214
- p.currentUser || (v = !0);
12215
- let A;
12216
- return Bn(C, async (p) => {
12217
- if (p) {
12218
- $e = p;
12217
+ for (const g of Object.values(mt))
12218
+ g.currentUser || (v = !0);
12219
+ let C;
12220
+ return Bn(T, async (g) => {
12221
+ if (g) {
12222
+ $e = g;
12219
12223
  const k = await jm($e), { claims: I } = k;
12220
12224
  hc = I.tenant, Rm = {
12221
12225
  ...$e,
@@ -12224,15 +12228,15 @@ const Gw = async (r, e, t, n) => {
12224
12228
  }
12225
12229
  };
12226
12230
  const b = [];
12227
- for (const Se of Object.values(ht))
12231
+ for (const Se of Object.values(mt))
12228
12232
  b.push(new Promise((Le) => {
12229
12233
  const Ot = Bn(Se, async (G) => {
12230
12234
  G && (Ot(), Le({}));
12231
12235
  });
12232
12236
  }));
12233
- await Promise.all(b), gd || (Aw(pe), gd = !0), A = await ie(pe, ["global", "auth", "offlinePersistenceType"], [$e, I]);
12234
- const w = await ie(pe, ["global", "auth", "tabManager"], [$e, I]), O = await ie(pe, ["global", "auth", "garbageCollectionStrategy"], [$e, I]), x = await ie(pe, ["global", "auth", "maxCacheSize"], [$e, I]) || -1, M = await ie(pe, ["global", "auth", "maxWriteCacheSize"], [$e, I]);
12235
- let D;
12237
+ await Promise.all(b), gd || (Aw(pe), gd = !0), C = await ie(pe, ["global", "auth", "offlinePersistenceType"], [$e, I]);
12238
+ const w = await ie(pe, ["global", "auth", "tabManager"], [$e, I]), O = await ie(pe, ["global", "auth", "garbageCollectionStrategy"], [$e, I]), x = await ie(pe, ["global", "auth", "maxCacheSize"], [$e, I]) || -1, P = await ie(pe, ["global", "auth", "maxWriteCacheSize"], [$e, I]);
12239
+ let M;
12236
12240
  const q = {
12237
12241
  localCache: Ac({
12238
12242
  tabManager: w === "SINGLE" ? kc({ forceOwnership: !1 }) : Ic(),
@@ -12241,31 +12245,31 @@ const Gw = async (r, e, t, n) => {
12241
12245
  }, z = {
12242
12246
  localCache: Ac({
12243
12247
  tabManager: w === "SINGLE" ? kc({ forceOwnership: !1 }) : Ic(),
12244
- cacheSizeBytes: M || x
12248
+ cacheSizeBytes: P || x
12245
12249
  })
12246
12250
  };
12247
12251
  let ee;
12248
- if (O === "EAGER" ? ee = Xm() : ee = ep({ cacheSizeBytes: x }), A === "ALL" ? D = q : D = {
12252
+ if (O === "EAGER" ? ee = Xm() : ee = ep({ cacheSizeBytes: x }), C === "ALL" ? M = q : M = {
12249
12253
  localCache: tp({
12250
12254
  garbageCollector: ee
12251
12255
  })
12252
- }, Ge.main = Zn(dt, D), ["ALL", "WRITE"].includes(A) ? Ge.firestoreWrite = Zn(c, z) : Ge.firestoreWrite = Zn(c, D), Tt === "development" && m && !R?.includes("Firestore")) {
12256
+ }, Ge.main = Zn(ht, M), ["ALL", "WRITE"].includes(C) ? Ge.firestoreWrite = Zn(c, z) : Ge.firestoreWrite = Zn(c, M), Tt === "development" && p && !R?.includes("Firestore")) {
12253
12257
  const Se = be.STOKER_FB_EMULATOR_FIRESTORE_PORT ? parseInt(be.STOKER_FB_EMULATOR_FIRESTORE_PORT) : 8080;
12254
12258
  for (const [Le, Ot] of Object.entries(Ge))
12255
12259
  Le !== "maintenance" && Cc(Ot, "localhost", Se);
12256
12260
  }
12257
- if (A === "ALL") {
12261
+ if (C === "ALL") {
12258
12262
  const Se = rp(Ge.main);
12259
12263
  Se && np(Se);
12260
12264
  }
12261
- const F = await Je(Ue(dt, be.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((Se) => {
12265
+ const D = await Je(Ue(ht, be.STOKER_FB_FUNCTIONS_REGION), "stoker-schema")().catch((Se) => {
12262
12266
  throw new Error("Error fetching schema.", { cause: Se });
12263
12267
  });
12264
- Pr = F.data.schema;
12265
- const te = Object.entries(F.data.allRoleGroups).map(([Se, Le]) => [Se, new Set(Le)]);
12266
- mc = Object.fromEntries(te), pc = F.data.currentUserRoleGroups, Tm = Sy(Object.keys(Pr.collections), e, "web", Co, n);
12268
+ Pr = D.data.schema;
12269
+ const te = Object.entries(D.data.allRoleGroups).map(([Se, Le]) => [Se, new Set(Le)]);
12270
+ mc = Object.fromEntries(te), pc = D.data.currentUserRoleGroups, Tm = Sy(Object.keys(Pr.collections), e, "web", Co, n);
12267
12271
  const ne = await fw($e, k);
12268
- Rn.push(...ne), A === "WRITE" && bw(Pr, $e), await ve(pe.postLogin, [$e]);
12272
+ Rn.push(...ne), C === "WRITE" && bw(Pr, $e), await ve(pe.postLogin, [$e]);
12269
12273
  const Me = new Event("stoker:ready");
12270
12274
  document.dispatchEvent(Me);
12271
12275
  } else if ($e) {
@@ -12275,7 +12279,7 @@ const Gw = async (r, e, t, n) => {
12275
12279
  const I = new Event("stoker:signOut");
12276
12280
  document.dispatchEvent(I);
12277
12281
  const b = { error: !1, instances: [] };
12278
- await Promise.all(Object.values(ht).map(async (O) => {
12282
+ await Promise.all(Object.values(mt).map(async (O) => {
12279
12283
  O.currentUser && await vd(O).catch((x) => {
12280
12284
  b.error = !0, b.instances.push({
12281
12285
  instance: O.app.name,
@@ -12284,26 +12288,26 @@ const Gw = async (r, e, t, n) => {
12284
12288
  }), console.error(`Error signing out of ${O.app.name}.`);
12285
12289
  });
12286
12290
  })), await Promise.all(Object.entries(Ge).map(async ([O, x]) => {
12287
- O !== "maintenance" && Object.keys(x).length !== 0 && await sp(x).catch((M) => {
12291
+ O !== "maintenance" && Object.keys(x).length !== 0 && await sp(x).catch((P) => {
12288
12292
  console.error(`Error terminating ${x.app.name}.`), b.error = !0, b.instances.push({
12289
12293
  instance: x.app.name,
12290
12294
  code: "TERMINATE_APP",
12291
- error: M
12295
+ error: P
12292
12296
  });
12293
12297
  });
12294
12298
  })), (await ie(pe, [
12295
12299
  "global",
12296
12300
  "auth",
12297
12301
  "clearPersistenceOnSignOut"
12298
- ]) ?? !0) && (A === "ALL" && await xc(Ge.main).catch((O) => {
12302
+ ]) ?? !0) && (C === "ALL" && await xc(Ge.main).catch((O) => {
12299
12303
  console.error('Error clearing indexedDB persistence in "[DEFAULT]".'), b.error = !0, b.instances.push({ instance: "[DEFAULT]", code: "CLEAR_CACHE", error: O });
12300
- }), ["ALL", "WRITE"].includes(A) && await xc(Ge.firestoreWrite).catch((O) => {
12304
+ }), ["ALL", "WRITE"].includes(C) && await xc(Ge.firestoreWrite).catch((O) => {
12301
12305
  console.error('Error clearing indexedDB persistence in "firestoreWrite".'), b.error = !0, b.instances.push({ instance: "firestoreWrite", code: "CLEAR_CACHE", error: O });
12302
12306
  })), b.error ? console.info("Sign out operation completed with errors.") : console.info("Sign out operation completed successfully."), await ve(pe.postLogout, [b]);
12303
12307
  }
12304
- }), v ? !1 : C.currentUser ? (E && console.info(`${C.currentUser.uid} successfully logged in.`), !0) : !1;
12305
- }, { getTenant: Mt, getEnv: ze, getTimezone: Cm, getSchema: Ve, getCurrentUser: Hw, getCurrentUserRoleGroups: Jr, getAllRoleGroups: yc, getGlobalConfigModule: Ie, getCollectionConfigModule: lt, getAppCheck: Kw, getAppCheckFirestoreWrite: Yw, getFirestoreWriteAuth: Nw, getFirestoreWrite: gc, getFirestoreMaintenance: Am } = Co, Jw = async (r, e, t) => {
12306
- const [n, s] = [fr(), Nw()], i = Ie();
12308
+ }), v ? !1 : T.currentUser ? (E && console.info(`${T.currentUser.uid} successfully logged in.`), !0) : !1;
12309
+ }, { getTenant: Mt, getEnv: ze, getTimezone: Cm, getSchema: Ve, getCurrentUser: Hw, getCurrentUserRoleGroups: Jr, getAllRoleGroups: yc, getGlobalConfigModule: Ie, getCollectionConfigModule: ut, getAppCheck: Kw, getAppCheckFirestoreWrite: Yw, getFirestoreWriteAuth: Nw, getFirestoreWrite: gc, getFirestoreMaintenance: Am } = Co, Jw = async (r, e, t) => {
12310
+ const [n, s] = [dr(), Nw()], i = Ie();
12307
12311
  if (!r || !e)
12308
12312
  throw new Error("Email and password are required.");
12309
12313
  try {
@@ -12392,82 +12396,82 @@ const Gw = async (r, e, t, n) => {
12392
12396
  const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i];
12393
12397
  if (!f)
12394
12398
  throw new Error("COLLECTION_NOT_FOUND");
12395
- const { labels: h, preloadCache: d } = f, m = Ie(), E = Object.keys(o.collections).includes(i), y = m.disabledCollections?.includes(i);
12399
+ const { labels: h, preloadCache: d } = f, p = Ie(), E = Object.keys(o.collections).includes(i), y = p.disabledCollections?.includes(i);
12396
12400
  if (!E || y)
12397
12401
  throw new Error("COLLECTION_NOT_FOUND");
12398
- const _ = lt(h.collection), S = await ie(m, [
12402
+ const _ = ut(h.collection), S = await ie(p, [
12399
12403
  "global",
12400
12404
  "firebase",
12401
12405
  "serverTimestampOptions"
12402
- ]), T = dm(r, e, l);
12403
- if (T.length === 0)
12406
+ ]), A = dm(r, e, l);
12407
+ if (A.length === 0)
12404
12408
  throw new Error("PERMISSION_DENIED");
12405
- const P = d?.roles?.includes(a.Role), g = { collection: h.collection };
12406
- await ce("preOperation", m, _, ["read", void 0, e, g]), await ce("preRead", m, _, [g, T, !1, !0]);
12407
- const v = /* @__PURE__ */ new Map(), A = [];
12408
- let p = {};
12409
+ const F = d?.roles?.includes(a.Role), m = { collection: h.collection };
12410
+ await ce("preOperation", p, _, ["read", void 0, e, m]), await ce("preRead", p, _, [m, A, !1, !0]);
12411
+ const v = /* @__PURE__ */ new Map(), C = [];
12412
+ let g = {};
12409
12413
  const k = /* @__PURE__ */ new Map();
12410
- typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((M) => {
12411
- if (typeof M == "string") {
12412
- const D = f.fields.find((q) => q.name === M);
12413
- if (D)
12414
- return D;
12415
- throw new Error(`SCHEMA_ERROR: Field ${M} not found in collection ${i}`);
12416
- }
12417
- return M;
12414
+ typeof s?.relations == "object" && (s.relations.fields = s.relations.fields.map((P) => {
12415
+ if (typeof P == "string") {
12416
+ const M = f.fields.find((q) => q.name === P);
12417
+ if (M)
12418
+ return M;
12419
+ throw new Error(`SCHEMA_ERROR: Field ${P} not found in collection ${i}`);
12420
+ }
12421
+ return P;
12418
12422
  }));
12419
12423
  const I = () => {
12420
- const M = Sd(u, async () => {
12421
- if (M(), p) {
12422
- if (um(p, k), !s?.noComputedFields) {
12423
- const D = [];
12424
+ const P = Sd(u, async () => {
12425
+ if (P(), g) {
12426
+ if (um(g, k), !s?.noComputedFields) {
12427
+ const M = [];
12424
12428
  for (const q of f.fields)
12425
- q.type === "Computed" && D.push(ve(() => q.formula(p)).then((z) => {
12426
- p && (p[q.name] = z);
12429
+ q.type === "Computed" && M.push(ve(() => q.formula(g)).then((z) => {
12430
+ g && (g[q.name] = z);
12427
12431
  }));
12428
- await Promise.all(D);
12432
+ await Promise.all(M);
12429
12433
  }
12430
12434
  if (s?.noEmbeddingFields)
12431
- for (const D of f.fields)
12432
- D.type === "Embedding" && delete p[D.name];
12435
+ for (const M of f.fields)
12436
+ M.type === "Embedding" && delete g[M.name];
12433
12437
  }
12434
- t(we(p));
12438
+ t(we(g));
12435
12439
  });
12436
- }, b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = (M) => typeof M == "object" ? M.fields.filter((q) => typeof q == "object" && _e(q) && jt(f, o, a).includes(q.collection)) : f.fields.filter((q) => _e(q) && jt(f, o, a).includes(q.collection)), x = (M) => new Promise((D) => {
12440
+ }, b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = (P) => typeof P == "object" ? P.fields.filter((q) => typeof q == "object" && _e(q) && jt(f, o, a).includes(q.collection)) : f.fields.filter((q) => _e(q) && jt(f, o, a).includes(q.collection)), x = (P) => new Promise((M) => {
12437
12441
  if (!s?.relations) {
12438
- D({});
12442
+ M({});
12439
12443
  return;
12440
12444
  }
12441
12445
  const q = we(s.relations), z = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map(), oe = O(q);
12442
- for (const F of oe)
12446
+ for (const D of oe)
12443
12447
  for (const te of w.values())
12444
- te.type === F.type && te.field === F.name && // eslint-disable-next-line security/detect-object-injection
12445
- !p[F.name][te.id] && (te.listener(), b.delete(`${F.name}_${te.id}`));
12446
- for (const F of oe)
12447
- if ("collection" in F) {
12448
- const te = p[F.name];
12448
+ te.type === D.type && te.field === D.name && // eslint-disable-next-line security/detect-object-injection
12449
+ !g[D.name][te.id] && (te.listener(), b.delete(`${D.name}_${te.id}`));
12450
+ for (const D of oe)
12451
+ if ("collection" in D) {
12452
+ const te = g[D.name];
12449
12453
  if (!te)
12450
12454
  continue;
12451
12455
  for (const ne of Object.keys(te))
12452
- te?.[ne].id || (z.set(`${F.name}_${ne}`, !1), b.has(`${F.name}_${ne}`) ? ee.set(`${F.name}_${ne}`, !0) : b.set(`${F.name}_${ne}`, !0));
12456
+ te?.[ne].id || (z.set(`${D.name}_${ne}`, !1), b.has(`${D.name}_${ne}`) ? ee.set(`${D.name}_${ne}`, !0) : b.set(`${D.name}_${ne}`, !0));
12453
12457
  }
12454
12458
  if (z.size === 0)
12455
- D({});
12459
+ M({});
12456
12460
  else
12457
- for (const F of oe)
12458
- if ("collection" in F) {
12459
- const te = p[F.name];
12461
+ for (const D of oe)
12462
+ if ("collection" in D) {
12463
+ const te = g[D.name];
12460
12464
  if (!te)
12461
12465
  continue;
12462
12466
  for (const [ne, Me] of Object.entries(te))
12463
- if (ee.has(`${F.name}_${ne}`)) {
12467
+ if (ee.has(`${D.name}_${ne}`)) {
12464
12468
  const Se = async () => {
12465
- te[ne].id ? (z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((Le) => Le) && (D({}), I())) : setTimeout(Se, 100);
12469
+ te[ne].id ? (z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((Le) => Le) && (M({}), I())) : setTimeout(Se, 100);
12466
12470
  };
12467
12471
  Se();
12468
12472
  } else {
12469
- const Se = o.collections[F.collection], { access: Le } = Se, { serverReadOnly: Ot } = Le;
12470
- Ot?.includes(a.Role) ? _r([...Me.Collection_Path], ne, {
12473
+ const Se = o.collections[D.collection], { access: Le } = Se, { serverReadOnly: Ot } = Le;
12474
+ Ot?.includes(a.Role) ? vr([...Me.Collection_Path], ne, {
12471
12475
  noComputedFields: s?.noComputedFields,
12472
12476
  noEmbeddingFields: s?.noEmbeddingFields
12473
12477
  }).then((K) => {
@@ -12476,22 +12480,22 @@ const Gw = async (r, e, t, n) => {
12476
12480
  return;
12477
12481
  }
12478
12482
  if (!te?.[ne]) {
12479
- z.set(`${F.name}_${ne}`, !0), b.delete(`${F.name}_${ne}`);
12483
+ z.set(`${D.name}_${ne}`, !0), b.delete(`${D.name}_${ne}`);
12480
12484
  return;
12481
12485
  }
12482
- te[ne] = K, z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (D({}), I(), M.fromCache === !1 && (ce("postOperation", m, _, [
12486
+ te[ne] = K, z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (M({}), I(), P.fromCache === !1 && (ce("postOperation", p, _, [
12483
12487
  "read",
12484
- p,
12488
+ g,
12485
12489
  e,
12486
- g
12487
- ]), ce("postRead", m, _, [
12490
+ m
12491
+ ]), ce("postRead", p, _, [
12492
+ m,
12493
+ A,
12488
12494
  g,
12489
- T,
12490
- p,
12491
12495
  !0
12492
12496
  ])));
12493
12497
  }).catch((K) => {
12494
- delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${F.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
12498
+ delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${D.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
12495
12499
  cause: K
12496
12500
  }));
12497
12501
  }) : km(
@@ -12503,70 +12507,70 @@ const Gw = async (r, e, t, n) => {
12503
12507
  return;
12504
12508
  }
12505
12509
  if (!te?.[ne]) {
12506
- w.get(`${F.name}_${ne}`) && w.get(`${F.name}_${ne}`).listener(), z.set(`${F.name}_${ne}`, !0), b.delete(`${F.name}_${ne}`);
12510
+ w.get(`${D.name}_${ne}`) && w.get(`${D.name}_${ne}`).listener(), z.set(`${D.name}_${ne}`, !0), b.delete(`${D.name}_${ne}`);
12507
12511
  return;
12508
12512
  }
12509
- te[ne] = K, z.set(`${F.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (D({}), I(), M.fromCache === !1 && (ce("postOperation", m, _, [
12513
+ te[ne] = K, z.set(`${D.name}_${ne}`, !0), Array.from(z.values()).every((j) => j) && (M({}), I(), P.fromCache === !1 && (ce("postOperation", p, _, [
12510
12514
  "read",
12511
- p,
12515
+ g,
12512
12516
  e,
12513
- g
12514
- ]), ce("postRead", m, _, [
12517
+ m
12518
+ ]), ce("postRead", p, _, [
12519
+ m,
12520
+ A,
12515
12521
  g,
12516
- T,
12517
- p,
12518
12522
  !0
12519
12523
  ])));
12520
12524
  },
12521
12525
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12522
12526
  (K) => {
12523
- delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${F.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
12527
+ delete te[ne], K.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${D.collection} with ID ${e} at location ${Me.Collection_Path?.join("/")}`, {
12524
12528
  cause: K
12525
12529
  }));
12526
12530
  },
12527
12531
  { ...s, relations: !1 }
12528
12532
  ).then((K) => {
12529
12533
  if (!te?.[ne]) {
12530
- K(), b.delete(`${F.name}_${ne}`);
12534
+ K(), b.delete(`${D.name}_${ne}`);
12531
12535
  return;
12532
12536
  }
12533
- A.push(K), w.set(`${F.name}_${ne}`, {
12537
+ C.push(K), w.set(`${D.name}_${ne}`, {
12534
12538
  id: ne,
12535
- type: F.type,
12536
- field: F.name,
12539
+ type: D.type,
12540
+ field: D.name,
12537
12541
  listener: K
12538
12542
  });
12539
12543
  });
12540
12544
  }
12541
12545
  }
12542
12546
  });
12543
- for (const M of T) {
12544
- const D = dr(M, { source: s?.only || (P ? "cache" : "default") }, (q) => {
12547
+ for (const P of A) {
12548
+ const M = hr(P, { source: s?.only || (F ? "cache" : "default") }, (q) => {
12545
12549
  if (q.exists()) {
12546
12550
  const z = q.data({ serverTimestamps: S || "none" });
12547
- if (v.has(M.path) && s?.relations) {
12551
+ if (v.has(P.path) && s?.relations) {
12548
12552
  const oe = O(s?.relations);
12549
- for (const F of oe)
12550
- "collection" in F && z[F.name] && (z[F.name] = p?.[F.name]);
12553
+ for (const D of oe)
12554
+ "collection" in D && z[D.name] && (z[D.name] = g?.[D.name]);
12551
12555
  }
12552
- v.set(M.path, !0), p ||= {}, p.id ||= q.id, p = { ...p, ...z }, delete p.Collection_Path_String;
12553
- const ee = k.get(M) || /* @__PURE__ */ new Set();
12554
- lm(z, ee), k.set(M, ee), v.size === T.length && x(q.metadata).then(() => {
12555
- I(), q.metadata.fromCache === !1 && (ce("postOperation", m, _, [
12556
+ v.set(P.path, !0), g ||= {}, g.id ||= q.id, g = { ...g, ...z }, delete g.Collection_Path_String;
12557
+ const ee = k.get(P) || /* @__PURE__ */ new Set();
12558
+ lm(z, ee), k.set(P, ee), v.size === A.length && x(q.metadata).then(() => {
12559
+ I(), q.metadata.fromCache === !1 && (ce("postOperation", p, _, [
12556
12560
  "read",
12557
- p,
12561
+ g,
12558
12562
  e,
12559
- g
12560
- ]), ce("postRead", m, _, [g, T, p, !0]));
12563
+ m
12564
+ ]), ce("postRead", p, _, [m, A, g, !0]));
12561
12565
  });
12562
- } else p && (p = void 0, I(), q.metadata.fromCache === !1 && (ce("postOperation", m, _, ["read", void 0, e, g]), ce("postRead", m, _, [g, T, void 0, !0])));
12566
+ } else g && (g = void 0, I(), q.metadata.fromCache === !1 && (ce("postOperation", p, _, ["read", void 0, e, m]), ce("postRead", p, _, [m, A, void 0, !0])));
12563
12567
  }, (q) => {
12564
- n && n(q), A.forEach((z) => z());
12568
+ n && n(q), C.forEach((z) => z());
12565
12569
  });
12566
- A.push(D);
12570
+ C.push(M);
12567
12571
  }
12568
12572
  return () => {
12569
- A.forEach((M) => M());
12573
+ C.forEach((P) => P());
12570
12574
  };
12571
12575
  }, Ja = (r) => {
12572
12576
  const e = r.first.values().next().value?.id;
@@ -12591,24 +12595,24 @@ const Gw = async (r, e, t, n) => {
12591
12595
  const a = De();
12592
12596
  if (!a?.Role)
12593
12597
  throw new Error("PERMISSION_DENIED");
12594
- const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i], { labels: h, preloadCache: d, access: m } = f, { serverReadOnly: E } = m, y = Ie(), _ = Object.keys(o.collections).includes(i), S = y.disabledCollections?.includes(i);
12598
+ const o = Ve(!0), l = Jr()[i], u = We(), f = o.collections[i], { labels: h, preloadCache: d, access: p } = f, { serverReadOnly: E } = p, y = Ie(), _ = Object.keys(o.collections).includes(i), S = y.disabledCollections?.includes(i);
12595
12599
  if (!_ || S)
12596
12600
  throw new Error("COLLECTION_NOT_FOUND");
12597
- const T = lt(h.collection), P = await ie(y, [
12601
+ const A = ut(h.collection), F = await ie(y, [
12598
12602
  "global",
12599
12603
  "firebase",
12600
12604
  "serverTimestampOptions"
12601
- ]), g = d?.roles?.includes(a.Role);
12605
+ ]), m = d?.roles?.includes(a.Role);
12602
12606
  if (s?.pagination?.number !== void 0) {
12603
12607
  const G = s.pagination.number;
12604
12608
  if (typeof G != "number" || !Number.isFinite(G) || !Number.isInteger(G) || G < 1)
12605
12609
  throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
12606
12610
  }
12607
- const C = oc(r, l, s?.getAll);
12608
- if (C.length === 0)
12611
+ const T = oc(r, l, !!s?.tempCache);
12612
+ if (T.length === 0)
12609
12613
  return { pages: 0, count: 0, unsubscribe: () => {
12610
12614
  } };
12611
- let R = C.map((G) => me(G, ...e));
12615
+ let R = T.map((G) => he(G, ...e));
12612
12616
  const v = s?.pagination?.startAfter || s?.pagination?.endBefore || s?.pagination?.startAt || s?.pagination?.endAt || {
12613
12617
  first: /* @__PURE__ */ new Map(),
12614
12618
  last: /* @__PURE__ */ new Map()
@@ -12622,43 +12626,43 @@ const Gw = async (r, e, t, n) => {
12622
12626
  s.pagination.startAfter || s.pagination.endBefore || s.pagination.startAt || s.pagination.endAt ? s.pagination.startAfter ? (Qa(s.pagination.startAfter), R = R.map((j, Y) => {
12623
12627
  if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
12624
12628
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAfter");
12625
- let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(v.last.get(Y)));
12626
- return s.pagination.number && (U = me(U, Xt(s.pagination.number))), U;
12629
+ let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), eo(v.last.get(Y)));
12630
+ return s.pagination.number && (U = he(U, Xt(s.pagination.number))), U;
12627
12631
  })) : s.pagination.endBefore ? (Ja(s.pagination.endBefore), R = R.map((j, Y) => {
12628
12632
  if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
12629
12633
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endBefore");
12630
- let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(v.first.get(Y)));
12631
- return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
12634
+ let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), to(v.first.get(Y)));
12635
+ return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
12632
12636
  })) : s.pagination.startAt ? (Ja(s.pagination.startAt), R = R.map((j, Y) => {
12633
12637
  if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
12634
12638
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using startAt");
12635
- let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(v.first.get(Y)));
12636
- return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
12639
+ let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), ap(v.first.get(Y)));
12640
+ return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
12637
12641
  })) : s.pagination.endAt && (Qa(s.pagination.endAt), R = R.map((j, Y) => {
12638
12642
  if (!s.pagination?.orderByField || !s.pagination.orderByDirection)
12639
12643
  throw new Error("INPUT_ERROR: orderByField and orderByDirection must be provided when using endAt");
12640
- let U = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(v.last.get(Y)));
12641
- return s.pagination.number && (U = me(U, Nr(s.pagination.number))), U;
12644
+ let U = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection), op(v.last.get(Y)));
12645
+ return s.pagination.number && (U = he(U, Fr(s.pagination.number))), U;
12642
12646
  })) : R = R.map((j) => {
12643
- let Y = me(j);
12644
- return s.pagination?.orderByField && s.pagination.orderByDirection && (Y = me(j, rt(s.pagination.orderByField, s.pagination.orderByDirection))), s.pagination.number && (Y = me(Y, Xt(s.pagination.number))), Y;
12647
+ let Y = he(j);
12648
+ return s.pagination?.orderByField && s.pagination.orderByDirection && (Y = he(j, rt(s.pagination.orderByField, s.pagination.orderByDirection))), s.pagination.number && (Y = he(Y, Xt(s.pagination.number))), Y;
12645
12649
  });
12646
12650
  }
12647
- const A = { collection: h.collection };
12648
- await ce("preOperation", y, T, ["read", void 0, void 0, A]), await ce("preRead", y, T, [A, R, !0, !0]);
12651
+ const C = { collection: h.collection };
12652
+ await ce("preOperation", y, A, ["read", void 0, void 0, C]), await ce("preRead", y, A, [C, R, !0, !0]);
12649
12653
  let I = !0;
12650
- const b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = [], x = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), q = (G, K, j) => {
12654
+ const b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), O = [], x = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), q = (G, K, j) => {
12651
12655
  const Y = [];
12652
12656
  x.forEach((U) => {
12653
- um(U, M.get(U.id));
12657
+ um(U, P.get(U.id));
12654
12658
  for (const Z of f.fields)
12655
12659
  Z.type === "Computed" && !s?.noComputedFields && Y.push(ve(Z.formula, [U, j]).then((Te) => {
12656
12660
  U[Z.name] = Te;
12657
12661
  })), s?.noEmbeddingFields && Z.type === "Embedding" && delete U[Z.name];
12658
12662
  }), Promise.all(Y).then(() => {
12659
12663
  t(Array.from(x.values()), G, K), K?.fromCache === !1 && x.forEach((U) => {
12660
- const Z = ["read", U, U.id, A];
12661
- ce("postOperation", y, T, Z), ce("postRead", y, T, [A, C, U, !0]);
12664
+ const Z = ["read", U, U.id, C];
12665
+ ce("postOperation", y, A, Z), ce("postRead", y, A, [C, T, U, !0]);
12662
12666
  });
12663
12667
  });
12664
12668
  }, z = (G, K) => {
@@ -12669,7 +12673,7 @@ const Gw = async (r, e, t, n) => {
12669
12673
  }), b.size === R.length && j) {
12670
12674
  I = !1;
12671
12675
  const Y = Sd(u, () => {
12672
- Y(), !s?.noComputedFields && T?.admin?.retriever ? ve(T.admin.retriever).then((U) => {
12676
+ Y(), !s?.noComputedFields && A?.admin?.retriever ? ve(A.admin.retriever).then((U) => {
12673
12677
  q(G, K, U);
12674
12678
  }) : q(G, K);
12675
12679
  });
@@ -12684,7 +12688,7 @@ const Gw = async (r, e, t, n) => {
12684
12688
  }
12685
12689
  return G;
12686
12690
  }));
12687
- const ee = {}, oe = {}, F = (G, K) => {
12691
+ const ee = {}, oe = {}, D = (G, K) => {
12688
12692
  if (!G)
12689
12693
  return;
12690
12694
  const j = G.id;
@@ -12715,13 +12719,13 @@ const Gw = async (r, e, t, n) => {
12715
12719
  continue;
12716
12720
  for (const [se, Xe] of Object.entries(ge))
12717
12721
  if (Te.has(se)) {
12718
- const ut = async () => {
12719
- ge[se].id ? (Z.set(se, !0), Array.from(Z.values()).every((Be) => Be) && w.set(j, "loaded")) : setTimeout(ut, 100);
12722
+ const ft = async () => {
12723
+ ge[se].id ? (Z.set(se, !0), Array.from(Z.values()).every((Be) => Be) && w.set(j, "loaded")) : setTimeout(ft, 100);
12720
12724
  };
12721
- ut();
12725
+ ft();
12722
12726
  } else {
12723
- const ut = o.collections[H.collection], { access: Be } = ut, { serverReadOnly: xe } = Be;
12724
- xe?.includes(a.Role) ? _r([...Xe.Collection_Path], se).then((Re) => {
12727
+ const ft = o.collections[H.collection], { access: Be } = ft, { serverReadOnly: xe } = Be;
12728
+ xe?.includes(a.Role) ? vr([...Xe.Collection_Path], se).then((Re) => {
12725
12729
  if (!Re) {
12726
12730
  delete ge[se];
12727
12731
  return;
@@ -12730,7 +12734,7 @@ const Gw = async (r, e, t, n) => {
12730
12734
  Z.set(se, !0), ee[j].delete(se);
12731
12735
  return;
12732
12736
  }
12733
- ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((wr) => wr) && (w.set(j, "loaded"), z(K));
12737
+ ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((br) => br) && (w.set(j, "loaded"), z(K));
12734
12738
  }).catch((Re) => {
12735
12739
  delete ge[se], Re.code !== "permission-denied" && n && n(new Error(`Error fetching relation document in collection ${H.collection} with ID ${j} at location ${Xe.Collection_Path?.join("/")}`, {
12736
12740
  cause: Re
@@ -12747,7 +12751,7 @@ const Gw = async (r, e, t, n) => {
12747
12751
  oe[j].has(se) && oe[j].get(se)?.listener(), Z.set(se, !0), ee[j].delete(se);
12748
12752
  return;
12749
12753
  }
12750
- ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((wr) => wr) && (w.set(j, "loaded"), z(K));
12754
+ ge[se] = Re, Z.set(se, !0), Array.from(Z.values()).every((br) => br) && (w.set(j, "loaded"), z(K));
12751
12755
  },
12752
12756
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12753
12757
  (Re) => {
@@ -12780,23 +12784,24 @@ const Gw = async (r, e, t, n) => {
12780
12784
  }
12781
12785
  }, ne = (G, K, j) => {
12782
12786
  const Y = j.data({
12783
- serverTimestamps: P || "none"
12787
+ serverTimestamps: F || "none"
12784
12788
  });
12785
12789
  K.id ||= j.id, K = { ...K, ...Y }, delete K.Collection_Path_String;
12786
- const U = M.get(j.id) || /* @__PURE__ */ new Map(), Z = U.get(G) || /* @__PURE__ */ new Set();
12787
- lm(Y, Z), U.set(G, Z), M.set(j.id, U), x.set(j.id, K);
12788
- }, Me = s?.only === "cache" || g;
12790
+ const U = P.get(j.id) || /* @__PURE__ */ new Map(), Z = U.get(G) || /* @__PURE__ */ new Set();
12791
+ lm(Y, Z), U.set(G, Z), P.set(j.id, U), x.set(j.id, K);
12792
+ }, Me = s?.only === "cache" || m;
12793
+ m && s?.tempCache && await sr(h.collection, s.tempCache?.constraints, void 0, void 0, void 0, s.tempCache?.label);
12789
12794
  for (const G of R) {
12790
12795
  let K = !0;
12791
- const j = dr(G, { source: Me ? "cache" : "default", includeMetadataChanges: !0 }, (Y) => {
12796
+ const j = hr(G, { source: Me ? "cache" : "default", includeMetadataChanges: !0 }, (Y) => {
12792
12797
  (Me || Y.metadata.fromCache === !1) && (b.set(G, !0), v.first.set(R.indexOf(G), Y.docs[0]), v.last.set(R.indexOf(G), Y.docs.at(-1) || Y.docs[0]), I && s?.relations || z(v, Y.metadata)), b.get(G) === !0 && (K ? (Y.docs.forEach((U) => {
12793
- const Z = x.get(U.id) || {}, Te = D.get(U.id) || 0;
12794
- D.set(U.id, Te + 1), ne(G, Z, U);
12798
+ const Z = x.get(U.id) || {}, Te = M.get(U.id) || 0;
12799
+ M.set(U.id, Te + 1), ne(G, Z, U);
12795
12800
  }), K = !1) : Y.docChanges().forEach((U) => {
12796
- const Z = x.get(U.doc.id) || {}, Te = D.get(U.doc.id) || 0;
12797
- U.type === "added" && D.set(U.doc.id, Te + 1), U.type === "added" || U.type === "modified" ? ne(G, Z, U.doc) : U.type === "removed" && (D.set(U.doc.id, Te - 1), D.get(U.doc.id) === 0 && (x.delete(U.doc.id), b.size === R.length && s?.relations && (w.set(U.doc.id, "deleted"), te(U.doc.id))));
12801
+ const Z = x.get(U.doc.id) || {}, Te = M.get(U.doc.id) || 0;
12802
+ U.type === "added" && M.set(U.doc.id, Te + 1), U.type === "added" || U.type === "modified" ? ne(G, Z, U.doc) : U.type === "removed" && (M.set(U.doc.id, Te - 1), M.get(U.doc.id) === 0 && (x.delete(U.doc.id), b.size === R.length && s?.relations && (w.set(U.doc.id, "deleted"), te(U.doc.id))));
12798
12803
  }), b.size === R.length && s?.relations && (x.size === 0 && z(v, Y.metadata), x.forEach((U) => {
12799
- F(U, v);
12804
+ D(U, v);
12800
12805
  })));
12801
12806
  }, (Y) => {
12802
12807
  n && n(new Error(`Error fetching documents at location ${r.join("/")}`, { cause: Y })), O.forEach((U) => U());
@@ -12805,8 +12810,8 @@ const Gw = async (r, e, t, n) => {
12805
12810
  }
12806
12811
  let Se, Le;
12807
12812
  if (s?.pagination && !d?.roles.includes(a.Role) && !E?.includes(a.Role)) {
12808
- let G = me(C[0], ...e);
12809
- s.pagination.orderByField && s.pagination.orderByDirection && (G = me(G, rt(s.pagination.orderByField, s.pagination.orderByDirection)));
12813
+ let G = he(T[0], ...e);
12814
+ s.pagination.orderByField && s.pagination.orderByDirection && (G = he(G, rt(s.pagination.orderByField, s.pagination.orderByDirection)));
12810
12815
  const K = await Ed(G).catch(() => {
12811
12816
  });
12812
12817
  if (K) {
@@ -12840,19 +12845,19 @@ const Gw = async (r, e, t, n) => {
12840
12845
  await Fw(e, t, n, s, i, a);
12841
12846
  return;
12842
12847
  }
12843
- const f = Ha(r), h = cw(e), d = t ? pd(t) : void 0, m = n ? pd(n) : void 0, E = s ? Ha(s) : void 0, y = i ? Ha(i) : void 0, _ = a ? Tn(a) : void 0, S = c ? Tn(c) : void 0, T = Array.isArray(f) ? f : [f];
12844
- if (T.length === 0 || T.length === 1 && !T[0])
12848
+ const f = Ha(r), h = cw(e), d = t ? pd(t) : void 0, p = n ? pd(n) : void 0, E = s ? Ha(s) : void 0, y = i ? Ha(i) : void 0, _ = a ? Tn(a) : void 0, S = c ? Tn(c) : void 0, A = Array.isArray(f) ? f : [f];
12849
+ if (A.length === 0 || A.length === 1 && !A[0])
12845
12850
  throw new Error("No valid email addresses provided");
12846
- const P = We(), g = { to: f, message: { subject: h } };
12847
- if (d && (g.message.text = d), m && (g.message.html = m), E) {
12848
- const C = Array.isArray(E) ? E : [E];
12849
- C.length > 0 && C[0] && (g.cc = E);
12851
+ const F = We(), m = { to: f, message: { subject: h } };
12852
+ if (d && (m.message.text = d), p && (m.message.html = p), E) {
12853
+ const T = Array.isArray(E) ? E : [E];
12854
+ T.length > 0 && T[0] && (m.cc = E);
12850
12855
  }
12851
12856
  if (y) {
12852
- const C = Array.isArray(y) ? y : [y];
12853
- C.length > 0 && C[0] && (g.bcc = y);
12857
+ const T = Array.isArray(y) ? y : [y];
12858
+ T.length > 0 && T[0] && (m.bcc = y);
12854
12859
  }
12855
- _ && (g.replyTo = _), o && (g.message.attachments = o), S && (g.from = S), await Td(qr(P, "system_mail"), g);
12860
+ _ && (m.replyTo = _), o && (m.message.attachments = o), S && (m.from = S), await Td(qr(F, "system_mail"), m);
12856
12861
  }, Dw = async (r) => {
12857
12862
  const e = it(), t = ze(), n = Ue(e, t.STOKER_FB_FUNCTIONS_REGION);
12858
12863
  await Je(n, "stoker-adminsms")({
@@ -12895,7 +12900,7 @@ export {
12895
12900
  Kw as getAppCheck,
12896
12901
  Yw as getAppCheckFirestoreWrite,
12897
12902
  ie as getCachedConfigValue,
12898
- lt as getCollectionConfigModule,
12903
+ ut as getCollectionConfigModule,
12899
12904
  oc as getCollectionRefs,
12900
12905
  zt as getConnectionStatus,
12901
12906
  Hw as getCurrentUser,
@@ -12911,8 +12916,9 @@ export {
12911
12916
  To as getLoadingState,
12912
12917
  Tw as getMaintenanceInfo,
12913
12918
  Cw as getNetworkStatus,
12914
- _r as getOne,
12919
+ vr as getOne,
12915
12920
  mw as getOneServer,
12921
+ lw as getPreloadListeners,
12916
12922
  Ve as getSchema,
12917
12923
  pm as getSome,
12918
12924
  hw as getSomeServer,
@@ -12922,14 +12928,14 @@ export {
12922
12928
  Om as getVersionInfo,
12923
12929
  Wg as getZodSchema,
12924
12930
  Gw as initializeStoker,
12925
- sr as isDeleteSentinel,
12931
+ ir as isDeleteSentinel,
12926
12932
  lb as keepTimezone,
12927
12933
  tb as multiFactorEnroll,
12928
12934
  eb as onStokerPermissionsChange,
12929
12935
  Qw as onStokerReady,
12930
12936
  Xw as onStokerSignOut,
12931
12937
  Zw as preloadCache,
12932
- Mr as preloadCollection,
12938
+ sr as preloadCollection,
12933
12939
  ub as removeTimezone,
12934
12940
  Fw as sendAdminEmail,
12935
12941
  Dw as sendAdminSMS,