@stoker-platform/node-client 0.5.67 → 0.5.69
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.cjs +6 -6
- package/dist/bundle.js +759 -751
- package/dist/types/main.d.ts +1 -0
- package/dist/types/utils/getStokerFirestore.d.ts +2 -0
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -2,16 +2,16 @@ import He from "lodash/isEqual.js";
|
|
|
2
2
|
import Zo from "lodash/merge.js";
|
|
3
3
|
import zo from "lodash/set.js";
|
|
4
4
|
import fe from "lodash/cloneDeep.js";
|
|
5
|
-
import { getApp as
|
|
6
|
-
import { getFirestore as
|
|
5
|
+
import { getApp as Ls, initializeApp as si, applicationDefault as ri } from "firebase-admin/app";
|
|
6
|
+
import { getFirestore as qo, Timestamp as ut, FieldValue as he } from "firebase-admin/firestore";
|
|
7
7
|
import { pathToFileURL as ii } from "node:url";
|
|
8
|
-
import
|
|
8
|
+
import Bo from "cross-spawn";
|
|
9
9
|
import { getDatabase as oi } from "firebase-admin/database";
|
|
10
10
|
import { getAuth as Et } from "firebase-admin/auth";
|
|
11
11
|
const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
12
12
|
if (e?.operations)
|
|
13
13
|
return e.operations.includes(n);
|
|
14
|
-
}, qn = (n, e) => e ? e.Role ? n.access?.includes(e.Role) : !1 : !0,
|
|
14
|
+
}, qn = (n, e) => e ? e.Role ? n.access?.includes(e.Role) : !1 : !0, Ho = (n, e) => e ? !e.Role || n.restrictCreate === !0 ? !1 : typeof n.restrictCreate == "object" ? n.restrictCreate?.includes(e.Role) : !0 : !0, ai = (n, e) => e ? !e.Role || n.restrictUpdate === !0 ? !1 : typeof n.restrictUpdate == "object" ? n.restrictUpdate?.includes(e.Role) : !0 : !0, ir = (n, e, t) => {
|
|
15
15
|
const { labels: s } = n;
|
|
16
16
|
return t.collections && // eslint-disable-next-line security/detect-object-injection
|
|
17
17
|
Se("Update", t.collections[s.collection]) && (!e.access || qn(e, t)) && ai(e, t) && !(n.auth && !t.collections?.[s.collection].auth && ["Enabled", "Role", "Name", "Email", "Photo_URL"].includes(e.name));
|
|
@@ -27,7 +27,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
27
27
|
c.role === e.Role && (!c.assignable || d?.active) && s.push(l);
|
|
28
28
|
});
|
|
29
29
|
}), s;
|
|
30
|
-
},
|
|
30
|
+
}, Vs = (n, e) => {
|
|
31
31
|
const t = [], { labels: s, access: r } = n, { entityRestrictions: i } = r, o = e.collections?.[s.collection];
|
|
32
32
|
return i?.restrictions?.forEach((a) => {
|
|
33
33
|
"roles" in a && a.roles.forEach((l) => {
|
|
@@ -62,14 +62,14 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
62
62
|
!i.find((m) => m.field === c.field) && c.roles.includes(t.Role) && i.push(c);
|
|
63
63
|
}
|
|
64
64
|
return i;
|
|
65
|
-
},
|
|
65
|
+
}, Go = (n, e, t, s, r, i, o) => {
|
|
66
66
|
const { fields: a } = e, l = r.collections?.[e.labels.collection];
|
|
67
67
|
let c = !0;
|
|
68
68
|
if (!l) {
|
|
69
69
|
c = !1;
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
const d = li(e, r), m =
|
|
72
|
+
const d = li(e, r), m = Vs(e, r), u = ci(e, t, r);
|
|
73
73
|
d?.filter((E) => E.type === "Record_Owner").forEach((E) => {
|
|
74
74
|
"operations" in E && E.operations && !E.operations.includes(n) || i.Created_By !== s && (c = !1);
|
|
75
75
|
}), d?.filter((E) => E.type === "Record_User").forEach((E) => {
|
|
@@ -97,7 +97,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
97
97
|
const C = U(a, E.collectionField), _ = U(a, E.propertyField);
|
|
98
98
|
Object.entries(l?.parentPropertyEntities || {}).some((z) => {
|
|
99
99
|
const [k, p] = z;
|
|
100
|
-
return k === i[_.name] && i[`${C.name}_Array`].some((
|
|
100
|
+
return k === i[_.name] && i[`${C.name}_Array`].some((F) => p.includes(F));
|
|
101
101
|
}) || (v = !1);
|
|
102
102
|
}), g && y) {
|
|
103
103
|
if (!(f || v)) {
|
|
@@ -134,8 +134,8 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
134
134
|
c = !1;
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
Object.entries(p.parentPropertyEntities || {}).some((
|
|
138
|
-
const [A, j] =
|
|
137
|
+
Object.entries(p.parentPropertyEntities || {}).some((F) => {
|
|
138
|
+
const [A, j] = F;
|
|
139
139
|
return A === i[z.name] && i[`${k.name}_Array`].some((h) => j.includes(h));
|
|
140
140
|
}) || (O = !1);
|
|
141
141
|
}), R && I) {
|
|
@@ -154,14 +154,14 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
154
154
|
if (!a || !r.Role)
|
|
155
155
|
return l = !1, l;
|
|
156
156
|
Se(n, a) || (l = !1);
|
|
157
|
-
const d =
|
|
158
|
-
return n === "Create" && d && (l = !1),
|
|
157
|
+
const d = Vs(e, r)?.filter((m) => m.type === "Individual").length > 0;
|
|
158
|
+
return n === "Create" && d && (l = !1), Go(n, e, t, s, r, i) || (l = !1), l;
|
|
159
159
|
}, di = (n, e, t) => {
|
|
160
160
|
const { labels: s } = n, r = [];
|
|
161
161
|
for (const i of Object.values(e.collections))
|
|
162
162
|
;
|
|
163
163
|
return r;
|
|
164
|
-
},
|
|
164
|
+
}, Yo = (n, e) => {
|
|
165
165
|
let t = !0, s = "";
|
|
166
166
|
return Object.keys(e).forEach((r) => {
|
|
167
167
|
if (!["Doc_ID", "Role", "Collection", "Enabled", "collections"].includes(r)) {
|
|
@@ -248,7 +248,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
250
|
}), s && console.error(`PERMISSION_DENIED: ${s}`)), t;
|
|
251
|
-
},
|
|
251
|
+
}, Jo = (n, e, t) => {
|
|
252
252
|
let s = !0, r = "";
|
|
253
253
|
Object.values(n.collections).filter((i) => i.auth).forEach((i) => {
|
|
254
254
|
if (e.collections?.[i.labels.collection]?.auth && !i.access.auth?.includes(e.Role)) {
|
|
@@ -335,7 +335,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
return r && console.error(`PERMISSION_DENIED: ${r}`), s;
|
|
338
|
-
},
|
|
338
|
+
}, Qo = (n, e, t, s, r, i, o, a, l) => {
|
|
339
339
|
const { access: c } = e, { permissionWriteRestrictions: d } = c;
|
|
340
340
|
let m = !0, u = "";
|
|
341
341
|
const f = d?.filter((g) => s === g.userRole);
|
|
@@ -379,7 +379,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
379
379
|
}
|
|
380
380
|
});
|
|
381
381
|
}), u && console.error(`PERMISSION_DENIED: ${u}`), m);
|
|
382
|
-
},
|
|
382
|
+
}, Ko = (n, e, t, s) => {
|
|
383
383
|
let r = !0, i = "";
|
|
384
384
|
return Object.values(n.collections).forEach((o) => {
|
|
385
385
|
const a = t.collections?.[o.labels.collection], l = s?.collections?.[o.labels.collection], c = e?.collections?.[o.labels.collection];
|
|
@@ -409,7 +409,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
409
409
|
return;
|
|
410
410
|
}
|
|
411
411
|
}), i && console.error(`PERMISSION_DENIED: ${i}`), r;
|
|
412
|
-
},
|
|
412
|
+
}, Us = (n, e, t, s, r, i, o, a, l, c, d) => {
|
|
413
413
|
const { labels: m } = s;
|
|
414
414
|
let u = !0, f = "";
|
|
415
415
|
if (!e.Role)
|
|
@@ -421,7 +421,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
421
421
|
if (i) {
|
|
422
422
|
if (!o?.Role)
|
|
423
423
|
return f = "Current user does not have a role", u = !1, u;
|
|
424
|
-
if (!
|
|
424
|
+
if (!Qo(n, s, r, o.Role, e.Role, a, c, c?.Role, l))
|
|
425
425
|
return u = !1, u;
|
|
426
426
|
if (n === "update" && d !== "delete" && c?.User_ID && e.User_ID !== c.User_ID)
|
|
427
427
|
return f = "User ID does not match original user ID", u = !1, u;
|
|
@@ -430,24 +430,24 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
430
430
|
if (n === "delete" && i === e.User_ID)
|
|
431
431
|
return f = "User cannot delete their own record", u = !1, u;
|
|
432
432
|
}
|
|
433
|
-
return n === "delete" || d === "delete" || !a ? u : a.Role ? (
|
|
434
|
-
},
|
|
433
|
+
return n === "delete" || d === "delete" || !a ? u : a.Role ? (Yo(r, a) || (u = !1), a.Collection && a.Collection !== m.collection ? (f = "Permissions collection does not match record collection", u = !1, u) : a.Role !== e.Role ? (f = "Permissions role does not match record role", u = !1, u) : a.Enabled !== void 0 && !!a.Enabled != !!e.Enabled ? (f = "Permissions enabled state does not match record enabled state", u = !1, u) : a.Doc_ID && a.Doc_ID !== t ? (f = "Permissions doc ID does not match record doc ID", u = !1, u) : !Jo(r, a, a.Role) || i && o && l && !Ko(r, o, a, l) ? (u = !1, u) : (f && console.error(`PERMISSION_DENIED: ${f}`), u)) : (f = "Permissions do not have a role", u = !1, u);
|
|
434
|
+
}, or = (n, e, t, s, r, i, o) => {
|
|
435
435
|
const { labels: a, fields: l } = t, c = i?.collections?.[a.collection];
|
|
436
436
|
let d = !0;
|
|
437
437
|
if (r && !c)
|
|
438
438
|
throw new Error("PERMISSION_DENIED");
|
|
439
439
|
r && !Se("Create", c) && (d = !1), r && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
440
|
-
!lt("Create", t, s, r, i, n) && (d = !1), t.auth && o && (r && !zn(c) && (d = !1),
|
|
440
|
+
!lt("Create", t, s, r, i, n) && (d = !1), t.auth && o && (r && !zn(c) && (d = !1), Us("create", n, e, t, s, r, i, o) || (d = !1));
|
|
441
441
|
for (const m of l) {
|
|
442
442
|
const u = n[m.name];
|
|
443
|
-
m.access && !qn(m, i) && u !== void 0 && (d = !1), u !== void 0 && !
|
|
443
|
+
m.access && !qn(m, i) && u !== void 0 && (d = !1), u !== void 0 && !Ho(m, i) && (d = !1);
|
|
444
444
|
}
|
|
445
445
|
if (!d)
|
|
446
446
|
throw new Error("PERMISSION_DENIED");
|
|
447
447
|
}, Re = (n) => n && (n._methodName === "deleteField" || n.constructor.name === "DeleteTransform"), it = (n) => {
|
|
448
448
|
for (const e in n)
|
|
449
449
|
Object.prototype.hasOwnProperty.call(n, e) && (Re(n[e]) ? delete n[e] : typeof n[e] == "object" && n[e] !== null && it(n[e]));
|
|
450
|
-
},
|
|
450
|
+
}, ar = (n, e, t, s, r, i, o, a, l, c) => {
|
|
451
451
|
const { labels: d, fields: m } = s, u = o?.collections?.[d.collection], f = { ...e, ...n };
|
|
452
452
|
it(f);
|
|
453
453
|
let g = !0, v = "";
|
|
@@ -456,21 +456,21 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
456
456
|
i && !Se("Update", u) && (g = !1, v = "Authenticated user does not have Update access to this collection"), i && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
457
457
|
(!lt("Update", s, r, i, o, e) || // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
458
458
|
!lt("Update", s, r, i, o, f)) && (g = !1, v = "Authenticated user does not have Update access to this document"), i && s.softDelete && f[s.softDelete.archivedField] !== e[s.softDelete.archivedField] && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
459
|
-
!Se("Delete", u) && (g = !1, v = "Authenticated user does not have Delete or Restore access to this document"), a && (i && !zn(u) && (g = !1, v = "Authenticated user does not have Auth access for this collection"),
|
|
459
|
+
!Se("Delete", u) && (g = !1, v = "Authenticated user does not have Delete or Restore access to this document"), a && (i && !zn(u) && (g = !1, v = "Authenticated user does not have Auth access for this collection"), Us("update", f, t, s, r, i, o, l, c, e, a) || (v = "Authenticated user does not have sufficient write access for this record", g = !1));
|
|
460
460
|
for (const y of m) {
|
|
461
461
|
const w = n[y.name];
|
|
462
462
|
y.access && !qn(y, o) && w !== void 0 && (v = `Authenticated user does not have access to field ${y.name}`, g = !1), w !== void 0 && !ai(y, o) && (v = `Authenticated user does not have Update access to field ${y.name}`, g = !1);
|
|
463
463
|
}
|
|
464
464
|
if (!g)
|
|
465
465
|
throw v && console.error(`PERMISSION_DENIED: ${v}`), new Error("PERMISSION_DENIED");
|
|
466
|
-
},
|
|
466
|
+
}, Xo = (n, e, t, s, r, i) => {
|
|
467
467
|
const { labels: o } = t, a = i.collections?.[o.collection];
|
|
468
468
|
let l = !0;
|
|
469
469
|
if (!a)
|
|
470
470
|
throw new Error("PERMISSION_DENIED");
|
|
471
|
-
if (Se("Delete", a) || (l = !1), lt("Delete", t, s, r, i, n) || (l = !1), t.auth && n.User_ID && (zn(a) || (l = !1),
|
|
471
|
+
if (Se("Delete", a) || (l = !1), lt("Delete", t, s, r, i, n) || (l = !1), t.auth && n.User_ID && (zn(a) || (l = !1), Us("delete", n, e, t, s, r, i) || (l = !1)), !l)
|
|
472
472
|
throw new Error("PERMISSION_DENIED");
|
|
473
|
-
},
|
|
473
|
+
}, ea = async (n, e, t, s, r) => {
|
|
474
474
|
const { labels: i } = e, o = r.collections?.[i.collection];
|
|
475
475
|
let a = !0;
|
|
476
476
|
if (!o) {
|
|
@@ -479,7 +479,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
479
479
|
}
|
|
480
480
|
if (Se("Read", o) || (a = !1), lt("Read", e, t, s, r, n) || (a = !1), !a)
|
|
481
481
|
throw new Error("PERMISSION_DENIED");
|
|
482
|
-
},
|
|
482
|
+
}, ta = async (n, e, t, s, r) => {
|
|
483
483
|
const { labels: i } = e, o = r.collections?.[i.collection];
|
|
484
484
|
let a = !0;
|
|
485
485
|
if (!o) {
|
|
@@ -490,10 +490,10 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
490
490
|
lt("Read", e, t, s, r, l) || (a = !1);
|
|
491
491
|
}), !a)
|
|
492
492
|
throw new Error("PERMISSION_DENIED");
|
|
493
|
-
},
|
|
493
|
+
}, na = (n, e, t) => {
|
|
494
494
|
const { access: s } = n;
|
|
495
495
|
return s.operations[t]?.includes(e);
|
|
496
|
-
},
|
|
496
|
+
}, sa = (n, e, t) => {
|
|
497
497
|
const { access: s } = e, { entityRestrictions: r } = s;
|
|
498
498
|
if (r?.restrictions) {
|
|
499
499
|
for (const i of r.restrictions)
|
|
@@ -516,7 +516,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
516
516
|
return `${i.type} parent filter`;
|
|
517
517
|
}
|
|
518
518
|
return !0;
|
|
519
|
-
},
|
|
519
|
+
}, ra = (n, e, t, s, r) => {
|
|
520
520
|
const i = {};
|
|
521
521
|
for (const o of n) {
|
|
522
522
|
const l = e[o].default({ sdk: t, utils: s, context: r });
|
|
@@ -534,7 +534,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
534
534
|
}, Bt = (n, e) => n && typeof n == "function" ? e ? n(...e) : n() : n, ie = async (n, e) => {
|
|
535
535
|
let t = n;
|
|
536
536
|
return n && (typeof n == "function" || typeof n.then == "function") && (e ? t = await n(...e) : t = await n()), t;
|
|
537
|
-
},
|
|
537
|
+
}, uu = async (n, e, t, s) => {
|
|
538
538
|
for (const d of e)
|
|
539
539
|
if (d === "__proto__" || d === "constructor" || d === "prototype")
|
|
540
540
|
throw new Error("Invalid config path: prototype pollution keys are not allowed");
|
|
@@ -692,7 +692,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
692
692
|
break;
|
|
693
693
|
}
|
|
694
694
|
})), [...new Set(t)];
|
|
695
|
-
},
|
|
695
|
+
}, ia = (n, e) => {
|
|
696
696
|
const t = [], { fields: s, roleSystemFields: r, preloadCache: i, queries: o } = n, a = Bn();
|
|
697
697
|
return t.push({
|
|
698
698
|
name: "Collection_Path",
|
|
@@ -710,7 +710,7 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
710
710
|
}), hi(n, e).forEach((c) => {
|
|
711
711
|
wt.includes(c.name) && t.push(U(a, c.name));
|
|
712
712
|
}), [...new Set(t)];
|
|
713
|
-
},
|
|
713
|
+
}, oa = (n, e, t) => {
|
|
714
714
|
const s = [], { fields: r, preloadCache: i } = e, o = Bn();
|
|
715
715
|
i?.range && i.range.fields.forEach((c) => {
|
|
716
716
|
wt.includes(c) ? s.push(U(o, c)) : s.push(U(r, c));
|
|
@@ -751,13 +751,13 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
751
751
|
const l = U(r, i.archivedField);
|
|
752
752
|
l && s.push(l);
|
|
753
753
|
}
|
|
754
|
-
return s.push(...
|
|
754
|
+
return s.push(...oa(n, e, t)), [...new Set(s)];
|
|
755
755
|
}, mi = (n, e) => {
|
|
756
756
|
const { preloadCache: t } = n, s = /* @__PURE__ */ new Set();
|
|
757
757
|
for (const r of e.config.roles) {
|
|
758
|
-
if (!
|
|
758
|
+
if (!na(n, r, "read"))
|
|
759
759
|
continue;
|
|
760
|
-
const i =
|
|
760
|
+
const i = ia(n, r);
|
|
761
761
|
let o = !1;
|
|
762
762
|
if (s.size === 0)
|
|
763
763
|
s.add({ key: "1", roles: [r], fields: i }), o = !0;
|
|
@@ -772,12 +772,12 @@ const zn = (n) => !!n.auth, Se = (n, e) => {
|
|
|
772
772
|
for (const r of s.values())
|
|
773
773
|
if (r.roles.includes(n))
|
|
774
774
|
return r;
|
|
775
|
-
},
|
|
775
|
+
}, aa = (n, e) => {
|
|
776
776
|
const { fields: t } = e, s = Bn(), r = [];
|
|
777
777
|
return [...t, ...s.filter((o) => o.name !== "id")].forEach((o) => {
|
|
778
778
|
n?.fields.some((a) => a.name === o.name) || r.push(o);
|
|
779
779
|
}), r;
|
|
780
|
-
},
|
|
780
|
+
}, Ws = (n, e, t) => {
|
|
781
781
|
const s = {};
|
|
782
782
|
return Object.values(n.collections).forEach((r) => {
|
|
783
783
|
const i = mi(r, n), o = Array.from(i);
|
|
@@ -806,7 +806,7 @@ async function oe(n, e, t, s) {
|
|
|
806
806
|
if (n !== "setEmbedding" && (await ts(n, e?.[n], s), n === "postWriteError"))
|
|
807
807
|
return r;
|
|
808
808
|
}
|
|
809
|
-
const
|
|
809
|
+
const js = (n, e, t, s, r, i, o, a, l, c) => (n === "create" && (t.Collection_Path = e, t.Created_At = a, t.Saved_At = l, t.Created_By = o || "System"), t.Last_Write_App = r, t.Last_Write_At = a, t.Last_Save_At = l, t.Last_Write_By = o || "System", t.Last_Write_Connection_Status = i, t.Last_Write_Version = s.version, t), pt = (n, e) => {
|
|
810
810
|
const { access: t, queries: s } = n, { serverReadOnly: r } = t, i = /* @__PURE__ */ new Set();
|
|
811
811
|
if (s)
|
|
812
812
|
for (const o of s) {
|
|
@@ -853,7 +853,7 @@ const Ws = (n, e, t, s, r, i, o, a, l, c) => (n === "create" && (t.Collection_Pa
|
|
|
853
853
|
vt(n, n.fields).forEach((s) => {
|
|
854
854
|
e[s.name] ? e[`${s.name}_Lowercase`] = e[s.name].toLowerCase() : delete e[`${s.name}_Lowercase`];
|
|
855
855
|
});
|
|
856
|
-
},
|
|
856
|
+
}, la = async (n, e, t, s) => {
|
|
857
857
|
const { fields: r } = e;
|
|
858
858
|
for (const i of t.fields) {
|
|
859
859
|
const o = U(r, i.name);
|
|
@@ -899,14 +899,14 @@ var ne;
|
|
|
899
899
|
}
|
|
900
900
|
n.joinValues = s, n.jsonStringifyReplacer = (r, i) => typeof i == "bigint" ? i.toString() : i;
|
|
901
901
|
})(ne || (ne = {}));
|
|
902
|
-
var
|
|
902
|
+
var lr;
|
|
903
903
|
(function(n) {
|
|
904
904
|
n.mergeShapes = (e, t) => ({
|
|
905
905
|
...e,
|
|
906
906
|
...t
|
|
907
907
|
// second overwrites first
|
|
908
908
|
});
|
|
909
|
-
})(
|
|
909
|
+
})(lr || (lr = {}));
|
|
910
910
|
const V = ne.arrayToEnum([
|
|
911
911
|
"string",
|
|
912
912
|
"nan",
|
|
@@ -1087,11 +1087,11 @@ const ws = (n, e) => {
|
|
|
1087
1087
|
}
|
|
1088
1088
|
return { message: t };
|
|
1089
1089
|
};
|
|
1090
|
-
let
|
|
1091
|
-
function
|
|
1092
|
-
return
|
|
1090
|
+
let ca = ws;
|
|
1091
|
+
function ua() {
|
|
1092
|
+
return ca;
|
|
1093
1093
|
}
|
|
1094
|
-
const
|
|
1094
|
+
const da = (n) => {
|
|
1095
1095
|
const { data: e, path: t, errorMaps: s, issueData: r } = n, i = [...t, ...r.path || []], o = {
|
|
1096
1096
|
...r,
|
|
1097
1097
|
path: i
|
|
@@ -1113,7 +1113,7 @@ const ua = (n) => {
|
|
|
1113
1113
|
};
|
|
1114
1114
|
};
|
|
1115
1115
|
function P(n, e) {
|
|
1116
|
-
const t =
|
|
1116
|
+
const t = ua(), s = da({
|
|
1117
1117
|
issueData: e,
|
|
1118
1118
|
data: n.data,
|
|
1119
1119
|
path: n.path,
|
|
@@ -1173,7 +1173,7 @@ class Ee {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
const J = Object.freeze({
|
|
1175
1175
|
status: "aborted"
|
|
1176
|
-
}), Ht = (n) => ({ status: "dirty", value: n }),
|
|
1176
|
+
}), Ht = (n) => ({ status: "dirty", value: n }), Fe = (n) => ({ status: "valid", value: n }), cr = (n) => n.status === "aborted", ur = (n) => n.status === "dirty", At = (n) => n.status === "valid", Nn = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
1177
1177
|
var W;
|
|
1178
1178
|
(function(n) {
|
|
1179
1179
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
@@ -1186,7 +1186,7 @@ class Ze {
|
|
|
1186
1186
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
1187
1187
|
}
|
|
1188
1188
|
}
|
|
1189
|
-
const
|
|
1189
|
+
const dr = (n, e) => {
|
|
1190
1190
|
if (At(e))
|
|
1191
1191
|
return { success: !0, data: e.value };
|
|
1192
1192
|
if (!n.common.issues.length)
|
|
@@ -1271,7 +1271,7 @@ class ee {
|
|
|
1271
1271
|
data: e,
|
|
1272
1272
|
parsedType: nt(e)
|
|
1273
1273
|
}, r = this._parseSync({ data: e, path: s.path, parent: s });
|
|
1274
|
-
return
|
|
1274
|
+
return dr(s, r);
|
|
1275
1275
|
}
|
|
1276
1276
|
"~validate"(e) {
|
|
1277
1277
|
const t = {
|
|
@@ -1324,7 +1324,7 @@ class ee {
|
|
|
1324
1324
|
data: e,
|
|
1325
1325
|
parsedType: nt(e)
|
|
1326
1326
|
}, r = this._parse({ data: e, path: s.path, parent: s }), i = await (Nn(r) ? r : Promise.resolve(r));
|
|
1327
|
-
return
|
|
1327
|
+
return dr(s, i);
|
|
1328
1328
|
}
|
|
1329
1329
|
refine(e, t) {
|
|
1330
1330
|
const s = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
|
|
@@ -1340,7 +1340,7 @@ class ee {
|
|
|
1340
1340
|
return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
|
|
1341
1341
|
}
|
|
1342
1342
|
_refinement(e) {
|
|
1343
|
-
return new
|
|
1343
|
+
return new $t({
|
|
1344
1344
|
schema: this,
|
|
1345
1345
|
typeName: Y.ZodEffects,
|
|
1346
1346
|
effect: { type: "refinement", refinement: e }
|
|
@@ -1360,7 +1360,7 @@ class ee {
|
|
|
1360
1360
|
return ot.create(this, this._def);
|
|
1361
1361
|
}
|
|
1362
1362
|
nullable() {
|
|
1363
|
-
return
|
|
1363
|
+
return Mt.create(this, this._def);
|
|
1364
1364
|
}
|
|
1365
1365
|
nullish() {
|
|
1366
1366
|
return this.nullable().optional();
|
|
@@ -1369,7 +1369,7 @@ class ee {
|
|
|
1369
1369
|
return We.create(this);
|
|
1370
1370
|
}
|
|
1371
1371
|
promise() {
|
|
1372
|
-
return
|
|
1372
|
+
return $n.create(this, this._def);
|
|
1373
1373
|
}
|
|
1374
1374
|
or(e) {
|
|
1375
1375
|
return An.create([this, e], this._def);
|
|
@@ -1378,7 +1378,7 @@ class ee {
|
|
|
1378
1378
|
return Cn.create(this, e, this._def);
|
|
1379
1379
|
}
|
|
1380
1380
|
transform(e) {
|
|
1381
|
-
return new
|
|
1381
|
+
return new $t({
|
|
1382
1382
|
...K(this._def),
|
|
1383
1383
|
schema: this,
|
|
1384
1384
|
typeName: Y.ZodEffects,
|
|
@@ -1395,7 +1395,7 @@ class ee {
|
|
|
1395
1395
|
});
|
|
1396
1396
|
}
|
|
1397
1397
|
brand() {
|
|
1398
|
-
return new
|
|
1398
|
+
return new Fa({
|
|
1399
1399
|
typeName: Y.ZodBranded,
|
|
1400
1400
|
type: this,
|
|
1401
1401
|
...K(this._def)
|
|
@@ -1418,7 +1418,7 @@ class ee {
|
|
|
1418
1418
|
});
|
|
1419
1419
|
}
|
|
1420
1420
|
pipe(e) {
|
|
1421
|
-
return
|
|
1421
|
+
return Zs.create(this, e);
|
|
1422
1422
|
}
|
|
1423
1423
|
readonly() {
|
|
1424
1424
|
return Ss.create(this);
|
|
@@ -1430,28 +1430,28 @@ class ee {
|
|
|
1430
1430
|
return this.safeParse(null).success;
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
|
-
const
|
|
1433
|
+
const fa = /^c[^\s-]{8,}$/i, ha = /^[0-9a-z]+$/, ma = /^[0-9A-HJKMNP-TV-Z]{26}$/i, pa = /^[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, ya = /^[a-z0-9_-]{21}$/i, ga = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, wa = /^[-+]?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)?)??$/, _a = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ea = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1434
1434
|
let ns;
|
|
1435
|
-
const
|
|
1435
|
+
const va = /^(?:(?: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])$/, Oa = /^(?:(?: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])$/, ka = /^(([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]))$/, ba = /^(([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])$/, Ta = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Sa = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, yi = "((\\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])))", Ra = new RegExp(`^${yi}$`);
|
|
1436
1436
|
function gi(n) {
|
|
1437
1437
|
let e = "[0-5]\\d";
|
|
1438
1438
|
n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
1439
1439
|
const t = n.precision ? "+" : "?";
|
|
1440
1440
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
1441
1441
|
}
|
|
1442
|
-
function
|
|
1442
|
+
function Ia(n) {
|
|
1443
1443
|
return new RegExp(`^${gi(n)}$`);
|
|
1444
1444
|
}
|
|
1445
|
-
function
|
|
1445
|
+
function xa(n) {
|
|
1446
1446
|
let e = `${yi}T${gi(n)}`;
|
|
1447
1447
|
const t = [];
|
|
1448
1448
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1449
1449
|
}
|
|
1450
|
-
function xa(n, e) {
|
|
1451
|
-
return !!((e === "v4" || !e) && Ea.test(n) || (e === "v6" || !e) && Oa.test(n));
|
|
1452
|
-
}
|
|
1453
1450
|
function Na(n, e) {
|
|
1454
|
-
|
|
1451
|
+
return !!((e === "v4" || !e) && va.test(n) || (e === "v6" || !e) && ka.test(n));
|
|
1452
|
+
}
|
|
1453
|
+
function Da(n, e) {
|
|
1454
|
+
if (!ga.test(n))
|
|
1455
1455
|
return !1;
|
|
1456
1456
|
try {
|
|
1457
1457
|
const [t] = n.split(".");
|
|
@@ -1463,8 +1463,8 @@ function Na(n, e) {
|
|
|
1463
1463
|
return !1;
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
|
-
function
|
|
1467
|
-
return !!((e === "v4" || !e) &&
|
|
1466
|
+
function Aa(n, e) {
|
|
1467
|
+
return !!((e === "v4" || !e) && Oa.test(n) || (e === "v6" || !e) && ba.test(n));
|
|
1468
1468
|
}
|
|
1469
1469
|
class Ge extends ee {
|
|
1470
1470
|
_parse(e) {
|
|
@@ -1515,43 +1515,43 @@ class Ge extends ee {
|
|
|
1515
1515
|
message: i.message
|
|
1516
1516
|
}), s.dirty());
|
|
1517
1517
|
} else if (i.kind === "email")
|
|
1518
|
-
|
|
1518
|
+
_a.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1519
1519
|
validation: "email",
|
|
1520
1520
|
code: D.invalid_string,
|
|
1521
1521
|
message: i.message
|
|
1522
1522
|
}), s.dirty());
|
|
1523
1523
|
else if (i.kind === "emoji")
|
|
1524
|
-
ns || (ns = new RegExp(
|
|
1524
|
+
ns || (ns = new RegExp(Ea, "u")), ns.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1525
1525
|
validation: "emoji",
|
|
1526
1526
|
code: D.invalid_string,
|
|
1527
1527
|
message: i.message
|
|
1528
1528
|
}), s.dirty());
|
|
1529
1529
|
else if (i.kind === "uuid")
|
|
1530
|
-
|
|
1530
|
+
pa.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1531
1531
|
validation: "uuid",
|
|
1532
1532
|
code: D.invalid_string,
|
|
1533
1533
|
message: i.message
|
|
1534
1534
|
}), s.dirty());
|
|
1535
1535
|
else if (i.kind === "nanoid")
|
|
1536
|
-
|
|
1536
|
+
ya.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1537
1537
|
validation: "nanoid",
|
|
1538
1538
|
code: D.invalid_string,
|
|
1539
1539
|
message: i.message
|
|
1540
1540
|
}), s.dirty());
|
|
1541
1541
|
else if (i.kind === "cuid")
|
|
1542
|
-
|
|
1542
|
+
fa.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1543
1543
|
validation: "cuid",
|
|
1544
1544
|
code: D.invalid_string,
|
|
1545
1545
|
message: i.message
|
|
1546
1546
|
}), s.dirty());
|
|
1547
1547
|
else if (i.kind === "cuid2")
|
|
1548
|
-
|
|
1548
|
+
ha.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1549
1549
|
validation: "cuid2",
|
|
1550
1550
|
code: D.invalid_string,
|
|
1551
1551
|
message: i.message
|
|
1552
1552
|
}), s.dirty());
|
|
1553
1553
|
else if (i.kind === "ulid")
|
|
1554
|
-
|
|
1554
|
+
ma.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1555
1555
|
validation: "ulid",
|
|
1556
1556
|
code: D.invalid_string,
|
|
1557
1557
|
message: i.message
|
|
@@ -1582,39 +1582,39 @@ class Ge extends ee {
|
|
|
1582
1582
|
code: D.invalid_string,
|
|
1583
1583
|
validation: { endsWith: i.value },
|
|
1584
1584
|
message: i.message
|
|
1585
|
-
}), s.dirty()) : i.kind === "datetime" ?
|
|
1585
|
+
}), s.dirty()) : i.kind === "datetime" ? xa(i).test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1586
1586
|
code: D.invalid_string,
|
|
1587
1587
|
validation: "datetime",
|
|
1588
1588
|
message: i.message
|
|
1589
|
-
}), s.dirty()) : i.kind === "date" ?
|
|
1589
|
+
}), s.dirty()) : i.kind === "date" ? Ra.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1590
1590
|
code: D.invalid_string,
|
|
1591
1591
|
validation: "date",
|
|
1592
1592
|
message: i.message
|
|
1593
|
-
}), s.dirty()) : i.kind === "time" ?
|
|
1593
|
+
}), s.dirty()) : i.kind === "time" ? Ia(i).test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1594
1594
|
code: D.invalid_string,
|
|
1595
1595
|
validation: "time",
|
|
1596
1596
|
message: i.message
|
|
1597
|
-
}), s.dirty()) : i.kind === "duration" ?
|
|
1597
|
+
}), s.dirty()) : i.kind === "duration" ? wa.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1598
1598
|
validation: "duration",
|
|
1599
1599
|
code: D.invalid_string,
|
|
1600
1600
|
message: i.message
|
|
1601
|
-
}), s.dirty()) : i.kind === "ip" ?
|
|
1601
|
+
}), s.dirty()) : i.kind === "ip" ? Na(e.data, i.version) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1602
1602
|
validation: "ip",
|
|
1603
1603
|
code: D.invalid_string,
|
|
1604
1604
|
message: i.message
|
|
1605
|
-
}), s.dirty()) : i.kind === "jwt" ?
|
|
1605
|
+
}), s.dirty()) : i.kind === "jwt" ? Da(e.data, i.alg) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1606
1606
|
validation: "jwt",
|
|
1607
1607
|
code: D.invalid_string,
|
|
1608
1608
|
message: i.message
|
|
1609
|
-
}), s.dirty()) : i.kind === "cidr" ?
|
|
1609
|
+
}), s.dirty()) : i.kind === "cidr" ? Aa(e.data, i.version) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1610
1610
|
validation: "cidr",
|
|
1611
1611
|
code: D.invalid_string,
|
|
1612
1612
|
message: i.message
|
|
1613
|
-
}), s.dirty()) : i.kind === "base64" ?
|
|
1613
|
+
}), s.dirty()) : i.kind === "base64" ? Ta.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1614
1614
|
validation: "base64",
|
|
1615
1615
|
code: D.invalid_string,
|
|
1616
1616
|
message: i.message
|
|
1617
|
-
}), s.dirty()) : i.kind === "base64url" ?
|
|
1617
|
+
}), s.dirty()) : i.kind === "base64url" ? Sa.test(e.data) || (r = this._getOrReturnCtx(e, r), P(r, {
|
|
1618
1618
|
validation: "base64url",
|
|
1619
1619
|
code: D.invalid_string,
|
|
1620
1620
|
message: i.message
|
|
@@ -1849,7 +1849,7 @@ Ge.create = (n) => new Ge({
|
|
|
1849
1849
|
coerce: n?.coerce ?? !1,
|
|
1850
1850
|
...K(n)
|
|
1851
1851
|
});
|
|
1852
|
-
function
|
|
1852
|
+
function Ca(n, e) {
|
|
1853
1853
|
const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, i = Number.parseInt(n.toFixed(r).replace(".", "")), o = Number.parseInt(e.toFixed(r).replace(".", ""));
|
|
1854
1854
|
return i % o / 10 ** r;
|
|
1855
1855
|
}
|
|
@@ -1888,7 +1888,7 @@ class Ct extends ee {
|
|
|
1888
1888
|
inclusive: i.inclusive,
|
|
1889
1889
|
exact: !1,
|
|
1890
1890
|
message: i.message
|
|
1891
|
-
}), r.dirty()) : i.kind === "multipleOf" ?
|
|
1891
|
+
}), r.dirty()) : i.kind === "multipleOf" ? Ca(e.data, i.value) !== 0 && (s = this._getOrReturnCtx(e, s), P(s, {
|
|
1892
1892
|
code: D.not_multiple_of,
|
|
1893
1893
|
multipleOf: i.value,
|
|
1894
1894
|
message: i.message
|
|
@@ -2168,7 +2168,7 @@ class _s extends ee {
|
|
|
2168
2168
|
received: s.parsedType
|
|
2169
2169
|
}), J;
|
|
2170
2170
|
}
|
|
2171
|
-
return
|
|
2171
|
+
return Fe(e.data);
|
|
2172
2172
|
}
|
|
2173
2173
|
}
|
|
2174
2174
|
_s.create = (n) => new _s({
|
|
@@ -2254,7 +2254,7 @@ Dn.create = (n) => new Dn({
|
|
|
2254
2254
|
typeName: Y.ZodDate,
|
|
2255
2255
|
...K(n)
|
|
2256
2256
|
});
|
|
2257
|
-
class
|
|
2257
|
+
class fr extends ee {
|
|
2258
2258
|
_parse(e) {
|
|
2259
2259
|
if (this._getType(e) !== V.symbol) {
|
|
2260
2260
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2264,10 +2264,10 @@ class dr extends ee {
|
|
|
2264
2264
|
received: s.parsedType
|
|
2265
2265
|
}), J;
|
|
2266
2266
|
}
|
|
2267
|
-
return
|
|
2267
|
+
return Fe(e.data);
|
|
2268
2268
|
}
|
|
2269
2269
|
}
|
|
2270
|
-
|
|
2270
|
+
fr.create = (n) => new fr({
|
|
2271
2271
|
typeName: Y.ZodSymbol,
|
|
2272
2272
|
...K(n)
|
|
2273
2273
|
});
|
|
@@ -2281,14 +2281,14 @@ class Es extends ee {
|
|
|
2281
2281
|
received: s.parsedType
|
|
2282
2282
|
}), J;
|
|
2283
2283
|
}
|
|
2284
|
-
return
|
|
2284
|
+
return Fe(e.data);
|
|
2285
2285
|
}
|
|
2286
2286
|
}
|
|
2287
2287
|
Es.create = (n) => new Es({
|
|
2288
2288
|
typeName: Y.ZodUndefined,
|
|
2289
2289
|
...K(n)
|
|
2290
2290
|
});
|
|
2291
|
-
class
|
|
2291
|
+
class hr extends ee {
|
|
2292
2292
|
_parse(e) {
|
|
2293
2293
|
if (this._getType(e) !== V.null) {
|
|
2294
2294
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2298,10 +2298,10 @@ class fr extends ee {
|
|
|
2298
2298
|
received: s.parsedType
|
|
2299
2299
|
}), J;
|
|
2300
2300
|
}
|
|
2301
|
-
return
|
|
2301
|
+
return Fe(e.data);
|
|
2302
2302
|
}
|
|
2303
2303
|
}
|
|
2304
|
-
|
|
2304
|
+
hr.create = (n) => new hr({
|
|
2305
2305
|
typeName: Y.ZodNull,
|
|
2306
2306
|
...K(n)
|
|
2307
2307
|
});
|
|
@@ -2310,22 +2310,22 @@ class vs extends ee {
|
|
|
2310
2310
|
super(...arguments), this._any = !0;
|
|
2311
2311
|
}
|
|
2312
2312
|
_parse(e) {
|
|
2313
|
-
return
|
|
2313
|
+
return Fe(e.data);
|
|
2314
2314
|
}
|
|
2315
2315
|
}
|
|
2316
2316
|
vs.create = (n) => new vs({
|
|
2317
2317
|
typeName: Y.ZodAny,
|
|
2318
2318
|
...K(n)
|
|
2319
2319
|
});
|
|
2320
|
-
class
|
|
2320
|
+
class mr extends ee {
|
|
2321
2321
|
constructor() {
|
|
2322
2322
|
super(...arguments), this._unknown = !0;
|
|
2323
2323
|
}
|
|
2324
2324
|
_parse(e) {
|
|
2325
|
-
return
|
|
2325
|
+
return Fe(e.data);
|
|
2326
2326
|
}
|
|
2327
2327
|
}
|
|
2328
|
-
|
|
2328
|
+
mr.create = (n) => new mr({
|
|
2329
2329
|
typeName: Y.ZodUnknown,
|
|
2330
2330
|
...K(n)
|
|
2331
2331
|
});
|
|
@@ -2343,7 +2343,7 @@ ct.create = (n) => new ct({
|
|
|
2343
2343
|
typeName: Y.ZodNever,
|
|
2344
2344
|
...K(n)
|
|
2345
2345
|
});
|
|
2346
|
-
class
|
|
2346
|
+
class pr extends ee {
|
|
2347
2347
|
_parse(e) {
|
|
2348
2348
|
if (this._getType(e) !== V.undefined) {
|
|
2349
2349
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2353,10 +2353,10 @@ class mr extends ee {
|
|
|
2353
2353
|
received: s.parsedType
|
|
2354
2354
|
}), J;
|
|
2355
2355
|
}
|
|
2356
|
-
return
|
|
2356
|
+
return Fe(e.data);
|
|
2357
2357
|
}
|
|
2358
2358
|
}
|
|
2359
|
-
|
|
2359
|
+
pr.create = (n) => new pr({
|
|
2360
2360
|
typeName: Y.ZodVoid,
|
|
2361
2361
|
...K(n)
|
|
2362
2362
|
});
|
|
@@ -2447,7 +2447,7 @@ function Rt(n) {
|
|
|
2447
2447
|
} else return n instanceof We ? new We({
|
|
2448
2448
|
...n._def,
|
|
2449
2449
|
type: Rt(n.element)
|
|
2450
|
-
}) : n instanceof ot ? ot.create(Rt(n.unwrap())) : n instanceof
|
|
2450
|
+
}) : n instanceof ot ? ot.create(Rt(n.unwrap())) : n instanceof Mt ? Mt.create(Rt(n.unwrap())) : n instanceof _t ? _t.create(n.items.map((e) => Rt(e))) : n;
|
|
2451
2451
|
}
|
|
2452
2452
|
class ue extends ee {
|
|
2453
2453
|
constructor() {
|
|
@@ -2838,10 +2838,10 @@ function Os(n, e) {
|
|
|
2838
2838
|
class Cn extends ee {
|
|
2839
2839
|
_parse(e) {
|
|
2840
2840
|
const { status: t, ctx: s } = this._processInputParams(e), r = (i, o) => {
|
|
2841
|
-
if (
|
|
2841
|
+
if (cr(i) || cr(o))
|
|
2842
2842
|
return J;
|
|
2843
2843
|
const a = Os(i.value, o.value);
|
|
2844
|
-
return a.valid ? ((
|
|
2844
|
+
return a.valid ? ((ur(i) || ur(o)) && t.dirty(), { status: t.value, value: a.data }) : (P(s, {
|
|
2845
2845
|
code: D.invalid_intersection_types
|
|
2846
2846
|
}), J);
|
|
2847
2847
|
};
|
|
@@ -2923,7 +2923,7 @@ _t.create = (n, e) => {
|
|
|
2923
2923
|
...K(e)
|
|
2924
2924
|
});
|
|
2925
2925
|
};
|
|
2926
|
-
class
|
|
2926
|
+
class Fn extends ee {
|
|
2927
2927
|
get keySchema() {
|
|
2928
2928
|
return this._def.keyType;
|
|
2929
2929
|
}
|
|
@@ -2951,12 +2951,12 @@ class $n extends ee {
|
|
|
2951
2951
|
return this._def.valueType;
|
|
2952
2952
|
}
|
|
2953
2953
|
static create(e, t, s) {
|
|
2954
|
-
return t instanceof ee ? new
|
|
2954
|
+
return t instanceof ee ? new Fn({
|
|
2955
2955
|
keyType: e,
|
|
2956
2956
|
valueType: t,
|
|
2957
2957
|
typeName: Y.ZodRecord,
|
|
2958
2958
|
...K(s)
|
|
2959
|
-
}) : new
|
|
2959
|
+
}) : new Fn({
|
|
2960
2960
|
keyType: Ge.create(),
|
|
2961
2961
|
valueType: e,
|
|
2962
2962
|
typeName: Y.ZodRecord,
|
|
@@ -2964,7 +2964,7 @@ class $n extends ee {
|
|
|
2964
2964
|
});
|
|
2965
2965
|
}
|
|
2966
2966
|
}
|
|
2967
|
-
class
|
|
2967
|
+
class yr extends ee {
|
|
2968
2968
|
get keySchema() {
|
|
2969
2969
|
return this._def.keyType;
|
|
2970
2970
|
}
|
|
@@ -3006,7 +3006,7 @@ class pr extends ee {
|
|
|
3006
3006
|
}
|
|
3007
3007
|
}
|
|
3008
3008
|
}
|
|
3009
|
-
|
|
3009
|
+
yr.create = (n, e, t) => new yr({
|
|
3010
3010
|
valueType: e,
|
|
3011
3011
|
keyType: n,
|
|
3012
3012
|
typeName: Y.ZodMap,
|
|
@@ -3076,7 +3076,7 @@ nn.create = (n, e) => new nn({
|
|
|
3076
3076
|
typeName: Y.ZodSet,
|
|
3077
3077
|
...K(e)
|
|
3078
3078
|
});
|
|
3079
|
-
class
|
|
3079
|
+
class gr extends ee {
|
|
3080
3080
|
get schema() {
|
|
3081
3081
|
return this._def.getter();
|
|
3082
3082
|
}
|
|
@@ -3085,7 +3085,7 @@ class yr extends ee {
|
|
|
3085
3085
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3086
3086
|
}
|
|
3087
3087
|
}
|
|
3088
|
-
|
|
3088
|
+
gr.create = (n, e) => new gr({
|
|
3089
3089
|
getter: n,
|
|
3090
3090
|
typeName: Y.ZodLazy,
|
|
3091
3091
|
...K(e)
|
|
@@ -3112,13 +3112,13 @@ ks.create = (n, e) => new ks({
|
|
|
3112
3112
|
...K(e)
|
|
3113
3113
|
});
|
|
3114
3114
|
function wi(n, e) {
|
|
3115
|
-
return new
|
|
3115
|
+
return new Ft({
|
|
3116
3116
|
values: n,
|
|
3117
3117
|
typeName: Y.ZodEnum,
|
|
3118
3118
|
...K(e)
|
|
3119
3119
|
});
|
|
3120
3120
|
}
|
|
3121
|
-
class
|
|
3121
|
+
class Ft extends ee {
|
|
3122
3122
|
_parse(e) {
|
|
3123
3123
|
if (typeof e.data != "string") {
|
|
3124
3124
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
@@ -3136,7 +3136,7 @@ class $t extends ee {
|
|
|
3136
3136
|
options: s
|
|
3137
3137
|
}), J;
|
|
3138
3138
|
}
|
|
3139
|
-
return
|
|
3139
|
+
return Fe(e.data);
|
|
3140
3140
|
}
|
|
3141
3141
|
get options() {
|
|
3142
3142
|
return this._def.values;
|
|
@@ -3160,20 +3160,20 @@ class $t extends ee {
|
|
|
3160
3160
|
return e;
|
|
3161
3161
|
}
|
|
3162
3162
|
extract(e, t = this._def) {
|
|
3163
|
-
return
|
|
3163
|
+
return Ft.create(e, {
|
|
3164
3164
|
...this._def,
|
|
3165
3165
|
...t
|
|
3166
3166
|
});
|
|
3167
3167
|
}
|
|
3168
3168
|
exclude(e, t = this._def) {
|
|
3169
|
-
return
|
|
3169
|
+
return Ft.create(this.options.filter((s) => !e.includes(s)), {
|
|
3170
3170
|
...this._def,
|
|
3171
3171
|
...t
|
|
3172
3172
|
});
|
|
3173
3173
|
}
|
|
3174
3174
|
}
|
|
3175
|
-
|
|
3176
|
-
class
|
|
3175
|
+
Ft.create = wi;
|
|
3176
|
+
class wr extends ee {
|
|
3177
3177
|
_parse(e) {
|
|
3178
3178
|
const t = ne.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3179
3179
|
if (s.parsedType !== V.string && s.parsedType !== V.number) {
|
|
@@ -3192,18 +3192,18 @@ class gr extends ee {
|
|
|
3192
3192
|
options: r
|
|
3193
3193
|
}), J;
|
|
3194
3194
|
}
|
|
3195
|
-
return
|
|
3195
|
+
return Fe(e.data);
|
|
3196
3196
|
}
|
|
3197
3197
|
get enum() {
|
|
3198
3198
|
return this._def.values;
|
|
3199
3199
|
}
|
|
3200
3200
|
}
|
|
3201
|
-
|
|
3201
|
+
wr.create = (n, e) => new wr({
|
|
3202
3202
|
values: n,
|
|
3203
3203
|
typeName: Y.ZodNativeEnum,
|
|
3204
3204
|
...K(e)
|
|
3205
3205
|
});
|
|
3206
|
-
class
|
|
3206
|
+
class $n extends ee {
|
|
3207
3207
|
unwrap() {
|
|
3208
3208
|
return this._def.type;
|
|
3209
3209
|
}
|
|
@@ -3216,18 +3216,18 @@ class Mn extends ee {
|
|
|
3216
3216
|
received: t.parsedType
|
|
3217
3217
|
}), J;
|
|
3218
3218
|
const s = t.parsedType === V.promise ? t.data : Promise.resolve(t.data);
|
|
3219
|
-
return
|
|
3219
|
+
return Fe(s.then((r) => this._def.type.parseAsync(r, {
|
|
3220
3220
|
path: t.path,
|
|
3221
3221
|
errorMap: t.common.contextualErrorMap
|
|
3222
3222
|
})));
|
|
3223
3223
|
}
|
|
3224
3224
|
}
|
|
3225
|
-
|
|
3225
|
+
$n.create = (n, e) => new $n({
|
|
3226
3226
|
type: n,
|
|
3227
3227
|
typeName: Y.ZodPromise,
|
|
3228
3228
|
...K(e)
|
|
3229
3229
|
});
|
|
3230
|
-
class
|
|
3230
|
+
class $t extends ee {
|
|
3231
3231
|
innerType() {
|
|
3232
3232
|
return this._def.schema;
|
|
3233
3233
|
}
|
|
@@ -3307,13 +3307,13 @@ class Mt extends ee {
|
|
|
3307
3307
|
ne.assertNever(r);
|
|
3308
3308
|
}
|
|
3309
3309
|
}
|
|
3310
|
-
|
|
3310
|
+
$t.create = (n, e, t) => new $t({
|
|
3311
3311
|
schema: n,
|
|
3312
3312
|
typeName: Y.ZodEffects,
|
|
3313
3313
|
effect: e,
|
|
3314
3314
|
...K(t)
|
|
3315
3315
|
});
|
|
3316
|
-
|
|
3316
|
+
$t.createWithPreprocess = (n, e, t) => new $t({
|
|
3317
3317
|
schema: e,
|
|
3318
3318
|
effect: { type: "preprocess", transform: n },
|
|
3319
3319
|
typeName: Y.ZodEffects,
|
|
@@ -3321,7 +3321,7 @@ Mt.createWithPreprocess = (n, e, t) => new Mt({
|
|
|
3321
3321
|
});
|
|
3322
3322
|
class ot extends ee {
|
|
3323
3323
|
_parse(e) {
|
|
3324
|
-
return this._getType(e) === V.undefined ?
|
|
3324
|
+
return this._getType(e) === V.undefined ? Fe(void 0) : this._def.innerType._parse(e);
|
|
3325
3325
|
}
|
|
3326
3326
|
unwrap() {
|
|
3327
3327
|
return this._def.innerType;
|
|
@@ -3332,15 +3332,15 @@ ot.create = (n, e) => new ot({
|
|
|
3332
3332
|
typeName: Y.ZodOptional,
|
|
3333
3333
|
...K(e)
|
|
3334
3334
|
});
|
|
3335
|
-
class
|
|
3335
|
+
class Mt extends ee {
|
|
3336
3336
|
_parse(e) {
|
|
3337
|
-
return this._getType(e) === V.null ?
|
|
3337
|
+
return this._getType(e) === V.null ? Fe(null) : this._def.innerType._parse(e);
|
|
3338
3338
|
}
|
|
3339
3339
|
unwrap() {
|
|
3340
3340
|
return this._def.innerType;
|
|
3341
3341
|
}
|
|
3342
3342
|
}
|
|
3343
|
-
|
|
3343
|
+
Mt.create = (n, e) => new Mt({
|
|
3344
3344
|
innerType: n,
|
|
3345
3345
|
typeName: Y.ZodNullable,
|
|
3346
3346
|
...K(e)
|
|
@@ -3408,7 +3408,7 @@ Ts.create = (n, e) => new Ts({
|
|
|
3408
3408
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3409
3409
|
...K(e)
|
|
3410
3410
|
});
|
|
3411
|
-
class
|
|
3411
|
+
class _r extends ee {
|
|
3412
3412
|
_parse(e) {
|
|
3413
3413
|
if (this._getType(e) !== V.nan) {
|
|
3414
3414
|
const s = this._getOrReturnCtx(e);
|
|
@@ -3421,11 +3421,11 @@ class wr extends ee {
|
|
|
3421
3421
|
return { status: "valid", value: e.data };
|
|
3422
3422
|
}
|
|
3423
3423
|
}
|
|
3424
|
-
|
|
3424
|
+
_r.create = (n) => new _r({
|
|
3425
3425
|
typeName: Y.ZodNaN,
|
|
3426
3426
|
...K(n)
|
|
3427
3427
|
});
|
|
3428
|
-
class
|
|
3428
|
+
class Fa extends ee {
|
|
3429
3429
|
_parse(e) {
|
|
3430
3430
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3431
3431
|
return this._def.type._parse({
|
|
@@ -3438,7 +3438,7 @@ class Ca extends ee {
|
|
|
3438
3438
|
return this._def.type;
|
|
3439
3439
|
}
|
|
3440
3440
|
}
|
|
3441
|
-
class
|
|
3441
|
+
class Zs extends ee {
|
|
3442
3442
|
_parse(e) {
|
|
3443
3443
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3444
3444
|
if (s.common.async)
|
|
@@ -3471,7 +3471,7 @@ class js extends ee {
|
|
|
3471
3471
|
}
|
|
3472
3472
|
}
|
|
3473
3473
|
static create(e, t) {
|
|
3474
|
-
return new
|
|
3474
|
+
return new Zs({
|
|
3475
3475
|
in: e,
|
|
3476
3476
|
out: t,
|
|
3477
3477
|
typeName: Y.ZodPipeline
|
|
@@ -3501,13 +3501,13 @@ ct.create;
|
|
|
3501
3501
|
const Ot = We.create, je = ue.create, ke = An.create;
|
|
3502
3502
|
Cn.create;
|
|
3503
3503
|
_t.create;
|
|
3504
|
-
const on =
|
|
3505
|
-
|
|
3504
|
+
const on = Fn.create, be = ks.create, Mn = Ft.create;
|
|
3505
|
+
$n.create;
|
|
3506
3506
|
ot.create;
|
|
3507
|
-
|
|
3507
|
+
Mt.create;
|
|
3508
3508
|
const En = () => pe().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds !== void 0 || n._seconds !== void 0 && n._nanoseconds !== void 0), {
|
|
3509
3509
|
message: "Value is not a valid timestamp"
|
|
3510
|
-
}),
|
|
3510
|
+
}), Er = () => pe().refine((n) => n && (n._methodName === "serverTimestamp" || n.constructor.name === "ServerTimestampTransform"), {
|
|
3511
3511
|
message: "Value is not a valid server timestamp"
|
|
3512
3512
|
}), _i = (n, e, t) => {
|
|
3513
3513
|
const s = {};
|
|
@@ -3541,9 +3541,9 @@ const En = () => pe().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3541
3541
|
if (i = Te(), e.length && (i = i.length(e.length)), e.minlength && (i = i.min(e.minlength)), e.maxlength && (i = i.max(e.maxlength)), e.email && (i = i.email()), e.uuid && (i = i.uuid()), e.url && (i = i.url()), e.emoji && (i = i.emoji()), e.ip && (i = i.ip()), e.pattern && (i = i.regex(new RegExp(e.pattern))), t && (i = i.toLowerCase()), e.values)
|
|
3542
3542
|
if (t) {
|
|
3543
3543
|
const o = e.values.map((a) => a.toLowerCase());
|
|
3544
|
-
i =
|
|
3544
|
+
i = Mn(o);
|
|
3545
3545
|
} else
|
|
3546
|
-
i =
|
|
3546
|
+
i = Mn(e.values);
|
|
3547
3547
|
break;
|
|
3548
3548
|
case "Boolean":
|
|
3549
3549
|
i = Xt();
|
|
@@ -3582,20 +3582,20 @@ const En = () => pe().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3582
3582
|
break;
|
|
3583
3583
|
}
|
|
3584
3584
|
return !X(e) && e.nullable && (i = i.nullable()), e.required || (i = i.optional()), i;
|
|
3585
|
-
},
|
|
3585
|
+
}, Pa = (n, e, t) => {
|
|
3586
3586
|
const s = {
|
|
3587
3587
|
Collection_Path: Ot(Te()),
|
|
3588
3588
|
Last_Write_App: Te(),
|
|
3589
3589
|
Last_Write_At: En(),
|
|
3590
|
-
Last_Save_At:
|
|
3590
|
+
Last_Save_At: Er(),
|
|
3591
3591
|
Last_Write_By: ke([Te().length(28), be("System")]),
|
|
3592
|
-
Last_Write_Connection_Status:
|
|
3592
|
+
Last_Write_Connection_Status: Mn(["Online", "Offline"]),
|
|
3593
3593
|
Last_Write_Version: yt().int(),
|
|
3594
3594
|
id: Te().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),
|
|
3595
3595
|
Created_At: En(),
|
|
3596
3596
|
Created_By: ke([Te().length(28), be("System")])
|
|
3597
3597
|
};
|
|
3598
|
-
n === "create" && (s.Saved_At =
|
|
3598
|
+
n === "create" && (s.Saved_At = Er()), n === "update" && (s.Saved_At = En(), 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());
|
|
3599
3599
|
const r = pt(e, e.fields), i = Array.from(r).map((l) => l.name);
|
|
3600
3600
|
e.fields.forEach((l) => {
|
|
3601
3601
|
X(l) ? (s[l.name] = $a(l, t), s[`${l.name}_Array`] = Ma(l), i.includes(l.name) && (s[`${l.name}_Single`] = _i(l, t, !0), l.required || (s[`${l.name}_Single`] = s[`${l.name}_Single`].optional())), l.length && (s[l.name] = s[l.name].refine((c) => l.length && c && Object.keys(c).length === l.length, {
|
|
@@ -3613,17 +3613,17 @@ const En = () => pe().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds
|
|
|
3613
3613
|
};
|
|
3614
3614
|
class kt extends Error {
|
|
3615
3615
|
}
|
|
3616
|
-
class
|
|
3616
|
+
class La extends kt {
|
|
3617
3617
|
constructor(e) {
|
|
3618
3618
|
super(`Invalid DateTime: ${e.toMessage()}`);
|
|
3619
3619
|
}
|
|
3620
3620
|
}
|
|
3621
|
-
class
|
|
3621
|
+
class Va extends kt {
|
|
3622
3622
|
constructor(e) {
|
|
3623
3623
|
super(`Invalid Interval: ${e.toMessage()}`);
|
|
3624
3624
|
}
|
|
3625
3625
|
}
|
|
3626
|
-
class
|
|
3626
|
+
class Ua extends kt {
|
|
3627
3627
|
constructor(e) {
|
|
3628
3628
|
super(`Invalid Duration: ${e.toMessage()}`);
|
|
3629
3629
|
}
|
|
@@ -3642,130 +3642,130 @@ class tt extends kt {
|
|
|
3642
3642
|
super("Zone is an abstract class");
|
|
3643
3643
|
}
|
|
3644
3644
|
}
|
|
3645
|
-
const
|
|
3646
|
-
year:
|
|
3647
|
-
month:
|
|
3648
|
-
day:
|
|
3645
|
+
const $ = "numeric", Le = "short", Ie = "long", Ln = {
|
|
3646
|
+
year: $,
|
|
3647
|
+
month: $,
|
|
3648
|
+
day: $
|
|
3649
3649
|
}, vi = {
|
|
3650
|
-
year:
|
|
3650
|
+
year: $,
|
|
3651
3651
|
month: Le,
|
|
3652
|
-
day:
|
|
3653
|
-
},
|
|
3654
|
-
year:
|
|
3652
|
+
day: $
|
|
3653
|
+
}, Wa = {
|
|
3654
|
+
year: $,
|
|
3655
3655
|
month: Le,
|
|
3656
|
-
day:
|
|
3656
|
+
day: $,
|
|
3657
3657
|
weekday: Le
|
|
3658
3658
|
}, Oi = {
|
|
3659
|
-
year:
|
|
3659
|
+
year: $,
|
|
3660
3660
|
month: Ie,
|
|
3661
|
-
day:
|
|
3661
|
+
day: $
|
|
3662
3662
|
}, ki = {
|
|
3663
|
-
year:
|
|
3663
|
+
year: $,
|
|
3664
3664
|
month: Ie,
|
|
3665
|
-
day:
|
|
3665
|
+
day: $,
|
|
3666
3666
|
weekday: Ie
|
|
3667
3667
|
}, bi = {
|
|
3668
|
-
hour:
|
|
3669
|
-
minute:
|
|
3668
|
+
hour: $,
|
|
3669
|
+
minute: $
|
|
3670
3670
|
}, Ti = {
|
|
3671
|
-
hour:
|
|
3672
|
-
minute:
|
|
3673
|
-
second:
|
|
3671
|
+
hour: $,
|
|
3672
|
+
minute: $,
|
|
3673
|
+
second: $
|
|
3674
3674
|
}, Si = {
|
|
3675
|
-
hour:
|
|
3676
|
-
minute:
|
|
3677
|
-
second:
|
|
3675
|
+
hour: $,
|
|
3676
|
+
minute: $,
|
|
3677
|
+
second: $,
|
|
3678
3678
|
timeZoneName: Le
|
|
3679
3679
|
}, Ri = {
|
|
3680
|
-
hour:
|
|
3681
|
-
minute:
|
|
3682
|
-
second:
|
|
3680
|
+
hour: $,
|
|
3681
|
+
minute: $,
|
|
3682
|
+
second: $,
|
|
3683
3683
|
timeZoneName: Ie
|
|
3684
3684
|
}, Ii = {
|
|
3685
|
-
hour:
|
|
3686
|
-
minute:
|
|
3685
|
+
hour: $,
|
|
3686
|
+
minute: $,
|
|
3687
3687
|
hourCycle: "h23"
|
|
3688
3688
|
}, xi = {
|
|
3689
|
-
hour:
|
|
3690
|
-
minute:
|
|
3691
|
-
second:
|
|
3689
|
+
hour: $,
|
|
3690
|
+
minute: $,
|
|
3691
|
+
second: $,
|
|
3692
3692
|
hourCycle: "h23"
|
|
3693
3693
|
}, Ni = {
|
|
3694
|
-
hour:
|
|
3695
|
-
minute:
|
|
3696
|
-
second:
|
|
3694
|
+
hour: $,
|
|
3695
|
+
minute: $,
|
|
3696
|
+
second: $,
|
|
3697
3697
|
hourCycle: "h23",
|
|
3698
3698
|
timeZoneName: Le
|
|
3699
3699
|
}, Di = {
|
|
3700
|
-
hour:
|
|
3701
|
-
minute:
|
|
3702
|
-
second:
|
|
3700
|
+
hour: $,
|
|
3701
|
+
minute: $,
|
|
3702
|
+
second: $,
|
|
3703
3703
|
hourCycle: "h23",
|
|
3704
3704
|
timeZoneName: Ie
|
|
3705
3705
|
}, Ai = {
|
|
3706
|
-
year:
|
|
3707
|
-
month:
|
|
3708
|
-
day:
|
|
3709
|
-
hour:
|
|
3710
|
-
minute:
|
|
3706
|
+
year: $,
|
|
3707
|
+
month: $,
|
|
3708
|
+
day: $,
|
|
3709
|
+
hour: $,
|
|
3710
|
+
minute: $
|
|
3711
3711
|
}, Ci = {
|
|
3712
|
-
year:
|
|
3713
|
-
month:
|
|
3714
|
-
day:
|
|
3715
|
-
hour:
|
|
3716
|
-
minute:
|
|
3717
|
-
second:
|
|
3718
|
-
},
|
|
3719
|
-
year:
|
|
3712
|
+
year: $,
|
|
3713
|
+
month: $,
|
|
3714
|
+
day: $,
|
|
3715
|
+
hour: $,
|
|
3716
|
+
minute: $,
|
|
3717
|
+
second: $
|
|
3718
|
+
}, Fi = {
|
|
3719
|
+
year: $,
|
|
3720
3720
|
month: Le,
|
|
3721
|
-
day:
|
|
3722
|
-
hour:
|
|
3723
|
-
minute:
|
|
3724
|
-
},
|
|
3725
|
-
year:
|
|
3721
|
+
day: $,
|
|
3722
|
+
hour: $,
|
|
3723
|
+
minute: $
|
|
3724
|
+
}, $i = {
|
|
3725
|
+
year: $,
|
|
3726
3726
|
month: Le,
|
|
3727
|
-
day:
|
|
3728
|
-
hour:
|
|
3729
|
-
minute:
|
|
3730
|
-
second:
|
|
3731
|
-
},
|
|
3732
|
-
year:
|
|
3727
|
+
day: $,
|
|
3728
|
+
hour: $,
|
|
3729
|
+
minute: $,
|
|
3730
|
+
second: $
|
|
3731
|
+
}, ja = {
|
|
3732
|
+
year: $,
|
|
3733
3733
|
month: Le,
|
|
3734
|
-
day:
|
|
3734
|
+
day: $,
|
|
3735
3735
|
weekday: Le,
|
|
3736
|
-
hour:
|
|
3737
|
-
minute:
|
|
3738
|
-
},
|
|
3739
|
-
year:
|
|
3736
|
+
hour: $,
|
|
3737
|
+
minute: $
|
|
3738
|
+
}, Mi = {
|
|
3739
|
+
year: $,
|
|
3740
3740
|
month: Ie,
|
|
3741
|
-
day:
|
|
3742
|
-
hour:
|
|
3743
|
-
minute:
|
|
3741
|
+
day: $,
|
|
3742
|
+
hour: $,
|
|
3743
|
+
minute: $,
|
|
3744
3744
|
timeZoneName: Le
|
|
3745
3745
|
}, Pi = {
|
|
3746
|
-
year:
|
|
3746
|
+
year: $,
|
|
3747
3747
|
month: Ie,
|
|
3748
|
-
day:
|
|
3749
|
-
hour:
|
|
3750
|
-
minute:
|
|
3751
|
-
second:
|
|
3748
|
+
day: $,
|
|
3749
|
+
hour: $,
|
|
3750
|
+
minute: $,
|
|
3751
|
+
second: $,
|
|
3752
3752
|
timeZoneName: Le
|
|
3753
3753
|
}, Li = {
|
|
3754
|
-
year:
|
|
3754
|
+
year: $,
|
|
3755
3755
|
month: Ie,
|
|
3756
|
-
day:
|
|
3756
|
+
day: $,
|
|
3757
3757
|
weekday: Ie,
|
|
3758
|
-
hour:
|
|
3759
|
-
minute:
|
|
3758
|
+
hour: $,
|
|
3759
|
+
minute: $,
|
|
3760
3760
|
timeZoneName: Ie
|
|
3761
3761
|
}, Vi = {
|
|
3762
|
-
year:
|
|
3762
|
+
year: $,
|
|
3763
3763
|
month: Ie,
|
|
3764
|
-
day:
|
|
3764
|
+
day: $,
|
|
3765
3765
|
weekday: Ie,
|
|
3766
|
-
hour:
|
|
3767
|
-
minute:
|
|
3768
|
-
second:
|
|
3766
|
+
hour: $,
|
|
3767
|
+
minute: $,
|
|
3768
|
+
second: $,
|
|
3769
3769
|
timeZoneName: Ie
|
|
3770
3770
|
};
|
|
3771
3771
|
class an {
|
|
@@ -3895,7 +3895,7 @@ class Hn extends an {
|
|
|
3895
3895
|
}
|
|
3896
3896
|
}
|
|
3897
3897
|
const Rs = /* @__PURE__ */ new Map();
|
|
3898
|
-
function
|
|
3898
|
+
function Za(n) {
|
|
3899
3899
|
let e = Rs.get(n);
|
|
3900
3900
|
return e === void 0 && (e = new Intl.DateTimeFormat("en-US", {
|
|
3901
3901
|
hour12: !1,
|
|
@@ -3909,7 +3909,7 @@ function ja(n) {
|
|
|
3909
3909
|
era: "short"
|
|
3910
3910
|
}), Rs.set(n, e)), e;
|
|
3911
3911
|
}
|
|
3912
|
-
const
|
|
3912
|
+
const za = {
|
|
3913
3913
|
year: 0,
|
|
3914
3914
|
month: 1,
|
|
3915
3915
|
day: 2,
|
|
@@ -3918,14 +3918,14 @@ const Za = {
|
|
|
3918
3918
|
minute: 5,
|
|
3919
3919
|
second: 6
|
|
3920
3920
|
};
|
|
3921
|
-
function
|
|
3921
|
+
function qa(n, e) {
|
|
3922
3922
|
const t = n.format(e).replace(/\u200E/g, ""), s = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t), [, r, i, o, a, l, c, d] = s;
|
|
3923
3923
|
return [o, r, i, a, l, c, d];
|
|
3924
3924
|
}
|
|
3925
|
-
function
|
|
3925
|
+
function Ba(n, e) {
|
|
3926
3926
|
const t = n.formatToParts(e), s = [];
|
|
3927
3927
|
for (let r = 0; r < t.length; r++) {
|
|
3928
|
-
const { type: i, value: o } = t[r], a =
|
|
3928
|
+
const { type: i, value: o } = t[r], a = za[i];
|
|
3929
3929
|
i === "era" ? s[a] = o : H(a) || (s[a] = parseInt(o, 10));
|
|
3930
3930
|
}
|
|
3931
3931
|
return s;
|
|
@@ -4036,8 +4036,8 @@ class Qe extends an {
|
|
|
4036
4036
|
if (!this.valid) return NaN;
|
|
4037
4037
|
const t = new Date(e);
|
|
4038
4038
|
if (isNaN(t)) return NaN;
|
|
4039
|
-
const s =
|
|
4040
|
-
let [r, i, o, a, l, c, d] = s.formatToParts ?
|
|
4039
|
+
const s = Za(this.name);
|
|
4040
|
+
let [r, i, o, a, l, c, d] = s.formatToParts ? Ba(s, t) : qa(s, t);
|
|
4041
4041
|
a === "BC" && (r = -Math.abs(r) + 1);
|
|
4042
4042
|
const u = Yn({
|
|
4043
4043
|
year: r,
|
|
@@ -4070,11 +4070,11 @@ class Qe extends an {
|
|
|
4070
4070
|
return this.valid;
|
|
4071
4071
|
}
|
|
4072
4072
|
}
|
|
4073
|
-
let
|
|
4074
|
-
function
|
|
4073
|
+
let vr = {};
|
|
4074
|
+
function Ha(n, e = {}) {
|
|
4075
4075
|
const t = JSON.stringify([n, e]);
|
|
4076
|
-
let s =
|
|
4077
|
-
return s || (s = new Intl.ListFormat(n, e),
|
|
4076
|
+
let s = vr[t];
|
|
4077
|
+
return s || (s = new Intl.ListFormat(n, e), vr[t] = s), s;
|
|
4078
4078
|
}
|
|
4079
4079
|
const Is = /* @__PURE__ */ new Map();
|
|
4080
4080
|
function xs(n, e = {}) {
|
|
@@ -4083,19 +4083,19 @@ function xs(n, e = {}) {
|
|
|
4083
4083
|
return s === void 0 && (s = new Intl.DateTimeFormat(n, e), Is.set(t, s)), s;
|
|
4084
4084
|
}
|
|
4085
4085
|
const Ns = /* @__PURE__ */ new Map();
|
|
4086
|
-
function
|
|
4086
|
+
function Ga(n, e = {}) {
|
|
4087
4087
|
const t = JSON.stringify([n, e]);
|
|
4088
4088
|
let s = Ns.get(t);
|
|
4089
4089
|
return s === void 0 && (s = new Intl.NumberFormat(n, e), Ns.set(t, s)), s;
|
|
4090
4090
|
}
|
|
4091
4091
|
const Ds = /* @__PURE__ */ new Map();
|
|
4092
|
-
function
|
|
4092
|
+
function Ya(n, e = {}) {
|
|
4093
4093
|
const { base: t, ...s } = e, r = JSON.stringify([n, s]);
|
|
4094
4094
|
let i = Ds.get(r);
|
|
4095
4095
|
return i === void 0 && (i = new Intl.RelativeTimeFormat(n, e), Ds.set(r, i)), i;
|
|
4096
4096
|
}
|
|
4097
4097
|
let Gt = null;
|
|
4098
|
-
function
|
|
4098
|
+
function Ja() {
|
|
4099
4099
|
return Gt || (Gt = new Intl.DateTimeFormat().resolvedOptions().locale, Gt);
|
|
4100
4100
|
}
|
|
4101
4101
|
const As = /* @__PURE__ */ new Map();
|
|
@@ -4104,7 +4104,7 @@ function Ui(n) {
|
|
|
4104
4104
|
return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), As.set(n, e)), e;
|
|
4105
4105
|
}
|
|
4106
4106
|
const Cs = /* @__PURE__ */ new Map();
|
|
4107
|
-
function
|
|
4107
|
+
function Qa(n) {
|
|
4108
4108
|
let e = Cs.get(n);
|
|
4109
4109
|
if (!e) {
|
|
4110
4110
|
const t = new Intl.Locale(n);
|
|
@@ -4112,7 +4112,7 @@ function Ja(n) {
|
|
|
4112
4112
|
}
|
|
4113
4113
|
return e;
|
|
4114
4114
|
}
|
|
4115
|
-
function
|
|
4115
|
+
function Ka(n) {
|
|
4116
4116
|
const e = n.indexOf("-x-");
|
|
4117
4117
|
e !== -1 && (n = n.substring(0, e));
|
|
4118
4118
|
const t = n.indexOf("-u-");
|
|
@@ -4130,10 +4130,10 @@ function Qa(n) {
|
|
|
4130
4130
|
return [r, i, o];
|
|
4131
4131
|
}
|
|
4132
4132
|
}
|
|
4133
|
-
function
|
|
4133
|
+
function Xa(n, e, t) {
|
|
4134
4134
|
return (t || e) && (n.includes("-u-") || (n += "-u"), t && (n += `-ca-${t}`), e && (n += `-nu-${e}`)), n;
|
|
4135
4135
|
}
|
|
4136
|
-
function
|
|
4136
|
+
function el(n) {
|
|
4137
4137
|
const e = [];
|
|
4138
4138
|
for (let t = 1; t <= 12; t++) {
|
|
4139
4139
|
const s = L.utc(2009, t, 1);
|
|
@@ -4141,7 +4141,7 @@ function Xa(n) {
|
|
|
4141
4141
|
}
|
|
4142
4142
|
return e;
|
|
4143
4143
|
}
|
|
4144
|
-
function
|
|
4144
|
+
function tl(n) {
|
|
4145
4145
|
const e = [];
|
|
4146
4146
|
for (let t = 1; t <= 7; t++) {
|
|
4147
4147
|
const s = L.utc(2016, 11, 13 + t);
|
|
@@ -4153,16 +4153,16 @@ function mn(n, e, t, s) {
|
|
|
4153
4153
|
const r = n.listingMode();
|
|
4154
4154
|
return r === "error" ? null : r === "en" ? t(e) : s(e);
|
|
4155
4155
|
}
|
|
4156
|
-
function
|
|
4156
|
+
function nl(n) {
|
|
4157
4157
|
return n.numberingSystem && n.numberingSystem !== "latn" ? !1 : n.numberingSystem === "latn" || !n.locale || n.locale.startsWith("en") || Ui(n.locale).numberingSystem === "latn";
|
|
4158
4158
|
}
|
|
4159
|
-
class
|
|
4159
|
+
class sl {
|
|
4160
4160
|
constructor(e, t, s) {
|
|
4161
4161
|
this.padTo = s.padTo || 0, this.floor = s.floor || !1;
|
|
4162
4162
|
const { padTo: r, floor: i, ...o } = s;
|
|
4163
4163
|
if (!t || Object.keys(o).length > 0) {
|
|
4164
4164
|
const a = { useGrouping: !1, ...s };
|
|
4165
|
-
s.padTo > 0 && (a.minimumIntegerDigits = s.padTo), this.inf =
|
|
4165
|
+
s.padTo > 0 && (a.minimumIntegerDigits = s.padTo), this.inf = Ga(e, a);
|
|
4166
4166
|
}
|
|
4167
4167
|
}
|
|
4168
4168
|
format(e) {
|
|
@@ -4170,12 +4170,12 @@ class nl {
|
|
|
4170
4170
|
const t = this.floor ? Math.floor(e) : e;
|
|
4171
4171
|
return this.inf.format(t);
|
|
4172
4172
|
} else {
|
|
4173
|
-
const t = this.floor ? Math.floor(e) :
|
|
4173
|
+
const t = this.floor ? Math.floor(e) : Gs(e, 3);
|
|
4174
4174
|
return de(t, this.padTo);
|
|
4175
4175
|
}
|
|
4176
4176
|
}
|
|
4177
4177
|
}
|
|
4178
|
-
class
|
|
4178
|
+
class rl {
|
|
4179
4179
|
constructor(e, t, s) {
|
|
4180
4180
|
this.opts = s, this.originalZone = void 0;
|
|
4181
4181
|
let r;
|
|
@@ -4211,12 +4211,12 @@ class sl {
|
|
|
4211
4211
|
return this.dtf.resolvedOptions();
|
|
4212
4212
|
}
|
|
4213
4213
|
}
|
|
4214
|
-
class
|
|
4214
|
+
class il {
|
|
4215
4215
|
constructor(e, t, s) {
|
|
4216
|
-
this.opts = { style: "long", ...s }, !t && Gi() && (this.rtf =
|
|
4216
|
+
this.opts = { style: "long", ...s }, !t && Gi() && (this.rtf = Ya(e, s));
|
|
4217
4217
|
}
|
|
4218
4218
|
format(e, t) {
|
|
4219
|
-
return this.rtf ? this.rtf.format(e, t) :
|
|
4219
|
+
return this.rtf ? this.rtf.format(e, t) : Rl(t, e, this.opts.numeric, this.opts.style !== "long");
|
|
4220
4220
|
}
|
|
4221
4221
|
formatToParts(e, t) {
|
|
4222
4222
|
return this.rtf ? this.rtf.formatToParts(e, t) : [];
|
|
@@ -4238,7 +4238,7 @@ class re {
|
|
|
4238
4238
|
);
|
|
4239
4239
|
}
|
|
4240
4240
|
static create(e, t, s, r, i = !1) {
|
|
4241
|
-
const o = e || le.defaultLocale, a = o || (i ? "en-US" :
|
|
4241
|
+
const o = e || le.defaultLocale, a = o || (i ? "en-US" : Ja()), l = t || le.defaultNumberingSystem, c = s || le.defaultOutputCalendar, d = $s(r) || le.defaultWeekSettings;
|
|
4242
4242
|
return new re(a, l, c, d, o);
|
|
4243
4243
|
}
|
|
4244
4244
|
static resetCache() {
|
|
@@ -4248,11 +4248,11 @@ class re {
|
|
|
4248
4248
|
return re.create(e, t, s, r);
|
|
4249
4249
|
}
|
|
4250
4250
|
constructor(e, t, s, r, i) {
|
|
4251
|
-
const [o, a, l] =
|
|
4252
|
-
this.locale = o, this.numberingSystem = t || a || null, this.outputCalendar = s || l || null, this.weekSettings = r, this.intl =
|
|
4251
|
+
const [o, a, l] = Ka(e);
|
|
4252
|
+
this.locale = o, this.numberingSystem = t || a || null, this.outputCalendar = s || l || null, this.weekSettings = r, this.intl = Xa(this.locale, this.numberingSystem, this.outputCalendar), this.weekdaysCache = { format: {}, standalone: {} }, this.monthsCache = { format: {}, standalone: {} }, this.meridiemCache = null, this.eraCache = {}, this.specifiedLocale = i, this.fastNumbersCached = null;
|
|
4253
4253
|
}
|
|
4254
4254
|
get fastNumbers() {
|
|
4255
|
-
return this.fastNumbersCached == null && (this.fastNumbersCached =
|
|
4255
|
+
return this.fastNumbersCached == null && (this.fastNumbersCached = nl(this)), this.fastNumbersCached;
|
|
4256
4256
|
}
|
|
4257
4257
|
listingMode() {
|
|
4258
4258
|
const e = this.isEnglish(), t = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
|
|
@@ -4263,7 +4263,7 @@ class re {
|
|
|
4263
4263
|
e.locale || this.specifiedLocale,
|
|
4264
4264
|
e.numberingSystem || this.numberingSystem,
|
|
4265
4265
|
e.outputCalendar || this.outputCalendar,
|
|
4266
|
-
|
|
4266
|
+
$s(e.weekSettings) || this.weekSettings,
|
|
4267
4267
|
e.defaultToEN || !1
|
|
4268
4268
|
);
|
|
4269
4269
|
}
|
|
@@ -4280,7 +4280,7 @@ class re {
|
|
|
4280
4280
|
const r = t ? { month: e, day: "numeric" } : { month: e }, i = t ? "format" : "standalone";
|
|
4281
4281
|
if (!this.monthsCache[i][e]) {
|
|
4282
4282
|
const o = s ? (a) => this.dtFormatter(a, r).format() : (a) => this.extract(a, r, "month");
|
|
4283
|
-
this.monthsCache[i][e] =
|
|
4283
|
+
this.monthsCache[i][e] = el(o);
|
|
4284
4284
|
}
|
|
4285
4285
|
return this.monthsCache[i][e];
|
|
4286
4286
|
});
|
|
@@ -4288,7 +4288,7 @@ class re {
|
|
|
4288
4288
|
weekdays(e, t = !1) {
|
|
4289
4289
|
return mn(this, e, no, () => {
|
|
4290
4290
|
const s = t ? { weekday: e, year: "numeric", month: "long", day: "numeric" } : { weekday: e }, r = t ? "format" : "standalone";
|
|
4291
|
-
return this.weekdaysCache[r][e] || (this.weekdaysCache[r][e] =
|
|
4291
|
+
return this.weekdaysCache[r][e] || (this.weekdaysCache[r][e] = tl(
|
|
4292
4292
|
(i) => this.extract(i, s, "weekday")
|
|
4293
4293
|
)), this.weekdaysCache[r][e];
|
|
4294
4294
|
});
|
|
@@ -4322,22 +4322,22 @@ class re {
|
|
|
4322
4322
|
return o ? o.value : null;
|
|
4323
4323
|
}
|
|
4324
4324
|
numberFormatter(e = {}) {
|
|
4325
|
-
return new
|
|
4325
|
+
return new sl(this.intl, e.forceSimple || this.fastNumbers, e);
|
|
4326
4326
|
}
|
|
4327
4327
|
dtFormatter(e, t = {}) {
|
|
4328
|
-
return new
|
|
4328
|
+
return new rl(e, this.intl, t);
|
|
4329
4329
|
}
|
|
4330
4330
|
relFormatter(e = {}) {
|
|
4331
|
-
return new
|
|
4331
|
+
return new il(this.intl, this.isEnglish(), e);
|
|
4332
4332
|
}
|
|
4333
4333
|
listFormatter(e = {}) {
|
|
4334
|
-
return
|
|
4334
|
+
return Ha(this.intl, e);
|
|
4335
4335
|
}
|
|
4336
4336
|
isEnglish() {
|
|
4337
4337
|
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || Ui(this.intl).locale.startsWith("en-us");
|
|
4338
4338
|
}
|
|
4339
4339
|
getWeekSettings() {
|
|
4340
|
-
return this.weekSettings ? this.weekSettings : Yi() ?
|
|
4340
|
+
return this.weekSettings ? this.weekSettings : Yi() ? Qa(this.locale) : Wi;
|
|
4341
4341
|
}
|
|
4342
4342
|
getStartOfWeek() {
|
|
4343
4343
|
return this.getWeekSettings().firstDay;
|
|
@@ -4475,7 +4475,7 @@ class _e extends an {
|
|
|
4475
4475
|
return !0;
|
|
4476
4476
|
}
|
|
4477
4477
|
}
|
|
4478
|
-
class
|
|
4478
|
+
class ol extends an {
|
|
4479
4479
|
constructor(e) {
|
|
4480
4480
|
super(), this.zoneName = e;
|
|
4481
4481
|
}
|
|
@@ -4517,12 +4517,12 @@ function rt(n, e) {
|
|
|
4517
4517
|
return e;
|
|
4518
4518
|
if (n instanceof an)
|
|
4519
4519
|
return n;
|
|
4520
|
-
if (
|
|
4520
|
+
if (fl(n)) {
|
|
4521
4521
|
const t = n.toLowerCase();
|
|
4522
4522
|
return t === "default" ? e : t === "local" || t === "system" ? Hn.instance : t === "utc" || t === "gmt" ? _e.utcInstance : _e.parseSpecifier(t) || Qe.create(n);
|
|
4523
|
-
} else return at(n) ? _e.instance(n) : typeof n == "object" && "offset" in n && typeof n.offset == "function" ? n : new
|
|
4523
|
+
} else return at(n) ? _e.instance(n) : typeof n == "object" && "offset" in n && typeof n.offset == "function" ? n : new ol(n);
|
|
4524
4524
|
}
|
|
4525
|
-
const
|
|
4525
|
+
const zs = {
|
|
4526
4526
|
arab: "[٠-٩]",
|
|
4527
4527
|
arabext: "[۰-۹]",
|
|
4528
4528
|
bali: "[᭐-᭙]",
|
|
@@ -4544,7 +4544,7 @@ const Zs = {
|
|
|
4544
4544
|
thai: "[๐-๙]",
|
|
4545
4545
|
tibt: "[༠-༩]",
|
|
4546
4546
|
latn: "\\d"
|
|
4547
|
-
},
|
|
4547
|
+
}, Or = {
|
|
4548
4548
|
arab: [1632, 1641],
|
|
4549
4549
|
arabext: [1776, 1785],
|
|
4550
4550
|
bali: [6992, 7001],
|
|
@@ -4564,18 +4564,18 @@ const Zs = {
|
|
|
4564
4564
|
telu: [3174, 3183],
|
|
4565
4565
|
thai: [3664, 3673],
|
|
4566
4566
|
tibt: [3872, 3881]
|
|
4567
|
-
},
|
|
4568
|
-
function
|
|
4567
|
+
}, al = zs.hanidec.replace(/[\[|\]]/g, "").split("");
|
|
4568
|
+
function ll(n) {
|
|
4569
4569
|
let e = parseInt(n, 10);
|
|
4570
4570
|
if (isNaN(e)) {
|
|
4571
4571
|
e = "";
|
|
4572
4572
|
for (let t = 0; t < n.length; t++) {
|
|
4573
4573
|
const s = n.charCodeAt(t);
|
|
4574
|
-
if (n[t].search(
|
|
4575
|
-
e +=
|
|
4574
|
+
if (n[t].search(zs.hanidec) !== -1)
|
|
4575
|
+
e += al.indexOf(n[t]);
|
|
4576
4576
|
else
|
|
4577
|
-
for (const r in
|
|
4578
|
-
const [i, o] =
|
|
4577
|
+
for (const r in Or) {
|
|
4578
|
+
const [i, o] = Or[r];
|
|
4579
4579
|
s >= i && s <= o && (e += s - i);
|
|
4580
4580
|
}
|
|
4581
4581
|
}
|
|
@@ -4583,25 +4583,25 @@ function al(n) {
|
|
|
4583
4583
|
} else
|
|
4584
4584
|
return e;
|
|
4585
4585
|
}
|
|
4586
|
-
const
|
|
4587
|
-
function
|
|
4588
|
-
|
|
4586
|
+
const Fs = /* @__PURE__ */ new Map();
|
|
4587
|
+
function cl() {
|
|
4588
|
+
Fs.clear();
|
|
4589
4589
|
}
|
|
4590
|
-
function
|
|
4590
|
+
function $e({ numberingSystem: n }, e = "") {
|
|
4591
4591
|
const t = n || "latn";
|
|
4592
|
-
let s =
|
|
4593
|
-
s === void 0 && (s = /* @__PURE__ */ new Map(),
|
|
4592
|
+
let s = Fs.get(t);
|
|
4593
|
+
s === void 0 && (s = /* @__PURE__ */ new Map(), Fs.set(t, s));
|
|
4594
4594
|
let r = s.get(e);
|
|
4595
|
-
return r === void 0 && (r = new RegExp(`${
|
|
4595
|
+
return r === void 0 && (r = new RegExp(`${zs[t]}${e}`), s.set(e, r)), r;
|
|
4596
4596
|
}
|
|
4597
|
-
let
|
|
4597
|
+
let kr = () => Date.now(), br = "system", Tr = null, Sr = null, Rr = null, Ir = 60, xr, Nr = null;
|
|
4598
4598
|
class le {
|
|
4599
4599
|
/**
|
|
4600
4600
|
* Get the callback for returning the current timestamp.
|
|
4601
4601
|
* @type {function}
|
|
4602
4602
|
*/
|
|
4603
4603
|
static get now() {
|
|
4604
|
-
return
|
|
4604
|
+
return kr;
|
|
4605
4605
|
}
|
|
4606
4606
|
/**
|
|
4607
4607
|
* Set the callback for returning the current timestamp.
|
|
@@ -4611,7 +4611,7 @@ class le {
|
|
|
4611
4611
|
* @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
|
|
4612
4612
|
*/
|
|
4613
4613
|
static set now(e) {
|
|
4614
|
-
|
|
4614
|
+
kr = e;
|
|
4615
4615
|
}
|
|
4616
4616
|
/**
|
|
4617
4617
|
* Set the default time zone to create DateTimes in. Does not affect existing instances.
|
|
@@ -4619,7 +4619,7 @@ class le {
|
|
|
4619
4619
|
* @type {string}
|
|
4620
4620
|
*/
|
|
4621
4621
|
static set defaultZone(e) {
|
|
4622
|
-
|
|
4622
|
+
br = e;
|
|
4623
4623
|
}
|
|
4624
4624
|
/**
|
|
4625
4625
|
* Get the default time zone object currently used to create DateTimes. Does not affect existing instances.
|
|
@@ -4627,49 +4627,49 @@ class le {
|
|
|
4627
4627
|
* @type {Zone}
|
|
4628
4628
|
*/
|
|
4629
4629
|
static get defaultZone() {
|
|
4630
|
-
return rt(
|
|
4630
|
+
return rt(br, Hn.instance);
|
|
4631
4631
|
}
|
|
4632
4632
|
/**
|
|
4633
4633
|
* Get the default locale to create DateTimes with. Does not affect existing instances.
|
|
4634
4634
|
* @type {string}
|
|
4635
4635
|
*/
|
|
4636
4636
|
static get defaultLocale() {
|
|
4637
|
-
return
|
|
4637
|
+
return Tr;
|
|
4638
4638
|
}
|
|
4639
4639
|
/**
|
|
4640
4640
|
* Set the default locale to create DateTimes with. Does not affect existing instances.
|
|
4641
4641
|
* @type {string}
|
|
4642
4642
|
*/
|
|
4643
4643
|
static set defaultLocale(e) {
|
|
4644
|
-
|
|
4644
|
+
Tr = e;
|
|
4645
4645
|
}
|
|
4646
4646
|
/**
|
|
4647
4647
|
* Get the default numbering system to create DateTimes with. Does not affect existing instances.
|
|
4648
4648
|
* @type {string}
|
|
4649
4649
|
*/
|
|
4650
4650
|
static get defaultNumberingSystem() {
|
|
4651
|
-
return
|
|
4651
|
+
return Sr;
|
|
4652
4652
|
}
|
|
4653
4653
|
/**
|
|
4654
4654
|
* Set the default numbering system to create DateTimes with. Does not affect existing instances.
|
|
4655
4655
|
* @type {string}
|
|
4656
4656
|
*/
|
|
4657
4657
|
static set defaultNumberingSystem(e) {
|
|
4658
|
-
|
|
4658
|
+
Sr = e;
|
|
4659
4659
|
}
|
|
4660
4660
|
/**
|
|
4661
4661
|
* Get the default output calendar to create DateTimes with. Does not affect existing instances.
|
|
4662
4662
|
* @type {string}
|
|
4663
4663
|
*/
|
|
4664
4664
|
static get defaultOutputCalendar() {
|
|
4665
|
-
return
|
|
4665
|
+
return Rr;
|
|
4666
4666
|
}
|
|
4667
4667
|
/**
|
|
4668
4668
|
* Set the default output calendar to create DateTimes with. Does not affect existing instances.
|
|
4669
4669
|
* @type {string}
|
|
4670
4670
|
*/
|
|
4671
4671
|
static set defaultOutputCalendar(e) {
|
|
4672
|
-
|
|
4672
|
+
Rr = e;
|
|
4673
4673
|
}
|
|
4674
4674
|
/**
|
|
4675
4675
|
* @typedef {Object} WeekSettings
|
|
@@ -4681,7 +4681,7 @@ class le {
|
|
|
4681
4681
|
* @return {WeekSettings|null}
|
|
4682
4682
|
*/
|
|
4683
4683
|
static get defaultWeekSettings() {
|
|
4684
|
-
return
|
|
4684
|
+
return Nr;
|
|
4685
4685
|
}
|
|
4686
4686
|
/**
|
|
4687
4687
|
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
|
|
@@ -4691,14 +4691,14 @@ class le {
|
|
|
4691
4691
|
* @param {WeekSettings|null} weekSettings
|
|
4692
4692
|
*/
|
|
4693
4693
|
static set defaultWeekSettings(e) {
|
|
4694
|
-
|
|
4694
|
+
Nr = $s(e);
|
|
4695
4695
|
}
|
|
4696
4696
|
/**
|
|
4697
4697
|
* Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
|
|
4698
4698
|
* @type {number}
|
|
4699
4699
|
*/
|
|
4700
4700
|
static get twoDigitCutoffYear() {
|
|
4701
|
-
return
|
|
4701
|
+
return Ir;
|
|
4702
4702
|
}
|
|
4703
4703
|
/**
|
|
4704
4704
|
* Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
|
|
@@ -4710,28 +4710,28 @@ class le {
|
|
|
4710
4710
|
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
|
|
4711
4711
|
*/
|
|
4712
4712
|
static set twoDigitCutoffYear(e) {
|
|
4713
|
-
|
|
4713
|
+
Ir = e % 100;
|
|
4714
4714
|
}
|
|
4715
4715
|
/**
|
|
4716
4716
|
* Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
|
|
4717
4717
|
* @type {boolean}
|
|
4718
4718
|
*/
|
|
4719
4719
|
static get throwOnInvalid() {
|
|
4720
|
-
return
|
|
4720
|
+
return xr;
|
|
4721
4721
|
}
|
|
4722
4722
|
/**
|
|
4723
4723
|
* Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
|
|
4724
4724
|
* @type {boolean}
|
|
4725
4725
|
*/
|
|
4726
4726
|
static set throwOnInvalid(e) {
|
|
4727
|
-
|
|
4727
|
+
xr = e;
|
|
4728
4728
|
}
|
|
4729
4729
|
/**
|
|
4730
4730
|
* Reset Luxon's global caches. Should only be necessary in testing scenarios.
|
|
4731
4731
|
* @return {void}
|
|
4732
4732
|
*/
|
|
4733
4733
|
static resetCaches() {
|
|
4734
|
-
re.resetCache(), Qe.resetCache(), L.resetCache(),
|
|
4734
|
+
re.resetCache(), Qe.resetCache(), L.resetCache(), cl();
|
|
4735
4735
|
}
|
|
4736
4736
|
}
|
|
4737
4737
|
class Pe {
|
|
@@ -4749,7 +4749,7 @@ function Ne(n, e) {
|
|
|
4749
4749
|
`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`
|
|
4750
4750
|
);
|
|
4751
4751
|
}
|
|
4752
|
-
function
|
|
4752
|
+
function qs(n, e, t) {
|
|
4753
4753
|
const s = new Date(Date.UTC(n, e - 1, t));
|
|
4754
4754
|
n < 100 && n >= 0 && s.setUTCFullYear(s.getUTCFullYear() - 1900);
|
|
4755
4755
|
const r = s.getUTCDay();
|
|
@@ -4762,16 +4762,16 @@ function qi(n, e) {
|
|
|
4762
4762
|
const t = ln(n) ? Zi : ji, s = t.findIndex((i) => i < e), r = e - t[s];
|
|
4763
4763
|
return { month: s + 1, day: r };
|
|
4764
4764
|
}
|
|
4765
|
-
function
|
|
4765
|
+
function Bs(n, e) {
|
|
4766
4766
|
return (n - e + 7) % 7 + 1;
|
|
4767
4767
|
}
|
|
4768
4768
|
function Vn(n, e = 4, t = 1) {
|
|
4769
|
-
const { year: s, month: r, day: i } = n, o = zi(s, r, i), a = qs(
|
|
4769
|
+
const { year: s, month: r, day: i } = n, o = zi(s, r, i), a = Bs(qs(s, r, i), t);
|
|
4770
4770
|
let l = Math.floor((o - a + 14 - e) / 7), c;
|
|
4771
4771
|
return l < 1 ? (c = s - 1, l = sn(c, e, t)) : l > sn(s, e, t) ? (c = s + 1, l = 1) : c = s, { weekYear: c, weekNumber: l, weekday: a, ...Qn(n) };
|
|
4772
4772
|
}
|
|
4773
|
-
function
|
|
4774
|
-
const { weekYear: s, weekNumber: r, weekday: i } = n, o = qs(
|
|
4773
|
+
function Dr(n, e = 4, t = 1) {
|
|
4774
|
+
const { weekYear: s, weekNumber: r, weekday: i } = n, o = Bs(qs(s, 1, e), t), a = Nt(s);
|
|
4775
4775
|
let l = r * 7 + i - o - 7 + e, c;
|
|
4776
4776
|
l < 1 ? (c = s - 1, l += Nt(c)) : l > a ? (c = s + 1, l -= Nt(s)) : c = s;
|
|
4777
4777
|
const { month: d, day: m } = qi(c, l);
|
|
@@ -4781,11 +4781,11 @@ function as(n) {
|
|
|
4781
4781
|
const { year: e, month: t, day: s } = n, r = zi(e, t, s);
|
|
4782
4782
|
return { year: e, ordinal: r, ...Qn(n) };
|
|
4783
4783
|
}
|
|
4784
|
-
function
|
|
4784
|
+
function Ar(n) {
|
|
4785
4785
|
const { year: e, ordinal: t } = n, { month: s, day: r } = qi(e, t);
|
|
4786
4786
|
return { year: e, month: s, day: r, ...Qn(n) };
|
|
4787
4787
|
}
|
|
4788
|
-
function
|
|
4788
|
+
function Cr(n, e) {
|
|
4789
4789
|
if (!H(n.localWeekday) || !H(n.localWeekNumber) || !H(n.localWeekYear)) {
|
|
4790
4790
|
if (!H(n.weekday) || !H(n.weekNumber) || !H(n.weekYear))
|
|
4791
4791
|
throw new It(
|
|
@@ -4798,7 +4798,7 @@ function Ar(n, e) {
|
|
|
4798
4798
|
} else
|
|
4799
4799
|
return { minDaysInFirstWeek: 4, startOfWeek: 1 };
|
|
4800
4800
|
}
|
|
4801
|
-
function
|
|
4801
|
+
function ul(n, e = 4, t = 1) {
|
|
4802
4802
|
const s = Gn(n.weekYear), r = De(
|
|
4803
4803
|
n.weekNumber,
|
|
4804
4804
|
1,
|
|
@@ -4806,7 +4806,7 @@ function cl(n, e = 4, t = 1) {
|
|
|
4806
4806
|
), i = De(n.weekday, 1, 7);
|
|
4807
4807
|
return s ? r ? i ? !1 : Ne("weekday", n.weekday) : Ne("week", n.weekNumber) : Ne("weekYear", n.weekYear);
|
|
4808
4808
|
}
|
|
4809
|
-
function
|
|
4809
|
+
function dl(n) {
|
|
4810
4810
|
const e = Gn(n.year), t = De(n.ordinal, 1, Nt(n.year));
|
|
4811
4811
|
return e ? t ? !1 : Ne("ordinal", n.ordinal) : Ne("year", n.year);
|
|
4812
4812
|
}
|
|
@@ -4827,10 +4827,10 @@ function at(n) {
|
|
|
4827
4827
|
function Gn(n) {
|
|
4828
4828
|
return typeof n == "number" && n % 1 === 0;
|
|
4829
4829
|
}
|
|
4830
|
-
function
|
|
4830
|
+
function fl(n) {
|
|
4831
4831
|
return typeof n == "string";
|
|
4832
4832
|
}
|
|
4833
|
-
function
|
|
4833
|
+
function hl(n) {
|
|
4834
4834
|
return Object.prototype.toString.call(n) === "[object Date]";
|
|
4835
4835
|
}
|
|
4836
4836
|
function Gi() {
|
|
@@ -4847,23 +4847,23 @@ function Yi() {
|
|
|
4847
4847
|
return !1;
|
|
4848
4848
|
}
|
|
4849
4849
|
}
|
|
4850
|
-
function
|
|
4850
|
+
function ml(n) {
|
|
4851
4851
|
return Array.isArray(n) ? n : [n];
|
|
4852
4852
|
}
|
|
4853
|
-
function
|
|
4853
|
+
function Fr(n, e, t) {
|
|
4854
4854
|
if (n.length !== 0)
|
|
4855
4855
|
return n.reduce((s, r) => {
|
|
4856
4856
|
const i = [e(r), r];
|
|
4857
4857
|
return s && t(s[0], i[0]) === s[0] ? s : i;
|
|
4858
4858
|
}, null)[1];
|
|
4859
4859
|
}
|
|
4860
|
-
function
|
|
4860
|
+
function pl(n, e) {
|
|
4861
4861
|
return e.reduce((t, s) => (t[s] = n[s], t), {});
|
|
4862
4862
|
}
|
|
4863
4863
|
function Pt(n, e) {
|
|
4864
4864
|
return Object.prototype.hasOwnProperty.call(n, e);
|
|
4865
4865
|
}
|
|
4866
|
-
function
|
|
4866
|
+
function $s(n) {
|
|
4867
4867
|
if (n == null)
|
|
4868
4868
|
return null;
|
|
4869
4869
|
if (typeof n != "object")
|
|
@@ -4879,7 +4879,7 @@ function Ms(n) {
|
|
|
4879
4879
|
function De(n, e, t) {
|
|
4880
4880
|
return Gn(n) && n >= e && n <= t;
|
|
4881
4881
|
}
|
|
4882
|
-
function
|
|
4882
|
+
function yl(n, e) {
|
|
4883
4883
|
return n - e * Math.floor(n / e);
|
|
4884
4884
|
}
|
|
4885
4885
|
function de(n, e = 2) {
|
|
@@ -4895,13 +4895,13 @@ function ht(n) {
|
|
|
4895
4895
|
if (!(H(n) || n === null || n === ""))
|
|
4896
4896
|
return parseFloat(n);
|
|
4897
4897
|
}
|
|
4898
|
-
function
|
|
4898
|
+
function Hs(n) {
|
|
4899
4899
|
if (!(H(n) || n === null || n === "")) {
|
|
4900
4900
|
const e = parseFloat("0." + n) * 1e3;
|
|
4901
4901
|
return Math.floor(e);
|
|
4902
4902
|
}
|
|
4903
4903
|
}
|
|
4904
|
-
function
|
|
4904
|
+
function Gs(n, e, t = "round") {
|
|
4905
4905
|
const s = 10 ** e;
|
|
4906
4906
|
switch (t) {
|
|
4907
4907
|
case "expand":
|
|
@@ -4925,7 +4925,7 @@ function Nt(n) {
|
|
|
4925
4925
|
return ln(n) ? 366 : 365;
|
|
4926
4926
|
}
|
|
4927
4927
|
function Un(n, e) {
|
|
4928
|
-
const t =
|
|
4928
|
+
const t = yl(e - 1, 12) + 1, s = n + (e - t) / 12;
|
|
4929
4929
|
return t === 2 ? ln(s) ? 29 : 28 : [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][t - 1];
|
|
4930
4930
|
}
|
|
4931
4931
|
function Yn(n) {
|
|
@@ -4941,13 +4941,13 @@ function Yn(n) {
|
|
|
4941
4941
|
return n.year < 100 && n.year >= 0 && (e = new Date(e), e.setUTCFullYear(n.year, n.month - 1, n.day)), +e;
|
|
4942
4942
|
}
|
|
4943
4943
|
function $r(n, e, t) {
|
|
4944
|
-
return -qs(
|
|
4944
|
+
return -Bs(qs(n, 1, e), t) + e - 1;
|
|
4945
4945
|
}
|
|
4946
4946
|
function sn(n, e = 4, t = 1) {
|
|
4947
4947
|
const s = $r(n, e, t), r = $r(n + 1, e, t);
|
|
4948
4948
|
return (Nt(n) - s + r) / 7;
|
|
4949
4949
|
}
|
|
4950
|
-
function
|
|
4950
|
+
function Ms(n) {
|
|
4951
4951
|
return n > 99 ? n : n > le.twoDigitCutoffYear ? 1900 + n : 2e3 + n;
|
|
4952
4952
|
}
|
|
4953
4953
|
function Ji(n, e, t, s = null) {
|
|
@@ -4999,9 +4999,9 @@ function en(n, e) {
|
|
|
4999
4999
|
}
|
|
5000
5000
|
}
|
|
5001
5001
|
function Qn(n) {
|
|
5002
|
-
return
|
|
5002
|
+
return pl(n, ["hour", "minute", "second", "millisecond"]);
|
|
5003
5003
|
}
|
|
5004
|
-
const
|
|
5004
|
+
const gl = [
|
|
5005
5005
|
"January",
|
|
5006
5006
|
"February",
|
|
5007
5007
|
"March",
|
|
@@ -5027,15 +5027,15 @@ const yl = [
|
|
|
5027
5027
|
"Oct",
|
|
5028
5028
|
"Nov",
|
|
5029
5029
|
"Dec"
|
|
5030
|
-
],
|
|
5030
|
+
], wl = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"];
|
|
5031
5031
|
function Xi(n) {
|
|
5032
5032
|
switch (n) {
|
|
5033
5033
|
case "narrow":
|
|
5034
|
-
return [...
|
|
5034
|
+
return [...wl];
|
|
5035
5035
|
case "short":
|
|
5036
5036
|
return [...Ki];
|
|
5037
5037
|
case "long":
|
|
5038
|
-
return [...
|
|
5038
|
+
return [...gl];
|
|
5039
5039
|
case "numeric":
|
|
5040
5040
|
return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
|
|
5041
5041
|
case "2-digit":
|
|
@@ -5052,11 +5052,11 @@ const eo = [
|
|
|
5052
5052
|
"Friday",
|
|
5053
5053
|
"Saturday",
|
|
5054
5054
|
"Sunday"
|
|
5055
|
-
], to = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
|
5055
|
+
], to = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], _l = ["M", "T", "W", "T", "F", "S", "S"];
|
|
5056
5056
|
function no(n) {
|
|
5057
5057
|
switch (n) {
|
|
5058
5058
|
case "narrow":
|
|
5059
|
-
return [...
|
|
5059
|
+
return [..._l];
|
|
5060
5060
|
case "short":
|
|
5061
5061
|
return [...to];
|
|
5062
5062
|
case "long":
|
|
@@ -5067,32 +5067,32 @@ function no(n) {
|
|
|
5067
5067
|
return null;
|
|
5068
5068
|
}
|
|
5069
5069
|
}
|
|
5070
|
-
const so = ["AM", "PM"],
|
|
5070
|
+
const so = ["AM", "PM"], El = ["Before Christ", "Anno Domini"], vl = ["BC", "AD"], Ol = ["B", "A"];
|
|
5071
5071
|
function ro(n) {
|
|
5072
5072
|
switch (n) {
|
|
5073
5073
|
case "narrow":
|
|
5074
|
-
return [...
|
|
5074
|
+
return [...Ol];
|
|
5075
5075
|
case "short":
|
|
5076
|
-
return [...
|
|
5076
|
+
return [...vl];
|
|
5077
5077
|
case "long":
|
|
5078
|
-
return [...
|
|
5078
|
+
return [...El];
|
|
5079
5079
|
default:
|
|
5080
5080
|
return null;
|
|
5081
5081
|
}
|
|
5082
5082
|
}
|
|
5083
|
-
function
|
|
5083
|
+
function kl(n) {
|
|
5084
5084
|
return so[n.hour < 12 ? 0 : 1];
|
|
5085
5085
|
}
|
|
5086
|
-
function
|
|
5086
|
+
function bl(n, e) {
|
|
5087
5087
|
return no(e)[n.weekday - 1];
|
|
5088
5088
|
}
|
|
5089
|
-
function
|
|
5089
|
+
function Tl(n, e) {
|
|
5090
5090
|
return Xi(e)[n.month - 1];
|
|
5091
5091
|
}
|
|
5092
|
-
function
|
|
5092
|
+
function Sl(n, e) {
|
|
5093
5093
|
return ro(e)[n.year < 0 ? 0 : 1];
|
|
5094
5094
|
}
|
|
5095
|
-
function
|
|
5095
|
+
function Rl(n, e, t = "always", s = !1) {
|
|
5096
5096
|
const r = {
|
|
5097
5097
|
years: ["year", "yr."],
|
|
5098
5098
|
quarters: ["quarter", "qtr."],
|
|
@@ -5123,7 +5123,7 @@ function Mr(n, e) {
|
|
|
5123
5123
|
s.literal ? t += s.val : t += e(s.val);
|
|
5124
5124
|
return t;
|
|
5125
5125
|
}
|
|
5126
|
-
const
|
|
5126
|
+
const Il = {
|
|
5127
5127
|
D: Ln,
|
|
5128
5128
|
DD: vi,
|
|
5129
5129
|
DDD: Oi,
|
|
@@ -5137,11 +5137,11 @@ const Rl = {
|
|
|
5137
5137
|
TTT: Ni,
|
|
5138
5138
|
TTTT: Di,
|
|
5139
5139
|
f: Ai,
|
|
5140
|
-
ff:
|
|
5141
|
-
fff:
|
|
5140
|
+
ff: Fi,
|
|
5141
|
+
fff: Mi,
|
|
5142
5142
|
ffff: Li,
|
|
5143
5143
|
F: Ci,
|
|
5144
|
-
FF:
|
|
5144
|
+
FF: $i,
|
|
5145
5145
|
FFF: Pi,
|
|
5146
5146
|
FFFF: Vi
|
|
5147
5147
|
};
|
|
@@ -5162,7 +5162,7 @@ class ge {
|
|
|
5162
5162
|
return s.length > 0 && i.push({ literal: r || /^\s+$/.test(s), val: s }), i;
|
|
5163
5163
|
}
|
|
5164
5164
|
static macroTokenToFormatOpts(e) {
|
|
5165
|
-
return
|
|
5165
|
+
return Il[e];
|
|
5166
5166
|
}
|
|
5167
5167
|
constructor(e, t) {
|
|
5168
5168
|
this.opts = t, this.loc = e, this.systemLoc = null;
|
|
@@ -5192,13 +5192,13 @@ class ge {
|
|
|
5192
5192
|
return t > 0 && (r.padTo = t), s && (r.signDisplay = s), this.loc.numberFormatter(r).format(e);
|
|
5193
5193
|
}
|
|
5194
5194
|
formatDateTimeFromString(e, t) {
|
|
5195
|
-
const s = this.loc.listingMode() === "en", r = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (f, g) => this.loc.extract(e, f, g), o = (f) => e.isOffsetFixed && e.offset === 0 && f.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, f.format) : "", a = () => s ?
|
|
5195
|
+
const s = this.loc.listingMode() === "en", r = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (f, g) => this.loc.extract(e, f, g), o = (f) => e.isOffsetFixed && e.offset === 0 && f.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, f.format) : "", a = () => s ? kl(e) : i({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), l = (f, g) => s ? Tl(e, f) : i(g ? { month: f } : { month: f, day: "numeric" }, "month"), c = (f, g) => s ? bl(e, f) : i(
|
|
5196
5196
|
g ? { weekday: f } : { weekday: f, month: "long", day: "numeric" },
|
|
5197
5197
|
"weekday"
|
|
5198
5198
|
), d = (f) => {
|
|
5199
5199
|
const g = ge.macroTokenToFormatOpts(f);
|
|
5200
5200
|
return g ? this.formatWithSystemDefault(e, g) : f;
|
|
5201
|
-
}, m = (f) => s ?
|
|
5201
|
+
}, m = (f) => s ? Sl(e, f) : i({ era: f }, "era"), u = (f) => {
|
|
5202
5202
|
switch (f) {
|
|
5203
5203
|
// ms
|
|
5204
5204
|
case "S":
|
|
@@ -5418,14 +5418,14 @@ function oo(...n) {
|
|
|
5418
5418
|
return [s, null, t + r];
|
|
5419
5419
|
};
|
|
5420
5420
|
}
|
|
5421
|
-
const ao = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,
|
|
5422
|
-
`${
|
|
5421
|
+
const ao = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, xl = `(?:${ao.source}?(?:\\[(${io.source})\\])?)?`, Ys = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, lo = RegExp(`${Ys.source}${xl}`), Js = RegExp(`(?:[Tt]${lo.source})?`), Nl = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Dl = /(\d{4})-?W(\d\d)(?:-?(\d))?/, Al = /(\d{4})-?(\d{3})/, Cl = oo("weekYear", "weekNumber", "weekDay"), Fl = oo("year", "ordinal"), $l = /(\d{4})-(\d\d)-(\d\d)/, co = RegExp(
|
|
5422
|
+
`${Ys.source} ?(?:${ao.source}|(${io.source}))?`
|
|
5423
5423
|
), Ml = RegExp(`(?: ${co.source})?`);
|
|
5424
5424
|
function Dt(n, e, t) {
|
|
5425
5425
|
const s = n[e];
|
|
5426
5426
|
return H(s) ? t : st(s);
|
|
5427
5427
|
}
|
|
5428
|
-
function
|
|
5428
|
+
function Pl(n, e) {
|
|
5429
5429
|
return [{
|
|
5430
5430
|
year: Dt(n, e),
|
|
5431
5431
|
month: Dt(n, e + 1, 1),
|
|
@@ -5437,7 +5437,7 @@ function jt(n, e) {
|
|
|
5437
5437
|
hours: Dt(n, e, 0),
|
|
5438
5438
|
minutes: Dt(n, e + 1, 0),
|
|
5439
5439
|
seconds: Dt(n, e + 2, 0),
|
|
5440
|
-
milliseconds:
|
|
5440
|
+
milliseconds: Hs(n[e + 3])
|
|
5441
5441
|
}, null, e + 4];
|
|
5442
5442
|
}
|
|
5443
5443
|
function cn(n, e) {
|
|
@@ -5448,8 +5448,8 @@ function un(n, e) {
|
|
|
5448
5448
|
const t = n[e] ? Qe.create(n[e]) : null;
|
|
5449
5449
|
return [{}, t, e + 1];
|
|
5450
5450
|
}
|
|
5451
|
-
const
|
|
5452
|
-
function
|
|
5451
|
+
const Ll = RegExp(`^T?${Ys.source}$`), Vl = /^-?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)?)?)$/;
|
|
5452
|
+
function Ul(n) {
|
|
5453
5453
|
const [e, t, s, r, i, o, a, l, c] = n, d = e[0] === "-", m = l && l[0] === "-", u = (f, g = !1) => f !== void 0 && (g || f && d) ? -f : f;
|
|
5454
5454
|
return [
|
|
5455
5455
|
{
|
|
@@ -5460,11 +5460,11 @@ function Vl(n) {
|
|
|
5460
5460
|
hours: u(ht(o)),
|
|
5461
5461
|
minutes: u(ht(a)),
|
|
5462
5462
|
seconds: u(ht(l), l === "-0"),
|
|
5463
|
-
milliseconds: u(
|
|
5463
|
+
milliseconds: u(Hs(c), m)
|
|
5464
5464
|
}
|
|
5465
5465
|
];
|
|
5466
5466
|
}
|
|
5467
|
-
const
|
|
5467
|
+
const Wl = {
|
|
5468
5468
|
GMT: 0,
|
|
5469
5469
|
EDT: -240,
|
|
5470
5470
|
EST: -300,
|
|
@@ -5475,9 +5475,9 @@ const Ul = {
|
|
|
5475
5475
|
PDT: -420,
|
|
5476
5476
|
PST: -480
|
|
5477
5477
|
};
|
|
5478
|
-
function
|
|
5478
|
+
function Qs(n, e, t, s, r, i, o) {
|
|
5479
5479
|
const a = {
|
|
5480
|
-
year: e.length === 2 ?
|
|
5480
|
+
year: e.length === 2 ? Ms(st(e)) : st(e),
|
|
5481
5481
|
month: Ki.indexOf(t) + 1,
|
|
5482
5482
|
day: st(s),
|
|
5483
5483
|
hour: st(r),
|
|
@@ -5485,8 +5485,8 @@ function Js(n, e, t, s, r, i, o) {
|
|
|
5485
5485
|
};
|
|
5486
5486
|
return o && (a.second = st(o)), n && (a.weekday = n.length > 3 ? eo.indexOf(n) + 1 : to.indexOf(n) + 1), a;
|
|
5487
5487
|
}
|
|
5488
|
-
const
|
|
5489
|
-
function
|
|
5488
|
+
const jl = /^(?:(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)))$/;
|
|
5489
|
+
function Zl(n) {
|
|
5490
5490
|
const [
|
|
5491
5491
|
,
|
|
5492
5492
|
e,
|
|
@@ -5500,29 +5500,24 @@ function jl(n) {
|
|
|
5500
5500
|
c,
|
|
5501
5501
|
d,
|
|
5502
5502
|
m
|
|
5503
|
-
] = n, u =
|
|
5503
|
+
] = n, u = Qs(e, r, s, t, i, o, a);
|
|
5504
5504
|
let f;
|
|
5505
|
-
return l ? f =
|
|
5505
|
+
return l ? f = Wl[l] : c ? f = 0 : f = Jn(d, m), [u, new _e(f)];
|
|
5506
5506
|
}
|
|
5507
|
-
function
|
|
5507
|
+
function zl(n) {
|
|
5508
5508
|
return n.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
|
|
5509
5509
|
}
|
|
5510
|
-
const
|
|
5511
|
-
function
|
|
5510
|
+
const ql = /^(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$/, Bl = /^(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$/, Hl = /^(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})$/;
|
|
5511
|
+
function Pr(n) {
|
|
5512
5512
|
const [, e, t, s, r, i, o, a] = n;
|
|
5513
|
-
return [
|
|
5513
|
+
return [Qs(e, r, s, t, i, o, a), _e.utcInstance];
|
|
5514
5514
|
}
|
|
5515
|
-
function
|
|
5515
|
+
function Gl(n) {
|
|
5516
5516
|
const [, e, t, s, r, i, o, a] = n;
|
|
5517
|
-
return [
|
|
5517
|
+
return [Qs(e, a, t, s, r, i, o), _e.utcInstance];
|
|
5518
5518
|
}
|
|
5519
|
-
const
|
|
5520
|
-
|
|
5521
|
-
jt,
|
|
5522
|
-
cn,
|
|
5523
|
-
un
|
|
5524
|
-
), Kl = Ut(
|
|
5525
|
-
Al,
|
|
5519
|
+
const Yl = Vt(Nl, Js), Jl = Vt(Dl, Js), Ql = Vt(Al, Js), Kl = Vt(lo), uo = Ut(
|
|
5520
|
+
Pl,
|
|
5526
5521
|
jt,
|
|
5527
5522
|
cn,
|
|
5528
5523
|
un
|
|
@@ -5532,50 +5527,55 @@ const Gl = Vt(xl, Ys), Yl = Vt(Nl, Ys), Jl = Vt(Dl, Ys), Ql = Vt(lo), uo = Ut(
|
|
|
5532
5527
|
cn,
|
|
5533
5528
|
un
|
|
5534
5529
|
), ec = Ut(
|
|
5530
|
+
Fl,
|
|
5531
|
+
jt,
|
|
5532
|
+
cn,
|
|
5533
|
+
un
|
|
5534
|
+
), tc = Ut(
|
|
5535
5535
|
jt,
|
|
5536
5536
|
cn,
|
|
5537
5537
|
un
|
|
5538
5538
|
);
|
|
5539
|
-
function
|
|
5539
|
+
function nc(n) {
|
|
5540
5540
|
return Wt(
|
|
5541
5541
|
n,
|
|
5542
|
-
[
|
|
5543
|
-
[Yl, Kl],
|
|
5542
|
+
[Yl, uo],
|
|
5544
5543
|
[Jl, Xl],
|
|
5545
|
-
[Ql, ec]
|
|
5544
|
+
[Ql, ec],
|
|
5545
|
+
[Kl, tc]
|
|
5546
5546
|
);
|
|
5547
5547
|
}
|
|
5548
|
-
function nc(n) {
|
|
5549
|
-
return Wt(Zl(n), [Wl, jl]);
|
|
5550
|
-
}
|
|
5551
5548
|
function sc(n) {
|
|
5549
|
+
return Wt(zl(n), [jl, Zl]);
|
|
5550
|
+
}
|
|
5551
|
+
function rc(n) {
|
|
5552
5552
|
return Wt(
|
|
5553
5553
|
n,
|
|
5554
|
-
[
|
|
5555
|
-
[
|
|
5556
|
-
[
|
|
5554
|
+
[ql, Pr],
|
|
5555
|
+
[Bl, Pr],
|
|
5556
|
+
[Hl, Gl]
|
|
5557
5557
|
);
|
|
5558
5558
|
}
|
|
5559
|
-
function
|
|
5560
|
-
return Wt(n, [
|
|
5559
|
+
function ic(n) {
|
|
5560
|
+
return Wt(n, [Vl, Ul]);
|
|
5561
5561
|
}
|
|
5562
|
-
const
|
|
5563
|
-
function
|
|
5564
|
-
return Wt(n, [
|
|
5562
|
+
const oc = Ut(jt);
|
|
5563
|
+
function ac(n) {
|
|
5564
|
+
return Wt(n, [Ll, oc]);
|
|
5565
5565
|
}
|
|
5566
|
-
const
|
|
5566
|
+
const lc = Vt($l, Ml), cc = Vt(co), uc = Ut(
|
|
5567
5567
|
jt,
|
|
5568
5568
|
cn,
|
|
5569
5569
|
un
|
|
5570
5570
|
);
|
|
5571
|
-
function
|
|
5571
|
+
function dc(n) {
|
|
5572
5572
|
return Wt(
|
|
5573
5573
|
n,
|
|
5574
|
-
[
|
|
5575
|
-
[
|
|
5574
|
+
[lc, uo],
|
|
5575
|
+
[cc, uc]
|
|
5576
5576
|
);
|
|
5577
5577
|
}
|
|
5578
|
-
const
|
|
5578
|
+
const Lr = "Invalid Duration", fo = {
|
|
5579
5579
|
weeks: {
|
|
5580
5580
|
days: 7,
|
|
5581
5581
|
hours: 168,
|
|
@@ -5592,7 +5592,7 @@ const Pr = "Invalid Duration", fo = {
|
|
|
5592
5592
|
hours: { minutes: 60, seconds: 3600, milliseconds: 3600 * 1e3 },
|
|
5593
5593
|
minutes: { seconds: 60, milliseconds: 60 * 1e3 },
|
|
5594
5594
|
seconds: { milliseconds: 1e3 }
|
|
5595
|
-
},
|
|
5595
|
+
}, fc = {
|
|
5596
5596
|
years: {
|
|
5597
5597
|
quarters: 4,
|
|
5598
5598
|
months: 12,
|
|
@@ -5621,7 +5621,7 @@ const Pr = "Invalid Duration", fo = {
|
|
|
5621
5621
|
milliseconds: 720 * 60 * 60 * 1e3
|
|
5622
5622
|
},
|
|
5623
5623
|
...fo
|
|
5624
|
-
}, xe = 146097 / 400, bt = 146097 / 4800,
|
|
5624
|
+
}, xe = 146097 / 400, bt = 146097 / 4800, hc = {
|
|
5625
5625
|
years: {
|
|
5626
5626
|
quarters: 4,
|
|
5627
5627
|
months: 12,
|
|
@@ -5660,7 +5660,7 @@ const Pr = "Invalid Duration", fo = {
|
|
|
5660
5660
|
"minutes",
|
|
5661
5661
|
"seconds",
|
|
5662
5662
|
"milliseconds"
|
|
5663
|
-
],
|
|
5663
|
+
], mc = gt.slice(0).reverse();
|
|
5664
5664
|
function Be(n, e, t = !1) {
|
|
5665
5665
|
const s = {
|
|
5666
5666
|
values: t ? e.values : { ...n.values, ...e.values || {} },
|
|
@@ -5672,11 +5672,11 @@ function Be(n, e, t = !1) {
|
|
|
5672
5672
|
}
|
|
5673
5673
|
function ho(n, e) {
|
|
5674
5674
|
let t = e.milliseconds ?? 0;
|
|
5675
|
-
for (const s of
|
|
5675
|
+
for (const s of mc.slice(1))
|
|
5676
5676
|
e[s] && (t += e[s] * n[s].milliseconds);
|
|
5677
5677
|
return t;
|
|
5678
5678
|
}
|
|
5679
|
-
function
|
|
5679
|
+
function Vr(n, e) {
|
|
5680
5680
|
const t = ho(n, e) < 0 ? -1 : 1;
|
|
5681
5681
|
gt.reduceRight((s, r) => {
|
|
5682
5682
|
if (H(e[r]))
|
|
@@ -5696,7 +5696,7 @@ function Lr(n, e) {
|
|
|
5696
5696
|
return r;
|
|
5697
5697
|
}, null);
|
|
5698
5698
|
}
|
|
5699
|
-
function
|
|
5699
|
+
function Ur(n) {
|
|
5700
5700
|
const e = {};
|
|
5701
5701
|
for (const [t, s] of Object.entries(n))
|
|
5702
5702
|
s !== 0 && (e[t] = s);
|
|
@@ -5708,7 +5708,7 @@ class te {
|
|
|
5708
5708
|
*/
|
|
5709
5709
|
constructor(e) {
|
|
5710
5710
|
const t = e.conversionAccuracy === "longterm" || !1;
|
|
5711
|
-
let s = t ?
|
|
5711
|
+
let s = t ? hc : fc;
|
|
5712
5712
|
e.matrix && (s = e.matrix), this.values = e.values, this.loc = e.loc || re.create(), this.conversionAccuracy = t ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = s, this.isLuxonDuration = !0;
|
|
5713
5713
|
}
|
|
5714
5714
|
/**
|
|
@@ -5791,7 +5791,7 @@ class te {
|
|
|
5791
5791
|
* @return {Duration}
|
|
5792
5792
|
*/
|
|
5793
5793
|
static fromISO(e, t) {
|
|
5794
|
-
const [s] =
|
|
5794
|
+
const [s] = ic(e);
|
|
5795
5795
|
return s ? te.fromObject(s, t) : te.invalid("unparsable", `the input "${e}" can't be parsed as ISO 8601`);
|
|
5796
5796
|
}
|
|
5797
5797
|
/**
|
|
@@ -5811,7 +5811,7 @@ class te {
|
|
|
5811
5811
|
* @return {Duration}
|
|
5812
5812
|
*/
|
|
5813
5813
|
static fromISOTime(e, t) {
|
|
5814
|
-
const [s] =
|
|
5814
|
+
const [s] = ac(e);
|
|
5815
5815
|
return s ? te.fromObject(s, t) : te.invalid("unparsable", `the input "${e}" can't be parsed as ISO 8601`);
|
|
5816
5816
|
}
|
|
5817
5817
|
/**
|
|
@@ -5825,7 +5825,7 @@ class te {
|
|
|
5825
5825
|
throw new ye("need to specify a reason the Duration is invalid");
|
|
5826
5826
|
const s = e instanceof Pe ? e : new Pe(e, t);
|
|
5827
5827
|
if (le.throwOnInvalid)
|
|
5828
|
-
throw new
|
|
5828
|
+
throw new Ua(s);
|
|
5829
5829
|
return new te({ invalid: s });
|
|
5830
5830
|
}
|
|
5831
5831
|
/**
|
|
@@ -5909,7 +5909,7 @@ class te {
|
|
|
5909
5909
|
...t,
|
|
5910
5910
|
floor: t.round !== !1 && t.floor !== !1
|
|
5911
5911
|
};
|
|
5912
|
-
return this.isValid ? ge.create(this.loc, s).formatDurationFromString(this, e) :
|
|
5912
|
+
return this.isValid ? ge.create(this.loc, s).formatDurationFromString(this, e) : Lr;
|
|
5913
5913
|
}
|
|
5914
5914
|
/**
|
|
5915
5915
|
* Returns a string representation of a Duration with all units included.
|
|
@@ -5928,7 +5928,7 @@ class te {
|
|
|
5928
5928
|
* ```
|
|
5929
5929
|
*/
|
|
5930
5930
|
toHuman(e = {}) {
|
|
5931
|
-
if (!this.isValid) return
|
|
5931
|
+
if (!this.isValid) return Lr;
|
|
5932
5932
|
const t = e.showZeros !== !1, s = gt.map((r) => {
|
|
5933
5933
|
const i = this.values[r];
|
|
5934
5934
|
return H(i) || i === 0 && !t ? null : this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...e, unit: r.slice(0, -1) }).format(i);
|
|
@@ -5956,7 +5956,7 @@ class te {
|
|
|
5956
5956
|
toISO() {
|
|
5957
5957
|
if (!this.isValid) return null;
|
|
5958
5958
|
let e = "P";
|
|
5959
|
-
return this.years !== 0 && (e += this.years + "Y"), (this.months !== 0 || this.quarters !== 0) && (e += this.months + this.quarters * 3 + "M"), this.weeks !== 0 && (e += this.weeks + "W"), this.days !== 0 && (e += this.days + "D"), (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) && (e += "T"), this.hours !== 0 && (e += this.hours + "H"), this.minutes !== 0 && (e += this.minutes + "M"), (this.seconds !== 0 || this.milliseconds !== 0) && (e +=
|
|
5959
|
+
return this.years !== 0 && (e += this.years + "Y"), (this.months !== 0 || this.quarters !== 0) && (e += this.months + this.quarters * 3 + "M"), this.weeks !== 0 && (e += this.weeks + "W"), this.days !== 0 && (e += this.days + "D"), (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) && (e += "T"), this.hours !== 0 && (e += this.hours + "H"), this.minutes !== 0 && (e += this.minutes + "M"), (this.seconds !== 0 || this.milliseconds !== 0) && (e += Gs(this.seconds + this.milliseconds / 1e3, 3) + "S"), e === "P" && (e += "T0S"), e;
|
|
5960
5960
|
}
|
|
5961
5961
|
/**
|
|
5962
5962
|
* Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.
|
|
@@ -6118,7 +6118,7 @@ class te {
|
|
|
6118
6118
|
normalize() {
|
|
6119
6119
|
if (!this.isValid) return this;
|
|
6120
6120
|
const e = this.toObject();
|
|
6121
|
-
return
|
|
6121
|
+
return Vr(this.matrix, e), Be(this, { values: e }, !0);
|
|
6122
6122
|
}
|
|
6123
6123
|
/**
|
|
6124
6124
|
* Rescale units to its largest representation
|
|
@@ -6127,7 +6127,7 @@ class te {
|
|
|
6127
6127
|
*/
|
|
6128
6128
|
rescale() {
|
|
6129
6129
|
if (!this.isValid) return this;
|
|
6130
|
-
const e =
|
|
6130
|
+
const e = Ur(this.normalize().shiftToAll().toObject());
|
|
6131
6131
|
return Be(this, { values: e }, !0);
|
|
6132
6132
|
}
|
|
6133
6133
|
/**
|
|
@@ -6154,7 +6154,7 @@ class te {
|
|
|
6154
6154
|
} else at(r[o]) && (s[o] = r[o]);
|
|
6155
6155
|
for (const o in s)
|
|
6156
6156
|
s[o] !== 0 && (t[i] += o === i ? s[o] : s[o] / this.matrix[i][o]);
|
|
6157
|
-
return
|
|
6157
|
+
return Vr(this.matrix, t), Be(this, { values: t }, !0);
|
|
6158
6158
|
}
|
|
6159
6159
|
/**
|
|
6160
6160
|
* Shift this Duration to all available units.
|
|
@@ -6192,7 +6192,7 @@ class te {
|
|
|
6192
6192
|
*/
|
|
6193
6193
|
removeZeros() {
|
|
6194
6194
|
if (!this.isValid) return this;
|
|
6195
|
-
const e =
|
|
6195
|
+
const e = Ur(this.values);
|
|
6196
6196
|
return Be(this, { values: e }, !0);
|
|
6197
6197
|
}
|
|
6198
6198
|
/**
|
|
@@ -6299,7 +6299,7 @@ class te {
|
|
|
6299
6299
|
}
|
|
6300
6300
|
}
|
|
6301
6301
|
const Tt = "Invalid Interval";
|
|
6302
|
-
function
|
|
6302
|
+
function pc(n, e) {
|
|
6303
6303
|
return !n || !n.isValid ? ae.invalid("missing or invalid start") : !e || !e.isValid ? ae.invalid("missing or invalid end") : e < n ? ae.invalid(
|
|
6304
6304
|
"end before start",
|
|
6305
6305
|
`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`
|
|
@@ -6323,7 +6323,7 @@ class ae {
|
|
|
6323
6323
|
throw new ye("need to specify a reason the Interval is invalid");
|
|
6324
6324
|
const s = e instanceof Pe ? e : new Pe(e, t);
|
|
6325
6325
|
if (le.throwOnInvalid)
|
|
6326
|
-
throw new
|
|
6326
|
+
throw new Va(s);
|
|
6327
6327
|
return new ae({ invalid: s });
|
|
6328
6328
|
}
|
|
6329
6329
|
/**
|
|
@@ -6333,7 +6333,7 @@ class ae {
|
|
|
6333
6333
|
* @return {Interval}
|
|
6334
6334
|
*/
|
|
6335
6335
|
static fromDateTimes(e, t) {
|
|
6336
|
-
const s = qt(e), r = qt(t), i =
|
|
6336
|
+
const s = qt(e), r = qt(t), i = pc(s, r);
|
|
6337
6337
|
return i ?? new ae({
|
|
6338
6338
|
start: s,
|
|
6339
6339
|
end: r
|
|
@@ -6936,11 +6936,11 @@ class pn {
|
|
|
6936
6936
|
return { relative: Gi(), localeWeek: Yi() };
|
|
6937
6937
|
}
|
|
6938
6938
|
}
|
|
6939
|
-
function
|
|
6939
|
+
function Wr(n, e) {
|
|
6940
6940
|
const t = (r) => r.toUTC(0, { keepLocalTime: !0 }).startOf("day").valueOf(), s = t(e) - t(n);
|
|
6941
6941
|
return Math.floor(te.fromMillis(s).as("days"));
|
|
6942
6942
|
}
|
|
6943
|
-
function
|
|
6943
|
+
function yc(n, e, t) {
|
|
6944
6944
|
const s = [
|
|
6945
6945
|
["years", (l, c) => c.year - l.year],
|
|
6946
6946
|
["quarters", (l, c) => c.quarter - l.quarter + (c.year - l.year) * 4],
|
|
@@ -6948,19 +6948,19 @@ function pc(n, e, t) {
|
|
|
6948
6948
|
[
|
|
6949
6949
|
"weeks",
|
|
6950
6950
|
(l, c) => {
|
|
6951
|
-
const d =
|
|
6951
|
+
const d = Wr(l, c);
|
|
6952
6952
|
return (d - d % 7) / 7;
|
|
6953
6953
|
}
|
|
6954
6954
|
],
|
|
6955
|
-
["days",
|
|
6955
|
+
["days", Wr]
|
|
6956
6956
|
], r = {}, i = n;
|
|
6957
6957
|
let o, a;
|
|
6958
6958
|
for (const [l, c] of s)
|
|
6959
6959
|
t.indexOf(l) >= 0 && (o = l, r[l] = c(n, e), a = i.plus(r), a > e ? (r[l]--, n = i.plus(r), n > e && (a = n, r[l]--, n = i.plus(r))) : n = a);
|
|
6960
6960
|
return [n, r, a, o];
|
|
6961
6961
|
}
|
|
6962
|
-
function
|
|
6963
|
-
let [r, i, o, a] =
|
|
6962
|
+
function gc(n, e, t, s) {
|
|
6963
|
+
let [r, i, o, a] = yc(n, e, t);
|
|
6964
6964
|
const l = e - r, c = t.filter(
|
|
6965
6965
|
(m) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(m) >= 0
|
|
6966
6966
|
);
|
|
@@ -6968,47 +6968,47 @@ function yc(n, e, t, s) {
|
|
|
6968
6968
|
const d = te.fromObject(i, s);
|
|
6969
6969
|
return c.length > 0 ? te.fromMillis(l, s).shiftTo(...c).plus(d) : d;
|
|
6970
6970
|
}
|
|
6971
|
-
const
|
|
6971
|
+
const wc = "missing Intl.DateTimeFormat.formatToParts support";
|
|
6972
6972
|
function se(n, e = (t) => t) {
|
|
6973
|
-
return { regex: n, deser: ([t]) => e(
|
|
6973
|
+
return { regex: n, deser: ([t]) => e(ll(t)) };
|
|
6974
6974
|
}
|
|
6975
|
-
const
|
|
6976
|
-
function
|
|
6975
|
+
const _c = " ", mo = `[ ${_c}]`, po = new RegExp(mo, "g");
|
|
6976
|
+
function Ec(n) {
|
|
6977
6977
|
return n.replace(/\./g, "\\.?").replace(po, mo);
|
|
6978
6978
|
}
|
|
6979
|
-
function
|
|
6979
|
+
function jr(n) {
|
|
6980
6980
|
return n.replace(/\./g, "").replace(po, " ").toLowerCase();
|
|
6981
6981
|
}
|
|
6982
|
-
function
|
|
6982
|
+
function Me(n, e) {
|
|
6983
6983
|
return n === null ? null : {
|
|
6984
|
-
regex: RegExp(n.map(
|
|
6985
|
-
deser: ([t]) => n.findIndex((s) =>
|
|
6984
|
+
regex: RegExp(n.map(Ec).join("|")),
|
|
6985
|
+
deser: ([t]) => n.findIndex((s) => jr(t) === jr(s)) + e
|
|
6986
6986
|
};
|
|
6987
6987
|
}
|
|
6988
|
-
function
|
|
6988
|
+
function Zr(n, e) {
|
|
6989
6989
|
return { regex: n, deser: ([, t, s]) => Jn(t, s), groups: e };
|
|
6990
6990
|
}
|
|
6991
6991
|
function yn(n) {
|
|
6992
6992
|
return { regex: n, deser: ([e]) => e };
|
|
6993
6993
|
}
|
|
6994
|
-
function
|
|
6994
|
+
function vc(n) {
|
|
6995
6995
|
return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
6996
6996
|
}
|
|
6997
|
-
function
|
|
6998
|
-
const t =
|
|
6997
|
+
function Oc(n, e) {
|
|
6998
|
+
const t = $e(e), s = $e(e, "{2}"), r = $e(e, "{3}"), i = $e(e, "{4}"), o = $e(e, "{6}"), a = $e(e, "{1,2}"), l = $e(e, "{1,3}"), c = $e(e, "{1,6}"), d = $e(e, "{1,9}"), m = $e(e, "{2,4}"), u = $e(e, "{4,6}"), f = (y) => ({ regex: RegExp(vc(y.val)), deser: ([w]) => w, literal: !0 }), v = ((y) => {
|
|
6999
6999
|
if (n.literal)
|
|
7000
7000
|
return f(y);
|
|
7001
7001
|
switch (y.val) {
|
|
7002
7002
|
// era
|
|
7003
7003
|
case "G":
|
|
7004
|
-
return
|
|
7004
|
+
return Me(e.eras("short"), 0);
|
|
7005
7005
|
case "GG":
|
|
7006
|
-
return
|
|
7006
|
+
return Me(e.eras("long"), 0);
|
|
7007
7007
|
// years
|
|
7008
7008
|
case "y":
|
|
7009
7009
|
return se(c);
|
|
7010
7010
|
case "yy":
|
|
7011
|
-
return se(m,
|
|
7011
|
+
return se(m, Ms);
|
|
7012
7012
|
case "yyyy":
|
|
7013
7013
|
return se(i);
|
|
7014
7014
|
case "yyyyy":
|
|
@@ -7021,17 +7021,17 @@ function vc(n, e) {
|
|
|
7021
7021
|
case "MM":
|
|
7022
7022
|
return se(s);
|
|
7023
7023
|
case "MMM":
|
|
7024
|
-
return
|
|
7024
|
+
return Me(e.months("short", !0), 1);
|
|
7025
7025
|
case "MMMM":
|
|
7026
|
-
return
|
|
7026
|
+
return Me(e.months("long", !0), 1);
|
|
7027
7027
|
case "L":
|
|
7028
7028
|
return se(a);
|
|
7029
7029
|
case "LL":
|
|
7030
7030
|
return se(s);
|
|
7031
7031
|
case "LLL":
|
|
7032
|
-
return
|
|
7032
|
+
return Me(e.months("short", !1), 1);
|
|
7033
7033
|
case "LLLL":
|
|
7034
|
-
return
|
|
7034
|
+
return Me(e.months("long", !1), 1);
|
|
7035
7035
|
// dates
|
|
7036
7036
|
case "d":
|
|
7037
7037
|
return se(a);
|
|
@@ -7075,12 +7075,12 @@ function vc(n, e) {
|
|
|
7075
7075
|
return se(t);
|
|
7076
7076
|
// meridiem
|
|
7077
7077
|
case "a":
|
|
7078
|
-
return
|
|
7078
|
+
return Me(e.meridiems(), 0);
|
|
7079
7079
|
// weekYear (k)
|
|
7080
7080
|
case "kkkk":
|
|
7081
7081
|
return se(i);
|
|
7082
7082
|
case "kk":
|
|
7083
|
-
return se(m,
|
|
7083
|
+
return se(m, Ms);
|
|
7084
7084
|
// weekNumber (W)
|
|
7085
7085
|
case "W":
|
|
7086
7086
|
return se(a);
|
|
@@ -7091,19 +7091,19 @@ function vc(n, e) {
|
|
|
7091
7091
|
case "c":
|
|
7092
7092
|
return se(t);
|
|
7093
7093
|
case "EEE":
|
|
7094
|
-
return
|
|
7094
|
+
return Me(e.weekdays("short", !1), 1);
|
|
7095
7095
|
case "EEEE":
|
|
7096
|
-
return
|
|
7096
|
+
return Me(e.weekdays("long", !1), 1);
|
|
7097
7097
|
case "ccc":
|
|
7098
|
-
return
|
|
7098
|
+
return Me(e.weekdays("short", !0), 1);
|
|
7099
7099
|
case "cccc":
|
|
7100
|
-
return
|
|
7100
|
+
return Me(e.weekdays("long", !0), 1);
|
|
7101
7101
|
// offset/zone
|
|
7102
7102
|
case "Z":
|
|
7103
7103
|
case "ZZ":
|
|
7104
|
-
return
|
|
7104
|
+
return Zr(new RegExp(`([+-]${a.source})(?::(${s.source}))?`), 2);
|
|
7105
7105
|
case "ZZZ":
|
|
7106
|
-
return
|
|
7106
|
+
return Zr(new RegExp(`([+-]${a.source})(${s.source})?`), 2);
|
|
7107
7107
|
// we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing
|
|
7108
7108
|
// because we don't have any way to figure out what they are
|
|
7109
7109
|
case "z":
|
|
@@ -7116,11 +7116,11 @@ function vc(n, e) {
|
|
|
7116
7116
|
return f(y);
|
|
7117
7117
|
}
|
|
7118
7118
|
})(n) || {
|
|
7119
|
-
invalidReason:
|
|
7119
|
+
invalidReason: wc
|
|
7120
7120
|
};
|
|
7121
7121
|
return v.token = n, v;
|
|
7122
7122
|
}
|
|
7123
|
-
const
|
|
7123
|
+
const kc = {
|
|
7124
7124
|
year: {
|
|
7125
7125
|
"2-digit": "yy",
|
|
7126
7126
|
numeric: "yyyyy"
|
|
@@ -7162,7 +7162,7 @@ const Oc = {
|
|
|
7162
7162
|
short: "ZZZ"
|
|
7163
7163
|
}
|
|
7164
7164
|
};
|
|
7165
|
-
function
|
|
7165
|
+
function bc(n, e, t) {
|
|
7166
7166
|
const { type: s, value: r } = n;
|
|
7167
7167
|
if (s === "literal") {
|
|
7168
7168
|
const l = /^\s+$/.test(r);
|
|
@@ -7174,17 +7174,17 @@ function kc(n, e, t) {
|
|
|
7174
7174
|
const i = e[s];
|
|
7175
7175
|
let o = s;
|
|
7176
7176
|
s === "hour" && (e.hour12 != null ? o = e.hour12 ? "hour12" : "hour24" : e.hourCycle != null ? e.hourCycle === "h11" || e.hourCycle === "h12" ? o = "hour12" : o = "hour24" : o = t.hour12 ? "hour12" : "hour24");
|
|
7177
|
-
let a =
|
|
7177
|
+
let a = kc[o];
|
|
7178
7178
|
if (typeof a == "object" && (a = a[i]), a)
|
|
7179
7179
|
return {
|
|
7180
7180
|
literal: !1,
|
|
7181
7181
|
val: a
|
|
7182
7182
|
};
|
|
7183
7183
|
}
|
|
7184
|
-
function
|
|
7184
|
+
function Tc(n) {
|
|
7185
7185
|
return [`^${n.map((t) => t.regex).reduce((t, s) => `${t}(${s.source})`, "")}$`, n];
|
|
7186
7186
|
}
|
|
7187
|
-
function
|
|
7187
|
+
function Sc(n, e, t) {
|
|
7188
7188
|
const s = n.match(e);
|
|
7189
7189
|
if (s) {
|
|
7190
7190
|
const r = {};
|
|
@@ -7198,7 +7198,7 @@ function Tc(n, e, t) {
|
|
|
7198
7198
|
} else
|
|
7199
7199
|
return [s, {}];
|
|
7200
7200
|
}
|
|
7201
|
-
function
|
|
7201
|
+
function Rc(n) {
|
|
7202
7202
|
const e = (i) => {
|
|
7203
7203
|
switch (i) {
|
|
7204
7204
|
case "S":
|
|
@@ -7233,34 +7233,34 @@ function Sc(n) {
|
|
|
7233
7233
|
}
|
|
7234
7234
|
};
|
|
7235
7235
|
let t = null, s;
|
|
7236
|
-
return H(n.z) || (t = Qe.create(n.z)), H(n.Z) || (t || (t = new _e(n.Z)), s = n.Z), H(n.q) || (n.M = (n.q - 1) * 3 + 1), H(n.h) || (n.h < 12 && n.a === 1 ? n.h += 12 : n.h === 12 && n.a === 0 && (n.h = 0)), n.G === 0 && n.y && (n.y = -n.y), H(n.u) || (n.S =
|
|
7236
|
+
return H(n.z) || (t = Qe.create(n.z)), H(n.Z) || (t || (t = new _e(n.Z)), s = n.Z), H(n.q) || (n.M = (n.q - 1) * 3 + 1), H(n.h) || (n.h < 12 && n.a === 1 ? n.h += 12 : n.h === 12 && n.a === 0 && (n.h = 0)), n.G === 0 && n.y && (n.y = -n.y), H(n.u) || (n.S = Hs(n.u)), [Object.keys(n).reduce((i, o) => {
|
|
7237
7237
|
const a = e(o);
|
|
7238
7238
|
return a && (i[a] = n[o]), i;
|
|
7239
7239
|
}, {}), t, s];
|
|
7240
7240
|
}
|
|
7241
7241
|
let ls = null;
|
|
7242
|
-
function
|
|
7242
|
+
function Ic() {
|
|
7243
7243
|
return ls || (ls = L.fromMillis(1555555555555)), ls;
|
|
7244
7244
|
}
|
|
7245
|
-
function
|
|
7245
|
+
function xc(n, e) {
|
|
7246
7246
|
if (n.literal)
|
|
7247
7247
|
return n;
|
|
7248
7248
|
const t = ge.macroTokenToFormatOpts(n.val), s = _o(t, e);
|
|
7249
7249
|
return s == null || s.includes(void 0) ? n : s;
|
|
7250
7250
|
}
|
|
7251
7251
|
function yo(n, e) {
|
|
7252
|
-
return Array.prototype.concat(...n.map((t) =>
|
|
7252
|
+
return Array.prototype.concat(...n.map((t) => xc(t, e)));
|
|
7253
7253
|
}
|
|
7254
7254
|
class go {
|
|
7255
7255
|
constructor(e, t) {
|
|
7256
|
-
if (this.locale = e, this.format = t, this.tokens = yo(ge.parseFormat(t), e), this.units = this.tokens.map((s) =>
|
|
7257
|
-
const [s, r] =
|
|
7256
|
+
if (this.locale = e, this.format = t, this.tokens = yo(ge.parseFormat(t), e), this.units = this.tokens.map((s) => Oc(s, e)), this.disqualifyingUnit = this.units.find((s) => s.invalidReason), !this.disqualifyingUnit) {
|
|
7257
|
+
const [s, r] = Tc(this.units);
|
|
7258
7258
|
this.regex = RegExp(s, "i"), this.handlers = r;
|
|
7259
7259
|
}
|
|
7260
7260
|
}
|
|
7261
7261
|
explainFromTokens(e) {
|
|
7262
7262
|
if (this.isValid) {
|
|
7263
|
-
const [t, s] =
|
|
7263
|
+
const [t, s] = Sc(e, this.regex, this.handlers), [r, i, o] = s ? Rc(s) : [null, null, void 0];
|
|
7264
7264
|
if (Pt(s, "a") && Pt(s, "H"))
|
|
7265
7265
|
throw new It(
|
|
7266
7266
|
"Can't include meridiem when specifying 24-hour format"
|
|
@@ -7288,17 +7288,17 @@ class go {
|
|
|
7288
7288
|
function wo(n, e, t) {
|
|
7289
7289
|
return new go(n, t).explainFromTokens(e);
|
|
7290
7290
|
}
|
|
7291
|
-
function
|
|
7291
|
+
function Nc(n, e, t) {
|
|
7292
7292
|
const { result: s, zone: r, specificOffset: i, invalidReason: o } = wo(n, e, t);
|
|
7293
7293
|
return [s, r, i, o];
|
|
7294
7294
|
}
|
|
7295
7295
|
function _o(n, e) {
|
|
7296
7296
|
if (!n)
|
|
7297
7297
|
return null;
|
|
7298
|
-
const s = ge.create(e, n).dtFormatter(
|
|
7299
|
-
return r.map((o) =>
|
|
7298
|
+
const s = ge.create(e, n).dtFormatter(Ic()), r = s.formatToParts(), i = s.resolvedOptions();
|
|
7299
|
+
return r.map((o) => bc(o, n, i));
|
|
7300
7300
|
}
|
|
7301
|
-
const cs = "Invalid DateTime",
|
|
7301
|
+
const cs = "Invalid DateTime", zr = 864e13;
|
|
7302
7302
|
function Yt(n) {
|
|
7303
7303
|
return new Pe("unsupported zone", `the zone "${n.name}" is not supported`);
|
|
7304
7304
|
}
|
|
@@ -7348,7 +7348,7 @@ function gn(n, e) {
|
|
|
7348
7348
|
function vn(n, e, t) {
|
|
7349
7349
|
return Eo(Yn(n), e, t);
|
|
7350
7350
|
}
|
|
7351
|
-
function
|
|
7351
|
+
function qr(n, e) {
|
|
7352
7352
|
const t = n.o, s = n.c.year + Math.trunc(e.years), r = n.c.month + Math.trunc(e.months) + Math.trunc(e.quarters) * 3, i = {
|
|
7353
7353
|
...n.c,
|
|
7354
7354
|
year: s,
|
|
@@ -7398,7 +7398,7 @@ function fs(n, e, t) {
|
|
|
7398
7398
|
} else if (r += de(n.c.month), t === "month") return r;
|
|
7399
7399
|
return r += de(n.c.day), r;
|
|
7400
7400
|
}
|
|
7401
|
-
function
|
|
7401
|
+
function Br(n, e, t, s, r, i, o) {
|
|
7402
7402
|
let a = !t || n.c.millisecond !== 0 || n.c.second !== 0, l = "";
|
|
7403
7403
|
switch (o) {
|
|
7404
7404
|
case "day":
|
|
@@ -7426,20 +7426,20 @@ const vo = {
|
|
|
7426
7426
|
minute: 0,
|
|
7427
7427
|
second: 0,
|
|
7428
7428
|
millisecond: 0
|
|
7429
|
-
},
|
|
7429
|
+
}, Dc = {
|
|
7430
7430
|
weekNumber: 1,
|
|
7431
7431
|
weekday: 1,
|
|
7432
7432
|
hour: 0,
|
|
7433
7433
|
minute: 0,
|
|
7434
7434
|
second: 0,
|
|
7435
7435
|
millisecond: 0
|
|
7436
|
-
},
|
|
7436
|
+
}, Ac = {
|
|
7437
7437
|
ordinal: 1,
|
|
7438
7438
|
hour: 0,
|
|
7439
7439
|
minute: 0,
|
|
7440
7440
|
second: 0,
|
|
7441
7441
|
millisecond: 0
|
|
7442
|
-
}, On = ["year", "month", "day", "hour", "minute", "second", "millisecond"],
|
|
7442
|
+
}, On = ["year", "month", "day", "hour", "minute", "second", "millisecond"], Cc = [
|
|
7443
7443
|
"weekYear",
|
|
7444
7444
|
"weekNumber",
|
|
7445
7445
|
"weekday",
|
|
@@ -7447,7 +7447,7 @@ const vo = {
|
|
|
7447
7447
|
"minute",
|
|
7448
7448
|
"second",
|
|
7449
7449
|
"millisecond"
|
|
7450
|
-
],
|
|
7450
|
+
], Fc = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
|
|
7451
7451
|
function kn(n) {
|
|
7452
7452
|
const e = {
|
|
7453
7453
|
year: "year",
|
|
@@ -7478,7 +7478,7 @@ function kn(n) {
|
|
|
7478
7478
|
if (!e) throw new Ei(n);
|
|
7479
7479
|
return e;
|
|
7480
7480
|
}
|
|
7481
|
-
function
|
|
7481
|
+
function Hr(n) {
|
|
7482
7482
|
switch (n.toLowerCase()) {
|
|
7483
7483
|
case "localweekday":
|
|
7484
7484
|
case "localweekdays":
|
|
@@ -7500,7 +7500,7 @@ function $c(n) {
|
|
|
7500
7500
|
let t = Ps.get(e);
|
|
7501
7501
|
return t === void 0 && (t = n.offset(Jt), Ps.set(e, t)), t;
|
|
7502
7502
|
}
|
|
7503
|
-
function
|
|
7503
|
+
function Gr(n, e) {
|
|
7504
7504
|
const t = rt(e.zone, le.defaultZone);
|
|
7505
7505
|
if (!t.isValid)
|
|
7506
7506
|
return L.invalid(Yt(t));
|
|
@@ -7519,8 +7519,8 @@ function Hr(n, e) {
|
|
|
7519
7519
|
}
|
|
7520
7520
|
return new L({ ts: r, zone: t, loc: s, o: i });
|
|
7521
7521
|
}
|
|
7522
|
-
function
|
|
7523
|
-
const s = H(t.round) ? !0 : t.round, r = H(t.rounding) ? "trunc" : t.rounding, i = (a, l) => (a =
|
|
7522
|
+
function Yr(n, e, t) {
|
|
7523
|
+
const s = H(t.round) ? !0 : t.round, r = H(t.rounding) ? "trunc" : t.rounding, i = (a, l) => (a = Gs(a, s || t.calendary ? 0 : 2, t.calendary ? "round" : r), e.loc.clone(t).relFormatter(t).format(a, l)), o = (a) => t.calendary ? e.hasSame(n, a) ? 0 : e.startOf(a).diff(n.startOf(a), a).get(a) : e.diff(n, a).get(a);
|
|
7524
7524
|
if (t.unit)
|
|
7525
7525
|
return i(o(t.unit), t.unit);
|
|
7526
7526
|
for (const a of t.units) {
|
|
@@ -7530,7 +7530,7 @@ function Gr(n, e, t) {
|
|
|
7530
7530
|
}
|
|
7531
7531
|
return i(n > e ? -0 : 0, t.units[t.units.length - 1]);
|
|
7532
7532
|
}
|
|
7533
|
-
function
|
|
7533
|
+
function Jr(n) {
|
|
7534
7534
|
let e = {}, t;
|
|
7535
7535
|
return n.length > 0 && typeof n[n.length - 1] == "object" ? (e = n[n.length - 1], t = Array.from(n).slice(0, n.length - 1)) : t = Array.from(n), [e, t];
|
|
7536
7536
|
}
|
|
@@ -7587,8 +7587,8 @@ class L {
|
|
|
7587
7587
|
* @return {DateTime}
|
|
7588
7588
|
*/
|
|
7589
7589
|
static local() {
|
|
7590
|
-
const [e, t] =
|
|
7591
|
-
return
|
|
7590
|
+
const [e, t] = Jr(arguments), [s, r, i, o, a, l, c] = t;
|
|
7591
|
+
return Gr({ year: s, month: r, day: i, hour: o, minute: a, second: l, millisecond: c }, e);
|
|
7592
7592
|
}
|
|
7593
7593
|
/**
|
|
7594
7594
|
* Create a DateTime in UTC
|
|
@@ -7616,8 +7616,8 @@ class L {
|
|
|
7616
7616
|
* @return {DateTime}
|
|
7617
7617
|
*/
|
|
7618
7618
|
static utc() {
|
|
7619
|
-
const [e, t] =
|
|
7620
|
-
return e.zone = _e.utcInstance,
|
|
7619
|
+
const [e, t] = Jr(arguments), [s, r, i, o, a, l, c] = t;
|
|
7620
|
+
return e.zone = _e.utcInstance, Gr({ year: s, month: r, day: i, hour: o, minute: a, second: l, millisecond: c }, e);
|
|
7621
7621
|
}
|
|
7622
7622
|
/**
|
|
7623
7623
|
* Create a DateTime from a JavaScript Date object. Uses the default zone.
|
|
@@ -7627,7 +7627,7 @@ class L {
|
|
|
7627
7627
|
* @return {DateTime}
|
|
7628
7628
|
*/
|
|
7629
7629
|
static fromJSDate(e, t = {}) {
|
|
7630
|
-
const s =
|
|
7630
|
+
const s = hl(e) ? e.valueOf() : NaN;
|
|
7631
7631
|
if (Number.isNaN(s))
|
|
7632
7632
|
return L.invalid("invalid input");
|
|
7633
7633
|
const r = rt(t.zone, le.defaultZone);
|
|
@@ -7650,7 +7650,7 @@ class L {
|
|
|
7650
7650
|
*/
|
|
7651
7651
|
static fromMillis(e, t = {}) {
|
|
7652
7652
|
if (at(e))
|
|
7653
|
-
return e < -
|
|
7653
|
+
return e < -zr || e > zr ? L.invalid("Timestamp out of range") : new L({
|
|
7654
7654
|
ts: e,
|
|
7655
7655
|
zone: rt(t.zone, le.defaultZone),
|
|
7656
7656
|
loc: re.fromObject(t)
|
|
@@ -7717,7 +7717,7 @@ class L {
|
|
|
7717
7717
|
const s = rt(t.zone, le.defaultZone);
|
|
7718
7718
|
if (!s.isValid)
|
|
7719
7719
|
return L.invalid(Yt(s));
|
|
7720
|
-
const r = re.fromObject(t), i = Wn(e,
|
|
7720
|
+
const r = re.fromObject(t), i = Wn(e, Hr), { minDaysInFirstWeek: o, startOfWeek: a } = Cr(i, r), l = le.now(), c = H(t.specificOffset) ? s.offset(l) : t.specificOffset, d = !H(i.ordinal), m = !H(i.year), u = !H(i.month) || !H(i.day), f = m || u, g = i.weekYear || i.weekNumber;
|
|
7721
7721
|
if ((f || d) && g)
|
|
7722
7722
|
throw new It(
|
|
7723
7723
|
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
|
|
@@ -7726,16 +7726,16 @@ class L {
|
|
|
7726
7726
|
throw new It("Can't mix ordinal dates with month/day");
|
|
7727
7727
|
const v = g || i.weekday && !f;
|
|
7728
7728
|
let y, w, R = gn(l, c);
|
|
7729
|
-
v ? (y =
|
|
7729
|
+
v ? (y = Cc, w = Dc, R = Vn(R, o, a)) : d ? (y = Fc, w = Ac, R = as(R)) : (y = On, w = vo);
|
|
7730
7730
|
let O = !1;
|
|
7731
7731
|
for (const p of y) {
|
|
7732
|
-
const
|
|
7733
|
-
H(
|
|
7732
|
+
const F = i[p];
|
|
7733
|
+
H(F) ? O ? i[p] = w[p] : i[p] = R[p] : O = !0;
|
|
7734
7734
|
}
|
|
7735
|
-
const I = v ?
|
|
7735
|
+
const I = v ? ul(i, o, a) : d ? dl(i) : Bi(i), E = I || Hi(i);
|
|
7736
7736
|
if (E)
|
|
7737
7737
|
return L.invalid(E);
|
|
7738
|
-
const C = v ?
|
|
7738
|
+
const C = v ? Dr(i, o, a) : d ? Ar(i) : i, [_, z] = vn(C, c, s), k = new L({
|
|
7739
7739
|
ts: _,
|
|
7740
7740
|
zone: s,
|
|
7741
7741
|
o: z,
|
|
@@ -7764,7 +7764,7 @@ class L {
|
|
|
7764
7764
|
* @return {DateTime}
|
|
7765
7765
|
*/
|
|
7766
7766
|
static fromISO(e, t = {}) {
|
|
7767
|
-
const [s, r] =
|
|
7767
|
+
const [s, r] = nc(e);
|
|
7768
7768
|
return St(s, r, t, "ISO 8601", e);
|
|
7769
7769
|
}
|
|
7770
7770
|
/**
|
|
@@ -7783,7 +7783,7 @@ class L {
|
|
|
7783
7783
|
* @return {DateTime}
|
|
7784
7784
|
*/
|
|
7785
7785
|
static fromRFC2822(e, t = {}) {
|
|
7786
|
-
const [s, r] =
|
|
7786
|
+
const [s, r] = sc(e);
|
|
7787
7787
|
return St(s, r, t, "RFC 2822", e);
|
|
7788
7788
|
}
|
|
7789
7789
|
/**
|
|
@@ -7803,7 +7803,7 @@ class L {
|
|
|
7803
7803
|
* @return {DateTime}
|
|
7804
7804
|
*/
|
|
7805
7805
|
static fromHTTP(e, t = {}) {
|
|
7806
|
-
const [s, r] =
|
|
7806
|
+
const [s, r] = rc(e);
|
|
7807
7807
|
return St(s, r, t, "HTTP", t);
|
|
7808
7808
|
}
|
|
7809
7809
|
/**
|
|
@@ -7827,7 +7827,7 @@ class L {
|
|
|
7827
7827
|
locale: r,
|
|
7828
7828
|
numberingSystem: i,
|
|
7829
7829
|
defaultToEN: !0
|
|
7830
|
-
}), [a, l, c, d] =
|
|
7830
|
+
}), [a, l, c, d] = Nc(o, e, t);
|
|
7831
7831
|
return d ? L.invalid(d) : St(a, l, s, `format ${t}`, e, c);
|
|
7832
7832
|
}
|
|
7833
7833
|
/**
|
|
@@ -7858,7 +7858,7 @@ class L {
|
|
|
7858
7858
|
* @return {DateTime}
|
|
7859
7859
|
*/
|
|
7860
7860
|
static fromSQL(e, t = {}) {
|
|
7861
|
-
const [s, r] =
|
|
7861
|
+
const [s, r] = dc(e);
|
|
7862
7862
|
return St(s, r, t, "SQL", e);
|
|
7863
7863
|
}
|
|
7864
7864
|
/**
|
|
@@ -7872,7 +7872,7 @@ class L {
|
|
|
7872
7872
|
throw new ye("need to specify a reason the DateTime is invalid");
|
|
7873
7873
|
const s = e instanceof Pe ? e : new Pe(e, t);
|
|
7874
7874
|
if (le.throwOnInvalid)
|
|
7875
|
-
throw new
|
|
7875
|
+
throw new La(s);
|
|
7876
7876
|
return new L({ invalid: s });
|
|
7877
7877
|
}
|
|
7878
7878
|
/**
|
|
@@ -8348,7 +8348,7 @@ class L {
|
|
|
8348
8348
|
*/
|
|
8349
8349
|
set(e) {
|
|
8350
8350
|
if (!this.isValid) return this;
|
|
8351
|
-
const t = Wn(e,
|
|
8351
|
+
const t = Wn(e, Hr), { minDaysInFirstWeek: s, startOfWeek: r } = Cr(t, this.loc), i = !H(t.weekYear) || !H(t.weekNumber) || !H(t.weekday), o = !H(t.ordinal), a = !H(t.year), l = !H(t.month) || !H(t.day), c = a || l, d = t.weekYear || t.weekNumber;
|
|
8352
8352
|
if ((c || o) && d)
|
|
8353
8353
|
throw new It(
|
|
8354
8354
|
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
|
|
@@ -8356,11 +8356,11 @@ class L {
|
|
|
8356
8356
|
if (l && o)
|
|
8357
8357
|
throw new It("Can't mix ordinal dates with month/day");
|
|
8358
8358
|
let m;
|
|
8359
|
-
i ? m =
|
|
8359
|
+
i ? m = Dr(
|
|
8360
8360
|
{ ...Vn(this.c, s, r), ...t },
|
|
8361
8361
|
s,
|
|
8362
8362
|
r
|
|
8363
|
-
) : H(t.ordinal) ? (m = { ...this.toObject(), ...t }, H(t.day) && (m.day = Math.min(Un(m.year, m.month), m.day))) : m =
|
|
8363
|
+
) : H(t.ordinal) ? (m = { ...this.toObject(), ...t }, H(t.day) && (m.day = Math.min(Un(m.year, m.month), m.day))) : m = Ar({ ...as(this.c), ...t });
|
|
8364
8364
|
const [u, f] = vn(m, this.o, this.zone);
|
|
8365
8365
|
return mt(this, { ts: u, o: f });
|
|
8366
8366
|
}
|
|
@@ -8380,7 +8380,7 @@ class L {
|
|
|
8380
8380
|
plus(e) {
|
|
8381
8381
|
if (!this.isValid) return this;
|
|
8382
8382
|
const t = te.fromDurationLike(e);
|
|
8383
|
-
return mt(this,
|
|
8383
|
+
return mt(this, qr(this, t));
|
|
8384
8384
|
}
|
|
8385
8385
|
/**
|
|
8386
8386
|
* Subtract a period of time to this DateTime and return the resulting DateTime
|
|
@@ -8391,7 +8391,7 @@ class L {
|
|
|
8391
8391
|
minus(e) {
|
|
8392
8392
|
if (!this.isValid) return this;
|
|
8393
8393
|
const t = te.fromDurationLike(e).negate();
|
|
8394
|
-
return mt(this,
|
|
8394
|
+
return mt(this, qr(this, t));
|
|
8395
8395
|
}
|
|
8396
8396
|
/**
|
|
8397
8397
|
* "Set" this DateTime to the beginning of a unit of time.
|
|
@@ -8541,7 +8541,7 @@ class L {
|
|
|
8541
8541
|
o = kn(o);
|
|
8542
8542
|
const a = e === "extended";
|
|
8543
8543
|
let l = fs(this, a, o);
|
|
8544
|
-
return On.indexOf(o) >= 3 && (l += "T"), l +=
|
|
8544
|
+
return On.indexOf(o) >= 3 && (l += "T"), l += Br(
|
|
8545
8545
|
this,
|
|
8546
8546
|
a,
|
|
8547
8547
|
t,
|
|
@@ -8598,7 +8598,7 @@ class L {
|
|
|
8598
8598
|
format: o = "extended",
|
|
8599
8599
|
precision: a = "milliseconds"
|
|
8600
8600
|
} = {}) {
|
|
8601
|
-
return this.isValid ? (a = kn(a), (r && On.indexOf(a) >= 3 ? "T" : "") +
|
|
8601
|
+
return this.isValid ? (a = kn(a), (r && On.indexOf(a) >= 3 ? "T" : "") + Br(
|
|
8602
8602
|
this,
|
|
8603
8603
|
o === "extended",
|
|
8604
8604
|
t,
|
|
@@ -8761,7 +8761,7 @@ class L {
|
|
|
8761
8761
|
diff(e, t = "milliseconds", s = {}) {
|
|
8762
8762
|
if (!this.isValid || !e.isValid)
|
|
8763
8763
|
return te.invalid("created by diffing an invalid DateTime");
|
|
8764
|
-
const r = { locale: this.locale, numberingSystem: this.numberingSystem, ...s }, i =
|
|
8764
|
+
const r = { locale: this.locale, numberingSystem: this.numberingSystem, ...s }, i = ml(t).map(te.normalizeUnit), o = e.valueOf() > this.valueOf(), a = o ? this : e, l = o ? e : this, c = gc(a, l, i, r);
|
|
8765
8765
|
return o ? c.negate() : c;
|
|
8766
8766
|
}
|
|
8767
8767
|
/**
|
|
@@ -8832,7 +8832,7 @@ class L {
|
|
|
8832
8832
|
if (!this.isValid) return null;
|
|
8833
8833
|
const t = e.base || L.fromObject({}, { zone: this.zone }), s = e.padding ? this < t ? -e.padding : e.padding : 0;
|
|
8834
8834
|
let r = ["years", "months", "days", "hours", "minutes", "seconds"], i = e.unit;
|
|
8835
|
-
return Array.isArray(e.unit) && (r = e.unit, i = void 0),
|
|
8835
|
+
return Array.isArray(e.unit) && (r = e.unit, i = void 0), Yr(t, this.plus(s), {
|
|
8836
8836
|
...e,
|
|
8837
8837
|
numeric: "always",
|
|
8838
8838
|
units: r,
|
|
@@ -8853,7 +8853,7 @@ class L {
|
|
|
8853
8853
|
* @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago"
|
|
8854
8854
|
*/
|
|
8855
8855
|
toRelativeCalendar(e = {}) {
|
|
8856
|
-
return this.isValid ?
|
|
8856
|
+
return this.isValid ? Yr(e.base || L.fromObject({}, { zone: this.zone }), this, {
|
|
8857
8857
|
...e,
|
|
8858
8858
|
numeric: "auto",
|
|
8859
8859
|
units: ["years", "months", "days"],
|
|
@@ -8868,7 +8868,7 @@ class L {
|
|
|
8868
8868
|
static min(...e) {
|
|
8869
8869
|
if (!e.every(L.isDateTime))
|
|
8870
8870
|
throw new ye("min requires all arguments be DateTimes");
|
|
8871
|
-
return
|
|
8871
|
+
return Fr(e, (t) => t.valueOf(), Math.min);
|
|
8872
8872
|
}
|
|
8873
8873
|
/**
|
|
8874
8874
|
* Return the max of several date times
|
|
@@ -8878,7 +8878,7 @@ class L {
|
|
|
8878
8878
|
static max(...e) {
|
|
8879
8879
|
if (!e.every(L.isDateTime))
|
|
8880
8880
|
throw new ye("max requires all arguments be DateTimes");
|
|
8881
|
-
return
|
|
8881
|
+
return Fr(e, (t) => t.valueOf(), Math.max);
|
|
8882
8882
|
}
|
|
8883
8883
|
// MISC
|
|
8884
8884
|
/**
|
|
@@ -8976,7 +8976,7 @@ class L {
|
|
|
8976
8976
|
* @type {Object}
|
|
8977
8977
|
*/
|
|
8978
8978
|
static get DATE_MED_WITH_WEEKDAY() {
|
|
8979
|
-
return
|
|
8979
|
+
return Wa;
|
|
8980
8980
|
}
|
|
8981
8981
|
/**
|
|
8982
8982
|
* {@link DateTime#toLocaleString} format like 'October 14, 1983'
|
|
@@ -9067,28 +9067,28 @@ class L {
|
|
|
9067
9067
|
* @type {Object}
|
|
9068
9068
|
*/
|
|
9069
9069
|
static get DATETIME_MED() {
|
|
9070
|
-
return
|
|
9070
|
+
return Fi;
|
|
9071
9071
|
}
|
|
9072
9072
|
/**
|
|
9073
9073
|
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.
|
|
9074
9074
|
* @type {Object}
|
|
9075
9075
|
*/
|
|
9076
9076
|
static get DATETIME_MED_WITH_SECONDS() {
|
|
9077
|
-
return
|
|
9077
|
+
return $i;
|
|
9078
9078
|
}
|
|
9079
9079
|
/**
|
|
9080
9080
|
* {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.
|
|
9081
9081
|
* @type {Object}
|
|
9082
9082
|
*/
|
|
9083
9083
|
static get DATETIME_MED_WITH_WEEKDAY() {
|
|
9084
|
-
return
|
|
9084
|
+
return ja;
|
|
9085
9085
|
}
|
|
9086
9086
|
/**
|
|
9087
9087
|
* {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.
|
|
9088
9088
|
* @type {Object}
|
|
9089
9089
|
*/
|
|
9090
9090
|
static get DATETIME_FULL() {
|
|
9091
|
-
return
|
|
9091
|
+
return Mi;
|
|
9092
9092
|
}
|
|
9093
9093
|
/**
|
|
9094
9094
|
* {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.
|
|
@@ -9138,14 +9138,14 @@ const Mc = (n, e) => {
|
|
|
9138
9138
|
Collection_Path: Ot(Te()),
|
|
9139
9139
|
...t
|
|
9140
9140
|
});
|
|
9141
|
-
},
|
|
9141
|
+
}, Pc = (n, e, t, s) => {
|
|
9142
9142
|
let r = je({}).catchall(Mc(n, e)), i;
|
|
9143
9143
|
if (!s && t) {
|
|
9144
9144
|
const o = Ae(n, t);
|
|
9145
9145
|
i = Bt(o.admin?.skipFormRequiredValidation);
|
|
9146
9146
|
}
|
|
9147
9147
|
return (!n.required || i) && (r = r.optional()), r;
|
|
9148
|
-
},
|
|
9148
|
+
}, Lc = () => pe().refine((n) => n === null || n && (n.seconds !== void 0 && n.nanoseconds !== void 0 || n._seconds !== void 0 && n._nanoseconds !== void 0), {
|
|
9149
9149
|
message: "Must be a valid date"
|
|
9150
9150
|
}), Oo = (n, e, t) => {
|
|
9151
9151
|
let s;
|
|
@@ -9162,7 +9162,7 @@ const Mc = (n, e) => {
|
|
|
9162
9162
|
s = Te(), n.length && (s = s.length(n.length, `Must be ${n.length} character(s) long`)), n.minlength && (s = s.min(n.minlength, `Must contain at least ${n.minlength} character(s)`)), n.maxlength && (s = s.max(n.maxlength, `Must contain at most ${n.maxlength} character(s)`)), n.email ? s = s.email("Must be a valid email address") : n.uuid ? s = ke([s.uuid("Must be a valid UUID"), be("")]) : n.url ? s = ke([s.url("Must be a valid URL"), be("")]) : n.emoji ? s = ke([s.emoji("Must be a valid emoji"), be("")]) : n.ip ? s = ke([s.ip("Must be a valid IP address"), be("")]) : n.pattern && (!t && a ? s = ke([s.regex(new RegExp(n.pattern)), s.regex(/^blob:/)], {
|
|
9163
9163
|
message: "Must be a valid value"
|
|
9164
9164
|
}) : s = s.regex(new RegExp(n.pattern), "Must be a valid value")), n.values && (s = ke([
|
|
9165
|
-
|
|
9165
|
+
Mn(n.values, {
|
|
9166
9166
|
message: `Must be one of the following values: ${n.values.join(", ")}`
|
|
9167
9167
|
}),
|
|
9168
9168
|
ss()
|
|
@@ -9189,7 +9189,7 @@ const Mc = (n, e) => {
|
|
|
9189
9189
|
t ? (s = je({
|
|
9190
9190
|
seconds: yt(),
|
|
9191
9191
|
nanoseconds: yt()
|
|
9192
|
-
}), n.min && n.max ? s = s.describe(`${r}Must be between ${L.fromMillis(n.min).toLocaleString(L.DATE_MED)} and ${L.fromMillis(n.max).toLocaleString(L.DATE_MED)}`) : n.min ? s = s.describe(`${r}Must be greater than or equal to ${L.fromMillis(n.min).toLocaleString(L.DATE_MED)}`) : n.max ? s = s.describe(`${r}Must be less than or equal to ${L.fromMillis(n.max).toLocaleString(L.DATE_MED)}`) : r && (s = s.describe(r.trim()))) : (s =
|
|
9192
|
+
}), n.min && n.max ? s = s.describe(`${r}Must be between ${L.fromMillis(n.min).toLocaleString(L.DATE_MED)} and ${L.fromMillis(n.max).toLocaleString(L.DATE_MED)}`) : n.min ? s = s.describe(`${r}Must be greater than or equal to ${L.fromMillis(n.min).toLocaleString(L.DATE_MED)}`) : n.max ? s = s.describe(`${r}Must be less than or equal to ${L.fromMillis(n.max).toLocaleString(L.DATE_MED)}`) : r && (s = s.describe(r.trim()))) : (s = Lc(), n.min && (s = s.refine((l) => l.toMillis() >= n.min, {
|
|
9193
9193
|
message: `Must be greater than or equal to ${L.fromMillis(n.min).toLocaleString(L.DATE_MED)}`
|
|
9194
9194
|
})), n.max && (s = s.refine((l) => l.toMillis() <= n.max, {
|
|
9195
9195
|
message: `Must be less than or equal to ${L.fromMillis(n.max).toLocaleString(L.DATE_MED)}`
|
|
@@ -9212,10 +9212,10 @@ const Mc = (n, e) => {
|
|
|
9212
9212
|
s = pe();
|
|
9213
9213
|
}
|
|
9214
9214
|
return (!n.required || i || o) && (s = s.optional()), s;
|
|
9215
|
-
},
|
|
9215
|
+
}, du = (n, e, t, s, r) => {
|
|
9216
9216
|
const { auth: i, softDelete: o } = n, a = {};
|
|
9217
9217
|
n.fields.forEach((c) => {
|
|
9218
|
-
c.type === "Embedding" || s && c.type === "Computed" || s && (c.name === o?.archivedField || c.name === o?.timestampField) || (X(c) ? (a[c.name] =
|
|
9218
|
+
c.type === "Embedding" || s && c.type === "Computed" || s && (c.name === o?.archivedField || c.name === o?.timestampField) || (X(c) ? (a[c.name] = Pc(c, e, t, s), s ? (c.length && (a[c.name] = a[c.name].describe(`Must contain ${c.length} item(s)`)), c.min && (a[c.name] = a[c.name].describe(`Must contain at least ${c.min} item(s)`)), c.max && (a[c.name] = a[c.name].describe(`Must contain at most ${c.max} item(s)`))) : (c.length && (a[c.name] = a[c.name].refine((d) => c.length && d && Object.keys(d).length === c.length, {
|
|
9219
9219
|
message: `Must contain ${c.length} item(s)`
|
|
9220
9220
|
})), c.min && (a[c.name] = a[c.name].refine((d) => c.min && d && Object.keys(d).length >= c.min, {
|
|
9221
9221
|
message: `Must contain at least ${c.min} item(s)`
|
|
@@ -9234,18 +9234,18 @@ const Mc = (n, e) => {
|
|
|
9234
9234
|
}));
|
|
9235
9235
|
const l = je(a);
|
|
9236
9236
|
return n.allowSchemalessFields ? l.passthrough() : l.strict();
|
|
9237
|
-
},
|
|
9237
|
+
}, Qr = async (n, e) => {
|
|
9238
9238
|
if (n) {
|
|
9239
9239
|
const t = await ie(n, [e]);
|
|
9240
9240
|
if (!t.valid)
|
|
9241
9241
|
throw new Error(t.message);
|
|
9242
9242
|
}
|
|
9243
9243
|
}, rn = async (n, e, t, s, r, i) => {
|
|
9244
|
-
await
|
|
9244
|
+
await Qr(s.custom?.preValidate, r);
|
|
9245
9245
|
for (const a of s.fields)
|
|
9246
|
-
await
|
|
9247
|
-
return
|
|
9248
|
-
},
|
|
9246
|
+
await Qr(a.custom?.preValidate, r);
|
|
9247
|
+
return Pa(n, t, i).parse(e), e;
|
|
9248
|
+
}, Ks = (n, e, t, s, r, i, o, a, l, c, d, m, u, f, g, v, y, w, R, O, I) => {
|
|
9249
9249
|
const { fields: E } = o;
|
|
9250
9250
|
E.filter((p) => "unique" in p && p.unique).forEach((p) => {
|
|
9251
9251
|
n !== "delete" && (typeof r[p.name] == "string" || typeof r[p.name] == "number") && (e.set(f(p, r[p.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||")), {
|
|
@@ -9254,39 +9254,39 @@ const Mc = (n, e) => {
|
|
|
9254
9254
|
}), I && I.size++);
|
|
9255
9255
|
}), E.forEach((p) => {
|
|
9256
9256
|
if (ft(p, o, i)) {
|
|
9257
|
-
const
|
|
9258
|
-
r[p.name] !== void 0 && (A[p.name] = r[p.name], X(p) && (A[`${p.name}_Array`] = r[`${p.name}_Array`])),
|
|
9257
|
+
const F = hn(p, o, i), A = {};
|
|
9258
|
+
r[p.name] !== void 0 && (A[p.name] = r[p.name], X(p) && (A[`${p.name}_Array`] = r[`${p.name}_Array`])), F.forEach((j) => {
|
|
9259
9259
|
r[j.name] !== void 0 && (X(j) ? A[`${j.name}_Array`] = r[`${j.name}_Array`] : A[j.name] = r[j.name]);
|
|
9260
9260
|
}), Object.keys(A).length > 0 && (n === "create" && (A.Collection_Path = t, A.Collection_Path_String = t.join("/"), e.set(u(p), A)), n === "update" && e.update(u(p), A), n === "delete" && e.delete(u(p)), I && I.size++);
|
|
9261
9261
|
}
|
|
9262
9262
|
});
|
|
9263
9263
|
const C = l[o.labels.collection];
|
|
9264
9264
|
for (const p of C) {
|
|
9265
|
-
const
|
|
9266
|
-
|
|
9265
|
+
const F = aa(p, o), A = { ...r };
|
|
9266
|
+
F.forEach((j) => {
|
|
9267
9267
|
delete A[j.name], delete A[`${j.name}_Array`], delete A[`${j.name}_Single`], delete A[`${j.name}_Lowercase`];
|
|
9268
9268
|
}), Object.keys(A).length > 0 && (n === "create" && (A.Collection_Path ||= t, A.Collection_Path_String = t.join("/"), e.set(g(p.key), A)), n === "update" && e.update(g(p.key), A), n === "delete" && e.delete(g(p.key)), I && I.size++);
|
|
9269
9269
|
}
|
|
9270
|
-
const _ = (p,
|
|
9270
|
+
const _ = (p, F) => {
|
|
9271
9271
|
let A = 1;
|
|
9272
|
-
ft(
|
|
9273
|
-
ft(h, p, i) && JSON.parse(es(hn(h, p, i))).includes(
|
|
9272
|
+
ft(F, p, i) && A++, p.fields.forEach((h) => {
|
|
9273
|
+
ft(h, p, i) && JSON.parse(es(hn(h, p, i))).includes(F.name) && A++;
|
|
9274
9274
|
});
|
|
9275
9275
|
const j = l[p.labels.collection];
|
|
9276
9276
|
for (const h of j)
|
|
9277
|
-
h.fields.some((S) => S.name ===
|
|
9277
|
+
h.fields.some((S) => S.name === F.name) && X(F) && A++;
|
|
9278
9278
|
return A;
|
|
9279
|
-
}, z = (p,
|
|
9279
|
+
}, z = (p, F, A, j, h) => {
|
|
9280
9280
|
const S = {};
|
|
9281
|
-
S[`${A.name}.${s}`] = m(), S[`${A.name}_Array`] = d(s), S[`${A.name}_Single`] = m(), e.update(v(h, j), S), ft(A,
|
|
9281
|
+
S[`${A.name}.${s}`] = m(), S[`${A.name}_Array`] = d(s), S[`${A.name}_Single`] = m(), e.update(v(h, j), S), ft(A, F, i) && e.update(y(p, A.name, j), {
|
|
9282
9282
|
[`${A.name}.${s}`]: m(),
|
|
9283
9283
|
[`${A.name}_Array`]: d(s)
|
|
9284
|
-
}),
|
|
9285
|
-
ft(T,
|
|
9284
|
+
}), F.fields.forEach((T) => {
|
|
9285
|
+
ft(T, F, i) && JSON.parse(es(hn(T, F, i))).includes(A.name) && e.update(y(p, T.name, j), {
|
|
9286
9286
|
[`${A.name}_Array`]: d(s)
|
|
9287
9287
|
});
|
|
9288
9288
|
});
|
|
9289
|
-
const b = l[
|
|
9289
|
+
const b = l[F.labels.collection];
|
|
9290
9290
|
for (const T of b)
|
|
9291
9291
|
T.fields.some((N) => N.name === A.name) && X(A) && e.update(w(p, T.key, j), S);
|
|
9292
9292
|
};
|
|
@@ -9297,7 +9297,7 @@ const Mc = (n, e) => {
|
|
|
9297
9297
|
for (const p of k) {
|
|
9298
9298
|
if (!I)
|
|
9299
9299
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
9300
|
-
const
|
|
9300
|
+
const F = i.collections[p.collection], A = U(F.fields, p.twoWay), j = pt(F, F.fields), h = Array.from(j).map((S) => S.name);
|
|
9301
9301
|
if (!A)
|
|
9302
9302
|
throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
|
|
9303
9303
|
if (X(A)) {
|
|
@@ -9327,30 +9327,30 @@ const Mc = (n, e) => {
|
|
|
9327
9327
|
id: s,
|
|
9328
9328
|
...N
|
|
9329
9329
|
});
|
|
9330
|
-
const
|
|
9330
|
+
const M = Rn(r);
|
|
9331
9331
|
e.update(v(b.Collection_Path, S), {
|
|
9332
9332
|
...q,
|
|
9333
|
-
...
|
|
9334
|
-
}), I.size++, ft(A,
|
|
9333
|
+
...M
|
|
9334
|
+
}), I.size++, ft(A, F, i) && (e.update(y(p, A.name, S), {
|
|
9335
9335
|
[`${A.name}.${s}`]: {
|
|
9336
9336
|
Collection_Path: t,
|
|
9337
9337
|
...N
|
|
9338
9338
|
},
|
|
9339
9339
|
[`${A.name}_Array`]: c(s)
|
|
9340
|
-
}), I.size++),
|
|
9341
|
-
if (ft(Z,
|
|
9342
|
-
const x = JSON.parse(es(hn(Z,
|
|
9343
|
-
x.includes(A.name) && (Q[`${p.twoWay}_Array`] = c(s)), Object.keys(
|
|
9344
|
-
x.includes(B) && (Q[B] =
|
|
9340
|
+
}), I.size++), F.fields.forEach((Z) => {
|
|
9341
|
+
if (ft(Z, F, i)) {
|
|
9342
|
+
const x = JSON.parse(es(hn(Z, F, i))), Q = {};
|
|
9343
|
+
x.includes(A.name) && (Q[`${p.twoWay}_Array`] = c(s)), Object.keys(M).forEach((B) => {
|
|
9344
|
+
x.includes(B) && (Q[B] = M[B]);
|
|
9345
9345
|
}), Object.keys(Q).length > 0 && (e.update(y(p, Z.name, S), Q), I.size++);
|
|
9346
9346
|
}
|
|
9347
9347
|
});
|
|
9348
|
-
const G = l[
|
|
9348
|
+
const G = l[F.labels.collection];
|
|
9349
9349
|
for (const Z of G)
|
|
9350
9350
|
if (Z.fields.some((x) => x.name === A.name)) {
|
|
9351
9351
|
const x = { ...q };
|
|
9352
|
-
Object.keys(
|
|
9353
|
-
Z.fields.some((B) => B.name === Q) && (x[Q] =
|
|
9352
|
+
Object.keys(M).forEach((Q) => {
|
|
9353
|
+
Z.fields.some((B) => B.name === Q) && (x[Q] = M[Q]);
|
|
9354
9354
|
}), Object.keys(x).length > 0 && (e.update(w(p, Z.key, S), x), I.size++);
|
|
9355
9355
|
}
|
|
9356
9356
|
}
|
|
@@ -9361,26 +9361,26 @@ const Mc = (n, e) => {
|
|
|
9361
9361
|
for (const p of k) {
|
|
9362
9362
|
if (!I)
|
|
9363
9363
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
9364
|
-
const
|
|
9364
|
+
const F = i.collections[p.collection], A = U(F.fields, p.twoWay);
|
|
9365
9365
|
if (!A)
|
|
9366
9366
|
throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
|
|
9367
9367
|
if (X(A)) {
|
|
9368
9368
|
if (n === "update" && R && !(r[p.name] && Re(r[p.name])) && r[`${p.name}_Array`] && R[`${p.name}_Array`]?.length > 0)
|
|
9369
9369
|
for (const [j, h] of Object.entries(R[p.name]))
|
|
9370
|
-
!r[`${p.name}_Array`].includes(j) && !O?.get(p.name)?.includes(j) && (I.size += _(
|
|
9370
|
+
!r[`${p.name}_Array`].includes(j) && !O?.get(p.name)?.includes(j) && (I.size += _(F, A), I.size <= 500 && z(p, F, A, j, h.Collection_Path));
|
|
9371
9371
|
} else
|
|
9372
9372
|
throw new Error(`SCHEMA_ERROR: Invalid field type: ${A.type}`);
|
|
9373
9373
|
}
|
|
9374
9374
|
for (const p of k) {
|
|
9375
9375
|
if (!I)
|
|
9376
9376
|
throw new Error("VALIDATION_ERROR: batchSize is required");
|
|
9377
|
-
const
|
|
9377
|
+
const F = i.collections[p.collection], A = U(F.fields, p.twoWay);
|
|
9378
9378
|
if (!A)
|
|
9379
9379
|
throw new Error(`SCHEMA_ERROR: Field ${p.twoWay} not found in collection ${p.collection}`);
|
|
9380
9380
|
if (X(A)) {
|
|
9381
9381
|
if (n === "update" && R && r[p.name] && Re(r[p.name]) && R[`${p.name}_Array`]?.length > 0)
|
|
9382
9382
|
for (const [j, h] of Object.entries(R[p.name]))
|
|
9383
|
-
O?.get(p.name)?.includes(j) || (I.size += _(
|
|
9383
|
+
O?.get(p.name)?.includes(j) || (I.size += _(F, A), I.size <= 500 && z(p, F, A, j, h.Collection_Path));
|
|
9384
9384
|
} else
|
|
9385
9385
|
throw new Error(`SCHEMA_ERROR: Invalid field type: ${A.type}`);
|
|
9386
9386
|
}
|
|
@@ -9388,7 +9388,7 @@ const Mc = (n, e) => {
|
|
|
9388
9388
|
}, Ue = (n) => {
|
|
9389
9389
|
for (const e in n)
|
|
9390
9390
|
Object.prototype.hasOwnProperty.call(n, e) && (n[e] === void 0 ? delete n[e] : typeof n[e] == "object" && n[e] !== null && Ue(n[e]));
|
|
9391
|
-
},
|
|
9391
|
+
}, Xs = (n) => {
|
|
9392
9392
|
if (n = n.toString(), /[/]|^\.+$|^__.*__$/.test(n))
|
|
9393
9393
|
return !1;
|
|
9394
9394
|
try {
|
|
@@ -9399,7 +9399,7 @@ const Mc = (n, e) => {
|
|
|
9399
9399
|
return !1;
|
|
9400
9400
|
}
|
|
9401
9401
|
return !(new Blob([n]).size > 1500);
|
|
9402
|
-
},
|
|
9402
|
+
}, Kr = async (n, e, t, s = 1e3, r = 5) => {
|
|
9403
9403
|
for (; r > 0; )
|
|
9404
9404
|
try {
|
|
9405
9405
|
await n(...e);
|
|
@@ -9416,14 +9416,14 @@ const Mc = (n, e) => {
|
|
|
9416
9416
|
if (e = e.replace(/\0/g, ""), e = e.replace(/[\x00-\x08\x0B-\x1F\x7F]/g, ""), e = e.trim(), e.length > 254)
|
|
9417
9417
|
throw new Error("Email address is too long");
|
|
9418
9418
|
return e;
|
|
9419
|
-
}, hs = (n) => n ? Array.isArray(n) ? n.map((s) => jn(s)).filter((s) => s.length > 0) : jn(n) || "" : "",
|
|
9419
|
+
}, hs = (n) => n ? Array.isArray(n) ? n.map((s) => jn(s)).filter((s) => s.length > 0) : jn(n) || "" : "", Vc = (n) => {
|
|
9420
9420
|
if (!n || typeof n != "string")
|
|
9421
9421
|
return "";
|
|
9422
9422
|
let e = n.replace(/[\r\n]/g, " ");
|
|
9423
9423
|
if (e = e.replace(/\0/g, ""), e = e.replace(/[\x00-\x08\x0B-\x1F\x7F]/g, ""), e = e.trim(), e.length > 998)
|
|
9424
9424
|
throw new Error("Email subject is too long");
|
|
9425
9425
|
return e;
|
|
9426
|
-
},
|
|
9426
|
+
}, Xr = (n) => {
|
|
9427
9427
|
if (!n || typeof n != "string")
|
|
9428
9428
|
return "";
|
|
9429
9429
|
let e = n.replace(/\0/g, "");
|
|
@@ -9433,7 +9433,13 @@ const Mc = (n, e) => {
|
|
|
9433
9433
|
`), e.length > 5e6)
|
|
9434
9434
|
throw new Error("Email body is too long");
|
|
9435
9435
|
return e;
|
|
9436
|
-
},
|
|
9436
|
+
}, Uc = (n = "enterprise", e) => n === "enterprise" ? e : "(default)", ce = () => {
|
|
9437
|
+
const n = Ls(), e = process.env.STOKER_FB_WEB_APP_CONFIG;
|
|
9438
|
+
if (!e)
|
|
9439
|
+
throw new Error("STOKER_FB_WEB_APP_CONFIG not set.");
|
|
9440
|
+
const t = JSON.parse(e), s = Uc(process.env.FB_FIRESTORE_EDITION, t.projectId);
|
|
9441
|
+
return qo(n, s);
|
|
9442
|
+
}, Wc = async (n, e) => {
|
|
9437
9443
|
const t = {};
|
|
9438
9444
|
for (const s of e) {
|
|
9439
9445
|
const r = `${n}/${s}.js`, i = ii(r).href;
|
|
@@ -9444,7 +9450,7 @@ const Mc = (n, e) => {
|
|
|
9444
9450
|
}
|
|
9445
9451
|
return t;
|
|
9446
9452
|
};
|
|
9447
|
-
let ms, ko, bn, bo, Qt, To, Tn, Sn, ps = 0,
|
|
9453
|
+
let ms, ko, bn, bo, Qt, To, Tn, Sn, ps = 0, ei = !1;
|
|
9448
9454
|
const xt = {
|
|
9449
9455
|
getTenant() {
|
|
9450
9456
|
if (!bn)
|
|
@@ -9466,7 +9472,7 @@ const xt = {
|
|
|
9466
9472
|
getCustomizationFile(n, e) {
|
|
9467
9473
|
if (!Object.keys(e.collections).includes(n))
|
|
9468
9474
|
throw new Error("PERMISSION_DENIED");
|
|
9469
|
-
const t =
|
|
9475
|
+
const t = ra([n], To, "node", xt);
|
|
9470
9476
|
return fe(t?.[n]);
|
|
9471
9477
|
},
|
|
9472
9478
|
getVersionInfo() {
|
|
@@ -9474,17 +9480,18 @@ const xt = {
|
|
|
9474
9480
|
},
|
|
9475
9481
|
getMaintenanceInfo() {
|
|
9476
9482
|
return Sn;
|
|
9477
|
-
}
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9483
|
+
},
|
|
9484
|
+
getStokerFirestore: ce
|
|
9485
|
+
}, fu = async (n, e, t, s, r) => {
|
|
9486
|
+
const i = !!ei;
|
|
9487
|
+
if (ei = !0, e && (bn = e), ko = n, ms && !r)
|
|
9481
9488
|
return xt;
|
|
9482
9489
|
if (!process.env.STOKER_FB_WEB_APP_CONFIG)
|
|
9483
9490
|
throw new Error("STOKER_FB_WEB_APP_CONFIG not set.");
|
|
9484
9491
|
const o = process.env.STOKER_FB_WEB_APP_CONFIG, a = JSON.parse(o), d = (await import(ii(t).href)).default;
|
|
9485
9492
|
Qt = d({ sdk: "node", utils: xt }), !r && n === "development" && (process.env.FIREBASE_AUTH_EMULATOR_HOST = "127.0.0.1:9099", process.env.FIREBASE_DATABASE_EMULATOR_HOST = "127.0.0.1:9000", process.env.FIRESTORE_EMULATOR_HOST = "127.0.0.1:8080", process.env.FIREBASE_STORAGE_EMULATOR_HOST = "127.0.0.1:9199");
|
|
9486
9493
|
try {
|
|
9487
|
-
ms =
|
|
9494
|
+
ms = Ls();
|
|
9488
9495
|
} catch {
|
|
9489
9496
|
ms = si({
|
|
9490
9497
|
credential: ri(),
|
|
@@ -9494,7 +9501,7 @@ const xt = {
|
|
|
9494
9501
|
});
|
|
9495
9502
|
}
|
|
9496
9503
|
const m = await Ke();
|
|
9497
|
-
return To = await
|
|
9504
|
+
return To = await Wc(s, Object.keys(m.collections)), bo = await ie(Qt.timezone), i || ce().collection("system_deployment").doc("maintenance_mode").onSnapshot((u) => {
|
|
9498
9505
|
u.exists ? (Sn = u.data(), ie(Qt.onMaintenanceUpdate, ["node", Sn.active ? "on" : "off"])) : console.error("Maintenance status not found");
|
|
9499
9506
|
}, (u) => {
|
|
9500
9507
|
console.error(u.message);
|
|
@@ -9508,8 +9515,8 @@ const xt = {
|
|
|
9508
9515
|
};
|
|
9509
9516
|
f();
|
|
9510
9517
|
}), xt;
|
|
9511
|
-
}, { getTenant: Xe, setTenant:
|
|
9512
|
-
const o =
|
|
9518
|
+
}, { getTenant: Xe, setTenant: hu, getMode: So, getTimezone: Ro, getGlobalConfigModule: Zt, getCustomizationFile: et, getVersionInfo: mu, getMaintenanceInfo: pu } = xt, yu = async (n, e, t, s) => new Promise((r, i) => {
|
|
9519
|
+
const o = Bo(n, e, { cwd: t || process.cwd(), env: { ...process.env, ...s } });
|
|
9513
9520
|
let a = "";
|
|
9514
9521
|
const l = () => {
|
|
9515
9522
|
o.kill("SIGINT");
|
|
@@ -9525,13 +9532,13 @@ const xt = {
|
|
|
9525
9532
|
}), o.on("exit", (m) => {
|
|
9526
9533
|
d(), m === 0 ? r(a) : i();
|
|
9527
9534
|
}), process.on("SIGINT", l), process.on("SIGTERM", c);
|
|
9528
|
-
}),
|
|
9535
|
+
}), gu = async () => {
|
|
9529
9536
|
const n = process.env.STOKER_FB_WEB_APP_CONFIG;
|
|
9530
9537
|
if (!n)
|
|
9531
9538
|
throw new Error("Firebase web app config not found");
|
|
9532
9539
|
const e = JSON.parse(n);
|
|
9533
9540
|
try {
|
|
9534
|
-
return
|
|
9541
|
+
return Ls();
|
|
9535
9542
|
} catch {
|
|
9536
9543
|
return si({
|
|
9537
9544
|
credential: ri(),
|
|
@@ -9553,7 +9560,7 @@ const xt = {
|
|
|
9553
9560
|
for (const i of Object.values(r.collections))
|
|
9554
9561
|
i.fields = i.fields.filter((o) => o.type !== "Computed");
|
|
9555
9562
|
return r;
|
|
9556
|
-
},
|
|
9563
|
+
}, wu = async () => {
|
|
9557
9564
|
const t = await oi().ref("schema").orderByChild("published_time").limitToLast(2).get();
|
|
9558
9565
|
if (!(t.numChildren() < 2))
|
|
9559
9566
|
return Object.values(t.val())[0];
|
|
@@ -9562,7 +9569,7 @@ const xt = {
|
|
|
9562
9569
|
for (let r = 0; r < e.length; r++)
|
|
9563
9570
|
r % 2 === 0 ? s = s.collection(e[r]) : s = s.doc(e[r]);
|
|
9564
9571
|
return s;
|
|
9565
|
-
},
|
|
9572
|
+
}, jc = (n, e, t, s, r) => {
|
|
9566
9573
|
const i = ce(), o = e.at(-1);
|
|
9567
9574
|
if (!o)
|
|
9568
9575
|
throw new Error("EMPTY_PATH");
|
|
@@ -9572,7 +9579,7 @@ const xt = {
|
|
|
9572
9579
|
const f = r.collections?.[l.collection];
|
|
9573
9580
|
if (!r.Role)
|
|
9574
9581
|
throw new Error("PERMISSION_DENIED");
|
|
9575
|
-
const g = f && Se("Read", f), v = ui(a, t, r), y = li(a, r), w =
|
|
9582
|
+
const g = f && Se("Read", f), v = ui(a, t, r), y = li(a, r), w = Vs(a, r), R = ci(a, t, r), O = (h = []) => {
|
|
9576
9583
|
const S = [], b = pi(r.Role, a, t);
|
|
9577
9584
|
if (!b)
|
|
9578
9585
|
throw new Error("PERMISSION_DENIED");
|
|
@@ -9650,15 +9657,15 @@ const xt = {
|
|
|
9650
9657
|
const N = r.collections?.[T.collection];
|
|
9651
9658
|
if (!N)
|
|
9652
9659
|
throw new Error("PERMISSION_DENIED");
|
|
9653
|
-
const q = N.individualEntities,
|
|
9660
|
+
const q = N.individualEntities, M = [];
|
|
9654
9661
|
if (q) {
|
|
9655
9662
|
const G = b.singleQuery ? b.singleQuery : z;
|
|
9656
9663
|
for (let Z = 0; Z < q.length; Z += G) {
|
|
9657
9664
|
const x = q.slice(Z, Z + G);
|
|
9658
|
-
|
|
9665
|
+
M.push(x);
|
|
9659
9666
|
}
|
|
9660
9667
|
if (!b.singleQuery)
|
|
9661
|
-
|
|
9668
|
+
M.forEach((Z) => {
|
|
9662
9669
|
p.push(...O(k.concat([[`${T.name}_Array`, "array-contains-any", Z]])));
|
|
9663
9670
|
});
|
|
9664
9671
|
else {
|
|
@@ -9670,7 +9677,7 @@ const xt = {
|
|
|
9670
9677
|
}
|
|
9671
9678
|
}
|
|
9672
9679
|
});
|
|
9673
|
-
const
|
|
9680
|
+
const F = [];
|
|
9674
9681
|
w.filter((h) => h.type === "Parent").forEach((h) => {
|
|
9675
9682
|
if ("collectionField" in h) {
|
|
9676
9683
|
const S = U(c, h.collectionField);
|
|
@@ -9679,12 +9686,12 @@ const xt = {
|
|
|
9679
9686
|
if (b) {
|
|
9680
9687
|
const N = h.singleQuery ? h.singleQuery : z;
|
|
9681
9688
|
for (let q = 0; q < b.length; q += N) {
|
|
9682
|
-
const
|
|
9683
|
-
T.push(
|
|
9689
|
+
const M = b.slice(q, q + N);
|
|
9690
|
+
T.push(M);
|
|
9684
9691
|
}
|
|
9685
9692
|
if (!h.singleQuery)
|
|
9686
9693
|
T.forEach((q) => {
|
|
9687
|
-
|
|
9694
|
+
F.push(...O(k.concat([[`${S.name}_Array`, "array-contains-any", q]])));
|
|
9688
9695
|
});
|
|
9689
9696
|
else {
|
|
9690
9697
|
if (b && b.length > N)
|
|
@@ -9702,26 +9709,26 @@ const xt = {
|
|
|
9702
9709
|
const q = r.collections?.[T.collection];
|
|
9703
9710
|
if (!q)
|
|
9704
9711
|
throw new Error("PERMISSION_DENIED");
|
|
9705
|
-
const
|
|
9706
|
-
if (
|
|
9712
|
+
const M = q.parentEntities, G = [];
|
|
9713
|
+
if (M) {
|
|
9707
9714
|
const Z = b.singleQuery ? b.singleQuery : z;
|
|
9708
|
-
for (let x = 0; x <
|
|
9709
|
-
const Q =
|
|
9715
|
+
for (let x = 0; x < M.length; x += Z) {
|
|
9716
|
+
const Q = M.slice(x, x + Z);
|
|
9710
9717
|
G.push(Q);
|
|
9711
9718
|
}
|
|
9712
9719
|
if (!b.singleQuery)
|
|
9713
9720
|
G.forEach((x) => {
|
|
9714
|
-
|
|
9721
|
+
F.push(...O(k.concat([
|
|
9715
9722
|
[`${N.name}_Array`, "array-contains-any", x]
|
|
9716
9723
|
])));
|
|
9717
9724
|
});
|
|
9718
9725
|
else {
|
|
9719
|
-
if (
|
|
9726
|
+
if (M && M.length > Z)
|
|
9720
9727
|
throw new Error(`INPUT_ERROR: Profile_Parent entity parentFilter with singleQuery set to true must not have more than ${b.singleQuery} entities`);
|
|
9721
9728
|
k.push([
|
|
9722
9729
|
`${N.name}_Array`,
|
|
9723
9730
|
"array-contains-any",
|
|
9724
|
-
|
|
9731
|
+
M
|
|
9725
9732
|
]);
|
|
9726
9733
|
}
|
|
9727
9734
|
}
|
|
@@ -9729,19 +9736,19 @@ const xt = {
|
|
|
9729
9736
|
}
|
|
9730
9737
|
});
|
|
9731
9738
|
const A = [];
|
|
9732
|
-
|
|
9739
|
+
F.length === 0 && (w.filter((h) => h.type === "Parent_Property").forEach((h) => {
|
|
9733
9740
|
if ("collectionField" in h && "propertyField" in h) {
|
|
9734
9741
|
const S = U(c, h.collectionField), b = U(c, h.propertyField);
|
|
9735
9742
|
if ("collection" in S) {
|
|
9736
9743
|
const T = f?.parentPropertyEntities || {};
|
|
9737
9744
|
Object.entries(T).forEach(([N, q]) => {
|
|
9738
9745
|
if (q.length > 0) {
|
|
9739
|
-
const
|
|
9746
|
+
const M = [];
|
|
9740
9747
|
for (let G = 0; G < q.length; G += z) {
|
|
9741
9748
|
const Z = q.slice(G, G + z);
|
|
9742
|
-
|
|
9749
|
+
M.push(Z);
|
|
9743
9750
|
}
|
|
9744
|
-
|
|
9751
|
+
M.forEach((G) => {
|
|
9745
9752
|
A.push(...O(k.concat([
|
|
9746
9753
|
[`${S.name}_Array`, "array-contains-any", G],
|
|
9747
9754
|
[b.name, "==", N]
|
|
@@ -9759,8 +9766,8 @@ const xt = {
|
|
|
9759
9766
|
const q = r.collections?.[b.collection];
|
|
9760
9767
|
if (!q)
|
|
9761
9768
|
throw new Error("PERMISSION_DENIED");
|
|
9762
|
-
const
|
|
9763
|
-
Object.entries(
|
|
9769
|
+
const M = q.parentPropertyEntities || {};
|
|
9770
|
+
Object.entries(M).forEach(([G, Z]) => {
|
|
9764
9771
|
if (Z.length > 0) {
|
|
9765
9772
|
const x = [];
|
|
9766
9773
|
for (let Q = 0; Q < Z.length; Q += z) {
|
|
@@ -9782,7 +9789,7 @@ const xt = {
|
|
|
9782
9789
|
}
|
|
9783
9790
|
}
|
|
9784
9791
|
}));
|
|
9785
|
-
const j = [...p,
|
|
9792
|
+
const j = [...p, ...F, ...A];
|
|
9786
9793
|
return !w.length && !R.length ? O(k) : j;
|
|
9787
9794
|
} else
|
|
9788
9795
|
throw new Error("PERMISSION_DENIED");
|
|
@@ -9825,14 +9832,14 @@ const xt = {
|
|
|
9825
9832
|
});
|
|
9826
9833
|
e[g] = v.records, i && await Promise.all(
|
|
9827
9834
|
// eslint-disable-next-line security/detect-object-injection
|
|
9828
|
-
e[g].map((y) =>
|
|
9835
|
+
e[g].map((y) => er(n, y, [...t, g, y.id], i, r, void 0, a, l, c))
|
|
9829
9836
|
), u > 0 && await Promise.all(
|
|
9830
9837
|
// eslint-disable-next-line security/detect-object-injection
|
|
9831
9838
|
e[g].map((y) => xo(n, y, [...t, g, y.id], { depth: u }, r, i, o, a, l, c))
|
|
9832
9839
|
);
|
|
9833
9840
|
});
|
|
9834
9841
|
await Promise.all(f);
|
|
9835
|
-
},
|
|
9842
|
+
}, er = async (n, e, t, s, r, i, o, a, l) => {
|
|
9836
9843
|
const c = t.at(-2);
|
|
9837
9844
|
s.fields ||= r.collections[c].fields.filter((u) => X(u));
|
|
9838
9845
|
const d = s.depth - 1, m = [];
|
|
@@ -9849,7 +9856,7 @@ const xt = {
|
|
|
9849
9856
|
noEmbeddingFields: l
|
|
9850
9857
|
}).then((R) => {
|
|
9851
9858
|
if (f[v] = R, d > 0)
|
|
9852
|
-
return
|
|
9859
|
+
return er(
|
|
9853
9860
|
n,
|
|
9854
9861
|
// eslint-disable-next-line security/detect-object-injection
|
|
9855
9862
|
f[v],
|
|
@@ -9910,7 +9917,7 @@ const xt = {
|
|
|
9910
9917
|
if (!v.Enabled)
|
|
9911
9918
|
throw new Error("PERMISSION_DENIED");
|
|
9912
9919
|
}
|
|
9913
|
-
let _ =
|
|
9920
|
+
let _ = jc(s, n, g, e?.userId, v);
|
|
9914
9921
|
if (_.length === 0)
|
|
9915
9922
|
return { cursor: {}, pages: 0, records: [] };
|
|
9916
9923
|
if (t && (_ = _.map((h) => (t.forEach(([S, b, T]) => {
|
|
@@ -9923,7 +9930,7 @@ const xt = {
|
|
|
9923
9930
|
throw new Error("INPUT_ERROR: startAfter and endBefore cannot be provided together");
|
|
9924
9931
|
const h = e.pagination.startAfter || e.pagination.endBefore;
|
|
9925
9932
|
if (e?.userId) {
|
|
9926
|
-
const S =
|
|
9933
|
+
const S = sa(v.Role, I, g);
|
|
9927
9934
|
if (h && S !== !0)
|
|
9928
9935
|
throw new Error("INPUT_ERROR: Pagination is not allowed when using " + S);
|
|
9929
9936
|
}
|
|
@@ -9931,7 +9938,7 @@ const xt = {
|
|
|
9931
9938
|
}
|
|
9932
9939
|
const z = {};
|
|
9933
9940
|
await oe("preOperation", y, C, { operation: "read", context: z }), await oe("preRead", y, C, { context: z, refs: _, multiple: !0, listener: !1 }), a = /* @__PURE__ */ new Map();
|
|
9934
|
-
const
|
|
9941
|
+
const F = _.map(async (h) => await c.get(h)), A = await Promise.all(F);
|
|
9935
9942
|
for (const h of A) {
|
|
9936
9943
|
for (const S of h.docs) {
|
|
9937
9944
|
a.has(S.id) || a.set(S.id, {});
|
|
@@ -9944,7 +9951,7 @@ const xt = {
|
|
|
9944
9951
|
}
|
|
9945
9952
|
if (e?.pagination) {
|
|
9946
9953
|
let h = _[0];
|
|
9947
|
-
t && (h = t.reduce((N, [q,
|
|
9954
|
+
t && (h = t.reduce((N, [q, M, G]) => N.where(q, M, G), h)), e.pagination.orderByField && e.pagination.orderByDirection && (h = h.orderBy(e.pagination.orderByField, e.pagination.orderByDirection));
|
|
9948
9955
|
const b = (await h.count().get()).data().count, T = e.pagination.number;
|
|
9949
9956
|
i = T > 0 ? Math.ceil(b / T) : 0;
|
|
9950
9957
|
}
|
|
@@ -9964,15 +9971,15 @@ const xt = {
|
|
|
9964
9971
|
e.userId,
|
|
9965
9972
|
e.transactional ? c : void 0,
|
|
9966
9973
|
e?.noEmbeddingFields
|
|
9967
|
-
)), e?.relations && (e.relations.fields && (e.relations.fields = e.relations.fields.map((
|
|
9968
|
-
if (typeof
|
|
9969
|
-
const G = I.fields.find((Z) => Z.name ===
|
|
9974
|
+
)), e?.relations && (e.relations.fields && (e.relations.fields = e.relations.fields.map((M) => {
|
|
9975
|
+
if (typeof M == "string") {
|
|
9976
|
+
const G = I.fields.find((Z) => Z.name === M);
|
|
9970
9977
|
if (G)
|
|
9971
9978
|
return G;
|
|
9972
|
-
throw new Error(`SCHEMA_ERROR: Field ${
|
|
9979
|
+
throw new Error(`SCHEMA_ERROR: Field ${M} not found in collection ${w}`);
|
|
9973
9980
|
}
|
|
9974
|
-
return
|
|
9975
|
-
})), S.push(
|
|
9981
|
+
return M;
|
|
9982
|
+
})), S.push(er(
|
|
9976
9983
|
s,
|
|
9977
9984
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9978
9985
|
a.get(h.id),
|
|
@@ -9985,25 +9992,25 @@ const xt = {
|
|
|
9985
9992
|
e?.noEmbeddingFields
|
|
9986
9993
|
))), await Promise.all(S);
|
|
9987
9994
|
const T = [];
|
|
9988
|
-
for (const
|
|
9989
|
-
if (
|
|
9990
|
-
const G = Ae(
|
|
9995
|
+
for (const M of I.fields) {
|
|
9996
|
+
if (M.type === "Computed" && !e?.noComputedFields) {
|
|
9997
|
+
const G = Ae(M, C);
|
|
9991
9998
|
if (!G.formula)
|
|
9992
9999
|
continue;
|
|
9993
10000
|
T.push(ie(G.formula, [h, j]).then((Z) => {
|
|
9994
|
-
h[
|
|
10001
|
+
h[M.name] = Z;
|
|
9995
10002
|
}));
|
|
9996
10003
|
}
|
|
9997
|
-
e?.noEmbeddingFields &&
|
|
10004
|
+
e?.noEmbeddingFields && M.type === "Embedding" && delete h[M.name];
|
|
9998
10005
|
}
|
|
9999
10006
|
if (await Promise.all(T), e?.userId && v?.Role) {
|
|
10000
|
-
const
|
|
10001
|
-
if (!(C.custom?.serverAccess?.read !== void 0 ? await ie(C.custom.serverAccess.read, [
|
|
10007
|
+
const M = v.Role;
|
|
10008
|
+
if (!(C.custom?.serverAccess?.read !== void 0 ? await ie(C.custom.serverAccess.read, [M, h]) : !0)) {
|
|
10002
10009
|
a.delete(h.id);
|
|
10003
10010
|
continue;
|
|
10004
10011
|
}
|
|
10005
10012
|
for (const Z of I.fields) {
|
|
10006
|
-
const x = !Z.access || Z.access.includes(
|
|
10013
|
+
const x = !Z.access || Z.access.includes(M), Q = Ae(Z, C), B = Q?.custom?.serverAccess?.read !== void 0 ? await ie(Q.custom.serverAccess.read, [M, h]) : !0;
|
|
10007
10014
|
(!x || !B) && (X(Z) ? (delete a.get(h.id)[Z.name], delete a.get(h.id)[`${Z.name}_Array`], delete a.get(h.id)[`${Z.name}_Single`]) : delete a.get(h.id)[Z.name]);
|
|
10008
10015
|
}
|
|
10009
10016
|
}
|
|
@@ -10015,7 +10022,7 @@ const xt = {
|
|
|
10015
10022
|
};
|
|
10016
10023
|
await oe("postOperation", y, C, N), await oe("postRead", y, C, { context: z, refs: _, record: h, listener: !1 });
|
|
10017
10024
|
}
|
|
10018
|
-
e?.userId && await
|
|
10025
|
+
e?.userId && await ta(
|
|
10019
10026
|
Array.from(a.values()),
|
|
10020
10027
|
I,
|
|
10021
10028
|
g,
|
|
@@ -10134,8 +10141,8 @@ const xt = {
|
|
|
10134
10141
|
throw new Error("PERMISSION_DENIED");
|
|
10135
10142
|
const _ = {};
|
|
10136
10143
|
await oe("preOperation", g, I, { operation: "read", recordId: e, context: _ }), await oe("preRead", g, I, { context: _, refs: C, multiple: !1, listener: !1 }), i = {};
|
|
10137
|
-
const p = C.map((b) => a.get(b)),
|
|
10138
|
-
for (const b of
|
|
10144
|
+
const p = C.map((b) => a.get(b)), F = await Promise.all(p);
|
|
10145
|
+
for (const b of F)
|
|
10139
10146
|
if (b.exists) {
|
|
10140
10147
|
const T = b.data();
|
|
10141
10148
|
i.id ||= b.id, i = { ...i, ...T }, delete i.Collection_Path_String;
|
|
@@ -10167,11 +10174,11 @@ const xt = {
|
|
|
10167
10174
|
if (!(I.custom?.serverAccess?.read !== void 0 ? await ie(I.custom?.serverAccess?.read, [b, i]) : !0))
|
|
10168
10175
|
throw new Error("PERMISSION_DENIED");
|
|
10169
10176
|
for (const N of R.fields) {
|
|
10170
|
-
const q = !N.access || N.access.includes(b),
|
|
10177
|
+
const q = !N.access || N.access.includes(b), M = Ae(N, I), G = M?.custom?.serverAccess?.read !== void 0 ? await ie(M.custom.serverAccess.read, [b, i]) : !0;
|
|
10171
10178
|
(!q || !G) && (X(N) ? (delete i[N.name], delete i[`${N.name}_Array`], delete i[`${N.name}_Single`]) : delete i[N.name]);
|
|
10172
10179
|
}
|
|
10173
10180
|
}
|
|
10174
|
-
await oe("postOperation", g, I, { operation: "read", data: i, recordId: e, context: _ }), await oe("postRead", g, I, { context: _, refs: C, record: i, listener: !1 }), t?.userId && await
|
|
10181
|
+
await oe("postOperation", g, I, { operation: "read", data: i, recordId: e, context: _ }), await oe("postRead", g, I, { context: _, refs: C, record: i, listener: !1 }), t?.userId && await ea(i, R, u, t.userId, f);
|
|
10175
10182
|
};
|
|
10176
10183
|
return t?.providedTransaction ? await o(t.providedTransaction) : await r.runTransaction(async (a) => {
|
|
10177
10184
|
await o(a);
|
|
@@ -10184,7 +10191,7 @@ const xt = {
|
|
|
10184
10191
|
return;
|
|
10185
10192
|
Ae(f, c);
|
|
10186
10193
|
const g = s[f.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
10187
|
-
if (!
|
|
10194
|
+
if (!Xs(g))
|
|
10188
10195
|
u.push(`${f.name} "${s[f.name]}" is invalid`);
|
|
10189
10196
|
else {
|
|
10190
10197
|
const v = await l.collection("tenants").doc(e).collection("system_unique").doc(d).collection(`Unique-${d}-${f.name}`).doc(g).get();
|
|
@@ -10239,14 +10246,14 @@ ${i}`);
|
|
|
10239
10246
|
})()
|
|
10240
10247
|
]), r.length > 0)
|
|
10241
10248
|
throw new Error(r.join(", "));
|
|
10242
|
-
},
|
|
10249
|
+
}, Fo = async (n, e, t, s, r, i, o, a, l) => {
|
|
10243
10250
|
const c = ce(), d = So(), m = process.env.ADMIN_EMAIL;
|
|
10244
10251
|
if (d === "development" || process.env.FIRESTORE_EMULATOR_HOST)
|
|
10245
10252
|
if (m)
|
|
10246
10253
|
n = m;
|
|
10247
10254
|
else
|
|
10248
10255
|
throw new Error("Admin email not set");
|
|
10249
|
-
const u = hs(n), f =
|
|
10256
|
+
const u = hs(n), f = Vc(e), g = t ? Xr(t) : void 0, v = s ? Xr(s) : void 0, y = r ? hs(r) : void 0, w = i ? hs(i) : void 0, R = o ? jn(o) : void 0, O = l ? jn(l) : void 0, I = Array.isArray(u) ? u : [u];
|
|
10250
10257
|
if (I.length === 0 || I.length === 1 && !I[0])
|
|
10251
10258
|
throw new Error("No valid email addresses provided");
|
|
10252
10259
|
const E = { to: u, message: { subject: f } };
|
|
@@ -10259,19 +10266,19 @@ ${i}`);
|
|
|
10259
10266
|
C.length > 0 && C[0] && (E.bcc = w);
|
|
10260
10267
|
}
|
|
10261
10268
|
R && (E.replyTo = R), a && (E.message.attachments = a), O && (E.from = O), await c.collection("system_mail").add(E);
|
|
10262
|
-
},
|
|
10263
|
-
function
|
|
10264
|
-
return
|
|
10269
|
+
}, Zc = ["tenant", "role", "collection", "doc"], $o = new Set(Zc);
|
|
10270
|
+
function tr(n) {
|
|
10271
|
+
return $o.has(n);
|
|
10265
10272
|
}
|
|
10266
|
-
function
|
|
10273
|
+
function zc(n) {
|
|
10267
10274
|
if (!n)
|
|
10268
10275
|
return {};
|
|
10269
10276
|
const e = {};
|
|
10270
10277
|
for (const t of Object.keys(n))
|
|
10271
|
-
|
|
10278
|
+
$o.has(t) || (e[t] = n[t]);
|
|
10272
10279
|
return e;
|
|
10273
10280
|
}
|
|
10274
|
-
const
|
|
10281
|
+
const Mo = async (n, e, t, s, r, i, o) => {
|
|
10275
10282
|
const a = Et(), l = ce(), { labels: c, fields: d } = s, m = "USER_ERROR", u = async (y, w) => {
|
|
10276
10283
|
try {
|
|
10277
10284
|
await dn(y);
|
|
@@ -10294,7 +10301,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10294
10301
|
}
|
|
10295
10302
|
const g = {};
|
|
10296
10303
|
for (const y of d)
|
|
10297
|
-
y.saveToAuthToken && !
|
|
10304
|
+
y.saveToAuthToken && !tr(y.name) && r[y.name] !== void 0 && y.type !== "Timestamp" && y.type !== "Computed" && y.type !== "Embedding" && (Re(r[y.name]) ? g[y.name] = null : g[y.name] = r[y.name]);
|
|
10298
10305
|
try {
|
|
10299
10306
|
await a.setCustomUserClaims(f.uid, {
|
|
10300
10307
|
...g,
|
|
@@ -10332,7 +10339,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10332
10339
|
if (y) {
|
|
10333
10340
|
const w = `https://${a.app.options.projectId}.firebaseapp.com/__/auth/action${y}`, R = await ie(t.appName), O = t?.mail?.emailVerification && t.mail.emailVerification(w, R);
|
|
10334
10341
|
try {
|
|
10335
|
-
await
|
|
10342
|
+
await Fo(r.Email, O?.subject || "Please verify your email address", void 0, O?.html || `Please verify your email address by clicking the link:
|
|
10336
10343
|
</br>
|
|
10337
10344
|
</br>
|
|
10338
10345
|
<a href="${w}">${w}</a>`);
|
|
@@ -10342,7 +10349,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10342
10349
|
}
|
|
10343
10350
|
}
|
|
10344
10351
|
return f.uid;
|
|
10345
|
-
},
|
|
10352
|
+
}, nr = async (n, e) => {
|
|
10346
10353
|
const { labels: t, parentCollection: s } = e;
|
|
10347
10354
|
if (s) {
|
|
10348
10355
|
const r = n.at(-2);
|
|
@@ -10355,7 +10362,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10355
10362
|
throw new Error("PERMISSION_DENIED");
|
|
10356
10363
|
} else if (n.length > 1)
|
|
10357
10364
|
throw new Error("PERMISSION_DENIED");
|
|
10358
|
-
}, Zn = (n) => n !== null && typeof n == "object" && !Array.isArray(n),
|
|
10365
|
+
}, Zn = (n) => n !== null && typeof n == "object" && !Array.isArray(n), _u = (n) => {
|
|
10359
10366
|
const e = (t) => {
|
|
10360
10367
|
Object.entries(t).forEach(([s, r]) => {
|
|
10361
10368
|
Zn(r) && Object.keys(r).length === 2 && typeof r.seconds == "number" && typeof r.nanoseconds == "number" ? t[s] = new ut(r.seconds, r.nanoseconds) : Zn(r) && e(r);
|
|
@@ -10369,11 +10376,11 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10369
10376
|
});
|
|
10370
10377
|
};
|
|
10371
10378
|
e(n);
|
|
10372
|
-
},
|
|
10379
|
+
}, sr = (n) => {
|
|
10373
10380
|
if (typeof n == "object")
|
|
10374
10381
|
for (const e in n)
|
|
10375
|
-
Object.prototype.hasOwnProperty.call(n, e) && (n[e] === "_DELETE_FIELD" ? n[e] = he.delete() :
|
|
10376
|
-
},
|
|
10382
|
+
Object.prototype.hasOwnProperty.call(n, e) && (n[e] === "_DELETE_FIELD" ? n[e] = he.delete() : sr(n[e]));
|
|
10383
|
+
}, qc = (n, e, t) => {
|
|
10377
10384
|
if (X(t) && t.includeFields) {
|
|
10378
10385
|
const s = {};
|
|
10379
10386
|
return t.includeFields.forEach((r) => {
|
|
@@ -10385,7 +10392,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10385
10392
|
}), s;
|
|
10386
10393
|
}
|
|
10387
10394
|
return {};
|
|
10388
|
-
},
|
|
10395
|
+
}, ti = async (n, e, t, s, r, i, o) => {
|
|
10389
10396
|
if (!X(t) || !t.enforceHierarchy)
|
|
10390
10397
|
return;
|
|
10391
10398
|
const { fields: a } = e, l = ce(), c = Object.entries(s[t.name]);
|
|
@@ -10407,7 +10414,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10407
10414
|
delete e[n.name][t], e[`${n.name}_Array`] = e[`${n.name}_Array`]?.filter((s) => s !== t), delete e[`${n.name}_Single`];
|
|
10408
10415
|
}, ys = async (n, e, t, s, r) => {
|
|
10409
10416
|
e[n.name] ||= {}, e[n.name][s] = t, e[`${n.name}_Array`] ||= [], e[`${n.name}_Array`].push(s), r && (e[`${n.name}_Single`] = { id: s, ...t });
|
|
10410
|
-
},
|
|
10417
|
+
}, Bc = (n, e, t, s, r, i) => {
|
|
10411
10418
|
const o = [], a = [];
|
|
10412
10419
|
for (const l of s.fields)
|
|
10413
10420
|
X(l) && l.twoWay && l.collection === t && ((n === "Create" || !i?.[l.name]?.[e]) && r[l.name]?.[e] && o.push(l), n === "Update" && i?.[l.name]?.[e] && !r[l.name]?.[e] && a.push(l));
|
|
@@ -10415,7 +10422,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10415
10422
|
}, Lo = async (n, e, t, s, r, i, o, a, l, c, d, m) => {
|
|
10416
10423
|
const { fields: u } = i, f = ce(), g = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
|
|
10417
10424
|
for (const w of u)
|
|
10418
|
-
X(w) && ["OneToOne", "OneToMany"].includes(w.type) && w.enforceHierarchy && s[w.name] && (n === "Create" || n === "Update" && !He(m?.[w.name], s[w.name])) && await
|
|
10425
|
+
X(w) && ["OneToOne", "OneToMany"].includes(w.type) && w.enforceHierarchy && s[w.name] && (n === "Create" || n === "Update" && !He(m?.[w.name], s[w.name])) && await ti(e, i, w, s, a, l);
|
|
10419
10426
|
for (const w of u)
|
|
10420
10427
|
if (X(w) && w.twoWay) {
|
|
10421
10428
|
const R = o.collections[w.collection], O = U(R.fields, w.twoWay), I = pt(R, [O]);
|
|
@@ -10441,14 +10448,14 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10441
10448
|
[_]: h
|
|
10442
10449
|
}), k = fe({ ...h, ...Rn(s) });
|
|
10443
10450
|
}
|
|
10444
|
-
const
|
|
10451
|
+
const F = {
|
|
10445
10452
|
...k[O.name],
|
|
10446
10453
|
[t]: {
|
|
10447
10454
|
Collection_Path: s.Collection_Path,
|
|
10448
|
-
...
|
|
10455
|
+
...qc(i, s, O)
|
|
10449
10456
|
}
|
|
10450
10457
|
};
|
|
10451
|
-
k[O.name] =
|
|
10458
|
+
k[O.name] = F, k[`${O.name}_Array`] ||= [], k[`${O.name}_Array`].push(t), I.size === 1 && (k[`${O.name}_Single`] = { id: t, ...F }), y.set(w.collection, {
|
|
10452
10459
|
...y.get(w.collection) || {},
|
|
10453
10460
|
[_]: k
|
|
10454
10461
|
});
|
|
@@ -10466,7 +10473,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10466
10473
|
k = p;
|
|
10467
10474
|
else {
|
|
10468
10475
|
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.`));
|
|
10469
|
-
const
|
|
10476
|
+
const F = Ce(f, z.Collection_Path, e), A = await a.get(F.doc(_));
|
|
10470
10477
|
if (!A.exists) {
|
|
10471
10478
|
g.set(w.name, [...g.get(w.name) || [], _]);
|
|
10472
10479
|
continue;
|
|
@@ -10477,7 +10484,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10477
10484
|
[_]: j
|
|
10478
10485
|
}), k = fe({ ...j, ...Rn(s) });
|
|
10479
10486
|
}
|
|
10480
|
-
k[O.name][t] && delete k[O.name][t], Array.isArray(k[`${O.name}_Array`]) && (k[`${O.name}_Array`] = k[`${O.name}_Array`].filter((
|
|
10487
|
+
k[O.name][t] && delete k[O.name][t], Array.isArray(k[`${O.name}_Array`]) && (k[`${O.name}_Array`] = k[`${O.name}_Array`].filter((F) => F !== t)), I.size === 1 && delete k[`${O.name}_Single`], y.set(w.collection, {
|
|
10481
10488
|
...y.get(w.collection) || {},
|
|
10482
10489
|
[_]: k
|
|
10483
10490
|
});
|
|
@@ -10488,25 +10495,25 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10488
10495
|
for (const [w, R] of y.entries()) {
|
|
10489
10496
|
const O = o.collections[w], I = et(w, o);
|
|
10490
10497
|
for (const [E, C] of Object.entries(R)) {
|
|
10491
|
-
const { addedFields: _, removedFields: z } =
|
|
10498
|
+
const { addedFields: _, removedFields: z } = Bc(n, E, w, i, s, m);
|
|
10492
10499
|
if (c && d) {
|
|
10493
10500
|
for (const k of _) {
|
|
10494
10501
|
const p = U(O.fields, k.twoWay);
|
|
10495
|
-
if (!
|
|
10502
|
+
if (!ir(O, p, d)) {
|
|
10496
10503
|
_n(k, r, E);
|
|
10497
10504
|
continue;
|
|
10498
10505
|
}
|
|
10499
10506
|
}
|
|
10500
10507
|
for (const k of z) {
|
|
10501
|
-
const p = U(O.fields, k.twoWay),
|
|
10502
|
-
if (!
|
|
10508
|
+
const p = U(O.fields, k.twoWay), F = pt(O, [p]);
|
|
10509
|
+
if (!ir(O, p, d)) {
|
|
10503
10510
|
ys(
|
|
10504
10511
|
k,
|
|
10505
10512
|
r,
|
|
10506
10513
|
// eslint-disable-next-line security/detect-object-injection
|
|
10507
10514
|
m?.[k.name]?.[E],
|
|
10508
10515
|
E,
|
|
10509
|
-
|
|
10516
|
+
F.size === 1
|
|
10510
10517
|
);
|
|
10511
10518
|
continue;
|
|
10512
10519
|
}
|
|
@@ -10523,14 +10530,14 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10523
10530
|
for (const k of _)
|
|
10524
10531
|
_n(k, r, E);
|
|
10525
10532
|
for (const k of z) {
|
|
10526
|
-
const p = U(O.fields, k.twoWay),
|
|
10533
|
+
const p = U(O.fields, k.twoWay), F = pt(O, [p]);
|
|
10527
10534
|
ys(
|
|
10528
10535
|
k,
|
|
10529
10536
|
r,
|
|
10530
10537
|
// eslint-disable-next-line security/detect-object-injection
|
|
10531
10538
|
m?.[k.name]?.[E],
|
|
10532
10539
|
E,
|
|
10533
|
-
|
|
10540
|
+
F.size === 1
|
|
10534
10541
|
);
|
|
10535
10542
|
}
|
|
10536
10543
|
}
|
|
@@ -10538,14 +10545,14 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10538
10545
|
for (const k of _)
|
|
10539
10546
|
_n(k, r, E);
|
|
10540
10547
|
for (const k of z) {
|
|
10541
|
-
const p = U(O.fields, k.twoWay),
|
|
10548
|
+
const p = U(O.fields, k.twoWay), F = pt(O, [p]);
|
|
10542
10549
|
ys(
|
|
10543
10550
|
k,
|
|
10544
10551
|
r,
|
|
10545
10552
|
// eslint-disable-next-line security/detect-object-injection
|
|
10546
10553
|
m?.[k.name]?.[E],
|
|
10547
10554
|
E,
|
|
10548
|
-
|
|
10555
|
+
F.size === 1
|
|
10549
10556
|
);
|
|
10550
10557
|
}
|
|
10551
10558
|
}
|
|
@@ -10557,7 +10564,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10557
10564
|
}
|
|
10558
10565
|
for (const k of _) {
|
|
10559
10566
|
const p = U(O.fields, k.twoWay);
|
|
10560
|
-
["OneToOne", "OneToMany"].includes(p.type) && X(p) && p.enforceHierarchy && await
|
|
10567
|
+
["OneToOne", "OneToMany"].includes(p.type) && X(p) && p.enforceHierarchy && await ti(e, O, p, C, a, l, !0);
|
|
10561
10568
|
}
|
|
10562
10569
|
}
|
|
10563
10570
|
}
|
|
@@ -10598,7 +10605,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10598
10605
|
return !1;
|
|
10599
10606
|
}
|
|
10600
10607
|
return !0;
|
|
10601
|
-
},
|
|
10608
|
+
}, Hc = 10, Gc = async (n, e) => {
|
|
10602
10609
|
if (n.length === 0)
|
|
10603
10610
|
return;
|
|
10604
10611
|
const t = Math.min(e, n.length);
|
|
@@ -10659,10 +10666,10 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10659
10666
|
}
|
|
10660
10667
|
}
|
|
10661
10668
|
}
|
|
10662
|
-
await
|
|
10669
|
+
await Gc(f, Hc);
|
|
10663
10670
|
}
|
|
10664
10671
|
}
|
|
10665
|
-
},
|
|
10672
|
+
}, Eu = async (n, e, t) => {
|
|
10666
10673
|
const s = t?.userId, r = t?.user;
|
|
10667
10674
|
let i = t?.context;
|
|
10668
10675
|
const o = Xe(), a = Zt();
|
|
@@ -10678,13 +10685,13 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10678
10685
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10679
10686
|
const u = l.collections[c], { labels: f, fields: g, enableWriteLog: v, softDelete: y } = u, w = et(f.collection, l), R = await ie(a.appName), O = ce(), I = Et(), C = (s ? await I.getUser(s) : void 0)?.customClaims?.role;
|
|
10680
10687
|
let _;
|
|
10681
|
-
s && await
|
|
10688
|
+
s && await nr(n, u);
|
|
10682
10689
|
const z = Ce(O, n, o), k = t?.id || z.doc().id;
|
|
10683
|
-
i = i || {}, i.collection = f.collection, e.id = k, Po(e),
|
|
10684
|
-
const p =
|
|
10690
|
+
i = i || {}, i.collection = f.collection, e.id = k, Po(e), sr(e);
|
|
10691
|
+
const p = js("create", n, e, l, R, "Online", s || "System", ut.now(), he.serverTimestamp());
|
|
10685
10692
|
t?.createdAt && (p.Created_At = t.createdAt), t?.createdBy && (p.Created_By = t.createdBy);
|
|
10686
|
-
const
|
|
10687
|
-
y && (p[y.archivedField] = !1), Ue(e), v && !t?.providedTransaction && await Lt("create", "started", p, o, n, k, u), await oe("preOperation", a, w, { operation: "create", data: p, recordId: k, context: i }), await oe("preWrite", a, w, { operation: "create", data: p, recordId: k, context: i }), In(u, p, l), xn(u, p), await
|
|
10693
|
+
const F = fe(p);
|
|
10694
|
+
y && (p[y.archivedField] = !1), Ue(e), v && !t?.providedTransaction && await Lt("create", "started", p, o, n, k, u), await oe("preOperation", a, w, { operation: "create", data: p, recordId: k, context: i }), await oe("preWrite", a, w, { operation: "create", data: p, recordId: k, context: i }), In(u, p, l), xn(u, p), await la(p, u, w, C), Ue(p);
|
|
10688
10695
|
try {
|
|
10689
10696
|
if (u.auth && r && !r.password)
|
|
10690
10697
|
throw new Error("Password is required");
|
|
@@ -10694,7 +10701,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10694
10701
|
}
|
|
10695
10702
|
Ue(p), e.id = k, y && (p[y.archivedField] = !1), In(u, p, l), xn(u, p);
|
|
10696
10703
|
try {
|
|
10697
|
-
Vo("create", p,
|
|
10704
|
+
Vo("create", p, F), Uo("create", u, p), await rn("create", p, u, w, { operation: "create", record: p, context: i }, l);
|
|
10698
10705
|
} catch (T) {
|
|
10699
10706
|
throw new Error(`VALIDATION_ERROR: ${T.message}`);
|
|
10700
10707
|
}
|
|
@@ -10707,14 +10714,14 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10707
10714
|
for (const q of u.fields) {
|
|
10708
10715
|
if (!(q.name in p))
|
|
10709
10716
|
continue;
|
|
10710
|
-
const
|
|
10711
|
-
if (
|
|
10717
|
+
const M = Ae(q, w);
|
|
10718
|
+
if (M?.custom?.serverAccess?.create !== void 0 && !await ie(M.custom.serverAccess.create, [T, p]))
|
|
10712
10719
|
throw new Error("PERMISSION_DENIED");
|
|
10713
10720
|
}
|
|
10714
10721
|
}
|
|
10715
10722
|
r && (r.permissions ||= {}, r.permissions.Role ||= p.Role, r.permissions.Enabled ||= p.Enabled);
|
|
10716
10723
|
const h = async (T, N) => {
|
|
10717
|
-
const [q,
|
|
10724
|
+
const [q, M, G, Z] = await Promise.all([
|
|
10718
10725
|
t?.providedTransaction ? Promise.resolve({}) : T.get(O.collection("system_deployment").doc("latest_deploy")),
|
|
10719
10726
|
t?.providedTransaction ? Promise.resolve({}) : T.get(O.collection("system_deployment").doc("maintenance_mode")),
|
|
10720
10727
|
s ? T.get(O.collection("tenants").doc(o).collection("system_user_permissions").doc(s)) : Promise.resolve({}),
|
|
@@ -10726,9 +10733,9 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10726
10733
|
const x = q.data();
|
|
10727
10734
|
if (x.force && p.Last_Write_At.valueOf() < x.time.valueOf())
|
|
10728
10735
|
throw new Error("VERSION_ERROR");
|
|
10729
|
-
if (!
|
|
10736
|
+
if (!M.exists)
|
|
10730
10737
|
throw new Error("MAINTENANCE_MODE");
|
|
10731
|
-
if (
|
|
10738
|
+
if (M.data().active)
|
|
10732
10739
|
throw new Error("MAINTENANCE_MODE");
|
|
10733
10740
|
}
|
|
10734
10741
|
if (l = Z, s) {
|
|
@@ -10751,7 +10758,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10751
10758
|
]) : !0))
|
|
10752
10759
|
throw new Error("PERMISSION_DENIED");
|
|
10753
10760
|
const ze = e[B.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
10754
|
-
if (
|
|
10761
|
+
if (Xs(ze)) {
|
|
10755
10762
|
if (N && N.size++, N && N.size > 500)
|
|
10756
10763
|
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.");
|
|
10757
10764
|
if ((await T.get(O.collection("tenants").doc(o).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${B.name}`).doc(ze)))?.exists)
|
|
@@ -10762,13 +10769,13 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10762
10769
|
});
|
|
10763
10770
|
await Promise.all(Q);
|
|
10764
10771
|
}
|
|
10765
|
-
|
|
10772
|
+
or(p, k, u, l, s, _, r?.permissions), r?.permissions && s && _ && await Wo(T, r.permissions, s, _, l), or(p, k, u, l, s, _, r?.permissions);
|
|
10766
10773
|
};
|
|
10767
10774
|
if (u.auth && r) {
|
|
10768
10775
|
await O.runTransaction(async (N) => {
|
|
10769
10776
|
await h(N);
|
|
10770
10777
|
}, { maxAttempts: 10 });
|
|
10771
|
-
const T = await
|
|
10778
|
+
const T = await Mo(
|
|
10772
10779
|
o,
|
|
10773
10780
|
k,
|
|
10774
10781
|
a,
|
|
@@ -10784,13 +10791,13 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10784
10791
|
try {
|
|
10785
10792
|
const N = { size: 1 };
|
|
10786
10793
|
await h(T, N), t?.noTwoWay || await Lo("Create", o, k, p, p, u, l, T, N, s, _);
|
|
10787
|
-
const q =
|
|
10788
|
-
|
|
10794
|
+
const q = Ws(l);
|
|
10795
|
+
Ks("create", T, n, k, p, l, u, t, q, he.arrayUnion, he.arrayRemove, he.delete, (M) => O.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${M.name}`).doc(k), (M, G) => O.collection("tenants").doc(o).collection("system_unique").doc(f.collection).collection(`Unique-${f.collection}-${M.name}`).doc(G), (M) => O.collection("tenants").doc(o).collection("system_fields").doc(f.collection).collection(`${f.collection}-${M}`).doc(k), (M, G) => Ce(O, M, o).doc(G), (M, G, Z) => O.collection("tenants").doc(o).collection("system_fields").doc(M.collection).collection(`${M.collection}-${G}`).doc(Z), (M, G, Z) => O.collection("tenants").doc(o).collection("system_fields").doc(M.collection).collection(`${M.collection}-${G.replaceAll(" ", "-")}`).doc(Z), void 0, void 0, N), T.set(z.doc(k), p);
|
|
10789
10796
|
} catch (N) {
|
|
10790
10797
|
if (t?.providedTransaction)
|
|
10791
10798
|
throw N;
|
|
10792
10799
|
{
|
|
10793
|
-
const
|
|
10800
|
+
const M = await oe("postWriteError", a, w, {
|
|
10794
10801
|
operation: "create",
|
|
10795
10802
|
data: p,
|
|
10796
10803
|
recordId: k,
|
|
@@ -10799,7 +10806,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10799
10806
|
});
|
|
10800
10807
|
if (v && (await new Promise((G) => {
|
|
10801
10808
|
setTimeout(G, 250);
|
|
10802
|
-
}), await Lt("create",
|
|
10809
|
+
}), await Lt("create", M?.resolved ? "success" : "failed", p, o, n, k, u, M?.resolved ? void 0 : N)), !M?.resolved)
|
|
10803
10810
|
throw u.auth && r && await dn(p), N;
|
|
10804
10811
|
}
|
|
10805
10812
|
}
|
|
@@ -10845,10 +10852,10 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10845
10852
|
}
|
|
10846
10853
|
if (l)
|
|
10847
10854
|
throw new Error(`ROLLBACK_FAILED: ${s}`);
|
|
10848
|
-
},
|
|
10855
|
+
}, Yc = async (n, e, t, s, r, i, o, a, l, c, d) => {
|
|
10849
10856
|
const m = Et(), u = ce(), f = {};
|
|
10850
10857
|
for (const y of r.fields)
|
|
10851
|
-
y.saveToAuthToken && !
|
|
10858
|
+
y.saveToAuthToken && !tr(y.name) && i[y.name] !== void 0 && y.type !== "Timestamp" && y.type !== "Computed" && y.type !== "Embedding" && (Re(i[y.name]) ? f[y.name] = null : f[y.name] = i[y.name]);
|
|
10852
10859
|
const g = "USER_ERROR";
|
|
10853
10860
|
let v = "";
|
|
10854
10861
|
if (n === "create") {
|
|
@@ -10857,7 +10864,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10857
10864
|
if (!l)
|
|
10858
10865
|
throw new Error("VALIDATION_ERROR: Permissions are required");
|
|
10859
10866
|
try {
|
|
10860
|
-
v = await
|
|
10867
|
+
v = await Mo(e, t, s, r, i, l, d);
|
|
10861
10868
|
} catch (y) {
|
|
10862
10869
|
throw new Error(y.message);
|
|
10863
10870
|
}
|
|
@@ -10874,7 +10881,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10874
10881
|
if (i.Role && i.Role !== o.Role || Object.keys(f).length)
|
|
10875
10882
|
try {
|
|
10876
10883
|
const w = {
|
|
10877
|
-
...
|
|
10884
|
+
...zc(a.customClaims),
|
|
10878
10885
|
...f
|
|
10879
10886
|
};
|
|
10880
10887
|
await m.setCustomUserClaims(o.User_ID, {
|
|
@@ -10911,7 +10918,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10911
10918
|
if (R) {
|
|
10912
10919
|
const O = `https://${m.app.options.projectId}.firebaseapp.com/__/auth/action${R}`, I = await ie(s.appName), E = s?.mail?.emailVerification && s.mail.emailVerification(O, I);
|
|
10913
10920
|
try {
|
|
10914
|
-
await
|
|
10921
|
+
await Fo(i.Email, E?.subject || "Please verify your email address", void 0, E?.html || `Please verify your email address by clicking the link:
|
|
10915
10922
|
</br>
|
|
10916
10923
|
</br>
|
|
10917
10924
|
<a href="${O}">${O}</a>`);
|
|
@@ -10929,7 +10936,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10929
10936
|
}
|
|
10930
10937
|
if (v)
|
|
10931
10938
|
return v;
|
|
10932
|
-
},
|
|
10939
|
+
}, Jc = async (n, e, t) => {
|
|
10933
10940
|
const s = Xe(), r = ce(), i = [e];
|
|
10934
10941
|
t && t.trim() !== "" && i.push(t), i.sort();
|
|
10935
10942
|
const o = [];
|
|
@@ -10941,7 +10948,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10941
10948
|
}
|
|
10942
10949
|
for (const a of o)
|
|
10943
10950
|
n.set(a, { locked: !0 });
|
|
10944
|
-
},
|
|
10951
|
+
}, ni = async (n, e) => {
|
|
10945
10952
|
const t = Xe(), s = ce(), r = [n];
|
|
10946
10953
|
e && e.trim() !== "" && r.push(e), r.sort();
|
|
10947
10954
|
const i = s.batch();
|
|
@@ -10950,7 +10957,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10950
10957
|
i.delete(a);
|
|
10951
10958
|
}
|
|
10952
10959
|
await i.commit();
|
|
10953
|
-
},
|
|
10960
|
+
}, Qc = async (n, e, t, s) => {
|
|
10954
10961
|
const r = s?.userId;
|
|
10955
10962
|
let i = s?.user, o = s?.context;
|
|
10956
10963
|
const a = Xe(), l = Zt();
|
|
@@ -10968,7 +10975,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10968
10975
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
10969
10976
|
const f = c.collections[d], { labels: g, fields: v, enableWriteLog: y } = f, w = et(g.collection, c), R = await ie(l.appName), O = Et(), I = ce();
|
|
10970
10977
|
let E;
|
|
10971
|
-
r && await
|
|
10978
|
+
r && await nr(n, f);
|
|
10972
10979
|
const C = Ce(I, n, a);
|
|
10973
10980
|
o = o || {}, o.collection = g.collection;
|
|
10974
10981
|
let _ = s?.originalRecord || await Ye(n, e, {
|
|
@@ -10997,13 +11004,13 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
10997
11004
|
throw new Error("VALIDATION_ERROR: User operations are only permitted for auth collections");
|
|
10998
11005
|
if (i?.operation === "delete" && i.permissions)
|
|
10999
11006
|
throw new Error("VALIDATION_ERROR: Permissions are not allowed for delete operations");
|
|
11000
|
-
const k = f.fields.filter((x) => x.saveToAuthToken && !
|
|
11001
|
-
k.some((x) => t[x.name] !== void 0)), j = (x) => x.User_ID && (f.auth && !p &&
|
|
11007
|
+
const k = f.fields.filter((x) => x.saveToAuthToken && !tr(x.name)), p = f.auth && i?.operation === "create", F = f.auth && i?.operation === "delete", A = f.auth && !p && !F && (i?.operation === "update" || t.Role || t.Enabled !== void 0 || t.Name || t.Email || t.Photo_URL || // eslint-disable-next-line security/detect-object-injection
|
|
11008
|
+
k.some((x) => t[x.name] !== void 0)), j = (x) => x.User_ID && (f.auth && !p && !F && i?.operation === "update" || t.Role && t.Role !== x.Role || t.Enabled !== void 0 && t.Enabled !== x.Enabled || t.Name && t.Name !== x.Name || t.Email && t.Email !== x.Email || t.Photo_URL && t.Photo_URL !== x.Photo_URL || k.some(
|
|
11002
11009
|
// eslint-disable-next-line security/detect-object-injection
|
|
11003
11010
|
(Q) => t[Q.name] !== void 0 && t[Q.name] !== x[Q.name]
|
|
11004
11011
|
));
|
|
11005
|
-
delete t.id, Po(t),
|
|
11006
|
-
const h =
|
|
11012
|
+
delete t.id, Po(t), sr(t);
|
|
11013
|
+
const h = js("update", n, t, c, R, "Online", r || "System", ut.now(), he.serverTimestamp()), S = fe(h);
|
|
11007
11014
|
for (const x of v)
|
|
11008
11015
|
!X(x) && Re(h[x.name]) && x.nullable && (h[x.name] = null);
|
|
11009
11016
|
Ue(h), Ue(_), y && !s?.providedTransaction && await Lt("update", "started", h, a, n, e, f, void 0, _);
|
|
@@ -11077,7 +11084,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11077
11084
|
if (!E.Enabled)
|
|
11078
11085
|
throw new Error("PERMISSION_DENIED");
|
|
11079
11086
|
}
|
|
11080
|
-
if (B && (B.size += Io(a, n, e, c, E).length), p && _.User_ID ||
|
|
11087
|
+
if (B && (B.size += Io(a, n, e, c, E).length), p && _.User_ID || F && !_.User_ID)
|
|
11081
11088
|
throw new Error("USER_ERROR");
|
|
11082
11089
|
if (j(_)) {
|
|
11083
11090
|
const Oe = await x.get(I.collection("tenants").doc(a).collection("system_user_permissions").doc(_.User_ID));
|
|
@@ -11104,11 +11111,11 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11104
11111
|
]) : !0))
|
|
11105
11112
|
throw new Error("PERMISSION_DENIED");
|
|
11106
11113
|
const Kn = h[we.name].toString().toLowerCase().replace(/\s/g, "---").replaceAll("/", "|||");
|
|
11107
|
-
if (
|
|
11114
|
+
if (Xs(Kn)) {
|
|
11108
11115
|
if (B && B.size++, B && B.size > 500)
|
|
11109
11116
|
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.");
|
|
11110
|
-
const
|
|
11111
|
-
if (
|
|
11117
|
+
const rr = await x.get(I.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${we.name}`).doc(Kn));
|
|
11118
|
+
if (rr.exists && rr.data().id !== e)
|
|
11112
11119
|
throw new Error(`VALIDATION_ERROR: ${we.name} "${h[we.name]}" already exists`);
|
|
11113
11120
|
} else
|
|
11114
11121
|
throw new Error(`VALIDATION_ERROR: ${we.name} "${h[we.name]}" is invalid`);
|
|
@@ -11130,12 +11137,12 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11130
11137
|
throw new Error("PERMISSION_DENIED");
|
|
11131
11138
|
}
|
|
11132
11139
|
}
|
|
11133
|
-
|
|
11140
|
+
ar(h, _, e, f, c, r, E, i?.operation ? i.operation : A ? "update" : void 0, i?.permissions, N), i?.permissions && r && E && await Wo(x, i.permissions, r, E, c, N, B), ar(h, _, e, f, c, r, E, i?.operation ? i.operation : A ? "update" : void 0, i?.permissions, N), Q && (p || j(_) || F) && await Jc(x, e, _.User_ID);
|
|
11134
11141
|
};
|
|
11135
|
-
(p || A ||
|
|
11142
|
+
(p || A || F) && await I.runTransaction(async (x) => {
|
|
11136
11143
|
await q(x, !0);
|
|
11137
11144
|
}, { maxAttempts: 10 });
|
|
11138
|
-
const
|
|
11145
|
+
const M = async (x, Q) => {
|
|
11139
11146
|
if (!_)
|
|
11140
11147
|
throw new Error("NOT_FOUND");
|
|
11141
11148
|
try {
|
|
@@ -11143,8 +11150,8 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11143
11150
|
await q(x, !1, B);
|
|
11144
11151
|
let Ve;
|
|
11145
11152
|
!s?.noTwoWay && !s?.providedTransaction && (Ve = await Lo("Update", a, e, ve, h, f, c, x, B, r, E, _));
|
|
11146
|
-
const ze =
|
|
11147
|
-
|
|
11153
|
+
const ze = Ws(c);
|
|
11154
|
+
Ks("update", x, n, e, h, c, f, s, ze, he.arrayUnion, he.arrayRemove, he.delete, (me) => I.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${me.name}`).doc(e), (me, qe) => I.collection("tenants").doc(a).collection("system_unique").doc(g.collection).collection(`Unique-${g.collection}-${me.name}`).doc(qe), (me) => I.collection("tenants").doc(a).collection("system_fields").doc(g.collection).collection(`${g.collection}-${me}`).doc(e), (me, qe) => Ce(I, me, a).doc(qe), (me, qe, Oe) => I.collection("tenants").doc(a).collection("system_fields").doc(me.collection).collection(`${me.collection}-${qe}`).doc(Oe), (me, qe, Oe) => I.collection("tenants").doc(a).collection("system_fields").doc(me.collection).collection(`${me.collection}-${qe.replaceAll(" ", "-")}`).doc(Oe), _, Ve, B), x.update(C.doc(e), h);
|
|
11148
11155
|
} catch (B) {
|
|
11149
11156
|
if (s?.providedTransaction)
|
|
11150
11157
|
throw B;
|
|
@@ -11160,16 +11167,16 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11160
11167
|
if (y && (await new Promise((ze) => {
|
|
11161
11168
|
setTimeout(ze, 250);
|
|
11162
11169
|
}), await Lt("update", Ve?.resolved ? "success" : "failed", h, a, n, e, f, Ve?.resolved ? void 0 : B, _)), !Ve?.resolved)
|
|
11163
|
-
throw p && await dn(_), j(_) && await Kt(_.User_ID, Q, N, "USER_ERROR"),
|
|
11170
|
+
throw p && await dn(_), j(_) && await Kt(_.User_ID, Q, N, "USER_ERROR"), F && await I.collection("tenants").doc(a).collection(g.collection).doc(e).update({ User_ID: he.delete() }), B;
|
|
11164
11171
|
}
|
|
11165
11172
|
}
|
|
11166
|
-
(p || j(_) ||
|
|
11173
|
+
(p || j(_) || F) && await Kr(ni, [e, _.User_ID]).catch(() => {
|
|
11167
11174
|
throw new Error("USER_ERROR");
|
|
11168
11175
|
});
|
|
11169
11176
|
};
|
|
11170
11177
|
try {
|
|
11171
11178
|
let x;
|
|
11172
|
-
if (p || j(_) ||
|
|
11179
|
+
if (p || j(_) || F) {
|
|
11173
11180
|
if (j(_)) {
|
|
11174
11181
|
x = await O.getUser(_.User_ID);
|
|
11175
11182
|
const ve = x.customClaims;
|
|
@@ -11178,14 +11185,14 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11178
11185
|
}
|
|
11179
11186
|
const Q = { ..._, ...h };
|
|
11180
11187
|
it(Q);
|
|
11181
|
-
const B = await
|
|
11182
|
-
p && (h.User_ID = B),
|
|
11188
|
+
const B = await Yc(i?.operation || "update", a, e, l, f, Q, _, x, i?.permissions, N, i?.password);
|
|
11189
|
+
p && (h.User_ID = B), F && (h.User_ID = he.delete());
|
|
11183
11190
|
}
|
|
11184
|
-
s?.providedTransaction ? await
|
|
11185
|
-
await
|
|
11191
|
+
s?.providedTransaction ? await M(s.providedTransaction, x) : await I.runTransaction(async (Q) => {
|
|
11192
|
+
await M(Q, x);
|
|
11186
11193
|
}, { maxAttempts: 10 });
|
|
11187
11194
|
} catch (x) {
|
|
11188
|
-
throw (p || j(_) ||
|
|
11195
|
+
throw (p || j(_) || F) && await Kr(ni, [e, _.User_ID]).catch(() => {
|
|
11189
11196
|
throw new Error("USER_ERROR");
|
|
11190
11197
|
}), x;
|
|
11191
11198
|
}
|
|
@@ -11201,7 +11208,7 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11201
11208
|
}
|
|
11202
11209
|
const G = { ..._, ...h };
|
|
11203
11210
|
return it(G), { id: e, ...G };
|
|
11204
|
-
},
|
|
11211
|
+
}, vu = async (n, e, t) => {
|
|
11205
11212
|
const s = t?.userId;
|
|
11206
11213
|
let r = t?.context;
|
|
11207
11214
|
const i = Xe(), o = Zt();
|
|
@@ -11213,14 +11220,14 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11213
11220
|
throw new Error("COLLECTION_NOT_FOUND");
|
|
11214
11221
|
const m = a.collections[l], { labels: u, auth: f, enableWriteLog: g, softDelete: v } = m, y = et(u.collection, a), w = await ie(o.appName);
|
|
11215
11222
|
if (v && !f && !t?.force)
|
|
11216
|
-
return await
|
|
11223
|
+
return await Qc(n, e, { [v.archivedField]: !0, [v.timestampField]: he.serverTimestamp() }, { userId: s });
|
|
11217
11224
|
const R = ce();
|
|
11218
11225
|
let O;
|
|
11219
|
-
s && await
|
|
11226
|
+
s && await nr(n, m);
|
|
11220
11227
|
const I = Ce(R, n, i);
|
|
11221
11228
|
r = r || {}, r.collection = u.collection;
|
|
11222
11229
|
const E = await Ye(n, e, { userId: s });
|
|
11223
|
-
let C =
|
|
11230
|
+
let C = js("delete", n, E, a, w, "Online", s || "System", ut.now(), he.serverTimestamp());
|
|
11224
11231
|
const _ = Rn(C);
|
|
11225
11232
|
Ue(C), g && await Lt("delete", "started", C, i, n, e, m), await oe("preOperation", o, y, { operation: "delete", data: C, recordId: e, context: r }), await oe("preWrite", o, y, { operation: "delete", data: C, recordId: e, context: r }), Ue(C);
|
|
11226
11233
|
const p = async (h) => {
|
|
@@ -11243,11 +11250,11 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11243
11250
|
throw new Error("USER_ERROR");
|
|
11244
11251
|
if (!O.Enabled)
|
|
11245
11252
|
throw new Error("PERMISSION_DENIED");
|
|
11246
|
-
|
|
11253
|
+
Xo(C, e, m, a, s, O);
|
|
11247
11254
|
}
|
|
11248
11255
|
if (s && O?.Role) {
|
|
11249
|
-
const
|
|
11250
|
-
if (!(y.custom?.serverAccess?.delete !== void 0 ? await ie(y.custom.serverAccess.delete, [
|
|
11256
|
+
const M = O.Role;
|
|
11257
|
+
if (!(y.custom?.serverAccess?.delete !== void 0 ? await ie(y.custom.serverAccess.delete, [M, C]) : !0))
|
|
11251
11258
|
throw new Error("PERMISSION_DENIED");
|
|
11252
11259
|
}
|
|
11253
11260
|
};
|
|
@@ -11257,8 +11264,8 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11257
11264
|
try {
|
|
11258
11265
|
await R.runTransaction(async (h) => {
|
|
11259
11266
|
await p(h);
|
|
11260
|
-
const S =
|
|
11261
|
-
|
|
11267
|
+
const S = Ws(a);
|
|
11268
|
+
Ks("delete", h, n, e, C, a, m, t, S, he.arrayUnion, he.arrayRemove, he.delete, (b) => R.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${b.name}`).doc(e), (b, T) => R.collection("tenants").doc(i).collection("system_unique").doc(u.collection).collection(`Unique-${u.collection}-${b.name}`).doc(T), (b) => R.collection("tenants").doc(i).collection("system_fields").doc(u.collection).collection(`${u.collection}-${b}`).doc(e), (b, T) => Ce(R, b, i).doc(T), (b, T, N) => R.collection("tenants").doc(i).collection("system_fields").doc(b.collection).collection(`${b.collection}-${T}`).doc(N), (b, T, N) => R.collection("tenants").doc(i).collection("system_fields").doc(b.collection).collection(`${b.collection}-${T.replaceAll(" ", "-")}`).doc(N)), h.delete(I.doc(e));
|
|
11262
11269
|
}, { maxAttempts: 10 });
|
|
11263
11270
|
} catch (h) {
|
|
11264
11271
|
const b = await oe("postWriteError", o, y, {
|
|
@@ -11273,9 +11280,9 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11273
11280
|
}), await Lt("delete", b?.resolved ? "success" : "failed", C, i, n, e, m, b?.resolved ? void 0 : h)), !b?.resolved)
|
|
11274
11281
|
throw m.auth && C.User_ID && await R.collection("tenants").doc(i).collection(u.collection).doc(e).update({ User_ID: he.delete() }), h;
|
|
11275
11282
|
}
|
|
11276
|
-
const
|
|
11277
|
-
return await oe("postWrite", o, y,
|
|
11278
|
-
},
|
|
11283
|
+
const F = { operation: "delete", data: C, recordId: e, context: r }, A = { ...F };
|
|
11284
|
+
return await oe("postWrite", o, y, F), await oe("postOperation", o, y, A), { id: e, ...C };
|
|
11285
|
+
}, Ou = async (n, e) => {
|
|
11279
11286
|
const t = ce(), s = So(), r = process.env.ADMIN_SMS;
|
|
11280
11287
|
if (s === "development")
|
|
11281
11288
|
if (r)
|
|
@@ -11284,72 +11291,73 @@ const Fo = async (n, e, t, s, r, i, o) => {
|
|
|
11284
11291
|
throw new Error("Admin phone not set");
|
|
11285
11292
|
const i = { to: n, body: e };
|
|
11286
11293
|
await t.collection("system_messages").add(i);
|
|
11287
|
-
},
|
|
11294
|
+
}, Kc = (n) => n !== null && typeof n == "object", ku = (n) => {
|
|
11288
11295
|
const e = (t) => {
|
|
11289
11296
|
Object.entries(t).forEach(([s, r]) => {
|
|
11290
11297
|
r instanceof ut ? t[s] = {
|
|
11291
11298
|
_seconds: r.seconds,
|
|
11292
11299
|
_nanoseconds: r.nanoseconds
|
|
11293
|
-
} :
|
|
11300
|
+
} : Kc(r) && e(r);
|
|
11294
11301
|
});
|
|
11295
11302
|
};
|
|
11296
11303
|
e(n);
|
|
11297
|
-
},
|
|
11304
|
+
}, bu = async (n) => await Et().getUser(n), Tu = (n) => {
|
|
11298
11305
|
const e = Ro();
|
|
11299
11306
|
return L.fromJSDate(n).setZone(e);
|
|
11300
|
-
},
|
|
11307
|
+
}, Xc = (n) => {
|
|
11301
11308
|
const e = Ro();
|
|
11302
11309
|
return L.fromJSDate(n.toDate()).setZone(e);
|
|
11303
|
-
},
|
|
11310
|
+
}, Su = (n, e) => {
|
|
11304
11311
|
const s = L.fromJSDate(n, { zone: e }).offset, i = L.fromJSDate(n).offset, o = s - i;
|
|
11305
11312
|
return L.fromJSDate(n).plus({ minutes: o }).toJSDate();
|
|
11306
|
-
},
|
|
11313
|
+
}, Ru = (n, e) => {
|
|
11307
11314
|
const s = L.fromJSDate(n, { zone: e }).offset, i = L.fromJSDate(n).offset, o = s - i;
|
|
11308
11315
|
return L.fromJSDate(n).minus({ minutes: o }).toJSDate();
|
|
11309
|
-
},
|
|
11316
|
+
}, Iu = (n) => "seconds" in n && "nanoseconds" in n ? Xc(new ut(n.seconds, n.nanoseconds)).toFormat("MMMM d, yyyy '@' h:mm a") : "";
|
|
11310
11317
|
export {
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11318
|
+
Eu as addRecord,
|
|
11319
|
+
Mo as addUser,
|
|
11320
|
+
Tu as convertDateToTimezone,
|
|
11321
|
+
Xc as convertTimestampToTimezone,
|
|
11322
|
+
vu as deleteRecord,
|
|
11316
11323
|
dn as deleteUser,
|
|
11317
|
-
|
|
11324
|
+
sr as deserializeDeleteSentinels,
|
|
11318
11325
|
Po as deserializeTimestamps,
|
|
11319
|
-
|
|
11320
|
-
|
|
11326
|
+
_u as deserializeTimestampsWithoutUnderscores,
|
|
11327
|
+
Iu as displayDate,
|
|
11321
11328
|
Ke as fetchCurrentSchema,
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11329
|
+
wu as fetchLastSchema,
|
|
11330
|
+
uu as getCachedConfigValue,
|
|
11331
|
+
jc as getCollectionRefs,
|
|
11325
11332
|
et as getCustomizationFile,
|
|
11326
|
-
|
|
11333
|
+
Wc as getCustomizationFiles,
|
|
11327
11334
|
Io as getDocumentRefs,
|
|
11328
11335
|
Ce as getFirestorePathRef,
|
|
11329
11336
|
Zt as getGlobalConfigModule,
|
|
11330
|
-
|
|
11331
|
-
|
|
11337
|
+
du as getInputSchema,
|
|
11338
|
+
pu as getMaintenanceInfo,
|
|
11332
11339
|
So as getMode,
|
|
11333
11340
|
Ye as getOne,
|
|
11334
11341
|
No as getSome,
|
|
11342
|
+
ce as getStokerFirestore,
|
|
11335
11343
|
Xe as getTenant,
|
|
11336
11344
|
Ro as getTimezone,
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11345
|
+
bu as getUser,
|
|
11346
|
+
mu as getVersionInfo,
|
|
11347
|
+
Pa as getZodSchema,
|
|
11348
|
+
gu as initializeFirebase,
|
|
11349
|
+
fu as initializeStoker,
|
|
11342
11350
|
Re as isDeleteSentinel,
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11351
|
+
Su as keepTimezone,
|
|
11352
|
+
Ru as removeTimezone,
|
|
11353
|
+
yu as runChildProcess,
|
|
11354
|
+
Fo as sendMail,
|
|
11355
|
+
Ou as sendMessage,
|
|
11356
|
+
ku as serializeTimestamps,
|
|
11357
|
+
hu as setTenant,
|
|
11350
11358
|
ie as tryPromise,
|
|
11351
|
-
|
|
11352
|
-
|
|
11359
|
+
Qc as updateRecord,
|
|
11360
|
+
Yc as updateUser,
|
|
11353
11361
|
Lo as validateRelations,
|
|
11354
11362
|
Uo as validateSoftDelete,
|
|
11355
11363
|
Lt as writeLog
|