@authhero/cloudflare-adapter 2.7.5 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,75 +1,71 @@
1
- var ct = Object.defineProperty;
2
- var dt = (r, e, t) => e in r ? ct(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var ke = (r, e, t) => dt(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { verificationMethodsSchema as ut } from "@authhero/adapter-interfaces";
5
- import lt from "wretch";
6
- function ft(r, e) {
1
+ import { verificationMethodsSchema as lt } from "@authhero/adapter-interfaces";
2
+ import ft from "wretch";
3
+ function ht(s, e) {
7
4
  var t = {};
8
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && e.indexOf(s) < 0 && (t[s] = r[s]);
9
- if (r != null && typeof Object.getOwnPropertySymbols == "function")
10
- for (var n = 0, s = Object.getOwnPropertySymbols(r); n < s.length; n++)
11
- e.indexOf(s[n]) < 0 && Object.prototype.propertyIsEnumerable.call(r, s[n]) && (t[s[n]] = r[s[n]]);
5
+ for (var r in s) Object.prototype.hasOwnProperty.call(s, r) && e.indexOf(r) < 0 && (t[r] = s[r]);
6
+ if (s != null && typeof Object.getOwnPropertySymbols == "function")
7
+ for (var n = 0, r = Object.getOwnPropertySymbols(s); n < r.length; n++)
8
+ e.indexOf(r[n]) < 0 && Object.prototype.propertyIsEnumerable.call(s, r[n]) && (t[r[n]] = s[r[n]]);
12
9
  return t;
13
10
  }
14
- function ht(r, e) {
11
+ function pt(s, e) {
15
12
  var t;
16
- return ((t = r == null ? void 0 : r._def) === null || t === void 0 ? void 0 : t.typeName) === e;
13
+ return ((t = s?._def) === null || t === void 0 ? void 0 : t.typeName) === e;
17
14
  }
18
- function ne(r, e) {
19
- const t = r.ZodType.prototype[e];
20
- r.ZodType.prototype[e] = function(...s) {
21
- const n = t.apply(this, s);
15
+ function le(s, e) {
16
+ const t = s.ZodType.prototype[e];
17
+ s.ZodType.prototype[e] = function(...r) {
18
+ const n = t.apply(this, r);
22
19
  return n._def.openapi = this._def.openapi, n;
23
20
  };
24
21
  }
25
- function pt(r) {
26
- if (typeof r.ZodType.prototype.openapi < "u")
22
+ function mt(s) {
23
+ if (typeof s.ZodType.prototype.openapi < "u")
27
24
  return;
28
- r.ZodType.prototype.openapi = function(n, a) {
29
- var i, o, c, d, h, b;
30
- const C = typeof n == "string" ? a : n, w = C ?? {}, { param: M } = w, Re = ft(w, ["param"]), D = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof n == "string" ? { refId: n } : void 0), be = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), Re), !((d = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || d === void 0) && d.param || M ? {
31
- param: Object.assign(Object.assign({}, (b = (h = this._def.openapi) === null || h === void 0 ? void 0 : h.metadata) === null || b === void 0 ? void 0 : b.param), M)
32
- } : void 0), B = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(D).length > 0 ? { _internal: D } : void 0), Object.keys(be).length > 0 ? { metadata: be } : void 0) }));
33
- if (ht(this, "ZodObject")) {
34
- const re = this.extend;
35
- B.extend = function(...se) {
36
- var Ne, Ie, $e, Pe, Me, De;
37
- const Ve = re.apply(this, se);
38
- return Ve._def.openapi = {
25
+ s.ZodType.prototype.openapi = function(n, a) {
26
+ var i, o, c, u, p, b;
27
+ const C = typeof n == "string" ? a : n, w = C ?? {}, { param: Z } = w, de = ht(w, ["param"]), M = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof n == "string" ? { refId: n } : void 0), J = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), de), !((u = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || u === void 0) && u.param || Z ? {
28
+ param: Object.assign(Object.assign({}, (b = (p = this._def.openapi) === null || p === void 0 ? void 0 : p.metadata) === null || b === void 0 ? void 0 : b.param), Z)
29
+ } : void 0), D = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(M).length > 0 ? { _internal: M } : void 0), Object.keys(J).length > 0 ? { metadata: J } : void 0) }));
30
+ if (pt(this, "ZodObject")) {
31
+ const ee = this.extend;
32
+ D.extend = function(...Q) {
33
+ var H, ue, Pe, Me, De, Le, Ve;
34
+ const ze = ee.apply(this, Q);
35
+ return ze._def.openapi = {
39
36
  _internal: {
40
- extendedFrom: !((Ie = (Ne = this._def.openapi) === null || Ne === void 0 ? void 0 : Ne._internal) === null || Ie === void 0) && Ie.refId ? { refId: (Pe = ($e = this._def.openapi) === null || $e === void 0 ? void 0 : $e._internal) === null || Pe === void 0 ? void 0 : Pe.refId, schema: this } : (Me = this._def.openapi) === null || Me === void 0 ? void 0 : Me._internal.extendedFrom
37
+ extendedFrom: !((ue = (H = this._def.openapi) === null || H === void 0 ? void 0 : H._internal) === null || ue === void 0) && ue.refId ? { refId: (Me = (Pe = this._def.openapi) === null || Pe === void 0 ? void 0 : Pe._internal) === null || Me === void 0 ? void 0 : Me.refId, schema: this } : (Le = (De = this._def.openapi) === null || De === void 0 ? void 0 : De._internal) === null || Le === void 0 ? void 0 : Le.extendedFrom
41
38
  },
42
- metadata: (De = Ve._def.openapi) === null || De === void 0 ? void 0 : De.metadata
43
- }, Ve;
39
+ metadata: (Ve = ze._def.openapi) === null || Ve === void 0 ? void 0 : Ve.metadata
40
+ }, ze;
44
41
  };
45
42
  }
46
- return B;
47
- }, ne(r, "optional"), ne(r, "nullable"), ne(r, "default"), ne(r, "transform"), ne(r, "refine");
48
- const e = r.ZodObject.prototype.deepPartial;
49
- r.ZodObject.prototype.deepPartial = function() {
43
+ return D;
44
+ }, le(s, "optional"), le(s, "nullable"), le(s, "default"), le(s, "transform"), le(s, "refine");
45
+ const e = s.ZodObject.prototype.deepPartial;
46
+ s.ZodObject.prototype.deepPartial = function() {
50
47
  const n = this._def.shape(), a = e.apply(this), i = a._def.shape();
51
48
  return Object.entries(i).forEach(([o, c]) => {
52
- var d, h;
53
- c._def.openapi = (h = (d = n[o]) === null || d === void 0 ? void 0 : d._def) === null || h === void 0 ? void 0 : h.openapi;
49
+ var u, p;
50
+ c._def.openapi = (p = (u = n[o]) === null || u === void 0 ? void 0 : u._def) === null || p === void 0 ? void 0 : p.openapi;
54
51
  }), a._def.openapi = void 0, a;
55
52
  };
56
- const t = r.ZodObject.prototype.pick;
57
- r.ZodObject.prototype.pick = function(...n) {
53
+ const t = s.ZodObject.prototype.pick;
54
+ s.ZodObject.prototype.pick = function(...n) {
58
55
  const a = t.apply(this, n);
59
56
  return a._def.openapi = void 0, a;
60
57
  };
61
- const s = r.ZodObject.prototype.omit;
62
- r.ZodObject.prototype.omit = function(...n) {
63
- const a = s.apply(this, n);
58
+ const r = s.ZodObject.prototype.omit;
59
+ s.ZodObject.prototype.omit = function(...n) {
60
+ const a = r.apply(this, n);
64
61
  return a._def.openapi = void 0, a;
65
62
  };
66
63
  }
67
- var H = class extends Error {
68
- constructor(e = 500, t) {
69
- super(t == null ? void 0 : t.message, { cause: t == null ? void 0 : t.cause });
70
- ke(this, "res");
71
- ke(this, "status");
72
- this.res = t == null ? void 0 : t.res, this.status = e;
64
+ var te = class extends Error {
65
+ res;
66
+ status;
67
+ constructor(s = 500, e) {
68
+ super(e?.message, { cause: e?.cause }), this.res = e?.res, this.status = s;
73
69
  }
74
70
  getResponse() {
75
71
  return this.res ? new Response(this.res.body, {
@@ -82,49 +78,50 @@ var H = class extends Error {
82
78
  };
83
79
  new Set(".\\+*[^]$()");
84
80
  var x;
85
- (function(r) {
86
- r.assertEqual = (n) => n;
81
+ (function(s) {
82
+ s.assertEqual = (n) => {
83
+ };
87
84
  function e(n) {
88
85
  }
89
- r.assertIs = e;
86
+ s.assertIs = e;
90
87
  function t(n) {
91
88
  throw new Error();
92
89
  }
93
- r.assertNever = t, r.arrayToEnum = (n) => {
90
+ s.assertNever = t, s.arrayToEnum = (n) => {
94
91
  const a = {};
95
92
  for (const i of n)
96
93
  a[i] = i;
97
94
  return a;
98
- }, r.getValidEnumValues = (n) => {
99
- const a = r.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
95
+ }, s.getValidEnumValues = (n) => {
96
+ const a = s.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
100
97
  for (const o of a)
101
98
  i[o] = n[o];
102
- return r.objectValues(i);
103
- }, r.objectValues = (n) => r.objectKeys(n).map(function(a) {
99
+ return s.objectValues(i);
100
+ }, s.objectValues = (n) => s.objectKeys(n).map(function(a) {
104
101
  return n[a];
105
- }), r.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
102
+ }), s.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
106
103
  const a = [];
107
104
  for (const i in n)
108
105
  Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
109
106
  return a;
110
- }, r.find = (n, a) => {
107
+ }, s.find = (n, a) => {
111
108
  for (const i of n)
112
109
  if (a(i))
113
110
  return i;
114
- }, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
115
- function s(n, a = " | ") {
111
+ }, s.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && Number.isFinite(n) && Math.floor(n) === n;
112
+ function r(n, a = " | ") {
116
113
  return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
117
114
  }
118
- r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
115
+ s.joinValues = r, s.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
119
116
  })(x || (x = {}));
120
- var Be;
121
- (function(r) {
122
- r.mergeShapes = (e, t) => ({
117
+ var Fe;
118
+ (function(s) {
119
+ s.mergeShapes = (e, t) => ({
123
120
  ...e,
124
121
  ...t
125
122
  // second overwrites first
126
123
  });
127
- })(Be || (Be = {}));
124
+ })(Fe || (Fe = {}));
128
125
  const f = x.arrayToEnum([
129
126
  "string",
130
127
  "nan",
@@ -146,14 +143,14 @@ const f = x.arrayToEnum([
146
143
  "never",
147
144
  "map",
148
145
  "set"
149
- ]), $ = (r) => {
150
- switch (typeof r) {
146
+ ]), V = (s) => {
147
+ switch (typeof s) {
151
148
  case "undefined":
152
149
  return f.undefined;
153
150
  case "string":
154
151
  return f.string;
155
152
  case "number":
156
- return isNaN(r) ? f.nan : f.number;
153
+ return Number.isNaN(s) ? f.nan : f.number;
157
154
  case "boolean":
158
155
  return f.boolean;
159
156
  case "function":
@@ -163,11 +160,11 @@ const f = x.arrayToEnum([
163
160
  case "symbol":
164
161
  return f.symbol;
165
162
  case "object":
166
- return Array.isArray(r) ? f.array : r === null ? f.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? f.promise : typeof Map < "u" && r instanceof Map ? f.map : typeof Set < "u" && r instanceof Set ? f.set : typeof Date < "u" && r instanceof Date ? f.date : f.object;
163
+ return Array.isArray(s) ? f.array : s === null ? f.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? f.promise : typeof Map < "u" && s instanceof Map ? f.map : typeof Set < "u" && s instanceof Set ? f.set : typeof Date < "u" && s instanceof Date ? f.date : f.object;
167
164
  default:
168
165
  return f.unknown;
169
166
  }
170
- }, u = x.arrayToEnum([
167
+ }, d = x.arrayToEnum([
171
168
  "invalid_type",
172
169
  "invalid_literal",
173
170
  "custom",
@@ -184,16 +181,16 @@ const f = x.arrayToEnum([
184
181
  "invalid_intersection_types",
185
182
  "not_multiple_of",
186
183
  "not_finite"
187
- ]), mt = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
188
- class Z extends Error {
184
+ ]), yt = (s) => JSON.stringify(s, null, 2).replace(/"([^"]+)":/g, "$1:");
185
+ class O extends Error {
189
186
  get errors() {
190
187
  return this.issues;
191
188
  }
192
189
  constructor(e) {
193
- super(), this.issues = [], this.addIssue = (s) => {
194
- this.issues = [...this.issues, s];
195
- }, this.addIssues = (s = []) => {
196
- this.issues = [...this.issues, ...s];
190
+ super(), this.issues = [], this.addIssue = (r) => {
191
+ this.issues = [...this.issues, r];
192
+ }, this.addIssues = (r = []) => {
193
+ this.issues = [...this.issues, ...r];
197
194
  };
198
195
  const t = new.target.prototype;
199
196
  Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
@@ -201,7 +198,7 @@ class Z extends Error {
201
198
  format(e) {
202
199
  const t = e || function(a) {
203
200
  return a.message;
204
- }, s = { _errors: [] }, n = (a) => {
201
+ }, r = { _errors: [] }, n = (a) => {
205
202
  for (const i of a.issues)
206
203
  if (i.code === "invalid_union")
207
204
  i.unionErrors.map(n);
@@ -210,19 +207,19 @@ class Z extends Error {
210
207
  else if (i.code === "invalid_arguments")
211
208
  n(i.argumentsError);
212
209
  else if (i.path.length === 0)
213
- s._errors.push(t(i));
210
+ r._errors.push(t(i));
214
211
  else {
215
- let o = s, c = 0;
212
+ let o = r, c = 0;
216
213
  for (; c < i.path.length; ) {
217
- const d = i.path[c];
218
- c === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], c++;
214
+ const u = i.path[c];
215
+ c === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], c++;
219
216
  }
220
217
  }
221
218
  };
222
- return n(this), s;
219
+ return n(this), r;
223
220
  }
224
221
  static assert(e) {
225
- if (!(e instanceof Z))
222
+ if (!(e instanceof O))
226
223
  throw new Error(`Not a ZodError: ${e}`);
227
224
  }
228
225
  toString() {
@@ -235,81 +232,85 @@ class Z extends Error {
235
232
  return this.issues.length === 0;
236
233
  }
237
234
  flatten(e = (t) => t.message) {
238
- const t = {}, s = [];
235
+ const t = {}, r = [];
239
236
  for (const n of this.issues)
240
- n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : s.push(e(n));
241
- return { formErrors: s, fieldErrors: t };
237
+ if (n.path.length > 0) {
238
+ const a = n.path[0];
239
+ t[a] = t[a] || [], t[a].push(e(n));
240
+ } else
241
+ r.push(e(n));
242
+ return { formErrors: r, fieldErrors: t };
242
243
  }
243
244
  get formErrors() {
244
245
  return this.flatten();
245
246
  }
246
247
  }
247
- Z.create = (r) => new Z(r);
248
- const Q = (r, e) => {
248
+ O.create = (s) => new O(s);
249
+ const ie = (s, e) => {
249
250
  let t;
250
- switch (r.code) {
251
- case u.invalid_type:
252
- r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
251
+ switch (s.code) {
252
+ case d.invalid_type:
253
+ s.received === f.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
253
254
  break;
254
- case u.invalid_literal:
255
- t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
255
+ case d.invalid_literal:
256
+ t = `Invalid literal value, expected ${JSON.stringify(s.expected, x.jsonStringifyReplacer)}`;
256
257
  break;
257
- case u.unrecognized_keys:
258
- t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
258
+ case d.unrecognized_keys:
259
+ t = `Unrecognized key(s) in object: ${x.joinValues(s.keys, ", ")}`;
259
260
  break;
260
- case u.invalid_union:
261
+ case d.invalid_union:
261
262
  t = "Invalid input";
262
263
  break;
263
- case u.invalid_union_discriminator:
264
- t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
264
+ case d.invalid_union_discriminator:
265
+ t = `Invalid discriminator value. Expected ${x.joinValues(s.options)}`;
265
266
  break;
266
- case u.invalid_enum_value:
267
- t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
267
+ case d.invalid_enum_value:
268
+ t = `Invalid enum value. Expected ${x.joinValues(s.options)}, received '${s.received}'`;
268
269
  break;
269
- case u.invalid_arguments:
270
+ case d.invalid_arguments:
270
271
  t = "Invalid function arguments";
271
272
  break;
272
- case u.invalid_return_type:
273
+ case d.invalid_return_type:
273
274
  t = "Invalid function return type";
274
275
  break;
275
- case u.invalid_date:
276
+ case d.invalid_date:
276
277
  t = "Invalid date";
277
278
  break;
278
- case u.invalid_string:
279
- typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
279
+ case d.invalid_string:
280
+ typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : x.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
280
281
  break;
281
- case u.too_small:
282
- r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
282
+ case d.too_small:
283
+ s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "bigint" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
283
284
  break;
284
- case u.too_big:
285
- r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
285
+ case d.too_big:
286
+ s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? t = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : t = "Invalid input";
286
287
  break;
287
- case u.custom:
288
+ case d.custom:
288
289
  t = "Invalid input";
289
290
  break;
290
- case u.invalid_intersection_types:
291
+ case d.invalid_intersection_types:
291
292
  t = "Intersection results could not be merged";
292
293
  break;
293
- case u.not_multiple_of:
294
- t = `Number must be a multiple of ${r.multipleOf}`;
294
+ case d.not_multiple_of:
295
+ t = `Number must be a multiple of ${s.multipleOf}`;
295
296
  break;
296
- case u.not_finite:
297
+ case d.not_finite:
297
298
  t = "Number must be finite";
298
299
  break;
299
300
  default:
300
- t = e.defaultError, x.assertNever(r);
301
+ t = e.defaultError, x.assertNever(s);
301
302
  }
302
303
  return { message: t };
303
304
  };
304
- let Ke = Q;
305
- function _t(r) {
306
- Ke = r;
305
+ let st = ie;
306
+ function _t(s) {
307
+ st = s;
307
308
  }
308
- function we() {
309
- return Ke;
309
+ function Oe() {
310
+ return st;
310
311
  }
311
- const Te = (r) => {
312
- const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = {
312
+ const Ae = (s) => {
313
+ const { data: e, path: t, errorMaps: r, issueData: n } = s, a = [...t, ...n.path || []], i = {
313
314
  ...n,
314
315
  path: a
315
316
  };
@@ -320,32 +321,32 @@ const Te = (r) => {
320
321
  message: n.message
321
322
  };
322
323
  let o = "";
323
- const c = s.filter((d) => !!d).slice().reverse();
324
- for (const d of c)
325
- o = d(i, { data: e, defaultError: o }).message;
324
+ const c = r.filter((u) => !!u).slice().reverse();
325
+ for (const u of c)
326
+ o = u(i, { data: e, defaultError: o }).message;
326
327
  return {
327
328
  ...n,
328
329
  path: a,
329
330
  message: o
330
331
  };
331
- }, yt = [];
332
- function l(r, e) {
333
- const t = we(), s = Te({
332
+ }, gt = [];
333
+ function l(s, e) {
334
+ const t = Oe(), r = Ae({
334
335
  issueData: e,
335
- data: r.data,
336
- path: r.path,
336
+ data: s.data,
337
+ path: s.path,
337
338
  errorMaps: [
338
- r.common.contextualErrorMap,
339
+ s.common.contextualErrorMap,
339
340
  // contextual error map is first priority
340
- r.schemaErrorMap,
341
+ s.schemaErrorMap,
341
342
  // then schema-bound map if available
342
343
  t,
343
344
  // then global override map
344
- t === Q ? void 0 : Q
345
+ t === ie ? void 0 : ie
345
346
  // then global default map
346
347
  ].filter((n) => !!n)
347
348
  });
348
- r.common.issues.push(s);
349
+ s.common.issues.push(r);
349
350
  }
350
351
  class T {
351
352
  constructor() {
@@ -358,99 +359,89 @@ class T {
358
359
  this.value !== "aborted" && (this.value = "aborted");
359
360
  }
360
361
  static mergeArray(e, t) {
361
- const s = [];
362
+ const r = [];
362
363
  for (const n of t) {
363
364
  if (n.status === "aborted")
364
- return y;
365
- n.status === "dirty" && e.dirty(), s.push(n.value);
365
+ return m;
366
+ n.status === "dirty" && e.dirty(), r.push(n.value);
366
367
  }
367
- return { status: e.value, value: s };
368
+ return { status: e.value, value: r };
368
369
  }
369
370
  static async mergeObjectAsync(e, t) {
370
- const s = [];
371
+ const r = [];
371
372
  for (const n of t) {
372
373
  const a = await n.key, i = await n.value;
373
- s.push({
374
+ r.push({
374
375
  key: a,
375
376
  value: i
376
377
  });
377
378
  }
378
- return T.mergeObjectSync(e, s);
379
+ return T.mergeObjectSync(e, r);
379
380
  }
380
381
  static mergeObjectSync(e, t) {
381
- const s = {};
382
+ const r = {};
382
383
  for (const n of t) {
383
384
  const { key: a, value: i } = n;
384
385
  if (a.status === "aborted" || i.status === "aborted")
385
- return y;
386
- a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (s[a.value] = i.value);
386
+ return m;
387
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (r[a.value] = i.value);
387
388
  }
388
- return { status: e.value, value: s };
389
+ return { status: e.value, value: r };
389
390
  }
390
391
  }
391
- const y = Object.freeze({
392
+ const m = Object.freeze({
392
393
  status: "aborted"
393
- }), K = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Fe = (r) => r.status === "aborted", qe = (r) => r.status === "dirty", q = (r) => r.status === "valid", oe = (r) => typeof Promise < "u" && r instanceof Promise;
394
- function Se(r, e, t, s) {
395
- if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
396
- return e.get(r);
397
- }
398
- function Xe(r, e, t, s, n) {
399
- if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
400
- return e.set(r, t), t;
401
- }
402
- var m;
403
- (function(r) {
404
- r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
405
- })(m || (m = {}));
406
- var ae, ie;
407
- class R {
408
- constructor(e, t, s, n) {
409
- this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
394
+ }), ne = (s) => ({ status: "dirty", value: s }), S = (s) => ({ status: "valid", value: s }), We = (s) => s.status === "aborted", Je = (s) => s.status === "dirty", K = (s) => s.status === "valid", fe = (s) => typeof Promise < "u" && s instanceof Promise;
395
+ var h;
396
+ (function(s) {
397
+ s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e?.message;
398
+ })(h || (h = {}));
399
+ class $ {
400
+ constructor(e, t, r, n) {
401
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = n;
410
402
  }
411
403
  get path() {
412
- return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
404
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
413
405
  }
414
406
  }
415
- const He = (r, e) => {
416
- if (q(e))
407
+ const Ge = (s, e) => {
408
+ if (K(e))
417
409
  return { success: !0, data: e.value };
418
- if (!r.common.issues.length)
410
+ if (!s.common.issues.length)
419
411
  throw new Error("Validation failed but no issues detected.");
420
412
  return {
421
413
  success: !1,
422
414
  get error() {
423
415
  if (this._error)
424
416
  return this._error;
425
- const t = new Z(r.common.issues);
417
+ const t = new O(s.common.issues);
426
418
  return this._error = t, this._error;
427
419
  }
428
420
  };
429
421
  };
430
- function v(r) {
431
- if (!r)
422
+ function _(s) {
423
+ if (!s)
432
424
  return {};
433
- const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
434
- if (e && (t || s))
425
+ const { errorMap: e, invalid_type_error: t, required_error: r, description: n } = s;
426
+ if (e && (t || r))
435
427
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
436
428
  return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
437
- var c, d;
438
- const { message: h } = r;
439
- return i.code === "invalid_enum_value" ? { message: h ?? o.defaultError } : typeof o.data > "u" ? { message: (c = h ?? s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = h ?? t) !== null && d !== void 0 ? d : o.defaultError };
429
+ const { message: c } = s;
430
+ return i.code === "invalid_enum_value" ? { message: c ?? o.defaultError } : typeof o.data > "u" ? { message: c ?? r ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: c ?? t ?? o.defaultError };
440
431
  }, description: n };
441
432
  }
442
- class g {
433
+ class v {
443
434
  get description() {
444
435
  return this._def.description;
445
436
  }
446
437
  _getType(e) {
447
- return $(e.data);
438
+ return V(e.data);
448
439
  }
449
440
  _getOrReturnCtx(e, t) {
450
441
  return t || {
451
442
  common: e.parent.common,
452
443
  data: e.data,
453
- parsedType: $(e.data),
444
+ parsedType: V(e.data),
454
445
  schemaErrorMap: this._def.errorMap,
455
446
  path: e.path,
456
447
  parent: e.parent
@@ -462,7 +453,7 @@ class g {
462
453
  ctx: {
463
454
  common: e.parent.common,
464
455
  data: e.data,
465
- parsedType: $(e.data),
456
+ parsedType: V(e.data),
466
457
  schemaErrorMap: this._def.errorMap,
467
458
  path: e.path,
468
459
  parent: e.parent
@@ -471,7 +462,7 @@ class g {
471
462
  }
472
463
  _parseSync(e) {
473
464
  const t = this._parse(e);
474
- if (oe(t))
465
+ if (fe(t))
475
466
  throw new Error("Synchronous parse encountered promise.");
476
467
  return t;
477
468
  }
@@ -480,30 +471,28 @@ class g {
480
471
  return Promise.resolve(t);
481
472
  }
482
473
  parse(e, t) {
483
- const s = this.safeParse(e, t);
484
- if (s.success)
485
- return s.data;
486
- throw s.error;
474
+ const r = this.safeParse(e, t);
475
+ if (r.success)
476
+ return r.data;
477
+ throw r.error;
487
478
  }
488
479
  safeParse(e, t) {
489
- var s;
490
- const n = {
480
+ const r = {
491
481
  common: {
492
482
  issues: [],
493
- async: (s = t == null ? void 0 : t.async) !== null && s !== void 0 ? s : !1,
494
- contextualErrorMap: t == null ? void 0 : t.errorMap
483
+ async: t?.async ?? !1,
484
+ contextualErrorMap: t?.errorMap
495
485
  },
496
- path: (t == null ? void 0 : t.path) || [],
486
+ path: t?.path || [],
497
487
  schemaErrorMap: this._def.errorMap,
498
488
  parent: null,
499
489
  data: e,
500
- parsedType: $(e)
501
- }, a = this._parseSync({ data: e, path: n.path, parent: n });
502
- return He(n, a);
490
+ parsedType: V(e)
491
+ }, n = this._parseSync({ data: e, path: r.path, parent: r });
492
+ return Ge(r, n);
503
493
  }
504
494
  "~validate"(e) {
505
- var t, s;
506
- const n = {
495
+ const t = {
507
496
  common: {
508
497
  issues: [],
509
498
  async: !!this["~standard"].async
@@ -512,66 +501,66 @@ class g {
512
501
  schemaErrorMap: this._def.errorMap,
513
502
  parent: null,
514
503
  data: e,
515
- parsedType: $(e)
504
+ parsedType: V(e)
516
505
  };
517
506
  if (!this["~standard"].async)
518
507
  try {
519
- const a = this._parseSync({ data: e, path: [], parent: n });
520
- return q(a) ? {
521
- value: a.value
508
+ const r = this._parseSync({ data: e, path: [], parent: t });
509
+ return K(r) ? {
510
+ value: r.value
522
511
  } : {
523
- issues: n.common.issues
512
+ issues: t.common.issues
524
513
  };
525
- } catch (a) {
526
- !((s = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || s === void 0) && s.includes("encountered") && (this["~standard"].async = !0), n.common = {
514
+ } catch (r) {
515
+ r?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), t.common = {
527
516
  issues: [],
528
517
  async: !0
529
518
  };
530
519
  }
531
- return this._parseAsync({ data: e, path: [], parent: n }).then((a) => q(a) ? {
532
- value: a.value
520
+ return this._parseAsync({ data: e, path: [], parent: t }).then((r) => K(r) ? {
521
+ value: r.value
533
522
  } : {
534
- issues: n.common.issues
523
+ issues: t.common.issues
535
524
  });
536
525
  }
537
526
  async parseAsync(e, t) {
538
- const s = await this.safeParseAsync(e, t);
539
- if (s.success)
540
- return s.data;
541
- throw s.error;
527
+ const r = await this.safeParseAsync(e, t);
528
+ if (r.success)
529
+ return r.data;
530
+ throw r.error;
542
531
  }
543
532
  async safeParseAsync(e, t) {
544
- const s = {
533
+ const r = {
545
534
  common: {
546
535
  issues: [],
547
- contextualErrorMap: t == null ? void 0 : t.errorMap,
536
+ contextualErrorMap: t?.errorMap,
548
537
  async: !0
549
538
  },
550
- path: (t == null ? void 0 : t.path) || [],
539
+ path: t?.path || [],
551
540
  schemaErrorMap: this._def.errorMap,
552
541
  parent: null,
553
542
  data: e,
554
- parsedType: $(e)
555
- }, n = this._parse({ data: e, path: s.path, parent: s }), a = await (oe(n) ? n : Promise.resolve(n));
556
- return He(s, a);
543
+ parsedType: V(e)
544
+ }, n = this._parse({ data: e, path: r.path, parent: r }), a = await (fe(n) ? n : Promise.resolve(n));
545
+ return Ge(r, a);
557
546
  }
558
547
  refine(e, t) {
559
- const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
548
+ const r = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
560
549
  return this._refinement((n, a) => {
561
550
  const i = e(n), o = () => a.addIssue({
562
- code: u.custom,
563
- ...s(n)
551
+ code: d.custom,
552
+ ...r(n)
564
553
  });
565
554
  return typeof Promise < "u" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
566
555
  });
567
556
  }
568
557
  refinement(e, t) {
569
- return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
558
+ return this._refinement((r, n) => e(r) ? !0 : (n.addIssue(typeof t == "function" ? t(r, n) : t), !1));
570
559
  }
571
560
  _refinement(e) {
572
- return new A({
561
+ return new N({
573
562
  schema: this,
574
- typeName: _.ZodEffects,
563
+ typeName: y.ZodEffects,
575
564
  effect: { type: "refinement", refinement: e }
576
565
  });
577
566
  }
@@ -586,57 +575,57 @@ class g {
586
575
  };
587
576
  }
588
577
  optional() {
589
- return E.create(this, this._def);
578
+ return I.create(this, this._def);
590
579
  }
591
580
  nullable() {
592
- return U.create(this, this._def);
581
+ return W.create(this, this._def);
593
582
  }
594
583
  nullish() {
595
584
  return this.nullable().optional();
596
585
  }
597
586
  array() {
598
- return j.create(this);
587
+ return E.create(this);
599
588
  }
600
589
  promise() {
601
- return te.create(this, this._def);
590
+ return ce.create(this, this._def);
602
591
  }
603
592
  or(e) {
604
- return le.create([this, e], this._def);
593
+ return ye.create([this, e], this._def);
605
594
  }
606
595
  and(e) {
607
- return fe.create(this, e, this._def);
596
+ return _e.create(this, e, this._def);
608
597
  }
609
598
  transform(e) {
610
- return new A({
611
- ...v(this._def),
599
+ return new N({
600
+ ..._(this._def),
612
601
  schema: this,
613
- typeName: _.ZodEffects,
602
+ typeName: y.ZodEffects,
614
603
  effect: { type: "transform", transform: e }
615
604
  });
616
605
  }
617
606
  default(e) {
618
607
  const t = typeof e == "function" ? e : () => e;
619
- return new ye({
620
- ...v(this._def),
608
+ return new ke({
609
+ ..._(this._def),
621
610
  innerType: this,
622
611
  defaultValue: t,
623
- typeName: _.ZodDefault
612
+ typeName: y.ZodDefault
624
613
  });
625
614
  }
626
615
  brand() {
627
- return new Je({
628
- typeName: _.ZodBranded,
616
+ return new Ye({
617
+ typeName: y.ZodBranded,
629
618
  type: this,
630
- ...v(this._def)
619
+ ..._(this._def)
631
620
  });
632
621
  }
633
622
  catch(e) {
634
623
  const t = typeof e == "function" ? e : () => e;
635
- return new ve({
636
- ...v(this._def),
624
+ return new we({
625
+ ..._(this._def),
637
626
  innerType: this,
638
627
  catchValue: t,
639
- typeName: _.ZodCatch
628
+ typeName: y.ZodCatch
640
629
  });
641
630
  }
642
631
  describe(e) {
@@ -647,10 +636,10 @@ class g {
647
636
  });
648
637
  }
649
638
  pipe(e) {
650
- return xe.create(this, e);
639
+ return Se.create(this, e);
651
640
  }
652
641
  readonly() {
653
- return ge.create(this);
642
+ return Te.create(this);
654
643
  }
655
644
  isOptional() {
656
645
  return this.safeParse(void 0).success;
@@ -659,251 +648,253 @@ class g {
659
648
  return this.safeParse(null).success;
660
649
  }
661
650
  }
662
- const vt = /^c[^\s-]{8,}$/i, gt = /^[0-9a-z]+$/, xt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, bt = /^[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, kt = /^[a-z0-9_-]{21}$/i, wt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Tt = /^[-+]?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)?)??$/, St = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ct = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
663
- let Le;
664
- const Zt = /^(?:(?: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])$/, Ot = /^(?:(?: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])$/, jt = /^(([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]))$/, At = /^(([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])$/, Et = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Rt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Qe = "((\\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])))", Nt = new RegExp(`^${Qe}$`);
665
- function et(r) {
651
+ const vt = /^c[^\s-]{8,}$/i, xt = /^[0-9a-z]+$/, bt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kt = /^[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, wt = /^[a-z0-9_-]{21}$/i, Tt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, St = /^[-+]?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)?)??$/, Ct = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ot = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
652
+ let Be;
653
+ const At = /^(?:(?: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])$/, Rt = /^(?:(?: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])$/, Et = /^(([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]))$/, Nt = /^(([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])$/, jt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, rt = "((\\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])))", It = new RegExp(`^${rt}$`);
654
+ function nt(s) {
666
655
  let e = "[0-5]\\d";
667
- r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
668
- const t = r.precision ? "+" : "?";
656
+ s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`);
657
+ const t = s.precision ? "+" : "?";
669
658
  return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
670
659
  }
671
- function It(r) {
672
- return new RegExp(`^${et(r)}$`);
660
+ function $t(s) {
661
+ return new RegExp(`^${nt(s)}$`);
673
662
  }
674
- function tt(r) {
675
- let e = `${Qe}T${et(r)}`;
663
+ function at(s) {
664
+ let e = `${rt}T${nt(s)}`;
676
665
  const t = [];
677
- return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
666
+ return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
678
667
  }
679
- function $t(r, e) {
680
- return !!((e === "v4" || !e) && Zt.test(r) || (e === "v6" || !e) && jt.test(r));
668
+ function Pt(s, e) {
669
+ return !!((e === "v4" || !e) && At.test(s) || (e === "v6" || !e) && Et.test(s));
681
670
  }
682
- function Pt(r, e) {
683
- if (!wt.test(r))
671
+ function Mt(s, e) {
672
+ if (!Tt.test(s))
684
673
  return !1;
685
674
  try {
686
- const [t] = r.split("."), s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(s));
687
- return !(typeof n != "object" || n === null || !n.typ || !n.alg || e && n.alg !== e);
675
+ const [t] = s.split(".");
676
+ if (!t)
677
+ return !1;
678
+ const r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(r));
679
+ return !(typeof n != "object" || n === null || "typ" in n && n?.typ !== "JWT" || !n.alg || e && n.alg !== e);
688
680
  } catch {
689
681
  return !1;
690
682
  }
691
683
  }
692
- function Mt(r, e) {
693
- return !!((e === "v4" || !e) && Ot.test(r) || (e === "v6" || !e) && At.test(r));
684
+ function Dt(s, e) {
685
+ return !!((e === "v4" || !e) && Rt.test(s) || (e === "v6" || !e) && Nt.test(s));
694
686
  }
695
- class O extends g {
687
+ class R extends v {
696
688
  _parse(e) {
697
689
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
698
690
  const a = this._getOrReturnCtx(e);
699
691
  return l(a, {
700
- code: u.invalid_type,
692
+ code: d.invalid_type,
701
693
  expected: f.string,
702
694
  received: a.parsedType
703
- }), y;
695
+ }), m;
704
696
  }
705
- const s = new T();
697
+ const r = new T();
706
698
  let n;
707
699
  for (const a of this._def.checks)
708
700
  if (a.kind === "min")
709
701
  e.data.length < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
710
- code: u.too_small,
702
+ code: d.too_small,
711
703
  minimum: a.value,
712
704
  type: "string",
713
705
  inclusive: !0,
714
706
  exact: !1,
715
707
  message: a.message
716
- }), s.dirty());
708
+ }), r.dirty());
717
709
  else if (a.kind === "max")
718
710
  e.data.length > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
719
- code: u.too_big,
711
+ code: d.too_big,
720
712
  maximum: a.value,
721
713
  type: "string",
722
714
  inclusive: !0,
723
715
  exact: !1,
724
716
  message: a.message
725
- }), s.dirty());
717
+ }), r.dirty());
726
718
  else if (a.kind === "length") {
727
719
  const i = e.data.length > a.value, o = e.data.length < a.value;
728
720
  (i || o) && (n = this._getOrReturnCtx(e, n), i ? l(n, {
729
- code: u.too_big,
721
+ code: d.too_big,
730
722
  maximum: a.value,
731
723
  type: "string",
732
724
  inclusive: !0,
733
725
  exact: !0,
734
726
  message: a.message
735
727
  }) : o && l(n, {
736
- code: u.too_small,
728
+ code: d.too_small,
737
729
  minimum: a.value,
738
730
  type: "string",
739
731
  inclusive: !0,
740
732
  exact: !0,
741
733
  message: a.message
742
- }), s.dirty());
734
+ }), r.dirty());
743
735
  } else if (a.kind === "email")
744
- St.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
736
+ Ct.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
745
737
  validation: "email",
746
- code: u.invalid_string,
738
+ code: d.invalid_string,
747
739
  message: a.message
748
- }), s.dirty());
740
+ }), r.dirty());
749
741
  else if (a.kind === "emoji")
750
- Le || (Le = new RegExp(Ct, "u")), Le.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
742
+ Be || (Be = new RegExp(Ot, "u")), Be.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
751
743
  validation: "emoji",
752
- code: u.invalid_string,
744
+ code: d.invalid_string,
753
745
  message: a.message
754
- }), s.dirty());
746
+ }), r.dirty());
755
747
  else if (a.kind === "uuid")
756
- bt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
748
+ kt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
757
749
  validation: "uuid",
758
- code: u.invalid_string,
750
+ code: d.invalid_string,
759
751
  message: a.message
760
- }), s.dirty());
752
+ }), r.dirty());
761
753
  else if (a.kind === "nanoid")
762
- kt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
754
+ wt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
763
755
  validation: "nanoid",
764
- code: u.invalid_string,
756
+ code: d.invalid_string,
765
757
  message: a.message
766
- }), s.dirty());
758
+ }), r.dirty());
767
759
  else if (a.kind === "cuid")
768
760
  vt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
769
761
  validation: "cuid",
770
- code: u.invalid_string,
762
+ code: d.invalid_string,
771
763
  message: a.message
772
- }), s.dirty());
764
+ }), r.dirty());
773
765
  else if (a.kind === "cuid2")
774
- gt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
766
+ xt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
775
767
  validation: "cuid2",
776
- code: u.invalid_string,
768
+ code: d.invalid_string,
777
769
  message: a.message
778
- }), s.dirty());
770
+ }), r.dirty());
779
771
  else if (a.kind === "ulid")
780
- xt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
772
+ bt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
781
773
  validation: "ulid",
782
- code: u.invalid_string,
774
+ code: d.invalid_string,
783
775
  message: a.message
784
- }), s.dirty());
776
+ }), r.dirty());
785
777
  else if (a.kind === "url")
786
778
  try {
787
779
  new URL(e.data);
788
780
  } catch {
789
781
  n = this._getOrReturnCtx(e, n), l(n, {
790
782
  validation: "url",
791
- code: u.invalid_string,
783
+ code: d.invalid_string,
792
784
  message: a.message
793
- }), s.dirty();
785
+ }), r.dirty();
794
786
  }
795
787
  else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
796
788
  validation: "regex",
797
- code: u.invalid_string,
789
+ code: d.invalid_string,
798
790
  message: a.message
799
- }), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), l(n, {
800
- code: u.invalid_string,
791
+ }), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), l(n, {
792
+ code: d.invalid_string,
801
793
  validation: { includes: a.value, position: a.position },
802
794
  message: a.message
803
- }), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
804
- code: u.invalid_string,
795
+ }), r.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
796
+ code: d.invalid_string,
805
797
  validation: { startsWith: a.value },
806
798
  message: a.message
807
- }), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
808
- code: u.invalid_string,
799
+ }), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
800
+ code: d.invalid_string,
809
801
  validation: { endsWith: a.value },
810
802
  message: a.message
811
- }), s.dirty()) : a.kind === "datetime" ? tt(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
812
- code: u.invalid_string,
803
+ }), r.dirty()) : a.kind === "datetime" ? at(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
804
+ code: d.invalid_string,
813
805
  validation: "datetime",
814
806
  message: a.message
815
- }), s.dirty()) : a.kind === "date" ? Nt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
816
- code: u.invalid_string,
807
+ }), r.dirty()) : a.kind === "date" ? It.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
808
+ code: d.invalid_string,
817
809
  validation: "date",
818
810
  message: a.message
819
- }), s.dirty()) : a.kind === "time" ? It(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
820
- code: u.invalid_string,
811
+ }), r.dirty()) : a.kind === "time" ? $t(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
812
+ code: d.invalid_string,
821
813
  validation: "time",
822
814
  message: a.message
823
- }), s.dirty()) : a.kind === "duration" ? Tt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
815
+ }), r.dirty()) : a.kind === "duration" ? St.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
824
816
  validation: "duration",
825
- code: u.invalid_string,
817
+ code: d.invalid_string,
826
818
  message: a.message
827
- }), s.dirty()) : a.kind === "ip" ? $t(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
819
+ }), r.dirty()) : a.kind === "ip" ? Pt(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
828
820
  validation: "ip",
829
- code: u.invalid_string,
821
+ code: d.invalid_string,
830
822
  message: a.message
831
- }), s.dirty()) : a.kind === "jwt" ? Pt(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), l(n, {
823
+ }), r.dirty()) : a.kind === "jwt" ? Mt(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), l(n, {
832
824
  validation: "jwt",
833
- code: u.invalid_string,
825
+ code: d.invalid_string,
834
826
  message: a.message
835
- }), s.dirty()) : a.kind === "cidr" ? Mt(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
827
+ }), r.dirty()) : a.kind === "cidr" ? Dt(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
836
828
  validation: "cidr",
837
- code: u.invalid_string,
829
+ code: d.invalid_string,
838
830
  message: a.message
839
- }), s.dirty()) : a.kind === "base64" ? Et.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
831
+ }), r.dirty()) : a.kind === "base64" ? jt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
840
832
  validation: "base64",
841
- code: u.invalid_string,
833
+ code: d.invalid_string,
842
834
  message: a.message
843
- }), s.dirty()) : a.kind === "base64url" ? Rt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
835
+ }), r.dirty()) : a.kind === "base64url" ? Zt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
844
836
  validation: "base64url",
845
- code: u.invalid_string,
837
+ code: d.invalid_string,
846
838
  message: a.message
847
- }), s.dirty()) : x.assertNever(a);
848
- return { status: s.value, value: e.data };
839
+ }), r.dirty()) : x.assertNever(a);
840
+ return { status: r.value, value: e.data };
849
841
  }
850
- _regex(e, t, s) {
842
+ _regex(e, t, r) {
851
843
  return this.refinement((n) => e.test(n), {
852
844
  validation: t,
853
- code: u.invalid_string,
854
- ...m.errToObj(s)
845
+ code: d.invalid_string,
846
+ ...h.errToObj(r)
855
847
  });
856
848
  }
857
849
  _addCheck(e) {
858
- return new O({
850
+ return new R({
859
851
  ...this._def,
860
852
  checks: [...this._def.checks, e]
861
853
  });
862
854
  }
863
855
  email(e) {
864
- return this._addCheck({ kind: "email", ...m.errToObj(e) });
856
+ return this._addCheck({ kind: "email", ...h.errToObj(e) });
865
857
  }
866
858
  url(e) {
867
- return this._addCheck({ kind: "url", ...m.errToObj(e) });
859
+ return this._addCheck({ kind: "url", ...h.errToObj(e) });
868
860
  }
869
861
  emoji(e) {
870
- return this._addCheck({ kind: "emoji", ...m.errToObj(e) });
862
+ return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
871
863
  }
872
864
  uuid(e) {
873
- return this._addCheck({ kind: "uuid", ...m.errToObj(e) });
865
+ return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
874
866
  }
875
867
  nanoid(e) {
876
- return this._addCheck({ kind: "nanoid", ...m.errToObj(e) });
868
+ return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
877
869
  }
878
870
  cuid(e) {
879
- return this._addCheck({ kind: "cuid", ...m.errToObj(e) });
871
+ return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
880
872
  }
881
873
  cuid2(e) {
882
- return this._addCheck({ kind: "cuid2", ...m.errToObj(e) });
874
+ return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
883
875
  }
884
876
  ulid(e) {
885
- return this._addCheck({ kind: "ulid", ...m.errToObj(e) });
877
+ return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
886
878
  }
887
879
  base64(e) {
888
- return this._addCheck({ kind: "base64", ...m.errToObj(e) });
880
+ return this._addCheck({ kind: "base64", ...h.errToObj(e) });
889
881
  }
890
882
  base64url(e) {
891
883
  return this._addCheck({
892
884
  kind: "base64url",
893
- ...m.errToObj(e)
885
+ ...h.errToObj(e)
894
886
  });
895
887
  }
896
888
  jwt(e) {
897
- return this._addCheck({ kind: "jwt", ...m.errToObj(e) });
889
+ return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
898
890
  }
899
891
  ip(e) {
900
- return this._addCheck({ kind: "ip", ...m.errToObj(e) });
892
+ return this._addCheck({ kind: "ip", ...h.errToObj(e) });
901
893
  }
902
894
  cidr(e) {
903
- return this._addCheck({ kind: "cidr", ...m.errToObj(e) });
895
+ return this._addCheck({ kind: "cidr", ...h.errToObj(e) });
904
896
  }
905
897
  datetime(e) {
906
- var t, s;
907
898
  return typeof e == "string" ? this._addCheck({
908
899
  kind: "datetime",
909
900
  precision: null,
@@ -912,10 +903,10 @@ class O extends g {
912
903
  message: e
913
904
  }) : this._addCheck({
914
905
  kind: "datetime",
915
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
916
- offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
917
- local: (s = e == null ? void 0 : e.local) !== null && s !== void 0 ? s : !1,
918
- ...m.errToObj(e == null ? void 0 : e.message)
906
+ precision: typeof e?.precision > "u" ? null : e?.precision,
907
+ offset: e?.offset ?? !1,
908
+ local: e?.local ?? !1,
909
+ ...h.errToObj(e?.message)
919
910
  });
920
911
  }
921
912
  date(e) {
@@ -928,83 +919,83 @@ class O extends g {
928
919
  message: e
929
920
  }) : this._addCheck({
930
921
  kind: "time",
931
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
932
- ...m.errToObj(e == null ? void 0 : e.message)
922
+ precision: typeof e?.precision > "u" ? null : e?.precision,
923
+ ...h.errToObj(e?.message)
933
924
  });
934
925
  }
935
926
  duration(e) {
936
- return this._addCheck({ kind: "duration", ...m.errToObj(e) });
927
+ return this._addCheck({ kind: "duration", ...h.errToObj(e) });
937
928
  }
938
929
  regex(e, t) {
939
930
  return this._addCheck({
940
931
  kind: "regex",
941
932
  regex: e,
942
- ...m.errToObj(t)
933
+ ...h.errToObj(t)
943
934
  });
944
935
  }
945
936
  includes(e, t) {
946
937
  return this._addCheck({
947
938
  kind: "includes",
948
939
  value: e,
949
- position: t == null ? void 0 : t.position,
950
- ...m.errToObj(t == null ? void 0 : t.message)
940
+ position: t?.position,
941
+ ...h.errToObj(t?.message)
951
942
  });
952
943
  }
953
944
  startsWith(e, t) {
954
945
  return this._addCheck({
955
946
  kind: "startsWith",
956
947
  value: e,
957
- ...m.errToObj(t)
948
+ ...h.errToObj(t)
958
949
  });
959
950
  }
960
951
  endsWith(e, t) {
961
952
  return this._addCheck({
962
953
  kind: "endsWith",
963
954
  value: e,
964
- ...m.errToObj(t)
955
+ ...h.errToObj(t)
965
956
  });
966
957
  }
967
958
  min(e, t) {
968
959
  return this._addCheck({
969
960
  kind: "min",
970
961
  value: e,
971
- ...m.errToObj(t)
962
+ ...h.errToObj(t)
972
963
  });
973
964
  }
974
965
  max(e, t) {
975
966
  return this._addCheck({
976
967
  kind: "max",
977
968
  value: e,
978
- ...m.errToObj(t)
969
+ ...h.errToObj(t)
979
970
  });
980
971
  }
981
972
  length(e, t) {
982
973
  return this._addCheck({
983
974
  kind: "length",
984
975
  value: e,
985
- ...m.errToObj(t)
976
+ ...h.errToObj(t)
986
977
  });
987
978
  }
988
979
  /**
989
980
  * Equivalent to `.min(1)`
990
981
  */
991
982
  nonempty(e) {
992
- return this.min(1, m.errToObj(e));
983
+ return this.min(1, h.errToObj(e));
993
984
  }
994
985
  trim() {
995
- return new O({
986
+ return new R({
996
987
  ...this._def,
997
988
  checks: [...this._def.checks, { kind: "trim" }]
998
989
  });
999
990
  }
1000
991
  toLowerCase() {
1001
- return new O({
992
+ return new R({
1002
993
  ...this._def,
1003
994
  checks: [...this._def.checks, { kind: "toLowerCase" }]
1004
995
  });
1005
996
  }
1006
997
  toUpperCase() {
1007
- return new O({
998
+ return new R({
1008
999
  ...this._def,
1009
1000
  checks: [...this._def.checks, { kind: "toUpperCase" }]
1010
1001
  });
@@ -1070,20 +1061,17 @@ class O extends g {
1070
1061
  return e;
1071
1062
  }
1072
1063
  }
1073
- O.create = (r) => {
1074
- var e;
1075
- return new O({
1076
- checks: [],
1077
- typeName: _.ZodString,
1078
- coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1079
- ...v(r)
1080
- });
1081
- };
1082
- function Dt(r, e) {
1083
- const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
1084
- return a % i / Math.pow(10, n);
1064
+ R.create = (s) => new R({
1065
+ checks: [],
1066
+ typeName: y.ZodString,
1067
+ coerce: s?.coerce ?? !1,
1068
+ ..._(s)
1069
+ });
1070
+ function Lt(s, e) {
1071
+ const t = (s.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, n = t > r ? t : r, a = Number.parseInt(s.toFixed(n).replace(".", "")), i = Number.parseInt(e.toFixed(n).replace(".", ""));
1072
+ return a % i / 10 ** n;
1085
1073
  }
1086
- class V extends g {
1074
+ class U extends v {
1087
1075
  constructor() {
1088
1076
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1089
1077
  }
@@ -1091,71 +1079,71 @@ class V extends g {
1091
1079
  if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
1092
1080
  const a = this._getOrReturnCtx(e);
1093
1081
  return l(a, {
1094
- code: u.invalid_type,
1082
+ code: d.invalid_type,
1095
1083
  expected: f.number,
1096
1084
  received: a.parsedType
1097
- }), y;
1085
+ }), m;
1098
1086
  }
1099
- let s;
1087
+ let r;
1100
1088
  const n = new T();
1101
1089
  for (const a of this._def.checks)
1102
- a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1103
- code: u.invalid_type,
1090
+ a.kind === "int" ? x.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1091
+ code: d.invalid_type,
1104
1092
  expected: "integer",
1105
1093
  received: "float",
1106
1094
  message: a.message
1107
- }), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1108
- code: u.too_small,
1095
+ }), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1096
+ code: d.too_small,
1109
1097
  minimum: a.value,
1110
1098
  type: "number",
1111
1099
  inclusive: a.inclusive,
1112
1100
  exact: !1,
1113
1101
  message: a.message
1114
- }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1115
- code: u.too_big,
1102
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1103
+ code: d.too_big,
1116
1104
  maximum: a.value,
1117
1105
  type: "number",
1118
1106
  inclusive: a.inclusive,
1119
1107
  exact: !1,
1120
1108
  message: a.message
1121
- }), n.dirty()) : a.kind === "multipleOf" ? Dt(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
1122
- code: u.not_multiple_of,
1109
+ }), n.dirty()) : a.kind === "multipleOf" ? Lt(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), l(r, {
1110
+ code: d.not_multiple_of,
1123
1111
  multipleOf: a.value,
1124
1112
  message: a.message
1125
- }), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1126
- code: u.not_finite,
1113
+ }), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1114
+ code: d.not_finite,
1127
1115
  message: a.message
1128
1116
  }), n.dirty()) : x.assertNever(a);
1129
1117
  return { status: n.value, value: e.data };
1130
1118
  }
1131
1119
  gte(e, t) {
1132
- return this.setLimit("min", e, !0, m.toString(t));
1120
+ return this.setLimit("min", e, !0, h.toString(t));
1133
1121
  }
1134
1122
  gt(e, t) {
1135
- return this.setLimit("min", e, !1, m.toString(t));
1123
+ return this.setLimit("min", e, !1, h.toString(t));
1136
1124
  }
1137
1125
  lte(e, t) {
1138
- return this.setLimit("max", e, !0, m.toString(t));
1126
+ return this.setLimit("max", e, !0, h.toString(t));
1139
1127
  }
1140
1128
  lt(e, t) {
1141
- return this.setLimit("max", e, !1, m.toString(t));
1129
+ return this.setLimit("max", e, !1, h.toString(t));
1142
1130
  }
1143
- setLimit(e, t, s, n) {
1144
- return new V({
1131
+ setLimit(e, t, r, n) {
1132
+ return new U({
1145
1133
  ...this._def,
1146
1134
  checks: [
1147
1135
  ...this._def.checks,
1148
1136
  {
1149
1137
  kind: e,
1150
1138
  value: t,
1151
- inclusive: s,
1152
- message: m.toString(n)
1139
+ inclusive: r,
1140
+ message: h.toString(n)
1153
1141
  }
1154
1142
  ]
1155
1143
  });
1156
1144
  }
1157
1145
  _addCheck(e) {
1158
- return new V({
1146
+ return new U({
1159
1147
  ...this._def,
1160
1148
  checks: [...this._def.checks, e]
1161
1149
  });
@@ -1163,7 +1151,7 @@ class V extends g {
1163
1151
  int(e) {
1164
1152
  return this._addCheck({
1165
1153
  kind: "int",
1166
- message: m.toString(e)
1154
+ message: h.toString(e)
1167
1155
  });
1168
1156
  }
1169
1157
  positive(e) {
@@ -1171,7 +1159,7 @@ class V extends g {
1171
1159
  kind: "min",
1172
1160
  value: 0,
1173
1161
  inclusive: !1,
1174
- message: m.toString(e)
1162
+ message: h.toString(e)
1175
1163
  });
1176
1164
  }
1177
1165
  negative(e) {
@@ -1179,7 +1167,7 @@ class V extends g {
1179
1167
  kind: "max",
1180
1168
  value: 0,
1181
1169
  inclusive: !1,
1182
- message: m.toString(e)
1170
+ message: h.toString(e)
1183
1171
  });
1184
1172
  }
1185
1173
  nonpositive(e) {
@@ -1187,7 +1175,7 @@ class V extends g {
1187
1175
  kind: "max",
1188
1176
  value: 0,
1189
1177
  inclusive: !0,
1190
- message: m.toString(e)
1178
+ message: h.toString(e)
1191
1179
  });
1192
1180
  }
1193
1181
  nonnegative(e) {
@@ -1195,20 +1183,20 @@ class V extends g {
1195
1183
  kind: "min",
1196
1184
  value: 0,
1197
1185
  inclusive: !0,
1198
- message: m.toString(e)
1186
+ message: h.toString(e)
1199
1187
  });
1200
1188
  }
1201
1189
  multipleOf(e, t) {
1202
1190
  return this._addCheck({
1203
1191
  kind: "multipleOf",
1204
1192
  value: e,
1205
- message: m.toString(t)
1193
+ message: h.toString(t)
1206
1194
  });
1207
1195
  }
1208
1196
  finite(e) {
1209
1197
  return this._addCheck({
1210
1198
  kind: "finite",
1211
- message: m.toString(e)
1199
+ message: h.toString(e)
1212
1200
  });
1213
1201
  }
1214
1202
  safe(e) {
@@ -1216,12 +1204,12 @@ class V extends g {
1216
1204
  kind: "min",
1217
1205
  inclusive: !0,
1218
1206
  value: Number.MIN_SAFE_INTEGER,
1219
- message: m.toString(e)
1207
+ message: h.toString(e)
1220
1208
  })._addCheck({
1221
1209
  kind: "max",
1222
1210
  inclusive: !0,
1223
1211
  value: Number.MAX_SAFE_INTEGER,
1224
- message: m.toString(e)
1212
+ message: h.toString(e)
1225
1213
  });
1226
1214
  }
1227
1215
  get minValue() {
@@ -1241,21 +1229,21 @@ class V extends g {
1241
1229
  }
1242
1230
  get isFinite() {
1243
1231
  let e = null, t = null;
1244
- for (const s of this._def.checks) {
1245
- if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
1232
+ for (const r of this._def.checks) {
1233
+ if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
1246
1234
  return !0;
1247
- s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1235
+ r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
1248
1236
  }
1249
1237
  return Number.isFinite(t) && Number.isFinite(e);
1250
1238
  }
1251
1239
  }
1252
- V.create = (r) => new V({
1240
+ U.create = (s) => new U({
1253
1241
  checks: [],
1254
- typeName: _.ZodNumber,
1255
- coerce: (r == null ? void 0 : r.coerce) || !1,
1256
- ...v(r)
1242
+ typeName: y.ZodNumber,
1243
+ coerce: s?.coerce || !1,
1244
+ ..._(s)
1257
1245
  });
1258
- class L extends g {
1246
+ class q extends v {
1259
1247
  constructor() {
1260
1248
  super(...arguments), this.min = this.gte, this.max = this.lte;
1261
1249
  }
@@ -1268,23 +1256,23 @@ class L extends g {
1268
1256
  }
1269
1257
  if (this._getType(e) !== f.bigint)
1270
1258
  return this._getInvalidInput(e);
1271
- let s;
1259
+ let r;
1272
1260
  const n = new T();
1273
1261
  for (const a of this._def.checks)
1274
- a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1275
- code: u.too_small,
1262
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1263
+ code: d.too_small,
1276
1264
  type: "bigint",
1277
1265
  minimum: a.value,
1278
1266
  inclusive: a.inclusive,
1279
1267
  message: a.message
1280
- }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1281
- code: u.too_big,
1268
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1269
+ code: d.too_big,
1282
1270
  type: "bigint",
1283
1271
  maximum: a.value,
1284
1272
  inclusive: a.inclusive,
1285
1273
  message: a.message
1286
- }), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), l(s, {
1287
- code: u.not_multiple_of,
1274
+ }), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), l(r, {
1275
+ code: d.not_multiple_of,
1288
1276
  multipleOf: a.value,
1289
1277
  message: a.message
1290
1278
  }), n.dirty()) : x.assertNever(a);
@@ -1293,39 +1281,39 @@ class L extends g {
1293
1281
  _getInvalidInput(e) {
1294
1282
  const t = this._getOrReturnCtx(e);
1295
1283
  return l(t, {
1296
- code: u.invalid_type,
1284
+ code: d.invalid_type,
1297
1285
  expected: f.bigint,
1298
1286
  received: t.parsedType
1299
- }), y;
1287
+ }), m;
1300
1288
  }
1301
1289
  gte(e, t) {
1302
- return this.setLimit("min", e, !0, m.toString(t));
1290
+ return this.setLimit("min", e, !0, h.toString(t));
1303
1291
  }
1304
1292
  gt(e, t) {
1305
- return this.setLimit("min", e, !1, m.toString(t));
1293
+ return this.setLimit("min", e, !1, h.toString(t));
1306
1294
  }
1307
1295
  lte(e, t) {
1308
- return this.setLimit("max", e, !0, m.toString(t));
1296
+ return this.setLimit("max", e, !0, h.toString(t));
1309
1297
  }
1310
1298
  lt(e, t) {
1311
- return this.setLimit("max", e, !1, m.toString(t));
1299
+ return this.setLimit("max", e, !1, h.toString(t));
1312
1300
  }
1313
- setLimit(e, t, s, n) {
1314
- return new L({
1301
+ setLimit(e, t, r, n) {
1302
+ return new q({
1315
1303
  ...this._def,
1316
1304
  checks: [
1317
1305
  ...this._def.checks,
1318
1306
  {
1319
1307
  kind: e,
1320
1308
  value: t,
1321
- inclusive: s,
1322
- message: m.toString(n)
1309
+ inclusive: r,
1310
+ message: h.toString(n)
1323
1311
  }
1324
1312
  ]
1325
1313
  });
1326
1314
  }
1327
1315
  _addCheck(e) {
1328
- return new L({
1316
+ return new q({
1329
1317
  ...this._def,
1330
1318
  checks: [...this._def.checks, e]
1331
1319
  });
@@ -1335,7 +1323,7 @@ class L extends g {
1335
1323
  kind: "min",
1336
1324
  value: BigInt(0),
1337
1325
  inclusive: !1,
1338
- message: m.toString(e)
1326
+ message: h.toString(e)
1339
1327
  });
1340
1328
  }
1341
1329
  negative(e) {
@@ -1343,7 +1331,7 @@ class L extends g {
1343
1331
  kind: "max",
1344
1332
  value: BigInt(0),
1345
1333
  inclusive: !1,
1346
- message: m.toString(e)
1334
+ message: h.toString(e)
1347
1335
  });
1348
1336
  }
1349
1337
  nonpositive(e) {
@@ -1351,7 +1339,7 @@ class L extends g {
1351
1339
  kind: "max",
1352
1340
  value: BigInt(0),
1353
1341
  inclusive: !0,
1354
- message: m.toString(e)
1342
+ message: h.toString(e)
1355
1343
  });
1356
1344
  }
1357
1345
  nonnegative(e) {
@@ -1359,14 +1347,14 @@ class L extends g {
1359
1347
  kind: "min",
1360
1348
  value: BigInt(0),
1361
1349
  inclusive: !0,
1362
- message: m.toString(e)
1350
+ message: h.toString(e)
1363
1351
  });
1364
1352
  }
1365
1353
  multipleOf(e, t) {
1366
1354
  return this._addCheck({
1367
1355
  kind: "multipleOf",
1368
1356
  value: e,
1369
- message: m.toString(t)
1357
+ message: h.toString(t)
1370
1358
  });
1371
1359
  }
1372
1360
  get minValue() {
@@ -1382,74 +1370,71 @@ class L extends g {
1382
1370
  return e;
1383
1371
  }
1384
1372
  }
1385
- L.create = (r) => {
1386
- var e;
1387
- return new L({
1388
- checks: [],
1389
- typeName: _.ZodBigInt,
1390
- coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1391
- ...v(r)
1392
- });
1393
- };
1394
- class ce extends g {
1373
+ q.create = (s) => new q({
1374
+ checks: [],
1375
+ typeName: y.ZodBigInt,
1376
+ coerce: s?.coerce ?? !1,
1377
+ ..._(s)
1378
+ });
1379
+ class he extends v {
1395
1380
  _parse(e) {
1396
1381
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1397
- const s = this._getOrReturnCtx(e);
1398
- return l(s, {
1399
- code: u.invalid_type,
1382
+ const r = this._getOrReturnCtx(e);
1383
+ return l(r, {
1384
+ code: d.invalid_type,
1400
1385
  expected: f.boolean,
1401
- received: s.parsedType
1402
- }), y;
1386
+ received: r.parsedType
1387
+ }), m;
1403
1388
  }
1404
1389
  return S(e.data);
1405
1390
  }
1406
1391
  }
1407
- ce.create = (r) => new ce({
1408
- typeName: _.ZodBoolean,
1409
- coerce: (r == null ? void 0 : r.coerce) || !1,
1410
- ...v(r)
1392
+ he.create = (s) => new he({
1393
+ typeName: y.ZodBoolean,
1394
+ coerce: s?.coerce || !1,
1395
+ ..._(s)
1411
1396
  });
1412
- class W extends g {
1397
+ class G extends v {
1413
1398
  _parse(e) {
1414
1399
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1415
1400
  const a = this._getOrReturnCtx(e);
1416
1401
  return l(a, {
1417
- code: u.invalid_type,
1402
+ code: d.invalid_type,
1418
1403
  expected: f.date,
1419
1404
  received: a.parsedType
1420
- }), y;
1405
+ }), m;
1421
1406
  }
1422
- if (isNaN(e.data.getTime())) {
1407
+ if (Number.isNaN(e.data.getTime())) {
1423
1408
  const a = this._getOrReturnCtx(e);
1424
1409
  return l(a, {
1425
- code: u.invalid_date
1426
- }), y;
1410
+ code: d.invalid_date
1411
+ }), m;
1427
1412
  }
1428
- const s = new T();
1413
+ const r = new T();
1429
1414
  let n;
1430
1415
  for (const a of this._def.checks)
1431
1416
  a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
1432
- code: u.too_small,
1417
+ code: d.too_small,
1433
1418
  message: a.message,
1434
1419
  inclusive: !0,
1435
1420
  exact: !1,
1436
1421
  minimum: a.value,
1437
1422
  type: "date"
1438
- }), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
1439
- code: u.too_big,
1423
+ }), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
1424
+ code: d.too_big,
1440
1425
  message: a.message,
1441
1426
  inclusive: !0,
1442
1427
  exact: !1,
1443
1428
  maximum: a.value,
1444
1429
  type: "date"
1445
- }), s.dirty()) : x.assertNever(a);
1430
+ }), r.dirty()) : x.assertNever(a);
1446
1431
  return {
1447
- status: s.value,
1432
+ status: r.value,
1448
1433
  value: new Date(e.data.getTime())
1449
1434
  };
1450
1435
  }
1451
1436
  _addCheck(e) {
1452
- return new W({
1437
+ return new G({
1453
1438
  ...this._def,
1454
1439
  checks: [...this._def.checks, e]
1455
1440
  });
@@ -1458,14 +1443,14 @@ class W extends g {
1458
1443
  return this._addCheck({
1459
1444
  kind: "min",
1460
1445
  value: e.getTime(),
1461
- message: m.toString(t)
1446
+ message: h.toString(t)
1462
1447
  });
1463
1448
  }
1464
1449
  max(e, t) {
1465
1450
  return this._addCheck({
1466
1451
  kind: "max",
1467
1452
  value: e.getTime(),
1468
- message: m.toString(t)
1453
+ message: h.toString(t)
1469
1454
  });
1470
1455
  }
1471
1456
  get minDate() {
@@ -1481,64 +1466,64 @@ class W extends g {
1481
1466
  return e != null ? new Date(e) : null;
1482
1467
  }
1483
1468
  }
1484
- W.create = (r) => new W({
1469
+ G.create = (s) => new G({
1485
1470
  checks: [],
1486
- coerce: (r == null ? void 0 : r.coerce) || !1,
1487
- typeName: _.ZodDate,
1488
- ...v(r)
1471
+ coerce: s?.coerce || !1,
1472
+ typeName: y.ZodDate,
1473
+ ..._(s)
1489
1474
  });
1490
- class Ce extends g {
1475
+ class Re extends v {
1491
1476
  _parse(e) {
1492
1477
  if (this._getType(e) !== f.symbol) {
1493
- const s = this._getOrReturnCtx(e);
1494
- return l(s, {
1495
- code: u.invalid_type,
1478
+ const r = this._getOrReturnCtx(e);
1479
+ return l(r, {
1480
+ code: d.invalid_type,
1496
1481
  expected: f.symbol,
1497
- received: s.parsedType
1498
- }), y;
1482
+ received: r.parsedType
1483
+ }), m;
1499
1484
  }
1500
1485
  return S(e.data);
1501
1486
  }
1502
1487
  }
1503
- Ce.create = (r) => new Ce({
1504
- typeName: _.ZodSymbol,
1505
- ...v(r)
1488
+ Re.create = (s) => new Re({
1489
+ typeName: y.ZodSymbol,
1490
+ ..._(s)
1506
1491
  });
1507
- class de extends g {
1492
+ class pe extends v {
1508
1493
  _parse(e) {
1509
1494
  if (this._getType(e) !== f.undefined) {
1510
- const s = this._getOrReturnCtx(e);
1511
- return l(s, {
1512
- code: u.invalid_type,
1495
+ const r = this._getOrReturnCtx(e);
1496
+ return l(r, {
1497
+ code: d.invalid_type,
1513
1498
  expected: f.undefined,
1514
- received: s.parsedType
1515
- }), y;
1499
+ received: r.parsedType
1500
+ }), m;
1516
1501
  }
1517
1502
  return S(e.data);
1518
1503
  }
1519
1504
  }
1520
- de.create = (r) => new de({
1521
- typeName: _.ZodUndefined,
1522
- ...v(r)
1505
+ pe.create = (s) => new pe({
1506
+ typeName: y.ZodUndefined,
1507
+ ..._(s)
1523
1508
  });
1524
- class ue extends g {
1509
+ class me extends v {
1525
1510
  _parse(e) {
1526
1511
  if (this._getType(e) !== f.null) {
1527
- const s = this._getOrReturnCtx(e);
1528
- return l(s, {
1529
- code: u.invalid_type,
1512
+ const r = this._getOrReturnCtx(e);
1513
+ return l(r, {
1514
+ code: d.invalid_type,
1530
1515
  expected: f.null,
1531
- received: s.parsedType
1532
- }), y;
1516
+ received: r.parsedType
1517
+ }), m;
1533
1518
  }
1534
1519
  return S(e.data);
1535
1520
  }
1536
1521
  }
1537
- ue.create = (r) => new ue({
1538
- typeName: _.ZodNull,
1539
- ...v(r)
1522
+ me.create = (s) => new me({
1523
+ typeName: y.ZodNull,
1524
+ ..._(s)
1540
1525
  });
1541
- class ee extends g {
1526
+ class oe extends v {
1542
1527
  constructor() {
1543
1528
  super(...arguments), this._any = !0;
1544
1529
  }
@@ -1546,11 +1531,11 @@ class ee extends g {
1546
1531
  return S(e.data);
1547
1532
  }
1548
1533
  }
1549
- ee.create = (r) => new ee({
1550
- typeName: _.ZodAny,
1551
- ...v(r)
1534
+ oe.create = (s) => new oe({
1535
+ typeName: y.ZodAny,
1536
+ ..._(s)
1552
1537
  });
1553
- class F extends g {
1538
+ class Y extends v {
1554
1539
  constructor() {
1555
1540
  super(...arguments), this._unknown = !0;
1556
1541
  }
@@ -1558,131 +1543,131 @@ class F extends g {
1558
1543
  return S(e.data);
1559
1544
  }
1560
1545
  }
1561
- F.create = (r) => new F({
1562
- typeName: _.ZodUnknown,
1563
- ...v(r)
1546
+ Y.create = (s) => new Y({
1547
+ typeName: y.ZodUnknown,
1548
+ ..._(s)
1564
1549
  });
1565
- class P extends g {
1550
+ class z extends v {
1566
1551
  _parse(e) {
1567
1552
  const t = this._getOrReturnCtx(e);
1568
1553
  return l(t, {
1569
- code: u.invalid_type,
1554
+ code: d.invalid_type,
1570
1555
  expected: f.never,
1571
1556
  received: t.parsedType
1572
- }), y;
1557
+ }), m;
1573
1558
  }
1574
1559
  }
1575
- P.create = (r) => new P({
1576
- typeName: _.ZodNever,
1577
- ...v(r)
1560
+ z.create = (s) => new z({
1561
+ typeName: y.ZodNever,
1562
+ ..._(s)
1578
1563
  });
1579
- class Ze extends g {
1564
+ class Ee extends v {
1580
1565
  _parse(e) {
1581
1566
  if (this._getType(e) !== f.undefined) {
1582
- const s = this._getOrReturnCtx(e);
1583
- return l(s, {
1584
- code: u.invalid_type,
1567
+ const r = this._getOrReturnCtx(e);
1568
+ return l(r, {
1569
+ code: d.invalid_type,
1585
1570
  expected: f.void,
1586
- received: s.parsedType
1587
- }), y;
1571
+ received: r.parsedType
1572
+ }), m;
1588
1573
  }
1589
1574
  return S(e.data);
1590
1575
  }
1591
1576
  }
1592
- Ze.create = (r) => new Ze({
1593
- typeName: _.ZodVoid,
1594
- ...v(r)
1577
+ Ee.create = (s) => new Ee({
1578
+ typeName: y.ZodVoid,
1579
+ ..._(s)
1595
1580
  });
1596
- class j extends g {
1581
+ class E extends v {
1597
1582
  _parse(e) {
1598
- const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
1583
+ const { ctx: t, status: r } = this._processInputParams(e), n = this._def;
1599
1584
  if (t.parsedType !== f.array)
1600
1585
  return l(t, {
1601
- code: u.invalid_type,
1586
+ code: d.invalid_type,
1602
1587
  expected: f.array,
1603
1588
  received: t.parsedType
1604
- }), y;
1589
+ }), m;
1605
1590
  if (n.exactLength !== null) {
1606
1591
  const i = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
1607
1592
  (i || o) && (l(t, {
1608
- code: i ? u.too_big : u.too_small,
1593
+ code: i ? d.too_big : d.too_small,
1609
1594
  minimum: o ? n.exactLength.value : void 0,
1610
1595
  maximum: i ? n.exactLength.value : void 0,
1611
1596
  type: "array",
1612
1597
  inclusive: !0,
1613
1598
  exact: !0,
1614
1599
  message: n.exactLength.message
1615
- }), s.dirty());
1600
+ }), r.dirty());
1616
1601
  }
1617
1602
  if (n.minLength !== null && t.data.length < n.minLength.value && (l(t, {
1618
- code: u.too_small,
1603
+ code: d.too_small,
1619
1604
  minimum: n.minLength.value,
1620
1605
  type: "array",
1621
1606
  inclusive: !0,
1622
1607
  exact: !1,
1623
1608
  message: n.minLength.message
1624
- }), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (l(t, {
1625
- code: u.too_big,
1609
+ }), r.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (l(t, {
1610
+ code: d.too_big,
1626
1611
  maximum: n.maxLength.value,
1627
1612
  type: "array",
1628
1613
  inclusive: !0,
1629
1614
  exact: !1,
1630
1615
  message: n.maxLength.message
1631
- }), s.dirty()), t.common.async)
1632
- return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new R(t, i, t.path, o)))).then((i) => T.mergeArray(s, i));
1633
- const a = [...t.data].map((i, o) => n.type._parseSync(new R(t, i, t.path, o)));
1634
- return T.mergeArray(s, a);
1616
+ }), r.dirty()), t.common.async)
1617
+ return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new $(t, i, t.path, o)))).then((i) => T.mergeArray(r, i));
1618
+ const a = [...t.data].map((i, o) => n.type._parseSync(new $(t, i, t.path, o)));
1619
+ return T.mergeArray(r, a);
1635
1620
  }
1636
1621
  get element() {
1637
1622
  return this._def.type;
1638
1623
  }
1639
1624
  min(e, t) {
1640
- return new j({
1625
+ return new E({
1641
1626
  ...this._def,
1642
- minLength: { value: e, message: m.toString(t) }
1627
+ minLength: { value: e, message: h.toString(t) }
1643
1628
  });
1644
1629
  }
1645
1630
  max(e, t) {
1646
- return new j({
1631
+ return new E({
1647
1632
  ...this._def,
1648
- maxLength: { value: e, message: m.toString(t) }
1633
+ maxLength: { value: e, message: h.toString(t) }
1649
1634
  });
1650
1635
  }
1651
1636
  length(e, t) {
1652
- return new j({
1637
+ return new E({
1653
1638
  ...this._def,
1654
- exactLength: { value: e, message: m.toString(t) }
1639
+ exactLength: { value: e, message: h.toString(t) }
1655
1640
  });
1656
1641
  }
1657
1642
  nonempty(e) {
1658
1643
  return this.min(1, e);
1659
1644
  }
1660
1645
  }
1661
- j.create = (r, e) => new j({
1662
- type: r,
1646
+ E.create = (s, e) => new E({
1647
+ type: s,
1663
1648
  minLength: null,
1664
1649
  maxLength: null,
1665
1650
  exactLength: null,
1666
- typeName: _.ZodArray,
1667
- ...v(e)
1651
+ typeName: y.ZodArray,
1652
+ ..._(e)
1668
1653
  });
1669
- function G(r) {
1670
- if (r instanceof k) {
1654
+ function re(s) {
1655
+ if (s instanceof k) {
1671
1656
  const e = {};
1672
- for (const t in r.shape) {
1673
- const s = r.shape[t];
1674
- e[t] = E.create(G(s));
1657
+ for (const t in s.shape) {
1658
+ const r = s.shape[t];
1659
+ e[t] = I.create(re(r));
1675
1660
  }
1676
1661
  return new k({
1677
- ...r._def,
1662
+ ...s._def,
1678
1663
  shape: () => e
1679
1664
  });
1680
- } else return r instanceof j ? new j({
1681
- ...r._def,
1682
- type: G(r.element)
1683
- }) : r instanceof E ? E.create(G(r.unwrap())) : r instanceof U ? U.create(G(r.unwrap())) : r instanceof N ? N.create(r.items.map((e) => G(e))) : r;
1665
+ } else return s instanceof E ? new E({
1666
+ ...s._def,
1667
+ type: re(s.element)
1668
+ }) : s instanceof I ? I.create(re(s.unwrap())) : s instanceof W ? W.create(re(s.unwrap())) : s instanceof P ? P.create(s.items.map((e) => re(e))) : s;
1684
1669
  }
1685
- class k extends g {
1670
+ class k extends v {
1686
1671
  constructor() {
1687
1672
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1688
1673
  }
@@ -1690,86 +1675,85 @@ class k extends g {
1690
1675
  if (this._cached !== null)
1691
1676
  return this._cached;
1692
1677
  const e = this._def.shape(), t = x.objectKeys(e);
1693
- return this._cached = { shape: e, keys: t };
1678
+ return this._cached = { shape: e, keys: t }, this._cached;
1694
1679
  }
1695
1680
  _parse(e) {
1696
1681
  if (this._getType(e) !== f.object) {
1697
- const d = this._getOrReturnCtx(e);
1698
- return l(d, {
1699
- code: u.invalid_type,
1682
+ const u = this._getOrReturnCtx(e);
1683
+ return l(u, {
1684
+ code: d.invalid_type,
1700
1685
  expected: f.object,
1701
- received: d.parsedType
1702
- }), y;
1686
+ received: u.parsedType
1687
+ }), m;
1703
1688
  }
1704
- const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1705
- if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
1706
- for (const d in n.data)
1707
- i.includes(d) || o.push(d);
1689
+ const { status: r, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1690
+ if (!(this._def.catchall instanceof z && this._def.unknownKeys === "strip"))
1691
+ for (const u in n.data)
1692
+ i.includes(u) || o.push(u);
1708
1693
  const c = [];
1709
- for (const d of i) {
1710
- const h = a[d], b = n.data[d];
1694
+ for (const u of i) {
1695
+ const p = a[u], b = n.data[u];
1711
1696
  c.push({
1712
- key: { status: "valid", value: d },
1713
- value: h._parse(new R(n, b, n.path, d)),
1714
- alwaysSet: d in n.data
1697
+ key: { status: "valid", value: u },
1698
+ value: p._parse(new $(n, b, n.path, u)),
1699
+ alwaysSet: u in n.data
1715
1700
  });
1716
1701
  }
1717
- if (this._def.catchall instanceof P) {
1718
- const d = this._def.unknownKeys;
1719
- if (d === "passthrough")
1720
- for (const h of o)
1702
+ if (this._def.catchall instanceof z) {
1703
+ const u = this._def.unknownKeys;
1704
+ if (u === "passthrough")
1705
+ for (const p of o)
1721
1706
  c.push({
1722
- key: { status: "valid", value: h },
1723
- value: { status: "valid", value: n.data[h] }
1707
+ key: { status: "valid", value: p },
1708
+ value: { status: "valid", value: n.data[p] }
1724
1709
  });
1725
- else if (d === "strict")
1710
+ else if (u === "strict")
1726
1711
  o.length > 0 && (l(n, {
1727
- code: u.unrecognized_keys,
1712
+ code: d.unrecognized_keys,
1728
1713
  keys: o
1729
- }), s.dirty());
1730
- else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1714
+ }), r.dirty());
1715
+ else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1731
1716
  } else {
1732
- const d = this._def.catchall;
1733
- for (const h of o) {
1734
- const b = n.data[h];
1717
+ const u = this._def.catchall;
1718
+ for (const p of o) {
1719
+ const b = n.data[p];
1735
1720
  c.push({
1736
- key: { status: "valid", value: h },
1737
- value: d._parse(
1738
- new R(n, b, n.path, h)
1721
+ key: { status: "valid", value: p },
1722
+ value: u._parse(
1723
+ new $(n, b, n.path, p)
1739
1724
  //, ctx.child(key), value, getParsedType(value)
1740
1725
  ),
1741
- alwaysSet: h in n.data
1726
+ alwaysSet: p in n.data
1742
1727
  });
1743
1728
  }
1744
1729
  }
1745
1730
  return n.common.async ? Promise.resolve().then(async () => {
1746
- const d = [];
1747
- for (const h of c) {
1748
- const b = await h.key, C = await h.value;
1749
- d.push({
1731
+ const u = [];
1732
+ for (const p of c) {
1733
+ const b = await p.key, C = await p.value;
1734
+ u.push({
1750
1735
  key: b,
1751
1736
  value: C,
1752
- alwaysSet: h.alwaysSet
1737
+ alwaysSet: p.alwaysSet
1753
1738
  });
1754
1739
  }
1755
- return d;
1756
- }).then((d) => T.mergeObjectSync(s, d)) : T.mergeObjectSync(s, c);
1740
+ return u;
1741
+ }).then((u) => T.mergeObjectSync(r, u)) : T.mergeObjectSync(r, c);
1757
1742
  }
1758
1743
  get shape() {
1759
1744
  return this._def.shape();
1760
1745
  }
1761
1746
  strict(e) {
1762
- return m.errToObj, new k({
1747
+ return h.errToObj, new k({
1763
1748
  ...this._def,
1764
1749
  unknownKeys: "strict",
1765
1750
  ...e !== void 0 ? {
1766
- errorMap: (t, s) => {
1767
- var n, a, i, o;
1768
- const c = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t, s).message) !== null && i !== void 0 ? i : s.defaultError;
1751
+ errorMap: (t, r) => {
1752
+ const n = this._def.errorMap?.(t, r).message ?? r.defaultError;
1769
1753
  return t.code === "unrecognized_keys" ? {
1770
- message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : c
1754
+ message: h.errToObj(e).message ?? n
1771
1755
  } : {
1772
- message: c
1756
+ message: n
1773
1757
  };
1774
1758
  }
1775
1759
  } : {}
@@ -1826,7 +1810,7 @@ class k extends g {
1826
1810
  ...this._def.shape(),
1827
1811
  ...e._def.shape()
1828
1812
  }),
1829
- typeName: _.ZodObject
1813
+ typeName: y.ZodObject
1830
1814
  });
1831
1815
  }
1832
1816
  // merge<
@@ -1896,18 +1880,18 @@ class k extends g {
1896
1880
  }
1897
1881
  pick(e) {
1898
1882
  const t = {};
1899
- return x.objectKeys(e).forEach((s) => {
1900
- e[s] && this.shape[s] && (t[s] = this.shape[s]);
1901
- }), new k({
1883
+ for (const r of x.objectKeys(e))
1884
+ e[r] && this.shape[r] && (t[r] = this.shape[r]);
1885
+ return new k({
1902
1886
  ...this._def,
1903
1887
  shape: () => t
1904
1888
  });
1905
1889
  }
1906
1890
  omit(e) {
1907
1891
  const t = {};
1908
- return x.objectKeys(this.shape).forEach((s) => {
1909
- e[s] || (t[s] = this.shape[s]);
1910
- }), new k({
1892
+ for (const r of x.objectKeys(this.shape))
1893
+ e[r] || (t[r] = this.shape[r]);
1894
+ return new k({
1911
1895
  ...this._def,
1912
1896
  shape: () => t
1913
1897
  });
@@ -1916,62 +1900,63 @@ class k extends g {
1916
1900
  * @deprecated
1917
1901
  */
1918
1902
  deepPartial() {
1919
- return G(this);
1903
+ return re(this);
1920
1904
  }
1921
1905
  partial(e) {
1922
1906
  const t = {};
1923
- return x.objectKeys(this.shape).forEach((s) => {
1924
- const n = this.shape[s];
1925
- e && !e[s] ? t[s] = n : t[s] = n.optional();
1926
- }), new k({
1907
+ for (const r of x.objectKeys(this.shape)) {
1908
+ const n = this.shape[r];
1909
+ e && !e[r] ? t[r] = n : t[r] = n.optional();
1910
+ }
1911
+ return new k({
1927
1912
  ...this._def,
1928
1913
  shape: () => t
1929
1914
  });
1930
1915
  }
1931
1916
  required(e) {
1932
1917
  const t = {};
1933
- return x.objectKeys(this.shape).forEach((s) => {
1934
- if (e && !e[s])
1935
- t[s] = this.shape[s];
1918
+ for (const r of x.objectKeys(this.shape))
1919
+ if (e && !e[r])
1920
+ t[r] = this.shape[r];
1936
1921
  else {
1937
- let a = this.shape[s];
1938
- for (; a instanceof E; )
1922
+ let a = this.shape[r];
1923
+ for (; a instanceof I; )
1939
1924
  a = a._def.innerType;
1940
- t[s] = a;
1925
+ t[r] = a;
1941
1926
  }
1942
- }), new k({
1927
+ return new k({
1943
1928
  ...this._def,
1944
1929
  shape: () => t
1945
1930
  });
1946
1931
  }
1947
1932
  keyof() {
1948
- return rt(x.objectKeys(this.shape));
1933
+ return it(x.objectKeys(this.shape));
1949
1934
  }
1950
1935
  }
1951
- k.create = (r, e) => new k({
1952
- shape: () => r,
1936
+ k.create = (s, e) => new k({
1937
+ shape: () => s,
1953
1938
  unknownKeys: "strip",
1954
- catchall: P.create(),
1955
- typeName: _.ZodObject,
1956
- ...v(e)
1939
+ catchall: z.create(),
1940
+ typeName: y.ZodObject,
1941
+ ..._(e)
1957
1942
  });
1958
- k.strictCreate = (r, e) => new k({
1959
- shape: () => r,
1943
+ k.strictCreate = (s, e) => new k({
1944
+ shape: () => s,
1960
1945
  unknownKeys: "strict",
1961
- catchall: P.create(),
1962
- typeName: _.ZodObject,
1963
- ...v(e)
1946
+ catchall: z.create(),
1947
+ typeName: y.ZodObject,
1948
+ ..._(e)
1964
1949
  });
1965
- k.lazycreate = (r, e) => new k({
1966
- shape: r,
1950
+ k.lazycreate = (s, e) => new k({
1951
+ shape: s,
1967
1952
  unknownKeys: "strip",
1968
- catchall: P.create(),
1969
- typeName: _.ZodObject,
1970
- ...v(e)
1953
+ catchall: z.create(),
1954
+ typeName: y.ZodObject,
1955
+ ..._(e)
1971
1956
  });
1972
- class le extends g {
1957
+ class ye extends v {
1973
1958
  _parse(e) {
1974
- const { ctx: t } = this._processInputParams(e), s = this._def.options;
1959
+ const { ctx: t } = this._processInputParams(e), r = this._def.options;
1975
1960
  function n(a) {
1976
1961
  for (const o of a)
1977
1962
  if (o.result.status === "valid")
@@ -1979,14 +1964,14 @@ class le extends g {
1979
1964
  for (const o of a)
1980
1965
  if (o.result.status === "dirty")
1981
1966
  return t.common.issues.push(...o.ctx.common.issues), o.result;
1982
- const i = a.map((o) => new Z(o.ctx.common.issues));
1967
+ const i = a.map((o) => new O(o.ctx.common.issues));
1983
1968
  return l(t, {
1984
- code: u.invalid_union,
1969
+ code: d.invalid_union,
1985
1970
  unionErrors: i
1986
- }), y;
1971
+ }), m;
1987
1972
  }
1988
1973
  if (t.common.async)
1989
- return Promise.all(s.map(async (a) => {
1974
+ return Promise.all(r.map(async (a) => {
1990
1975
  const i = {
1991
1976
  ...t,
1992
1977
  common: {
@@ -2007,52 +1992,52 @@ class le extends g {
2007
1992
  {
2008
1993
  let a;
2009
1994
  const i = [];
2010
- for (const c of s) {
2011
- const d = {
1995
+ for (const c of r) {
1996
+ const u = {
2012
1997
  ...t,
2013
1998
  common: {
2014
1999
  ...t.common,
2015
2000
  issues: []
2016
2001
  },
2017
2002
  parent: null
2018
- }, h = c._parseSync({
2003
+ }, p = c._parseSync({
2019
2004
  data: t.data,
2020
2005
  path: t.path,
2021
- parent: d
2006
+ parent: u
2022
2007
  });
2023
- if (h.status === "valid")
2024
- return h;
2025
- h.status === "dirty" && !a && (a = { result: h, ctx: d }), d.common.issues.length && i.push(d.common.issues);
2008
+ if (p.status === "valid")
2009
+ return p;
2010
+ p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length && i.push(u.common.issues);
2026
2011
  }
2027
2012
  if (a)
2028
2013
  return t.common.issues.push(...a.ctx.common.issues), a.result;
2029
- const o = i.map((c) => new Z(c));
2014
+ const o = i.map((c) => new O(c));
2030
2015
  return l(t, {
2031
- code: u.invalid_union,
2016
+ code: d.invalid_union,
2032
2017
  unionErrors: o
2033
- }), y;
2018
+ }), m;
2034
2019
  }
2035
2020
  }
2036
2021
  get options() {
2037
2022
  return this._def.options;
2038
2023
  }
2039
2024
  }
2040
- le.create = (r, e) => new le({
2041
- options: r,
2042
- typeName: _.ZodUnion,
2043
- ...v(e)
2025
+ ye.create = (s, e) => new ye({
2026
+ options: s,
2027
+ typeName: y.ZodUnion,
2028
+ ..._(e)
2044
2029
  });
2045
- const I = (r) => r instanceof pe ? I(r.schema) : r instanceof A ? I(r.innerType()) : r instanceof me ? [r.value] : r instanceof z ? r.options : r instanceof _e ? x.objectValues(r.enum) : r instanceof ye ? I(r._def.innerType) : r instanceof de ? [void 0] : r instanceof ue ? [null] : r instanceof E ? [void 0, ...I(r.unwrap())] : r instanceof U ? [null, ...I(r.unwrap())] : r instanceof Je || r instanceof ge ? I(r.unwrap()) : r instanceof ve ? I(r._def.innerType) : [];
2046
- class Ee extends g {
2030
+ const L = (s) => s instanceof ve ? L(s.schema) : s instanceof N ? L(s.innerType()) : s instanceof xe ? [s.value] : s instanceof F ? s.options : s instanceof be ? x.objectValues(s.enum) : s instanceof ke ? L(s._def.innerType) : s instanceof pe ? [void 0] : s instanceof me ? [null] : s instanceof I ? [void 0, ...L(s.unwrap())] : s instanceof W ? [null, ...L(s.unwrap())] : s instanceof Ye || s instanceof Te ? L(s.unwrap()) : s instanceof we ? L(s._def.innerType) : [];
2031
+ class $e extends v {
2047
2032
  _parse(e) {
2048
2033
  const { ctx: t } = this._processInputParams(e);
2049
2034
  if (t.parsedType !== f.object)
2050
2035
  return l(t, {
2051
- code: u.invalid_type,
2036
+ code: d.invalid_type,
2052
2037
  expected: f.object,
2053
2038
  received: t.parsedType
2054
- }), y;
2055
- const s = this.discriminator, n = t.data[s], a = this.optionsMap.get(n);
2039
+ }), m;
2040
+ const r = this.discriminator, n = t.data[r], a = this.optionsMap.get(n);
2056
2041
  return a ? t.common.async ? a._parseAsync({
2057
2042
  data: t.data,
2058
2043
  path: t.path,
@@ -2062,10 +2047,10 @@ class Ee extends g {
2062
2047
  path: t.path,
2063
2048
  parent: t
2064
2049
  }) : (l(t, {
2065
- code: u.invalid_union_discriminator,
2050
+ code: d.invalid_union_discriminator,
2066
2051
  options: Array.from(this.optionsMap.keys()),
2067
- path: [s]
2068
- }), y);
2052
+ path: [r]
2053
+ }), m);
2069
2054
  }
2070
2055
  get discriminator() {
2071
2056
  return this._def.discriminator;
@@ -2084,10 +2069,10 @@ class Ee extends g {
2084
2069
  * @param types an array of object schemas
2085
2070
  * @param params
2086
2071
  */
2087
- static create(e, t, s) {
2072
+ static create(e, t, r) {
2088
2073
  const n = /* @__PURE__ */ new Map();
2089
2074
  for (const a of t) {
2090
- const i = I(a.shape[e]);
2075
+ const i = L(a.shape[e]);
2091
2076
  if (!i.length)
2092
2077
  throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2093
2078
  for (const o of i) {
@@ -2096,130 +2081,130 @@ class Ee extends g {
2096
2081
  n.set(o, a);
2097
2082
  }
2098
2083
  }
2099
- return new Ee({
2100
- typeName: _.ZodDiscriminatedUnion,
2084
+ return new $e({
2085
+ typeName: y.ZodDiscriminatedUnion,
2101
2086
  discriminator: e,
2102
2087
  options: t,
2103
2088
  optionsMap: n,
2104
- ...v(s)
2089
+ ..._(r)
2105
2090
  });
2106
2091
  }
2107
2092
  }
2108
- function We(r, e) {
2109
- const t = $(r), s = $(e);
2110
- if (r === e)
2111
- return { valid: !0, data: r };
2112
- if (t === f.object && s === f.object) {
2113
- const n = x.objectKeys(e), a = x.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = { ...r, ...e };
2093
+ function Qe(s, e) {
2094
+ const t = V(s), r = V(e);
2095
+ if (s === e)
2096
+ return { valid: !0, data: s };
2097
+ if (t === f.object && r === f.object) {
2098
+ const n = x.objectKeys(e), a = x.objectKeys(s).filter((o) => n.indexOf(o) !== -1), i = { ...s, ...e };
2114
2099
  for (const o of a) {
2115
- const c = We(r[o], e[o]);
2100
+ const c = Qe(s[o], e[o]);
2116
2101
  if (!c.valid)
2117
2102
  return { valid: !1 };
2118
2103
  i[o] = c.data;
2119
2104
  }
2120
2105
  return { valid: !0, data: i };
2121
- } else if (t === f.array && s === f.array) {
2122
- if (r.length !== e.length)
2106
+ } else if (t === f.array && r === f.array) {
2107
+ if (s.length !== e.length)
2123
2108
  return { valid: !1 };
2124
2109
  const n = [];
2125
- for (let a = 0; a < r.length; a++) {
2126
- const i = r[a], o = e[a], c = We(i, o);
2110
+ for (let a = 0; a < s.length; a++) {
2111
+ const i = s[a], o = e[a], c = Qe(i, o);
2127
2112
  if (!c.valid)
2128
2113
  return { valid: !1 };
2129
2114
  n.push(c.data);
2130
2115
  }
2131
2116
  return { valid: !0, data: n };
2132
- } else return t === f.date && s === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
2117
+ } else return t === f.date && r === f.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
2133
2118
  }
2134
- class fe extends g {
2119
+ class _e extends v {
2135
2120
  _parse(e) {
2136
- const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
2137
- if (Fe(a) || Fe(i))
2138
- return y;
2139
- const o = We(a.value, i.value);
2140
- return o.valid ? ((qe(a) || qe(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(s, {
2141
- code: u.invalid_intersection_types
2142
- }), y);
2121
+ const { status: t, ctx: r } = this._processInputParams(e), n = (a, i) => {
2122
+ if (We(a) || We(i))
2123
+ return m;
2124
+ const o = Qe(a.value, i.value);
2125
+ return o.valid ? ((Je(a) || Je(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(r, {
2126
+ code: d.invalid_intersection_types
2127
+ }), m);
2143
2128
  };
2144
- return s.common.async ? Promise.all([
2129
+ return r.common.async ? Promise.all([
2145
2130
  this._def.left._parseAsync({
2146
- data: s.data,
2147
- path: s.path,
2148
- parent: s
2131
+ data: r.data,
2132
+ path: r.path,
2133
+ parent: r
2149
2134
  }),
2150
2135
  this._def.right._parseAsync({
2151
- data: s.data,
2152
- path: s.path,
2153
- parent: s
2136
+ data: r.data,
2137
+ path: r.path,
2138
+ parent: r
2154
2139
  })
2155
2140
  ]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
2156
- data: s.data,
2157
- path: s.path,
2158
- parent: s
2141
+ data: r.data,
2142
+ path: r.path,
2143
+ parent: r
2159
2144
  }), this._def.right._parseSync({
2160
- data: s.data,
2161
- path: s.path,
2162
- parent: s
2145
+ data: r.data,
2146
+ path: r.path,
2147
+ parent: r
2163
2148
  }));
2164
2149
  }
2165
2150
  }
2166
- fe.create = (r, e, t) => new fe({
2167
- left: r,
2151
+ _e.create = (s, e, t) => new _e({
2152
+ left: s,
2168
2153
  right: e,
2169
- typeName: _.ZodIntersection,
2170
- ...v(t)
2154
+ typeName: y.ZodIntersection,
2155
+ ..._(t)
2171
2156
  });
2172
- class N extends g {
2157
+ class P extends v {
2173
2158
  _parse(e) {
2174
- const { status: t, ctx: s } = this._processInputParams(e);
2175
- if (s.parsedType !== f.array)
2176
- return l(s, {
2177
- code: u.invalid_type,
2159
+ const { status: t, ctx: r } = this._processInputParams(e);
2160
+ if (r.parsedType !== f.array)
2161
+ return l(r, {
2162
+ code: d.invalid_type,
2178
2163
  expected: f.array,
2179
- received: s.parsedType
2180
- }), y;
2181
- if (s.data.length < this._def.items.length)
2182
- return l(s, {
2183
- code: u.too_small,
2164
+ received: r.parsedType
2165
+ }), m;
2166
+ if (r.data.length < this._def.items.length)
2167
+ return l(r, {
2168
+ code: d.too_small,
2184
2169
  minimum: this._def.items.length,
2185
2170
  inclusive: !0,
2186
2171
  exact: !1,
2187
2172
  type: "array"
2188
- }), y;
2189
- !this._def.rest && s.data.length > this._def.items.length && (l(s, {
2190
- code: u.too_big,
2173
+ }), m;
2174
+ !this._def.rest && r.data.length > this._def.items.length && (l(r, {
2175
+ code: d.too_big,
2191
2176
  maximum: this._def.items.length,
2192
2177
  inclusive: !0,
2193
2178
  exact: !1,
2194
2179
  type: "array"
2195
2180
  }), t.dirty());
2196
- const a = [...s.data].map((i, o) => {
2181
+ const a = [...r.data].map((i, o) => {
2197
2182
  const c = this._def.items[o] || this._def.rest;
2198
- return c ? c._parse(new R(s, i, s.path, o)) : null;
2183
+ return c ? c._parse(new $(r, i, r.path, o)) : null;
2199
2184
  }).filter((i) => !!i);
2200
- return s.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
2185
+ return r.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
2201
2186
  }
2202
2187
  get items() {
2203
2188
  return this._def.items;
2204
2189
  }
2205
2190
  rest(e) {
2206
- return new N({
2191
+ return new P({
2207
2192
  ...this._def,
2208
2193
  rest: e
2209
2194
  });
2210
2195
  }
2211
2196
  }
2212
- N.create = (r, e) => {
2213
- if (!Array.isArray(r))
2197
+ P.create = (s, e) => {
2198
+ if (!Array.isArray(s))
2214
2199
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2215
- return new N({
2216
- items: r,
2217
- typeName: _.ZodTuple,
2200
+ return new P({
2201
+ items: s,
2202
+ typeName: y.ZodTuple,
2218
2203
  rest: null,
2219
- ...v(e)
2204
+ ..._(e)
2220
2205
  });
2221
2206
  };
2222
- class he extends g {
2207
+ class ge extends v {
2223
2208
  get keySchema() {
2224
2209
  return this._def.keyType;
2225
2210
  }
@@ -2227,40 +2212,40 @@ class he extends g {
2227
2212
  return this._def.valueType;
2228
2213
  }
2229
2214
  _parse(e) {
2230
- const { status: t, ctx: s } = this._processInputParams(e);
2231
- if (s.parsedType !== f.object)
2232
- return l(s, {
2233
- code: u.invalid_type,
2215
+ const { status: t, ctx: r } = this._processInputParams(e);
2216
+ if (r.parsedType !== f.object)
2217
+ return l(r, {
2218
+ code: d.invalid_type,
2234
2219
  expected: f.object,
2235
- received: s.parsedType
2236
- }), y;
2220
+ received: r.parsedType
2221
+ }), m;
2237
2222
  const n = [], a = this._def.keyType, i = this._def.valueType;
2238
- for (const o in s.data)
2223
+ for (const o in r.data)
2239
2224
  n.push({
2240
- key: a._parse(new R(s, o, s.path, o)),
2241
- value: i._parse(new R(s, s.data[o], s.path, o)),
2242
- alwaysSet: o in s.data
2225
+ key: a._parse(new $(r, o, r.path, o)),
2226
+ value: i._parse(new $(r, r.data[o], r.path, o)),
2227
+ alwaysSet: o in r.data
2243
2228
  });
2244
- return s.common.async ? T.mergeObjectAsync(t, n) : T.mergeObjectSync(t, n);
2229
+ return r.common.async ? T.mergeObjectAsync(t, n) : T.mergeObjectSync(t, n);
2245
2230
  }
2246
2231
  get element() {
2247
2232
  return this._def.valueType;
2248
2233
  }
2249
- static create(e, t, s) {
2250
- return t instanceof g ? new he({
2234
+ static create(e, t, r) {
2235
+ return t instanceof v ? new ge({
2251
2236
  keyType: e,
2252
2237
  valueType: t,
2253
- typeName: _.ZodRecord,
2254
- ...v(s)
2255
- }) : new he({
2256
- keyType: O.create(),
2238
+ typeName: y.ZodRecord,
2239
+ ..._(r)
2240
+ }) : new ge({
2241
+ keyType: R.create(),
2257
2242
  valueType: e,
2258
- typeName: _.ZodRecord,
2259
- ...v(t)
2243
+ typeName: y.ZodRecord,
2244
+ ..._(t)
2260
2245
  });
2261
2246
  }
2262
2247
  }
2263
- class Oe extends g {
2248
+ class Ne extends v {
2264
2249
  get keySchema() {
2265
2250
  return this._def.keyType;
2266
2251
  }
@@ -2268,65 +2253,65 @@ class Oe extends g {
2268
2253
  return this._def.valueType;
2269
2254
  }
2270
2255
  _parse(e) {
2271
- const { status: t, ctx: s } = this._processInputParams(e);
2272
- if (s.parsedType !== f.map)
2273
- return l(s, {
2274
- code: u.invalid_type,
2256
+ const { status: t, ctx: r } = this._processInputParams(e);
2257
+ if (r.parsedType !== f.map)
2258
+ return l(r, {
2259
+ code: d.invalid_type,
2275
2260
  expected: f.map,
2276
- received: s.parsedType
2277
- }), y;
2278
- const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], d) => ({
2279
- key: n._parse(new R(s, o, s.path, [d, "key"])),
2280
- value: a._parse(new R(s, c, s.path, [d, "value"]))
2261
+ received: r.parsedType
2262
+ }), m;
2263
+ const n = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c], u) => ({
2264
+ key: n._parse(new $(r, o, r.path, [u, "key"])),
2265
+ value: a._parse(new $(r, c, r.path, [u, "value"]))
2281
2266
  }));
2282
- if (s.common.async) {
2267
+ if (r.common.async) {
2283
2268
  const o = /* @__PURE__ */ new Map();
2284
2269
  return Promise.resolve().then(async () => {
2285
2270
  for (const c of i) {
2286
- const d = await c.key, h = await c.value;
2287
- if (d.status === "aborted" || h.status === "aborted")
2288
- return y;
2289
- (d.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(d.value, h.value);
2271
+ const u = await c.key, p = await c.value;
2272
+ if (u.status === "aborted" || p.status === "aborted")
2273
+ return m;
2274
+ (u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
2290
2275
  }
2291
2276
  return { status: t.value, value: o };
2292
2277
  });
2293
2278
  } else {
2294
2279
  const o = /* @__PURE__ */ new Map();
2295
2280
  for (const c of i) {
2296
- const d = c.key, h = c.value;
2297
- if (d.status === "aborted" || h.status === "aborted")
2298
- return y;
2299
- (d.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(d.value, h.value);
2281
+ const u = c.key, p = c.value;
2282
+ if (u.status === "aborted" || p.status === "aborted")
2283
+ return m;
2284
+ (u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
2300
2285
  }
2301
2286
  return { status: t.value, value: o };
2302
2287
  }
2303
2288
  }
2304
2289
  }
2305
- Oe.create = (r, e, t) => new Oe({
2290
+ Ne.create = (s, e, t) => new Ne({
2306
2291
  valueType: e,
2307
- keyType: r,
2308
- typeName: _.ZodMap,
2309
- ...v(t)
2292
+ keyType: s,
2293
+ typeName: y.ZodMap,
2294
+ ..._(t)
2310
2295
  });
2311
- class J extends g {
2296
+ class X extends v {
2312
2297
  _parse(e) {
2313
- const { status: t, ctx: s } = this._processInputParams(e);
2314
- if (s.parsedType !== f.set)
2315
- return l(s, {
2316
- code: u.invalid_type,
2298
+ const { status: t, ctx: r } = this._processInputParams(e);
2299
+ if (r.parsedType !== f.set)
2300
+ return l(r, {
2301
+ code: d.invalid_type,
2317
2302
  expected: f.set,
2318
- received: s.parsedType
2319
- }), y;
2303
+ received: r.parsedType
2304
+ }), m;
2320
2305
  const n = this._def;
2321
- n.minSize !== null && s.data.size < n.minSize.value && (l(s, {
2322
- code: u.too_small,
2306
+ n.minSize !== null && r.data.size < n.minSize.value && (l(r, {
2307
+ code: d.too_small,
2323
2308
  minimum: n.minSize.value,
2324
2309
  type: "set",
2325
2310
  inclusive: !0,
2326
2311
  exact: !1,
2327
2312
  message: n.minSize.message
2328
- }), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (l(s, {
2329
- code: u.too_big,
2313
+ }), t.dirty()), n.maxSize !== null && r.data.size > n.maxSize.value && (l(r, {
2314
+ code: d.too_big,
2330
2315
  maximum: n.maxSize.value,
2331
2316
  type: "set",
2332
2317
  inclusive: !0,
@@ -2335,27 +2320,27 @@ class J extends g {
2335
2320
  }), t.dirty());
2336
2321
  const a = this._def.valueType;
2337
2322
  function i(c) {
2338
- const d = /* @__PURE__ */ new Set();
2339
- for (const h of c) {
2340
- if (h.status === "aborted")
2341
- return y;
2342
- h.status === "dirty" && t.dirty(), d.add(h.value);
2323
+ const u = /* @__PURE__ */ new Set();
2324
+ for (const p of c) {
2325
+ if (p.status === "aborted")
2326
+ return m;
2327
+ p.status === "dirty" && t.dirty(), u.add(p.value);
2343
2328
  }
2344
- return { status: t.value, value: d };
2329
+ return { status: t.value, value: u };
2345
2330
  }
2346
- const o = [...s.data.values()].map((c, d) => a._parse(new R(s, c, s.path, d)));
2347
- return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2331
+ const o = [...r.data.values()].map((c, u) => a._parse(new $(r, c, r.path, u)));
2332
+ return r.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2348
2333
  }
2349
2334
  min(e, t) {
2350
- return new J({
2335
+ return new X({
2351
2336
  ...this._def,
2352
- minSize: { value: e, message: m.toString(t) }
2337
+ minSize: { value: e, message: h.toString(t) }
2353
2338
  });
2354
2339
  }
2355
2340
  max(e, t) {
2356
- return new J({
2341
+ return new X({
2357
2342
  ...this._def,
2358
- maxSize: { value: e, message: m.toString(t) }
2343
+ maxSize: { value: e, message: h.toString(t) }
2359
2344
  });
2360
2345
  }
2361
2346
  size(e, t) {
@@ -2365,14 +2350,14 @@ class J extends g {
2365
2350
  return this.min(1, e);
2366
2351
  }
2367
2352
  }
2368
- J.create = (r, e) => new J({
2369
- valueType: r,
2353
+ X.create = (s, e) => new X({
2354
+ valueType: s,
2370
2355
  minSize: null,
2371
2356
  maxSize: null,
2372
- typeName: _.ZodSet,
2373
- ...v(e)
2357
+ typeName: y.ZodSet,
2358
+ ..._(e)
2374
2359
  });
2375
- class X extends g {
2360
+ class ae extends v {
2376
2361
  constructor() {
2377
2362
  super(...arguments), this.validate = this.implement;
2378
2363
  }
@@ -2380,62 +2365,52 @@ class X extends g {
2380
2365
  const { ctx: t } = this._processInputParams(e);
2381
2366
  if (t.parsedType !== f.function)
2382
2367
  return l(t, {
2383
- code: u.invalid_type,
2368
+ code: d.invalid_type,
2384
2369
  expected: f.function,
2385
2370
  received: t.parsedType
2386
- }), y;
2387
- function s(o, c) {
2388
- return Te({
2371
+ }), m;
2372
+ function r(o, c) {
2373
+ return Ae({
2389
2374
  data: o,
2390
2375
  path: t.path,
2391
- errorMaps: [
2392
- t.common.contextualErrorMap,
2393
- t.schemaErrorMap,
2394
- we(),
2395
- Q
2396
- ].filter((d) => !!d),
2376
+ errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Oe(), ie].filter((u) => !!u),
2397
2377
  issueData: {
2398
- code: u.invalid_arguments,
2378
+ code: d.invalid_arguments,
2399
2379
  argumentsError: c
2400
2380
  }
2401
2381
  });
2402
2382
  }
2403
2383
  function n(o, c) {
2404
- return Te({
2384
+ return Ae({
2405
2385
  data: o,
2406
2386
  path: t.path,
2407
- errorMaps: [
2408
- t.common.contextualErrorMap,
2409
- t.schemaErrorMap,
2410
- we(),
2411
- Q
2412
- ].filter((d) => !!d),
2387
+ errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Oe(), ie].filter((u) => !!u),
2413
2388
  issueData: {
2414
- code: u.invalid_return_type,
2389
+ code: d.invalid_return_type,
2415
2390
  returnTypeError: c
2416
2391
  }
2417
2392
  });
2418
2393
  }
2419
2394
  const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2420
- if (this._def.returns instanceof te) {
2395
+ if (this._def.returns instanceof ce) {
2421
2396
  const o = this;
2422
2397
  return S(async function(...c) {
2423
- const d = new Z([]), h = await o._def.args.parseAsync(c, a).catch((w) => {
2424
- throw d.addIssue(s(c, w)), d;
2425
- }), b = await Reflect.apply(i, this, h);
2398
+ const u = new O([]), p = await o._def.args.parseAsync(c, a).catch((w) => {
2399
+ throw u.addIssue(r(c, w)), u;
2400
+ }), b = await Reflect.apply(i, this, p);
2426
2401
  return await o._def.returns._def.type.parseAsync(b, a).catch((w) => {
2427
- throw d.addIssue(n(b, w)), d;
2402
+ throw u.addIssue(n(b, w)), u;
2428
2403
  });
2429
2404
  });
2430
2405
  } else {
2431
2406
  const o = this;
2432
2407
  return S(function(...c) {
2433
- const d = o._def.args.safeParse(c, a);
2434
- if (!d.success)
2435
- throw new Z([s(c, d.error)]);
2436
- const h = Reflect.apply(i, this, d.data), b = o._def.returns.safeParse(h, a);
2408
+ const u = o._def.args.safeParse(c, a);
2409
+ if (!u.success)
2410
+ throw new O([r(c, u.error)]);
2411
+ const p = Reflect.apply(i, this, u.data), b = o._def.returns.safeParse(p, a);
2437
2412
  if (!b.success)
2438
- throw new Z([n(h, b.error)]);
2413
+ throw new O([n(p, b.error)]);
2439
2414
  return b.data;
2440
2415
  });
2441
2416
  }
@@ -2447,13 +2422,13 @@ class X extends g {
2447
2422
  return this._def.returns;
2448
2423
  }
2449
2424
  args(...e) {
2450
- return new X({
2425
+ return new ae({
2451
2426
  ...this._def,
2452
- args: N.create(e).rest(F.create())
2427
+ args: P.create(e).rest(Y.create())
2453
2428
  });
2454
2429
  }
2455
2430
  returns(e) {
2456
- return new X({
2431
+ return new ae({
2457
2432
  ...this._def,
2458
2433
  returns: e
2459
2434
  });
@@ -2464,16 +2439,16 @@ class X extends g {
2464
2439
  strictImplement(e) {
2465
2440
  return this.parse(e);
2466
2441
  }
2467
- static create(e, t, s) {
2468
- return new X({
2469
- args: e || N.create([]).rest(F.create()),
2470
- returns: t || F.create(),
2471
- typeName: _.ZodFunction,
2472
- ...v(s)
2442
+ static create(e, t, r) {
2443
+ return new ae({
2444
+ args: e || P.create([]).rest(Y.create()),
2445
+ returns: t || Y.create(),
2446
+ typeName: y.ZodFunction,
2447
+ ..._(r)
2473
2448
  });
2474
2449
  }
2475
2450
  }
2476
- class pe extends g {
2451
+ class ve extends v {
2477
2452
  get schema() {
2478
2453
  return this._def.getter();
2479
2454
  }
@@ -2482,20 +2457,20 @@ class pe extends g {
2482
2457
  return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2483
2458
  }
2484
2459
  }
2485
- pe.create = (r, e) => new pe({
2486
- getter: r,
2487
- typeName: _.ZodLazy,
2488
- ...v(e)
2460
+ ve.create = (s, e) => new ve({
2461
+ getter: s,
2462
+ typeName: y.ZodLazy,
2463
+ ..._(e)
2489
2464
  });
2490
- class me extends g {
2465
+ class xe extends v {
2491
2466
  _parse(e) {
2492
2467
  if (e.data !== this._def.value) {
2493
2468
  const t = this._getOrReturnCtx(e);
2494
2469
  return l(t, {
2495
2470
  received: t.data,
2496
- code: u.invalid_literal,
2471
+ code: d.invalid_literal,
2497
2472
  expected: this._def.value
2498
- }), y;
2473
+ }), m;
2499
2474
  }
2500
2475
  return { status: "valid", value: e.data };
2501
2476
  }
@@ -2503,38 +2478,35 @@ class me extends g {
2503
2478
  return this._def.value;
2504
2479
  }
2505
2480
  }
2506
- me.create = (r, e) => new me({
2507
- value: r,
2508
- typeName: _.ZodLiteral,
2509
- ...v(e)
2481
+ xe.create = (s, e) => new xe({
2482
+ value: s,
2483
+ typeName: y.ZodLiteral,
2484
+ ..._(e)
2510
2485
  });
2511
- function rt(r, e) {
2512
- return new z({
2513
- values: r,
2514
- typeName: _.ZodEnum,
2515
- ...v(e)
2486
+ function it(s, e) {
2487
+ return new F({
2488
+ values: s,
2489
+ typeName: y.ZodEnum,
2490
+ ..._(e)
2516
2491
  });
2517
2492
  }
2518
- class z extends g {
2519
- constructor() {
2520
- super(...arguments), ae.set(this, void 0);
2521
- }
2493
+ class F extends v {
2522
2494
  _parse(e) {
2523
2495
  if (typeof e.data != "string") {
2524
- const t = this._getOrReturnCtx(e), s = this._def.values;
2496
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2525
2497
  return l(t, {
2526
- expected: x.joinValues(s),
2498
+ expected: x.joinValues(r),
2527
2499
  received: t.parsedType,
2528
- code: u.invalid_type
2529
- }), y;
2500
+ code: d.invalid_type
2501
+ }), m;
2530
2502
  }
2531
- if (Se(this, ae) || Xe(this, ae, new Set(this._def.values)), !Se(this, ae).has(e.data)) {
2532
- const t = this._getOrReturnCtx(e), s = this._def.values;
2503
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2504
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2533
2505
  return l(t, {
2534
2506
  received: t.data,
2535
- code: u.invalid_enum_value,
2536
- options: s
2537
- }), y;
2507
+ code: d.invalid_enum_value,
2508
+ options: r
2509
+ }), m;
2538
2510
  }
2539
2511
  return S(e.data);
2540
2512
  }
@@ -2560,41 +2532,37 @@ class z extends g {
2560
2532
  return e;
2561
2533
  }
2562
2534
  extract(e, t = this._def) {
2563
- return z.create(e, {
2535
+ return F.create(e, {
2564
2536
  ...this._def,
2565
2537
  ...t
2566
2538
  });
2567
2539
  }
2568
2540
  exclude(e, t = this._def) {
2569
- return z.create(this.options.filter((s) => !e.includes(s)), {
2541
+ return F.create(this.options.filter((r) => !e.includes(r)), {
2570
2542
  ...this._def,
2571
2543
  ...t
2572
2544
  });
2573
2545
  }
2574
2546
  }
2575
- ae = /* @__PURE__ */ new WeakMap();
2576
- z.create = rt;
2577
- class _e extends g {
2578
- constructor() {
2579
- super(...arguments), ie.set(this, void 0);
2580
- }
2547
+ F.create = it;
2548
+ class be extends v {
2581
2549
  _parse(e) {
2582
- const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2583
- if (s.parsedType !== f.string && s.parsedType !== f.number) {
2550
+ const t = x.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
2551
+ if (r.parsedType !== f.string && r.parsedType !== f.number) {
2584
2552
  const n = x.objectValues(t);
2585
- return l(s, {
2553
+ return l(r, {
2586
2554
  expected: x.joinValues(n),
2587
- received: s.parsedType,
2588
- code: u.invalid_type
2589
- }), y;
2555
+ received: r.parsedType,
2556
+ code: d.invalid_type
2557
+ }), m;
2590
2558
  }
2591
- if (Se(this, ie) || Xe(this, ie, new Set(x.getValidEnumValues(this._def.values))), !Se(this, ie).has(e.data)) {
2559
+ if (this._cache || (this._cache = new Set(x.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2592
2560
  const n = x.objectValues(t);
2593
- return l(s, {
2594
- received: s.data,
2595
- code: u.invalid_enum_value,
2561
+ return l(r, {
2562
+ received: r.data,
2563
+ code: d.invalid_enum_value,
2596
2564
  options: n
2597
- }), y;
2565
+ }), m;
2598
2566
  }
2599
2567
  return S(e.data);
2600
2568
  }
@@ -2602,13 +2570,12 @@ class _e extends g {
2602
2570
  return this._def.values;
2603
2571
  }
2604
2572
  }
2605
- ie = /* @__PURE__ */ new WeakMap();
2606
- _e.create = (r, e) => new _e({
2607
- values: r,
2608
- typeName: _.ZodNativeEnum,
2609
- ...v(e)
2573
+ be.create = (s, e) => new be({
2574
+ values: s,
2575
+ typeName: y.ZodNativeEnum,
2576
+ ..._(e)
2610
2577
  });
2611
- class te extends g {
2578
+ class ce extends v {
2612
2579
  unwrap() {
2613
2580
  return this._def.type;
2614
2581
  }
@@ -2616,112 +2583,115 @@ class te extends g {
2616
2583
  const { ctx: t } = this._processInputParams(e);
2617
2584
  if (t.parsedType !== f.promise && t.common.async === !1)
2618
2585
  return l(t, {
2619
- code: u.invalid_type,
2586
+ code: d.invalid_type,
2620
2587
  expected: f.promise,
2621
2588
  received: t.parsedType
2622
- }), y;
2623
- const s = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2624
- return S(s.then((n) => this._def.type.parseAsync(n, {
2589
+ }), m;
2590
+ const r = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2591
+ return S(r.then((n) => this._def.type.parseAsync(n, {
2625
2592
  path: t.path,
2626
2593
  errorMap: t.common.contextualErrorMap
2627
2594
  })));
2628
2595
  }
2629
2596
  }
2630
- te.create = (r, e) => new te({
2631
- type: r,
2632
- typeName: _.ZodPromise,
2633
- ...v(e)
2597
+ ce.create = (s, e) => new ce({
2598
+ type: s,
2599
+ typeName: y.ZodPromise,
2600
+ ..._(e)
2634
2601
  });
2635
- class A extends g {
2602
+ class N extends v {
2636
2603
  innerType() {
2637
2604
  return this._def.schema;
2638
2605
  }
2639
2606
  sourceType() {
2640
- return this._def.schema._def.typeName === _.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2607
+ return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2641
2608
  }
2642
2609
  _parse(e) {
2643
- const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
2610
+ const { status: t, ctx: r } = this._processInputParams(e), n = this._def.effect || null, a = {
2644
2611
  addIssue: (i) => {
2645
- l(s, i), i.fatal ? t.abort() : t.dirty();
2612
+ l(r, i), i.fatal ? t.abort() : t.dirty();
2646
2613
  },
2647
2614
  get path() {
2648
- return s.path;
2615
+ return r.path;
2649
2616
  }
2650
2617
  };
2651
2618
  if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
2652
- const i = n.transform(s.data, a);
2653
- if (s.common.async)
2619
+ const i = n.transform(r.data, a);
2620
+ if (r.common.async)
2654
2621
  return Promise.resolve(i).then(async (o) => {
2655
2622
  if (t.value === "aborted")
2656
- return y;
2623
+ return m;
2657
2624
  const c = await this._def.schema._parseAsync({
2658
2625
  data: o,
2659
- path: s.path,
2660
- parent: s
2626
+ path: r.path,
2627
+ parent: r
2661
2628
  });
2662
- return c.status === "aborted" ? y : c.status === "dirty" || t.value === "dirty" ? K(c.value) : c;
2629
+ return c.status === "aborted" ? m : c.status === "dirty" || t.value === "dirty" ? ne(c.value) : c;
2663
2630
  });
2664
2631
  {
2665
2632
  if (t.value === "aborted")
2666
- return y;
2633
+ return m;
2667
2634
  const o = this._def.schema._parseSync({
2668
2635
  data: i,
2669
- path: s.path,
2670
- parent: s
2636
+ path: r.path,
2637
+ parent: r
2671
2638
  });
2672
- return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? K(o.value) : o;
2639
+ return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? ne(o.value) : o;
2673
2640
  }
2674
2641
  }
2675
2642
  if (n.type === "refinement") {
2676
2643
  const i = (o) => {
2677
2644
  const c = n.refinement(o, a);
2678
- if (s.common.async)
2645
+ if (r.common.async)
2679
2646
  return Promise.resolve(c);
2680
2647
  if (c instanceof Promise)
2681
2648
  throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2682
2649
  return o;
2683
2650
  };
2684
- if (s.common.async === !1) {
2651
+ if (r.common.async === !1) {
2685
2652
  const o = this._def.schema._parseSync({
2686
- data: s.data,
2687
- path: s.path,
2688
- parent: s
2653
+ data: r.data,
2654
+ path: r.path,
2655
+ parent: r
2689
2656
  });
2690
- return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2657
+ return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2691
2658
  } else
2692
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2659
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2693
2660
  }
2694
2661
  if (n.type === "transform")
2695
- if (s.common.async === !1) {
2662
+ if (r.common.async === !1) {
2696
2663
  const i = this._def.schema._parseSync({
2697
- data: s.data,
2698
- path: s.path,
2699
- parent: s
2664
+ data: r.data,
2665
+ path: r.path,
2666
+ parent: r
2700
2667
  });
2701
- if (!q(i))
2702
- return i;
2668
+ if (!K(i))
2669
+ return m;
2703
2670
  const o = n.transform(i.value, a);
2704
2671
  if (o instanceof Promise)
2705
2672
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2706
2673
  return { status: t.value, value: o };
2707
2674
  } else
2708
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => q(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2675
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => K(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({
2676
+ status: t.value,
2677
+ value: o
2678
+ })) : m);
2709
2679
  x.assertNever(n);
2710
2680
  }
2711
2681
  }
2712
- A.create = (r, e, t) => new A({
2713
- schema: r,
2714
- typeName: _.ZodEffects,
2682
+ N.create = (s, e, t) => new N({
2683
+ schema: s,
2684
+ typeName: y.ZodEffects,
2715
2685
  effect: e,
2716
- ...v(t)
2686
+ ..._(t)
2717
2687
  });
2718
- A.createWithPreprocess = (r, e, t) => new A({
2688
+ N.createWithPreprocess = (s, e, t) => new N({
2719
2689
  schema: e,
2720
- effect: { type: "preprocess", transform: r },
2721
- typeName: _.ZodEffects,
2722
- ...v(t)
2690
+ effect: { type: "preprocess", transform: s },
2691
+ typeName: y.ZodEffects,
2692
+ ..._(t)
2723
2693
  });
2724
- class E extends g {
2694
+ class I extends v {
2725
2695
  _parse(e) {
2726
2696
  return this._getType(e) === f.undefined ? S(void 0) : this._def.innerType._parse(e);
2727
2697
  }
@@ -2729,12 +2699,12 @@ class E extends g {
2729
2699
  return this._def.innerType;
2730
2700
  }
2731
2701
  }
2732
- E.create = (r, e) => new E({
2733
- innerType: r,
2734
- typeName: _.ZodOptional,
2735
- ...v(e)
2702
+ I.create = (s, e) => new I({
2703
+ innerType: s,
2704
+ typeName: y.ZodOptional,
2705
+ ..._(e)
2736
2706
  });
2737
- class U extends g {
2707
+ class W extends v {
2738
2708
  _parse(e) {
2739
2709
  return this._getType(e) === f.null ? S(null) : this._def.innerType._parse(e);
2740
2710
  }
@@ -2742,17 +2712,17 @@ class U extends g {
2742
2712
  return this._def.innerType;
2743
2713
  }
2744
2714
  }
2745
- U.create = (r, e) => new U({
2746
- innerType: r,
2747
- typeName: _.ZodNullable,
2748
- ...v(e)
2715
+ W.create = (s, e) => new W({
2716
+ innerType: s,
2717
+ typeName: y.ZodNullable,
2718
+ ..._(e)
2749
2719
  });
2750
- class ye extends g {
2720
+ class ke extends v {
2751
2721
  _parse(e) {
2752
2722
  const { ctx: t } = this._processInputParams(e);
2753
- let s = t.data;
2754
- return t.parsedType === f.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2755
- data: s,
2723
+ let r = t.data;
2724
+ return t.parsedType === f.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
2725
+ data: r,
2756
2726
  path: t.path,
2757
2727
  parent: t
2758
2728
  });
@@ -2761,42 +2731,42 @@ class ye extends g {
2761
2731
  return this._def.innerType;
2762
2732
  }
2763
2733
  }
2764
- ye.create = (r, e) => new ye({
2765
- innerType: r,
2766
- typeName: _.ZodDefault,
2734
+ ke.create = (s, e) => new ke({
2735
+ innerType: s,
2736
+ typeName: y.ZodDefault,
2767
2737
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2768
- ...v(e)
2738
+ ..._(e)
2769
2739
  });
2770
- class ve extends g {
2740
+ class we extends v {
2771
2741
  _parse(e) {
2772
- const { ctx: t } = this._processInputParams(e), s = {
2742
+ const { ctx: t } = this._processInputParams(e), r = {
2773
2743
  ...t,
2774
2744
  common: {
2775
2745
  ...t.common,
2776
2746
  issues: []
2777
2747
  }
2778
2748
  }, n = this._def.innerType._parse({
2779
- data: s.data,
2780
- path: s.path,
2749
+ data: r.data,
2750
+ path: r.path,
2781
2751
  parent: {
2782
- ...s
2752
+ ...r
2783
2753
  }
2784
2754
  });
2785
- return oe(n) ? n.then((a) => ({
2755
+ return fe(n) ? n.then((a) => ({
2786
2756
  status: "valid",
2787
2757
  value: a.status === "valid" ? a.value : this._def.catchValue({
2788
2758
  get error() {
2789
- return new Z(s.common.issues);
2759
+ return new O(r.common.issues);
2790
2760
  },
2791
- input: s.data
2761
+ input: r.data
2792
2762
  })
2793
2763
  })) : {
2794
2764
  status: "valid",
2795
2765
  value: n.status === "valid" ? n.value : this._def.catchValue({
2796
2766
  get error() {
2797
- return new Z(s.common.issues);
2767
+ return new O(r.common.issues);
2798
2768
  },
2799
- input: s.data
2769
+ input: r.data
2800
2770
  })
2801
2771
  };
2802
2772
  }
@@ -2804,35 +2774,35 @@ class ve extends g {
2804
2774
  return this._def.innerType;
2805
2775
  }
2806
2776
  }
2807
- ve.create = (r, e) => new ve({
2808
- innerType: r,
2809
- typeName: _.ZodCatch,
2777
+ we.create = (s, e) => new we({
2778
+ innerType: s,
2779
+ typeName: y.ZodCatch,
2810
2780
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2811
- ...v(e)
2781
+ ..._(e)
2812
2782
  });
2813
- class je extends g {
2783
+ class je extends v {
2814
2784
  _parse(e) {
2815
2785
  if (this._getType(e) !== f.nan) {
2816
- const s = this._getOrReturnCtx(e);
2817
- return l(s, {
2818
- code: u.invalid_type,
2786
+ const r = this._getOrReturnCtx(e);
2787
+ return l(r, {
2788
+ code: d.invalid_type,
2819
2789
  expected: f.nan,
2820
- received: s.parsedType
2821
- }), y;
2790
+ received: r.parsedType
2791
+ }), m;
2822
2792
  }
2823
2793
  return { status: "valid", value: e.data };
2824
2794
  }
2825
2795
  }
2826
- je.create = (r) => new je({
2827
- typeName: _.ZodNaN,
2828
- ...v(r)
2796
+ je.create = (s) => new je({
2797
+ typeName: y.ZodNaN,
2798
+ ..._(s)
2829
2799
  });
2830
2800
  const Vt = Symbol("zod_brand");
2831
- class Je extends g {
2801
+ class Ye extends v {
2832
2802
  _parse(e) {
2833
- const { ctx: t } = this._processInputParams(e), s = t.data;
2803
+ const { ctx: t } = this._processInputParams(e), r = t.data;
2834
2804
  return this._def.type._parse({
2835
- data: s,
2805
+ data: r,
2836
2806
  path: t.path,
2837
2807
  parent: t
2838
2808
  });
@@ -2841,374 +2811,372 @@ class Je extends g {
2841
2811
  return this._def.type;
2842
2812
  }
2843
2813
  }
2844
- class xe extends g {
2814
+ class Se extends v {
2845
2815
  _parse(e) {
2846
- const { status: t, ctx: s } = this._processInputParams(e);
2847
- if (s.common.async)
2816
+ const { status: t, ctx: r } = this._processInputParams(e);
2817
+ if (r.common.async)
2848
2818
  return (async () => {
2849
2819
  const a = await this._def.in._parseAsync({
2850
- data: s.data,
2851
- path: s.path,
2852
- parent: s
2820
+ data: r.data,
2821
+ path: r.path,
2822
+ parent: r
2853
2823
  });
2854
- return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), K(a.value)) : this._def.out._parseAsync({
2824
+ return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), ne(a.value)) : this._def.out._parseAsync({
2855
2825
  data: a.value,
2856
- path: s.path,
2857
- parent: s
2826
+ path: r.path,
2827
+ parent: r
2858
2828
  });
2859
2829
  })();
2860
2830
  {
2861
2831
  const n = this._def.in._parseSync({
2862
- data: s.data,
2863
- path: s.path,
2864
- parent: s
2832
+ data: r.data,
2833
+ path: r.path,
2834
+ parent: r
2865
2835
  });
2866
- return n.status === "aborted" ? y : n.status === "dirty" ? (t.dirty(), {
2836
+ return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), {
2867
2837
  status: "dirty",
2868
2838
  value: n.value
2869
2839
  }) : this._def.out._parseSync({
2870
2840
  data: n.value,
2871
- path: s.path,
2872
- parent: s
2841
+ path: r.path,
2842
+ parent: r
2873
2843
  });
2874
2844
  }
2875
2845
  }
2876
2846
  static create(e, t) {
2877
- return new xe({
2847
+ return new Se({
2878
2848
  in: e,
2879
2849
  out: t,
2880
- typeName: _.ZodPipeline
2850
+ typeName: y.ZodPipeline
2881
2851
  });
2882
2852
  }
2883
2853
  }
2884
- class ge extends g {
2854
+ class Te extends v {
2885
2855
  _parse(e) {
2886
- const t = this._def.innerType._parse(e), s = (n) => (q(n) && (n.value = Object.freeze(n.value)), n);
2887
- return oe(t) ? t.then((n) => s(n)) : s(t);
2856
+ const t = this._def.innerType._parse(e), r = (n) => (K(n) && (n.value = Object.freeze(n.value)), n);
2857
+ return fe(t) ? t.then((n) => r(n)) : r(t);
2888
2858
  }
2889
2859
  unwrap() {
2890
2860
  return this._def.innerType;
2891
2861
  }
2892
2862
  }
2893
- ge.create = (r, e) => new ge({
2894
- innerType: r,
2895
- typeName: _.ZodReadonly,
2896
- ...v(e)
2863
+ Te.create = (s, e) => new Te({
2864
+ innerType: s,
2865
+ typeName: y.ZodReadonly,
2866
+ ..._(e)
2897
2867
  });
2898
- function Ye(r, e) {
2899
- const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
2868
+ function Xe(s, e) {
2869
+ const t = typeof s == "function" ? s(e) : typeof s == "string" ? { message: s } : s;
2900
2870
  return typeof t == "string" ? { message: t } : t;
2901
2871
  }
2902
- function st(r, e = {}, t) {
2903
- return r ? ee.create().superRefine((s, n) => {
2904
- var a, i;
2905
- const o = r(s);
2906
- if (o instanceof Promise)
2907
- return o.then((c) => {
2908
- var d, h;
2909
- if (!c) {
2910
- const b = Ye(e, s), C = (h = (d = b.fatal) !== null && d !== void 0 ? d : t) !== null && h !== void 0 ? h : !0;
2911
- n.addIssue({ code: "custom", ...b, fatal: C });
2872
+ function ot(s, e = {}, t) {
2873
+ return s ? oe.create().superRefine((r, n) => {
2874
+ const a = s(r);
2875
+ if (a instanceof Promise)
2876
+ return a.then((i) => {
2877
+ if (!i) {
2878
+ const o = Xe(e, r), c = o.fatal ?? t ?? !0;
2879
+ n.addIssue({ code: "custom", ...o, fatal: c });
2912
2880
  }
2913
2881
  });
2914
- if (!o) {
2915
- const c = Ye(e, s), d = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
2916
- n.addIssue({ code: "custom", ...c, fatal: d });
2882
+ if (!a) {
2883
+ const i = Xe(e, r), o = i.fatal ?? t ?? !0;
2884
+ n.addIssue({ code: "custom", ...i, fatal: o });
2917
2885
  }
2918
- }) : ee.create();
2886
+ }) : oe.create();
2919
2887
  }
2920
- const Lt = {
2888
+ const zt = {
2921
2889
  object: k.lazycreate
2922
2890
  };
2923
- var _;
2924
- (function(r) {
2925
- r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
2926
- })(_ || (_ = {}));
2927
- const zt = (r, e = {
2928
- message: `Input not instance of ${r.name}`
2929
- }) => st((t) => t instanceof r, e), nt = O.create, at = V.create, Ut = je.create, Bt = L.create, it = ce.create, Ft = W.create, qt = Ce.create, Wt = de.create, Jt = ue.create, Ht = ee.create, Yt = F.create, Gt = P.create, Kt = Ze.create, Xt = j.create, Qt = k.create, er = k.strictCreate, tr = le.create, rr = Ee.create, sr = fe.create, nr = N.create, ar = he.create, ir = Oe.create, or = J.create, cr = X.create, dr = pe.create, ur = me.create, lr = z.create, fr = _e.create, hr = te.create, Ge = A.create, pr = E.create, mr = U.create, _r = A.createWithPreprocess, yr = xe.create, vr = () => nt().optional(), gr = () => at().optional(), xr = () => it().optional(), br = {
2930
- string: (r) => O.create({ ...r, coerce: !0 }),
2931
- number: (r) => V.create({ ...r, coerce: !0 }),
2932
- boolean: (r) => ce.create({
2933
- ...r,
2891
+ var y;
2892
+ (function(s) {
2893
+ s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly";
2894
+ })(y || (y = {}));
2895
+ const Bt = (s, e = {
2896
+ message: `Input not instance of ${s.name}`
2897
+ }) => ot((t) => t instanceof s, e), g = R.create, Ke = U.create, Ut = je.create, qt = q.create, Ce = he.create, Ft = G.create, Wt = Re.create, Jt = pe.create, Qt = me.create, Ht = oe.create, Yt = Y.create, Kt = z.create, Gt = Ee.create, A = E.create, j = k.create, Xt = k.strictCreate, es = ye.create, ts = $e.create, ss = _e.create, rs = P.create, ct = ge.create, ns = Ne.create, as = X.create, is = ae.create, os = ve.create, cs = xe.create, ds = F.create, us = be.create, ls = ce.create, et = N.create, fs = I.create, hs = W.create, ps = N.createWithPreprocess, ms = Se.create, ys = () => g().optional(), _s = () => Ke().optional(), gs = () => Ce().optional(), vs = {
2898
+ string: ((s) => R.create({ ...s, coerce: !0 })),
2899
+ number: ((s) => U.create({ ...s, coerce: !0 })),
2900
+ boolean: ((s) => he.create({
2901
+ ...s,
2934
2902
  coerce: !0
2935
- }),
2936
- bigint: (r) => L.create({ ...r, coerce: !0 }),
2937
- date: (r) => W.create({ ...r, coerce: !0 })
2938
- }, kr = y;
2939
- var p = /* @__PURE__ */ Object.freeze({
2903
+ })),
2904
+ bigint: ((s) => q.create({ ...s, coerce: !0 })),
2905
+ date: ((s) => G.create({ ...s, coerce: !0 }))
2906
+ }, xs = m, bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2940
2907
  __proto__: null,
2941
- defaultErrorMap: Q,
2942
- setErrorMap: _t,
2943
- getErrorMap: we,
2944
- makeIssue: Te,
2945
- EMPTY_PATH: yt,
2946
- addIssueToContext: l,
2947
- ParseStatus: T,
2948
- INVALID: y,
2949
- DIRTY: K,
2950
- OK: S,
2951
- isAborted: Fe,
2952
- isDirty: qe,
2953
- isValid: q,
2954
- isAsync: oe,
2955
- get util() {
2956
- return x;
2957
- },
2958
- get objectUtil() {
2959
- return Be;
2960
- },
2961
- ZodParsedType: f,
2962
- getParsedType: $,
2963
- ZodType: g,
2964
- datetimeRegex: tt,
2965
- ZodString: O,
2966
- ZodNumber: V,
2967
- ZodBigInt: L,
2968
- ZodBoolean: ce,
2969
- ZodDate: W,
2970
- ZodSymbol: Ce,
2971
- ZodUndefined: de,
2972
- ZodNull: ue,
2973
- ZodAny: ee,
2974
- ZodUnknown: F,
2975
- ZodNever: P,
2976
- ZodVoid: Ze,
2977
- ZodArray: j,
2978
- ZodObject: k,
2979
- ZodUnion: le,
2980
- ZodDiscriminatedUnion: Ee,
2981
- ZodIntersection: fe,
2982
- ZodTuple: N,
2983
- ZodRecord: he,
2984
- ZodMap: Oe,
2985
- ZodSet: J,
2986
- ZodFunction: X,
2987
- ZodLazy: pe,
2988
- ZodLiteral: me,
2989
- ZodEnum: z,
2990
- ZodNativeEnum: _e,
2991
- ZodPromise: te,
2992
- ZodEffects: A,
2993
- ZodTransformer: A,
2994
- ZodOptional: E,
2995
- ZodNullable: U,
2996
- ZodDefault: ye,
2997
- ZodCatch: ve,
2998
- ZodNaN: je,
2999
2908
  BRAND: Vt,
3000
- ZodBranded: Je,
3001
- ZodPipeline: xe,
3002
- ZodReadonly: ge,
3003
- custom: st,
3004
- Schema: g,
3005
- ZodSchema: g,
3006
- late: Lt,
2909
+ DIRTY: ne,
2910
+ EMPTY_PATH: gt,
2911
+ INVALID: m,
2912
+ NEVER: xs,
2913
+ OK: S,
2914
+ ParseStatus: T,
2915
+ Schema: v,
2916
+ ZodAny: oe,
2917
+ ZodArray: E,
2918
+ ZodBigInt: q,
2919
+ ZodBoolean: he,
2920
+ ZodBranded: Ye,
2921
+ ZodCatch: we,
2922
+ ZodDate: G,
2923
+ ZodDefault: ke,
2924
+ ZodDiscriminatedUnion: $e,
2925
+ ZodEffects: N,
2926
+ ZodEnum: F,
2927
+ ZodError: O,
3007
2928
  get ZodFirstPartyTypeKind() {
3008
- return _;
2929
+ return y;
3009
2930
  },
3010
- coerce: br,
2931
+ ZodFunction: ae,
2932
+ ZodIntersection: _e,
2933
+ ZodIssueCode: d,
2934
+ ZodLazy: ve,
2935
+ ZodLiteral: xe,
2936
+ ZodMap: Ne,
2937
+ ZodNaN: je,
2938
+ ZodNativeEnum: be,
2939
+ ZodNever: z,
2940
+ ZodNull: me,
2941
+ ZodNullable: W,
2942
+ ZodNumber: U,
2943
+ ZodObject: k,
2944
+ ZodOptional: I,
2945
+ ZodParsedType: f,
2946
+ ZodPipeline: Se,
2947
+ ZodPromise: ce,
2948
+ ZodReadonly: Te,
2949
+ ZodRecord: ge,
2950
+ ZodSchema: v,
2951
+ ZodSet: X,
2952
+ ZodString: R,
2953
+ ZodSymbol: Re,
2954
+ ZodTransformer: N,
2955
+ ZodTuple: P,
2956
+ ZodType: v,
2957
+ ZodUndefined: pe,
2958
+ ZodUnion: ye,
2959
+ ZodUnknown: Y,
2960
+ ZodVoid: Ee,
2961
+ addIssueToContext: l,
3011
2962
  any: Ht,
3012
- array: Xt,
3013
- bigint: Bt,
3014
- boolean: it,
2963
+ array: A,
2964
+ bigint: qt,
2965
+ boolean: Ce,
2966
+ coerce: vs,
2967
+ custom: ot,
3015
2968
  date: Ft,
3016
- discriminatedUnion: rr,
3017
- effect: Ge,
3018
- enum: lr,
3019
- function: cr,
3020
- instanceof: zt,
3021
- intersection: sr,
3022
- lazy: dr,
3023
- literal: ur,
3024
- map: ir,
2969
+ datetimeRegex: at,
2970
+ defaultErrorMap: ie,
2971
+ discriminatedUnion: ts,
2972
+ effect: et,
2973
+ enum: ds,
2974
+ function: is,
2975
+ getErrorMap: Oe,
2976
+ getParsedType: V,
2977
+ instanceof: Bt,
2978
+ intersection: ss,
2979
+ isAborted: We,
2980
+ isAsync: fe,
2981
+ isDirty: Je,
2982
+ isValid: K,
2983
+ late: zt,
2984
+ lazy: os,
2985
+ literal: cs,
2986
+ makeIssue: Ae,
2987
+ map: ns,
3025
2988
  nan: Ut,
3026
- nativeEnum: fr,
3027
- never: Gt,
3028
- null: Jt,
3029
- nullable: mr,
3030
- number: at,
3031
- object: Qt,
3032
- oboolean: xr,
3033
- onumber: gr,
3034
- optional: pr,
3035
- ostring: vr,
3036
- pipeline: yr,
3037
- preprocess: _r,
3038
- promise: hr,
3039
- record: ar,
3040
- set: or,
3041
- strictObject: er,
3042
- string: nt,
3043
- symbol: qt,
3044
- transformer: Ge,
3045
- tuple: nr,
3046
- undefined: Wt,
3047
- union: tr,
2989
+ nativeEnum: us,
2990
+ never: Kt,
2991
+ null: Qt,
2992
+ nullable: hs,
2993
+ number: Ke,
2994
+ object: j,
2995
+ get objectUtil() {
2996
+ return Fe;
2997
+ },
2998
+ oboolean: gs,
2999
+ onumber: _s,
3000
+ optional: fs,
3001
+ ostring: ys,
3002
+ pipeline: ms,
3003
+ preprocess: ps,
3004
+ promise: ls,
3005
+ quotelessJson: yt,
3006
+ record: ct,
3007
+ set: as,
3008
+ setErrorMap: _t,
3009
+ strictObject: Xt,
3010
+ string: g,
3011
+ symbol: Wt,
3012
+ transformer: et,
3013
+ tuple: rs,
3014
+ undefined: Jt,
3015
+ union: es,
3048
3016
  unknown: Yt,
3049
- void: Kt,
3050
- NEVER: kr,
3051
- ZodIssueCode: u,
3052
- quotelessJson: mt,
3053
- ZodError: Z
3054
- });
3055
- pt(p);
3056
- const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method + "@" + r, Sr = (r) => r.clone(), Cr = ({ skip: r = wr, key: e = Tr, resolver: t = Sr } = {}) => {
3057
- const s = /* @__PURE__ */ new Map();
3017
+ get util() {
3018
+ return x;
3019
+ },
3020
+ void: Gt
3021
+ }, Symbol.toStringTag, { value: "Module" }));
3022
+ mt(bs);
3023
+ const ks = (s, e) => e.skipDedupe || e.method !== "GET", ws = (s, e) => e.method + "@" + s, Ts = (s) => s.clone(), Ss = ({ skip: s = ks, key: e = ws, resolver: t = Ts } = {}) => {
3024
+ const r = /* @__PURE__ */ new Map();
3058
3025
  return (n) => (a, i) => {
3059
- if (r(a, i))
3026
+ if (s(a, i))
3060
3027
  return n(a, i);
3061
3028
  const o = e(a, i);
3062
- if (!s.has(o))
3063
- s.set(o, []);
3029
+ if (!r.has(o))
3030
+ r.set(o, []);
3064
3031
  else
3065
- return new Promise((c, d) => {
3066
- s.get(o).push([c, d]);
3032
+ return new Promise((c, u) => {
3033
+ r.get(o).push([c, u]);
3067
3034
  });
3068
3035
  try {
3069
- return n(a, i).then((c) => (s.get(o).forEach(([d]) => d(t(c))), s.delete(o), c)).catch((c) => {
3070
- throw s.get(o).forEach(([, d]) => d(c)), s.delete(o), c;
3036
+ return n(a, i).then((c) => (r.get(o).forEach(([u]) => u(t(c))), r.delete(o), c)).catch((c) => {
3037
+ throw r.get(o).forEach(([, u]) => u(c)), r.delete(o), c;
3071
3038
  });
3072
3039
  } catch (c) {
3073
- return s.delete(o), Promise.reject(c);
3040
+ return r.delete(o), Promise.reject(c);
3074
3041
  }
3075
3042
  };
3076
- }, Zr = (r, e) => r * e, Or = (r) => r && r.ok, jr = ({ delayTimer: r = 500, delayRamp: e = Zr, maxAttempts: t = 10, until: s = Or, onRetry: n = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (d, h) => {
3043
+ }, Cs = (s, e) => s * e, Os = (s) => s && (s.ok || s.status >= 400 && s.status < 500), As = ({ delayTimer: s = 500, delayRamp: e = Cs, maxAttempts: t = 10, until: r = Os, onRetry: n = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (u, p) => {
3077
3044
  let b = 0;
3078
- if (o && o(d, h))
3079
- return c(d, h);
3080
- const C = (w, M) => Promise.resolve(s(w, M)).then((Re) => Re ? w && i ? w : M ? Promise.reject(M) : w : (b++, !t || b <= t ? new Promise((D) => {
3081
- const be = e(r, b);
3045
+ if (o && o(u, p))
3046
+ return c(u, p);
3047
+ const C = (w, Z) => Promise.resolve(r(w, Z)).then((de) => de ? w && i ? w : Z ? Promise.reject(Z) : w : (b++, !t || b <= t ? new Promise((M) => {
3048
+ const J = e(s, b);
3082
3049
  setTimeout(() => {
3083
3050
  typeof n == "function" ? Promise.resolve(n({
3084
3051
  response: w,
3085
- error: M,
3086
- url: d,
3087
- options: h
3088
- })).then((B = {}) => {
3089
- var re, se;
3090
- D(c((re = B && B.url) !== null && re !== void 0 ? re : d, (se = B && B.options) !== null && se !== void 0 ? se : h));
3091
- }) : D(c(d, h));
3092
- }, be);
3093
- }).then(C).catch((D) => {
3052
+ error: Z,
3053
+ url: u,
3054
+ attempt: b,
3055
+ options: p
3056
+ })).then((D = {}) => {
3057
+ var ee, Q;
3058
+ M(c((ee = D && D.url) !== null && ee !== void 0 ? ee : u, (Q = D && D.options) !== null && Q !== void 0 ? Q : p));
3059
+ }) : M(c(u, p));
3060
+ }, J);
3061
+ }).then(C).catch((M) => {
3094
3062
  if (!a)
3095
- throw D;
3096
- return C(null, D);
3097
- }) : w && i ? w : Promise.reject(M || new Error("Number of attempts exceeded."))));
3098
- return c(d, h).then(C).catch((w) => {
3063
+ throw M;
3064
+ return C(null, M);
3065
+ }) : w && i ? w : Promise.reject(Z || new Error("Number of attempts exceeded."))));
3066
+ return c(u, p).then(C).catch((w) => {
3099
3067
  if (!a)
3100
3068
  throw w;
3101
3069
  return C(null, w);
3102
3070
  });
3103
- }, Ae = p.object({
3104
- code: p.number(),
3105
- message: p.string()
3106
- }), Ar = p.object({
3107
- message: p.string()
3108
- }), Er = p.object({
3109
- emails: p.array(p.string()).optional(),
3110
- http_body: p.string().optional(),
3111
- http_url: p.string().optional(),
3112
- txt_name: p.string().optional(),
3113
- txt_value: p.string().optional()
3114
- }), Rr = p.object({
3115
- ciphers: p.array(p.string()).optional(),
3116
- early_hints: p.string().optional(),
3117
- http2: p.string().optional(),
3118
- min_tls_version: p.string().optional(),
3119
- tls_1_3: p.string().optional()
3120
- }), Nr = p.object({
3121
- id: p.string(),
3122
- bundle_method: p.string().optional(),
3123
- certificate_authority: p.string(),
3124
- custom_certificate: p.string().optional(),
3125
- custom_csr_id: p.string().optional(),
3126
- custom_key: p.string().optional(),
3127
- expires_on: p.string().optional(),
3128
- hosts: p.array(p.string()).optional(),
3129
- issuer: p.string().optional(),
3130
- method: p.string(),
3131
- serial_number: p.string().optional(),
3132
- settings: Rr.optional(),
3133
- signature: p.string().optional(),
3134
- type: p.string(),
3135
- uploaded_on: p.string().optional(),
3136
- validation_errors: p.array(Ar).optional(),
3137
- validation_records: p.array(Er).optional(),
3138
- wildcard: p.boolean()
3139
- }), Ir = p.object({
3140
- name: p.string(),
3141
- type: p.string(),
3142
- value: p.string()
3143
- }), $r = p.object({
3144
- http_body: p.string().optional(),
3145
- http_url: p.string().optional()
3146
- }), ot = p.object({
3147
- id: p.string(),
3148
- ssl: Nr,
3149
- hostname: p.string(),
3150
- custom_metadata: p.record(p.string()).optional(),
3151
- custom_origin_server: p.string().optional(),
3152
- custom_origin_sni: p.string().optional(),
3153
- ownership_verification: Ir.optional(),
3154
- ownership_verification_http: $r.optional(),
3155
- status: p.string(),
3156
- verification_errors: p.array(p.string()).optional(),
3157
- created_at: p.string()
3158
- }), ze = p.object({
3159
- errors: p.array(Ae),
3160
- messages: p.array(Ae),
3161
- success: p.boolean(),
3162
- result: ot
3163
- }), Pr = p.object({
3164
- errors: p.array(Ae),
3165
- messages: p.array(Ae),
3166
- success: p.boolean(),
3167
- result: p.array(ot)
3071
+ }, Ze = j({
3072
+ code: Ke(),
3073
+ message: g()
3074
+ }), Rs = j({
3075
+ message: g()
3076
+ }), Es = j({
3077
+ emails: A(g()).optional(),
3078
+ http_body: g().optional(),
3079
+ http_url: g().optional(),
3080
+ txt_name: g().optional(),
3081
+ txt_value: g().optional()
3082
+ }), Ns = j({
3083
+ ciphers: A(g()).optional(),
3084
+ early_hints: g().optional(),
3085
+ http2: g().optional(),
3086
+ min_tls_version: g().optional(),
3087
+ tls_1_3: g().optional()
3088
+ }), js = j({
3089
+ id: g(),
3090
+ bundle_method: g().optional(),
3091
+ certificate_authority: g(),
3092
+ custom_certificate: g().optional(),
3093
+ custom_csr_id: g().optional(),
3094
+ custom_key: g().optional(),
3095
+ expires_on: g().optional(),
3096
+ hosts: A(g()).optional(),
3097
+ issuer: g().optional(),
3098
+ method: g(),
3099
+ serial_number: g().optional(),
3100
+ settings: Ns.optional(),
3101
+ signature: g().optional(),
3102
+ type: g(),
3103
+ uploaded_on: g().optional(),
3104
+ validation_errors: A(Rs).optional(),
3105
+ validation_records: A(Es).optional(),
3106
+ wildcard: Ce()
3107
+ }), Zs = j({
3108
+ name: g(),
3109
+ type: g(),
3110
+ value: g()
3111
+ }), Is = j({
3112
+ http_body: g().optional(),
3113
+ http_url: g().optional()
3114
+ }), dt = j({
3115
+ id: g(),
3116
+ ssl: js,
3117
+ hostname: g(),
3118
+ custom_metadata: ct(g()).optional(),
3119
+ custom_origin_server: g().optional(),
3120
+ custom_origin_sni: g().optional(),
3121
+ ownership_verification: Zs.optional(),
3122
+ ownership_verification_http: Is.optional(),
3123
+ status: g(),
3124
+ verification_errors: A(g()).optional(),
3125
+ created_at: g()
3126
+ }), Ue = j({
3127
+ errors: A(Ze),
3128
+ messages: A(Ze),
3129
+ success: Ce(),
3130
+ result: dt
3131
+ }), $s = j({
3132
+ errors: A(Ze),
3133
+ messages: A(Ze),
3134
+ success: Ce(),
3135
+ result: A(dt)
3168
3136
  });
3169
- function Y(r) {
3170
- return lt(`https://api.cloudflare.com/client/v4/zones/${r.zoneId}`).headers({
3171
- "X-Auth-Email": r.authEmail,
3172
- "X-Auth-Key": r.authKey,
3137
+ function se(s) {
3138
+ return ft(`https://api.cloudflare.com/client/v4/zones/${s.zoneId}`).headers({
3139
+ "X-Auth-Email": s.authEmail,
3140
+ "X-Auth-Key": s.authKey,
3173
3141
  "Content-Type": "application/json"
3174
- }).middlewares([jr(), Cr()]);
3142
+ }).middlewares([As(), Ss()]);
3175
3143
  }
3176
- function Ue(r) {
3144
+ function qe(s) {
3177
3145
  const e = [];
3178
- if (r.ssl.validation_records)
3179
- for (const t of r.ssl.validation_records)
3146
+ if (s.ssl.validation_records)
3147
+ for (const t of s.ssl.validation_records)
3180
3148
  t.txt_name && t.txt_value && e.push({
3181
3149
  name: "txt",
3182
3150
  record: t.txt_value,
3183
3151
  domain: t.txt_name
3184
3152
  });
3185
- return r.ownership_verification && e.push({
3153
+ return s.ownership_verification && e.push({
3186
3154
  name: "txt",
3187
- record: r.ownership_verification.value,
3188
- domain: r.ownership_verification.name
3155
+ record: s.ownership_verification.value,
3156
+ domain: s.ownership_verification.name
3189
3157
  }), {
3190
- custom_domain_id: r.id,
3191
- domain: r.hostname,
3192
- primary: r.primary,
3193
- status: r.status === "active" ? "ready" : "pending",
3158
+ custom_domain_id: s.id,
3159
+ domain: s.hostname,
3160
+ primary: s.primary,
3161
+ status: s.status === "active" ? "ready" : "pending",
3194
3162
  type: "auth0_managed_certs",
3195
3163
  verification: {
3196
- methods: p.array(ut).parse(e)
3164
+ methods: A(lt).parse(e)
3197
3165
  }
3198
3166
  };
3199
3167
  }
3200
- function Mr(r) {
3168
+ function Ps(s) {
3201
3169
  return {
3202
3170
  create: async (e, t) => {
3203
- const { result: s, errors: n, success: a } = ze.parse(
3204
- await Y(r).post(
3171
+ const { result: r, errors: n, success: a } = Ue.parse(
3172
+ await se(s).post(
3205
3173
  {
3206
3174
  hostname: t.domain,
3207
3175
  ssl: {
3208
3176
  method: "txt",
3209
3177
  type: "dv"
3210
3178
  },
3211
- custom_metadata: r.enterprise ? {
3179
+ custom_metadata: s.enterprise ? {
3212
3180
  tenant_id: e
3213
3181
  } : void 0
3214
3182
  },
@@ -3217,88 +3185,83 @@ function Mr(r) {
3217
3185
  );
3218
3186
  if (!a)
3219
3187
  throw new Error(JSON.stringify(n));
3220
- const i = Ue({
3221
- ...s,
3188
+ const i = qe({
3189
+ ...r,
3222
3190
  primary: !1
3223
3191
  });
3224
- return await r.customDomainAdapter.create(e, {
3192
+ return await s.customDomainAdapter.create(e, {
3225
3193
  custom_domain_id: i.custom_domain_id,
3226
3194
  domain: i.domain,
3227
3195
  type: i.type
3228
3196
  }), i;
3229
3197
  },
3230
3198
  get: async (e, t) => {
3231
- var c;
3232
- const s = await r.customDomainAdapter.get(
3199
+ const r = await s.customDomainAdapter.get(
3233
3200
  e,
3234
3201
  t
3235
3202
  );
3236
- if (!s)
3237
- throw new H(404);
3238
- const n = await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json(), { result: a, errors: i, success: o } = ze.parse(n);
3203
+ if (!r)
3204
+ throw new te(404);
3205
+ const n = await se(s).get(`/custom_hostnames/${encodeURIComponent(t)}`).json(), { result: a, errors: i, success: o } = Ue.parse(n);
3239
3206
  if (!o)
3240
- throw new H(503, {
3207
+ throw new te(503, {
3241
3208
  message: JSON.stringify(i)
3242
3209
  });
3243
- if (r.enterprise && ((c = a.custom_metadata) == null ? void 0 : c.tenant_id) !== e)
3244
- throw new H(404);
3245
- return Ue({ ...s, ...a });
3210
+ if (s.enterprise && a.custom_metadata?.tenant_id !== e)
3211
+ throw new te(404);
3212
+ return qe({ ...r, ...a });
3246
3213
  },
3247
- getByDomain: async (e) => r.customDomainAdapter.getByDomain(e),
3214
+ getByDomain: async (e) => s.customDomainAdapter.getByDomain(e),
3248
3215
  list: async (e) => {
3249
- const t = await r.customDomainAdapter.list(e), s = await Y(r).get("/custom_hostnames").json(), { result: n, errors: a, success: i } = Pr.parse(s);
3216
+ const t = await s.customDomainAdapter.list(e), r = await se(s).get("/custom_hostnames").json(), { result: n, errors: a, success: i } = $s.parse(r);
3250
3217
  if (!i)
3251
- throw new H(503, {
3218
+ throw new te(503, {
3252
3219
  message: JSON.stringify(a)
3253
3220
  });
3254
3221
  return n.filter(
3255
3222
  (o) => t.find((c) => c.custom_domain_id === o.id)
3256
3223
  ).filter(
3257
- (o) => {
3258
- var c;
3259
- return !(r.enterprise && ((c = o.custom_metadata) == null ? void 0 : c.tenant_id) !== e);
3260
- }
3224
+ (o) => !(s.enterprise && o.custom_metadata?.tenant_id !== e)
3261
3225
  ).map(
3262
- (o) => Ue({
3226
+ (o) => qe({
3263
3227
  ...t.find((c) => c.custom_domain_id === o.id),
3264
3228
  ...o
3265
3229
  })
3266
3230
  );
3267
3231
  },
3268
3232
  remove: async (e, t) => {
3269
- var n;
3270
- if (r.enterprise) {
3271
- const { result: a, success: i } = ze.parse(
3272
- await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json()
3233
+ if (s.enterprise) {
3234
+ const { result: n, success: a } = Ue.parse(
3235
+ await se(s).get(`/custom_hostnames/${encodeURIComponent(t)}`).json()
3273
3236
  );
3274
- if (!i || ((n = a.custom_metadata) == null ? void 0 : n.tenant_id) !== e)
3275
- throw new H(404);
3237
+ if (!a || n.custom_metadata?.tenant_id !== e)
3238
+ throw new te(404);
3276
3239
  }
3277
- const s = await Y(r).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();
3278
- return s.ok && await r.customDomainAdapter.remove(e, t), s.ok;
3240
+ const r = await se(s).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();
3241
+ return r.ok && await s.customDomainAdapter.remove(e, t), r.ok;
3279
3242
  },
3280
- update: async (e, t, s) => {
3281
- const n = await Y(r).patch(
3282
- s,
3243
+ update: async (e, t, r) => {
3244
+ const n = await se(s).patch(
3245
+ r,
3283
3246
  `/custom_hostnames/${encodeURIComponent(t)}`
3284
3247
  ).res();
3285
3248
  if (!n.ok)
3286
- throw new H(503, {
3249
+ throw new te(503, {
3287
3250
  message: await n.text()
3288
3251
  });
3289
- return r.customDomainAdapter.update(
3252
+ return s.customDomainAdapter.update(
3290
3253
  e,
3291
3254
  t,
3292
- s
3255
+ r
3293
3256
  );
3294
3257
  }
3295
3258
  };
3296
3259
  }
3297
- class Dr {
3260
+ class Ms {
3298
3261
  constructor(e) {
3299
- ke(this, "cache", null);
3300
3262
  this.config = e;
3301
3263
  }
3264
+ cache = null;
3302
3265
  async getCache() {
3303
3266
  if (this.cache)
3304
3267
  return this.cache;
@@ -3316,7 +3279,7 @@ class Dr {
3316
3279
  }
3317
3280
  async get(e) {
3318
3281
  try {
3319
- const t = await this.getCache(), s = this.createRequest(e), n = await t.match(s);
3282
+ const t = await this.getCache(), r = this.createRequest(e), n = await t.match(r);
3320
3283
  if (!n)
3321
3284
  return null;
3322
3285
  const a = await n.json();
@@ -3325,28 +3288,28 @@ class Dr {
3325
3288
  return console.error(`CloudflareCache: get error for key ${e}:`, t), null;
3326
3289
  }
3327
3290
  }
3328
- async set(e, t, s) {
3291
+ async set(e, t, r) {
3329
3292
  try {
3330
- const n = await this.getCache(), a = s ?? this.config.defaultTtlSeconds, i = a !== void 0, o = i ? Math.max(0, a) : 0, c = {
3293
+ const n = await this.getCache(), a = r ?? this.config.defaultTtlSeconds, i = a !== void 0, o = i ? Math.max(0, a) : 0, c = {
3331
3294
  value: t,
3332
3295
  expiresAt: i ? new Date(Date.now() + (o > 0 ? o * 1e3 : -1)).toISOString() : void 0,
3333
3296
  cachedAt: (/* @__PURE__ */ new Date()).toISOString()
3334
- }, d = this.createRequest(e), h = {
3297
+ }, u = this.createRequest(e), p = {
3335
3298
  "Content-Type": "application/json"
3336
3299
  };
3337
- i && o > 0 && (h["Cache-Control"] = `max-age=${o}`);
3300
+ i && o > 0 && (p["Cache-Control"] = `max-age=${o}`);
3338
3301
  const b = new Response(JSON.stringify(c), {
3339
- headers: h
3302
+ headers: p
3340
3303
  });
3341
- await n.put(d, b);
3304
+ await n.put(u, b);
3342
3305
  } catch (n) {
3343
3306
  console.error(`CloudflareCache: set error for key ${e}:`, n);
3344
3307
  }
3345
3308
  }
3346
3309
  async delete(e) {
3347
3310
  try {
3348
- const t = await this.getCache(), s = this.createRequest(e);
3349
- return await t.delete(s);
3311
+ const t = await this.getCache(), r = this.createRequest(e);
3312
+ return await t.delete(r);
3350
3313
  } catch (t) {
3351
3314
  return console.error(`CloudflareCache: delete error for key ${e}:`, t), !1;
3352
3315
  }
@@ -3357,30 +3320,273 @@ class Dr {
3357
3320
  );
3358
3321
  }
3359
3322
  }
3360
- function Vr(r = {}) {
3323
+ function Ds(s = {}) {
3361
3324
  const e = {
3362
3325
  defaultTtlSeconds: 300,
3363
3326
  // 5 minutes default
3364
3327
  keyPrefix: "authhero",
3365
3328
  // default prefix
3366
- ...r
3329
+ ...s
3367
3330
  // user config overrides defaults
3368
3331
  };
3369
- return new Dr(e);
3332
+ return new Ms(e);
3333
+ }
3334
+ const Ls = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3335
+ let Vs = (s = 21) => {
3336
+ let e = "", t = crypto.getRandomValues(new Uint8Array(s |= 0));
3337
+ for (; s--; )
3338
+ e += Ls[t[s] & 63];
3339
+ return e;
3340
+ };
3341
+ async function He(s, e) {
3342
+ const t = s.timeout || 3e4, r = new AbortController(), n = setTimeout(() => r.abort(), t);
3343
+ try {
3344
+ const a = `https://api.sql.cloudflarestorage.com/api/v1/accounts/${s.accountId}/r2-sql/query/${s.warehouseName}`, i = await fetch(a, {
3345
+ method: "POST",
3346
+ headers: {
3347
+ "Content-Type": "application/json",
3348
+ Authorization: `Bearer ${s.authToken}`
3349
+ },
3350
+ // Request body should be shaped as { "query": "..." }
3351
+ body: JSON.stringify({
3352
+ query: e
3353
+ }),
3354
+ signal: r.signal
3355
+ });
3356
+ if (!i.ok)
3357
+ throw new Error(
3358
+ `R2 SQL query failed: ${i.status} ${i.statusText}`
3359
+ );
3360
+ const o = await i.json();
3361
+ if (!o.success && o.errors)
3362
+ throw new Error(`R2 SQL error: ${o.errors.join(", ")}`);
3363
+ return o.data || o.result?.data || [];
3364
+ } finally {
3365
+ clearTimeout(n);
3366
+ }
3370
3367
  }
3371
- function Br(r) {
3368
+ function Ie(s) {
3369
+ return `'${s.replace(/'/g, "''")}'`;
3370
+ }
3371
+ function B(s) {
3372
+ return `"${s.replace(/"/g, '""')}"`;
3373
+ }
3374
+ function ut(s) {
3375
+ const e = (t) => {
3376
+ if (!t)
3377
+ return "";
3378
+ try {
3379
+ return JSON.parse(t);
3380
+ } catch {
3381
+ return t;
3382
+ }
3383
+ };
3372
3384
  return {
3373
- customDomains: Mr(r),
3385
+ type: s.type,
3386
+ date: s.date,
3387
+ description: s.description,
3388
+ ip: s.ip,
3389
+ user_agent: s.user_agent,
3390
+ details: e(s.details),
3391
+ isMobile: !!s.isMobile,
3392
+ user_id: s.user_id,
3393
+ user_name: s.user_name,
3394
+ connection: s.connection,
3395
+ connection_id: s.connection_id,
3396
+ client_id: s.client_id,
3397
+ client_name: s.client_name,
3398
+ audience: s.audience,
3399
+ scope: s.scope ? s.scope.split(",") : void 0,
3400
+ strategy: s.strategy,
3401
+ strategy_type: s.strategy_type,
3402
+ hostname: s.hostname,
3403
+ auth0_client: e(s.auth0_client),
3404
+ log_id: s.id
3405
+ };
3406
+ }
3407
+ function zs(s) {
3408
+ return async (e, t) => {
3409
+ if (console.log("createLog called with config:", s), s.baseAdapter) {
3410
+ const a = await s.baseAdapter.create(e, t);
3411
+ return (s.pipelineEndpoint || s.pipelineBinding) && tt(s, e, a).catch((i) => {
3412
+ console.error("Failed to send log to Pipeline:", i);
3413
+ }), a;
3414
+ }
3415
+ const r = t.log_id || Vs(), n = {
3416
+ ...t,
3417
+ log_id: r
3418
+ };
3419
+ return await tt(s, e, n), console.log("Log sent to Pipeline with ID:", r), n;
3420
+ };
3421
+ }
3422
+ async function tt(s, e, t) {
3423
+ const r = (c) => c ? JSON.stringify(c) : void 0, n = {
3424
+ id: t.log_id,
3425
+ tenant_id: e,
3426
+ type: t.type,
3427
+ date: t.date,
3428
+ description: t.description?.substring(0, 256),
3429
+ ip: t.ip,
3430
+ user_agent: t.user_agent,
3431
+ details: r(t.details)?.substring(0, 8192),
3432
+ isMobile: t.isMobile ? 1 : 0,
3433
+ user_id: t.user_id,
3434
+ user_name: t.user_name,
3435
+ connection: t.connection,
3436
+ connection_id: t.connection_id,
3437
+ client_id: t.client_id,
3438
+ client_name: t.client_name,
3439
+ audience: t.audience,
3440
+ scope: t.scope?.join(","),
3441
+ strategy: t.strategy,
3442
+ strategy_type: t.strategy_type,
3443
+ hostname: t.hostname,
3444
+ auth0_client: r(t.auth0_client),
3445
+ log_id: t.log_id
3446
+ }, a = s.timeout || 3e4, i = new AbortController(), o = setTimeout(() => i.abort(), a);
3447
+ try {
3448
+ let c;
3449
+ if (s.pipelineBinding)
3450
+ c = await s.pipelineBinding.fetch("https://pipeline", {
3451
+ method: "POST",
3452
+ headers: {
3453
+ "Content-Type": "application/json"
3454
+ },
3455
+ body: JSON.stringify([n]),
3456
+ // Pipelines accept array of records
3457
+ signal: i.signal
3458
+ });
3459
+ else if (s.pipelineEndpoint)
3460
+ c = await fetch(s.pipelineEndpoint, {
3461
+ method: "POST",
3462
+ headers: {
3463
+ "Content-Type": "application/json"
3464
+ },
3465
+ body: JSON.stringify([n]),
3466
+ // Pipelines accept array of records
3467
+ signal: i.signal
3468
+ });
3469
+ else
3470
+ throw new Error(
3471
+ "Either pipelineEndpoint or pipelineBinding must be configured"
3472
+ );
3473
+ if (!c.ok)
3474
+ throw new Error(
3475
+ `Pipeline ingestion failed: ${c.status} ${c.statusText}`
3476
+ );
3477
+ } finally {
3478
+ clearTimeout(o);
3479
+ }
3480
+ }
3481
+ function Bs(s) {
3482
+ return async (e, t) => {
3483
+ if (s.baseAdapter)
3484
+ return s.baseAdapter.get(e, t);
3485
+ const r = s.namespace || "default", n = s.tableName || "logs", a = `
3486
+ SELECT * FROM ${B(r)}.${B(n)}
3487
+ WHERE tenant_id = ${Ie(e)}
3488
+ AND id = ${Ie(t)}
3489
+ LIMIT 1
3490
+ `, i = await He(s, a);
3491
+ if (i.length === 0)
3492
+ return null;
3493
+ const o = i[0];
3494
+ return o ? ut(o) : null;
3495
+ };
3496
+ }
3497
+ function Us(s) {
3498
+ const e = {};
3499
+ return (s.match(/(\w+):(\S+)/g) || []).forEach((r) => {
3500
+ const [n, a] = r.split(":");
3501
+ n && a && (e[n] = a);
3502
+ }), e;
3503
+ }
3504
+ function qs(s) {
3505
+ const e = [];
3506
+ for (const [t, r] of Object.entries(s)) {
3507
+ const n = t.replace(/[^a-zA-Z0-9_]/g, "");
3508
+ n && r && e.push(
3509
+ `${B(n)} = ${Ie(r)}`
3510
+ );
3511
+ }
3512
+ return e;
3513
+ }
3514
+ function Fs(s) {
3515
+ return async (e, t = {}) => {
3516
+ if (s.baseAdapter)
3517
+ return s.baseAdapter.list(e, t);
3518
+ const { page: r = 0, per_page: n = 50, include_totals: a = !1, sort: i, q: o } = t, c = s.namespace || "default", u = s.tableName || "logs", p = [
3519
+ `tenant_id = ${Ie(e)}`
3520
+ ];
3521
+ if (o) {
3522
+ const H = Us(o);
3523
+ p.push(...qs(H));
3524
+ }
3525
+ const b = p.join(" AND ");
3526
+ let C = "ORDER BY date DESC";
3527
+ if (i && i.sort_by) {
3528
+ const H = i.sort_by.replace(/[^a-zA-Z0-9_]/g, ""), ue = i.sort_order === "asc" ? "ASC" : "DESC";
3529
+ C = `ORDER BY ${B(H)} ${ue}`;
3530
+ }
3531
+ const w = r * n, Z = `LIMIT ${n} OFFSET ${w}`, de = `
3532
+ SELECT * FROM ${B(c)}.${B(u)}
3533
+ WHERE ${b}
3534
+ ${C}
3535
+ ${Z}
3536
+ `, J = (await He(s, de)).map(ut);
3537
+ if (!a)
3538
+ return {
3539
+ logs: J,
3540
+ start: 0,
3541
+ limit: 0,
3542
+ length: 0
3543
+ };
3544
+ const D = `
3545
+ SELECT COUNT(*) as count FROM ${B(c)}.${B(u)}
3546
+ WHERE ${b}
3547
+ `, Q = (await He(s, D))[0]?.count || 0;
3548
+ return {
3549
+ logs: J,
3550
+ start: w,
3551
+ limit: n,
3552
+ length: Number(Q)
3553
+ };
3554
+ };
3555
+ }
3556
+ function Ws(s) {
3557
+ const e = !!s.baseAdapter, t = !!s.pipelineEndpoint, r = !!s.pipelineBinding;
3558
+ if (!e && !t && !r)
3559
+ throw new Error(
3560
+ 'R2 SQL logs adapter requires one of: "baseAdapter", "pipelineEndpoint", or "pipelineBinding"'
3561
+ );
3562
+ if (!e) {
3563
+ if (!s.authToken)
3564
+ throw new Error('R2 SQL logs adapter requires "authToken" configuration');
3565
+ if (!s.warehouseName)
3566
+ throw new Error(
3567
+ 'R2 SQL logs adapter requires "warehouseName" configuration'
3568
+ );
3569
+ }
3570
+ return {
3571
+ create: zs(s),
3572
+ list: Fs(s),
3573
+ get: Bs(s)
3574
+ };
3575
+ }
3576
+ function Hs(s) {
3577
+ const e = {
3578
+ customDomains: Ps(s),
3374
3579
  // Always create a cache adapter (let createCloudflareCache apply defaults)
3375
- cache: Vr({
3376
- ...r.cacheName && { cacheName: r.cacheName },
3377
- ...r.defaultTtlSeconds !== void 0 && {
3378
- defaultTtlSeconds: r.defaultTtlSeconds
3580
+ cache: Ds({
3581
+ ...s.cacheName && { cacheName: s.cacheName },
3582
+ ...s.defaultTtlSeconds !== void 0 && {
3583
+ defaultTtlSeconds: s.defaultTtlSeconds
3379
3584
  },
3380
- ...r.keyPrefix && { keyPrefix: r.keyPrefix }
3585
+ ...s.keyPrefix && { keyPrefix: s.keyPrefix }
3381
3586
  })
3382
3587
  };
3588
+ return s.r2SqlLogs && (e.logs = Ws(s.r2SqlLogs)), e;
3383
3589
  }
3384
3590
  export {
3385
- Br as default
3591
+ Hs as default
3386
3592
  };