@stoker-platform/node-client 0.5.88 → 0.5.90

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
@@ -7,7 +7,7 @@ import { getFirestore as ea, Timestamp as ht, FieldValue as ge } from "firebase-
7
7
  import { pathToFileURL as mi } from "node:url";
8
8
  import ta from "cross-spawn";
9
9
  import { getDatabase as pi } from "firebase-admin/database";
10
- import { getAuth as Tt } from "firebase-admin/auth";
10
+ import { getAuth as Rt } from "firebase-admin/auth";
11
11
  const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.access) ? !1 : t.access.includes(e) : !0, na = (t, e) => {
12
12
  if (Kn(t.access))
13
13
  return e.fieldAccessGroups?.[t.access.group];
@@ -38,13 +38,13 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
38
38
  }, sa = (t, e, n, s) => {
39
39
  const r = na(t, e);
40
40
  return r ? Xn(r, e.labels.collection, n, s) : !1;
41
- }, es = (t) => !!t.auth, Ie = (t, e) => {
41
+ }, es = (t) => !!t.auth, Ne = (t, e) => {
42
42
  if (e?.operations)
43
43
  return e.operations.includes(t);
44
44
  }, Be = (t, e, n, s) => e ? e.Role ? Kn(t.access) ? !n || !s ? !1 : sa(t, n, e, s) : t.access?.includes(e.Role) : !1 : !0, yi = (t, e, n, s) => t === !0 ? !1 : Array.isArray(t) ? t.includes(e.Role) : typeof t == "object" && t !== null ? !n || !s ? !1 : Xn(t, n, e, s) : !0, ra = (t, e, n, s) => e ? e.Role ? yi(t.restrictCreate, e, n, s) : !1 : !0, gi = (t, e, n, s) => e ? e.Role ? yi(t.restrictUpdate, e, n, s) : !1 : !0, mr = (t, e, n, s) => {
45
45
  const { labels: r } = t;
46
46
  return n.collections && // eslint-disable-next-line security/detect-object-injection
47
- Ie("Update", n.collections[r.collection]) && (!e.access || Be(e, n, t, s)) && gi(e, n, r.collection, s) && !(t.auth && !n.collections?.[r.collection].auth && ["Enabled", "Role", "Name", "Email", "Photo_URL"].includes(e.name));
47
+ Ne("Update", n.collections[r.collection]) && (!e.access || Be(e, n, t, s)) && gi(e, n, r.collection, s) && !(t.auth && !n.collections?.[r.collection].auth && ["Enabled", "Role", "Name", "Email", "Photo_URL"].includes(e.name));
48
48
  }, V = (t, e) => t.filter((n) => n.name === e)[0], ee = (t) => ["OneToOne", "OneToMany", "ManyToOne", "ManyToMany"].includes(t.type), wi = (t, e) => {
49
49
  const n = {
50
50
  Record_Owner: "recordOwner",
@@ -117,24 +117,24 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
117
117
  h?.filter((v) => v.type === "Individual").forEach(() => {
118
118
  g = !0, l?.individualEntities?.includes(i.id) || (f = !1);
119
119
  });
120
- let T = !0, m = !1;
120
+ let R = !0, m = !1;
121
121
  if (h?.filter((v) => v.type === "Parent").forEach((v) => {
122
122
  m = !0;
123
123
  const N = V(a, v.collectionField);
124
- l?.parentEntities?.some((W) => i[`${N.name}_Array`].includes(W)) || (T = !1);
124
+ l?.parentEntities?.some((W) => i[`${N.name}_Array`].includes(W)) || (R = !1);
125
125
  }), h?.filter((v) => v.type === "Parent_Property").forEach((v) => {
126
126
  m = !0;
127
127
  const N = V(a, v.collectionField), W = V(a, v.propertyField);
128
128
  Object.entries(l?.parentPropertyEntities || {}).some((O) => {
129
- const [H, R] = O;
130
- return H === i[W.name] && i[`${N.name}_Array`].some((p) => R.includes(p));
131
- }) || (T = !1);
129
+ const [H, S] = O;
130
+ return H === i[W.name] && i[`${N.name}_Array`].some((p) => S.includes(p));
131
+ }) || (R = !1);
132
132
  }), g && m) {
133
- if (!(f || T)) {
133
+ if (!(f || R)) {
134
134
  c = !1;
135
135
  return;
136
136
  }
137
- } else if (!f || !T) {
137
+ } else if (!f || !R) {
138
138
  c = !1;
139
139
  return;
140
140
  }
@@ -156,15 +156,15 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
156
156
  c = !1;
157
157
  return;
158
158
  }
159
- H.parentEntities?.some((R) => i[`${O.name}_Array`].includes(R)) || (x = !1);
159
+ H.parentEntities?.some((S) => i[`${O.name}_Array`].includes(S)) || (x = !1);
160
160
  }), u?.filter((v) => v.parentFilter.type === "Parent_Property").forEach((v) => {
161
161
  k = !0;
162
- const { parentFilter: N } = v, W = V(a, N.collectionField), O = V(a, N.parentPropertyField), H = V(a, N.parentCollectionField), R = r.collections?.[W.collection];
163
- if (!R) {
162
+ const { parentFilter: N } = v, W = V(a, N.collectionField), O = V(a, N.parentPropertyField), H = V(a, N.parentCollectionField), S = r.collections?.[W.collection];
163
+ if (!S) {
164
164
  c = !1;
165
165
  return;
166
166
  }
167
- Object.entries(R.parentPropertyEntities || {}).some((p) => {
167
+ Object.entries(S.parentPropertyEntities || {}).some((p) => {
168
168
  const [C, I] = p;
169
169
  return C === i[O.name] && i[`${H.name}_Array`].some((P) => I.includes(P));
170
170
  }) || (x = !1);
@@ -183,7 +183,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
183
183
  let l = !0;
184
184
  if (!a || !r.Role)
185
185
  return l = !1, l;
186
- Ie(t, a) || (l = !1);
186
+ Ne(t, a) || (l = !1);
187
187
  const d = Gs(e, r)?.filter((h) => h.type === "Individual").length > 0;
188
188
  return t === "Create" && d && (l = !1), ia(t, e, n, s, r, i) || (l = !1), l;
189
189
  }, vi = (t, e, n) => {
@@ -328,11 +328,11 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
328
328
  }
329
329
  }), h?.assignable?.includes(n)))
330
330
  continue;
331
- let T = !1;
331
+ let R = !1;
332
332
  if (h?.restrictions?.forEach((m) => {
333
333
  for (const E of m.roles)
334
334
  if (E.role === n) {
335
- if (T = !0, m.type === "Individual" && !e.collections?.[o.collection]?.individualEntities) {
335
+ if (R = !0, m.type === "Individual" && !e.collections?.[o.collection]?.individualEntities) {
336
336
  r = `Collection ${o.collection} is missing individual entities`, s = !1;
337
337
  return;
338
338
  }
@@ -359,7 +359,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
359
359
  }
360
360
  }
361
361
  }
362
- }), T && !e.collections?.[o.collection]?.restrictEntities) {
362
+ }), R && !e.collections?.[o.collection]?.restrictEntities) {
363
363
  r = `Collection ${o.collection} must have restrictEntities set to true`, s = !1;
364
364
  return;
365
365
  }
@@ -371,19 +371,19 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
371
371
  const f = d?.filter((g) => s === g.userRole);
372
372
  return f?.length && !f.some((g) => g.recordRole === r) ? (u = `User ${s} does not have write access to record with role ${r}`, h = !1, h) : t === "update" && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
373
373
  o.User_ID && f?.length && !f.some((g) => g.recordRole === a) ? (u = `User ${s} does not have write access to record with role ${r}`, h = !1, h) : (d?.forEach((g) => {
374
- s === g.userRole && g.recordRole === r && t !== "delete" && i && Object.keys(n.collections).forEach((T) => {
375
- const m = i.collections?.[T], E = l?.collections?.[T];
374
+ s === g.userRole && g.recordRole === r && t !== "delete" && i && Object.keys(n.collections).forEach((R) => {
375
+ const m = i.collections?.[R], E = l?.collections?.[R];
376
376
  if (!(t === "update" && Je(m, E)) && m) {
377
- const w = g.collections.some((x) => x.collection === T);
377
+ const w = g.collections.some((x) => x.collection === R);
378
378
  if (w) {
379
379
  if (w) {
380
- const x = g.collections.find((v) => v.collection === T);
380
+ const x = g.collections.find((v) => v.collection === R);
381
381
  if (!(m.operations.every((v) => x.operations.includes(v)) || t === "update" && Je(m.operations, E?.operations))) {
382
- u = `User ${s} does not have write access to all included operations for collection ${T}`, h = !1;
382
+ u = `User ${s} does not have write access to all included operations for collection ${R}`, h = !1;
383
383
  return;
384
384
  }
385
385
  if (!x.auth && m.auth && !(t === "update" && Je(m.auth, E?.auth))) {
386
- u = `User ${s} does not have write access to auth for collection ${T}`, h = !1;
386
+ u = `User ${s} does not have write access to auth for collection ${R}`, h = !1;
387
387
  return;
388
388
  }
389
389
  const k = {
@@ -394,16 +394,16 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
394
394
  if (Object.keys(k).forEach((v) => {
395
395
  const N = k[v];
396
396
  if (x.attributeRestrictions?.includes(N) && !(m[v]?.active || t === "update" && Je(m[v], E?.[v]))) {
397
- u = `User ${s} does not have write access to attribute restriction ${v} for collection ${T}`, h = !1;
397
+ u = `User ${s} does not have write access to attribute restriction ${v} for collection ${R}`, h = !1;
398
398
  return;
399
399
  }
400
400
  }), x.restrictEntities && !m.restrictEntities && !(t === "update" && Je(m.restrictEntities, E?.restrictEntities))) {
401
- u = `User ${s} does not have write access to restrictEntities for collection ${T}`, h = !1;
401
+ u = `User ${s} does not have write access to restrictEntities for collection ${R}`, h = !1;
402
402
  return;
403
403
  }
404
404
  }
405
405
  } else {
406
- u = `User ${s} does not have write access to collection ${T}`, h = !1;
406
+ u = `User ${s} does not have write access to collection ${R}`, h = !1;
407
407
  return;
408
408
  }
409
409
  }
@@ -418,7 +418,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
418
418
  return;
419
419
  }
420
420
  for (const d of a?.operations || [])
421
- if (!l?.operations.includes(d) && (!Ie("Read", c) || !Ie(d, c))) {
421
+ if (!l?.operations.includes(d) && (!Ne("Read", c) || !Ne(d, c))) {
422
422
  i = `User does not have ${d.toLowerCase()} access to collection ${o.labels.collection}`, r = !1;
423
423
  return;
424
424
  }
@@ -466,7 +466,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
466
466
  let h = !0;
467
467
  if (r && !d)
468
468
  throw new Error("PERMISSION_DENIED");
469
- r && !Ie("Create", d) && (h = !1), r && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
469
+ r && !Ne("Create", d) && (h = !1), r && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
470
470
  !dt("Create", n, s, r, i, t) && (h = !1), n.auth && o && (r && !es(d) && (h = !1), Ys("create", t, e, n, s, r, i, o) || (h = !1));
471
471
  for (const u of c) {
472
472
  const f = t[u.name];
@@ -474,31 +474,31 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
474
474
  }
475
475
  if (!h)
476
476
  throw new Error("PERMISSION_DENIED");
477
- }, De = (t) => t && (t._methodName === "deleteField" || t.constructor.name === "DeleteTransform"), at = (t) => {
477
+ }, ke = (t) => t && (t._methodName === "deleteField" || t.constructor.name === "DeleteTransform"), Qe = (t) => {
478
478
  for (const e in t)
479
- Object.prototype.hasOwnProperty.call(t, e) && (De(t[e]) ? delete t[e] : typeof t[e] == "object" && t[e] !== null && at(t[e]));
479
+ Object.prototype.hasOwnProperty.call(t, e) && (ke(t[e]) ? delete t[e] : typeof t[e] == "object" && t[e] !== null && Qe(t[e]));
480
480
  }, yr = (t, e, n, s, r, i, o, a, l, c, d) => {
481
481
  const { labels: h, fields: u } = s, f = o?.collections?.[h.collection], g = { ...e, ...t };
482
- at(g);
483
- let T = !0, m = "";
482
+ Qe(g);
483
+ let R = !0, m = "";
484
484
  if (i && !f)
485
485
  throw new Error("PERMISSION_DENIED");
486
- i && !Ie("Update", f) && (T = !1, m = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
486
+ i && !Ne("Update", f) && (R = !1, m = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
487
487
  (!dt("Update", s, r, i, o, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
488
- !dt("Update", s, r, i, o, g)) && (T = !1, m = "Authenticated user does not have Update access to this document"), i && s.softDelete && g[s.softDelete.archivedField] !== e[s.softDelete.archivedField] && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
489
- !Ie("Delete", f) && (T = !1, m = "Authenticated user does not have Delete or Restore access to this document"), a && (i && !es(f) && (T = !1, m = "Authenticated user does not have Auth access for this collection"), Ys("update", g, n, s, r, i, o, l, c, e, a) || (m = "Authenticated user does not have sufficient write access for this record", T = !1));
488
+ !dt("Update", s, r, i, o, g)) && (R = !1, m = "Authenticated user does not have Update access to this document"), i && s.softDelete && g[s.softDelete.archivedField] !== e[s.softDelete.archivedField] && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
489
+ !Ne("Delete", f) && (R = !1, m = "Authenticated user does not have Delete or Restore access to this document"), a && (i && !es(f) && (R = !1, m = "Authenticated user does not have Auth access for this collection"), Ys("update", g, n, s, r, i, o, l, c, e, a) || (m = "Authenticated user does not have sufficient write access for this record", R = !1));
490
490
  for (const E of u) {
491
491
  const w = t[E.name];
492
- E.access && !Be(E, o, s, d) && w !== void 0 && (m = `Authenticated user does not have access to field ${E.name}`, T = !1), w !== void 0 && !gi(E, o, h.collection, d) && (m = `Authenticated user does not have Update access to field ${E.name}`, T = !1);
492
+ E.access && !Be(E, o, s, d) && w !== void 0 && (m = `Authenticated user does not have access to field ${E.name}`, R = !1), w !== void 0 && !gi(E, o, h.collection, d) && (m = `Authenticated user does not have Update access to field ${E.name}`, R = !1);
493
493
  }
494
- if (!T)
494
+ if (!R)
495
495
  throw m && console.error(`PERMISSION_DENIED: ${m}`), new Error("PERMISSION_DENIED");
496
496
  }, ua = (t, e, n, s, r, i) => {
497
497
  const { labels: o } = n, a = i.collections?.[o.collection];
498
498
  let l = !0;
499
499
  if (!a)
500
500
  throw new Error("PERMISSION_DENIED");
501
- if (Ie("Delete", a) || (l = !1), dt("Delete", n, s, r, i, t) || (l = !1), n.auth && t.User_ID && (es(a) || (l = !1), Ys("delete", t, e, n, s, r, i) || (l = !1)), !l)
501
+ if (Ne("Delete", a) || (l = !1), dt("Delete", n, s, r, i, t) || (l = !1), n.auth && t.User_ID && (es(a) || (l = !1), Ys("delete", t, e, n, s, r, i) || (l = !1)), !l)
502
502
  throw new Error("PERMISSION_DENIED");
503
503
  }, da = async (t, e, n, s, r) => {
504
504
  const { labels: i } = e, o = r.collections?.[i.collection];
@@ -507,7 +507,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
507
507
  a = !1;
508
508
  return;
509
509
  }
510
- if (Ie("Read", o) || (a = !1), dt("Read", e, n, s, r, t) || (a = !1), !a)
510
+ if (Ne("Read", o) || (a = !1), dt("Read", e, n, s, r, t) || (a = !1), !a)
511
511
  throw new Error("PERMISSION_DENIED");
512
512
  }, fa = async (t, e, n, s, r) => {
513
513
  const { labels: i } = e, o = r.collections?.[i.collection];
@@ -516,7 +516,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
516
516
  a = !1;
517
517
  return;
518
518
  }
519
- if (Ie("Read", o) || (a = !1), t.forEach((l) => {
519
+ if (Ne("Read", o) || (a = !1), t.forEach((l) => {
520
520
  dt("Read", e, n, s, r, l) || (a = !1);
521
521
  }), !a)
522
522
  throw new Error("PERMISSION_DENIED");
@@ -558,7 +558,7 @@ const Kn = (t) => !!t && !Array.isArray(t), ln = (t, e) => t.access ? Kn(t.acces
558
558
  i[o] = l;
559
559
  }
560
560
  return i;
561
- }, Ue = (t, e) => e.fields.filter((n) => n.name === t.name)[0], ls = {
561
+ }, We = (t, e) => e.fields.filter((n) => n.name === t.name)[0], ls = {
562
562
  global: {},
563
563
  collections: {}
564
564
  }, Qt = (t, e) => t && typeof t == "function" ? e ? t(...e) : t() : t, ae = async (t, e) => {
@@ -879,7 +879,7 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
879
879
  return e.forEach((o) => {
880
880
  ee(o) && ["OneToOne", "OneToMany"].includes(o.type) && o.sorting && (typeof o.sorting == "boolean" || !o.sorting.roles?.every((a) => r?.includes(a))) && i.add(o);
881
881
  }), i;
882
- }, St = (t, e) => {
882
+ }, Tt = (t, e) => {
883
883
  const { access: n, recordTitleField: s } = t, { serverReadOnly: r } = n, i = /* @__PURE__ */ new Set();
884
884
  return e.forEach((o) => {
885
885
  (s === o.name || o.sorting && (typeof o.sorting == "boolean" || !o.sorting.roles?.every((a) => r?.includes(a)))) && o.type === "String" && i.add(o);
@@ -897,7 +897,7 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
897
897
  s.forEach((i) => {
898
898
  if (ee(i))
899
899
  if (e[i.name]) {
900
- if (De(e[i.name]))
900
+ if (ke(e[i.name]))
901
901
  e[`${i.name}_Array`] = e[i.name];
902
902
  else if (Object.keys(e[i.name]).forEach((o) => {
903
903
  const a = e[i.name][o];
@@ -905,7 +905,7 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
905
905
  }), e[`${i.name}_Array`] = Object.keys(e[i.name]), i.includeFields)
906
906
  for (const o of i.includeFields) {
907
907
  const a = n.collections[i.collection], l = V(a.fields, o);
908
- St(a, [l]).size === 1 && Object.keys(e[i.name]).forEach((d) => {
908
+ Tt(a, [l]).size === 1 && Object.keys(e[i.name]).forEach((d) => {
909
909
  e[i.name][d][o] ? e[i.name][d][`${o}_Lowercase`] = e[i.name][d][o].toLowerCase() : delete e[i.name][d][`${o}_Lowercase`];
910
910
  });
911
911
  }
@@ -913,7 +913,7 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
913
913
  delete e[`${i.name}_Array`], delete e[`${i.name}_Single`];
914
914
  }), Et(t, s).forEach((i) => {
915
915
  if (e[i.name])
916
- if (De(e[i.name]))
916
+ if (ke(e[i.name]))
917
917
  e[`${i.name}_Single`] = e[i.name];
918
918
  else {
919
919
  const o = e[`${i.name}_Array`]?.[0];
@@ -924,14 +924,14 @@ const Ks = (t, e, n, s, r, i, o, a, l, c) => (t === "create" && (n.Collection_Pa
924
924
  }
925
925
  });
926
926
  }, Pn = (t, e) => {
927
- St(t, t.fields).forEach((s) => {
927
+ Tt(t, t.fields).forEach((s) => {
928
928
  e[s.name] ? e[`${s.name}_Lowercase`] = e[s.name].toLowerCase() : delete e[`${s.name}_Lowercase`];
929
929
  });
930
930
  }, va = async (t, e, n, s, r) => {
931
931
  const { fields: i } = e;
932
932
  for (const o of n.fields) {
933
933
  const a = V(i, o.name);
934
- o.custom?.initialValue !== void 0 && (!a.access || Be(a, s, e, r || {})) && (t[o.name] = await ae(o.custom.initialValue, [t]), St(e, [a]).size === 1 && (t[`${o.name}_Lowercase`] = t[o.name].toLowerCase()));
934
+ o.custom?.initialValue !== void 0 && (!a.access || Be(a, s, e, r || {})) && (t[o.name] = await ae(o.custom.initialValue, [t]), Tt(e, [a]).size === 1 && (t[`${o.name}_Lowercase`] = t[o.name].toLowerCase()));
935
935
  }
936
936
  for (const o of i)
937
937
  (!o.access || Be(o, s, e, r || {})) && ("autoIncrement" in o && o.autoIncrement && !t[o.name] && (t[o.name] = "Pending"), !ee(o) && o.nullable && t[o.name] === void 0 && (t[o.name] = null));
@@ -1002,7 +1002,7 @@ const Z = se.arrayToEnum([
1002
1002
  "never",
1003
1003
  "map",
1004
1004
  "set"
1005
- ]), rt = (t) => {
1005
+ ]), it = (t) => {
1006
1006
  switch (typeof t) {
1007
1007
  case "undefined":
1008
1008
  return Z.undefined;
@@ -1041,7 +1041,7 @@ const Z = se.arrayToEnum([
1041
1041
  "not_multiple_of",
1042
1042
  "not_finite"
1043
1043
  ]);
1044
- class Xe extends Error {
1044
+ class et extends Error {
1045
1045
  get errors() {
1046
1046
  return this.issues;
1047
1047
  }
@@ -1078,7 +1078,7 @@ class Xe extends Error {
1078
1078
  return r(this), s;
1079
1079
  }
1080
1080
  static assert(e) {
1081
- if (!(e instanceof Xe))
1081
+ if (!(e instanceof et))
1082
1082
  throw new Error(`Not a ZodError: ${e}`);
1083
1083
  }
1084
1084
  toString() {
@@ -1104,8 +1104,8 @@ class Xe extends Error {
1104
1104
  return this.flatten();
1105
1105
  }
1106
1106
  }
1107
- Xe.create = (t) => new Xe(t);
1108
- const Rs = (t, e) => {
1107
+ et.create = (t) => new et(t);
1108
+ const Ss = (t, e) => {
1109
1109
  let n;
1110
1110
  switch (t.code) {
1111
1111
  case A.invalid_type:
@@ -1161,7 +1161,7 @@ const Rs = (t, e) => {
1161
1161
  }
1162
1162
  return { message: n };
1163
1163
  };
1164
- let Oa = Rs;
1164
+ let Oa = Ss;
1165
1165
  function ka() {
1166
1166
  return Oa;
1167
1167
  }
@@ -1198,13 +1198,13 @@ function L(t, e) {
1198
1198
  // then schema-bound map if available
1199
1199
  n,
1200
1200
  // then global override map
1201
- n === Rs ? void 0 : Rs
1201
+ n === Ss ? void 0 : Ss
1202
1202
  // then global default map
1203
1203
  ].filter((r) => !!r)
1204
1204
  });
1205
1205
  t.common.issues.push(s);
1206
1206
  }
1207
- class ke {
1207
+ class Re {
1208
1208
  constructor() {
1209
1209
  this.value = "valid";
1210
1210
  }
@@ -1232,7 +1232,7 @@ class ke {
1232
1232
  value: o
1233
1233
  });
1234
1234
  }
1235
- return ke.mergeObjectSync(e, s);
1235
+ return Re.mergeObjectSync(e, s);
1236
1236
  }
1237
1237
  static mergeObjectSync(e, n) {
1238
1238
  const s = {};
@@ -1247,7 +1247,7 @@ class ke {
1247
1247
  }
1248
1248
  const Q = Object.freeze({
1249
1249
  status: "aborted"
1250
- }), Kt = (t) => ({ status: "dirty", value: t }), Me = (t) => ({ status: "valid", value: t }), wr = (t) => t.status === "aborted", _r = (t) => t.status === "dirty", Pt = (t) => t.status === "valid", Ln = (t) => typeof Promise < "u" && t instanceof Promise;
1250
+ }), Kt = (t) => ({ status: "dirty", value: t }), Pe = (t) => ({ status: "valid", value: t }), wr = (t) => t.status === "aborted", _r = (t) => t.status === "dirty", Pt = (t) => t.status === "valid", Ln = (t) => typeof Promise < "u" && t instanceof Promise;
1251
1251
  var q;
1252
1252
  (function(t) {
1253
1253
  t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
@@ -1270,7 +1270,7 @@ const Er = (t, e) => {
1270
1270
  get error() {
1271
1271
  if (this._error)
1272
1272
  return this._error;
1273
- const n = new Xe(t.common.issues);
1273
+ const n = new et(t.common.issues);
1274
1274
  return this._error = n, this._error;
1275
1275
  }
1276
1276
  };
@@ -1291,13 +1291,13 @@ class te {
1291
1291
  return this._def.description;
1292
1292
  }
1293
1293
  _getType(e) {
1294
- return rt(e.data);
1294
+ return it(e.data);
1295
1295
  }
1296
1296
  _getOrReturnCtx(e, n) {
1297
1297
  return n || {
1298
1298
  common: e.parent.common,
1299
1299
  data: e.data,
1300
- parsedType: rt(e.data),
1300
+ parsedType: it(e.data),
1301
1301
  schemaErrorMap: this._def.errorMap,
1302
1302
  path: e.path,
1303
1303
  parent: e.parent
@@ -1305,11 +1305,11 @@ class te {
1305
1305
  }
1306
1306
  _processInputParams(e) {
1307
1307
  return {
1308
- status: new ke(),
1308
+ status: new Re(),
1309
1309
  ctx: {
1310
1310
  common: e.parent.common,
1311
1311
  data: e.data,
1312
- parsedType: rt(e.data),
1312
+ parsedType: it(e.data),
1313
1313
  schemaErrorMap: this._def.errorMap,
1314
1314
  path: e.path,
1315
1315
  parent: e.parent
@@ -1343,7 +1343,7 @@ class te {
1343
1343
  schemaErrorMap: this._def.errorMap,
1344
1344
  parent: null,
1345
1345
  data: e,
1346
- parsedType: rt(e)
1346
+ parsedType: it(e)
1347
1347
  }, r = this._parseSync({ data: e, path: s.path, parent: s });
1348
1348
  return Er(s, r);
1349
1349
  }
@@ -1357,7 +1357,7 @@ class te {
1357
1357
  schemaErrorMap: this._def.errorMap,
1358
1358
  parent: null,
1359
1359
  data: e,
1360
- parsedType: rt(e)
1360
+ parsedType: it(e)
1361
1361
  };
1362
1362
  if (!this["~standard"].async)
1363
1363
  try {
@@ -1396,7 +1396,7 @@ class te {
1396
1396
  schemaErrorMap: this._def.errorMap,
1397
1397
  parent: null,
1398
1398
  data: e,
1399
- parsedType: rt(e)
1399
+ parsedType: it(e)
1400
1400
  }, r = this._parse({ data: e, path: s.path, parent: s }), i = await (Ln(r) ? r : Promise.resolve(r));
1401
1401
  return Er(s, i);
1402
1402
  }
@@ -1504,20 +1504,20 @@ class te {
1504
1504
  return this.safeParse(null).success;
1505
1505
  }
1506
1506
  }
1507
- const Ta = /^c[^\s-]{8,}$/i, Sa = /^[0-9a-z]+$/, Ra = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ia = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, xa = /^[a-z0-9_-]{21}$/i, Na = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Aa = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Da = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ca = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1507
+ const Ra = /^c[^\s-]{8,}$/i, Ta = /^[0-9a-z]+$/, Sa = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ia = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, xa = /^[a-z0-9_-]{21}$/i, Na = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Aa = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Da = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ca = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1508
1508
  let ds;
1509
- const Fa = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, $a = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ma = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Pa = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, La = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Va = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ti = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Ua = new RegExp(`^${Ti}$`);
1510
- function Si(t) {
1509
+ const Fa = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, $a = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ma = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Pa = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, La = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Va = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ri = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Ua = new RegExp(`^${Ri}$`);
1510
+ function Ti(t) {
1511
1511
  let e = "[0-5]\\d";
1512
1512
  t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
1513
1513
  const n = t.precision ? "+" : "?";
1514
1514
  return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`;
1515
1515
  }
1516
1516
  function Wa(t) {
1517
- return new RegExp(`^${Si(t)}$`);
1517
+ return new RegExp(`^${Ti(t)}$`);
1518
1518
  }
1519
1519
  function ja(t) {
1520
- let e = `${Ti}T${Si(t)}`;
1520
+ let e = `${Ri}T${Ti(t)}`;
1521
1521
  const n = [];
1522
1522
  return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
1523
1523
  }
@@ -1540,7 +1540,7 @@ function za(t, e) {
1540
1540
  function qa(t, e) {
1541
1541
  return !!((e === "v4" || !e) && $a.test(t) || (e === "v6" || !e) && Pa.test(t));
1542
1542
  }
1543
- class Qe extends te {
1543
+ class Ke extends te {
1544
1544
  _parse(e) {
1545
1545
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== Z.string) {
1546
1546
  const i = this._getOrReturnCtx(e);
@@ -1550,7 +1550,7 @@ class Qe extends te {
1550
1550
  received: i.parsedType
1551
1551
  }), Q;
1552
1552
  }
1553
- const s = new ke();
1553
+ const s = new Re();
1554
1554
  let r;
1555
1555
  for (const i of this._def.checks)
1556
1556
  if (i.kind === "min")
@@ -1613,19 +1613,19 @@ class Qe extends te {
1613
1613
  message: i.message
1614
1614
  }), s.dirty());
1615
1615
  else if (i.kind === "cuid")
1616
- Ta.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1616
+ Ra.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1617
1617
  validation: "cuid",
1618
1618
  code: A.invalid_string,
1619
1619
  message: i.message
1620
1620
  }), s.dirty());
1621
1621
  else if (i.kind === "cuid2")
1622
- Sa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1622
+ Ta.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1623
1623
  validation: "cuid2",
1624
1624
  code: A.invalid_string,
1625
1625
  message: i.message
1626
1626
  }), s.dirty());
1627
1627
  else if (i.kind === "ulid")
1628
- Ra.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1628
+ Sa.test(e.data) || (r = this._getOrReturnCtx(e, r), L(r, {
1629
1629
  validation: "ulid",
1630
1630
  code: A.invalid_string,
1631
1631
  message: i.message
@@ -1703,7 +1703,7 @@ class Qe extends te {
1703
1703
  });
1704
1704
  }
1705
1705
  _addCheck(e) {
1706
- return new Qe({
1706
+ return new Ke({
1707
1707
  ...this._def,
1708
1708
  checks: [...this._def.checks, e]
1709
1709
  });
@@ -1839,19 +1839,19 @@ class Qe extends te {
1839
1839
  return this.min(1, q.errToObj(e));
1840
1840
  }
1841
1841
  trim() {
1842
- return new Qe({
1842
+ return new Ke({
1843
1843
  ...this._def,
1844
1844
  checks: [...this._def.checks, { kind: "trim" }]
1845
1845
  });
1846
1846
  }
1847
1847
  toLowerCase() {
1848
- return new Qe({
1848
+ return new Ke({
1849
1849
  ...this._def,
1850
1850
  checks: [...this._def.checks, { kind: "toLowerCase" }]
1851
1851
  });
1852
1852
  }
1853
1853
  toUpperCase() {
1854
- return new Qe({
1854
+ return new Ke({
1855
1855
  ...this._def,
1856
1856
  checks: [...this._def.checks, { kind: "toUpperCase" }]
1857
1857
  });
@@ -1917,7 +1917,7 @@ class Qe extends te {
1917
1917
  return e;
1918
1918
  }
1919
1919
  }
1920
- Qe.create = (t) => new Qe({
1920
+ Ke.create = (t) => new Ke({
1921
1921
  checks: [],
1922
1922
  typeName: Y.ZodString,
1923
1923
  coerce: t?.coerce ?? !1,
@@ -1941,7 +1941,7 @@ class Lt extends te {
1941
1941
  }), Q;
1942
1942
  }
1943
1943
  let s;
1944
- const r = new ke();
1944
+ const r = new Re();
1945
1945
  for (const i of this._def.checks)
1946
1946
  i.kind === "int" ? se.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), L(s, {
1947
1947
  code: A.invalid_type,
@@ -2113,7 +2113,7 @@ class cn extends te {
2113
2113
  if (this._getType(e) !== Z.bigint)
2114
2114
  return this._getInvalidInput(e);
2115
2115
  let s;
2116
- const r = new ke();
2116
+ const r = new Re();
2117
2117
  for (const i of this._def.checks)
2118
2118
  i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), L(s, {
2119
2119
  code: A.too_small,
@@ -2242,7 +2242,7 @@ class Is extends te {
2242
2242
  received: s.parsedType
2243
2243
  }), Q;
2244
2244
  }
2245
- return Me(e.data);
2245
+ return Pe(e.data);
2246
2246
  }
2247
2247
  }
2248
2248
  Is.create = (t) => new Is({
@@ -2266,7 +2266,7 @@ class Vn extends te {
2266
2266
  code: A.invalid_date
2267
2267
  }), Q;
2268
2268
  }
2269
- const s = new ke();
2269
+ const s = new Re();
2270
2270
  let r;
2271
2271
  for (const i of this._def.checks)
2272
2272
  i.kind === "min" ? e.data.getTime() < i.value && (r = this._getOrReturnCtx(e, r), L(r, {
@@ -2338,7 +2338,7 @@ class vr extends te {
2338
2338
  received: s.parsedType
2339
2339
  }), Q;
2340
2340
  }
2341
- return Me(e.data);
2341
+ return Pe(e.data);
2342
2342
  }
2343
2343
  }
2344
2344
  vr.create = (t) => new vr({
@@ -2355,7 +2355,7 @@ class xs extends te {
2355
2355
  received: s.parsedType
2356
2356
  }), Q;
2357
2357
  }
2358
- return Me(e.data);
2358
+ return Pe(e.data);
2359
2359
  }
2360
2360
  }
2361
2361
  xs.create = (t) => new xs({
@@ -2372,7 +2372,7 @@ class Or extends te {
2372
2372
  received: s.parsedType
2373
2373
  }), Q;
2374
2374
  }
2375
- return Me(e.data);
2375
+ return Pe(e.data);
2376
2376
  }
2377
2377
  }
2378
2378
  Or.create = (t) => new Or({
@@ -2384,7 +2384,7 @@ class Ns extends te {
2384
2384
  super(...arguments), this._any = !0;
2385
2385
  }
2386
2386
  _parse(e) {
2387
- return Me(e.data);
2387
+ return Pe(e.data);
2388
2388
  }
2389
2389
  }
2390
2390
  Ns.create = (t) => new Ns({
@@ -2396,7 +2396,7 @@ class kr extends te {
2396
2396
  super(...arguments), this._unknown = !0;
2397
2397
  }
2398
2398
  _parse(e) {
2399
- return Me(e.data);
2399
+ return Pe(e.data);
2400
2400
  }
2401
2401
  }
2402
2402
  kr.create = (t) => new kr({
@@ -2427,7 +2427,7 @@ class br extends te {
2427
2427
  received: s.parsedType
2428
2428
  }), Q;
2429
2429
  }
2430
- return Me(e.data);
2430
+ return Pe(e.data);
2431
2431
  }
2432
2432
  }
2433
2433
  br.create = (t) => new br({
@@ -2470,9 +2470,9 @@ class ze extends te {
2470
2470
  exact: !1,
2471
2471
  message: r.maxLength.message
2472
2472
  }), s.dirty()), n.common.async)
2473
- return Promise.all([...n.data].map((o, a) => r.type._parseAsync(new He(n, o, n.path, a)))).then((o) => ke.mergeArray(s, o));
2473
+ return Promise.all([...n.data].map((o, a) => r.type._parseAsync(new He(n, o, n.path, a)))).then((o) => Re.mergeArray(s, o));
2474
2474
  const i = [...n.data].map((o, a) => r.type._parseSync(new He(n, o, n.path, a)));
2475
- return ke.mergeArray(s, i);
2475
+ return Re.mergeArray(s, i);
2476
2476
  }
2477
2477
  get element() {
2478
2478
  return this._def.type;
@@ -2594,7 +2594,7 @@ class me extends te {
2594
2594
  });
2595
2595
  }
2596
2596
  return c;
2597
- }).then((c) => ke.mergeObjectSync(s, c)) : ke.mergeObjectSync(s, l);
2597
+ }).then((c) => Re.mergeObjectSync(s, c)) : Re.mergeObjectSync(s, l);
2598
2598
  }
2599
2599
  get shape() {
2600
2600
  return this._def.shape();
@@ -2786,7 +2786,7 @@ class me extends te {
2786
2786
  });
2787
2787
  }
2788
2788
  keyof() {
2789
- return Ri(se.objectKeys(this.shape));
2789
+ return Si(se.objectKeys(this.shape));
2790
2790
  }
2791
2791
  }
2792
2792
  me.create = (t, e) => new me({
@@ -2820,7 +2820,7 @@ class Un extends te {
2820
2820
  for (const a of i)
2821
2821
  if (a.result.status === "dirty")
2822
2822
  return n.common.issues.push(...a.ctx.common.issues), a.result;
2823
- const o = i.map((a) => new Xe(a.ctx.common.issues));
2823
+ const o = i.map((a) => new et(a.ctx.common.issues));
2824
2824
  return L(n, {
2825
2825
  code: A.invalid_union,
2826
2826
  unionErrors: o
@@ -2867,7 +2867,7 @@ class Un extends te {
2867
2867
  }
2868
2868
  if (i)
2869
2869
  return n.common.issues.push(...i.ctx.common.issues), i.result;
2870
- const a = o.map((l) => new Xe(l));
2870
+ const a = o.map((l) => new et(l));
2871
2871
  return L(n, {
2872
2872
  code: A.invalid_union,
2873
2873
  unionErrors: a
@@ -2884,7 +2884,7 @@ Un.create = (t, e) => new Un({
2884
2884
  ...X(e)
2885
2885
  });
2886
2886
  function As(t, e) {
2887
- const n = rt(t), s = rt(e);
2887
+ const n = it(t), s = it(e);
2888
2888
  if (t === e)
2889
2889
  return { valid: !0, data: t };
2890
2890
  if (n === Z.object && s === Z.object) {
@@ -2975,7 +2975,7 @@ class bt extends te {
2975
2975
  const l = this._def.items[a] || this._def.rest;
2976
2976
  return l ? l._parse(new He(s, o, s.path, a)) : null;
2977
2977
  }).filter((o) => !!o);
2978
- return s.common.async ? Promise.all(i).then((o) => ke.mergeArray(n, o)) : ke.mergeArray(n, i);
2978
+ return s.common.async ? Promise.all(i).then((o) => Re.mergeArray(n, o)) : Re.mergeArray(n, i);
2979
2979
  }
2980
2980
  get items() {
2981
2981
  return this._def.items;
@@ -3019,7 +3019,7 @@ class jn extends te {
3019
3019
  value: o._parse(new He(s, s.data[a], s.path, a)),
3020
3020
  alwaysSet: a in s.data
3021
3021
  });
3022
- return s.common.async ? ke.mergeObjectAsync(n, r) : ke.mergeObjectSync(n, r);
3022
+ return s.common.async ? Re.mergeObjectAsync(n, r) : Re.mergeObjectSync(n, r);
3023
3023
  }
3024
3024
  get element() {
3025
3025
  return this._def.valueType;
@@ -3031,14 +3031,14 @@ class jn extends te {
3031
3031
  typeName: Y.ZodRecord,
3032
3032
  ...X(s)
3033
3033
  }) : new jn({
3034
- keyType: Qe.create(),
3034
+ keyType: Ke.create(),
3035
3035
  valueType: e,
3036
3036
  typeName: Y.ZodRecord,
3037
3037
  ...X(n)
3038
3038
  });
3039
3039
  }
3040
3040
  }
3041
- class Tr extends te {
3041
+ class Rr extends te {
3042
3042
  get keySchema() {
3043
3043
  return this._def.keyType;
3044
3044
  }
@@ -3080,7 +3080,7 @@ class Tr extends te {
3080
3080
  }
3081
3081
  }
3082
3082
  }
3083
- Tr.create = (t, e, n) => new Tr({
3083
+ Rr.create = (t, e, n) => new Rr({
3084
3084
  valueType: e,
3085
3085
  keyType: t,
3086
3086
  typeName: Y.ZodMap,
@@ -3150,7 +3150,7 @@ un.create = (t, e) => new un({
3150
3150
  typeName: Y.ZodSet,
3151
3151
  ...X(e)
3152
3152
  });
3153
- class Sr extends te {
3153
+ class Tr extends te {
3154
3154
  get schema() {
3155
3155
  return this._def.getter();
3156
3156
  }
@@ -3159,7 +3159,7 @@ class Sr extends te {
3159
3159
  return this._def.getter()._parse({ data: n.data, path: n.path, parent: n });
3160
3160
  }
3161
3161
  }
3162
- Sr.create = (t, e) => new Sr({
3162
+ Tr.create = (t, e) => new Tr({
3163
3163
  getter: t,
3164
3164
  typeName: Y.ZodLazy,
3165
3165
  ...X(e)
@@ -3185,7 +3185,7 @@ Ds.create = (t, e) => new Ds({
3185
3185
  typeName: Y.ZodLiteral,
3186
3186
  ...X(e)
3187
3187
  });
3188
- function Ri(t, e) {
3188
+ function Si(t, e) {
3189
3189
  return new Vt({
3190
3190
  values: t,
3191
3191
  typeName: Y.ZodEnum,
@@ -3210,7 +3210,7 @@ class Vt extends te {
3210
3210
  options: s
3211
3211
  }), Q;
3212
3212
  }
3213
- return Me(e.data);
3213
+ return Pe(e.data);
3214
3214
  }
3215
3215
  get options() {
3216
3216
  return this._def.values;
@@ -3246,8 +3246,8 @@ class Vt extends te {
3246
3246
  });
3247
3247
  }
3248
3248
  }
3249
- Vt.create = Ri;
3250
- class Rr extends te {
3249
+ Vt.create = Si;
3250
+ class Sr extends te {
3251
3251
  _parse(e) {
3252
3252
  const n = se.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
3253
3253
  if (s.parsedType !== Z.string && s.parsedType !== Z.number) {
@@ -3266,13 +3266,13 @@ class Rr extends te {
3266
3266
  options: r
3267
3267
  }), Q;
3268
3268
  }
3269
- return Me(e.data);
3269
+ return Pe(e.data);
3270
3270
  }
3271
3271
  get enum() {
3272
3272
  return this._def.values;
3273
3273
  }
3274
3274
  }
3275
- Rr.create = (t, e) => new Rr({
3275
+ Sr.create = (t, e) => new Sr({
3276
3276
  values: t,
3277
3277
  typeName: Y.ZodNativeEnum,
3278
3278
  ...X(e)
@@ -3290,7 +3290,7 @@ class Zn extends te {
3290
3290
  received: n.parsedType
3291
3291
  }), Q;
3292
3292
  const s = n.parsedType === Z.promise ? n.data : Promise.resolve(n.data);
3293
- return Me(s.then((r) => this._def.type.parseAsync(r, {
3293
+ return Pe(s.then((r) => this._def.type.parseAsync(r, {
3294
3294
  path: n.path,
3295
3295
  errorMap: n.common.contextualErrorMap
3296
3296
  })));
@@ -3395,7 +3395,7 @@ Ut.createWithPreprocess = (t, e, n) => new Ut({
3395
3395
  });
3396
3396
  class ct extends te {
3397
3397
  _parse(e) {
3398
- return this._getType(e) === Z.undefined ? Me(void 0) : this._def.innerType._parse(e);
3398
+ return this._getType(e) === Z.undefined ? Pe(void 0) : this._def.innerType._parse(e);
3399
3399
  }
3400
3400
  unwrap() {
3401
3401
  return this._def.innerType;
@@ -3408,7 +3408,7 @@ ct.create = (t, e) => new ct({
3408
3408
  });
3409
3409
  class Wt extends te {
3410
3410
  _parse(e) {
3411
- return this._getType(e) === Z.null ? Me(null) : this._def.innerType._parse(e);
3411
+ return this._getType(e) === Z.null ? Pe(null) : this._def.innerType._parse(e);
3412
3412
  }
3413
3413
  unwrap() {
3414
3414
  return this._def.innerType;
@@ -3458,7 +3458,7 @@ class Fs extends te {
3458
3458
  status: "valid",
3459
3459
  value: i.status === "valid" ? i.value : this._def.catchValue({
3460
3460
  get error() {
3461
- return new Xe(s.common.issues);
3461
+ return new et(s.common.issues);
3462
3462
  },
3463
3463
  input: s.data
3464
3464
  })
@@ -3466,7 +3466,7 @@ class Fs extends te {
3466
3466
  status: "valid",
3467
3467
  value: r.status === "valid" ? r.value : this._def.catchValue({
3468
3468
  get error() {
3469
- return new Xe(s.common.issues);
3469
+ return new et(s.common.issues);
3470
3470
  },
3471
3471
  input: s.data
3472
3472
  })
@@ -3570,12 +3570,12 @@ var Y;
3570
3570
  (function(t) {
3571
3571
  t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
3572
3572
  })(Y || (Y = {}));
3573
- const Re = Qe.create, Ot = Lt.create, on = Is.create, fs = xs.create, we = Ns.create;
3573
+ const xe = Ke.create, Ot = Lt.create, on = Is.create, fs = xs.create, we = Ns.create;
3574
3574
  ft.create;
3575
- const Rt = ze.create, qe = me.create, Te = Un.create;
3575
+ const St = ze.create, qe = me.create, Se = Un.create;
3576
3576
  Wn.create;
3577
3577
  bt.create;
3578
- const mn = jn.create, Se = Ds.create, zn = Vt.create;
3578
+ const mn = jn.create, Ie = Ds.create, zn = Vt.create;
3579
3579
  Zn.create;
3580
3580
  ct.create;
3581
3581
  Wt.create;
@@ -3593,26 +3593,26 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
3593
3593
  const a = i.fields.find((c) => c.name === o);
3594
3594
  if (!a)
3595
3595
  throw new Error(`Field ${o} not found in collection ${t.collection}`);
3596
- s[o] = qn(i, a), St(i, [a]).size === 1 && (s[`${o}_Lowercase`] = qn(i, a, !0));
3596
+ s[o] = qn(i, a), Tt(i, [a]).size === 1 && (s[`${o}_Lowercase`] = qn(i, a, !0));
3597
3597
  });
3598
3598
  }
3599
3599
  const r = {
3600
- Collection_Path: Rt(Re()),
3600
+ Collection_Path: St(xe()),
3601
3601
  ...s
3602
3602
  };
3603
- return n && (r.id = Re().length(20)), qe(r);
3603
+ return n && (r.id = xe().length(20)), qe(r);
3604
3604
  }, Ga = (t, e) => {
3605
3605
  let n = mn(Ii(t, e));
3606
3606
  return t.required || (n = n.optional()), n;
3607
3607
  }, Ya = (t) => {
3608
- let e = Rt(Te([Re().length(20), Re().length(28)]));
3608
+ let e = St(Se([xe().length(20), xe().length(28)]));
3609
3609
  return ["OneToOne", "OneToMany"].includes(t.type) ? e = e.max(1) : (t.min && (e = e.min(t.min)), t.max && (e = e.max(t.max)), t.length && (e = e.length(t.length))), t.required ? e = e.nonempty() : e = e.optional(), e;
3610
3610
  }, qn = (t, e, n) => {
3611
3611
  const { softDelete: s } = t, r = s?.timestampField;
3612
3612
  let i;
3613
3613
  switch (e.type) {
3614
3614
  case "String":
3615
- if (i = Re(), 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))), n && (i = i.toLowerCase()), e.values)
3615
+ if (i = xe(), 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))), n && (i = i.toLowerCase()), e.values)
3616
3616
  if (n) {
3617
3617
  const o = e.values.map((a) => a.toLowerCase());
3618
3618
  i = zn(o);
@@ -3623,7 +3623,7 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
3623
3623
  i = on();
3624
3624
  break;
3625
3625
  case "Number":
3626
- e.autoIncrement ? i = Te([Se("Pending"), Ot().int()]) : (i = Ot(), e.min && (i = i.min(e.min)), e.max && (i = i.max(e.max)), e.decimal ? i = i.refine((o) => e.decimal ? (o.toString().split(".")[1]?.length || 0) <= e.decimal : !1, {
3626
+ e.autoIncrement ? i = Se([Ie("Pending"), Ot().int()]) : (i = Ot(), e.min && (i = i.min(e.min)), e.max && (i = i.max(e.max)), e.decimal ? i = i.refine((o) => e.decimal ? (o.toString().split(".")[1]?.length || 0) <= e.decimal : !1, {
3627
3627
  message: `Value must have ${e.decimal} or fewer decimal places`
3628
3628
  }) : i = i.int(), e.values && (i = i.refine((o) => e.values?.includes(o), {
3629
3629
  message: "Value is not an allowed value"
@@ -3639,7 +3639,7 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
3639
3639
  })));
3640
3640
  break;
3641
3641
  case "Array":
3642
- i = Rt(we()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((o) => {
3642
+ i = St(we()), e.length && (i = i.length(e.length)), e.minlength ? i = i.min(e.minlength) : e.required && (i = i.nonempty()), e.maxlength && (i = i.max(e.maxlength)), e.values && (i = i.refine((o) => {
3643
3643
  let a = !0;
3644
3644
  return o.forEach((l) => {
3645
3645
  e.values && !e.values.includes(l) && (a = !1);
@@ -3658,16 +3658,16 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
3658
3658
  return !ee(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
3659
3659
  }, Ja = (t, e, n) => {
3660
3660
  const s = {
3661
- Collection_Path: Rt(Re()),
3662
- Last_Write_App: Re(),
3661
+ Collection_Path: St(xe()),
3662
+ Last_Write_App: xe(),
3663
3663
  Last_Write_At: xn(),
3664
3664
  Last_Save_At: xr(),
3665
- Last_Write_By: Te([Re().length(28), Se("System")]),
3665
+ Last_Write_By: Se([xe().length(28), Ie("System")]),
3666
3666
  Last_Write_Connection_Status: zn(["Online", "Offline"]),
3667
3667
  Last_Write_Version: Ot().int(),
3668
- id: Re().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
3668
+ id: xe().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
3669
3669
  Created_At: xn(),
3670
- Created_By: Te([Re().length(28), Se("System")])
3670
+ Created_By: Se([xe().length(28), Ie("System")])
3671
3671
  };
3672
3672
  t === "create" && (s.Saved_At = xr()), t === "update" && (s.Saved_At = xn(), s.Collection_Path = s.Collection_Path.optional(), s.id = s.id.optional(), s.Created_At = s.Created_At.optional(), s.Saved_At = s.Saved_At.optional(), s.Created_By = s.Created_By.optional());
3673
3673
  const r = Et(e, e.fields), i = Array.from(r).map((l) => l.name);
@@ -3679,7 +3679,7 @@ const xn = () => we().refine((t) => t && (t.seconds !== void 0 && t.nanoseconds
3679
3679
  })), l.max && (s[l.name] = s[l.name].refine((c) => l.max && (!c || Object.keys(c).length <= l.max), {
3680
3680
  message: `Value must contain at most ${l.max} item(s)`
3681
3681
  }))) : l.type !== "Computed" && (s[l.name] = qn(e, l));
3682
- }), St(e, e.fields).forEach((l) => {
3682
+ }), Tt(e, e.fields).forEach((l) => {
3683
3683
  s[l.name] && (s[`${l.name}_Lowercase`] = qn(e, l, !0));
3684
3684
  });
3685
3685
  const a = qe(s);
@@ -3709,35 +3709,35 @@ class xi extends It {
3709
3709
  super(`Invalid unit ${e}`);
3710
3710
  }
3711
3711
  }
3712
- class _e extends It {
3712
+ class Ee extends It {
3713
3713
  }
3714
- class st extends It {
3714
+ class rt extends It {
3715
3715
  constructor() {
3716
3716
  super("Zone is an abstract class");
3717
3717
  }
3718
3718
  }
3719
- const $ = "numeric", We = "short", xe = "long", Bn = {
3719
+ const $ = "numeric", je = "short", Ae = "long", Bn = {
3720
3720
  year: $,
3721
3721
  month: $,
3722
3722
  day: $
3723
3723
  }, Ni = {
3724
3724
  year: $,
3725
- month: We,
3725
+ month: je,
3726
3726
  day: $
3727
3727
  }, el = {
3728
3728
  year: $,
3729
- month: We,
3729
+ month: je,
3730
3730
  day: $,
3731
- weekday: We
3731
+ weekday: je
3732
3732
  }, Ai = {
3733
3733
  year: $,
3734
- month: xe,
3734
+ month: Ae,
3735
3735
  day: $
3736
3736
  }, Di = {
3737
3737
  year: $,
3738
- month: xe,
3738
+ month: Ae,
3739
3739
  day: $,
3740
- weekday: xe
3740
+ weekday: Ae
3741
3741
  }, Ci = {
3742
3742
  hour: $,
3743
3743
  minute: $
@@ -3749,12 +3749,12 @@ const $ = "numeric", We = "short", xe = "long", Bn = {
3749
3749
  hour: $,
3750
3750
  minute: $,
3751
3751
  second: $,
3752
- timeZoneName: We
3752
+ timeZoneName: je
3753
3753
  }, Mi = {
3754
3754
  hour: $,
3755
3755
  minute: $,
3756
3756
  second: $,
3757
- timeZoneName: xe
3757
+ timeZoneName: Ae
3758
3758
  }, Pi = {
3759
3759
  hour: $,
3760
3760
  minute: $,
@@ -3769,13 +3769,13 @@ const $ = "numeric", We = "short", xe = "long", Bn = {
3769
3769
  minute: $,
3770
3770
  second: $,
3771
3771
  hourCycle: "h23",
3772
- timeZoneName: We
3772
+ timeZoneName: je
3773
3773
  }, Ui = {
3774
3774
  hour: $,
3775
3775
  minute: $,
3776
3776
  second: $,
3777
3777
  hourCycle: "h23",
3778
- timeZoneName: xe
3778
+ timeZoneName: Ae
3779
3779
  }, Wi = {
3780
3780
  year: $,
3781
3781
  month: $,
@@ -3791,56 +3791,56 @@ const $ = "numeric", We = "short", xe = "long", Bn = {
3791
3791
  second: $
3792
3792
  }, Zi = {
3793
3793
  year: $,
3794
- month: We,
3794
+ month: je,
3795
3795
  day: $,
3796
3796
  hour: $,
3797
3797
  minute: $
3798
3798
  }, zi = {
3799
3799
  year: $,
3800
- month: We,
3800
+ month: je,
3801
3801
  day: $,
3802
3802
  hour: $,
3803
3803
  minute: $,
3804
3804
  second: $
3805
3805
  }, tl = {
3806
3806
  year: $,
3807
- month: We,
3807
+ month: je,
3808
3808
  day: $,
3809
- weekday: We,
3809
+ weekday: je,
3810
3810
  hour: $,
3811
3811
  minute: $
3812
3812
  }, qi = {
3813
3813
  year: $,
3814
- month: xe,
3814
+ month: Ae,
3815
3815
  day: $,
3816
3816
  hour: $,
3817
3817
  minute: $,
3818
- timeZoneName: We
3818
+ timeZoneName: je
3819
3819
  }, Bi = {
3820
3820
  year: $,
3821
- month: xe,
3821
+ month: Ae,
3822
3822
  day: $,
3823
3823
  hour: $,
3824
3824
  minute: $,
3825
3825
  second: $,
3826
- timeZoneName: We
3826
+ timeZoneName: je
3827
3827
  }, Hi = {
3828
3828
  year: $,
3829
- month: xe,
3829
+ month: Ae,
3830
3830
  day: $,
3831
- weekday: xe,
3831
+ weekday: Ae,
3832
3832
  hour: $,
3833
3833
  minute: $,
3834
- timeZoneName: xe
3834
+ timeZoneName: Ae
3835
3835
  }, Gi = {
3836
3836
  year: $,
3837
- month: xe,
3837
+ month: Ae,
3838
3838
  day: $,
3839
- weekday: xe,
3839
+ weekday: Ae,
3840
3840
  hour: $,
3841
3841
  minute: $,
3842
3842
  second: $,
3843
- timeZoneName: xe
3843
+ timeZoneName: Ae
3844
3844
  };
3845
3845
  class pn {
3846
3846
  /**
@@ -3849,7 +3849,7 @@ class pn {
3849
3849
  * @type {string}
3850
3850
  */
3851
3851
  get type() {
3852
- throw new st();
3852
+ throw new rt();
3853
3853
  }
3854
3854
  /**
3855
3855
  * The name of this zone.
@@ -3857,7 +3857,7 @@ class pn {
3857
3857
  * @type {string}
3858
3858
  */
3859
3859
  get name() {
3860
- throw new st();
3860
+ throw new rt();
3861
3861
  }
3862
3862
  /**
3863
3863
  * The IANA name of this zone.
@@ -3874,7 +3874,7 @@ class pn {
3874
3874
  * @type {boolean}
3875
3875
  */
3876
3876
  get isUniversal() {
3877
- throw new st();
3877
+ throw new rt();
3878
3878
  }
3879
3879
  /**
3880
3880
  * Returns the offset's common name (such as EST) at the specified timestamp
@@ -3886,7 +3886,7 @@ class pn {
3886
3886
  * @return {string}
3887
3887
  */
3888
3888
  offsetName(e, n) {
3889
- throw new st();
3889
+ throw new rt();
3890
3890
  }
3891
3891
  /**
3892
3892
  * Returns the offset's value as a string
@@ -3897,7 +3897,7 @@ class pn {
3897
3897
  * @return {string}
3898
3898
  */
3899
3899
  formatOffset(e, n) {
3900
- throw new st();
3900
+ throw new rt();
3901
3901
  }
3902
3902
  /**
3903
3903
  * Return the offset in minutes for this zone at the specified timestamp.
@@ -3906,7 +3906,7 @@ class pn {
3906
3906
  * @return {number}
3907
3907
  */
3908
3908
  offset(e) {
3909
- throw new st();
3909
+ throw new rt();
3910
3910
  }
3911
3911
  /**
3912
3912
  * Return whether this Zone is equal to another zone
@@ -3915,7 +3915,7 @@ class pn {
3915
3915
  * @return {boolean}
3916
3916
  */
3917
3917
  equals(e) {
3918
- throw new st();
3918
+ throw new rt();
3919
3919
  }
3920
3920
  /**
3921
3921
  * Return whether this Zone is valid.
@@ -3923,7 +3923,7 @@ class pn {
3923
3923
  * @type {boolean}
3924
3924
  */
3925
3925
  get isValid() {
3926
- throw new st();
3926
+ throw new rt();
3927
3927
  }
3928
3928
  }
3929
3929
  let hs = null;
@@ -4005,14 +4005,14 @@ function il(t, e) {
4005
4005
  return s;
4006
4006
  }
4007
4007
  const ms = /* @__PURE__ */ new Map();
4008
- class et extends pn {
4008
+ class tt extends pn {
4009
4009
  /**
4010
4010
  * @param {string} name - Zone name
4011
4011
  * @return {IANAZone}
4012
4012
  */
4013
4013
  static create(e) {
4014
4014
  let n = ms.get(e);
4015
- return n === void 0 && ms.set(e, n = new et(e)), n;
4015
+ return n === void 0 && ms.set(e, n = new tt(e)), n;
4016
4016
  }
4017
4017
  /**
4018
4018
  * Reset local caches. Should only be necessary in testing scenarios.
@@ -4050,7 +4050,7 @@ class et extends pn {
4050
4050
  }
4051
4051
  }
4052
4052
  constructor(e) {
4053
- super(), this.zoneName = e, this.valid = et.isValidZone(e);
4053
+ super(), this.zoneName = e, this.valid = tt.isValidZone(e);
4054
4054
  }
4055
4055
  /**
4056
4056
  * The type of zone. `iana` for all instances of `IANAZone`.
@@ -4257,7 +4257,7 @@ class gl {
4257
4257
  this.dt = e;
4258
4258
  else if (e.zone.type === "fixed") {
4259
4259
  const o = -1 * (e.offset / 60), a = o >= 0 ? `Etc/GMT+${o}` : `Etc/GMT${o}`;
4260
- e.offset !== 0 && et.create(a).valid ? (r = a, this.dt = e) : (r = "UTC", this.dt = e.offset === 0 ? e : e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
4260
+ e.offset !== 0 && tt.create(a).valid ? (r = a, this.dt = e) : (r = "UTC", this.dt = e.offset === 0 ? e : e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
4261
4261
  } else e.zone.type === "system" ? this.dt = e : e.zone.type === "iana" ? (this.dt = e, r = e.zone.name) : (r = "UTC", this.dt = e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
4262
4262
  const i = { ...this.opts };
4263
4263
  i.timeZone = i.timeZone || r, this.dtf = Ls(n, i);
@@ -4430,13 +4430,13 @@ class ie {
4430
4430
  }
4431
4431
  }
4432
4432
  let ps = null;
4433
- class Oe extends pn {
4433
+ class be extends pn {
4434
4434
  /**
4435
4435
  * Get a singleton instance of UTC
4436
4436
  * @return {FixedOffsetZone}
4437
4437
  */
4438
4438
  static get utcInstance() {
4439
- return ps === null && (ps = new Oe(0)), ps;
4439
+ return ps === null && (ps = new be(0)), ps;
4440
4440
  }
4441
4441
  /**
4442
4442
  * Get an instance with a specified offset
@@ -4444,7 +4444,7 @@ class Oe extends pn {
4444
4444
  * @return {FixedOffsetZone}
4445
4445
  */
4446
4446
  static instance(e) {
4447
- return e === 0 ? Oe.utcInstance : new Oe(e);
4447
+ return e === 0 ? be.utcInstance : new be(e);
4448
4448
  }
4449
4449
  /**
4450
4450
  * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6"
@@ -4458,7 +4458,7 @@ class Oe extends pn {
4458
4458
  if (e) {
4459
4459
  const n = e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
4460
4460
  if (n)
4461
- return new Oe(rs(n[1], n[2]));
4461
+ return new be(rs(n[1], n[2]));
4462
4462
  }
4463
4463
  return null;
4464
4464
  }
@@ -4586,15 +4586,15 @@ class _l extends pn {
4586
4586
  return !1;
4587
4587
  }
4588
4588
  }
4589
- function ot(t, e) {
4589
+ function at(t, e) {
4590
4590
  if (G(t) || t === null)
4591
4591
  return e;
4592
4592
  if (t instanceof pn)
4593
4593
  return t;
4594
- if (Tl(t)) {
4594
+ if (Rl(t)) {
4595
4595
  const n = t.toLowerCase();
4596
- return n === "default" ? e : n === "local" || n === "system" ? ts.instance : n === "utc" || n === "gmt" ? Oe.utcInstance : Oe.parseSpecifier(n) || et.create(t);
4597
- } else return ut(t) ? Oe.instance(t) : typeof t == "object" && "offset" in t && typeof t.offset == "function" ? t : new _l(t);
4596
+ return n === "default" ? e : n === "local" || n === "system" ? ts.instance : n === "utc" || n === "gmt" ? be.utcInstance : be.parseSpecifier(n) || tt.create(t);
4597
+ } else return ut(t) ? be.instance(t) : typeof t == "object" && "offset" in t && typeof t.offset == "function" ? t : new _l(t);
4598
4598
  }
4599
4599
  const er = {
4600
4600
  arab: "[٠-٩]",
@@ -4661,7 +4661,7 @@ const Zs = /* @__PURE__ */ new Map();
4661
4661
  function Ol() {
4662
4662
  Zs.clear();
4663
4663
  }
4664
- function Pe({ numberingSystem: t }, e = "") {
4664
+ function Le({ numberingSystem: t }, e = "") {
4665
4665
  const n = t || "latn";
4666
4666
  let s = Zs.get(n);
4667
4667
  s === void 0 && (s = /* @__PURE__ */ new Map(), Zs.set(n, s));
@@ -4701,7 +4701,7 @@ class fe {
4701
4701
  * @type {Zone}
4702
4702
  */
4703
4703
  static get defaultZone() {
4704
- return ot(Cr, ts.instance);
4704
+ return at(Cr, ts.instance);
4705
4705
  }
4706
4706
  /**
4707
4707
  * Get the default locale to create DateTimes with. Does not affect existing instances.
@@ -4805,10 +4805,10 @@ class fe {
4805
4805
  * @return {void}
4806
4806
  */
4807
4807
  static resetCaches() {
4808
- ie.resetCache(), et.resetCache(), j.resetCache(), Ol();
4808
+ ie.resetCache(), tt.resetCache(), j.resetCache(), Ol();
4809
4809
  }
4810
4810
  }
4811
- class Ve {
4811
+ class Ue {
4812
4812
  constructor(e, n) {
4813
4813
  this.reason = e, this.explanation = n;
4814
4814
  }
@@ -4817,8 +4817,8 @@ class Ve {
4817
4817
  }
4818
4818
  }
4819
4819
  const Qi = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], Ki = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
4820
- function Ce(t, e) {
4821
- return new Ve(
4820
+ function Fe(t, e) {
4821
+ return new Ue(
4822
4822
  "unit out of range",
4823
4823
  `you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`
4824
4824
  );
@@ -4873,24 +4873,24 @@ function jr(t, e) {
4873
4873
  return { minDaysInFirstWeek: 4, startOfWeek: 1 };
4874
4874
  }
4875
4875
  function kl(t, e = 4, n = 1) {
4876
- const s = ns(t.weekYear), r = Fe(
4876
+ const s = ns(t.weekYear), r = $e(
4877
4877
  t.weekNumber,
4878
4878
  1,
4879
4879
  dn(t.weekYear, e, n)
4880
- ), i = Fe(t.weekday, 1, 7);
4881
- return s ? r ? i ? !1 : Ce("weekday", t.weekday) : Ce("week", t.weekNumber) : Ce("weekYear", t.weekYear);
4880
+ ), i = $e(t.weekday, 1, 7);
4881
+ return s ? r ? i ? !1 : Fe("weekday", t.weekday) : Fe("week", t.weekNumber) : Fe("weekYear", t.weekYear);
4882
4882
  }
4883
4883
  function bl(t) {
4884
- const e = ns(t.year), n = Fe(t.ordinal, 1, $t(t.year));
4885
- return e ? n ? !1 : Ce("ordinal", t.ordinal) : Ce("year", t.year);
4884
+ const e = ns(t.year), n = $e(t.ordinal, 1, $t(t.year));
4885
+ return e ? n ? !1 : Fe("ordinal", t.ordinal) : Fe("year", t.year);
4886
4886
  }
4887
4887
  function to(t) {
4888
- const e = ns(t.year), n = Fe(t.month, 1, 12), s = Fe(t.day, 1, Gn(t.year, t.month));
4889
- return e ? n ? s ? !1 : Ce("day", t.day) : Ce("month", t.month) : Ce("year", t.year);
4888
+ const e = ns(t.year), n = $e(t.month, 1, 12), s = $e(t.day, 1, Gn(t.year, t.month));
4889
+ return e ? n ? s ? !1 : Fe("day", t.day) : Fe("month", t.month) : Fe("year", t.year);
4890
4890
  }
4891
4891
  function no(t) {
4892
- const { hour: e, minute: n, second: s, millisecond: r } = t, i = Fe(e, 0, 23) || e === 24 && n === 0 && s === 0 && r === 0, o = Fe(n, 0, 59), a = Fe(s, 0, 59), l = Fe(r, 0, 999);
4893
- return i ? o ? a ? l ? !1 : Ce("millisecond", r) : Ce("second", s) : Ce("minute", n) : Ce("hour", e);
4892
+ const { hour: e, minute: n, second: s, millisecond: r } = t, i = $e(e, 0, 23) || e === 24 && n === 0 && s === 0 && r === 0, o = $e(n, 0, 59), a = $e(s, 0, 59), l = $e(r, 0, 999);
4893
+ return i ? o ? a ? l ? !1 : Fe("millisecond", r) : Fe("second", s) : Fe("minute", n) : Fe("hour", e);
4894
4894
  }
4895
4895
  function G(t) {
4896
4896
  return typeof t > "u";
@@ -4901,10 +4901,10 @@ function ut(t) {
4901
4901
  function ns(t) {
4902
4902
  return typeof t == "number" && t % 1 === 0;
4903
4903
  }
4904
- function Tl(t) {
4904
+ function Rl(t) {
4905
4905
  return typeof t == "string";
4906
4906
  }
4907
- function Sl(t) {
4907
+ function Tl(t) {
4908
4908
  return Object.prototype.toString.call(t) === "[object Date]";
4909
4909
  }
4910
4910
  function so() {
@@ -4921,7 +4921,7 @@ function ro() {
4921
4921
  return !1;
4922
4922
  }
4923
4923
  }
4924
- function Rl(t) {
4924
+ function Sl(t) {
4925
4925
  return Array.isArray(t) ? t : [t];
4926
4926
  }
4927
4927
  function Zr(t, e, n) {
@@ -4941,16 +4941,16 @@ function zs(t) {
4941
4941
  if (t == null)
4942
4942
  return null;
4943
4943
  if (typeof t != "object")
4944
- throw new _e("Week settings must be an object");
4945
- if (!Fe(t.firstDay, 1, 7) || !Fe(t.minimalDays, 1, 7) || !Array.isArray(t.weekend) || t.weekend.some((e) => !Fe(e, 1, 7)))
4946
- throw new _e("Invalid week settings");
4944
+ throw new Ee("Week settings must be an object");
4945
+ if (!$e(t.firstDay, 1, 7) || !$e(t.minimalDays, 1, 7) || !Array.isArray(t.weekend) || t.weekend.some((e) => !$e(e, 1, 7)))
4946
+ throw new Ee("Invalid week settings");
4947
4947
  return {
4948
4948
  firstDay: t.firstDay,
4949
4949
  minimalDays: t.minimalDays,
4950
4950
  weekend: Array.from(t.weekend)
4951
4951
  };
4952
4952
  }
4953
- function Fe(t, e, n) {
4953
+ function $e(t, e, n) {
4954
4954
  return ns(t) && t >= e && t <= n;
4955
4955
  }
4956
4956
  function xl(t, e) {
@@ -4961,7 +4961,7 @@ function pe(t, e = 2) {
4961
4961
  let s;
4962
4962
  return n ? s = "-" + ("" + -t).padStart(e, "0") : s = ("" + t).padStart(e, "0"), s;
4963
4963
  }
4964
- function it(t) {
4964
+ function ot(t) {
4965
4965
  if (!(G(t) || t === null || t === ""))
4966
4966
  return parseInt(t, 10);
4967
4967
  }
@@ -5046,7 +5046,7 @@ function rs(t, e) {
5046
5046
  function oo(t) {
5047
5047
  const e = Number(t);
5048
5048
  if (typeof t == "boolean" || t === "" || !Number.isFinite(e))
5049
- throw new _e(`Invalid unit value ${t}`);
5049
+ throw new Ee(`Invalid unit value ${t}`);
5050
5050
  return e;
5051
5051
  }
5052
5052
  function Yn(t, e) {
@@ -5219,9 +5219,9 @@ const Wl = {
5219
5219
  FFF: Bi,
5220
5220
  FFFF: Gi
5221
5221
  };
5222
- class Ee {
5222
+ class ve {
5223
5223
  static create(e, n = {}) {
5224
- return new Ee(e, n);
5224
+ return new ve(e, n);
5225
5225
  }
5226
5226
  static parseFormat(e) {
5227
5227
  let n = null, s = "", r = !1;
@@ -5270,7 +5270,7 @@ class Ee {
5270
5270
  g ? { weekday: f } : { weekday: f, month: "long", day: "numeric" },
5271
5271
  "weekday"
5272
5272
  ), d = (f) => {
5273
- const g = Ee.macroTokenToFormatOpts(f);
5273
+ const g = ve.macroTokenToFormatOpts(f);
5274
5274
  return g ? this.formatWithSystemDefault(e, g) : f;
5275
5275
  }, h = (f) => s ? Vl(e, f) : i({ era: f }, "era"), u = (f) => {
5276
5276
  switch (f) {
@@ -5415,7 +5415,7 @@ class Ee {
5415
5415
  return d(f);
5416
5416
  }
5417
5417
  };
5418
- return qr(Ee.parseFormat(n), u);
5418
+ return qr(ve.parseFormat(n), u);
5419
5419
  }
5420
5420
  formatDurationFromString(e, n) {
5421
5421
  const s = this.opts.signMode === "negativeLargestOnly" ? -1 : 1, r = (d) => {
@@ -5443,11 +5443,11 @@ class Ee {
5443
5443
  const f = r(u);
5444
5444
  if (f) {
5445
5445
  const g = h.isNegativeDuration && f !== h.largestUnit ? s : 1;
5446
- let T;
5447
- return this.opts.signMode === "negativeLargestOnly" && f !== h.largestUnit ? T = "never" : this.opts.signMode === "all" ? T = "always" : T = "auto", this.num(d.get(f) * g, u.length, T);
5446
+ let R;
5447
+ return this.opts.signMode === "negativeLargestOnly" && f !== h.largestUnit ? R = "never" : this.opts.signMode === "all" ? R = "always" : R = "auto", this.num(d.get(f) * g, u.length, R);
5448
5448
  } else
5449
5449
  return u;
5450
- }, o = Ee.parseFormat(n), a = o.reduce(
5450
+ }, o = ve.parseFormat(n), a = o.reduce(
5451
5451
  (d, { literal: h, val: u }) => h ? d : d.concat(u),
5452
5452
  []
5453
5453
  ), l = e.shiftTo(...a.map(r).filter((d) => d)), c = {
@@ -5488,7 +5488,7 @@ function yo(...t) {
5488
5488
  const s = {};
5489
5489
  let r;
5490
5490
  for (r = 0; r < t.length; r++)
5491
- s[t[r]] = it(e[n + r]);
5491
+ s[t[r]] = ot(e[n + r]);
5492
5492
  return [s, null, n + r];
5493
5493
  };
5494
5494
  }
@@ -5497,7 +5497,7 @@ const go = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, jl = `(?:${go.source}?(?:\\[(${
5497
5497
  ), Yl = RegExp(`(?: ${_o.source})?`);
5498
5498
  function Mt(t, e, n) {
5499
5499
  const s = t[e];
5500
- return G(s) ? n : it(s);
5500
+ return G(s) ? n : ot(s);
5501
5501
  }
5502
5502
  function Jl(t, e) {
5503
5503
  return [{
@@ -5515,11 +5515,11 @@ function Ht(t, e) {
5515
5515
  }, null, e + 4];
5516
5516
  }
5517
5517
  function gn(t, e) {
5518
- const n = !t[e] && !t[e + 1], s = rs(t[e + 1], t[e + 2]), r = n ? null : Oe.instance(s);
5518
+ const n = !t[e] && !t[e + 1], s = rs(t[e + 1], t[e + 2]), r = n ? null : be.instance(s);
5519
5519
  return [{}, r, e + 3];
5520
5520
  }
5521
5521
  function wn(t, e) {
5522
- const n = t[e] ? et.create(t[e]) : null;
5522
+ const n = t[e] ? tt.create(t[e]) : null;
5523
5523
  return [{}, n, e + 1];
5524
5524
  }
5525
5525
  const Ql = RegExp(`^T?${ir.source}$`), Kl = /^-?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)?)?)$/;
@@ -5551,13 +5551,13 @@ const ec = {
5551
5551
  };
5552
5552
  function ar(t, e, n, s, r, i, o) {
5553
5553
  const a = {
5554
- year: e.length === 2 ? qs(it(e)) : it(e),
5554
+ year: e.length === 2 ? qs(ot(e)) : ot(e),
5555
5555
  month: ao.indexOf(n) + 1,
5556
- day: it(s),
5557
- hour: it(r),
5558
- minute: it(i)
5556
+ day: ot(s),
5557
+ hour: ot(r),
5558
+ minute: ot(i)
5559
5559
  };
5560
- return o && (a.second = it(o)), t && (a.weekday = t.length > 3 ? co.indexOf(t) + 1 : uo.indexOf(t) + 1), a;
5560
+ return o && (a.second = ot(o)), t && (a.weekday = t.length > 3 ? co.indexOf(t) + 1 : uo.indexOf(t) + 1), a;
5561
5561
  }
5562
5562
  const tc = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
5563
5563
  function nc(t) {
@@ -5576,7 +5576,7 @@ function nc(t) {
5576
5576
  h
5577
5577
  ] = t, u = ar(e, r, s, n, i, o, a);
5578
5578
  let f;
5579
- return l ? f = ec[l] : c ? f = 0 : f = rs(d, h), [u, new Oe(f)];
5579
+ return l ? f = ec[l] : c ? f = 0 : f = rs(d, h), [u, new be(f)];
5580
5580
  }
5581
5581
  function sc(t) {
5582
5582
  return t.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
@@ -5584,11 +5584,11 @@ function sc(t) {
5584
5584
  const rc = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, ic = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, oc = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
5585
5585
  function Br(t) {
5586
5586
  const [, e, n, s, r, i, o, a] = t;
5587
- return [ar(e, r, s, n, i, o, a), Oe.utcInstance];
5587
+ return [ar(e, r, s, n, i, o, a), be.utcInstance];
5588
5588
  }
5589
5589
  function ac(t) {
5590
5590
  const [, e, n, s, r, i, o, a] = t;
5591
- return [ar(e, a, n, s, r, i, o), Oe.utcInstance];
5591
+ return [ar(e, a, n, s, r, i, o), be.utcInstance];
5592
5592
  }
5593
5593
  const lc = zt(Zl, or), cc = zt(zl, or), uc = zt(ql, or), dc = zt(wo), Eo = qt(
5594
5594
  Jl,
@@ -5666,7 +5666,7 @@ const Hr = "Invalid Duration", vo = {
5666
5666
  hours: { minutes: 60, seconds: 3600, milliseconds: 3600 * 1e3 },
5667
5667
  minutes: { seconds: 60, milliseconds: 60 * 1e3 },
5668
5668
  seconds: { milliseconds: 1e3 }
5669
- }, Tc = {
5669
+ }, Rc = {
5670
5670
  years: {
5671
5671
  quarters: 4,
5672
5672
  months: 12,
@@ -5695,25 +5695,25 @@ const Hr = "Invalid Duration", vo = {
5695
5695
  milliseconds: 720 * 60 * 60 * 1e3
5696
5696
  },
5697
5697
  ...vo
5698
- }, Ae = 146097 / 400, xt = 146097 / 4800, Sc = {
5698
+ }, Ce = 146097 / 400, xt = 146097 / 4800, Tc = {
5699
5699
  years: {
5700
5700
  quarters: 4,
5701
5701
  months: 12,
5702
- weeks: Ae / 7,
5703
- days: Ae,
5704
- hours: Ae * 24,
5705
- minutes: Ae * 24 * 60,
5706
- seconds: Ae * 24 * 60 * 60,
5707
- milliseconds: Ae * 24 * 60 * 60 * 1e3
5702
+ weeks: Ce / 7,
5703
+ days: Ce,
5704
+ hours: Ce * 24,
5705
+ minutes: Ce * 24 * 60,
5706
+ seconds: Ce * 24 * 60 * 60,
5707
+ milliseconds: Ce * 24 * 60 * 60 * 1e3
5708
5708
  },
5709
5709
  quarters: {
5710
5710
  months: 3,
5711
- weeks: Ae / 28,
5712
- days: Ae / 4,
5713
- hours: Ae * 24 / 4,
5714
- minutes: Ae * 24 * 60 / 4,
5715
- seconds: Ae * 24 * 60 * 60 / 4,
5716
- milliseconds: Ae * 24 * 60 * 60 * 1e3 / 4
5711
+ weeks: Ce / 28,
5712
+ days: Ce / 4,
5713
+ hours: Ce * 24 / 4,
5714
+ minutes: Ce * 24 * 60 / 4,
5715
+ seconds: Ce * 24 * 60 * 60 / 4,
5716
+ milliseconds: Ce * 24 * 60 * 60 * 1e3 / 4
5717
5717
  },
5718
5718
  months: {
5719
5719
  weeks: xt / 7,
@@ -5734,7 +5734,7 @@ const Hr = "Invalid Duration", vo = {
5734
5734
  "minutes",
5735
5735
  "seconds",
5736
5736
  "milliseconds"
5737
- ], Rc = kt.slice(0).reverse();
5737
+ ], Sc = kt.slice(0).reverse();
5738
5738
  function Ye(t, e, n = !1) {
5739
5739
  const s = {
5740
5740
  values: n ? e.values : { ...t.values, ...e.values || {} },
@@ -5746,7 +5746,7 @@ function Ye(t, e, n = !1) {
5746
5746
  }
5747
5747
  function Oo(t, e) {
5748
5748
  let n = e.milliseconds ?? 0;
5749
- for (const s of Rc.slice(1))
5749
+ for (const s of Sc.slice(1))
5750
5750
  e[s] && (n += e[s] * t[s].milliseconds);
5751
5751
  return n;
5752
5752
  }
@@ -5782,7 +5782,7 @@ class ne {
5782
5782
  */
5783
5783
  constructor(e) {
5784
5784
  const n = e.conversionAccuracy === "longterm" || !1;
5785
- let s = n ? Sc : Tc;
5785
+ let s = n ? Tc : Rc;
5786
5786
  e.matrix && (s = e.matrix), this.values = e.values, this.loc = e.loc || ie.create(), this.conversionAccuracy = n ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = s, this.isLuxonDuration = !0;
5787
5787
  }
5788
5788
  /**
@@ -5819,7 +5819,7 @@ class ne {
5819
5819
  */
5820
5820
  static fromObject(e, n = {}) {
5821
5821
  if (e == null || typeof e != "object")
5822
- throw new _e(
5822
+ throw new Ee(
5823
5823
  `Duration.fromObject: argument expected to be an object, got ${e === null ? "null" : typeof e}`
5824
5824
  );
5825
5825
  return new ne({
@@ -5846,7 +5846,7 @@ class ne {
5846
5846
  return e;
5847
5847
  if (typeof e == "object")
5848
5848
  return ne.fromObject(e);
5849
- throw new _e(
5849
+ throw new Ee(
5850
5850
  `Unknown duration argument ${e} of type ${typeof e}`
5851
5851
  );
5852
5852
  }
@@ -5896,8 +5896,8 @@ class ne {
5896
5896
  */
5897
5897
  static invalid(e, n = null) {
5898
5898
  if (!e)
5899
- throw new _e("need to specify a reason the Duration is invalid");
5900
- const s = e instanceof Ve ? e : new Ve(e, n);
5899
+ throw new Ee("need to specify a reason the Duration is invalid");
5900
+ const s = e instanceof Ue ? e : new Ue(e, n);
5901
5901
  if (fe.throwOnInvalid)
5902
5902
  throw new Xa(s);
5903
5903
  return new ne({ invalid: s });
@@ -5983,7 +5983,7 @@ class ne {
5983
5983
  ...n,
5984
5984
  floor: n.round !== !1 && n.floor !== !1
5985
5985
  };
5986
- return this.isValid ? Ee.create(this.loc, s).formatDurationFromString(this, e) : Hr;
5986
+ return this.isValid ? ve.create(this.loc, s).formatDurationFromString(this, e) : Hr;
5987
5987
  }
5988
5988
  /**
5989
5989
  * Returns a string representation of a Duration with all units included.
@@ -6394,8 +6394,8 @@ class de {
6394
6394
  */
6395
6395
  static invalid(e, n = null) {
6396
6396
  if (!e)
6397
- throw new _e("need to specify a reason the Interval is invalid");
6398
- const s = e instanceof Ve ? e : new Ve(e, n);
6397
+ throw new Ee("need to specify a reason the Interval is invalid");
6398
+ const s = e instanceof Ue ? e : new Ue(e, n);
6399
6399
  if (fe.throwOnInvalid)
6400
6400
  throw new Ka(s);
6401
6401
  return new de({ invalid: s });
@@ -6769,7 +6769,7 @@ class de {
6769
6769
  * @return {string}
6770
6770
  */
6771
6771
  toLocaleString(e = Bn, n = {}) {
6772
- return this.isValid ? Ee.create(this.s.loc.clone(n), e).formatInterval(this) : Nt;
6772
+ return this.isValid ? ve.create(this.s.loc.clone(n), e).formatInterval(this) : Nt;
6773
6773
  }
6774
6774
  /**
6775
6775
  * Returns an ISO 8601-compliant string representation of this Interval.
@@ -6855,7 +6855,7 @@ class bn {
6855
6855
  * @return {boolean}
6856
6856
  */
6857
6857
  static isValidIANAZone(e) {
6858
- return et.isValidZone(e);
6858
+ return tt.isValidZone(e);
6859
6859
  }
6860
6860
  /**
6861
6861
  * Converts the input into a {@link Zone} instance.
@@ -6872,7 +6872,7 @@ class bn {
6872
6872
  * @return {Zone}
6873
6873
  */
6874
6874
  static normalizeZone(e) {
6875
- return ot(e, fe.defaultZone);
6875
+ return at(e, fe.defaultZone);
6876
6876
  }
6877
6877
  /**
6878
6878
  * Get the weekday on which the week starts according to the given locale.
@@ -7053,7 +7053,7 @@ function Cc(t) {
7053
7053
  function Qr(t) {
7054
7054
  return t.replace(/\./g, "").replace(bo, " ").toLowerCase();
7055
7055
  }
7056
- function Le(t, e) {
7056
+ function Ve(t, e) {
7057
7057
  return t === null ? null : {
7058
7058
  regex: RegExp(t.map(Cc).join("|")),
7059
7059
  deser: ([n]) => t.findIndex((s) => Qr(n) === Qr(s)) + e
@@ -7062,22 +7062,22 @@ function Le(t, e) {
7062
7062
  function Kr(t, e) {
7063
7063
  return { regex: t, deser: ([, n, s]) => rs(n, s), groups: e };
7064
7064
  }
7065
- function Tn(t) {
7065
+ function Rn(t) {
7066
7066
  return { regex: t, deser: ([e]) => e };
7067
7067
  }
7068
7068
  function Fc(t) {
7069
7069
  return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
7070
7070
  }
7071
7071
  function $c(t, e) {
7072
- const n = Pe(e), s = Pe(e, "{2}"), r = Pe(e, "{3}"), i = Pe(e, "{4}"), o = Pe(e, "{6}"), a = Pe(e, "{1,2}"), l = Pe(e, "{1,3}"), c = Pe(e, "{1,6}"), d = Pe(e, "{1,9}"), h = Pe(e, "{2,4}"), u = Pe(e, "{4,6}"), f = (m) => ({ regex: RegExp(Fc(m.val)), deser: ([E]) => E, literal: !0 }), T = ((m) => {
7072
+ const n = Le(e), s = Le(e, "{2}"), r = Le(e, "{3}"), i = Le(e, "{4}"), o = Le(e, "{6}"), a = Le(e, "{1,2}"), l = Le(e, "{1,3}"), c = Le(e, "{1,6}"), d = Le(e, "{1,9}"), h = Le(e, "{2,4}"), u = Le(e, "{4,6}"), f = (m) => ({ regex: RegExp(Fc(m.val)), deser: ([E]) => E, literal: !0 }), R = ((m) => {
7073
7073
  if (t.literal)
7074
7074
  return f(m);
7075
7075
  switch (m.val) {
7076
7076
  // era
7077
7077
  case "G":
7078
- return Le(e.eras("short"), 0);
7078
+ return Ve(e.eras("short"), 0);
7079
7079
  case "GG":
7080
- return Le(e.eras("long"), 0);
7080
+ return Ve(e.eras("long"), 0);
7081
7081
  // years
7082
7082
  case "y":
7083
7083
  return re(c);
@@ -7095,17 +7095,17 @@ function $c(t, e) {
7095
7095
  case "MM":
7096
7096
  return re(s);
7097
7097
  case "MMM":
7098
- return Le(e.months("short", !0), 1);
7098
+ return Ve(e.months("short", !0), 1);
7099
7099
  case "MMMM":
7100
- return Le(e.months("long", !0), 1);
7100
+ return Ve(e.months("long", !0), 1);
7101
7101
  case "L":
7102
7102
  return re(a);
7103
7103
  case "LL":
7104
7104
  return re(s);
7105
7105
  case "LLL":
7106
- return Le(e.months("short", !1), 1);
7106
+ return Ve(e.months("short", !1), 1);
7107
7107
  case "LLLL":
7108
- return Le(e.months("long", !1), 1);
7108
+ return Ve(e.months("long", !1), 1);
7109
7109
  // dates
7110
7110
  case "d":
7111
7111
  return re(a);
@@ -7142,14 +7142,14 @@ function $c(t, e) {
7142
7142
  case "SSS":
7143
7143
  return re(r);
7144
7144
  case "u":
7145
- return Tn(d);
7145
+ return Rn(d);
7146
7146
  case "uu":
7147
- return Tn(a);
7147
+ return Rn(a);
7148
7148
  case "uuu":
7149
7149
  return re(n);
7150
7150
  // meridiem
7151
7151
  case "a":
7152
- return Le(e.meridiems(), 0);
7152
+ return Ve(e.meridiems(), 0);
7153
7153
  // weekYear (k)
7154
7154
  case "kkkk":
7155
7155
  return re(i);
@@ -7165,13 +7165,13 @@ function $c(t, e) {
7165
7165
  case "c":
7166
7166
  return re(n);
7167
7167
  case "EEE":
7168
- return Le(e.weekdays("short", !1), 1);
7168
+ return Ve(e.weekdays("short", !1), 1);
7169
7169
  case "EEEE":
7170
- return Le(e.weekdays("long", !1), 1);
7170
+ return Ve(e.weekdays("long", !1), 1);
7171
7171
  case "ccc":
7172
- return Le(e.weekdays("short", !0), 1);
7172
+ return Ve(e.weekdays("short", !0), 1);
7173
7173
  case "cccc":
7174
- return Le(e.weekdays("long", !0), 1);
7174
+ return Ve(e.weekdays("long", !0), 1);
7175
7175
  // offset/zone
7176
7176
  case "Z":
7177
7177
  case "ZZ":
@@ -7181,18 +7181,18 @@ function $c(t, e) {
7181
7181
  // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing
7182
7182
  // because we don't have any way to figure out what they are
7183
7183
  case "z":
7184
- return Tn(/[a-z_+-/]{1,256}?/i);
7184
+ return Rn(/[a-z_+-/]{1,256}?/i);
7185
7185
  // this special-case "token" represents a place where a macro-token expanded into a white-space literal
7186
7186
  // in this case we accept any non-newline white-space
7187
7187
  case " ":
7188
- return Tn(/[^\S\n\r]/);
7188
+ return Rn(/[^\S\n\r]/);
7189
7189
  default:
7190
7190
  return f(m);
7191
7191
  }
7192
7192
  })(t) || {
7193
7193
  invalidReason: Ac
7194
7194
  };
7195
- return T.token = t, T;
7195
+ return R.token = t, R;
7196
7196
  }
7197
7197
  const Mc = {
7198
7198
  year: {
@@ -7307,7 +7307,7 @@ function Uc(t) {
7307
7307
  }
7308
7308
  };
7309
7309
  let n = null, s;
7310
- return G(t.z) || (n = et.create(t.z)), G(t.Z) || (n || (n = new Oe(t.Z)), s = t.Z), G(t.q) || (t.M = (t.q - 1) * 3 + 1), G(t.h) || (t.h < 12 && t.a === 1 ? t.h += 12 : t.h === 12 && t.a === 0 && (t.h = 0)), t.G === 0 && t.y && (t.y = -t.y), G(t.u) || (t.S = sr(t.u)), [Object.keys(t).reduce((i, o) => {
7310
+ return G(t.z) || (n = tt.create(t.z)), G(t.Z) || (n || (n = new be(t.Z)), s = t.Z), G(t.q) || (t.M = (t.q - 1) * 3 + 1), G(t.h) || (t.h < 12 && t.a === 1 ? t.h += 12 : t.h === 12 && t.a === 0 && (t.h = 0)), t.G === 0 && t.y && (t.y = -t.y), G(t.u) || (t.S = sr(t.u)), [Object.keys(t).reduce((i, o) => {
7311
7311
  const a = e(o);
7312
7312
  return a && (i[a] = t[o]), i;
7313
7313
  }, {}), n, s];
@@ -7319,15 +7319,15 @@ function Wc() {
7319
7319
  function jc(t, e) {
7320
7320
  if (t.literal)
7321
7321
  return t;
7322
- const n = Ee.macroTokenToFormatOpts(t.val), s = Io(n, e);
7322
+ const n = ve.macroTokenToFormatOpts(t.val), s = Io(n, e);
7323
7323
  return s == null || s.includes(void 0) ? t : s;
7324
7324
  }
7325
- function To(t, e) {
7325
+ function Ro(t, e) {
7326
7326
  return Array.prototype.concat(...t.map((n) => jc(n, e)));
7327
7327
  }
7328
- class So {
7328
+ class To {
7329
7329
  constructor(e, n) {
7330
- if (this.locale = e, this.format = n, this.tokens = To(Ee.parseFormat(n), e), this.units = this.tokens.map((s) => $c(s, e)), this.disqualifyingUnit = this.units.find((s) => s.invalidReason), !this.disqualifyingUnit) {
7330
+ if (this.locale = e, this.format = n, this.tokens = Ro(ve.parseFormat(n), e), this.units = this.tokens.map((s) => $c(s, e)), this.disqualifyingUnit = this.units.find((s) => s.invalidReason), !this.disqualifyingUnit) {
7331
7331
  const [s, r] = Lc(this.units);
7332
7332
  this.regex = RegExp(s, "i"), this.handlers = r;
7333
7333
  }
@@ -7359,22 +7359,22 @@ class So {
7359
7359
  return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;
7360
7360
  }
7361
7361
  }
7362
- function Ro(t, e, n) {
7363
- return new So(t, n).explainFromTokens(e);
7362
+ function So(t, e, n) {
7363
+ return new To(t, n).explainFromTokens(e);
7364
7364
  }
7365
7365
  function Zc(t, e, n) {
7366
- const { result: s, zone: r, specificOffset: i, invalidReason: o } = Ro(t, e, n);
7366
+ const { result: s, zone: r, specificOffset: i, invalidReason: o } = So(t, e, n);
7367
7367
  return [s, r, i, o];
7368
7368
  }
7369
7369
  function Io(t, e) {
7370
7370
  if (!t)
7371
7371
  return null;
7372
- const s = Ee.create(e, t).dtFormatter(Wc()), r = s.formatToParts(), i = s.resolvedOptions();
7372
+ const s = ve.create(e, t).dtFormatter(Wc()), r = s.formatToParts(), i = s.resolvedOptions();
7373
7373
  return r.map((o) => Pc(o, t, i));
7374
7374
  }
7375
7375
  const ws = "Invalid DateTime", Xr = 864e13;
7376
7376
  function en(t) {
7377
- return new Ve("unsupported zone", `the zone "${t.name}" is not supported`);
7377
+ return new Ue("unsupported zone", `the zone "${t.name}" is not supported`);
7378
7378
  }
7379
7379
  function _s(t) {
7380
7380
  return t.weekData === null && (t.weekData = Hn(t.c)), t.weekData;
@@ -7406,7 +7406,7 @@ function xo(t, e, n) {
7406
7406
  const i = n.offset(s);
7407
7407
  return r === i ? [s, r] : [t - Math.min(r, i) * 60 * 1e3, Math.max(r, i)];
7408
7408
  }
7409
- function Sn(t, e) {
7409
+ function Tn(t, e) {
7410
7410
  t += e * 60 * 1e3;
7411
7411
  const n = new Date(t);
7412
7412
  return {
@@ -7453,11 +7453,11 @@ function At(t, e, n, s, r, i) {
7453
7453
  return o ? c : c.setZone(a);
7454
7454
  } else
7455
7455
  return j.invalid(
7456
- new Ve("unparsable", `the input "${r}" can't be parsed as ${s}`)
7456
+ new Ue("unparsable", `the input "${r}" can't be parsed as ${s}`)
7457
7457
  );
7458
7458
  }
7459
- function Rn(t, e, n = !0) {
7460
- return t.isValid ? Ee.create(ie.create("en-US"), {
7459
+ function Sn(t, e, n = !0) {
7460
+ return t.isValid ? ve.create(ie.create("en-US"), {
7461
7461
  allowZ: n,
7462
7462
  forceSimple: !0
7463
7463
  }).formatDateTimeFromString(t, e) : null;
@@ -7575,7 +7575,7 @@ function Gc(t) {
7575
7575
  return n === void 0 && (n = t.offset(tn), Bs.set(e, n)), n;
7576
7576
  }
7577
7577
  function si(t, e) {
7578
- const n = ot(e.zone, fe.defaultZone);
7578
+ const n = at(e.zone, fe.defaultZone);
7579
7579
  if (!n.isValid)
7580
7580
  return j.invalid(en(n));
7581
7581
  const s = ie.fromObject(e);
@@ -7616,7 +7616,7 @@ class j {
7616
7616
  */
7617
7617
  constructor(e) {
7618
7618
  const n = e.zone || fe.defaultZone;
7619
- let s = e.invalid || (Number.isNaN(e.ts) ? new Ve("invalid input") : null) || (n.isValid ? null : en(n));
7619
+ let s = e.invalid || (Number.isNaN(e.ts) ? new Ue("invalid input") : null) || (n.isValid ? null : en(n));
7620
7620
  this.ts = G(e.ts) ? fe.now() : e.ts;
7621
7621
  let r = null, i = null;
7622
7622
  if (!s)
@@ -7624,7 +7624,7 @@ class j {
7624
7624
  [r, i] = [e.old.c, e.old.o];
7625
7625
  else {
7626
7626
  const a = ut(e.o) && !e.old ? e.o : n.offset(this.ts);
7627
- r = Sn(this.ts, a), s = Number.isNaN(r.year) ? new Ve("invalid input") : null, r = s ? null : r, i = s ? null : a;
7627
+ r = Tn(this.ts, a), s = Number.isNaN(r.year) ? new Ue("invalid input") : null, r = s ? null : r, i = s ? null : a;
7628
7628
  }
7629
7629
  this._zone = n, this.loc = e.loc || ie.create(), this.invalid = s, this.weekData = null, this.localWeekData = null, this.c = r, this.o = i, this.isLuxonDateTime = !0;
7630
7630
  }
@@ -7691,7 +7691,7 @@ class j {
7691
7691
  */
7692
7692
  static utc() {
7693
7693
  const [e, n] = ii(arguments), [s, r, i, o, a, l, c] = n;
7694
- return e.zone = Oe.utcInstance, si({ year: s, month: r, day: i, hour: o, minute: a, second: l, millisecond: c }, e);
7694
+ return e.zone = be.utcInstance, si({ year: s, month: r, day: i, hour: o, minute: a, second: l, millisecond: c }, e);
7695
7695
  }
7696
7696
  /**
7697
7697
  * Create a DateTime from a JavaScript Date object. Uses the default zone.
@@ -7701,10 +7701,10 @@ class j {
7701
7701
  * @return {DateTime}
7702
7702
  */
7703
7703
  static fromJSDate(e, n = {}) {
7704
- const s = Sl(e) ? e.valueOf() : NaN;
7704
+ const s = Tl(e) ? e.valueOf() : NaN;
7705
7705
  if (Number.isNaN(s))
7706
7706
  return j.invalid("invalid input");
7707
- const r = ot(n.zone, fe.defaultZone);
7707
+ const r = at(n.zone, fe.defaultZone);
7708
7708
  return r.isValid ? new j({
7709
7709
  ts: s,
7710
7710
  zone: r,
@@ -7726,10 +7726,10 @@ class j {
7726
7726
  if (ut(e))
7727
7727
  return e < -Xr || e > Xr ? j.invalid("Timestamp out of range") : new j({
7728
7728
  ts: e,
7729
- zone: ot(n.zone, fe.defaultZone),
7729
+ zone: at(n.zone, fe.defaultZone),
7730
7730
  loc: ie.fromObject(n)
7731
7731
  });
7732
- throw new _e(
7732
+ throw new Ee(
7733
7733
  `fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`
7734
7734
  );
7735
7735
  }
@@ -7748,10 +7748,10 @@ class j {
7748
7748
  if (ut(e))
7749
7749
  return new j({
7750
7750
  ts: e * 1e3,
7751
- zone: ot(n.zone, fe.defaultZone),
7751
+ zone: at(n.zone, fe.defaultZone),
7752
7752
  loc: ie.fromObject(n)
7753
7753
  });
7754
- throw new _e("fromSeconds requires a numerical input");
7754
+ throw new Ee("fromSeconds requires a numerical input");
7755
7755
  }
7756
7756
  /**
7757
7757
  * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.
@@ -7788,7 +7788,7 @@ class j {
7788
7788
  */
7789
7789
  static fromObject(e, n = {}) {
7790
7790
  e = e || {};
7791
- const s = ot(n.zone, fe.defaultZone);
7791
+ const s = at(n.zone, fe.defaultZone);
7792
7792
  if (!s.isValid)
7793
7793
  return j.invalid(en(s));
7794
7794
  const r = ie.fromObject(n), i = Yn(e, ni), { minDaysInFirstWeek: o, startOfWeek: a } = jr(i, r), l = fe.now(), c = G(n.specificOffset) ? s.offset(l) : n.specificOffset, d = !G(i.ordinal), h = !G(i.year), u = !G(i.month) || !G(i.day), f = h || u, g = i.weekYear || i.weekNumber;
@@ -7798,18 +7798,18 @@ class j {
7798
7798
  );
7799
7799
  if (u && d)
7800
7800
  throw new Ct("Can't mix ordinal dates with month/day");
7801
- const T = g || i.weekday && !f;
7802
- let m, E, w = Sn(l, c);
7803
- T ? (m = Bc, E = zc, w = Hn(w, o, a)) : d ? (m = Hc, E = qc, w = ys(w)) : (m = An, E = No);
7801
+ const R = g || i.weekday && !f;
7802
+ let m, E, w = Tn(l, c);
7803
+ R ? (m = Bc, E = zc, w = Hn(w, o, a)) : d ? (m = Hc, E = qc, w = ys(w)) : (m = An, E = No);
7804
7804
  let x = !1;
7805
- for (const R of m) {
7806
- const p = i[R];
7807
- G(p) ? x ? i[R] = E[R] : i[R] = w[R] : x = !0;
7805
+ for (const S of m) {
7806
+ const p = i[S];
7807
+ G(p) ? x ? i[S] = E[S] : i[S] = w[S] : x = !0;
7808
7808
  }
7809
- const k = T ? kl(i, o, a) : d ? bl(i) : to(i), v = k || no(i);
7809
+ const k = R ? kl(i, o, a) : d ? bl(i) : to(i), v = k || no(i);
7810
7810
  if (v)
7811
7811
  return j.invalid(v);
7812
- const N = T ? Ur(i, o, a) : d ? Wr(i) : i, [W, O] = Nn(N, c, s), H = new j({
7812
+ const N = R ? Ur(i, o, a) : d ? Wr(i) : i, [W, O] = Nn(N, c, s), H = new j({
7813
7813
  ts: W,
7814
7814
  zone: s,
7815
7815
  o: O,
@@ -7896,7 +7896,7 @@ class j {
7896
7896
  */
7897
7897
  static fromFormat(e, n, s = {}) {
7898
7898
  if (G(e) || G(n))
7899
- throw new _e("fromFormat requires an input string and a format");
7899
+ throw new Ee("fromFormat requires an input string and a format");
7900
7900
  const { locale: r = null, numberingSystem: i = null } = s, o = ie.fromOpts({
7901
7901
  locale: r,
7902
7902
  numberingSystem: i,
@@ -7943,8 +7943,8 @@ class j {
7943
7943
  */
7944
7944
  static invalid(e, n = null) {
7945
7945
  if (!e)
7946
- throw new _e("need to specify a reason the DateTime is invalid");
7947
- const s = e instanceof Ve ? e : new Ve(e, n);
7946
+ throw new Ee("need to specify a reason the DateTime is invalid");
7947
+ const s = e instanceof Ue ? e : new Ue(e, n);
7948
7948
  if (fe.throwOnInvalid)
7949
7949
  throw new Qa(s);
7950
7950
  return new j({ invalid: s });
@@ -7975,7 +7975,7 @@ class j {
7975
7975
  * @returns {string}
7976
7976
  */
7977
7977
  static expandFormat(e, n = {}) {
7978
- return To(Ee.parseFormat(e), ie.fromObject(n)).map((r) => r.val).join("");
7978
+ return Ro(ve.parseFormat(e), ie.fromObject(n)).map((r) => r.val).join("");
7979
7979
  }
7980
7980
  static resetCache() {
7981
7981
  tn = void 0, Bs.clear();
@@ -8279,7 +8279,7 @@ class j {
8279
8279
  const e = 864e5, n = 6e4, s = ss(this.c), r = this.zone.offset(s - e), i = this.zone.offset(s + e), o = this.zone.offset(s - r * n), a = this.zone.offset(s - i * n);
8280
8280
  if (o === a)
8281
8281
  return [this];
8282
- const l = s - o * n, c = s - a * n, d = Sn(l, o), h = Sn(c, a);
8282
+ const l = s - o * n, c = s - a * n, d = Tn(l, o), h = Tn(c, a);
8283
8283
  return d.hour === h.hour && d.minute === h.minute && d.second === h.second && d.millisecond === h.millisecond ? [wt(this, { ts: l }), wt(this, { ts: c })] : [this];
8284
8284
  }
8285
8285
  /**
@@ -8339,7 +8339,7 @@ class j {
8339
8339
  * @return {Object}
8340
8340
  */
8341
8341
  resolvedLocaleOptions(e = {}) {
8342
- const { locale: n, numberingSystem: s, calendar: r } = Ee.create(
8342
+ const { locale: n, numberingSystem: s, calendar: r } = ve.create(
8343
8343
  this.loc.clone(e),
8344
8344
  e
8345
8345
  ).resolvedOptions(this);
@@ -8355,7 +8355,7 @@ class j {
8355
8355
  * @return {DateTime}
8356
8356
  */
8357
8357
  toUTC(e = 0, n = {}) {
8358
- return this.setZone(Oe.instance(e), n);
8358
+ return this.setZone(be.instance(e), n);
8359
8359
  }
8360
8360
  /**
8361
8361
  * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.
@@ -8376,7 +8376,7 @@ class j {
8376
8376
  * @return {DateTime}
8377
8377
  */
8378
8378
  setZone(e, { keepLocalTime: n = !1, keepCalendarTime: s = !1 } = {}) {
8379
- if (e = ot(e, fe.defaultZone), e.equals(this.zone))
8379
+ if (e = at(e, fe.defaultZone), e.equals(this.zone))
8380
8380
  return this;
8381
8381
  if (e.isValid) {
8382
8382
  let r = this.ts;
@@ -8545,7 +8545,7 @@ class j {
8545
8545
  * @return {string}
8546
8546
  */
8547
8547
  toFormat(e, n = {}) {
8548
- return this.isValid ? Ee.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this, e) : ws;
8548
+ return this.isValid ? ve.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this, e) : ws;
8549
8549
  }
8550
8550
  /**
8551
8551
  * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.
@@ -8567,7 +8567,7 @@ class j {
8567
8567
  * @return {string}
8568
8568
  */
8569
8569
  toLocaleString(e = Bn, n = {}) {
8570
- return this.isValid ? Ee.create(this.loc.clone(n), e).formatDateTime(this) : ws;
8570
+ return this.isValid ? ve.create(this.loc.clone(n), e).formatDateTime(this) : ws;
8571
8571
  }
8572
8572
  /**
8573
8573
  * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.
@@ -8583,7 +8583,7 @@ class j {
8583
8583
  * //=> ]
8584
8584
  */
8585
8585
  toLocaleParts(e = {}) {
8586
- return this.isValid ? Ee.create(this.loc.clone(e), e).formatDateTimeParts(this) : [];
8586
+ return this.isValid ? ve.create(this.loc.clone(e), e).formatDateTimeParts(this) : [];
8587
8587
  }
8588
8588
  /**
8589
8589
  * Returns an ISO 8601-compliant string representation of this DateTime
@@ -8644,7 +8644,7 @@ class j {
8644
8644
  * @return {string}
8645
8645
  */
8646
8646
  toISOWeekDate() {
8647
- return Rn(this, "kkkk-'W'WW-c");
8647
+ return Sn(this, "kkkk-'W'WW-c");
8648
8648
  }
8649
8649
  /**
8650
8650
  * Returns an ISO 8601-compliant string representation of this DateTime's time component
@@ -8689,7 +8689,7 @@ class j {
8689
8689
  * @return {string}
8690
8690
  */
8691
8691
  toRFC2822() {
8692
- return Rn(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", !1);
8692
+ return Sn(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", !1);
8693
8693
  }
8694
8694
  /**
8695
8695
  * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.
@@ -8700,7 +8700,7 @@ class j {
8700
8700
  * @return {string}
8701
8701
  */
8702
8702
  toHTTP() {
8703
- return Rn(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
8703
+ return Sn(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
8704
8704
  }
8705
8705
  /**
8706
8706
  * Returns a string representation of this DateTime appropriate for use in SQL Date
@@ -8724,7 +8724,7 @@ class j {
8724
8724
  */
8725
8725
  toSQLTime({ includeOffset: e = !0, includeZone: n = !1, includeOffsetSpace: s = !0 } = {}) {
8726
8726
  let r = "HH:mm:ss.SSS";
8727
- return (n || e) && (s && (r += " "), n ? r += "z" : e && (r += "ZZ")), Rn(this, r, !0);
8727
+ return (n || e) && (s && (r += " "), n ? r += "z" : e && (r += "ZZ")), Sn(this, r, !0);
8728
8728
  }
8729
8729
  /**
8730
8730
  * Returns a string representation of this DateTime appropriate for use in SQL DateTime
@@ -8835,7 +8835,7 @@ class j {
8835
8835
  diff(e, n = "milliseconds", s = {}) {
8836
8836
  if (!this.isValid || !e.isValid)
8837
8837
  return ne.invalid("created by diffing an invalid DateTime");
8838
- const r = { locale: this.locale, numberingSystem: this.numberingSystem, ...s }, i = Rl(n).map(ne.normalizeUnit), o = e.valueOf() > this.valueOf(), a = o ? this : e, l = o ? e : this, c = Nc(a, l, i, r);
8838
+ const r = { locale: this.locale, numberingSystem: this.numberingSystem, ...s }, i = Sl(n).map(ne.normalizeUnit), o = e.valueOf() > this.valueOf(), a = o ? this : e, l = o ? e : this, c = Nc(a, l, i, r);
8839
8839
  return o ? c.negate() : c;
8840
8840
  }
8841
8841
  /**
@@ -8941,7 +8941,7 @@ class j {
8941
8941
  */
8942
8942
  static min(...e) {
8943
8943
  if (!e.every(j.isDateTime))
8944
- throw new _e("min requires all arguments be DateTimes");
8944
+ throw new Ee("min requires all arguments be DateTimes");
8945
8945
  return Zr(e, (n) => n.valueOf(), Math.min);
8946
8946
  }
8947
8947
  /**
@@ -8951,7 +8951,7 @@ class j {
8951
8951
  */
8952
8952
  static max(...e) {
8953
8953
  if (!e.every(j.isDateTime))
8954
- throw new _e("max requires all arguments be DateTimes");
8954
+ throw new Ee("max requires all arguments be DateTimes");
8955
8955
  return Zr(e, (n) => n.valueOf(), Math.max);
8956
8956
  }
8957
8957
  // MISC
@@ -8968,7 +8968,7 @@ class j {
8968
8968
  numberingSystem: i,
8969
8969
  defaultToEN: !0
8970
8970
  });
8971
- return Ro(o, e, n);
8971
+ return So(o, e, n);
8972
8972
  }
8973
8973
  /**
8974
8974
  * @deprecated use fromFormatExplain instead
@@ -8994,7 +8994,7 @@ class j {
8994
8994
  numberingSystem: r,
8995
8995
  defaultToEN: !0
8996
8996
  });
8997
- return new So(i, e);
8997
+ return new To(i, e);
8998
8998
  }
8999
8999
  /**
9000
9000
  * Create a DateTime from an input string and format parser.
@@ -9008,7 +9008,7 @@ class j {
9008
9008
  */
9009
9009
  static fromFormatParser(e, n, s = {}) {
9010
9010
  if (G(e) || G(n))
9011
- throw new _e(
9011
+ throw new Ee(
9012
9012
  "fromFormatParser requires an input string and a format parser"
9013
9013
  );
9014
9014
  const { locale: r = null, numberingSystem: i = null } = s, o = ie.fromOpts({
@@ -9017,7 +9017,7 @@ class j {
9017
9017
  defaultToEN: !0
9018
9018
  });
9019
9019
  if (!o.equals(n.locale))
9020
- throw new _e(
9020
+ throw new Ee(
9021
9021
  `fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`
9022
9022
  );
9023
9023
  const { result: a, zone: l, specificOffset: c, invalidReason: d } = n.explainFromTokens(e);
@@ -9193,7 +9193,7 @@ function Jt(t) {
9193
9193
  return j.fromJSDate(t);
9194
9194
  if (t && typeof t == "object")
9195
9195
  return j.fromObject(t);
9196
- throw new _e(
9196
+ throw new Ee(
9197
9197
  `Unknown datetime argument: ${t}, of type ${typeof t}`
9198
9198
  );
9199
9199
  }
@@ -9209,13 +9209,13 @@ const Yc = (t, e) => {
9209
9209
  });
9210
9210
  }
9211
9211
  return qe({
9212
- Collection_Path: Rt(Re()),
9212
+ Collection_Path: St(xe()),
9213
9213
  ...n
9214
9214
  });
9215
9215
  }, Jc = (t, e, n, s) => {
9216
9216
  let r = qe({}).catchall(Yc(t, e)), i;
9217
9217
  if (!s && n) {
9218
- const o = Ue(t, n);
9218
+ const o = We(t, n);
9219
9219
  i = Qt(o.admin?.skipFormRequiredValidation);
9220
9220
  }
9221
9221
  return (!t.required || i) && (r = r.optional()), r;
@@ -9228,14 +9228,14 @@ const Yc = (t, e) => {
9228
9228
  ` || "";
9229
9229
  let i, o, a;
9230
9230
  if (!n && e) {
9231
- const l = Ue(t, e);
9231
+ const l = We(t, e);
9232
9232
  i = l.admin?.condition?.form !== void 0 && !Qt(l.admin.condition.form), o = Qt(l.admin?.skipFormRequiredValidation), a = Qt(l.admin?.image);
9233
9233
  }
9234
9234
  switch (t.type) {
9235
9235
  case "String":
9236
- s = Re(), t.length && (s = s.length(t.length, `Must be ${t.length} character(s) long`)), t.minlength && (s = s.min(t.minlength, `Must contain at least ${t.minlength} character(s)`)), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} character(s)`)), t.email ? s = s.email("Must be a valid email address") : t.uuid ? s = Te([s.uuid("Must be a valid UUID"), Se("")]) : t.url ? s = Te([s.url("Must be a valid URL"), Se("")]) : t.emoji ? s = Te([s.emoji("Must be a valid emoji"), Se("")]) : t.ip ? s = Te([s.ip("Must be a valid IP address"), Se("")]) : t.pattern && (!n && a ? s = Te([s.regex(new RegExp(t.pattern)), s.regex(/^blob:/)], {
9236
+ s = xe(), t.length && (s = s.length(t.length, `Must be ${t.length} character(s) long`)), t.minlength && (s = s.min(t.minlength, `Must contain at least ${t.minlength} character(s)`)), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} character(s)`)), t.email ? s = s.email("Must be a valid email address") : t.uuid ? s = Se([s.uuid("Must be a valid UUID"), Ie("")]) : t.url ? s = Se([s.url("Must be a valid URL"), Ie("")]) : t.emoji ? s = Se([s.emoji("Must be a valid emoji"), Ie("")]) : t.ip ? s = Se([s.ip("Must be a valid IP address"), Ie("")]) : t.pattern && (!n && a ? s = Se([s.regex(new RegExp(t.pattern)), s.regex(/^blob:/)], {
9237
9237
  message: "Must be a valid value"
9238
- }) : s = s.regex(new RegExp(t.pattern), "Must be a valid value")), t.values && (s = Te([
9238
+ }) : s = s.regex(new RegExp(t.pattern), "Must be a valid value")), t.values && (s = Se([
9239
9239
  zn(t.values, {
9240
9240
  message: `Must be one of the following values: ${t.values.join(", ")}`
9241
9241
  }),
@@ -9246,13 +9246,13 @@ const Yc = (t, e) => {
9246
9246
  s = on(), r && (s = s.describe(r.trim()));
9247
9247
  break;
9248
9248
  case "Number":
9249
- t.autoIncrement ? s = Te([fs(), Ot().int()], {
9249
+ t.autoIncrement ? s = Se([fs(), Ot().int()], {
9250
9250
  message: "Must be a valid number"
9251
9251
  }) : (s = Ot({
9252
9252
  message: "Must be a valid number"
9253
9253
  }), t.min && (s = s.min(t.min, `Must be greater than or equal to ${t.min}`)), t.max && (s = s.max(t.max, `Must be less than or equal to ${t.max}`)), t.decimal ? n ? s = s.describe(`${r}Must have ${t.decimal} decimal places`) : s = s.refine((l) => t.decimal ? (l.toString().split(".")[1]?.length || 0) <= t.decimal : !1, {
9254
9254
  message: `Must have ${t.decimal} or fewer decimal places`
9255
- }) : s = s.int("Must not have decimal places"), t.values ? (n || (s = Te([
9255
+ }) : s = s.int("Must not have decimal places"), t.values ? (n || (s = Se([
9256
9256
  s.refine((l) => t.values?.includes(l), {
9257
9257
  message: `Must be one of the following values: ${t.values.join(", ")}`
9258
9258
  }),
@@ -9270,7 +9270,7 @@ const Yc = (t, e) => {
9270
9270
  })));
9271
9271
  break;
9272
9272
  case "Array":
9273
- s = Rt(we()), t.length && (s = s.length(t.length, `Must contain ${t.length} item(s)`)), t.minlength ? s = s.min(t.minlength, `Must contain at least ${t.minlength} item(s)`) : t.required && !i && (s = s.nonempty("Must contain at least one item")), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} item(s)`)), t.values ? (n || (s = s.refine((l) => {
9273
+ s = St(we()), t.length && (s = s.length(t.length, `Must contain ${t.length} item(s)`)), t.minlength ? s = s.min(t.minlength, `Must contain at least ${t.minlength} item(s)`) : t.required && !i && (s = s.nonempty("Must contain at least one item")), t.maxlength && (s = s.max(t.maxlength, `Must contain at most ${t.maxlength} item(s)`)), t.values ? (n || (s = s.refine((l) => {
9274
9274
  let c = !0;
9275
9275
  return l.forEach((d) => {
9276
9276
  t.values && !t.values.includes(d) && (c = !1);
@@ -9296,8 +9296,8 @@ const Yc = (t, e) => {
9296
9296
  })), c.max && (a[c.name] = a[c.name].refine((d) => c.max && (!d || Object.keys(d).length <= c.max), {
9297
9297
  message: `Must contain at most ${c.max} item(s)`
9298
9298
  })))) : a[c.name] = Ao(c, n, s), r && (a[c.name] = a[c.name].optional()));
9299
- }), !s && i && (a.operation = Te([Se("create"), Se("update"), Se("delete")]).optional(), a.password = Re().optional(), a.passwordConfirm = Re().optional(), Object.values(e.collections).forEach((c) => {
9300
- a[`auth-${c.labels.collection}`] = on().optional(), a[`operations-${c.labels.collection}`] = Rt(Te([Se("Read"), Se("Create"), Se("Update"), Se("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = on().optional(), c.access.attributeRestrictions?.forEach((d) => {
9299
+ }), !s && i && (a.operation = Se([Ie("create"), Ie("update"), Ie("delete")]).optional(), a.password = xe().optional(), a.passwordConfirm = xe().optional(), Object.values(e.collections).forEach((c) => {
9300
+ a[`auth-${c.labels.collection}`] = on().optional(), a[`operations-${c.labels.collection}`] = St(Se([Ie("Read"), Ie("Create"), Ie("Update"), Ie("Delete")])).optional(), a[`restrict-${c.labels.collection}`] = on().optional(), c.access.attributeRestrictions?.forEach((d) => {
9301
9301
  a[`attribute-${c.labels.collection}-${d.type}`] = on().optional();
9302
9302
  }), c.access.entityRestrictions?.restrictions?.forEach((d) => {
9303
9303
  if (d.type === "Individual" && (a[`accessible-${c.labels.collection}-${c.labels.collection}`] = qe({}).catchall(we()).optional()), d.type === "Parent" || d.type === "Parent_Property") {
@@ -9319,7 +9319,7 @@ const Yc = (t, e) => {
9319
9319
  for (const a of s.fields)
9320
9320
  await oi(a.custom?.preValidate, r);
9321
9321
  return Ja(t, n, i).parse(e), e;
9322
- }, lr = (t, e, n, s, r, i, o, a, l, c, d, h, u, f, g, T, m, E, w, x, k) => {
9322
+ }, lr = (t, e, n, s, r, i, o, a, l, c, d, h, u, f, g, R, m, E, w, x, k) => {
9323
9323
  const { fields: v } = o;
9324
9324
  v.filter((p) => "unique" in p && p.unique).forEach((p) => {
9325
9325
  t !== "delete" && (typeof r[p.name] == "string" || typeof r[p.name] == "number") && (e.set(f(p, r[p.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||")), {
@@ -9342,12 +9342,12 @@ const Yc = (t, e) => {
9342
9342
  if (P.length === 0)
9343
9343
  continue;
9344
9344
  const y = rn(p, I.key), _ = {};
9345
- P.forEach((S) => {
9345
+ P.forEach((T) => {
9346
9346
  [
9347
- S.name,
9348
- `${S.name}_Array`,
9349
- `${S.name}_Single`,
9350
- `${S.name}_Lowercase`
9347
+ T.name,
9348
+ `${T.name}_Array`,
9349
+ `${T.name}_Single`,
9350
+ `${T.name}_Lowercase`
9351
9351
  ].forEach((F) => {
9352
9352
  r[F] !== void 0 && (_[F] = r[F]);
9353
9353
  });
@@ -9367,16 +9367,16 @@ const Yc = (t, e) => {
9367
9367
  });
9368
9368
  const P = l[p.labels.collection];
9369
9369
  for (const _ of P)
9370
- _.fields.some((S) => S.name === C.name) && ee(C) && I++;
9370
+ _.fields.some((T) => T.name === C.name) && ee(C) && I++;
9371
9371
  const y = _t(p);
9372
- for (const [_, S] of Object.entries(y))
9373
- if (S.length !== 0)
9372
+ for (const [_, T] of Object.entries(y))
9373
+ if (T.length !== 0)
9374
9374
  for (const U of P)
9375
9375
  On(_, p, U).some((D) => D.name === C.name) && ee(C) && I++;
9376
9376
  return I;
9377
9377
  }, H = (p, C, I, P, y) => {
9378
9378
  const _ = {};
9379
- _[`${I.name}.${s}`] = h(), _[`${I.name}_Array`] = d(s), _[`${I.name}_Single`] = h(), e.update(T(y, P), _), yt(I, C, i) && e.update(m(p, I.name, P), {
9379
+ _[`${I.name}.${s}`] = h(), _[`${I.name}_Array`] = d(s), _[`${I.name}_Single`] = h(), e.update(R(y, P), _), yt(I, C, i) && e.update(m(p, I.name, P), {
9380
9380
  [`${I.name}.${s}`]: h(),
9381
9381
  [`${I.name}_Array`]: d(s)
9382
9382
  }), C.fields.forEach((F) => {
@@ -9384,22 +9384,22 @@ const Yc = (t, e) => {
9384
9384
  [`${I.name}_Array`]: d(s)
9385
9385
  });
9386
9386
  });
9387
- const S = l[C.labels.collection];
9388
- for (const F of S)
9387
+ const T = l[C.labels.collection];
9388
+ for (const F of T)
9389
9389
  F.fields.some((D) => D.name === I.name) && ee(I) && e.update(E(p, F.key, P), _);
9390
9390
  const U = _t(C);
9391
9391
  for (const [F, D] of Object.entries(U))
9392
9392
  if (D.length !== 0)
9393
- for (const M of S) {
9393
+ for (const M of T) {
9394
9394
  const J = On(F, C, M), z = rn(F, M.key);
9395
9395
  J.some((b) => b.name === I.name) && ee(I) && e.update(E(p, z, P), _);
9396
9396
  }
9397
9397
  };
9398
9398
  if (t === "delete")
9399
9399
  return;
9400
- const R = v.filter((p) => ee(p) && p.twoWay);
9400
+ const S = v.filter((p) => ee(p) && p.twoWay);
9401
9401
  if (!a?.noTwoWay) {
9402
- for (const p of R) {
9402
+ for (const p of S) {
9403
9403
  if (!k)
9404
9404
  throw new Error("VALIDATION_ERROR: batchSize is required");
9405
9405
  const C = i.collections[p.collection], I = V(C.fields, p.twoWay), P = Et(C, C.fields), y = Array.from(P).map((_) => _.name);
@@ -9407,17 +9407,17 @@ const Yc = (t, e) => {
9407
9407
  throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
9408
9408
  if (ee(I)) {
9409
9409
  if (r[`${p.name}_Array`])
9410
- for (const [_, S] of Object.entries(r[p.name])) {
9410
+ for (const [_, T] of Object.entries(r[p.name])) {
9411
9411
  if (t === "update" && w && w[`${p.name}_Array`]?.includes(_))
9412
9412
  continue;
9413
9413
  const U = { ...w, ...r };
9414
- at(U);
9414
+ Qe(U);
9415
9415
  const F = {};
9416
9416
  I.includeFields && I.includeFields.forEach((b) => {
9417
9417
  if (U[b] !== void 0) {
9418
9418
  F[b] = U[b];
9419
9419
  const B = V(o.fields, b);
9420
- St(o, [B]).size === 1 && (F[`${b}_Lowercase`] = U[`${b}_Lowercase`]);
9420
+ Tt(o, [B]).size === 1 && (F[`${b}_Lowercase`] = U[`${b}_Lowercase`]);
9421
9421
  }
9422
9422
  });
9423
9423
  const D = {
@@ -9433,7 +9433,7 @@ const Yc = (t, e) => {
9433
9433
  ...F
9434
9434
  });
9435
9435
  const M = Mn(r);
9436
- e.update(T(S.Collection_Path, _), {
9436
+ e.update(R(T.Collection_Path, _), {
9437
9437
  ...D,
9438
9438
  ...M
9439
9439
  }), k.size++, yt(I, C, i) && (e.update(m(p, I.name, _), {
@@ -9462,12 +9462,12 @@ const Yc = (t, e) => {
9462
9462
  for (const [b, B] of Object.entries(z))
9463
9463
  if (B.length !== 0)
9464
9464
  for (const K of J) {
9465
- const le = On(b, C, K), be = rn(b, K.key);
9465
+ const le = On(b, C, K), Te = rn(b, K.key);
9466
9466
  if (le.some((oe) => oe.name === I.name)) {
9467
9467
  const oe = { ...D };
9468
9468
  Object.keys(M).forEach((ce) => {
9469
- le.some((Ne) => Ne.name === ce) && (oe[ce] = M[ce]);
9470
- }), Object.keys(oe).length > 0 && (e.update(E(p, be, _), oe), k.size++);
9469
+ le.some((De) => De.name === ce) && (oe[ce] = M[ce]);
9470
+ }), Object.keys(oe).length > 0 && (e.update(E(p, Te, _), oe), k.size++);
9471
9471
  }
9472
9472
  }
9473
9473
  }
@@ -9475,27 +9475,27 @@ const Yc = (t, e) => {
9475
9475
  throw new Error(`SCHEMA_ERROR: Invalid field type: ${I.type}`);
9476
9476
  }
9477
9477
  k && k.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${k.size} operations in the Firestore transaction has exceeded the recommended limit of 500. This is likely due to a large number of two way updates, roles, dependencies on the collection, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.`));
9478
- for (const p of R) {
9478
+ for (const p of S) {
9479
9479
  if (!k)
9480
9480
  throw new Error("VALIDATION_ERROR: batchSize is required");
9481
9481
  const C = i.collections[p.collection], I = V(C.fields, p.twoWay);
9482
9482
  if (!I)
9483
9483
  throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
9484
9484
  if (ee(I)) {
9485
- if (t === "update" && w && !(r[p.name] && De(r[p.name])) && r[`${p.name}_Array`] && w[`${p.name}_Array`]?.length > 0)
9485
+ if (t === "update" && w && !(r[p.name] && ke(r[p.name])) && r[`${p.name}_Array`] && w[`${p.name}_Array`]?.length > 0)
9486
9486
  for (const [P, y] of Object.entries(w[p.name]))
9487
9487
  !r[`${p.name}_Array`].includes(P) && !x?.get(p.name)?.includes(P) && (k.size += O(C, I), k.size <= 500 && H(p, C, I, P, y.Collection_Path));
9488
9488
  } else
9489
9489
  throw new Error(`SCHEMA_ERROR: Invalid field type: ${I.type}`);
9490
9490
  }
9491
- for (const p of R) {
9491
+ for (const p of S) {
9492
9492
  if (!k)
9493
9493
  throw new Error("VALIDATION_ERROR: batchSize is required");
9494
9494
  const C = i.collections[p.collection], I = V(C.fields, p.twoWay);
9495
9495
  if (!I)
9496
9496
  throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
9497
9497
  if (ee(I)) {
9498
- if (t === "update" && w && r[p.name] && De(r[p.name]) && w[`${p.name}_Array`]?.length > 0)
9498
+ if (t === "update" && w && r[p.name] && ke(r[p.name]) && w[`${p.name}_Array`]?.length > 0)
9499
9499
  for (const [P, y] of Object.entries(w[p.name]))
9500
9500
  x?.get(p.name)?.includes(P) || (k.size += O(C, I), k.size <= 500 && H(p, C, I, P, y.Collection_Path));
9501
9501
  } else
@@ -9599,7 +9599,7 @@ const Ft = {
9599
9599
  return $n;
9600
9600
  },
9601
9601
  getStokerFirestore: he
9602
- }, Tu = async (t, e, n, s, r) => {
9602
+ }, Ru = async (t, e, n, s, r) => {
9603
9603
  const i = !!ci;
9604
9604
  if (ci = !0, e && (Cn = e), Co = t, ks && !r)
9605
9605
  return Ft;
@@ -9617,7 +9617,7 @@ const Ft = {
9617
9617
  projectId: a.projectId
9618
9618
  });
9619
9619
  }
9620
- const h = await tt();
9620
+ const h = await nt();
9621
9621
  return $o = await eu(s, Object.keys(h.collections)), Fo = await ae(nn.timezone), i || he().collection("system_deployment").doc("maintenance_mode").onSnapshot((u) => {
9622
9622
  u.exists ? ($n = u.data(), ae(nn.onMaintenanceUpdate, ["node", $n.active ? "on" : "off"])) : console.error("Maintenance status not found");
9623
9623
  }, (u) => {
@@ -9632,7 +9632,7 @@ const Ft = {
9632
9632
  };
9633
9633
  f();
9634
9634
  }), Ft;
9635
- }, { getTenant: nt, setTenant: Su, getMode: Mo, getTimezone: Po, getGlobalConfigModule: Gt, getCustomizationFile: mt, getVersionInfo: Ru, getMaintenanceInfo: Iu } = Ft, xu = async (t, e, n, s) => new Promise((r, i) => {
9635
+ }, { getTenant: st, setTenant: Tu, getMode: Mo, getTimezone: Po, getGlobalConfigModule: Gt, getCustomizationFile: mt, getVersionInfo: Su, getMaintenanceInfo: Iu } = Ft, xu = async (t, e, n, s) => new Promise((r, i) => {
9636
9636
  const o = ta(t, e, { cwd: n || process.cwd(), env: { ...process.env, ...s } });
9637
9637
  let a = "";
9638
9638
  const l = () => {
@@ -9664,13 +9664,13 @@ const Ft = {
9664
9664
  projectId: e.projectId
9665
9665
  });
9666
9666
  }
9667
- }, tt = async (t = !1) => {
9667
+ }, nt = async (t = !1) => {
9668
9668
  const s = await pi().ref("schema").orderByChild("published_time").limitToLast(1).get(), r = Object.values(s.val())[0];
9669
9669
  if (t) {
9670
9670
  for (const i of Object.values(r.collections))
9671
9671
  for (const o of i.fields)
9672
9672
  if (o.type === "Computed") {
9673
- const a = Ue(o, mt(i.labels.collection, r));
9673
+ const a = We(o, mt(i.labels.collection, r));
9674
9674
  a.formula && (o.formula = a.formula);
9675
9675
  }
9676
9676
  } else
@@ -9681,7 +9681,7 @@ const Ft = {
9681
9681
  const n = await pi().ref("schema").orderByChild("published_time").limitToLast(2).get();
9682
9682
  if (!(n.numChildren() < 2))
9683
9683
  return Object.values(n.val())[0];
9684
- }, $e = (t, e, n) => {
9684
+ }, Me = (t, e, n) => {
9685
9685
  let s = t.collection("tenants").doc(n);
9686
9686
  for (let r = 0; r < e.length; r++)
9687
9687
  r % 2 === 0 ? s = s.collection(e[r]) : s = s.doc(e[r]);
@@ -9690,18 +9690,18 @@ const Ft = {
9690
9690
  const o = he(), a = e.at(-1);
9691
9691
  if (!a)
9692
9692
  throw new Error("EMPTY_PATH");
9693
- const l = n.collections[a], { labels: c, fields: d, preloadCache: h } = l, u = mt(a, n), f = $e(o, e, t);
9693
+ const l = n.collections[a], { labels: c, fields: d, preloadCache: h } = l, u = mt(a, n), f = Me(o, e, t);
9694
9694
  if (r)
9695
9695
  if (s) {
9696
9696
  const g = r.collections?.[c.collection];
9697
9697
  if (!r.Role)
9698
9698
  throw new Error("PERMISSION_DENIED");
9699
- const T = g && Ie("Read", g), m = Ei(l, n, r, i ?? {}), E = wi(l, r), w = Gs(l, r), x = _i(l, n, r), k = (y = []) => {
9700
- const _ = [], S = bi(r.Role, l, n);
9701
- if (!S)
9699
+ const R = g && Ne("Read", g), m = Ei(l, n, r, i ?? {}), E = wi(l, r), w = Gs(l, r), x = _i(l, n, r), k = (y = []) => {
9700
+ const _ = [], T = bi(r.Role, l, n);
9701
+ if (!T)
9702
9702
  throw new Error("PERMISSION_DENIED");
9703
- if (T) {
9704
- let U = o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${S.key}`).where("Collection_Path_String", "==", e.join("/"));
9703
+ if (R) {
9704
+ let U = o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${T.key}`).where("Collection_Path_String", "==", e.join("/"));
9705
9705
  y.forEach((D) => {
9706
9706
  U = U.where(...D);
9707
9707
  }), _.push(U);
@@ -9709,7 +9709,7 @@ const Ft = {
9709
9709
  Object.entries(l.fieldAccessGroups || {}).forEach(([D, M]) => {
9710
9710
  if (!F[D]?.length || !Xn(M, c.collection, r, i ?? {}))
9711
9711
  return;
9712
- const J = rn(D, S.key);
9712
+ const J = rn(D, T.key);
9713
9713
  let z = o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${J}`).where("Collection_Path_String", "==", e.join("/"));
9714
9714
  y.forEach((b) => {
9715
9715
  z = z.where(...b);
@@ -9733,7 +9733,7 @@ const Ft = {
9733
9733
  if (v.length > 0) {
9734
9734
  for (const y of v)
9735
9735
  if (y.operations && y.type === "Record_Property") {
9736
- const _ = y.roles.find((S) => S.role === r.Role);
9736
+ const _ = y.roles.find((T) => T.role === r.Role);
9737
9737
  if (!_)
9738
9738
  throw new Error("PERMISSION_DENIED");
9739
9739
  W(_.values?.length);
@@ -9742,42 +9742,42 @@ const Ft = {
9742
9742
  h?.roles.includes(r.Role) && h.range && W(h.range.fields.length);
9743
9743
  const O = u.admin?.statusField;
9744
9744
  O && !h?.roles.includes(r.Role) && W(Math.max(O.active?.length || 0, O.archived?.length || 0));
9745
- const H = N === 0 ? 30 : Math.max(1, Math.floor(30 / N)), R = [];
9746
- v.filter((y) => y.type === "Record_Owner").forEach(() => R.push(["Created_By", "==", s])), v.filter((y) => y.type === "Record_User").forEach((y) => {
9745
+ const H = N === 0 ? 30 : Math.max(1, Math.floor(30 / N)), S = [];
9746
+ v.filter((y) => y.type === "Record_Owner").forEach(() => S.push(["Created_By", "==", s])), v.filter((y) => y.type === "Record_User").forEach((y) => {
9747
9747
  if ("collectionField" in y) {
9748
9748
  const _ = V(d, y.collectionField);
9749
- R.push([`${_.name}_Array`, "array-contains", r.Doc_ID]);
9749
+ S.push([`${_.name}_Array`, "array-contains", r.Doc_ID]);
9750
9750
  }
9751
9751
  }), v.filter((y) => y.type === "Record_Property").forEach((y) => {
9752
9752
  if ("propertyField" in y) {
9753
9753
  const _ = y.roles.find((U) => U.role === r.Role);
9754
9754
  if (!_)
9755
9755
  throw new Error("PERMISSION_DENIED");
9756
- const S = V(d, y.propertyField);
9757
- S.type === "Array" ? R.push([`${S.name}_Array`, "array-contains-any", _.values]) : R.push([S.name, "in", _.values]);
9756
+ const T = V(d, y.propertyField);
9757
+ T.type === "Array" ? S.push([`${T.name}_Array`, "array-contains-any", _.values]) : S.push([T.name, "in", _.values]);
9758
9758
  }
9759
9759
  });
9760
9760
  const p = [];
9761
9761
  w.filter((y) => y.type === "Individual").forEach((y) => {
9762
- const _ = g?.individualEntities, S = [];
9762
+ const _ = g?.individualEntities, T = [];
9763
9763
  if (_) {
9764
9764
  const U = y.singleQuery ? y.singleQuery : H;
9765
9765
  for (let F = 0; F < _.length; F += U) {
9766
9766
  const D = _.slice(F, F + U);
9767
- S.push(D);
9767
+ T.push(D);
9768
9768
  }
9769
9769
  if (!y.singleQuery)
9770
- S.forEach((F) => {
9771
- p.push(...k(R.concat([["id", "in", F]])));
9770
+ T.forEach((F) => {
9771
+ p.push(...k(S.concat([["id", "in", F]])));
9772
9772
  });
9773
9773
  else {
9774
9774
  if (_.length > U)
9775
9775
  throw new Error(`INPUT_ERROR: Individual entity restriction with singleQuery set to true must not have more than ${y.singleQuery} entities`);
9776
- R.push(["id", "in", _]);
9776
+ S.push(["id", "in", _]);
9777
9777
  }
9778
9778
  }
9779
9779
  }), x.filter((y) => y.parentFilter.type === "Individual").forEach((y) => {
9780
- const { parentFilter: _, parentRestriction: S } = y;
9780
+ const { parentFilter: _, parentRestriction: T } = y;
9781
9781
  if ("collectionField" in _) {
9782
9782
  const U = V(d, _.collectionField);
9783
9783
  if ("collection" in U) {
@@ -9786,19 +9786,19 @@ const Ft = {
9786
9786
  throw new Error("PERMISSION_DENIED");
9787
9787
  const D = F.individualEntities, M = [];
9788
9788
  if (D) {
9789
- const J = S.singleQuery ? S.singleQuery : H;
9789
+ const J = T.singleQuery ? T.singleQuery : H;
9790
9790
  for (let z = 0; z < D.length; z += J) {
9791
9791
  const b = D.slice(z, z + J);
9792
9792
  M.push(b);
9793
9793
  }
9794
- if (!S.singleQuery)
9794
+ if (!T.singleQuery)
9795
9795
  M.forEach((z) => {
9796
- p.push(...k(R.concat([[`${U.name}_Array`, "array-contains-any", z]])));
9796
+ p.push(...k(S.concat([[`${U.name}_Array`, "array-contains-any", z]])));
9797
9797
  });
9798
9798
  else {
9799
9799
  if (D.length > J)
9800
- throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${S.singleQuery} entities`);
9801
- R.push([`${U.name}_Array`, "array-contains-any", D]);
9800
+ throw new Error(`INPUT_ERROR: Individual entity parentFilter with singleQuery set to true must not have more than ${T.singleQuery} entities`);
9801
+ S.push([`${U.name}_Array`, "array-contains-any", D]);
9802
9802
  }
9803
9803
  }
9804
9804
  }
@@ -9809,27 +9809,27 @@ const Ft = {
9809
9809
  if ("collectionField" in y) {
9810
9810
  const _ = V(d, y.collectionField);
9811
9811
  if ("collection" in _) {
9812
- const S = g?.parentEntities, U = [];
9813
- if (S) {
9812
+ const T = g?.parentEntities, U = [];
9813
+ if (T) {
9814
9814
  const F = y.singleQuery ? y.singleQuery : H;
9815
- for (let D = 0; D < S.length; D += F) {
9816
- const M = S.slice(D, D + F);
9815
+ for (let D = 0; D < T.length; D += F) {
9816
+ const M = T.slice(D, D + F);
9817
9817
  U.push(M);
9818
9818
  }
9819
9819
  if (!y.singleQuery)
9820
9820
  U.forEach((D) => {
9821
- C.push(...k(R.concat([[`${_.name}_Array`, "array-contains-any", D]])));
9821
+ C.push(...k(S.concat([[`${_.name}_Array`, "array-contains-any", D]])));
9822
9822
  });
9823
9823
  else {
9824
- if (S && S.length > F)
9824
+ if (T && T.length > F)
9825
9825
  throw new Error(`INPUT_ERROR: Parent entity restriction with singleQuery set to true must not have more than ${y.singleQuery} entities`);
9826
- R.push([`${_.name}_Array`, "array-contains-any", S]);
9826
+ S.push([`${_.name}_Array`, "array-contains-any", T]);
9827
9827
  }
9828
9828
  }
9829
9829
  }
9830
9830
  }
9831
9831
  }), x.filter((y) => y.parentFilter.type === "Parent").forEach((y) => {
9832
- const { parentFilter: _, parentRestriction: S } = y;
9832
+ const { parentFilter: _, parentRestriction: T } = y;
9833
9833
  if ("collectionField" in _ && "parentCollectionField" in _) {
9834
9834
  const U = V(d, _.collectionField), F = V(d, _.parentCollectionField);
9835
9835
  if ("collection" in U && "collection" in F) {
@@ -9838,21 +9838,21 @@ const Ft = {
9838
9838
  throw new Error("PERMISSION_DENIED");
9839
9839
  const M = D.parentEntities, J = [];
9840
9840
  if (M) {
9841
- const z = S.singleQuery ? S.singleQuery : H;
9841
+ const z = T.singleQuery ? T.singleQuery : H;
9842
9842
  for (let b = 0; b < M.length; b += z) {
9843
9843
  const B = M.slice(b, b + z);
9844
9844
  J.push(B);
9845
9845
  }
9846
- if (!S.singleQuery)
9846
+ if (!T.singleQuery)
9847
9847
  J.forEach((b) => {
9848
- C.push(...k(R.concat([
9848
+ C.push(...k(S.concat([
9849
9849
  [`${F.name}_Array`, "array-contains-any", b]
9850
9850
  ])));
9851
9851
  });
9852
9852
  else {
9853
9853
  if (M && M.length > z)
9854
- throw new Error(`INPUT_ERROR: Profile_Parent entity parentFilter with singleQuery set to true must not have more than ${S.singleQuery} entities`);
9855
- R.push([
9854
+ throw new Error(`INPUT_ERROR: Profile_Parent entity parentFilter with singleQuery set to true must not have more than ${T.singleQuery} entities`);
9855
+ S.push([
9856
9856
  `${F.name}_Array`,
9857
9857
  "array-contains-any",
9858
9858
  M
@@ -9865,7 +9865,7 @@ const Ft = {
9865
9865
  const I = [];
9866
9866
  C.length === 0 && (w.filter((y) => y.type === "Parent_Property").forEach((y) => {
9867
9867
  if ("collectionField" in y && "propertyField" in y) {
9868
- const _ = V(d, y.collectionField), S = V(d, y.propertyField);
9868
+ const _ = V(d, y.collectionField), T = V(d, y.propertyField);
9869
9869
  if ("collection" in _) {
9870
9870
  const U = g?.parentPropertyEntities || {};
9871
9871
  Object.entries(U).forEach(([F, D]) => {
@@ -9876,9 +9876,9 @@ const Ft = {
9876
9876
  M.push(z);
9877
9877
  }
9878
9878
  M.forEach((J) => {
9879
- I.push(...k(R.concat([
9879
+ I.push(...k(S.concat([
9880
9880
  [`${_.name}_Array`, "array-contains-any", J],
9881
- [S.name, "==", F]
9881
+ [T.name, "==", F]
9882
9882
  ])));
9883
9883
  });
9884
9884
  }
@@ -9888,9 +9888,9 @@ const Ft = {
9888
9888
  }), x.filter((y) => y.parentFilter.type === "Parent_Property").forEach((y) => {
9889
9889
  const { parentFilter: _ } = y;
9890
9890
  if ("collectionField" in _ && "parentCollectionField" in _ && "parentPropertyField" in _) {
9891
- const S = V(d, _.collectionField), U = V(d, _.parentCollectionField), F = V(d, _.parentPropertyField);
9892
- if ("collection" in S && "collection" in U) {
9893
- const D = r.collections?.[S.collection];
9891
+ const T = V(d, _.collectionField), U = V(d, _.parentCollectionField), F = V(d, _.parentPropertyField);
9892
+ if ("collection" in T && "collection" in U) {
9893
+ const D = r.collections?.[T.collection];
9894
9894
  if (!D)
9895
9895
  throw new Error("PERMISSION_DENIED");
9896
9896
  const M = D.parentPropertyEntities || {};
@@ -9902,7 +9902,7 @@ const Ft = {
9902
9902
  b.push(K);
9903
9903
  }
9904
9904
  b.forEach((B) => {
9905
- I.push(...k(R.concat([
9905
+ I.push(...k(S.concat([
9906
9906
  [
9907
9907
  `${U.name}_Array`,
9908
9908
  "array-contains-any",
@@ -9917,7 +9917,7 @@ const Ft = {
9917
9917
  }
9918
9918
  }));
9919
9919
  const P = [...p, ...C, ...I];
9920
- return !w.length && !x.length ? k(R) : P;
9920
+ return !w.length && !x.length ? k(S) : P;
9921
9921
  } else
9922
9922
  throw new Error("PERMISSION_DENIED");
9923
9923
  else return [f];
@@ -9925,21 +9925,21 @@ const Ft = {
9925
9925
  const o = he(), a = e.at(-1);
9926
9926
  if (!a)
9927
9927
  throw new Error("EMPTY_PATH");
9928
- const l = s.collections[a], { labels: c } = l, d = $e(o, e, t);
9928
+ const l = s.collections[a], { labels: c } = l, d = Me(o, e, t);
9929
9929
  if (r) {
9930
9930
  const h = r.collections?.[c.collection];
9931
9931
  if (!r.Role)
9932
9932
  throw new Error("PERMISSION_DENIED");
9933
- const u = h && Ie("Read", h), f = Ei(l, s, r, i ?? {}), g = [], T = bi(r.Role, l, s);
9934
- if (!T)
9933
+ const u = h && Ne("Read", h), f = Ei(l, s, r, i ?? {}), g = [], R = bi(r.Role, l, s);
9934
+ if (!R)
9935
9935
  throw new Error("PERMISSION_DENIED");
9936
9936
  if (u) {
9937
- g.push(o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${T.key}`).doc(n));
9937
+ g.push(o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${R.key}`).doc(n));
9938
9938
  const m = _t(l);
9939
9939
  Object.entries(l.fieldAccessGroups || {}).forEach(([E, w]) => {
9940
9940
  if (!m[E]?.length || !Xn(w, c.collection, r, i ?? {}))
9941
9941
  return;
9942
- const x = rn(E, T.key);
9942
+ const x = rn(E, R.key);
9943
9943
  g.push(o.collection("tenants").doc(t).collection("system_fields").doc(c.collection).collection(`${c.collection}-${x}`).doc(n));
9944
9944
  });
9945
9945
  } else if (f)
@@ -9948,14 +9948,14 @@ const Ft = {
9948
9948
  return g;
9949
9949
  } else
9950
9950
  return [d.doc(n)];
9951
- }, os = async (t) => await Tt().getUser(t), Vo = async (t, e, n, s, r, i, o, a, l, c) => {
9951
+ }, os = async (t) => await Rt().getUser(t), Vo = async (t, e, n, s, r, i, o, a, l, c) => {
9952
9952
  const d = n.at(-2), h = vi(r.collections[d], r).map((g) => g.labels.collection);
9953
9953
  s.collections ? s.collections.forEach((g) => {
9954
9954
  if (!h.includes(g))
9955
9955
  throw new Error(`SCHEMA_ERROR: Collection ${g} not found in subcollections of ${d}`);
9956
9956
  }) : s.collections = h;
9957
9957
  const u = s.depth - 1, f = s.collections.map(async (g) => {
9958
- const T = await Uo([...n, g], {
9958
+ const R = await Uo([...n, g], {
9959
9959
  constraints: s.constraints,
9960
9960
  userId: a,
9961
9961
  pagination: s.limit,
@@ -9964,7 +9964,7 @@ const Ft = {
9964
9964
  }).catch((m) => {
9965
9965
  throw m.code === "permission-denied" && console.info(`PERMISSION_DENIED for subcollection ${g} for document at ${n.join("/")}`), m;
9966
9966
  });
9967
- e[g] = T.records, i && await Promise.all(
9967
+ e[g] = R.records, i && await Promise.all(
9968
9968
  // eslint-disable-next-line security/detect-object-injection
9969
9969
  e[g].map((m) => cr(t, m, [...n, g, m.id], i, r, void 0, a, l, c))
9970
9970
  ), u > 0 && await Promise.all(
@@ -9983,18 +9983,18 @@ const Ft = {
9983
9983
  if (!f)
9984
9984
  continue;
9985
9985
  const g = Object.keys(f);
9986
- for (const T of g) {
9987
- const m = f[T], E = Ke(m.Collection_Path, T, {
9986
+ for (const R of g) {
9987
+ const m = f[R], E = Xe(m.Collection_Path, R, {
9988
9988
  userId: o,
9989
9989
  providedTransaction: a,
9990
9990
  noEmbeddingFields: l
9991
9991
  }).then((w) => {
9992
- if (f[T] = w, d > 0)
9992
+ if (f[R] = w, d > 0)
9993
9993
  return cr(
9994
9994
  t,
9995
9995
  // eslint-disable-next-line security/detect-object-injection
9996
- f[T],
9997
- [...m.Collection_Path, T],
9996
+ f[R],
9997
+ [...m.Collection_Path, R],
9998
9998
  { depth: d },
9999
9999
  r,
10000
10000
  i,
@@ -10004,7 +10004,7 @@ const Ft = {
10004
10004
  );
10005
10005
  }).catch((w) => {
10006
10006
  if (w.message.includes("NOT_FOUND") || w.code === "permission-denied")
10007
- delete f[T];
10007
+ delete f[R];
10008
10008
  else
10009
10009
  throw w;
10010
10010
  });
@@ -10022,28 +10022,28 @@ const Ft = {
10022
10022
  if (typeof c != "number" || !Number.isFinite(c) || !Number.isInteger(c) || c < 1)
10023
10023
  throw new Error("INPUT_ERROR: Pagination number must be a positive finite integer");
10024
10024
  }
10025
- const n = e?.constraints, s = nt(), r = he();
10025
+ const n = e?.constraints, s = st(), r = he();
10026
10026
  let i, o, a;
10027
10027
  const l = async (c) => {
10028
10028
  const [d, h, u, f] = await Promise.all([
10029
10029
  e?.userId ? c.get(r.collection("tenants").doc(s).collection("system_user_permissions").doc(e.userId)) : Promise.resolve({}),
10030
10030
  c.get(r.collection("system_deployment").doc("maintenance_mode")),
10031
- tt(!0),
10031
+ nt(!0),
10032
10032
  e?.userId ? os(e.userId) : Promise.resolve(void 0)
10033
10033
  ]);
10034
10034
  if (!h.exists)
10035
10035
  throw new Error("MAINTENANCE_MODE");
10036
10036
  if (h.data().active)
10037
10037
  throw new Error("MAINTENANCE_MODE");
10038
- const T = u;
10038
+ const R = u;
10039
10039
  let m;
10040
10040
  const E = Gt(), w = t.at(-1);
10041
10041
  if (!w)
10042
10042
  throw new Error("EMPTY_PATH");
10043
- const x = Object.keys(T.collections).includes(w), k = E.disabledCollections?.includes(w);
10043
+ const x = Object.keys(R.collections).includes(w), k = E.disabledCollections?.includes(w);
10044
10044
  if (!x || k)
10045
10045
  throw new Error("COLLECTION_NOT_FOUND");
10046
- const v = T.collections[w], { labels: N } = v, W = mt(N.collection, T);
10046
+ const v = R.collections[w], { labels: N } = v, W = mt(N.collection, R);
10047
10047
  if (e?.userId) {
10048
10048
  if (!d?.exists)
10049
10049
  throw new Error("PERMISSION_DENIED");
@@ -10055,7 +10055,7 @@ const Ft = {
10055
10055
  let O = tu(
10056
10056
  s,
10057
10057
  t,
10058
- T,
10058
+ R,
10059
10059
  e?.userId,
10060
10060
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10061
10061
  m,
@@ -10063,8 +10063,8 @@ const Ft = {
10063
10063
  );
10064
10064
  if (O.length === 0)
10065
10065
  return { cursor: {}, pages: 0, records: [] };
10066
- if (n && (O = O.map((y) => (n.forEach(([_, S, U]) => {
10067
- y = y.where(_, S, U);
10066
+ if (n && (O = O.map((y) => (n.forEach(([_, T, U]) => {
10067
+ y = y.where(_, T, U);
10068
10068
  }), y))), o = e?.pagination?.startAfter || e?.pagination?.endBefore || {
10069
10069
  first: /* @__PURE__ */ new Map(),
10070
10070
  last: /* @__PURE__ */ new Map()
@@ -10073,11 +10073,11 @@ const Ft = {
10073
10073
  throw new Error("INPUT_ERROR: startAfter and endBefore cannot be provided together");
10074
10074
  const y = e.pagination.startAfter || e.pagination.endBefore;
10075
10075
  if (e?.userId) {
10076
- const _ = ma(m.Role, v, T);
10076
+ const _ = ma(m.Role, v, R);
10077
10077
  if (y && _ !== !0)
10078
10078
  throw new Error("INPUT_ERROR: Pagination is not allowed when using " + _);
10079
10079
  }
10080
- e.pagination.orderByField && e.pagination.orderByDirection ? !e.pagination.startAfter && !e.pagination.endBefore ? O = O.map((_) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).limit(e.pagination.number)) : e.pagination.startAfter ? O = O.map((_, S) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).startAfter(o.last.get(S)).limit(e.pagination.number)) : O = O.map((_, S) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).endBefore(o.first.get(S)).limitToLast(e.pagination.number)) : !e.pagination.startAfter && !e.pagination.endBefore ? O = O.map((_) => _.limit(e.pagination.number)) : e.pagination.startAfter ? O = O.map((_, S) => _.startAfter(o.last.get(S)).limit(e.pagination.number)) : O = O.map((_, S) => _.endBefore(o.first.get(S)).limitToLast(e.pagination.number));
10080
+ e.pagination.orderByField && e.pagination.orderByDirection ? !e.pagination.startAfter && !e.pagination.endBefore ? O = O.map((_) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).limit(e.pagination.number)) : e.pagination.startAfter ? O = O.map((_, T) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).startAfter(o.last.get(T)).limit(e.pagination.number)) : O = O.map((_, T) => _.orderBy(e.pagination.orderByField, e.pagination.orderByDirection).endBefore(o.first.get(T)).limitToLast(e.pagination.number)) : !e.pagination.startAfter && !e.pagination.endBefore ? O = O.map((_) => _.limit(e.pagination.number)) : e.pagination.startAfter ? O = O.map((_, T) => _.startAfter(o.last.get(T)).limit(e.pagination.number)) : O = O.map((_, T) => _.endBefore(o.first.get(T)).limitToLast(e.pagination.number));
10081
10081
  }
10082
10082
  const H = {};
10083
10083
  await ue("preOperation", E, W, { operation: "read", context: H }), await ue("preRead", E, W, { context: H, refs: O, multiple: !0, listener: !1 }), a = /* @__PURE__ */ new Map();
@@ -10085,9 +10085,9 @@ const Ft = {
10085
10085
  for (const y of I) {
10086
10086
  for (const _ of y.docs) {
10087
10087
  a.has(_.id) || a.set(_.id, {});
10088
- const S = _.data(), U = a.get(_.id);
10088
+ const T = _.data(), U = a.get(_.id);
10089
10089
  U.id ||= _.id;
10090
- const F = { ...U, ...S };
10090
+ const F = { ...U, ...T };
10091
10091
  delete F.Collection_Path_String, a.set(_.id, F);
10092
10092
  }
10093
10093
  o.first.set(I.indexOf(y), y.docs[0]), o.last.set(I.indexOf(y), y.docs.at(-1) || y.docs[0]);
@@ -10095,20 +10095,20 @@ const Ft = {
10095
10095
  if (e?.pagination) {
10096
10096
  let y = O[0];
10097
10097
  n && (y = n.reduce((F, [D, M, J]) => F.where(D, M, J), y)), e.pagination.orderByField && e.pagination.orderByDirection && (y = y.orderBy(e.pagination.orderByField, e.pagination.orderByDirection));
10098
- const S = (await y.count().get()).data().count, U = e.pagination.number;
10099
- i = U > 0 ? Math.ceil(S / U) : 0;
10098
+ const T = (await y.count().get()).data().count, U = e.pagination.number;
10099
+ i = U > 0 ? Math.ceil(T / U) : 0;
10100
10100
  }
10101
10101
  let P;
10102
10102
  e?.noComputedFields || (P = await ae(W.admin?.retriever));
10103
10103
  for (const y of a.values()) {
10104
- const _ = [], S = [...y.Collection_Path, y.id];
10104
+ const _ = [], T = [...y.Collection_Path, y.id];
10105
10105
  e?.subcollections && _.push(Vo(
10106
10106
  s,
10107
10107
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10108
10108
  a.get(y.id),
10109
- S,
10110
- ye(e.subcollections),
10111
10109
  T,
10110
+ ye(e.subcollections),
10111
+ R,
10112
10112
  ye(e?.relations),
10113
10113
  void 0,
10114
10114
  e.userId,
@@ -10126,9 +10126,9 @@ const Ft = {
10126
10126
  s,
10127
10127
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10128
10128
  a.get(y.id),
10129
- S,
10130
- ye(e.relations),
10131
10129
  T,
10130
+ ye(e.relations),
10131
+ R,
10132
10132
  void 0,
10133
10133
  e.userId,
10134
10134
  e.transactional ? c : void 0,
@@ -10137,7 +10137,7 @@ const Ft = {
10137
10137
  const U = [];
10138
10138
  for (const M of v.fields) {
10139
10139
  if (M.type === "Computed" && !e?.noComputedFields) {
10140
- const J = Ue(M, W);
10140
+ const J = We(M, W);
10141
10141
  if (!J.formula)
10142
10142
  continue;
10143
10143
  U.push(ae(J.formula, [y, P]).then((z) => {
@@ -10153,7 +10153,7 @@ const Ft = {
10153
10153
  continue;
10154
10154
  }
10155
10155
  for (const z of v.fields) {
10156
- const b = !z.access || Be(z, m, v, f?.customClaims ?? {}), B = Ue(z, W), K = B?.custom?.serverAccess?.read !== void 0 ? await ae(B.custom.serverAccess.read, [M, y]) : !0;
10156
+ const b = !z.access || Be(z, m, v, f?.customClaims ?? {}), B = We(z, W), K = B?.custom?.serverAccess?.read !== void 0 ? await ae(B.custom.serverAccess.read, [M, y]) : !0;
10157
10157
  (!b || !K) && (ee(z) ? (delete a.get(y.id)[z.name], delete a.get(y.id)[`${z.name}_Array`], delete a.get(y.id)[`${z.name}_Single`]) : delete a.get(y.id)[z.name]);
10158
10158
  }
10159
10159
  }
@@ -10168,7 +10168,7 @@ const Ft = {
10168
10168
  e?.userId && await fa(
10169
10169
  Array.from(a.values()),
10170
10170
  v,
10171
- T,
10171
+ R,
10172
10172
  e.userId,
10173
10173
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10174
10174
  m
@@ -10210,8 +10210,8 @@ const Ft = {
10210
10210
  const f = n[u.name];
10211
10211
  if (!f)
10212
10212
  continue;
10213
- for (const [g, T] of Object.entries(f)) {
10214
- const m = Ke(T.Collection_Path, g, {
10213
+ for (const [g, R] of Object.entries(f)) {
10214
+ const m = Xe(R.Collection_Path, g, {
10215
10215
  userId: o,
10216
10216
  providedTransaction: e,
10217
10217
  noComputedFields: a,
@@ -10223,7 +10223,7 @@ const Ft = {
10223
10223
  e,
10224
10224
  // eslint-disable-next-line security/detect-object-injection
10225
10225
  f[g],
10226
- [...T.Collection_Path, g],
10226
+ [...R.Collection_Path, g],
10227
10227
  r,
10228
10228
  { depth: d },
10229
10229
  o,
@@ -10240,18 +10240,18 @@ const Ft = {
10240
10240
  }
10241
10241
  }
10242
10242
  await Promise.all(h);
10243
- }, Ke = async (t, e, n) => {
10243
+ }, Xe = async (t, e, n) => {
10244
10244
  if (n?.subcollections?.depth && n.subcollections.depth > 10)
10245
10245
  throw new Error("INPUT_ERROR: Subcollections depth cannot exceed 10");
10246
10246
  if (n?.relations?.depth && n.relations.depth > 10)
10247
10247
  throw new Error("INPUT_ERROR: Relations depth cannot exceed 10");
10248
- const s = nt(), r = he();
10248
+ const s = st(), r = he();
10249
10249
  let i;
10250
10250
  const o = async (a) => {
10251
10251
  const [l, c, d, h] = await Promise.all([
10252
10252
  n?.userId ? a.get(r.collection("tenants").doc(s).collection("system_user_permissions").doc(n.userId)) : Promise.resolve({}),
10253
10253
  a.get(r.collection("system_deployment").doc("maintenance_mode")),
10254
- tt(!0),
10254
+ nt(!0),
10255
10255
  n?.userId ? os(n.userId) : Promise.resolve(void 0)
10256
10256
  ]);
10257
10257
  if (!c.exists)
@@ -10260,10 +10260,10 @@ const Ft = {
10260
10260
  throw new Error("MAINTENANCE_MODE");
10261
10261
  const f = d;
10262
10262
  let g;
10263
- const T = Gt(), m = t.at(-1);
10263
+ const R = Gt(), m = t.at(-1);
10264
10264
  if (!m)
10265
10265
  throw new Error("EMPTY_PATH");
10266
- const E = Object.keys(f.collections).includes(m), w = T.disabledCollections?.includes(m);
10266
+ const E = Object.keys(f.collections).includes(m), w = R.disabledCollections?.includes(m);
10267
10267
  if (!E || w)
10268
10268
  throw new Error("COLLECTION_NOT_FOUND");
10269
10269
  const x = f.collections[m], { labels: k } = x, v = mt(k.collection, f);
@@ -10278,51 +10278,51 @@ const Ft = {
10278
10278
  if (N = g.collections?.[k.collection], !N)
10279
10279
  throw new Error("PERMISSION_DENIED");
10280
10280
  }
10281
- if (n?.userId && (!N || !Ie("Read", N)))
10281
+ if (n?.userId && (!N || !Ne("Read", N)))
10282
10282
  throw new Error("PERMISSION_DENIED");
10283
10283
  const W = Lo(s, t, e, f, g, h?.customClaims ?? {});
10284
10284
  if (W.length === 0)
10285
10285
  throw new Error("PERMISSION_DENIED");
10286
10286
  const O = {};
10287
- await ue("preOperation", T, v, { operation: "read", recordId: e, context: O }), await ue("preRead", T, v, { context: O, refs: W, multiple: !1, listener: !1 }), i = {};
10288
- const p = W.map((S) => a.get(S)), C = await Promise.all(p);
10289
- for (const S of C)
10290
- if (S.exists) {
10291
- const U = S.data();
10292
- i.id ||= S.id, i = { ...i, ...U }, delete i.Collection_Path_String;
10287
+ await ue("preOperation", R, v, { operation: "read", recordId: e, context: O }), await ue("preRead", R, v, { context: O, refs: W, multiple: !1, listener: !1 }), i = {};
10288
+ const p = W.map((T) => a.get(T)), C = await Promise.all(p);
10289
+ for (const T of C)
10290
+ if (T.exists) {
10291
+ const U = T.data();
10292
+ i.id ||= T.id, i = { ...i, ...U }, delete i.Collection_Path_String;
10293
10293
  } else
10294
10294
  throw new Error(`NOT_FOUND: Document with ID ${e} does not exist at location ${t?.join("/") || k.collection}`);
10295
10295
  const I = [], P = t ? [...t, e] : [k.collection, e];
10296
- if (n?.subcollections && I.push(Wo(s, a, i, P, n.subcollections, f, void 0, n.userId)), n?.relations && (n.relations.fields && (n.relations.fields = n.relations.fields.map((S) => {
10297
- if (typeof S == "string") {
10298
- const U = x.fields.find((F) => F.name === S);
10296
+ if (n?.subcollections && I.push(Wo(s, a, i, P, n.subcollections, f, void 0, n.userId)), n?.relations && (n.relations.fields && (n.relations.fields = n.relations.fields.map((T) => {
10297
+ if (typeof T == "string") {
10298
+ const U = x.fields.find((F) => F.name === T);
10299
10299
  if (U)
10300
10300
  return U;
10301
- throw new Error(`SCHEMA_ERROR: Field ${S} not found in collection ${m}`);
10301
+ throw new Error(`SCHEMA_ERROR: Field ${T} not found in collection ${m}`);
10302
10302
  }
10303
- return S;
10303
+ return T;
10304
10304
  })), I.push(jo(s, a, i, P, f, n.relations, n.userId, n.noComputedFields, n.noEmbeddingFields))), await Promise.all(I), !n?.noComputedFields) {
10305
- for (const S of x.fields)
10306
- if (S.type === "Computed") {
10307
- const U = Ue(S, v);
10305
+ for (const T of x.fields)
10306
+ if (T.type === "Computed") {
10307
+ const U = We(T, v);
10308
10308
  if (!U.formula)
10309
10309
  continue;
10310
- i[S.name] = await U.formula(i);
10310
+ i[T.name] = await U.formula(i);
10311
10311
  }
10312
10312
  }
10313
10313
  if (n?.noEmbeddingFields)
10314
- for (const S of x.fields)
10315
- S.type === "Embedding" && delete i[S.name];
10314
+ for (const T of x.fields)
10315
+ T.type === "Embedding" && delete i[T.name];
10316
10316
  if (n?.userId && g?.Role) {
10317
- const S = g.Role;
10318
- if (!(v.custom?.serverAccess?.read !== void 0 ? await ae(v.custom?.serverAccess?.read, [S, i]) : !0))
10317
+ const T = g.Role;
10318
+ if (!(v.custom?.serverAccess?.read !== void 0 ? await ae(v.custom?.serverAccess?.read, [T, i]) : !0))
10319
10319
  throw new Error("PERMISSION_DENIED");
10320
10320
  for (const F of x.fields) {
10321
- const D = !F.access || Be(F, g, x, h?.customClaims ?? {}), M = Ue(F, v), J = M?.custom?.serverAccess?.read !== void 0 ? await ae(M.custom.serverAccess.read, [S, i]) : !0;
10321
+ const D = !F.access || Be(F, g, x, h?.customClaims ?? {}), M = We(F, v), J = M?.custom?.serverAccess?.read !== void 0 ? await ae(M.custom.serverAccess.read, [T, i]) : !0;
10322
10322
  (!D || !J) && (ee(F) ? (delete i[F.name], delete i[`${F.name}_Array`], delete i[`${F.name}_Single`]) : delete i[F.name]);
10323
10323
  }
10324
10324
  }
10325
- await ue("postOperation", T, v, { operation: "read", data: i, recordId: e, context: O }), await ue("postRead", T, v, { context: O, refs: W, record: i, listener: !1 }), n?.userId && await da(i, x, f, n.userId, g);
10325
+ await ue("postOperation", R, v, { operation: "read", data: i, recordId: e, context: O }), await ue("postRead", R, v, { context: O, refs: W, record: i, listener: !1 }), n?.userId && await da(i, x, f, n.userId, g);
10326
10326
  };
10327
10327
  return n?.providedTransaction ? await o(n.providedTransaction) : await r.runTransaction(async (a) => {
10328
10328
  await o(a);
@@ -10347,11 +10347,11 @@ const Ft = {
10347
10347
  f.TTL = ht.fromDate(w);
10348
10348
  }
10349
10349
  const g = ye(n);
10350
- at(g), t !== "delete" && (f.data.data = ye(g)), t === "update" && (f.data.originalRecord = ye(l)), t !== "delete" && ["started", "written"].includes(e) && (delete f.data.data.Saved_At, delete f.data.data.Last_Save_At), e === "failed" && (f.data.error = JSON.stringify(a));
10351
- const T = $e(d, r, s), m = n.Last_Write_At;
10352
- await T.doc(i).collection("system_write_log").doc(`${n.Last_Write_By}-${m.valueOf()}`).set(f);
10350
+ Qe(g), t !== "delete" && (f.data.data = ye(g)), t === "update" && (f.data.originalRecord = ye(l)), t !== "delete" && ["started", "written"].includes(e) && (delete f.data.data.Saved_At, delete f.data.data.Last_Save_At), e === "failed" && (f.data.error = JSON.stringify(a));
10351
+ const R = Me(d, r, s), m = n.Last_Write_At;
10352
+ await R.doc(i).collection("system_write_log").doc(`${n.Last_Write_By}-${m.valueOf()}`).set(f);
10353
10353
  }, _n = async (t) => {
10354
- const e = nt(), n = Tt(), s = he(), r = [];
10354
+ const e = st(), n = Rt(), s = he(), r = [];
10355
10355
  if (await Promise.all([
10356
10356
  (async () => {
10357
10357
  try {
@@ -10380,11 +10380,11 @@ ${i}`);
10380
10380
  t = h;
10381
10381
  else
10382
10382
  throw new Error("Admin email not set");
10383
- const u = Os(t), f = Kc(e), g = n ? li(n) : void 0, T = s ? li(s) : void 0, m = r ? Os(r) : void 0, E = i ? Os(i) : void 0, w = o ? Jn(o) : void 0, x = l ? Jn(l) : void 0, k = Array.isArray(u) ? u : [u];
10383
+ const u = Os(t), f = Kc(e), g = n ? li(n) : void 0, R = s ? li(s) : void 0, m = r ? Os(r) : void 0, E = i ? Os(i) : void 0, w = o ? Jn(o) : void 0, x = l ? Jn(l) : void 0, k = Array.isArray(u) ? u : [u];
10384
10384
  if (k.length === 0 || k.length === 1 && !k[0])
10385
10385
  throw new Error("No valid email addresses provided");
10386
10386
  const v = { to: u, message: { subject: f } };
10387
- if (g && (v.message.text = g), T && (v.message.html = T), m) {
10387
+ if (g && (v.message.text = g), R && (v.message.html = R), m) {
10388
10388
  const N = Array.isArray(m) ? m : [m];
10389
10389
  N.length > 0 && N[0] && (v.cc = m);
10390
10390
  }
@@ -10406,7 +10406,14 @@ function su(t) {
10406
10406
  return e;
10407
10407
  }
10408
10408
  const qo = async (t, e, n, s, r, i, o) => {
10409
- const a = Tt(), l = he(), { labels: c, fields: d } = s, h = "USER_ERROR", u = async (m, E) => {
10409
+ const a = Rt(), l = he(), { labels: c, fields: d } = s;
10410
+ if (ke(r.Email) || !r.Email)
10411
+ throw new Error("VALIDATION_ERROR: Email field is required");
10412
+ if (ke(r.Role) || !r.Role)
10413
+ throw new Error("VALIDATION_ERROR: Role field is required");
10414
+ if (r.Enabled === void 0 || r.Enabled === null || ke(r.Enabled))
10415
+ throw new Error("VALIDATION_ERROR: Enabled field is required");
10416
+ const h = "USER_ERROR", u = async (m, E) => {
10410
10417
  try {
10411
10418
  await _n(m);
10412
10419
  } catch {
@@ -10428,7 +10435,7 @@ const qo = async (t, e, n, s, r, i, o) => {
10428
10435
  }
10429
10436
  const g = {};
10430
10437
  for (const m of d)
10431
- m.saveToAuthToken && !ur(m.name) && r[m.name] !== void 0 && m.type !== "Timestamp" && m.type !== "Computed" && m.type !== "Embedding" && (De(r[m.name]) ? g[m.name] = null : g[m.name] = r[m.name]);
10438
+ m.saveToAuthToken && !ur(m.name) && r[m.name] !== void 0 && m.type !== "Timestamp" && m.type !== "Computed" && m.type !== "Embedding" && (ke(r[m.name]) ? g[m.name] = null : g[m.name] = r[m.name]);
10432
10439
  try {
10433
10440
  await a.setCustomUserClaims(f.uid, {
10434
10441
  ...g,
@@ -10451,8 +10458,8 @@ const qo = async (t, e, n, s, r, i, o) => {
10451
10458
  } catch {
10452
10459
  throw await u(r, h), new Error(h);
10453
10460
  }
10454
- const T = n.auth.enableMultiFactorAuth;
10455
- if (T === !0 || typeof T == "object" && T.includes(r.Role)) {
10461
+ const R = n.auth.enableMultiFactorAuth;
10462
+ if (R === !0 || typeof R == "object" && R.includes(r.Role)) {
10456
10463
  let m;
10457
10464
  try {
10458
10465
  m = await a.generateEmailVerificationLink(r.Email);
@@ -10482,7 +10489,7 @@ const qo = async (t, e, n, s, r, i, o) => {
10482
10489
  const r = t.at(-2);
10483
10490
  if (!r)
10484
10491
  throw new Error("PERMISSION_DENIED");
10485
- const i = [...t].slice(0, -2), o = await Ke(i, r).catch(() => {
10492
+ const i = [...t].slice(0, -2), o = await Xe(i, r).catch(() => {
10486
10493
  throw new Error("PERMISSION_DENIED");
10487
10494
  }), a = o.Collection_Path;
10488
10495
  if (a.push(o.id), a.push(n.collection), !Je(t, a))
@@ -10514,7 +10521,7 @@ const qo = async (t, e, n, s, r, i, o) => {
10514
10521
  if (e[r] !== void 0) {
10515
10522
  s[r] = e[r];
10516
10523
  const i = V(t.fields, r);
10517
- St(t, [i]).size === 1 && (s[`${r}_Lowercase`] = e[`${r}_Lowercase`]);
10524
+ Tt(t, [i]).size === 1 && (s[`${r}_Lowercase`] = e[`${r}_Lowercase`]);
10518
10525
  }
10519
10526
  }), s;
10520
10527
  }
@@ -10528,18 +10535,18 @@ const qo = async (t, e, n, s, r, i, o) => {
10528
10535
  const [d, h] = c[0];
10529
10536
  if (!h)
10530
10537
  throw new Error(`VALIDATION_ERROR: Relation ${n.name} is required`);
10531
- const u = $e(l, h.Collection_Path, t);
10538
+ const u = Me(l, h.Collection_Path, t);
10532
10539
  if (i.size++, !o && i.size > 500)
10533
10540
  throw new Error("VALIDATION ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.");
10534
10541
  const f = await r.get(u.doc(d));
10535
10542
  if (!f.exists)
10536
10543
  throw new Error(`VALIDATION_ERROR: Record ${d} not found in collection ${n.collection}`);
10537
- const g = f.data(), T = V(a, n.enforceHierarchy.field), m = n.enforceHierarchy;
10538
- if (!g[m.recordLinkField] || !s[T.name] || !Object.keys(s[T.name]).every((E) => Object.keys(g[m.recordLinkField]).includes(E)))
10544
+ const g = f.data(), R = V(a, n.enforceHierarchy.field), m = n.enforceHierarchy;
10545
+ if (!g[m.recordLinkField] || !s[R.name] || !Object.keys(s[R.name]).every((E) => Object.keys(g[m.recordLinkField]).includes(E)))
10539
10546
  throw new Error("VALIDATION_ERROR: Invalid relation hierarchy");
10540
10547
  }, In = async (t, e, n) => {
10541
10548
  delete e[t.name][n], e[`${t.name}_Array`] = e[`${t.name}_Array`]?.filter((s) => s !== n), delete e[`${t.name}_Single`];
10542
- }, Ts = async (t, e, n, s, r) => {
10549
+ }, Rs = async (t, e, n, s, r) => {
10543
10550
  e[t.name] ||= {}, e[t.name][s] = n, e[`${t.name}_Array`] ||= [], e[`${t.name}_Array`].push(s), r && (e[`${t.name}_Single`] = { id: s, ...n });
10544
10551
  }, iu = (t, e, n, s, r, i) => {
10545
10552
  const o = [], a = [];
@@ -10547,7 +10554,7 @@ const qo = async (t, e, n, s, r, i, o) => {
10547
10554
  ee(l) && l.twoWay && l.collection === n && ((t === "Create" || !i?.[l.name]?.[e]) && r[l.name]?.[e] && o.push(l), t === "Update" && i?.[l.name]?.[e] && !r[l.name]?.[e] && a.push(l));
10548
10555
  return { addedFields: o, removedFields: a };
10549
10556
  }, Ho = async (t, e, n, s, r, i, o, a, l, c, d, h, u) => {
10550
- const { fields: f } = i, g = he(), T = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
10557
+ const { fields: f } = i, g = he(), R = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
10551
10558
  for (const w of f)
10552
10559
  ee(w) && ["OneToOne", "OneToMany"].includes(w.type) && w.enforceHierarchy && s[w.name] && (t === "Create" || t === "Update" && !Je(h?.[w.name], s[w.name])) && await ui(e, i, w, s, a, l);
10553
10560
  for (const w of f)
@@ -10558,13 +10565,13 @@ const qo = async (t, e, n, s, r, i, o) => {
10558
10565
  for (const W of N) {
10559
10566
  const [O, H] = W;
10560
10567
  if (t === "Create" || !h?.[w.name]?.[O]) {
10561
- let R;
10568
+ let S;
10562
10569
  const p = E.get(w.collection)?.[O];
10563
10570
  if (p)
10564
- R = p;
10571
+ S = p;
10565
10572
  else {
10566
10573
  l.size++, l && l.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${l.size} operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of two way updates, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.`));
10567
- const I = $e(g, H.Collection_Path, e), P = await a.get(I.doc(O));
10574
+ const I = Me(g, H.Collection_Path, e), P = await a.get(I.doc(O));
10568
10575
  if (!P.exists) {
10569
10576
  In(w, r, O);
10570
10577
  continue;
@@ -10573,18 +10580,18 @@ const qo = async (t, e, n, s, r, i, o) => {
10573
10580
  m.set(w.collection, {
10574
10581
  ...m.get(w.collection) || {},
10575
10582
  [O]: y
10576
- }), R = ye({ ...y, ...Mn(s) });
10583
+ }), S = ye({ ...y, ...Mn(s) });
10577
10584
  }
10578
10585
  const C = {
10579
- ...R[k.name],
10586
+ ...S[k.name],
10580
10587
  [n]: {
10581
10588
  Collection_Path: s.Collection_Path,
10582
10589
  ...ru(i, s, k)
10583
10590
  }
10584
10591
  };
10585
- R[k.name] = C, R[`${k.name}_Array`] ||= [], R[`${k.name}_Array`].push(n), v.size === 1 && (R[`${k.name}_Single`] = { id: n, ...C }), E.set(w.collection, {
10592
+ S[k.name] = C, S[`${k.name}_Array`] ||= [], S[`${k.name}_Array`].push(n), v.size === 1 && (S[`${k.name}_Single`] = { id: n, ...C }), E.set(w.collection, {
10586
10593
  ...E.get(w.collection) || {},
10587
- [O]: R
10594
+ [O]: S
10588
10595
  });
10589
10596
  }
10590
10597
  }
@@ -10594,26 +10601,26 @@ const qo = async (t, e, n, s, r, i, o) => {
10594
10601
  for (const W of N) {
10595
10602
  const [O, H] = W;
10596
10603
  if (!s[w.name]?.[O]) {
10597
- let R;
10604
+ let S;
10598
10605
  const p = E.get(w.collection)?.[O];
10599
10606
  if (p)
10600
- R = p;
10607
+ S = p;
10601
10608
  else {
10602
10609
  l.size++, l && l.size > 500 && console.error(new Error(`VALIDATION_ERROR: ${l.size} operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of two way updates, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.`));
10603
- const C = $e(g, H.Collection_Path, e), I = await a.get(C.doc(O));
10610
+ const C = Me(g, H.Collection_Path, e), I = await a.get(C.doc(O));
10604
10611
  if (!I.exists) {
10605
- T.set(w.name, [...T.get(w.name) || [], O]);
10612
+ R.set(w.name, [...R.get(w.name) || [], O]);
10606
10613
  continue;
10607
10614
  }
10608
10615
  const P = I.data();
10609
10616
  m.set(w.collection, {
10610
10617
  ...m.get(w.collection) || {},
10611
10618
  [O]: P
10612
- }), R = ye({ ...P, ...Mn(s) });
10619
+ }), S = ye({ ...P, ...Mn(s) });
10613
10620
  }
10614
- R[k.name][n] && delete R[k.name][n], Array.isArray(R[`${k.name}_Array`]) && (R[`${k.name}_Array`] = R[`${k.name}_Array`].filter((C) => C !== n)), v.size === 1 && delete R[`${k.name}_Single`], E.set(w.collection, {
10621
+ S[k.name][n] && delete S[k.name][n], Array.isArray(S[`${k.name}_Array`]) && (S[`${k.name}_Array`] = S[`${k.name}_Array`].filter((C) => C !== n)), v.size === 1 && delete S[`${k.name}_Single`], E.set(w.collection, {
10615
10622
  ...E.get(w.collection) || {},
10616
- [O]: R
10623
+ [O]: S
10617
10624
  });
10618
10625
  }
10619
10626
  }
@@ -10624,21 +10631,21 @@ const qo = async (t, e, n, s, r, i, o) => {
10624
10631
  for (const [N, W] of Object.entries(x)) {
10625
10632
  const { addedFields: O, removedFields: H } = iu(t, N, w, i, s, h);
10626
10633
  if (c && d) {
10627
- for (const R of O) {
10628
- const p = V(k.fields, R.twoWay);
10634
+ for (const S of O) {
10635
+ const p = V(k.fields, S.twoWay);
10629
10636
  if (!mr(k, p, d, u ?? {})) {
10630
- In(R, r, N);
10637
+ In(S, r, N);
10631
10638
  continue;
10632
10639
  }
10633
10640
  }
10634
- for (const R of H) {
10635
- const p = V(k.fields, R.twoWay), C = Et(k, [p]);
10641
+ for (const S of H) {
10642
+ const p = V(k.fields, S.twoWay), C = Et(k, [p]);
10636
10643
  if (!mr(k, p, d, u ?? {})) {
10637
- Ts(
10638
- R,
10644
+ Rs(
10645
+ S,
10639
10646
  r,
10640
10647
  // eslint-disable-next-line security/detect-object-injection
10641
- h?.[R.name]?.[N],
10648
+ h?.[S.name]?.[N],
10642
10649
  N,
10643
10650
  C.size === 1
10644
10651
  );
@@ -10654,30 +10661,30 @@ const qo = async (t, e, n, s, r, i, o) => {
10654
10661
  // eslint-disable-next-line security/detect-object-injection
10655
10662
  m.get(w)?.[N]
10656
10663
  )) {
10657
- for (const R of O)
10658
- In(R, r, N);
10659
- for (const R of H) {
10660
- const p = V(k.fields, R.twoWay), C = Et(k, [p]);
10661
- Ts(
10662
- R,
10664
+ for (const S of O)
10665
+ In(S, r, N);
10666
+ for (const S of H) {
10667
+ const p = V(k.fields, S.twoWay), C = Et(k, [p]);
10668
+ Rs(
10669
+ S,
10663
10670
  r,
10664
10671
  // eslint-disable-next-line security/detect-object-injection
10665
- h?.[R.name]?.[N],
10672
+ h?.[S.name]?.[N],
10666
10673
  N,
10667
10674
  C.size === 1
10668
10675
  );
10669
10676
  }
10670
10677
  }
10671
10678
  if (!dt("Update", k, o, c, d, W)) {
10672
- for (const R of O)
10673
- In(R, r, N);
10674
- for (const R of H) {
10675
- const p = V(k.fields, R.twoWay), C = Et(k, [p]);
10676
- Ts(
10677
- R,
10679
+ for (const S of O)
10680
+ In(S, r, N);
10681
+ for (const S of H) {
10682
+ const p = V(k.fields, S.twoWay), C = Et(k, [p]);
10683
+ Rs(
10684
+ S,
10678
10685
  r,
10679
10686
  // eslint-disable-next-line security/detect-object-injection
10680
- h?.[R.name]?.[N],
10687
+ h?.[S.name]?.[N],
10681
10688
  N,
10682
10689
  C.size === 1
10683
10690
  );
@@ -10686,16 +10693,16 @@ const qo = async (t, e, n, s, r, i, o) => {
10686
10693
  }
10687
10694
  try {
10688
10695
  await fn("update", W, k, v, { operation: "update", data: W, context: {}, originalRecord: W }, o);
10689
- } catch (R) {
10690
- throw new Error(`VALIDATION_ERROR: Two way relation update would invalidate record ${N} in ${w}: ${R.message}`);
10696
+ } catch (S) {
10697
+ throw new Error(`VALIDATION_ERROR: Two way relation update would invalidate record ${N} in ${w}: ${S.message}`);
10691
10698
  }
10692
- for (const R of O) {
10693
- const p = V(k.fields, R.twoWay);
10699
+ for (const S of O) {
10700
+ const p = V(k.fields, S.twoWay);
10694
10701
  ["OneToOne", "OneToMany"].includes(p.type) && ee(p) && p.enforceHierarchy && await ui(e, k, p, W, a, l, !0);
10695
10702
  }
10696
10703
  }
10697
10704
  }
10698
- return T;
10705
+ return R;
10699
10706
  }, Go = (t, e, n) => {
10700
10707
  t === "create" && lt.forEach((s) => {
10701
10708
  if (!Je(e[s], n[s]))
@@ -10723,11 +10730,11 @@ const qo = async (t, e, n, s, r, i, o) => {
10723
10730
  else if (n[o] && n[o]?.valueOf() !== s[o]?.valueOf())
10724
10731
  throw new Error("Soft delete timestamp cannot be changed");
10725
10732
  }
10726
- }, Ss = async (t, e, n, s, r) => {
10727
- if (!Ie("Read", r.collections?.[e.labels.collection]))
10733
+ }, Ts = async (t, e, n, s, r) => {
10734
+ if (!Ne("Read", r.collections?.[e.labels.collection]))
10728
10735
  return !1;
10729
10736
  try {
10730
- await Ke([e.labels.collection], n, { userId: s, providedTransaction: t });
10737
+ await Xe([e.labels.collection], n, { userId: s, providedTransaction: t });
10731
10738
  } catch {
10732
10739
  return !1;
10733
10740
  }
@@ -10752,12 +10759,12 @@ const qo = async (t, e, n, s, r, i, o) => {
10752
10759
  if (s.collections?.[a]?.restrictEntities || s?.collections?.[a]?.recordOwner?.active || s?.collections?.[a]?.recordUser?.active || s?.collections?.[a]?.recordProperty?.active) {
10753
10760
  const u = i?.collections?.[a], f = [];
10754
10761
  if (l.individualEntities) {
10755
- const g = l.individualEntities, T = u?.individualEntities || [], m = i ? g.filter((E) => !T.includes(E)) : g;
10762
+ const g = l.individualEntities, R = u?.individualEntities || [], m = i ? g.filter((E) => !R.includes(E)) : g;
10756
10763
  for (const E of m) {
10757
10764
  if (o && o.size++, o && o.size > 500)
10758
10765
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks or entity restrictions (in permissions when dealing with user collections).");
10759
10766
  f.push(async () => {
10760
- if (!await Ss(t, d, E, n, s))
10767
+ if (!await Ts(t, d, E, n, s))
10761
10768
  throw new Error("PERMISSION_DENIED");
10762
10769
  });
10763
10770
  }
@@ -10766,12 +10773,12 @@ const qo = async (t, e, n, s, r, i, o) => {
10766
10773
  const g = c.entityRestrictions?.restrictions?.find((k) => k.type === "Parent" && k.roles.some((v) => v.role === e.Role));
10767
10774
  if (!g)
10768
10775
  throw new Error("PERMISSION_DENIED");
10769
- const T = V(d.fields, g.collectionField), m = r.collections[T.collection], E = l.parentEntities, w = u?.parentEntities || [], x = i ? E.filter((k) => !w.includes(k)) : E;
10776
+ const R = V(d.fields, g.collectionField), m = r.collections[R.collection], E = l.parentEntities, w = u?.parentEntities || [], x = i ? E.filter((k) => !w.includes(k)) : E;
10770
10777
  for (const k of x) {
10771
10778
  if (o && o.size++, o && o.size > 500)
10772
10779
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks or entity restrictions (in permissions when dealing with user collections).");
10773
10780
  f.push(async () => {
10774
- if (!await Ss(t, m, k, n, s))
10781
+ if (!await Ts(t, m, k, n, s))
10775
10782
  throw new Error("PERMISSION_DENIED");
10776
10783
  });
10777
10784
  }
@@ -10780,14 +10787,14 @@ const qo = async (t, e, n, s, r, i, o) => {
10780
10787
  const g = c.entityRestrictions?.restrictions?.find((x) => x.type === "Parent_Property" && x.roles.some((k) => k.role === e.Role));
10781
10788
  if (!g)
10782
10789
  throw new Error("PERMISSION_DENIED");
10783
- const T = V(d.fields, g.collectionField), m = r.collections[T.collection], E = l.parentPropertyEntities, w = u?.parentPropertyEntities || {};
10790
+ const R = V(d.fields, g.collectionField), m = r.collections[R.collection], E = l.parentPropertyEntities, w = u?.parentPropertyEntities || {};
10784
10791
  for (const [x, k] of Object.entries(E)) {
10785
10792
  const v = w[x] || [], N = i ? k.filter((W) => !v.includes(W)) : k;
10786
10793
  for (const W of N) {
10787
10794
  if (o && o.size++, o && o.size > 500)
10788
10795
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks or entity restrictions (in permissions when dealing with user collections).");
10789
10796
  f.push(async () => {
10790
- if (!await Ss(t, m, W, n, s))
10797
+ if (!await Ts(t, m, W, n, s))
10791
10798
  throw new Error("PERMISSION_DENIED");
10792
10799
  });
10793
10800
  }
@@ -10799,36 +10806,44 @@ const qo = async (t, e, n, s, r, i, o) => {
10799
10806
  }, Cu = async (t, e, n) => {
10800
10807
  const s = n?.userId, r = n?.user;
10801
10808
  let i = n?.context;
10802
- const o = nt(), a = Gt();
10809
+ const o = st(), a = Gt();
10803
10810
  if (n?.providedTransaction && s)
10804
10811
  throw new Error("PERMISSION_DENIED");
10805
10812
  if (n?.providedSchema && s)
10806
10813
  throw new Error("PERMISSION_DENIED");
10807
- let l = n?.providedSchema || await tt();
10814
+ let l = n?.providedSchema || await nt();
10808
10815
  if (t.length === 0)
10809
10816
  throw new Error("EMPTY_PATH");
10810
10817
  const c = t.at(-1), d = Object.keys(l.collections).includes(c), h = a.disabledCollections?.includes(c);
10811
10818
  if (!d || h)
10812
10819
  throw new Error("COLLECTION_NOT_FOUND");
10813
- const u = l.collections[c], { labels: f, fields: g, enableWriteLog: T, softDelete: m } = u, E = mt(f.collection, l), w = await ae(a.appName), x = he(), k = Tt(), v = s ? await k.getUser(s) : void 0, N = v?.customClaims?.role;
10820
+ const u = l.collections[c], { labels: f, fields: g, enableWriteLog: R, softDelete: m } = u, E = mt(f.collection, l), w = await ae(a.appName), x = he(), k = Rt(), v = s ? await k.getUser(s) : void 0, N = v?.customClaims?.role;
10814
10821
  let W, O;
10815
10822
  s && await dr(t, u);
10816
- const H = $e(x, t, o), R = n?.id || H.doc().id;
10817
- i = i || {}, i.collection = f.collection, e.id = R, Bo(e), fr(e);
10823
+ const H = Me(x, t, o), S = n?.id || H.doc().id;
10824
+ i = i || {}, i.collection = f.collection, e.id = S, Bo(e), fr(e);
10818
10825
  const p = Ks("create", t, e, l, w, "Online", s || "System", ht.now(), ge.serverTimestamp());
10819
10826
  n?.createdAt && (p.Created_At = n.createdAt), n?.createdBy && (p.Created_By = n.createdBy);
10820
10827
  const C = ye(p);
10821
- m && (p[m.archivedField] = !1), Ze(e), vt(u, p, l), T && !n?.providedTransaction && await Zt("create", "started", p, o, t, R, u), await ue("preOperation", a, E, { operation: "create", data: p, recordId: R, context: i }), await ue("preWrite", a, E, { operation: "create", data: p, recordId: R, context: i }), vt(u, p, l), Pn(u, p);
10828
+ m && (p[m.archivedField] = !1), Ze(e), vt(u, p, l), R && !n?.providedTransaction && await Zt("create", "started", p, o, t, S, u), await ue("preOperation", a, E, { operation: "create", data: p, recordId: S, context: i }), await ue("preWrite", a, E, { operation: "create", data: p, recordId: S, context: i }), vt(u, p, l), Pn(u, p);
10822
10829
  const _ = (s ? await x.collection("tenants").doc(o).collection("system_user_permissions").doc(s).get() : void 0)?.data();
10823
10830
  await va(p, u, E, _, v?.customClaims || {}), Ze(p);
10824
10831
  try {
10825
- if (u.auth && r && !r.password)
10826
- throw new Error("Password is required");
10832
+ if (u.auth && r) {
10833
+ if (!r.password)
10834
+ throw new Error("Password is required");
10835
+ if (!p.Role)
10836
+ throw new Error("Role field is required");
10837
+ if (!p.Email)
10838
+ throw new Error("Email field is required");
10839
+ if (p.Enabled === void 0 || p.Enabled === null)
10840
+ throw new Error("Enabled field is required");
10841
+ }
10827
10842
  n?.providedTransaction || await fn("create", p, u, E, { operation: "create", data: p, context: i }, l);
10828
10843
  } catch (D) {
10829
10844
  throw new Error(`VALIDATION_ERROR: ${D.message}`);
10830
10845
  }
10831
- Ze(p), e.id = R, m && (p[m.archivedField] = !1), vt(u, p, l), Pn(u, p);
10846
+ Ze(p), e.id = S, m && (p[m.archivedField] = !1), vt(u, p, l), Pn(u, p);
10832
10847
  try {
10833
10848
  Go("create", p, C), Yo("create", u, p), await fn("create", p, u, E, { operation: "create", data: p, context: i }, l);
10834
10849
  } catch (D) {
@@ -10843,18 +10858,18 @@ const qo = async (t, e, n, s, r, i, o) => {
10843
10858
  for (const J of u.fields) {
10844
10859
  if (!(J.name in p))
10845
10860
  continue;
10846
- const z = Ue(J, E);
10861
+ const z = We(J, E);
10847
10862
  if (z?.custom?.serverAccess?.create !== void 0 && !await ae(z.custom.serverAccess.create, [D, p]))
10848
10863
  throw new Error("PERMISSION_DENIED");
10849
10864
  }
10850
10865
  }
10851
10866
  r && (r.permissions ||= {}, r.permissions.Role ||= p.Role, r.permissions.Enabled ||= p.Enabled);
10852
- const S = async (D, M) => {
10867
+ const T = async (D, M) => {
10853
10868
  const [J, z, b, B, K] = await Promise.all([
10854
10869
  n?.providedTransaction ? Promise.resolve({}) : D.get(x.collection("system_deployment").doc("latest_deploy")),
10855
10870
  n?.providedTransaction ? Promise.resolve({}) : D.get(x.collection("system_deployment").doc("maintenance_mode")),
10856
10871
  s ? D.get(x.collection("tenants").doc(o).collection("system_user_permissions").doc(s)) : Promise.resolve({}),
10857
- n?.providedSchema ? Promise.resolve(n.providedSchema) : tt(),
10872
+ n?.providedSchema ? Promise.resolve(n.providedSchema) : nt(),
10858
10873
  s ? os(s) : Promise.resolve(void 0)
10859
10874
  ]);
10860
10875
  if (M && (M.size += 3), !n?.providedTransaction) {
@@ -10878,11 +10893,11 @@ const qo = async (t, e, n, s, r, i, o) => {
10878
10893
  O = K?.customClaims ?? {};
10879
10894
  }
10880
10895
  if (!n?.providedTransaction) {
10881
- const be = g.filter((oe) => "unique" in oe && oe.unique).map(async (oe) => {
10896
+ const Te = g.filter((oe) => "unique" in oe && oe.unique).map(async (oe) => {
10882
10897
  if (!s || !oe.access || Be(oe, W, u, O)) {
10883
10898
  if (!p[oe.name])
10884
10899
  return;
10885
- const ce = Ue(oe, E);
10900
+ const ce = We(oe, E);
10886
10901
  if (!(s && ce?.custom?.serverAccess?.read !== void 0 ? await ae(ce.custom.serverAccess.read, [
10887
10902
  W?.Role,
10888
10903
  p
@@ -10898,17 +10913,17 @@ const qo = async (t, e, n, s, r, i, o) => {
10898
10913
  throw new Error(`VALIDATION_ERROR: ${oe.name} "${p[oe.name]}" is invalid`);
10899
10914
  }
10900
10915
  });
10901
- await Promise.all(be);
10916
+ await Promise.all(Te);
10902
10917
  }
10903
- pr(p, R, u, l, s, W, r?.permissions, O), r?.permissions && s && W && await Jo(D, r.permissions, s, W, l), pr(p, R, u, l, s, W, r?.permissions, O);
10918
+ pr(p, S, u, l, s, W, r?.permissions, O), r?.permissions && s && W && await Jo(D, r.permissions, s, W, l), pr(p, S, u, l, s, W, r?.permissions, O);
10904
10919
  };
10905
10920
  if (u.auth && r) {
10906
10921
  await x.runTransaction(async (M) => {
10907
- await S(M);
10922
+ await T(M);
10908
10923
  }, { maxAttempts: 10 });
10909
10924
  const D = await qo(
10910
10925
  o,
10911
- R,
10926
+ S,
10912
10927
  a,
10913
10928
  u,
10914
10929
  p,
@@ -10921,9 +10936,9 @@ const qo = async (t, e, n, s, r, i, o) => {
10921
10936
  const U = async (D) => {
10922
10937
  try {
10923
10938
  const M = { size: 1 };
10924
- await S(D, M), n?.noTwoWay || await Ho("Create", o, R, p, p, u, l, D, M, s, W, void 0, O);
10939
+ await T(D, M), n?.noTwoWay || await Ho("Create", o, S, p, p, u, l, D, M, s, W, void 0, O);
10925
10940
  const J = Qs(l);
10926
- lr("create", D, t, R, p, l, u, n, J, ge.arrayUnion, ge.arrayRemove, ge.delete, (z) => x.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${z.name}`).doc(R), (z, b) => x.collection("tenants").doc(o).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${z.name}`).doc(b), (z) => x.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${z}`).doc(R), (z, b) => $e(x, z, o).doc(b), (z, b, B) => x.collection("tenants").doc(o).collection("system_fields").doc(z.collection).collection(`${z.collection}-${b}`).doc(B), (z, b, B) => x.collection("tenants").doc(o).collection("system_fields").doc(z.collection).collection(`${z.collection}-${b.replaceAll(" ", "-")}`).doc(B), void 0, void 0, M), D.set(H.doc(R), p);
10941
+ lr("create", D, t, S, p, l, u, n, J, ge.arrayUnion, ge.arrayRemove, ge.delete, (z) => x.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${z.name}`).doc(S), (z, b) => x.collection("tenants").doc(o).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${z.name}`).doc(b), (z) => x.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${z}`).doc(S), (z, b) => Me(x, z, o).doc(b), (z, b, B) => x.collection("tenants").doc(o).collection("system_fields").doc(z.collection).collection(`${z.collection}-${b}`).doc(B), (z, b, B) => x.collection("tenants").doc(o).collection("system_fields").doc(z.collection).collection(`${z.collection}-${b.replaceAll(" ", "-")}`).doc(B), void 0, void 0, M), D.set(H.doc(S), p);
10927
10942
  } catch (M) {
10928
10943
  if (n?.providedTransaction)
10929
10944
  throw M;
@@ -10931,13 +10946,13 @@ const qo = async (t, e, n, s, r, i, o) => {
10931
10946
  const z = await ue("postWriteError", a, E, {
10932
10947
  operation: "create",
10933
10948
  data: p,
10934
- recordId: R,
10949
+ recordId: S,
10935
10950
  context: i,
10936
10951
  error: M
10937
10952
  });
10938
- if (T && (await new Promise((b) => {
10953
+ if (R && (await new Promise((b) => {
10939
10954
  setTimeout(b, 250);
10940
- }), await Zt("create", z?.resolved ? "success" : "failed", p, o, t, R, u, z?.resolved ? void 0 : M)), !z?.resolved)
10955
+ }), await Zt("create", z?.resolved ? "success" : "failed", p, o, t, S, u, z?.resolved ? void 0 : M)), !z?.resolved)
10941
10956
  throw u.auth && r && await _n(p), M;
10942
10957
  }
10943
10958
  }
@@ -10945,12 +10960,12 @@ const qo = async (t, e, n, s, r, i, o) => {
10945
10960
  if (n?.providedTransaction ? await U(n.providedTransaction) : await x.runTransaction(async (D) => {
10946
10961
  await U(D);
10947
10962
  }, { maxAttempts: 10 }), !n?.providedTransaction) {
10948
- const D = { operation: "create", data: p, recordId: R, context: i }, M = { ...D };
10963
+ const D = { operation: "create", data: p, recordId: S, context: i }, M = { ...D };
10949
10964
  await ue("postWrite", a, E, D), await ue("postOperation", a, E, M);
10950
10965
  }
10951
- return { id: R, ...p };
10966
+ return { id: S, ...p };
10952
10967
  }, sn = async (t, e, n, s) => {
10953
- const r = nt(), i = Tt(), o = he(), a = e.customClaims || {};
10968
+ const r = st(), i = Rt(), o = he(), a = e.customClaims || {};
10954
10969
  let l = !1;
10955
10970
  try {
10956
10971
  await i.updateUser(t, {
@@ -10984,18 +10999,18 @@ const qo = async (t, e, n, s, r, i, o) => {
10984
10999
  if (l)
10985
11000
  throw new Error(`ROLLBACK_FAILED: ${s}`);
10986
11001
  }, lu = async (t, e, n, s, r, i, o, a, l, c, d) => {
10987
- const h = Tt(), u = he(), f = {};
11002
+ const h = Rt(), u = he(), f = {};
10988
11003
  for (const m of r.fields)
10989
- m.saveToAuthToken && !ur(m.name) && i[m.name] !== void 0 && m.type !== "Timestamp" && m.type !== "Computed" && m.type !== "Embedding" && (De(i[m.name]) ? f[m.name] = null : f[m.name] = i[m.name]);
11004
+ m.saveToAuthToken && !ur(m.name) && i[m.name] !== void 0 && m.type !== "Timestamp" && m.type !== "Computed" && m.type !== "Embedding" && (ke(i[m.name]) ? f[m.name] = null : f[m.name] = i[m.name]);
10990
11005
  const g = "USER_ERROR";
10991
- let T = "";
11006
+ let R = "";
10992
11007
  if (t === "create") {
10993
11008
  if (!d)
10994
11009
  throw new Error("VALIDATION_ERROR: Password is required");
10995
11010
  if (!l)
10996
11011
  throw new Error("VALIDATION_ERROR: Permissions are required");
10997
11012
  try {
10998
- T = await qo(e, n, s, r, i, l, d);
11013
+ R = await qo(e, n, s, r, i, l, d);
10999
11014
  } catch (m) {
11000
11015
  throw new Error(m.message);
11001
11016
  }
@@ -11065,10 +11080,10 @@ const qo = async (t, e, n, s, r, i, o) => {
11065
11080
  } catch (m) {
11066
11081
  throw new Error(m.message);
11067
11082
  }
11068
- if (T)
11069
- return T;
11083
+ if (R)
11084
+ return R;
11070
11085
  }, cu = async (t, e, n) => {
11071
- const s = nt(), r = he(), i = [e];
11086
+ const s = st(), r = he(), i = [e];
11072
11087
  n && n.trim() !== "" && i.push(n), i.sort();
11073
11088
  const o = [];
11074
11089
  for (const a of i) {
@@ -11080,7 +11095,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11080
11095
  for (const a of o)
11081
11096
  t.set(a, { locked: !0 });
11082
11097
  }, di = async (t, e) => {
11083
- const n = nt(), s = he(), r = [t];
11098
+ const n = st(), s = he(), r = [t];
11084
11099
  e && e.trim() !== "" && r.push(e), r.sort();
11085
11100
  const i = s.batch();
11086
11101
  for (const o of r) {
@@ -11091,34 +11106,34 @@ const qo = async (t, e, n, s, r, i, o) => {
11091
11106
  }, uu = async (t, e, n, s) => {
11092
11107
  const r = s?.userId;
11093
11108
  let i = s?.user, o = s?.context;
11094
- const a = nt(), l = Gt();
11109
+ const a = st(), l = Gt();
11095
11110
  if (s?.providedTransaction && r)
11096
11111
  throw new Error("PERMISSION_DENIED");
11097
11112
  if (s?.providedSchema && r)
11098
11113
  throw new Error("PERMISSION_DENIED");
11099
11114
  if (s?.providedTransaction && !s?.originalRecord)
11100
11115
  throw new Error("PERMISSION_DENIED");
11101
- let c = s?.providedSchema || await tt(!0);
11116
+ let c = s?.providedSchema || await nt(!0);
11102
11117
  if (t.length === 0)
11103
11118
  throw new Error("EMPTY_PATH");
11104
11119
  const d = t.at(-1), h = Object.keys(c.collections).includes(d), u = l.disabledCollections?.includes(d);
11105
11120
  if (!h || u)
11106
11121
  throw new Error("COLLECTION_NOT_FOUND");
11107
- const f = c.collections[d], { labels: g, fields: T, enableWriteLog: m } = f, E = mt(g.collection, c), w = await ae(l.appName), x = Tt(), k = he();
11122
+ const f = c.collections[d], { labels: g, fields: R, enableWriteLog: m } = f, E = mt(g.collection, c), w = await ae(l.appName), x = Rt(), k = he();
11108
11123
  let v, N;
11109
11124
  r && await dr(t, f);
11110
- const W = $e(k, t, a);
11125
+ const W = Me(k, t, a);
11111
11126
  o = o || {}, o.collection = g.collection;
11112
- let O = s?.originalRecord || await Ke(t, e, {
11127
+ let O = s?.originalRecord || await Xe(t, e, {
11113
11128
  userId: r,
11114
11129
  noComputedFields: !0,
11115
11130
  noEmbeddingFields: !0
11116
11131
  }), H = O;
11117
- r && (H = await Ke(t, e, {
11132
+ r && (H = await Xe(t, e, {
11118
11133
  noComputedFields: !0,
11119
11134
  noEmbeddingFields: !0
11120
11135
  }));
11121
- for (const b of T)
11136
+ for (const b of R)
11122
11137
  b.type === "Computed" && (delete n[b.name], delete O[b.name]);
11123
11138
  if (c = {
11124
11139
  ...c,
@@ -11135,24 +11150,24 @@ const qo = async (t, e, n, s, r, i, o) => {
11135
11150
  throw new Error("VALIDATION_ERROR: User operations are only permitted for auth collections");
11136
11151
  if (i?.operation === "delete" && i.permissions)
11137
11152
  throw new Error("VALIDATION_ERROR: Permissions are not allowed for delete operations");
11138
- const R = f.fields.filter((b) => b.saveToAuthToken && !ur(b.name)), p = f.auth && i?.operation === "create", C = f.auth && i?.operation === "delete", I = f.auth && !p && !C && (i?.operation === "update" || n.Role || n.Enabled !== void 0 || n.Name || n.Email || n.Photo_URL || // eslint-disable-next-line security/detect-object-injection
11139
- R.some((b) => n[b.name] !== void 0)), P = (b) => b.User_ID && (f.auth && !p && !C && i?.operation === "update" || n.Role && n.Role !== b.Role || n.Enabled !== void 0 && n.Enabled !== b.Enabled || n.Name && n.Name !== b.Name || n.Email && n.Email !== b.Email || n.Photo_URL && n.Photo_URL !== b.Photo_URL || R.some(
11153
+ const S = f.fields.filter((b) => b.saveToAuthToken && !ur(b.name)), p = f.auth && i?.operation === "create", C = f.auth && i?.operation === "delete", I = f.auth && !p && !C && (i?.operation === "update" || n.Role || n.Enabled !== void 0 || n.Name || n.Email || n.Photo_URL || // eslint-disable-next-line security/detect-object-injection
11154
+ S.some((b) => n[b.name] !== void 0)), P = (b) => b.User_ID && (f.auth && !p && !C && i?.operation === "update" || n.Role && n.Role !== b.Role || n.Enabled !== void 0 && n.Enabled !== b.Enabled || n.Name && n.Name !== b.Name || n.Email && n.Email !== b.Email || n.Photo_URL && n.Photo_URL !== b.Photo_URL || S.some(
11140
11155
  // eslint-disable-next-line security/detect-object-injection
11141
11156
  (B) => n[B.name] !== void 0 && n[B.name] !== b[B.name]
11142
11157
  ));
11143
11158
  delete n.id, Bo(n), fr(n);
11144
11159
  const y = Ks("update", t, n, c, w, "Online", r || "System", ht.now(), ge.serverTimestamp()), _ = ye(y);
11145
- for (const b of T)
11146
- !ee(b) && De(y[b.name]) && b.nullable && (y[b.name] = null);
11160
+ for (const b of R)
11161
+ !ee(b) && ke(y[b.name]) && b.nullable && (y[b.name] = null);
11147
11162
  Ze(y), Ze(O), vt(f, y, c), vt(f, O, c), m && !s?.providedTransaction && await Zt("update", "started", y, a, t, e, f, void 0, O);
11148
- const S = {
11163
+ const T = {
11149
11164
  operation: "update",
11150
11165
  data: y,
11151
11166
  recordId: e,
11152
11167
  context: o,
11153
11168
  originalRecord: ye(O)
11154
11169
  };
11155
- await ue("preOperation", l, E, S);
11170
+ await ue("preOperation", l, E, T);
11156
11171
  const U = {
11157
11172
  operation: "update",
11158
11173
  data: y,
@@ -11166,49 +11181,49 @@ const qo = async (t, e, n, s, r, i, o) => {
11166
11181
  throw new Error("Password is required");
11167
11182
  if (!s?.providedTransaction) {
11168
11183
  const b = { ...H, ...y };
11169
- at(b), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ye(O) }, c);
11184
+ Qe(b), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ye(O) }, c);
11170
11185
  }
11171
11186
  } catch (b) {
11172
11187
  throw new Error(`VALIDATION_ERROR: ${b.message}`);
11173
11188
  }
11174
11189
  Ze(y), delete n.id, vt(f, y, c), Pn(f, y);
11175
- for (const b of T)
11176
- !ee(b) && De(y[b.name]) && b.nullable && (y[b.name] = null);
11190
+ for (const b of R)
11191
+ !ee(b) && ke(y[b.name]) && b.nullable && (y[b.name] = null);
11177
11192
  try {
11178
11193
  const b = { ...H, ...y };
11179
- at(b), Yo("update", f, y, O), Go("update", y, _), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ye(O) }, c);
11194
+ Qe(b), Yo("update", f, y, O), Go("update", y, _), await fn("update", b, f, E, { operation: "update", data: y, context: o, originalRecord: ye(O) }, c);
11180
11195
  } catch (b) {
11181
11196
  throw new Error(`VALIDATION_ERROR: ${b.message}`);
11182
11197
  }
11183
11198
  let F;
11184
11199
  i && (i.permissions ||= {});
11185
11200
  const D = async (b, B, K) => {
11186
- const [le, be, oe, ce, Ne, Ge] = await Promise.all([
11201
+ const [le, Te, oe, ce, De, Ge] = await Promise.all([
11187
11202
  s?.providedTransaction ? Promise.resolve({}) : b.get(k.collection("system_deployment").doc("latest_deploy")),
11188
11203
  s?.providedTransaction ? Promise.resolve({}) : b.get(k.collection("system_deployment").doc("maintenance_mode")),
11189
- s?.providedTransaction ? Promise.resolve(O) : Ke(t, e, {
11204
+ s?.providedTransaction ? Promise.resolve(O) : Xe(t, e, {
11190
11205
  userId: r,
11191
11206
  providedTransaction: b,
11192
11207
  noComputedFields: !0
11193
11208
  }),
11194
11209
  r ? b.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(r)) : Promise.resolve({}),
11195
- s?.providedSchema ? Promise.resolve(s.providedSchema) : tt(),
11210
+ s?.providedSchema ? Promise.resolve(s.providedSchema) : nt(),
11196
11211
  r ? os(r) : Promise.resolve(void 0)
11197
11212
  ]);
11198
11213
  if (K && (K.size += 3), !s?.providedTransaction) {
11199
11214
  if (!le.exists)
11200
11215
  throw new Error("VERSION_ERROR");
11201
- const je = le.data();
11202
- if (je.force && y.Last_Write_At.valueOf() < je.time.valueOf())
11216
+ const _e = le.data();
11217
+ if (_e.force && y.Last_Write_At.valueOf() < _e.time.valueOf())
11203
11218
  throw new Error("VERSION_ERROR");
11204
- if (!be.exists)
11219
+ if (!Te.exists)
11205
11220
  throw new Error("MAINTENANCE_MODE");
11206
- if (be.data().active)
11221
+ if (Te.data().active)
11207
11222
  throw new Error("MAINTENANCE_MODE");
11208
11223
  }
11209
11224
  if (!oe)
11210
11225
  throw new Error("NOT_FOUND");
11211
- if (O = oe, c = Ne, r) {
11226
+ if (O = oe, c = De, r) {
11212
11227
  if (!ce?.exists)
11213
11228
  throw new Error("PERMISSION_DENIED");
11214
11229
  if (v = ce.data(), !v.Role)
@@ -11220,50 +11235,59 @@ const qo = async (t, e, n, s, r, i, o) => {
11220
11235
  if (K && (K.size += Lo(a, t, e, c, v, N).length), p && O.User_ID || C && !O.User_ID)
11221
11236
  throw new Error("USER_ERROR");
11222
11237
  if (P(O)) {
11223
- const je = await b.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(O.User_ID));
11224
- if (K && K.size++, !je?.exists)
11238
+ const _e = await b.get(k.collection("tenants").doc(a).collection("system_user_permissions").doc(O.User_ID));
11239
+ if (K && K.size++, !_e?.exists)
11225
11240
  throw new Error("PERMISSION_DENIED");
11226
- F = je.data();
11241
+ F = _e.data();
11227
11242
  const pt = i?.permissions && Object.keys(i.permissions).length > 0 ? i.permissions : void 0;
11228
11243
  if (y.Role && y.Role !== O.Role && !pt && (i ||= { operation: "update", permissions: {} }, i.permissions = ye(F), i.permissions.Role = y.Role), i?.permissions) {
11229
- if (i.permissions.Role ||= y.Role || O.Role, i.permissions.Enabled ??= y.Enabled ?? O.Enabled, De(i.permissions.Role))
11244
+ if (i.permissions.Role ||= y.Role || O.Role, i.permissions.Enabled ??= y.Enabled ?? O.Enabled, ke(i.permissions.Role) || !i.permissions.Role)
11230
11245
  throw new Error("VALIDATION_ERROR: Role field is required");
11231
- if (De(i.permissions.Enabled))
11246
+ if (ke(i.permissions.Enabled) || i.permissions.Enabled === void 0 || i.permissions.Enabled === null)
11232
11247
  throw new Error("VALIDATION_ERROR: Enabled field is required");
11233
11248
  }
11234
11249
  }
11250
+ if (p) {
11251
+ const _e = { ...O, ...y };
11252
+ if (Qe(_e), !_e.Role)
11253
+ throw new Error("VALIDATION_ERROR: Role field is required");
11254
+ if (_e.Enabled === void 0 || _e.Enabled === null)
11255
+ throw new Error("VALIDATION_ERROR: Enabled field is required");
11256
+ if (!_e.Email)
11257
+ throw new Error("VALIDATION_ERROR: Email field is required");
11258
+ }
11235
11259
  if (!s?.providedTransaction) {
11236
- const pt = T.filter((ve) => "unique" in ve && ve.unique).map(async (ve) => {
11237
- if (!r || !ve.access || Be(ve, v, f, N)) {
11238
- if (y[ve.name] === void 0 || De(y[ve.name]))
11260
+ const pt = R.filter((Oe) => "unique" in Oe && Oe.unique).map(async (Oe) => {
11261
+ if (!r || !Oe.access || Be(Oe, v, f, N)) {
11262
+ if (y[Oe.name] === void 0 || ke(y[Oe.name]))
11239
11263
  return;
11240
- const Yt = Ue(ve, E), En = { ...O, ...y };
11264
+ const Yt = We(Oe, E), En = { ...O, ...y };
11241
11265
  if (!(r && Yt?.custom?.serverAccess?.read !== void 0 ? await ae(Yt.custom.serverAccess.read, [
11242
11266
  v?.Role,
11243
11267
  En
11244
11268
  ]) : !0))
11245
11269
  throw new Error("PERMISSION_DENIED");
11246
- const as = y[ve.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
11270
+ const as = y[Oe.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
11247
11271
  if (Do(as)) {
11248
11272
  if (K && K.size++, K && K.size > 500)
11249
11273
  throw new Error("VALIDATION_ERROR: The number of operations in the Firestore transaction has exceeded the limit of 500. This is likely due to a large number of unique field checks.");
11250
- const hr = await b.get(k.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${ve.name}`).doc(as));
11274
+ const hr = await b.get(k.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${Oe.name}`).doc(as));
11251
11275
  if (hr.exists && hr.data().id !== e)
11252
- throw new Error(`VALIDATION_ERROR: ${ve.name} "${y[ve.name]}" already exists`);
11276
+ throw new Error(`VALIDATION_ERROR: ${Oe.name} "${y[Oe.name]}" already exists`);
11253
11277
  } else
11254
- throw new Error(`VALIDATION_ERROR: ${ve.name} "${y[ve.name]}" is invalid`);
11278
+ throw new Error(`VALIDATION_ERROR: ${Oe.name} "${y[Oe.name]}" is invalid`);
11255
11279
  }
11256
11280
  });
11257
11281
  await Promise.all(pt);
11258
11282
  }
11259
11283
  if (r && v?.Role) {
11260
- const je = v.Role, pt = { ...O, ...y };
11261
- if (!(E.custom?.serverAccess?.update !== void 0 ? await ae(E.custom.serverAccess.update, [je, pt, O]) : !0))
11284
+ const _e = v.Role, pt = { ...O, ...y };
11285
+ if (!(E.custom?.serverAccess?.update !== void 0 ? await ae(E.custom.serverAccess.update, [_e, pt, O]) : !0))
11262
11286
  throw new Error("PERMISSION_DENIED");
11263
11287
  for (const Yt of f.fields) {
11264
- const En = Ue(Yt, E);
11288
+ const En = We(Yt, E);
11265
11289
  if (Object.prototype.hasOwnProperty.call(y, Yt.name) && En?.custom?.serverAccess?.update !== void 0 && !await ae(En.custom.serverAccess.update, [
11266
- je,
11290
+ _e,
11267
11291
  pt,
11268
11292
  O
11269
11293
  ]))
@@ -11281,10 +11305,10 @@ const qo = async (t, e, n, s, r, i, o) => {
11281
11305
  try {
11282
11306
  const K = { size: 1 }, le = { ...O, ...y };
11283
11307
  await D(b, !1, K);
11284
- let be;
11285
- !s?.noTwoWay && !s?.providedTransaction && (be = await Ho("Update", a, e, le, y, f, c, b, K, r, v, O, N));
11308
+ let Te;
11309
+ !s?.noTwoWay && !s?.providedTransaction && (Te = await Ho("Update", a, e, le, y, f, c, b, K, r, v, O, N));
11286
11310
  const oe = Qs(c);
11287
- lr("update", b, t, e, y, c, f, s, oe, ge.arrayUnion, ge.arrayRemove, ge.delete, (ce) => k.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${ce.name}`).doc(e), (ce, Ne) => k.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${ce.name}`).doc(Ne), (ce) => k.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${ce}`).doc(e), (ce, Ne) => $e(k, ce, a).doc(Ne), (ce, Ne, Ge) => k.collection("tenants").doc(a).collection("system_fields").doc(ce.collection).collection(`${ce.collection}-${Ne}`).doc(Ge), (ce, Ne, Ge) => k.collection("tenants").doc(a).collection("system_fields").doc(ce.collection).collection(`${ce.collection}-${Ne.replaceAll(" ", "-")}`).doc(Ge), O, be, K), b.update(W.doc(e), y);
11311
+ lr("update", b, t, e, y, c, f, s, oe, ge.arrayUnion, ge.arrayRemove, ge.delete, (ce) => k.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${ce.name}`).doc(e), (ce, De) => k.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${ce.name}`).doc(De), (ce) => k.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${ce}`).doc(e), (ce, De) => Me(k, ce, a).doc(De), (ce, De, Ge) => k.collection("tenants").doc(a).collection("system_fields").doc(ce.collection).collection(`${ce.collection}-${De}`).doc(Ge), (ce, De, Ge) => k.collection("tenants").doc(a).collection("system_fields").doc(ce.collection).collection(`${ce.collection}-${De.replaceAll(" ", "-")}`).doc(Ge), O, Te, K), b.update(W.doc(e), y);
11288
11312
  } catch (K) {
11289
11313
  if (s?.providedTransaction)
11290
11314
  throw K;
@@ -11296,10 +11320,10 @@ const qo = async (t, e, n, s, r, i, o) => {
11296
11320
  context: o,
11297
11321
  error: K,
11298
11322
  originalRecord: ye(O)
11299
- }, be = await ue("postWriteError", l, E, le);
11323
+ }, Te = await ue("postWriteError", l, E, le);
11300
11324
  if (m && (await new Promise((oe) => {
11301
11325
  setTimeout(oe, 250);
11302
- }), await Zt("update", be?.resolved ? "success" : "failed", y, a, t, e, f, be?.resolved ? void 0 : K, O)), !be?.resolved)
11326
+ }), await Zt("update", Te?.resolved ? "success" : "failed", y, a, t, e, f, Te?.resolved ? void 0 : K, O)), !Te?.resolved)
11303
11327
  throw p && await _n(O), P(O) && await sn(O.User_ID, B, F, "USER_ERROR"), C && await k.collection("tenants").doc(a).collection(g.collection).doc(e).update({ User_ID: ge.delete() }), K;
11304
11328
  }
11305
11329
  }
@@ -11317,7 +11341,7 @@ const qo = async (t, e, n, s, r, i, o) => {
11317
11341
  throw new Error("USER_ERROR");
11318
11342
  }
11319
11343
  const B = { ...O, ...y };
11320
- at(B);
11344
+ Qe(B);
11321
11345
  const K = await lu(i?.operation || "update", a, e, l, f, B, O, b, i?.permissions, F, i?.password);
11322
11346
  p && (y.User_ID = K), C && (y.User_ID = ge.delete());
11323
11347
  }
@@ -11340,35 +11364,35 @@ const qo = async (t, e, n, s, r, i, o) => {
11340
11364
  await ue("postWrite", l, E, b), await ue("postOperation", l, E, B);
11341
11365
  }
11342
11366
  const J = { ...O, ...y };
11343
- return at(J), { id: e, ...J };
11367
+ return Qe(J), { id: e, ...J };
11344
11368
  }, Fu = async (t, e, n) => {
11345
11369
  const s = n?.userId;
11346
11370
  let r = n?.context;
11347
- const i = nt(), o = Gt();
11348
- let a = await tt();
11371
+ const i = st(), o = Gt();
11372
+ let a = await nt();
11349
11373
  if (t.length === 0)
11350
11374
  throw new Error("EMPTY_PATH");
11351
11375
  const l = t.at(-1), c = Object.keys(a.collections).includes(l), d = o.disabledCollections?.includes(l);
11352
11376
  if (!c || d)
11353
11377
  throw new Error("COLLECTION_NOT_FOUND");
11354
- const h = a.collections[l], { labels: u, auth: f, enableWriteLog: g, softDelete: T } = h, m = mt(u.collection, a), E = await ae(o.appName);
11355
- if (T && !f && !n?.force)
11356
- return await uu(t, e, { [T.archivedField]: !0, [T.timestampField]: ge.serverTimestamp() }, { userId: s });
11378
+ const h = a.collections[l], { labels: u, auth: f, enableWriteLog: g, softDelete: R } = h, m = mt(u.collection, a), E = await ae(o.appName);
11379
+ if (R && !f && !n?.force)
11380
+ return await uu(t, e, { [R.archivedField]: !0, [R.timestampField]: ge.serverTimestamp() }, { userId: s });
11357
11381
  const w = he();
11358
11382
  let x;
11359
11383
  s && await dr(t, h);
11360
- const k = $e(w, t, i);
11384
+ const k = Me(w, t, i);
11361
11385
  r = r || {}, r.collection = u.collection;
11362
- const v = await Ke(t, e, { userId: s });
11386
+ const v = await Xe(t, e, { userId: s });
11363
11387
  let N = Ks("delete", t, v, a, E, "Online", s || "System", ht.now(), ge.serverTimestamp());
11364
11388
  const W = Mn(N);
11365
11389
  Ze(N), g && await Zt("delete", "started", N, i, t, e, h), await ue("preOperation", o, m, { operation: "delete", data: N, recordId: e, context: r }), await ue("preWrite", o, m, { operation: "delete", data: N, recordId: e, context: r }), Ze(N);
11366
- const R = async (P) => {
11367
- const [y, _, S, U] = await Promise.all([
11390
+ const S = async (P) => {
11391
+ const [y, _, T, U] = await Promise.all([
11368
11392
  P.get(w.collection("system_deployment").doc("maintenance_mode")),
11369
- Ke(t, e, { userId: s, providedTransaction: P }),
11393
+ Xe(t, e, { userId: s, providedTransaction: P }),
11370
11394
  s ? P.get(w.collection("tenants").doc(i).collection("system_user_permissions").doc(s)) : Promise.resolve({}),
11371
- tt()
11395
+ nt()
11372
11396
  ]);
11373
11397
  if (!y.exists)
11374
11398
  throw new Error("MAINTENANCE_MODE");
@@ -11377,9 +11401,9 @@ const qo = async (t, e, n, s, r, i, o) => {
11377
11401
  if (!_)
11378
11402
  throw new Error("NOT_FOUND");
11379
11403
  if (N = { ..._, ...W }, a = U, s) {
11380
- if (!S?.exists)
11404
+ if (!T?.exists)
11381
11405
  throw new Error("PERMISSION_DENIED");
11382
- if (x = S.data(), !x.Role)
11406
+ if (x = T.data(), !x.Role)
11383
11407
  throw new Error("USER_ERROR");
11384
11408
  if (!x.Enabled)
11385
11409
  throw new Error("PERMISSION_DENIED");
@@ -11392,13 +11416,13 @@ const qo = async (t, e, n, s, r, i, o) => {
11392
11416
  }
11393
11417
  };
11394
11418
  h.auth && (await w.runTransaction(async (P) => {
11395
- await R(P);
11419
+ await S(P);
11396
11420
  }, { maxAttempts: 10 }), N.User_ID && await _n(N));
11397
11421
  try {
11398
11422
  await w.runTransaction(async (P) => {
11399
- await R(P);
11423
+ await S(P);
11400
11424
  const y = Qs(a);
11401
- lr("delete", P, t, e, N, a, h, n, y, ge.arrayUnion, ge.arrayRemove, ge.delete, (_) => w.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${_.name}`).doc(e), (_, S) => w.collection("tenants").doc(i).collection("system_unique").doc(u.collection).collection(`Unique-${u.collection}-${_.name}`).doc(S), (_) => w.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${_}`).doc(e), (_, S) => $e(w, _, i).doc(S), (_, S, U) => w.collection("tenants").doc(i).collection("system_fields").doc(_.collection).collection(`${_.collection}-${S}`).doc(U), (_, S, U) => w.collection("tenants").doc(i).collection("system_fields").doc(_.collection).collection(`${_.collection}-${S.replaceAll(" ", "-")}`).doc(U)), P.delete(k.doc(e));
11425
+ lr("delete", P, t, e, N, a, h, n, y, ge.arrayUnion, ge.arrayRemove, ge.delete, (_) => w.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${_.name}`).doc(e), (_, T) => w.collection("tenants").doc(i).collection("system_unique").doc(u.collection).collection(`Unique-${u.collection}-${_.name}`).doc(T), (_) => w.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${_}`).doc(e), (_, T) => Me(w, _, i).doc(T), (_, T, U) => w.collection("tenants").doc(i).collection("system_fields").doc(_.collection).collection(`${_.collection}-${T}`).doc(U), (_, T, U) => w.collection("tenants").doc(i).collection("system_fields").doc(_.collection).collection(`${_.collection}-${T.replaceAll(" ", "-")}`).doc(U)), P.delete(k.doc(e));
11402
11426
  }, { maxAttempts: 10 });
11403
11427
  } catch (P) {
11404
11428
  const _ = await ue("postWriteError", o, m, {
@@ -11408,8 +11432,8 @@ const qo = async (t, e, n, s, r, i, o) => {
11408
11432
  context: r,
11409
11433
  error: P
11410
11434
  });
11411
- if (g && (await new Promise((S) => {
11412
- setTimeout(S, 250);
11435
+ if (g && (await new Promise((T) => {
11436
+ setTimeout(T, 250);
11413
11437
  }), await Zt("delete", _?.resolved ? "success" : "failed", N, i, t, e, h, _?.resolved ? void 0 : P)), !_?.resolved)
11414
11438
  throw h.auth && N.User_ID && await w.collection("tenants").doc(i).collection(u.collection).doc(e).update({ User_ID: ge.delete() }), P;
11415
11439
  }
@@ -11458,36 +11482,36 @@ export {
11458
11482
  Bo as deserializeTimestamps,
11459
11483
  Du as deserializeTimestampsWithoutUnderscores,
11460
11484
  Uu as displayDate,
11461
- tt as fetchCurrentSchema,
11485
+ nt as fetchCurrentSchema,
11462
11486
  Au as fetchLastSchema,
11463
11487
  ku as getCachedConfigValue,
11464
11488
  tu as getCollectionRefs,
11465
11489
  mt as getCustomizationFile,
11466
11490
  eu as getCustomizationFiles,
11467
11491
  Lo as getDocumentRefs,
11468
- $e as getFirestorePathRef,
11492
+ Me as getFirestorePathRef,
11469
11493
  Gt as getGlobalConfigModule,
11470
11494
  bu as getInputSchema,
11471
11495
  Iu as getMaintenanceInfo,
11472
11496
  Mo as getMode,
11473
- Ke as getOne,
11497
+ Xe as getOne,
11474
11498
  Uo as getSome,
11475
11499
  he as getStokerFirestore,
11476
- nt as getTenant,
11500
+ st as getTenant,
11477
11501
  Po as getTimezone,
11478
11502
  os as getUser,
11479
- Ru as getVersionInfo,
11503
+ Su as getVersionInfo,
11480
11504
  Ja as getZodSchema,
11481
11505
  Nu as initializeFirebase,
11482
- Tu as initializeStoker,
11483
- De as isDeleteSentinel,
11506
+ Ru as initializeStoker,
11507
+ ke as isDeleteSentinel,
11484
11508
  Lu as keepTimezone,
11485
11509
  Vu as removeTimezone,
11486
11510
  xu as runChildProcess,
11487
11511
  Zo as sendMail,
11488
11512
  $u as sendMessage,
11489
11513
  Mu as serializeTimestamps,
11490
- Su as setTenant,
11514
+ Tu as setTenant,
11491
11515
  ae as tryPromise,
11492
11516
  uu as updateRecord,
11493
11517
  lu as updateUser,