@resconet/qp-bridge 1.1.0 → 1.1.1-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -1,29 +1,30 @@
1
- let ve;
2
- const Fe = new Uint8Array(16);
3
- function et() {
4
- if (!ve && (ve = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ve))
1
+ let X;
2
+ const Ue = new Uint8Array(16);
3
+ function Ve() {
4
+ if (!X && (X = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !X))
5
5
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
6
- return ve(Fe);
6
+ return X(Ue);
7
7
  }
8
- const k = [];
8
+ const S = [];
9
9
  for (let t = 0; t < 256; ++t)
10
- k.push((t + 256).toString(16).slice(1));
11
- function tt(t, e = 0) {
12
- return k[t[e + 0]] + k[t[e + 1]] + k[t[e + 2]] + k[t[e + 3]] + "-" + k[t[e + 4]] + k[t[e + 5]] + "-" + k[t[e + 6]] + k[t[e + 7]] + "-" + k[t[e + 8]] + k[t[e + 9]] + "-" + k[t[e + 10]] + k[t[e + 11]] + k[t[e + 12]] + k[t[e + 13]] + k[t[e + 14]] + k[t[e + 15]];
10
+ S.push((t + 256).toString(16).slice(1));
11
+ function Be(t, e = 0) {
12
+ return S[t[e + 0]] + S[t[e + 1]] + S[t[e + 2]] + S[t[e + 3]] + "-" + S[t[e + 4]] + S[t[e + 5]] + "-" + S[t[e + 6]] + S[t[e + 7]] + "-" + S[t[e + 8]] + S[t[e + 9]] + "-" + S[t[e + 10]] + S[t[e + 11]] + S[t[e + 12]] + S[t[e + 13]] + S[t[e + 14]] + S[t[e + 15]];
13
13
  }
14
- const st = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), je = {
15
- randomUUID: st
14
+ const ze = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ce = {
15
+ randomUUID: ze
16
16
  };
17
- function $e(t, e, s) {
18
- if (je.randomUUID && !e && !t)
19
- return je.randomUUID();
17
+ function Ee(t, e, s) {
18
+ if (Ce.randomUUID && !e && !t)
19
+ return Ce.randomUUID();
20
20
  t = t || {};
21
- const n = t.random || (t.rng || et)();
22
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, tt(n);
21
+ const n = t.random || (t.rng || Ve)();
22
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Be(n);
23
23
  }
24
- var x;
24
+ var v;
25
25
  (function(t) {
26
- t.assertEqual = (r) => r;
26
+ t.assertEqual = (r) => {
27
+ };
27
28
  function e(r) {
28
29
  }
29
30
  t.assertIs = e;
@@ -36,9 +37,9 @@ var x;
36
37
  a[i] = i;
37
38
  return a;
38
39
  }, t.getValidEnumValues = (r) => {
39
- const a = t.objectKeys(r).filter((o) => typeof r[r[o]] != "number"), i = {};
40
- for (const o of a)
41
- i[o] = r[o];
40
+ const a = t.objectKeys(r).filter((c) => typeof r[r[c]] != "number"), i = {};
41
+ for (const c of a)
42
+ i[c] = r[c];
42
43
  return t.objectValues(i);
43
44
  }, t.objectValues = (r) => t.objectKeys(r).map(function(a) {
44
45
  return r[a];
@@ -51,21 +52,21 @@ var x;
51
52
  for (const i of r)
52
53
  if (a(i))
53
54
  return i;
54
- }, t.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && isFinite(r) && Math.floor(r) === r;
55
+ }, t.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && Number.isFinite(r) && Math.floor(r) === r;
55
56
  function n(r, a = " | ") {
56
57
  return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
57
58
  }
58
59
  t.joinValues = n, t.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
59
- })(x || (x = {}));
60
- var Ze;
60
+ })(v || (v = {}));
61
+ var Te;
61
62
  (function(t) {
62
63
  t.mergeShapes = (e, s) => ({
63
64
  ...e,
64
65
  ...s
65
66
  // second overwrites first
66
67
  });
67
- })(Ze || (Ze = {}));
68
- const f = x.arrayToEnum([
68
+ })(Te || (Te = {}));
69
+ const d = v.arrayToEnum([
69
70
  "string",
70
71
  "nan",
71
72
  "number",
@@ -86,28 +87,28 @@ const f = x.arrayToEnum([
86
87
  "never",
87
88
  "map",
88
89
  "set"
89
- ]), q = (t) => {
90
+ ]), I = (t) => {
90
91
  switch (typeof t) {
91
92
  case "undefined":
92
- return f.undefined;
93
+ return d.undefined;
93
94
  case "string":
94
- return f.string;
95
+ return d.string;
95
96
  case "number":
96
- return isNaN(t) ? f.nan : f.number;
97
+ return Number.isNaN(t) ? d.nan : d.number;
97
98
  case "boolean":
98
- return f.boolean;
99
+ return d.boolean;
99
100
  case "function":
100
- return f.function;
101
+ return d.function;
101
102
  case "bigint":
102
- return f.bigint;
103
+ return d.bigint;
103
104
  case "symbol":
104
- return f.symbol;
105
+ return d.symbol;
105
106
  case "object":
106
- return Array.isArray(t) ? f.array : t === null ? f.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? f.promise : typeof Map < "u" && t instanceof Map ? f.map : typeof Set < "u" && t instanceof Set ? f.set : typeof Date < "u" && t instanceof Date ? f.date : f.object;
107
+ return Array.isArray(t) ? d.array : t === null ? d.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? d.promise : typeof Map < "u" && t instanceof Map ? d.map : typeof Set < "u" && t instanceof Set ? d.set : typeof Date < "u" && t instanceof Date ? d.date : d.object;
107
108
  default:
108
- return f.unknown;
109
+ return d.unknown;
109
110
  }
110
- }, c = x.arrayToEnum([
111
+ }, o = v.arrayToEnum([
111
112
  "invalid_type",
112
113
  "invalid_literal",
113
114
  "custom",
@@ -124,8 +125,11 @@ const f = x.arrayToEnum([
124
125
  "invalid_intersection_types",
125
126
  "not_multiple_of",
126
127
  "not_finite"
127
- ]), nt = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
128
+ ]);
128
129
  class E extends Error {
130
+ get errors() {
131
+ return this.issues;
132
+ }
129
133
  constructor(e) {
130
134
  super(), this.issues = [], this.addIssue = (n) => {
131
135
  this.issues = [...this.issues, n];
@@ -135,9 +139,6 @@ class E extends Error {
135
139
  const s = new.target.prototype;
136
140
  Object.setPrototypeOf ? Object.setPrototypeOf(this, s) : this.__proto__ = s, this.name = "ZodError", this.issues = e;
137
141
  }
138
- get errors() {
139
- return this.issues;
140
- }
141
142
  format(e) {
142
143
  const s = e || function(a) {
143
144
  return a.message;
@@ -152,10 +153,10 @@ class E extends Error {
152
153
  else if (i.path.length === 0)
153
154
  n._errors.push(s(i));
154
155
  else {
155
- let o = n, d = 0;
156
- for (; d < i.path.length; ) {
157
- const u = i.path[d];
158
- d === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(s(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], d++;
156
+ let c = n, f = 0;
157
+ for (; f < i.path.length; ) {
158
+ const h = i.path[f];
159
+ f === i.path.length - 1 ? (c[h] = c[h] || { _errors: [] }, c[h]._errors.push(s(i))) : c[h] = c[h] || { _errors: [] }, c = c[h], f++;
159
160
  }
160
161
  }
161
162
  };
@@ -169,7 +170,7 @@ class E extends Error {
169
170
  return this.message;
170
171
  }
171
172
  get message() {
172
- return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
173
+ return JSON.stringify(this.issues, v.jsonStringifyReplacer, 2);
173
174
  }
174
175
  get isEmpty() {
175
176
  return this.issues.length === 0;
@@ -177,7 +178,11 @@ class E extends Error {
177
178
  flatten(e = (s) => s.message) {
178
179
  const s = {}, n = [];
179
180
  for (const r of this.issues)
180
- r.path.length > 0 ? (s[r.path[0]] = s[r.path[0]] || [], s[r.path[0]].push(e(r))) : n.push(e(r));
181
+ if (r.path.length > 0) {
182
+ const a = r.path[0];
183
+ s[a] = s[a] || [], s[a].push(e(r));
184
+ } else
185
+ n.push(e(r));
181
186
  return { formErrors: n, fieldErrors: s };
182
187
  }
183
188
  get formErrors() {
@@ -185,70 +190,67 @@ class E extends Error {
185
190
  }
186
191
  }
187
192
  E.create = (t) => new E(t);
188
- const Y = (t, e) => {
193
+ const ce = (t, e) => {
189
194
  let s;
190
195
  switch (t.code) {
191
- case c.invalid_type:
192
- t.received === f.undefined ? s = "Required" : s = `Expected ${t.expected}, received ${t.received}`;
196
+ case o.invalid_type:
197
+ t.received === d.undefined ? s = "Required" : s = `Expected ${t.expected}, received ${t.received}`;
193
198
  break;
194
- case c.invalid_literal:
195
- s = `Invalid literal value, expected ${JSON.stringify(t.expected, x.jsonStringifyReplacer)}`;
199
+ case o.invalid_literal:
200
+ s = `Invalid literal value, expected ${JSON.stringify(t.expected, v.jsonStringifyReplacer)}`;
196
201
  break;
197
- case c.unrecognized_keys:
198
- s = `Unrecognized key(s) in object: ${x.joinValues(t.keys, ", ")}`;
202
+ case o.unrecognized_keys:
203
+ s = `Unrecognized key(s) in object: ${v.joinValues(t.keys, ", ")}`;
199
204
  break;
200
- case c.invalid_union:
205
+ case o.invalid_union:
201
206
  s = "Invalid input";
202
207
  break;
203
- case c.invalid_union_discriminator:
204
- s = `Invalid discriminator value. Expected ${x.joinValues(t.options)}`;
208
+ case o.invalid_union_discriminator:
209
+ s = `Invalid discriminator value. Expected ${v.joinValues(t.options)}`;
205
210
  break;
206
- case c.invalid_enum_value:
207
- s = `Invalid enum value. Expected ${x.joinValues(t.options)}, received '${t.received}'`;
211
+ case o.invalid_enum_value:
212
+ s = `Invalid enum value. Expected ${v.joinValues(t.options)}, received '${t.received}'`;
208
213
  break;
209
- case c.invalid_arguments:
214
+ case o.invalid_arguments:
210
215
  s = "Invalid function arguments";
211
216
  break;
212
- case c.invalid_return_type:
217
+ case o.invalid_return_type:
213
218
  s = "Invalid function return type";
214
219
  break;
215
- case c.invalid_date:
220
+ case o.invalid_date:
216
221
  s = "Invalid date";
217
222
  break;
218
- case c.invalid_string:
219
- typeof t.validation == "object" ? "includes" in t.validation ? (s = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (s = `${s} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? s = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? s = `Invalid input: must end with "${t.validation.endsWith}"` : x.assertNever(t.validation) : t.validation !== "regex" ? s = `Invalid ${t.validation}` : s = "Invalid";
223
+ case o.invalid_string:
224
+ typeof t.validation == "object" ? "includes" in t.validation ? (s = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (s = `${s} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? s = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? s = `Invalid input: must end with "${t.validation.endsWith}"` : v.assertNever(t.validation) : t.validation !== "regex" ? s = `Invalid ${t.validation}` : s = "Invalid";
220
225
  break;
221
- case c.too_small:
222
- t.type === "array" ? s = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? s = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? s = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? s = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : s = "Invalid input";
226
+ case o.too_small:
227
+ t.type === "array" ? s = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? s = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? s = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? s = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? s = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : s = "Invalid input";
223
228
  break;
224
- case c.too_big:
229
+ case o.too_big:
225
230
  t.type === "array" ? s = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? s = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? s = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? s = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? s = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : s = "Invalid input";
226
231
  break;
227
- case c.custom:
232
+ case o.custom:
228
233
  s = "Invalid input";
229
234
  break;
230
- case c.invalid_intersection_types:
235
+ case o.invalid_intersection_types:
231
236
  s = "Intersection results could not be merged";
232
237
  break;
233
- case c.not_multiple_of:
238
+ case o.not_multiple_of:
234
239
  s = `Number must be a multiple of ${t.multipleOf}`;
235
240
  break;
236
- case c.not_finite:
241
+ case o.not_finite:
237
242
  s = "Number must be finite";
238
243
  break;
239
244
  default:
240
- s = e.defaultError, x.assertNever(t);
245
+ s = e.defaultError, v.assertNever(t);
241
246
  }
242
247
  return { message: s };
243
248
  };
244
- let Ue = Y;
245
- function rt(t) {
246
- Ue = t;
249
+ let De = ce;
250
+ function Ge() {
251
+ return De;
247
252
  }
248
- function _e() {
249
- return Ue;
250
- }
251
- const xe = (t) => {
253
+ const Fe = (t) => {
252
254
  const { data: e, path: s, errorMaps: n, issueData: r } = t, a = [...s, ...r.path || []], i = {
253
255
  ...r,
254
256
  path: a
@@ -259,32 +261,35 @@ const xe = (t) => {
259
261
  path: a,
260
262
  message: r.message
261
263
  };
262
- let o = "";
263
- const d = n.filter((u) => !!u).slice().reverse();
264
- for (const u of d)
265
- o = u(i, { data: e, defaultError: o }).message;
264
+ let c = "";
265
+ const f = n.filter((h) => !!h).slice().reverse();
266
+ for (const h of f)
267
+ c = h(i, { data: e, defaultError: c }).message;
266
268
  return {
267
269
  ...r,
268
270
  path: a,
269
- message: o
271
+ message: c
270
272
  };
271
- }, at = [];
272
- function l(t, e) {
273
- const s = _e(), n = xe({
273
+ };
274
+ function u(t, e) {
275
+ const s = Ge(), n = Fe({
274
276
  issueData: e,
275
277
  data: t.data,
276
278
  path: t.path,
277
279
  errorMaps: [
278
280
  t.common.contextualErrorMap,
281
+ // contextual error map is first priority
279
282
  t.schemaErrorMap,
283
+ // then schema-bound map if available
280
284
  s,
281
- s === Y ? void 0 : Y
285
+ // then global override map
286
+ s === ce ? void 0 : ce
282
287
  // then global default map
283
288
  ].filter((r) => !!r)
284
289
  });
285
290
  t.common.issues.push(n);
286
291
  }
287
- class S {
292
+ class R {
288
293
  constructor() {
289
294
  this.value = "valid";
290
295
  }
@@ -298,7 +303,7 @@ class S {
298
303
  const n = [];
299
304
  for (const r of s) {
300
305
  if (r.status === "aborted")
301
- return y;
306
+ return p;
302
307
  r.status === "dirty" && e.dirty(), n.push(r.value);
303
308
  }
304
309
  return { status: e.value, value: n };
@@ -312,47 +317,36 @@ class S {
312
317
  value: i
313
318
  });
314
319
  }
315
- return S.mergeObjectSync(e, n);
320
+ return R.mergeObjectSync(e, n);
316
321
  }
317
322
  static mergeObjectSync(e, s) {
318
323
  const n = {};
319
324
  for (const r of s) {
320
325
  const { key: a, value: i } = r;
321
326
  if (a.status === "aborted" || i.status === "aborted")
322
- return y;
327
+ return p;
323
328
  a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || r.alwaysSet) && (n[a.value] = i.value);
324
329
  }
325
330
  return { status: e.value, value: n };
326
331
  }
327
332
  }
328
- const y = Object.freeze({
333
+ const p = Object.freeze({
329
334
  status: "aborted"
330
- }), W = (t) => ({ status: "dirty", value: t }), T = (t) => ({ status: "valid", value: t }), Ne = (t) => t.status === "aborted", Me = (t) => t.status === "dirty", se = (t) => t.status === "valid", ne = (t) => typeof Promise < "u" && t instanceof Promise;
331
- function be(t, e, s, n) {
332
- if (typeof e == "function" ? t !== e || !n : !e.has(t))
333
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
334
- return e.get(t);
335
- }
336
- function Le(t, e, s, n, r) {
337
- if (typeof e == "function" ? t !== e || !r : !e.has(t))
338
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
339
- return e.set(t, s), s;
340
- }
341
- var p;
335
+ }), W = (t) => ({ status: "dirty", value: t }), T = (t) => ({ status: "valid", value: t }), Ae = (t) => t.status === "aborted", Ne = (t) => t.status === "dirty", V = (t) => t.status === "valid", K = (t) => typeof Promise < "u" && t instanceof Promise;
336
+ var l;
342
337
  (function(t) {
343
338
  t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
344
- })(p || (p = {}));
345
- var F, ee;
346
- class O {
339
+ })(l || (l = {}));
340
+ class N {
347
341
  constructor(e, s, n, r) {
348
342
  this._cachedPath = [], this.parent = e, this.data = s, this._path = n, this._key = r;
349
343
  }
350
344
  get path() {
351
- return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
345
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
352
346
  }
353
347
  }
354
- const Pe = (t, e) => {
355
- if (se(e))
348
+ const Oe = (t, e) => {
349
+ if (V(e))
356
350
  return { success: !0, data: e.value };
357
351
  if (!t.common.issues.length)
358
352
  throw new Error("Validation failed but no issues detected.");
@@ -366,33 +360,29 @@ const Pe = (t, e) => {
366
360
  }
367
361
  };
368
362
  };
369
- function v(t) {
363
+ function g(t) {
370
364
  if (!t)
371
365
  return {};
372
366
  const { errorMap: e, invalid_type_error: s, required_error: n, description: r } = t;
373
367
  if (e && (s || n))
374
368
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
375
- return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
376
- var d, u;
377
- const { message: g } = t;
378
- return i.code === "invalid_enum_value" ? { message: g ?? o.defaultError } : typeof o.data > "u" ? { message: (d = g ?? n) !== null && d !== void 0 ? d : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = g ?? s) !== null && u !== void 0 ? u : o.defaultError };
369
+ return e ? { errorMap: e, description: r } : { errorMap: (i, c) => {
370
+ const { message: f } = t;
371
+ return i.code === "invalid_enum_value" ? { message: f ?? c.defaultError } : typeof c.data > "u" ? { message: f ?? n ?? c.defaultError } : i.code !== "invalid_type" ? { message: c.defaultError } : { message: f ?? s ?? c.defaultError };
379
372
  }, description: r };
380
373
  }
381
- class _ {
382
- constructor(e) {
383
- this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this);
384
- }
374
+ class y {
385
375
  get description() {
386
376
  return this._def.description;
387
377
  }
388
378
  _getType(e) {
389
- return q(e.data);
379
+ return I(e.data);
390
380
  }
391
381
  _getOrReturnCtx(e, s) {
392
382
  return s || {
393
383
  common: e.parent.common,
394
384
  data: e.data,
395
- parsedType: q(e.data),
385
+ parsedType: I(e.data),
396
386
  schemaErrorMap: this._def.errorMap,
397
387
  path: e.path,
398
388
  parent: e.parent
@@ -400,11 +390,11 @@ class _ {
400
390
  }
401
391
  _processInputParams(e) {
402
392
  return {
403
- status: new S(),
393
+ status: new R(),
404
394
  ctx: {
405
395
  common: e.parent.common,
406
396
  data: e.data,
407
- parsedType: q(e.data),
397
+ parsedType: I(e.data),
408
398
  schemaErrorMap: this._def.errorMap,
409
399
  path: e.path,
410
400
  parent: e.parent
@@ -413,7 +403,7 @@ class _ {
413
403
  }
414
404
  _parseSync(e) {
415
405
  const s = this._parse(e);
416
- if (ne(s))
406
+ if (K(s))
417
407
  throw new Error("Synchronous parse encountered promise.");
418
408
  return s;
419
409
  }
@@ -428,20 +418,52 @@ class _ {
428
418
  throw n.error;
429
419
  }
430
420
  safeParse(e, s) {
431
- var n;
432
- const r = {
421
+ const n = {
433
422
  common: {
434
423
  issues: [],
435
- async: (n = s == null ? void 0 : s.async) !== null && n !== void 0 ? n : !1,
424
+ async: (s == null ? void 0 : s.async) ?? !1,
436
425
  contextualErrorMap: s == null ? void 0 : s.errorMap
437
426
  },
438
427
  path: (s == null ? void 0 : s.path) || [],
439
428
  schemaErrorMap: this._def.errorMap,
440
429
  parent: null,
441
430
  data: e,
442
- parsedType: q(e)
443
- }, a = this._parseSync({ data: e, path: r.path, parent: r });
444
- return Pe(r, a);
431
+ parsedType: I(e)
432
+ }, r = this._parseSync({ data: e, path: n.path, parent: n });
433
+ return Oe(n, r);
434
+ }
435
+ "~validate"(e) {
436
+ var n, r;
437
+ const s = {
438
+ common: {
439
+ issues: [],
440
+ async: !!this["~standard"].async
441
+ },
442
+ path: [],
443
+ schemaErrorMap: this._def.errorMap,
444
+ parent: null,
445
+ data: e,
446
+ parsedType: I(e)
447
+ };
448
+ if (!this["~standard"].async)
449
+ try {
450
+ const a = this._parseSync({ data: e, path: [], parent: s });
451
+ return V(a) ? {
452
+ value: a.value
453
+ } : {
454
+ issues: s.common.issues
455
+ };
456
+ } catch (a) {
457
+ (r = (n = a == null ? void 0 : a.message) == null ? void 0 : n.toLowerCase()) != null && r.includes("encountered") && (this["~standard"].async = !0), s.common = {
458
+ issues: [],
459
+ async: !0
460
+ };
461
+ }
462
+ return this._parseAsync({ data: e, path: [], parent: s }).then((a) => V(a) ? {
463
+ value: a.value
464
+ } : {
465
+ issues: s.common.issues
466
+ });
445
467
  }
446
468
  async parseAsync(e, s) {
447
469
  const n = await this.safeParseAsync(e, s);
@@ -460,25 +482,25 @@ class _ {
460
482
  schemaErrorMap: this._def.errorMap,
461
483
  parent: null,
462
484
  data: e,
463
- parsedType: q(e)
464
- }, r = this._parse({ data: e, path: n.path, parent: n }), a = await (ne(r) ? r : Promise.resolve(r));
465
- return Pe(n, a);
485
+ parsedType: I(e)
486
+ }, r = this._parse({ data: e, path: n.path, parent: n }), a = await (K(r) ? r : Promise.resolve(r));
487
+ return Oe(n, a);
466
488
  }
467
489
  refine(e, s) {
468
490
  const n = (r) => typeof s == "string" || typeof s > "u" ? { message: s } : typeof s == "function" ? s(r) : s;
469
491
  return this._refinement((r, a) => {
470
- const i = e(r), o = () => a.addIssue({
471
- code: c.custom,
492
+ const i = e(r), c = () => a.addIssue({
493
+ code: o.custom,
472
494
  ...n(r)
473
495
  });
474
- return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
496
+ return typeof Promise < "u" && i instanceof Promise ? i.then((f) => f ? !0 : (c(), !1)) : i ? !0 : (c(), !1);
475
497
  });
476
498
  }
477
499
  refinement(e, s) {
478
500
  return this._refinement((n, r) => e(n) ? !0 : (r.addIssue(typeof s == "function" ? s(n, r) : s), !1));
479
501
  }
480
502
  _refinement(e) {
481
- return new M({
503
+ return new j({
482
504
  schema: this,
483
505
  typeName: m.ZodEffects,
484
506
  effect: { type: "refinement", refinement: e }
@@ -487,30 +509,37 @@ class _ {
487
509
  superRefine(e) {
488
510
  return this._refinement(e);
489
511
  }
512
+ constructor(e) {
513
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
514
+ version: 1,
515
+ vendor: "zod",
516
+ validate: (s) => this["~validate"](s)
517
+ };
518
+ }
490
519
  optional() {
491
- return I.create(this, this._def);
520
+ return M.create(this, this._def);
492
521
  }
493
522
  nullable() {
494
- return V.create(this, this._def);
523
+ return F.create(this, this._def);
495
524
  }
496
525
  nullish() {
497
526
  return this.nullable().optional();
498
527
  }
499
528
  array() {
500
- return N.create(this, this._def);
529
+ return A.create(this);
501
530
  }
502
531
  promise() {
503
- return X.create(this, this._def);
532
+ return ne.create(this, this._def);
504
533
  }
505
534
  or(e) {
506
- return oe.create([this, e], this._def);
535
+ return ee.create([this, e], this._def);
507
536
  }
508
537
  and(e) {
509
- return ce.create(this, e, this._def);
538
+ return te.create(this, e, this._def);
510
539
  }
511
540
  transform(e) {
512
- return new M({
513
- ...v(this._def),
541
+ return new j({
542
+ ...g(this._def),
514
543
  schema: this,
515
544
  typeName: m.ZodEffects,
516
545
  effect: { type: "transform", transform: e }
@@ -518,24 +547,24 @@ class _ {
518
547
  }
519
548
  default(e) {
520
549
  const s = typeof e == "function" ? e : () => e;
521
- return new he({
522
- ...v(this._def),
550
+ return new xe({
551
+ ...g(this._def),
523
552
  innerType: this,
524
553
  defaultValue: s,
525
554
  typeName: m.ZodDefault
526
555
  });
527
556
  }
528
557
  brand() {
529
- return new Oe({
558
+ return new pt({
530
559
  typeName: m.ZodBranded,
531
560
  type: this,
532
- ...v(this._def)
561
+ ...g(this._def)
533
562
  });
534
563
  }
535
564
  catch(e) {
536
565
  const s = typeof e == "function" ? e : () => e;
537
- return new pe({
538
- ...v(this._def),
566
+ return new be({
567
+ ...g(this._def),
539
568
  innerType: this,
540
569
  catchValue: s,
541
570
  typeName: m.ZodCatch
@@ -549,10 +578,10 @@ class _ {
549
578
  });
550
579
  }
551
580
  pipe(e) {
552
- return ge.create(this, e);
581
+ return Se.create(this, e);
553
582
  }
554
583
  readonly() {
555
- return me.create(this);
584
+ return we.create(this);
556
585
  }
557
586
  isOptional() {
558
587
  return this.safeParse(void 0).success;
@@ -561,40 +590,58 @@ class _ {
561
590
  return this.safeParse(null).success;
562
591
  }
563
592
  }
564
- const it = /^c[^\s-]{8,}$/i, ot = /^[0-9a-z]+$/, ct = /^[0-9A-HJKMNP-TV-Z]{26}$/, ut = /^[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, dt = /^[a-z0-9_-]{21}$/i, lt = /^[-+]?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)?)??$/, ft = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ht = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
565
- let Ce;
566
- const pt = /^(?:(?: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])$/, mt = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, gt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ve = "((\\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])))", yt = new RegExp(`^${Ve}$`);
567
- function De(t) {
568
- let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
569
- return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
593
+ const Qe = /^c[^\s-]{8,}$/i, We = /^[0-9a-z]+$/, Je = /^[0-9A-HJKMNP-TV-Z]{26}$/i, He = /^[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, Ye = /^[a-z0-9_-]{21}$/i, Xe = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ke = /^[-+]?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)?)??$/, et = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, tt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
594
+ let ie;
595
+ const st = /^(?:(?: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])$/, nt = /^(?:(?: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])$/, rt = /^(([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])$/, it = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ct = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ie = "((\\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])))", ot = new RegExp(`^${Ie}$`);
596
+ function Me(t) {
597
+ let e = "[0-5]\\d";
598
+ t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
599
+ const s = t.precision ? "+" : "?";
600
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`;
570
601
  }
571
- function vt(t) {
572
- return new RegExp(`^${De(t)}$`);
602
+ function ut(t) {
603
+ return new RegExp(`^${Me(t)}$`);
573
604
  }
574
- function Be(t) {
575
- let e = `${Ve}T${De(t)}`;
605
+ function dt(t) {
606
+ let e = `${Ie}T${Me(t)}`;
576
607
  const s = [];
577
608
  return s.push(t.local ? "Z?" : "Z"), t.offset && s.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${s.join("|")})`, new RegExp(`^${e}$`);
578
609
  }
579
- function _t(t, e) {
580
- return !!((e === "v4" || !e) && pt.test(t) || (e === "v6" || !e) && mt.test(t));
610
+ function lt(t, e) {
611
+ return !!((e === "v4" || !e) && st.test(t) || (e === "v6" || !e) && rt.test(t));
612
+ }
613
+ function ft(t, e) {
614
+ if (!Xe.test(t))
615
+ return !1;
616
+ try {
617
+ const [s] = t.split(".");
618
+ if (!s)
619
+ return !1;
620
+ const n = s.replace(/-/g, "+").replace(/_/g, "/").padEnd(s.length + (4 - s.length % 4) % 4, "="), r = JSON.parse(atob(n));
621
+ return !(typeof r != "object" || r === null || "typ" in r && (r == null ? void 0 : r.typ) !== "JWT" || !r.alg || e && r.alg !== e);
622
+ } catch {
623
+ return !1;
624
+ }
625
+ }
626
+ function ht(t, e) {
627
+ return !!((e === "v4" || !e) && nt.test(t) || (e === "v6" || !e) && at.test(t));
581
628
  }
582
- class Z extends _ {
629
+ class O extends y {
583
630
  _parse(e) {
584
- if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
631
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== d.string) {
585
632
  const a = this._getOrReturnCtx(e);
586
- return l(a, {
587
- code: c.invalid_type,
588
- expected: f.string,
633
+ return u(a, {
634
+ code: o.invalid_type,
635
+ expected: d.string,
589
636
  received: a.parsedType
590
- }), y;
637
+ }), p;
591
638
  }
592
- const n = new S();
639
+ const n = new R();
593
640
  let r;
594
641
  for (const a of this._def.checks)
595
642
  if (a.kind === "min")
596
- e.data.length < a.value && (r = this._getOrReturnCtx(e, r), l(r, {
597
- code: c.too_small,
643
+ e.data.length < a.value && (r = this._getOrReturnCtx(e, r), u(r, {
644
+ code: o.too_small,
598
645
  minimum: a.value,
599
646
  type: "string",
600
647
  inclusive: !0,
@@ -602,8 +649,8 @@ class Z extends _ {
602
649
  message: a.message
603
650
  }), n.dirty());
604
651
  else if (a.kind === "max")
605
- e.data.length > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
606
- code: c.too_big,
652
+ e.data.length > a.value && (r = this._getOrReturnCtx(e, r), u(r, {
653
+ code: o.too_big,
607
654
  maximum: a.value,
608
655
  type: "string",
609
656
  inclusive: !0,
@@ -611,16 +658,16 @@ class Z extends _ {
611
658
  message: a.message
612
659
  }), n.dirty());
613
660
  else if (a.kind === "length") {
614
- const i = e.data.length > a.value, o = e.data.length < a.value;
615
- (i || o) && (r = this._getOrReturnCtx(e, r), i ? l(r, {
616
- code: c.too_big,
661
+ const i = e.data.length > a.value, c = e.data.length < a.value;
662
+ (i || c) && (r = this._getOrReturnCtx(e, r), i ? u(r, {
663
+ code: o.too_big,
617
664
  maximum: a.value,
618
665
  type: "string",
619
666
  inclusive: !0,
620
667
  exact: !0,
621
668
  message: a.message
622
- }) : o && l(r, {
623
- code: c.too_small,
669
+ }) : c && u(r, {
670
+ code: o.too_small,
624
671
  minimum: a.value,
625
672
  type: "string",
626
673
  inclusive: !0,
@@ -628,146 +675,169 @@ class Z extends _ {
628
675
  message: a.message
629
676
  }), n.dirty());
630
677
  } else if (a.kind === "email")
631
- ft.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
678
+ et.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
632
679
  validation: "email",
633
- code: c.invalid_string,
680
+ code: o.invalid_string,
634
681
  message: a.message
635
682
  }), n.dirty());
636
683
  else if (a.kind === "emoji")
637
- Ce || (Ce = new RegExp(ht, "u")), Ce.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
684
+ ie || (ie = new RegExp(tt, "u")), ie.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
638
685
  validation: "emoji",
639
- code: c.invalid_string,
686
+ code: o.invalid_string,
640
687
  message: a.message
641
688
  }), n.dirty());
642
689
  else if (a.kind === "uuid")
643
- ut.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
690
+ He.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
644
691
  validation: "uuid",
645
- code: c.invalid_string,
692
+ code: o.invalid_string,
646
693
  message: a.message
647
694
  }), n.dirty());
648
695
  else if (a.kind === "nanoid")
649
- dt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
696
+ Ye.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
650
697
  validation: "nanoid",
651
- code: c.invalid_string,
698
+ code: o.invalid_string,
652
699
  message: a.message
653
700
  }), n.dirty());
654
701
  else if (a.kind === "cuid")
655
- it.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
702
+ Qe.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
656
703
  validation: "cuid",
657
- code: c.invalid_string,
704
+ code: o.invalid_string,
658
705
  message: a.message
659
706
  }), n.dirty());
660
707
  else if (a.kind === "cuid2")
661
- ot.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
708
+ We.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
662
709
  validation: "cuid2",
663
- code: c.invalid_string,
710
+ code: o.invalid_string,
664
711
  message: a.message
665
712
  }), n.dirty());
666
713
  else if (a.kind === "ulid")
667
- ct.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
714
+ Je.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
668
715
  validation: "ulid",
669
- code: c.invalid_string,
716
+ code: o.invalid_string,
670
717
  message: a.message
671
718
  }), n.dirty());
672
719
  else if (a.kind === "url")
673
720
  try {
674
721
  new URL(e.data);
675
722
  } catch {
676
- r = this._getOrReturnCtx(e, r), l(r, {
723
+ r = this._getOrReturnCtx(e, r), u(r, {
677
724
  validation: "url",
678
- code: c.invalid_string,
725
+ code: o.invalid_string,
679
726
  message: a.message
680
727
  }), n.dirty();
681
728
  }
682
729
  else
683
- a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
730
+ a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
684
731
  validation: "regex",
685
- code: c.invalid_string,
732
+ code: o.invalid_string,
686
733
  message: a.message
687
- }), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), l(r, {
688
- code: c.invalid_string,
734
+ }), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), u(r, {
735
+ code: o.invalid_string,
689
736
  validation: { includes: a.value, position: a.position },
690
737
  message: a.message
691
- }), n.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) || (r = this._getOrReturnCtx(e, r), l(r, {
692
- code: c.invalid_string,
738
+ }), n.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) || (r = this._getOrReturnCtx(e, r), u(r, {
739
+ code: o.invalid_string,
693
740
  validation: { startsWith: a.value },
694
741
  message: a.message
695
- }), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), l(r, {
696
- code: c.invalid_string,
742
+ }), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), u(r, {
743
+ code: o.invalid_string,
697
744
  validation: { endsWith: a.value },
698
745
  message: a.message
699
- }), n.dirty()) : a.kind === "datetime" ? Be(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
700
- code: c.invalid_string,
746
+ }), n.dirty()) : a.kind === "datetime" ? dt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
747
+ code: o.invalid_string,
701
748
  validation: "datetime",
702
749
  message: a.message
703
- }), n.dirty()) : a.kind === "date" ? yt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
704
- code: c.invalid_string,
750
+ }), n.dirty()) : a.kind === "date" ? ot.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
751
+ code: o.invalid_string,
705
752
  validation: "date",
706
753
  message: a.message
707
- }), n.dirty()) : a.kind === "time" ? vt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
708
- code: c.invalid_string,
754
+ }), n.dirty()) : a.kind === "time" ? ut(a).test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
755
+ code: o.invalid_string,
709
756
  validation: "time",
710
757
  message: a.message
711
- }), n.dirty()) : a.kind === "duration" ? lt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
758
+ }), n.dirty()) : a.kind === "duration" ? Ke.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
712
759
  validation: "duration",
713
- code: c.invalid_string,
760
+ code: o.invalid_string,
714
761
  message: a.message
715
- }), n.dirty()) : a.kind === "ip" ? _t(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
762
+ }), n.dirty()) : a.kind === "ip" ? lt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), u(r, {
716
763
  validation: "ip",
717
- code: c.invalid_string,
764
+ code: o.invalid_string,
718
765
  message: a.message
719
- }), n.dirty()) : a.kind === "base64" ? gt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
766
+ }), n.dirty()) : a.kind === "jwt" ? ft(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), u(r, {
767
+ validation: "jwt",
768
+ code: o.invalid_string,
769
+ message: a.message
770
+ }), n.dirty()) : a.kind === "cidr" ? ht(e.data, a.version) || (r = this._getOrReturnCtx(e, r), u(r, {
771
+ validation: "cidr",
772
+ code: o.invalid_string,
773
+ message: a.message
774
+ }), n.dirty()) : a.kind === "base64" ? it.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
720
775
  validation: "base64",
721
- code: c.invalid_string,
776
+ code: o.invalid_string,
722
777
  message: a.message
723
- }), n.dirty()) : x.assertNever(a);
778
+ }), n.dirty()) : a.kind === "base64url" ? ct.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
779
+ validation: "base64url",
780
+ code: o.invalid_string,
781
+ message: a.message
782
+ }), n.dirty()) : v.assertNever(a);
724
783
  return { status: n.value, value: e.data };
725
784
  }
726
785
  _regex(e, s, n) {
727
786
  return this.refinement((r) => e.test(r), {
728
787
  validation: s,
729
- code: c.invalid_string,
730
- ...p.errToObj(n)
788
+ code: o.invalid_string,
789
+ ...l.errToObj(n)
731
790
  });
732
791
  }
733
792
  _addCheck(e) {
734
- return new Z({
793
+ return new O({
735
794
  ...this._def,
736
795
  checks: [...this._def.checks, e]
737
796
  });
738
797
  }
739
798
  email(e) {
740
- return this._addCheck({ kind: "email", ...p.errToObj(e) });
799
+ return this._addCheck({ kind: "email", ...l.errToObj(e) });
741
800
  }
742
801
  url(e) {
743
- return this._addCheck({ kind: "url", ...p.errToObj(e) });
802
+ return this._addCheck({ kind: "url", ...l.errToObj(e) });
744
803
  }
745
804
  emoji(e) {
746
- return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
805
+ return this._addCheck({ kind: "emoji", ...l.errToObj(e) });
747
806
  }
748
807
  uuid(e) {
749
- return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
808
+ return this._addCheck({ kind: "uuid", ...l.errToObj(e) });
750
809
  }
751
810
  nanoid(e) {
752
- return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
811
+ return this._addCheck({ kind: "nanoid", ...l.errToObj(e) });
753
812
  }
754
813
  cuid(e) {
755
- return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
814
+ return this._addCheck({ kind: "cuid", ...l.errToObj(e) });
756
815
  }
757
816
  cuid2(e) {
758
- return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
817
+ return this._addCheck({ kind: "cuid2", ...l.errToObj(e) });
759
818
  }
760
819
  ulid(e) {
761
- return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
820
+ return this._addCheck({ kind: "ulid", ...l.errToObj(e) });
762
821
  }
763
822
  base64(e) {
764
- return this._addCheck({ kind: "base64", ...p.errToObj(e) });
823
+ return this._addCheck({ kind: "base64", ...l.errToObj(e) });
824
+ }
825
+ base64url(e) {
826
+ return this._addCheck({
827
+ kind: "base64url",
828
+ ...l.errToObj(e)
829
+ });
830
+ }
831
+ jwt(e) {
832
+ return this._addCheck({ kind: "jwt", ...l.errToObj(e) });
765
833
  }
766
834
  ip(e) {
767
- return this._addCheck({ kind: "ip", ...p.errToObj(e) });
835
+ return this._addCheck({ kind: "ip", ...l.errToObj(e) });
836
+ }
837
+ cidr(e) {
838
+ return this._addCheck({ kind: "cidr", ...l.errToObj(e) });
768
839
  }
769
840
  datetime(e) {
770
- var s, n;
771
841
  return typeof e == "string" ? this._addCheck({
772
842
  kind: "datetime",
773
843
  precision: null,
@@ -777,9 +847,9 @@ class Z extends _ {
777
847
  }) : this._addCheck({
778
848
  kind: "datetime",
779
849
  precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
780
- offset: (s = e == null ? void 0 : e.offset) !== null && s !== void 0 ? s : !1,
781
- local: (n = e == null ? void 0 : e.local) !== null && n !== void 0 ? n : !1,
782
- ...p.errToObj(e == null ? void 0 : e.message)
850
+ offset: (e == null ? void 0 : e.offset) ?? !1,
851
+ local: (e == null ? void 0 : e.local) ?? !1,
852
+ ...l.errToObj(e == null ? void 0 : e.message)
783
853
  });
784
854
  }
785
855
  date(e) {
@@ -793,17 +863,17 @@ class Z extends _ {
793
863
  }) : this._addCheck({
794
864
  kind: "time",
795
865
  precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
796
- ...p.errToObj(e == null ? void 0 : e.message)
866
+ ...l.errToObj(e == null ? void 0 : e.message)
797
867
  });
798
868
  }
799
869
  duration(e) {
800
- return this._addCheck({ kind: "duration", ...p.errToObj(e) });
870
+ return this._addCheck({ kind: "duration", ...l.errToObj(e) });
801
871
  }
802
872
  regex(e, s) {
803
873
  return this._addCheck({
804
874
  kind: "regex",
805
875
  regex: e,
806
- ...p.errToObj(s)
876
+ ...l.errToObj(s)
807
877
  });
808
878
  }
809
879
  includes(e, s) {
@@ -811,65 +881,64 @@ class Z extends _ {
811
881
  kind: "includes",
812
882
  value: e,
813
883
  position: s == null ? void 0 : s.position,
814
- ...p.errToObj(s == null ? void 0 : s.message)
884
+ ...l.errToObj(s == null ? void 0 : s.message)
815
885
  });
816
886
  }
817
887
  startsWith(e, s) {
818
888
  return this._addCheck({
819
889
  kind: "startsWith",
820
890
  value: e,
821
- ...p.errToObj(s)
891
+ ...l.errToObj(s)
822
892
  });
823
893
  }
824
894
  endsWith(e, s) {
825
895
  return this._addCheck({
826
896
  kind: "endsWith",
827
897
  value: e,
828
- ...p.errToObj(s)
898
+ ...l.errToObj(s)
829
899
  });
830
900
  }
831
901
  min(e, s) {
832
902
  return this._addCheck({
833
903
  kind: "min",
834
904
  value: e,
835
- ...p.errToObj(s)
905
+ ...l.errToObj(s)
836
906
  });
837
907
  }
838
908
  max(e, s) {
839
909
  return this._addCheck({
840
910
  kind: "max",
841
911
  value: e,
842
- ...p.errToObj(s)
912
+ ...l.errToObj(s)
843
913
  });
844
914
  }
845
915
  length(e, s) {
846
916
  return this._addCheck({
847
917
  kind: "length",
848
918
  value: e,
849
- ...p.errToObj(s)
919
+ ...l.errToObj(s)
850
920
  });
851
921
  }
852
922
  /**
853
- * @deprecated Use z.string().min(1) instead.
854
- * @see {@link ZodString.min}
923
+ * Equivalent to `.min(1)`
855
924
  */
856
925
  nonempty(e) {
857
- return this.min(1, p.errToObj(e));
926
+ return this.min(1, l.errToObj(e));
858
927
  }
859
928
  trim() {
860
- return new Z({
929
+ return new O({
861
930
  ...this._def,
862
931
  checks: [...this._def.checks, { kind: "trim" }]
863
932
  });
864
933
  }
865
934
  toLowerCase() {
866
- return new Z({
935
+ return new O({
867
936
  ...this._def,
868
937
  checks: [...this._def.checks, { kind: "toLowerCase" }]
869
938
  });
870
939
  }
871
940
  toUpperCase() {
872
- return new Z({
941
+ return new O({
873
942
  ...this._def,
874
943
  checks: [...this._def.checks, { kind: "toUpperCase" }]
875
944
  });
@@ -913,9 +982,15 @@ class Z extends _ {
913
982
  get isIP() {
914
983
  return !!this._def.checks.find((e) => e.kind === "ip");
915
984
  }
985
+ get isCIDR() {
986
+ return !!this._def.checks.find((e) => e.kind === "cidr");
987
+ }
916
988
  get isBase64() {
917
989
  return !!this._def.checks.find((e) => e.kind === "base64");
918
990
  }
991
+ get isBase64url() {
992
+ return !!this._def.checks.find((e) => e.kind === "base64url");
993
+ }
919
994
  get minLength() {
920
995
  let e = null;
921
996
  for (const s of this._def.checks)
@@ -929,78 +1004,75 @@ class Z extends _ {
929
1004
  return e;
930
1005
  }
931
1006
  }
932
- Z.create = (t) => {
933
- var e;
934
- return new Z({
935
- checks: [],
936
- typeName: m.ZodString,
937
- coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
938
- ...v(t)
939
- });
940
- };
941
- function xt(t, e) {
942
- const s = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = s > n ? s : n, a = parseInt(t.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
943
- return a % i / Math.pow(10, r);
1007
+ O.create = (t) => new O({
1008
+ checks: [],
1009
+ typeName: m.ZodString,
1010
+ coerce: (t == null ? void 0 : t.coerce) ?? !1,
1011
+ ...g(t)
1012
+ });
1013
+ function mt(t, e) {
1014
+ const s = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = s > n ? s : n, a = Number.parseInt(t.toFixed(r).replace(".", "")), i = Number.parseInt(e.toFixed(r).replace(".", ""));
1015
+ return a % i / 10 ** r;
944
1016
  }
945
- class $ extends _ {
1017
+ class B extends y {
946
1018
  constructor() {
947
1019
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
948
1020
  }
949
1021
  _parse(e) {
950
- if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
1022
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== d.number) {
951
1023
  const a = this._getOrReturnCtx(e);
952
- return l(a, {
953
- code: c.invalid_type,
954
- expected: f.number,
1024
+ return u(a, {
1025
+ code: o.invalid_type,
1026
+ expected: d.number,
955
1027
  received: a.parsedType
956
- }), y;
1028
+ }), p;
957
1029
  }
958
1030
  let n;
959
- const r = new S();
1031
+ const r = new R();
960
1032
  for (const a of this._def.checks)
961
- a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
962
- code: c.invalid_type,
1033
+ a.kind === "int" ? v.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
1034
+ code: o.invalid_type,
963
1035
  expected: "integer",
964
1036
  received: "float",
965
1037
  message: a.message
966
- }), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
967
- code: c.too_small,
1038
+ }), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
1039
+ code: o.too_small,
968
1040
  minimum: a.value,
969
1041
  type: "number",
970
1042
  inclusive: a.inclusive,
971
1043
  exact: !1,
972
1044
  message: a.message
973
- }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
974
- code: c.too_big,
1045
+ }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
1046
+ code: o.too_big,
975
1047
  maximum: a.value,
976
1048
  type: "number",
977
1049
  inclusive: a.inclusive,
978
1050
  exact: !1,
979
1051
  message: a.message
980
- }), r.dirty()) : a.kind === "multipleOf" ? xt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
981
- code: c.not_multiple_of,
1052
+ }), r.dirty()) : a.kind === "multipleOf" ? mt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), u(n, {
1053
+ code: o.not_multiple_of,
982
1054
  multipleOf: a.value,
983
1055
  message: a.message
984
- }), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
985
- code: c.not_finite,
1056
+ }), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
1057
+ code: o.not_finite,
986
1058
  message: a.message
987
- }), r.dirty()) : x.assertNever(a);
1059
+ }), r.dirty()) : v.assertNever(a);
988
1060
  return { status: r.value, value: e.data };
989
1061
  }
990
1062
  gte(e, s) {
991
- return this.setLimit("min", e, !0, p.toString(s));
1063
+ return this.setLimit("min", e, !0, l.toString(s));
992
1064
  }
993
1065
  gt(e, s) {
994
- return this.setLimit("min", e, !1, p.toString(s));
1066
+ return this.setLimit("min", e, !1, l.toString(s));
995
1067
  }
996
1068
  lte(e, s) {
997
- return this.setLimit("max", e, !0, p.toString(s));
1069
+ return this.setLimit("max", e, !0, l.toString(s));
998
1070
  }
999
1071
  lt(e, s) {
1000
- return this.setLimit("max", e, !1, p.toString(s));
1072
+ return this.setLimit("max", e, !1, l.toString(s));
1001
1073
  }
1002
1074
  setLimit(e, s, n, r) {
1003
- return new $({
1075
+ return new B({
1004
1076
  ...this._def,
1005
1077
  checks: [
1006
1078
  ...this._def.checks,
@@ -1008,13 +1080,13 @@ class $ extends _ {
1008
1080
  kind: e,
1009
1081
  value: s,
1010
1082
  inclusive: n,
1011
- message: p.toString(r)
1083
+ message: l.toString(r)
1012
1084
  }
1013
1085
  ]
1014
1086
  });
1015
1087
  }
1016
1088
  _addCheck(e) {
1017
- return new $({
1089
+ return new B({
1018
1090
  ...this._def,
1019
1091
  checks: [...this._def.checks, e]
1020
1092
  });
@@ -1022,7 +1094,7 @@ class $ extends _ {
1022
1094
  int(e) {
1023
1095
  return this._addCheck({
1024
1096
  kind: "int",
1025
- message: p.toString(e)
1097
+ message: l.toString(e)
1026
1098
  });
1027
1099
  }
1028
1100
  positive(e) {
@@ -1030,7 +1102,7 @@ class $ extends _ {
1030
1102
  kind: "min",
1031
1103
  value: 0,
1032
1104
  inclusive: !1,
1033
- message: p.toString(e)
1105
+ message: l.toString(e)
1034
1106
  });
1035
1107
  }
1036
1108
  negative(e) {
@@ -1038,7 +1110,7 @@ class $ extends _ {
1038
1110
  kind: "max",
1039
1111
  value: 0,
1040
1112
  inclusive: !1,
1041
- message: p.toString(e)
1113
+ message: l.toString(e)
1042
1114
  });
1043
1115
  }
1044
1116
  nonpositive(e) {
@@ -1046,7 +1118,7 @@ class $ extends _ {
1046
1118
  kind: "max",
1047
1119
  value: 0,
1048
1120
  inclusive: !0,
1049
- message: p.toString(e)
1121
+ message: l.toString(e)
1050
1122
  });
1051
1123
  }
1052
1124
  nonnegative(e) {
@@ -1054,20 +1126,20 @@ class $ extends _ {
1054
1126
  kind: "min",
1055
1127
  value: 0,
1056
1128
  inclusive: !0,
1057
- message: p.toString(e)
1129
+ message: l.toString(e)
1058
1130
  });
1059
1131
  }
1060
1132
  multipleOf(e, s) {
1061
1133
  return this._addCheck({
1062
1134
  kind: "multipleOf",
1063
1135
  value: e,
1064
- message: p.toString(s)
1136
+ message: l.toString(s)
1065
1137
  });
1066
1138
  }
1067
1139
  finite(e) {
1068
1140
  return this._addCheck({
1069
1141
  kind: "finite",
1070
- message: p.toString(e)
1142
+ message: l.toString(e)
1071
1143
  });
1072
1144
  }
1073
1145
  safe(e) {
@@ -1075,12 +1147,12 @@ class $ extends _ {
1075
1147
  kind: "min",
1076
1148
  inclusive: !0,
1077
1149
  value: Number.MIN_SAFE_INTEGER,
1078
- message: p.toString(e)
1150
+ message: l.toString(e)
1079
1151
  })._addCheck({
1080
1152
  kind: "max",
1081
1153
  inclusive: !0,
1082
1154
  value: Number.MAX_SAFE_INTEGER,
1083
- message: p.toString(e)
1155
+ message: l.toString(e)
1084
1156
  });
1085
1157
  }
1086
1158
  get minValue() {
@@ -1096,7 +1168,7 @@ class $ extends _ {
1096
1168
  return e;
1097
1169
  }
1098
1170
  get isInt() {
1099
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
1171
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && v.isInteger(e.value));
1100
1172
  }
1101
1173
  get isFinite() {
1102
1174
  let e = null, s = null;
@@ -1108,61 +1180,69 @@ class $ extends _ {
1108
1180
  return Number.isFinite(s) && Number.isFinite(e);
1109
1181
  }
1110
1182
  }
1111
- $.create = (t) => new $({
1183
+ B.create = (t) => new B({
1112
1184
  checks: [],
1113
1185
  typeName: m.ZodNumber,
1114
1186
  coerce: (t == null ? void 0 : t.coerce) || !1,
1115
- ...v(t)
1187
+ ...g(t)
1116
1188
  });
1117
- class U extends _ {
1189
+ class z extends y {
1118
1190
  constructor() {
1119
1191
  super(...arguments), this.min = this.gte, this.max = this.lte;
1120
1192
  }
1121
1193
  _parse(e) {
1122
- if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
1123
- const a = this._getOrReturnCtx(e);
1124
- return l(a, {
1125
- code: c.invalid_type,
1126
- expected: f.bigint,
1127
- received: a.parsedType
1128
- }), y;
1129
- }
1194
+ if (this._def.coerce)
1195
+ try {
1196
+ e.data = BigInt(e.data);
1197
+ } catch {
1198
+ return this._getInvalidInput(e);
1199
+ }
1200
+ if (this._getType(e) !== d.bigint)
1201
+ return this._getInvalidInput(e);
1130
1202
  let n;
1131
- const r = new S();
1203
+ const r = new R();
1132
1204
  for (const a of this._def.checks)
1133
- a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1134
- code: c.too_small,
1205
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
1206
+ code: o.too_small,
1135
1207
  type: "bigint",
1136
1208
  minimum: a.value,
1137
1209
  inclusive: a.inclusive,
1138
1210
  message: a.message
1139
- }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1140
- code: c.too_big,
1211
+ }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
1212
+ code: o.too_big,
1141
1213
  type: "bigint",
1142
1214
  maximum: a.value,
1143
1215
  inclusive: a.inclusive,
1144
1216
  message: a.message
1145
- }), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
1146
- code: c.not_multiple_of,
1217
+ }), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), u(n, {
1218
+ code: o.not_multiple_of,
1147
1219
  multipleOf: a.value,
1148
1220
  message: a.message
1149
- }), r.dirty()) : x.assertNever(a);
1221
+ }), r.dirty()) : v.assertNever(a);
1150
1222
  return { status: r.value, value: e.data };
1151
1223
  }
1224
+ _getInvalidInput(e) {
1225
+ const s = this._getOrReturnCtx(e);
1226
+ return u(s, {
1227
+ code: o.invalid_type,
1228
+ expected: d.bigint,
1229
+ received: s.parsedType
1230
+ }), p;
1231
+ }
1152
1232
  gte(e, s) {
1153
- return this.setLimit("min", e, !0, p.toString(s));
1233
+ return this.setLimit("min", e, !0, l.toString(s));
1154
1234
  }
1155
1235
  gt(e, s) {
1156
- return this.setLimit("min", e, !1, p.toString(s));
1236
+ return this.setLimit("min", e, !1, l.toString(s));
1157
1237
  }
1158
1238
  lte(e, s) {
1159
- return this.setLimit("max", e, !0, p.toString(s));
1239
+ return this.setLimit("max", e, !0, l.toString(s));
1160
1240
  }
1161
1241
  lt(e, s) {
1162
- return this.setLimit("max", e, !1, p.toString(s));
1242
+ return this.setLimit("max", e, !1, l.toString(s));
1163
1243
  }
1164
1244
  setLimit(e, s, n, r) {
1165
- return new U({
1245
+ return new z({
1166
1246
  ...this._def,
1167
1247
  checks: [
1168
1248
  ...this._def.checks,
@@ -1170,13 +1250,13 @@ class U extends _ {
1170
1250
  kind: e,
1171
1251
  value: s,
1172
1252
  inclusive: n,
1173
- message: p.toString(r)
1253
+ message: l.toString(r)
1174
1254
  }
1175
1255
  ]
1176
1256
  });
1177
1257
  }
1178
1258
  _addCheck(e) {
1179
- return new U({
1259
+ return new z({
1180
1260
  ...this._def,
1181
1261
  checks: [...this._def.checks, e]
1182
1262
  });
@@ -1186,7 +1266,7 @@ class U extends _ {
1186
1266
  kind: "min",
1187
1267
  value: BigInt(0),
1188
1268
  inclusive: !1,
1189
- message: p.toString(e)
1269
+ message: l.toString(e)
1190
1270
  });
1191
1271
  }
1192
1272
  negative(e) {
@@ -1194,7 +1274,7 @@ class U extends _ {
1194
1274
  kind: "max",
1195
1275
  value: BigInt(0),
1196
1276
  inclusive: !1,
1197
- message: p.toString(e)
1277
+ message: l.toString(e)
1198
1278
  });
1199
1279
  }
1200
1280
  nonpositive(e) {
@@ -1202,7 +1282,7 @@ class U extends _ {
1202
1282
  kind: "max",
1203
1283
  value: BigInt(0),
1204
1284
  inclusive: !0,
1205
- message: p.toString(e)
1285
+ message: l.toString(e)
1206
1286
  });
1207
1287
  }
1208
1288
  nonnegative(e) {
@@ -1210,14 +1290,14 @@ class U extends _ {
1210
1290
  kind: "min",
1211
1291
  value: BigInt(0),
1212
1292
  inclusive: !0,
1213
- message: p.toString(e)
1293
+ message: l.toString(e)
1214
1294
  });
1215
1295
  }
1216
1296
  multipleOf(e, s) {
1217
1297
  return this._addCheck({
1218
1298
  kind: "multipleOf",
1219
1299
  value: e,
1220
- message: p.toString(s)
1300
+ message: l.toString(s)
1221
1301
  });
1222
1302
  }
1223
1303
  get minValue() {
@@ -1233,74 +1313,71 @@ class U extends _ {
1233
1313
  return e;
1234
1314
  }
1235
1315
  }
1236
- U.create = (t) => {
1237
- var e;
1238
- return new U({
1239
- checks: [],
1240
- typeName: m.ZodBigInt,
1241
- coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
1242
- ...v(t)
1243
- });
1244
- };
1245
- class re extends _ {
1316
+ z.create = (t) => new z({
1317
+ checks: [],
1318
+ typeName: m.ZodBigInt,
1319
+ coerce: (t == null ? void 0 : t.coerce) ?? !1,
1320
+ ...g(t)
1321
+ });
1322
+ class oe extends y {
1246
1323
  _parse(e) {
1247
- if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1324
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== d.boolean) {
1248
1325
  const n = this._getOrReturnCtx(e);
1249
- return l(n, {
1250
- code: c.invalid_type,
1251
- expected: f.boolean,
1326
+ return u(n, {
1327
+ code: o.invalid_type,
1328
+ expected: d.boolean,
1252
1329
  received: n.parsedType
1253
- }), y;
1330
+ }), p;
1254
1331
  }
1255
1332
  return T(e.data);
1256
1333
  }
1257
1334
  }
1258
- re.create = (t) => new re({
1335
+ oe.create = (t) => new oe({
1259
1336
  typeName: m.ZodBoolean,
1260
1337
  coerce: (t == null ? void 0 : t.coerce) || !1,
1261
- ...v(t)
1338
+ ...g(t)
1262
1339
  });
1263
- class z extends _ {
1340
+ class H extends y {
1264
1341
  _parse(e) {
1265
- if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1342
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== d.date) {
1266
1343
  const a = this._getOrReturnCtx(e);
1267
- return l(a, {
1268
- code: c.invalid_type,
1269
- expected: f.date,
1344
+ return u(a, {
1345
+ code: o.invalid_type,
1346
+ expected: d.date,
1270
1347
  received: a.parsedType
1271
- }), y;
1348
+ }), p;
1272
1349
  }
1273
- if (isNaN(e.data.getTime())) {
1350
+ if (Number.isNaN(e.data.getTime())) {
1274
1351
  const a = this._getOrReturnCtx(e);
1275
- return l(a, {
1276
- code: c.invalid_date
1277
- }), y;
1352
+ return u(a, {
1353
+ code: o.invalid_date
1354
+ }), p;
1278
1355
  }
1279
- const n = new S();
1356
+ const n = new R();
1280
1357
  let r;
1281
1358
  for (const a of this._def.checks)
1282
- a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), l(r, {
1283
- code: c.too_small,
1359
+ a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), u(r, {
1360
+ code: o.too_small,
1284
1361
  message: a.message,
1285
1362
  inclusive: !0,
1286
1363
  exact: !1,
1287
1364
  minimum: a.value,
1288
1365
  type: "date"
1289
- }), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
1290
- code: c.too_big,
1366
+ }), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), u(r, {
1367
+ code: o.too_big,
1291
1368
  message: a.message,
1292
1369
  inclusive: !0,
1293
1370
  exact: !1,
1294
1371
  maximum: a.value,
1295
1372
  type: "date"
1296
- }), n.dirty()) : x.assertNever(a);
1373
+ }), n.dirty()) : v.assertNever(a);
1297
1374
  return {
1298
1375
  status: n.value,
1299
1376
  value: new Date(e.data.getTime())
1300
1377
  };
1301
1378
  }
1302
1379
  _addCheck(e) {
1303
- return new z({
1380
+ return new H({
1304
1381
  ...this._def,
1305
1382
  checks: [...this._def.checks, e]
1306
1383
  });
@@ -1309,14 +1386,14 @@ class z extends _ {
1309
1386
  return this._addCheck({
1310
1387
  kind: "min",
1311
1388
  value: e.getTime(),
1312
- message: p.toString(s)
1389
+ message: l.toString(s)
1313
1390
  });
1314
1391
  }
1315
1392
  max(e, s) {
1316
1393
  return this._addCheck({
1317
1394
  kind: "max",
1318
1395
  value: e.getTime(),
1319
- message: p.toString(s)
1396
+ message: l.toString(s)
1320
1397
  });
1321
1398
  }
1322
1399
  get minDate() {
@@ -1332,64 +1409,64 @@ class z extends _ {
1332
1409
  return e != null ? new Date(e) : null;
1333
1410
  }
1334
1411
  }
1335
- z.create = (t) => new z({
1412
+ H.create = (t) => new H({
1336
1413
  checks: [],
1337
1414
  coerce: (t == null ? void 0 : t.coerce) || !1,
1338
1415
  typeName: m.ZodDate,
1339
- ...v(t)
1416
+ ...g(t)
1340
1417
  });
1341
- class we extends _ {
1418
+ class ue extends y {
1342
1419
  _parse(e) {
1343
- if (this._getType(e) !== f.symbol) {
1420
+ if (this._getType(e) !== d.symbol) {
1344
1421
  const n = this._getOrReturnCtx(e);
1345
- return l(n, {
1346
- code: c.invalid_type,
1347
- expected: f.symbol,
1422
+ return u(n, {
1423
+ code: o.invalid_type,
1424
+ expected: d.symbol,
1348
1425
  received: n.parsedType
1349
- }), y;
1426
+ }), p;
1350
1427
  }
1351
1428
  return T(e.data);
1352
1429
  }
1353
1430
  }
1354
- we.create = (t) => new we({
1431
+ ue.create = (t) => new ue({
1355
1432
  typeName: m.ZodSymbol,
1356
- ...v(t)
1433
+ ...g(t)
1357
1434
  });
1358
- class ae extends _ {
1435
+ class de extends y {
1359
1436
  _parse(e) {
1360
- if (this._getType(e) !== f.undefined) {
1437
+ if (this._getType(e) !== d.undefined) {
1361
1438
  const n = this._getOrReturnCtx(e);
1362
- return l(n, {
1363
- code: c.invalid_type,
1364
- expected: f.undefined,
1439
+ return u(n, {
1440
+ code: o.invalid_type,
1441
+ expected: d.undefined,
1365
1442
  received: n.parsedType
1366
- }), y;
1443
+ }), p;
1367
1444
  }
1368
1445
  return T(e.data);
1369
1446
  }
1370
1447
  }
1371
- ae.create = (t) => new ae({
1448
+ de.create = (t) => new de({
1372
1449
  typeName: m.ZodUndefined,
1373
- ...v(t)
1450
+ ...g(t)
1374
1451
  });
1375
- class ie extends _ {
1452
+ class le extends y {
1376
1453
  _parse(e) {
1377
- if (this._getType(e) !== f.null) {
1454
+ if (this._getType(e) !== d.null) {
1378
1455
  const n = this._getOrReturnCtx(e);
1379
- return l(n, {
1380
- code: c.invalid_type,
1381
- expected: f.null,
1456
+ return u(n, {
1457
+ code: o.invalid_type,
1458
+ expected: d.null,
1382
1459
  received: n.parsedType
1383
- }), y;
1460
+ }), p;
1384
1461
  }
1385
1462
  return T(e.data);
1386
1463
  }
1387
1464
  }
1388
- ie.create = (t) => new ie({
1465
+ le.create = (t) => new le({
1389
1466
  typeName: m.ZodNull,
1390
- ...v(t)
1467
+ ...g(t)
1391
1468
  });
1392
- class J extends _ {
1469
+ class fe extends y {
1393
1470
  constructor() {
1394
1471
  super(...arguments), this._any = !0;
1395
1472
  }
@@ -1397,11 +1474,11 @@ class J extends _ {
1397
1474
  return T(e.data);
1398
1475
  }
1399
1476
  }
1400
- J.create = (t) => new J({
1477
+ fe.create = (t) => new fe({
1401
1478
  typeName: m.ZodAny,
1402
- ...v(t)
1479
+ ...g(t)
1403
1480
  });
1404
- class B extends _ {
1481
+ class he extends y {
1405
1482
  constructor() {
1406
1483
  super(...arguments), this._unknown = !0;
1407
1484
  }
@@ -1409,55 +1486,55 @@ class B extends _ {
1409
1486
  return T(e.data);
1410
1487
  }
1411
1488
  }
1412
- B.create = (t) => new B({
1489
+ he.create = (t) => new he({
1413
1490
  typeName: m.ZodUnknown,
1414
- ...v(t)
1491
+ ...g(t)
1415
1492
  });
1416
- class P extends _ {
1493
+ class Z extends y {
1417
1494
  _parse(e) {
1418
1495
  const s = this._getOrReturnCtx(e);
1419
- return l(s, {
1420
- code: c.invalid_type,
1421
- expected: f.never,
1496
+ return u(s, {
1497
+ code: o.invalid_type,
1498
+ expected: d.never,
1422
1499
  received: s.parsedType
1423
- }), y;
1500
+ }), p;
1424
1501
  }
1425
1502
  }
1426
- P.create = (t) => new P({
1503
+ Z.create = (t) => new Z({
1427
1504
  typeName: m.ZodNever,
1428
- ...v(t)
1505
+ ...g(t)
1429
1506
  });
1430
- class ke extends _ {
1507
+ class me extends y {
1431
1508
  _parse(e) {
1432
- if (this._getType(e) !== f.undefined) {
1509
+ if (this._getType(e) !== d.undefined) {
1433
1510
  const n = this._getOrReturnCtx(e);
1434
- return l(n, {
1435
- code: c.invalid_type,
1436
- expected: f.void,
1511
+ return u(n, {
1512
+ code: o.invalid_type,
1513
+ expected: d.void,
1437
1514
  received: n.parsedType
1438
- }), y;
1515
+ }), p;
1439
1516
  }
1440
1517
  return T(e.data);
1441
1518
  }
1442
1519
  }
1443
- ke.create = (t) => new ke({
1520
+ me.create = (t) => new me({
1444
1521
  typeName: m.ZodVoid,
1445
- ...v(t)
1522
+ ...g(t)
1446
1523
  });
1447
- class N extends _ {
1524
+ class A extends y {
1448
1525
  _parse(e) {
1449
1526
  const { ctx: s, status: n } = this._processInputParams(e), r = this._def;
1450
- if (s.parsedType !== f.array)
1451
- return l(s, {
1452
- code: c.invalid_type,
1453
- expected: f.array,
1527
+ if (s.parsedType !== d.array)
1528
+ return u(s, {
1529
+ code: o.invalid_type,
1530
+ expected: d.array,
1454
1531
  received: s.parsedType
1455
- }), y;
1532
+ }), p;
1456
1533
  if (r.exactLength !== null) {
1457
- const i = s.data.length > r.exactLength.value, o = s.data.length < r.exactLength.value;
1458
- (i || o) && (l(s, {
1459
- code: i ? c.too_big : c.too_small,
1460
- minimum: o ? r.exactLength.value : void 0,
1534
+ const i = s.data.length > r.exactLength.value, c = s.data.length < r.exactLength.value;
1535
+ (i || c) && (u(s, {
1536
+ code: i ? o.too_big : o.too_small,
1537
+ minimum: c ? r.exactLength.value : void 0,
1461
1538
  maximum: i ? r.exactLength.value : void 0,
1462
1539
  type: "array",
1463
1540
  inclusive: !0,
@@ -1465,164 +1542,164 @@ class N extends _ {
1465
1542
  message: r.exactLength.message
1466
1543
  }), n.dirty());
1467
1544
  }
1468
- if (r.minLength !== null && s.data.length < r.minLength.value && (l(s, {
1469
- code: c.too_small,
1545
+ if (r.minLength !== null && s.data.length < r.minLength.value && (u(s, {
1546
+ code: o.too_small,
1470
1547
  minimum: r.minLength.value,
1471
1548
  type: "array",
1472
1549
  inclusive: !0,
1473
1550
  exact: !1,
1474
1551
  message: r.minLength.message
1475
- }), n.dirty()), r.maxLength !== null && s.data.length > r.maxLength.value && (l(s, {
1476
- code: c.too_big,
1552
+ }), n.dirty()), r.maxLength !== null && s.data.length > r.maxLength.value && (u(s, {
1553
+ code: o.too_big,
1477
1554
  maximum: r.maxLength.value,
1478
1555
  type: "array",
1479
1556
  inclusive: !0,
1480
1557
  exact: !1,
1481
1558
  message: r.maxLength.message
1482
1559
  }), n.dirty()), s.common.async)
1483
- return Promise.all([...s.data].map((i, o) => r.type._parseAsync(new O(s, i, s.path, o)))).then((i) => S.mergeArray(n, i));
1484
- const a = [...s.data].map((i, o) => r.type._parseSync(new O(s, i, s.path, o)));
1485
- return S.mergeArray(n, a);
1560
+ return Promise.all([...s.data].map((i, c) => r.type._parseAsync(new N(s, i, s.path, c)))).then((i) => R.mergeArray(n, i));
1561
+ const a = [...s.data].map((i, c) => r.type._parseSync(new N(s, i, s.path, c)));
1562
+ return R.mergeArray(n, a);
1486
1563
  }
1487
1564
  get element() {
1488
1565
  return this._def.type;
1489
1566
  }
1490
1567
  min(e, s) {
1491
- return new N({
1568
+ return new A({
1492
1569
  ...this._def,
1493
- minLength: { value: e, message: p.toString(s) }
1570
+ minLength: { value: e, message: l.toString(s) }
1494
1571
  });
1495
1572
  }
1496
1573
  max(e, s) {
1497
- return new N({
1574
+ return new A({
1498
1575
  ...this._def,
1499
- maxLength: { value: e, message: p.toString(s) }
1576
+ maxLength: { value: e, message: l.toString(s) }
1500
1577
  });
1501
1578
  }
1502
1579
  length(e, s) {
1503
- return new N({
1580
+ return new A({
1504
1581
  ...this._def,
1505
- exactLength: { value: e, message: p.toString(s) }
1582
+ exactLength: { value: e, message: l.toString(s) }
1506
1583
  });
1507
1584
  }
1508
1585
  nonempty(e) {
1509
1586
  return this.min(1, e);
1510
1587
  }
1511
1588
  }
1512
- N.create = (t, e) => new N({
1589
+ A.create = (t, e) => new A({
1513
1590
  type: t,
1514
1591
  minLength: null,
1515
1592
  maxLength: null,
1516
1593
  exactLength: null,
1517
1594
  typeName: m.ZodArray,
1518
- ...v(e)
1595
+ ...g(e)
1519
1596
  });
1520
- function Q(t) {
1597
+ function L(t) {
1521
1598
  if (t instanceof b) {
1522
1599
  const e = {};
1523
1600
  for (const s in t.shape) {
1524
1601
  const n = t.shape[s];
1525
- e[s] = I.create(Q(n));
1602
+ e[s] = M.create(L(n));
1526
1603
  }
1527
1604
  return new b({
1528
1605
  ...t._def,
1529
1606
  shape: () => e
1530
1607
  });
1531
1608
  } else
1532
- return t instanceof N ? new N({
1609
+ return t instanceof A ? new A({
1533
1610
  ...t._def,
1534
- type: Q(t.element)
1535
- }) : t instanceof I ? I.create(Q(t.unwrap())) : t instanceof V ? V.create(Q(t.unwrap())) : t instanceof A ? A.create(t.items.map((e) => Q(e))) : t;
1611
+ type: L(t.element)
1612
+ }) : t instanceof M ? M.create(L(t.unwrap())) : t instanceof F ? F.create(L(t.unwrap())) : t instanceof P ? P.create(t.items.map((e) => L(e))) : t;
1536
1613
  }
1537
- class b extends _ {
1614
+ class b extends y {
1538
1615
  constructor() {
1539
1616
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1540
1617
  }
1541
1618
  _getCached() {
1542
1619
  if (this._cached !== null)
1543
1620
  return this._cached;
1544
- const e = this._def.shape(), s = x.objectKeys(e);
1545
- return this._cached = { shape: e, keys: s };
1621
+ const e = this._def.shape(), s = v.objectKeys(e);
1622
+ return this._cached = { shape: e, keys: s }, this._cached;
1546
1623
  }
1547
1624
  _parse(e) {
1548
- if (this._getType(e) !== f.object) {
1549
- const u = this._getOrReturnCtx(e);
1550
- return l(u, {
1551
- code: c.invalid_type,
1552
- expected: f.object,
1553
- received: u.parsedType
1554
- }), y;
1625
+ if (this._getType(e) !== d.object) {
1626
+ const h = this._getOrReturnCtx(e);
1627
+ return u(h, {
1628
+ code: o.invalid_type,
1629
+ expected: d.object,
1630
+ received: h.parsedType
1631
+ }), p;
1555
1632
  }
1556
- const { status: n, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1557
- if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
1558
- for (const u in r.data)
1559
- i.includes(u) || o.push(u);
1560
- const d = [];
1561
- for (const u of i) {
1562
- const g = a[u], R = r.data[u];
1563
- d.push({
1564
- key: { status: "valid", value: u },
1565
- value: g._parse(new O(r, R, r.path, u)),
1566
- alwaysSet: u in r.data
1633
+ const { status: n, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), c = [];
1634
+ if (!(this._def.catchall instanceof Z && this._def.unknownKeys === "strip"))
1635
+ for (const h in r.data)
1636
+ i.includes(h) || c.push(h);
1637
+ const f = [];
1638
+ for (const h of i) {
1639
+ const _ = a[h], q = r.data[h];
1640
+ f.push({
1641
+ key: { status: "valid", value: h },
1642
+ value: _._parse(new N(r, q, r.path, h)),
1643
+ alwaysSet: h in r.data
1567
1644
  });
1568
1645
  }
1569
- if (this._def.catchall instanceof P) {
1570
- const u = this._def.unknownKeys;
1571
- if (u === "passthrough")
1572
- for (const g of o)
1573
- d.push({
1574
- key: { status: "valid", value: g },
1575
- value: { status: "valid", value: r.data[g] }
1646
+ if (this._def.catchall instanceof Z) {
1647
+ const h = this._def.unknownKeys;
1648
+ if (h === "passthrough")
1649
+ for (const _ of c)
1650
+ f.push({
1651
+ key: { status: "valid", value: _ },
1652
+ value: { status: "valid", value: r.data[_] }
1576
1653
  });
1577
- else if (u === "strict")
1578
- o.length > 0 && (l(r, {
1579
- code: c.unrecognized_keys,
1580
- keys: o
1654
+ else if (h === "strict")
1655
+ c.length > 0 && (u(r, {
1656
+ code: o.unrecognized_keys,
1657
+ keys: c
1581
1658
  }), n.dirty());
1582
- else if (u !== "strip")
1659
+ else if (h !== "strip")
1583
1660
  throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1584
1661
  } else {
1585
- const u = this._def.catchall;
1586
- for (const g of o) {
1587
- const R = r.data[g];
1588
- d.push({
1589
- key: { status: "valid", value: g },
1590
- value: u._parse(
1591
- new O(r, R, r.path, g)
1662
+ const h = this._def.catchall;
1663
+ for (const _ of c) {
1664
+ const q = r.data[_];
1665
+ f.push({
1666
+ key: { status: "valid", value: _ },
1667
+ value: h._parse(
1668
+ new N(r, q, r.path, _)
1592
1669
  //, ctx.child(key), value, getParsedType(value)
1593
1670
  ),
1594
- alwaysSet: g in r.data
1671
+ alwaysSet: _ in r.data
1595
1672
  });
1596
1673
  }
1597
1674
  }
1598
1675
  return r.common.async ? Promise.resolve().then(async () => {
1599
- const u = [];
1600
- for (const g of d) {
1601
- const R = await g.key, D = await g.value;
1602
- u.push({
1603
- key: R,
1604
- value: D,
1605
- alwaysSet: g.alwaysSet
1676
+ const h = [];
1677
+ for (const _ of f) {
1678
+ const q = await _.key, $ = await _.value;
1679
+ h.push({
1680
+ key: q,
1681
+ value: $,
1682
+ alwaysSet: _.alwaysSet
1606
1683
  });
1607
1684
  }
1608
- return u;
1609
- }).then((u) => S.mergeObjectSync(n, u)) : S.mergeObjectSync(n, d);
1685
+ return h;
1686
+ }).then((h) => R.mergeObjectSync(n, h)) : R.mergeObjectSync(n, f);
1610
1687
  }
1611
1688
  get shape() {
1612
1689
  return this._def.shape();
1613
1690
  }
1614
1691
  strict(e) {
1615
- return p.errToObj, new b({
1692
+ return l.errToObj, new b({
1616
1693
  ...this._def,
1617
1694
  unknownKeys: "strict",
1618
1695
  ...e !== void 0 ? {
1619
1696
  errorMap: (s, n) => {
1620
- var r, a, i, o;
1621
- const d = (i = (a = (r = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(r, s, n).message) !== null && i !== void 0 ? i : n.defaultError;
1697
+ var a, i;
1698
+ const r = ((i = (a = this._def).errorMap) == null ? void 0 : i.call(a, s, n).message) ?? n.defaultError;
1622
1699
  return s.code === "unrecognized_keys" ? {
1623
- message: (o = p.errToObj(e).message) !== null && o !== void 0 ? o : d
1700
+ message: l.errToObj(e).message ?? r
1624
1701
  } : {
1625
- message: d
1702
+ message: r
1626
1703
  };
1627
1704
  }
1628
1705
  } : {}
@@ -1749,18 +1826,18 @@ class b extends _ {
1749
1826
  }
1750
1827
  pick(e) {
1751
1828
  const s = {};
1752
- return x.objectKeys(e).forEach((n) => {
1829
+ for (const n of v.objectKeys(e))
1753
1830
  e[n] && this.shape[n] && (s[n] = this.shape[n]);
1754
- }), new b({
1831
+ return new b({
1755
1832
  ...this._def,
1756
1833
  shape: () => s
1757
1834
  });
1758
1835
  }
1759
1836
  omit(e) {
1760
1837
  const s = {};
1761
- return x.objectKeys(this.shape).forEach((n) => {
1838
+ for (const n of v.objectKeys(this.shape))
1762
1839
  e[n] || (s[n] = this.shape[n]);
1763
- }), new b({
1840
+ return new b({
1764
1841
  ...this._def,
1765
1842
  shape: () => s
1766
1843
  });
@@ -1769,74 +1846,75 @@ class b extends _ {
1769
1846
  * @deprecated
1770
1847
  */
1771
1848
  deepPartial() {
1772
- return Q(this);
1849
+ return L(this);
1773
1850
  }
1774
1851
  partial(e) {
1775
1852
  const s = {};
1776
- return x.objectKeys(this.shape).forEach((n) => {
1853
+ for (const n of v.objectKeys(this.shape)) {
1777
1854
  const r = this.shape[n];
1778
1855
  e && !e[n] ? s[n] = r : s[n] = r.optional();
1779
- }), new b({
1856
+ }
1857
+ return new b({
1780
1858
  ...this._def,
1781
1859
  shape: () => s
1782
1860
  });
1783
1861
  }
1784
1862
  required(e) {
1785
1863
  const s = {};
1786
- return x.objectKeys(this.shape).forEach((n) => {
1864
+ for (const n of v.objectKeys(this.shape))
1787
1865
  if (e && !e[n])
1788
1866
  s[n] = this.shape[n];
1789
1867
  else {
1790
1868
  let a = this.shape[n];
1791
- for (; a instanceof I; )
1869
+ for (; a instanceof M; )
1792
1870
  a = a._def.innerType;
1793
1871
  s[n] = a;
1794
1872
  }
1795
- }), new b({
1873
+ return new b({
1796
1874
  ...this._def,
1797
1875
  shape: () => s
1798
1876
  });
1799
1877
  }
1800
1878
  keyof() {
1801
- return ze(x.objectKeys(this.shape));
1879
+ return Ze(v.objectKeys(this.shape));
1802
1880
  }
1803
1881
  }
1804
1882
  b.create = (t, e) => new b({
1805
1883
  shape: () => t,
1806
1884
  unknownKeys: "strip",
1807
- catchall: P.create(),
1885
+ catchall: Z.create(),
1808
1886
  typeName: m.ZodObject,
1809
- ...v(e)
1887
+ ...g(e)
1810
1888
  });
1811
1889
  b.strictCreate = (t, e) => new b({
1812
1890
  shape: () => t,
1813
1891
  unknownKeys: "strict",
1814
- catchall: P.create(),
1892
+ catchall: Z.create(),
1815
1893
  typeName: m.ZodObject,
1816
- ...v(e)
1894
+ ...g(e)
1817
1895
  });
1818
1896
  b.lazycreate = (t, e) => new b({
1819
1897
  shape: t,
1820
1898
  unknownKeys: "strip",
1821
- catchall: P.create(),
1899
+ catchall: Z.create(),
1822
1900
  typeName: m.ZodObject,
1823
- ...v(e)
1901
+ ...g(e)
1824
1902
  });
1825
- class oe extends _ {
1903
+ class ee extends y {
1826
1904
  _parse(e) {
1827
1905
  const { ctx: s } = this._processInputParams(e), n = this._def.options;
1828
1906
  function r(a) {
1829
- for (const o of a)
1830
- if (o.result.status === "valid")
1831
- return o.result;
1832
- for (const o of a)
1833
- if (o.result.status === "dirty")
1834
- return s.common.issues.push(...o.ctx.common.issues), o.result;
1835
- const i = a.map((o) => new E(o.ctx.common.issues));
1836
- return l(s, {
1837
- code: c.invalid_union,
1907
+ for (const c of a)
1908
+ if (c.result.status === "valid")
1909
+ return c.result;
1910
+ for (const c of a)
1911
+ if (c.result.status === "dirty")
1912
+ return s.common.issues.push(...c.ctx.common.issues), c.result;
1913
+ const i = a.map((c) => new E(c.ctx.common.issues));
1914
+ return u(s, {
1915
+ code: o.invalid_union,
1838
1916
  unionErrors: i
1839
- }), y;
1917
+ }), p;
1840
1918
  }
1841
1919
  if (s.common.async)
1842
1920
  return Promise.all(n.map(async (a) => {
@@ -1860,140 +1938,77 @@ class oe extends _ {
1860
1938
  {
1861
1939
  let a;
1862
1940
  const i = [];
1863
- for (const d of n) {
1864
- const u = {
1941
+ for (const f of n) {
1942
+ const h = {
1865
1943
  ...s,
1866
1944
  common: {
1867
1945
  ...s.common,
1868
1946
  issues: []
1869
1947
  },
1870
1948
  parent: null
1871
- }, g = d._parseSync({
1949
+ }, _ = f._parseSync({
1872
1950
  data: s.data,
1873
1951
  path: s.path,
1874
- parent: u
1952
+ parent: h
1875
1953
  });
1876
- if (g.status === "valid")
1877
- return g;
1878
- g.status === "dirty" && !a && (a = { result: g, ctx: u }), u.common.issues.length && i.push(u.common.issues);
1954
+ if (_.status === "valid")
1955
+ return _;
1956
+ _.status === "dirty" && !a && (a = { result: _, ctx: h }), h.common.issues.length && i.push(h.common.issues);
1879
1957
  }
1880
1958
  if (a)
1881
1959
  return s.common.issues.push(...a.ctx.common.issues), a.result;
1882
- const o = i.map((d) => new E(d));
1883
- return l(s, {
1884
- code: c.invalid_union,
1885
- unionErrors: o
1886
- }), y;
1960
+ const c = i.map((f) => new E(f));
1961
+ return u(s, {
1962
+ code: o.invalid_union,
1963
+ unionErrors: c
1964
+ }), p;
1887
1965
  }
1888
1966
  }
1889
1967
  get options() {
1890
1968
  return this._def.options;
1891
1969
  }
1892
1970
  }
1893
- oe.create = (t, e) => new oe({
1971
+ ee.create = (t, e) => new ee({
1894
1972
  options: t,
1895
1973
  typeName: m.ZodUnion,
1896
- ...v(e)
1974
+ ...g(e)
1897
1975
  });
1898
- const j = (t) => t instanceof de ? j(t.schema) : t instanceof M ? j(t.innerType()) : t instanceof le ? [t.value] : t instanceof L ? t.options : t instanceof fe ? x.objectValues(t.enum) : t instanceof he ? j(t._def.innerType) : t instanceof ae ? [void 0] : t instanceof ie ? [null] : t instanceof I ? [void 0, ...j(t.unwrap())] : t instanceof V ? [null, ...j(t.unwrap())] : t instanceof Oe || t instanceof me ? j(t.unwrap()) : t instanceof pe ? j(t._def.innerType) : [];
1899
- class Re extends _ {
1900
- _parse(e) {
1901
- const { ctx: s } = this._processInputParams(e);
1902
- if (s.parsedType !== f.object)
1903
- return l(s, {
1904
- code: c.invalid_type,
1905
- expected: f.object,
1906
- received: s.parsedType
1907
- }), y;
1908
- const n = this.discriminator, r = s.data[n], a = this.optionsMap.get(r);
1909
- return a ? s.common.async ? a._parseAsync({
1910
- data: s.data,
1911
- path: s.path,
1912
- parent: s
1913
- }) : a._parseSync({
1914
- data: s.data,
1915
- path: s.path,
1916
- parent: s
1917
- }) : (l(s, {
1918
- code: c.invalid_union_discriminator,
1919
- options: Array.from(this.optionsMap.keys()),
1920
- path: [n]
1921
- }), y);
1922
- }
1923
- get discriminator() {
1924
- return this._def.discriminator;
1925
- }
1926
- get options() {
1927
- return this._def.options;
1928
- }
1929
- get optionsMap() {
1930
- return this._def.optionsMap;
1931
- }
1932
- /**
1933
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
1934
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
1935
- * have a different value for each object in the union.
1936
- * @param discriminator the name of the discriminator property
1937
- * @param types an array of object schemas
1938
- * @param params
1939
- */
1940
- static create(e, s, n) {
1941
- const r = /* @__PURE__ */ new Map();
1942
- for (const a of s) {
1943
- const i = j(a.shape[e]);
1944
- if (!i.length)
1945
- throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1946
- for (const o of i) {
1947
- if (r.has(o))
1948
- throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
1949
- r.set(o, a);
1950
- }
1951
- }
1952
- return new Re({
1953
- typeName: m.ZodDiscriminatedUnion,
1954
- discriminator: e,
1955
- options: s,
1956
- optionsMap: r,
1957
- ...v(n)
1958
- });
1959
- }
1960
- }
1961
- function Ie(t, e) {
1962
- const s = q(t), n = q(e);
1976
+ function pe(t, e) {
1977
+ const s = I(t), n = I(e);
1963
1978
  if (t === e)
1964
1979
  return { valid: !0, data: t };
1965
- if (s === f.object && n === f.object) {
1966
- const r = x.objectKeys(e), a = x.objectKeys(t).filter((o) => r.indexOf(o) !== -1), i = { ...t, ...e };
1967
- for (const o of a) {
1968
- const d = Ie(t[o], e[o]);
1969
- if (!d.valid)
1980
+ if (s === d.object && n === d.object) {
1981
+ const r = v.objectKeys(e), a = v.objectKeys(t).filter((c) => r.indexOf(c) !== -1), i = { ...t, ...e };
1982
+ for (const c of a) {
1983
+ const f = pe(t[c], e[c]);
1984
+ if (!f.valid)
1970
1985
  return { valid: !1 };
1971
- i[o] = d.data;
1986
+ i[c] = f.data;
1972
1987
  }
1973
1988
  return { valid: !0, data: i };
1974
- } else if (s === f.array && n === f.array) {
1989
+ } else if (s === d.array && n === d.array) {
1975
1990
  if (t.length !== e.length)
1976
1991
  return { valid: !1 };
1977
1992
  const r = [];
1978
1993
  for (let a = 0; a < t.length; a++) {
1979
- const i = t[a], o = e[a], d = Ie(i, o);
1980
- if (!d.valid)
1994
+ const i = t[a], c = e[a], f = pe(i, c);
1995
+ if (!f.valid)
1981
1996
  return { valid: !1 };
1982
- r.push(d.data);
1997
+ r.push(f.data);
1983
1998
  }
1984
1999
  return { valid: !0, data: r };
1985
2000
  } else
1986
- return s === f.date && n === f.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
2001
+ return s === d.date && n === d.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
1987
2002
  }
1988
- class ce extends _ {
2003
+ class te extends y {
1989
2004
  _parse(e) {
1990
2005
  const { status: s, ctx: n } = this._processInputParams(e), r = (a, i) => {
1991
- if (Ne(a) || Ne(i))
1992
- return y;
1993
- const o = Ie(a.value, i.value);
1994
- return o.valid ? ((Me(a) || Me(i)) && s.dirty(), { status: s.value, value: o.data }) : (l(n, {
1995
- code: c.invalid_intersection_types
1996
- }), y);
2006
+ if (Ae(a) || Ae(i))
2007
+ return p;
2008
+ const c = pe(a.value, i.value);
2009
+ return c.valid ? ((Ne(a) || Ne(i)) && s.dirty(), { status: s.value, value: c.data }) : (u(n, {
2010
+ code: o.invalid_intersection_types
2011
+ }), p);
1997
2012
  };
1998
2013
  return n.common.async ? Promise.all([
1999
2014
  this._def.left._parseAsync({
@@ -2017,63 +2032,63 @@ class ce extends _ {
2017
2032
  }));
2018
2033
  }
2019
2034
  }
2020
- ce.create = (t, e, s) => new ce({
2035
+ te.create = (t, e, s) => new te({
2021
2036
  left: t,
2022
2037
  right: e,
2023
2038
  typeName: m.ZodIntersection,
2024
- ...v(s)
2039
+ ...g(s)
2025
2040
  });
2026
- class A extends _ {
2041
+ class P extends y {
2027
2042
  _parse(e) {
2028
2043
  const { status: s, ctx: n } = this._processInputParams(e);
2029
- if (n.parsedType !== f.array)
2030
- return l(n, {
2031
- code: c.invalid_type,
2032
- expected: f.array,
2044
+ if (n.parsedType !== d.array)
2045
+ return u(n, {
2046
+ code: o.invalid_type,
2047
+ expected: d.array,
2033
2048
  received: n.parsedType
2034
- }), y;
2049
+ }), p;
2035
2050
  if (n.data.length < this._def.items.length)
2036
- return l(n, {
2037
- code: c.too_small,
2051
+ return u(n, {
2052
+ code: o.too_small,
2038
2053
  minimum: this._def.items.length,
2039
2054
  inclusive: !0,
2040
2055
  exact: !1,
2041
2056
  type: "array"
2042
- }), y;
2043
- !this._def.rest && n.data.length > this._def.items.length && (l(n, {
2044
- code: c.too_big,
2057
+ }), p;
2058
+ !this._def.rest && n.data.length > this._def.items.length && (u(n, {
2059
+ code: o.too_big,
2045
2060
  maximum: this._def.items.length,
2046
2061
  inclusive: !0,
2047
2062
  exact: !1,
2048
2063
  type: "array"
2049
2064
  }), s.dirty());
2050
- const a = [...n.data].map((i, o) => {
2051
- const d = this._def.items[o] || this._def.rest;
2052
- return d ? d._parse(new O(n, i, n.path, o)) : null;
2065
+ const a = [...n.data].map((i, c) => {
2066
+ const f = this._def.items[c] || this._def.rest;
2067
+ return f ? f._parse(new N(n, i, n.path, c)) : null;
2053
2068
  }).filter((i) => !!i);
2054
- return n.common.async ? Promise.all(a).then((i) => S.mergeArray(s, i)) : S.mergeArray(s, a);
2069
+ return n.common.async ? Promise.all(a).then((i) => R.mergeArray(s, i)) : R.mergeArray(s, a);
2055
2070
  }
2056
2071
  get items() {
2057
2072
  return this._def.items;
2058
2073
  }
2059
2074
  rest(e) {
2060
- return new A({
2075
+ return new P({
2061
2076
  ...this._def,
2062
2077
  rest: e
2063
2078
  });
2064
2079
  }
2065
2080
  }
2066
- A.create = (t, e) => {
2081
+ P.create = (t, e) => {
2067
2082
  if (!Array.isArray(t))
2068
2083
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2069
- return new A({
2084
+ return new P({
2070
2085
  items: t,
2071
2086
  typeName: m.ZodTuple,
2072
2087
  rest: null,
2073
- ...v(e)
2088
+ ...g(e)
2074
2089
  });
2075
2090
  };
2076
- class ue extends _ {
2091
+ class se extends y {
2077
2092
  get keySchema() {
2078
2093
  return this._def.keyType;
2079
2094
  }
@@ -2082,39 +2097,39 @@ class ue extends _ {
2082
2097
  }
2083
2098
  _parse(e) {
2084
2099
  const { status: s, ctx: n } = this._processInputParams(e);
2085
- if (n.parsedType !== f.object)
2086
- return l(n, {
2087
- code: c.invalid_type,
2088
- expected: f.object,
2100
+ if (n.parsedType !== d.object)
2101
+ return u(n, {
2102
+ code: o.invalid_type,
2103
+ expected: d.object,
2089
2104
  received: n.parsedType
2090
- }), y;
2105
+ }), p;
2091
2106
  const r = [], a = this._def.keyType, i = this._def.valueType;
2092
- for (const o in n.data)
2107
+ for (const c in n.data)
2093
2108
  r.push({
2094
- key: a._parse(new O(n, o, n.path, o)),
2095
- value: i._parse(new O(n, n.data[o], n.path, o)),
2096
- alwaysSet: o in n.data
2109
+ key: a._parse(new N(n, c, n.path, c)),
2110
+ value: i._parse(new N(n, n.data[c], n.path, c)),
2111
+ alwaysSet: c in n.data
2097
2112
  });
2098
- return n.common.async ? S.mergeObjectAsync(s, r) : S.mergeObjectSync(s, r);
2113
+ return n.common.async ? R.mergeObjectAsync(s, r) : R.mergeObjectSync(s, r);
2099
2114
  }
2100
2115
  get element() {
2101
2116
  return this._def.valueType;
2102
2117
  }
2103
2118
  static create(e, s, n) {
2104
- return s instanceof _ ? new ue({
2119
+ return s instanceof y ? new se({
2105
2120
  keyType: e,
2106
2121
  valueType: s,
2107
2122
  typeName: m.ZodRecord,
2108
- ...v(n)
2109
- }) : new ue({
2110
- keyType: Z.create(),
2123
+ ...g(n)
2124
+ }) : new se({
2125
+ keyType: O.create(),
2111
2126
  valueType: e,
2112
2127
  typeName: m.ZodRecord,
2113
- ...v(s)
2128
+ ...g(s)
2114
2129
  });
2115
2130
  }
2116
2131
  }
2117
- class Se extends _ {
2132
+ class ge extends y {
2118
2133
  get keySchema() {
2119
2134
  return this._def.keyType;
2120
2135
  }
@@ -2123,64 +2138,64 @@ class Se extends _ {
2123
2138
  }
2124
2139
  _parse(e) {
2125
2140
  const { status: s, ctx: n } = this._processInputParams(e);
2126
- if (n.parsedType !== f.map)
2127
- return l(n, {
2128
- code: c.invalid_type,
2129
- expected: f.map,
2141
+ if (n.parsedType !== d.map)
2142
+ return u(n, {
2143
+ code: o.invalid_type,
2144
+ expected: d.map,
2130
2145
  received: n.parsedType
2131
- }), y;
2132
- const r = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, d], u) => ({
2133
- key: r._parse(new O(n, o, n.path, [u, "key"])),
2134
- value: a._parse(new O(n, d, n.path, [u, "value"]))
2146
+ }), p;
2147
+ const r = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([c, f], h) => ({
2148
+ key: r._parse(new N(n, c, n.path, [h, "key"])),
2149
+ value: a._parse(new N(n, f, n.path, [h, "value"]))
2135
2150
  }));
2136
2151
  if (n.common.async) {
2137
- const o = /* @__PURE__ */ new Map();
2152
+ const c = /* @__PURE__ */ new Map();
2138
2153
  return Promise.resolve().then(async () => {
2139
- for (const d of i) {
2140
- const u = await d.key, g = await d.value;
2141
- if (u.status === "aborted" || g.status === "aborted")
2142
- return y;
2143
- (u.status === "dirty" || g.status === "dirty") && s.dirty(), o.set(u.value, g.value);
2154
+ for (const f of i) {
2155
+ const h = await f.key, _ = await f.value;
2156
+ if (h.status === "aborted" || _.status === "aborted")
2157
+ return p;
2158
+ (h.status === "dirty" || _.status === "dirty") && s.dirty(), c.set(h.value, _.value);
2144
2159
  }
2145
- return { status: s.value, value: o };
2160
+ return { status: s.value, value: c };
2146
2161
  });
2147
2162
  } else {
2148
- const o = /* @__PURE__ */ new Map();
2149
- for (const d of i) {
2150
- const u = d.key, g = d.value;
2151
- if (u.status === "aborted" || g.status === "aborted")
2152
- return y;
2153
- (u.status === "dirty" || g.status === "dirty") && s.dirty(), o.set(u.value, g.value);
2163
+ const c = /* @__PURE__ */ new Map();
2164
+ for (const f of i) {
2165
+ const h = f.key, _ = f.value;
2166
+ if (h.status === "aborted" || _.status === "aborted")
2167
+ return p;
2168
+ (h.status === "dirty" || _.status === "dirty") && s.dirty(), c.set(h.value, _.value);
2154
2169
  }
2155
- return { status: s.value, value: o };
2170
+ return { status: s.value, value: c };
2156
2171
  }
2157
2172
  }
2158
2173
  }
2159
- Se.create = (t, e, s) => new Se({
2174
+ ge.create = (t, e, s) => new ge({
2160
2175
  valueType: e,
2161
2176
  keyType: t,
2162
2177
  typeName: m.ZodMap,
2163
- ...v(s)
2178
+ ...g(s)
2164
2179
  });
2165
- class G extends _ {
2180
+ class D extends y {
2166
2181
  _parse(e) {
2167
2182
  const { status: s, ctx: n } = this._processInputParams(e);
2168
- if (n.parsedType !== f.set)
2169
- return l(n, {
2170
- code: c.invalid_type,
2171
- expected: f.set,
2183
+ if (n.parsedType !== d.set)
2184
+ return u(n, {
2185
+ code: o.invalid_type,
2186
+ expected: d.set,
2172
2187
  received: n.parsedType
2173
- }), y;
2188
+ }), p;
2174
2189
  const r = this._def;
2175
- r.minSize !== null && n.data.size < r.minSize.value && (l(n, {
2176
- code: c.too_small,
2190
+ r.minSize !== null && n.data.size < r.minSize.value && (u(n, {
2191
+ code: o.too_small,
2177
2192
  minimum: r.minSize.value,
2178
2193
  type: "set",
2179
2194
  inclusive: !0,
2180
2195
  exact: !1,
2181
2196
  message: r.minSize.message
2182
- }), s.dirty()), r.maxSize !== null && n.data.size > r.maxSize.value && (l(n, {
2183
- code: c.too_big,
2197
+ }), s.dirty()), r.maxSize !== null && n.data.size > r.maxSize.value && (u(n, {
2198
+ code: o.too_big,
2184
2199
  maximum: r.maxSize.value,
2185
2200
  type: "set",
2186
2201
  inclusive: !0,
@@ -2188,28 +2203,28 @@ class G extends _ {
2188
2203
  message: r.maxSize.message
2189
2204
  }), s.dirty());
2190
2205
  const a = this._def.valueType;
2191
- function i(d) {
2192
- const u = /* @__PURE__ */ new Set();
2193
- for (const g of d) {
2194
- if (g.status === "aborted")
2195
- return y;
2196
- g.status === "dirty" && s.dirty(), u.add(g.value);
2206
+ function i(f) {
2207
+ const h = /* @__PURE__ */ new Set();
2208
+ for (const _ of f) {
2209
+ if (_.status === "aborted")
2210
+ return p;
2211
+ _.status === "dirty" && s.dirty(), h.add(_.value);
2197
2212
  }
2198
- return { status: s.value, value: u };
2213
+ return { status: s.value, value: h };
2199
2214
  }
2200
- const o = [...n.data.values()].map((d, u) => a._parse(new O(n, d, n.path, u)));
2201
- return n.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
2215
+ const c = [...n.data.values()].map((f, h) => a._parse(new N(n, f, n.path, h)));
2216
+ return n.common.async ? Promise.all(c).then((f) => i(f)) : i(c);
2202
2217
  }
2203
2218
  min(e, s) {
2204
- return new G({
2219
+ return new D({
2205
2220
  ...this._def,
2206
- minSize: { value: e, message: p.toString(s) }
2221
+ minSize: { value: e, message: l.toString(s) }
2207
2222
  });
2208
2223
  }
2209
2224
  max(e, s) {
2210
- return new G({
2225
+ return new D({
2211
2226
  ...this._def,
2212
- maxSize: { value: e, message: p.toString(s) }
2227
+ maxSize: { value: e, message: l.toString(s) }
2213
2228
  });
2214
2229
  }
2215
2230
  size(e, s) {
@@ -2219,115 +2234,14 @@ class G extends _ {
2219
2234
  return this.min(1, e);
2220
2235
  }
2221
2236
  }
2222
- G.create = (t, e) => new G({
2237
+ D.create = (t, e) => new D({
2223
2238
  valueType: t,
2224
2239
  minSize: null,
2225
2240
  maxSize: null,
2226
2241
  typeName: m.ZodSet,
2227
- ...v(e)
2242
+ ...g(e)
2228
2243
  });
2229
- class H extends _ {
2230
- constructor() {
2231
- super(...arguments), this.validate = this.implement;
2232
- }
2233
- _parse(e) {
2234
- const { ctx: s } = this._processInputParams(e);
2235
- if (s.parsedType !== f.function)
2236
- return l(s, {
2237
- code: c.invalid_type,
2238
- expected: f.function,
2239
- received: s.parsedType
2240
- }), y;
2241
- function n(o, d) {
2242
- return xe({
2243
- data: o,
2244
- path: s.path,
2245
- errorMaps: [
2246
- s.common.contextualErrorMap,
2247
- s.schemaErrorMap,
2248
- _e(),
2249
- Y
2250
- ].filter((u) => !!u),
2251
- issueData: {
2252
- code: c.invalid_arguments,
2253
- argumentsError: d
2254
- }
2255
- });
2256
- }
2257
- function r(o, d) {
2258
- return xe({
2259
- data: o,
2260
- path: s.path,
2261
- errorMaps: [
2262
- s.common.contextualErrorMap,
2263
- s.schemaErrorMap,
2264
- _e(),
2265
- Y
2266
- ].filter((u) => !!u),
2267
- issueData: {
2268
- code: c.invalid_return_type,
2269
- returnTypeError: d
2270
- }
2271
- });
2272
- }
2273
- const a = { errorMap: s.common.contextualErrorMap }, i = s.data;
2274
- if (this._def.returns instanceof X) {
2275
- const o = this;
2276
- return T(async function(...d) {
2277
- const u = new E([]), g = await o._def.args.parseAsync(d, a).catch((Ee) => {
2278
- throw u.addIssue(n(d, Ee)), u;
2279
- }), R = await Reflect.apply(i, this, g);
2280
- return await o._def.returns._def.type.parseAsync(R, a).catch((Ee) => {
2281
- throw u.addIssue(r(R, Ee)), u;
2282
- });
2283
- });
2284
- } else {
2285
- const o = this;
2286
- return T(function(...d) {
2287
- const u = o._def.args.safeParse(d, a);
2288
- if (!u.success)
2289
- throw new E([n(d, u.error)]);
2290
- const g = Reflect.apply(i, this, u.data), R = o._def.returns.safeParse(g, a);
2291
- if (!R.success)
2292
- throw new E([r(g, R.error)]);
2293
- return R.data;
2294
- });
2295
- }
2296
- }
2297
- parameters() {
2298
- return this._def.args;
2299
- }
2300
- returnType() {
2301
- return this._def.returns;
2302
- }
2303
- args(...e) {
2304
- return new H({
2305
- ...this._def,
2306
- args: A.create(e).rest(B.create())
2307
- });
2308
- }
2309
- returns(e) {
2310
- return new H({
2311
- ...this._def,
2312
- returns: e
2313
- });
2314
- }
2315
- implement(e) {
2316
- return this.parse(e);
2317
- }
2318
- strictImplement(e) {
2319
- return this.parse(e);
2320
- }
2321
- static create(e, s, n) {
2322
- return new H({
2323
- args: e || A.create([]).rest(B.create()),
2324
- returns: s || B.create(),
2325
- typeName: m.ZodFunction,
2326
- ...v(n)
2327
- });
2328
- }
2329
- }
2330
- class de extends _ {
2244
+ class ye extends y {
2331
2245
  get schema() {
2332
2246
  return this._def.getter();
2333
2247
  }
@@ -2336,20 +2250,20 @@ class de extends _ {
2336
2250
  return this._def.getter()._parse({ data: s.data, path: s.path, parent: s });
2337
2251
  }
2338
2252
  }
2339
- de.create = (t, e) => new de({
2253
+ ye.create = (t, e) => new ye({
2340
2254
  getter: t,
2341
2255
  typeName: m.ZodLazy,
2342
- ...v(e)
2256
+ ...g(e)
2343
2257
  });
2344
- class le extends _ {
2258
+ class _e extends y {
2345
2259
  _parse(e) {
2346
2260
  if (e.data !== this._def.value) {
2347
2261
  const s = this._getOrReturnCtx(e);
2348
- return l(s, {
2262
+ return u(s, {
2349
2263
  received: s.data,
2350
- code: c.invalid_literal,
2264
+ code: o.invalid_literal,
2351
2265
  expected: this._def.value
2352
- }), y;
2266
+ }), p;
2353
2267
  }
2354
2268
  return { status: "valid", value: e.data };
2355
2269
  }
@@ -2357,38 +2271,35 @@ class le extends _ {
2357
2271
  return this._def.value;
2358
2272
  }
2359
2273
  }
2360
- le.create = (t, e) => new le({
2274
+ _e.create = (t, e) => new _e({
2361
2275
  value: t,
2362
2276
  typeName: m.ZodLiteral,
2363
- ...v(e)
2277
+ ...g(e)
2364
2278
  });
2365
- function ze(t, e) {
2366
- return new L({
2279
+ function Ze(t, e) {
2280
+ return new G({
2367
2281
  values: t,
2368
2282
  typeName: m.ZodEnum,
2369
- ...v(e)
2283
+ ...g(e)
2370
2284
  });
2371
2285
  }
2372
- class L extends _ {
2373
- constructor() {
2374
- super(...arguments), F.set(this, void 0);
2375
- }
2286
+ class G extends y {
2376
2287
  _parse(e) {
2377
2288
  if (typeof e.data != "string") {
2378
2289
  const s = this._getOrReturnCtx(e), n = this._def.values;
2379
- return l(s, {
2380
- expected: x.joinValues(n),
2290
+ return u(s, {
2291
+ expected: v.joinValues(n),
2381
2292
  received: s.parsedType,
2382
- code: c.invalid_type
2383
- }), y;
2293
+ code: o.invalid_type
2294
+ }), p;
2384
2295
  }
2385
- if (be(this, F) || Le(this, F, new Set(this._def.values)), !be(this, F).has(e.data)) {
2296
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2386
2297
  const s = this._getOrReturnCtx(e), n = this._def.values;
2387
- return l(s, {
2298
+ return u(s, {
2388
2299
  received: s.data,
2389
- code: c.invalid_enum_value,
2300
+ code: o.invalid_enum_value,
2390
2301
  options: n
2391
- }), y;
2302
+ }), p;
2392
2303
  }
2393
2304
  return T(e.data);
2394
2305
  }
@@ -2414,41 +2325,37 @@ class L extends _ {
2414
2325
  return e;
2415
2326
  }
2416
2327
  extract(e, s = this._def) {
2417
- return L.create(e, {
2328
+ return G.create(e, {
2418
2329
  ...this._def,
2419
2330
  ...s
2420
2331
  });
2421
2332
  }
2422
2333
  exclude(e, s = this._def) {
2423
- return L.create(this.options.filter((n) => !e.includes(n)), {
2334
+ return G.create(this.options.filter((n) => !e.includes(n)), {
2424
2335
  ...this._def,
2425
2336
  ...s
2426
2337
  });
2427
2338
  }
2428
2339
  }
2429
- F = /* @__PURE__ */ new WeakMap();
2430
- L.create = ze;
2431
- class fe extends _ {
2432
- constructor() {
2433
- super(...arguments), ee.set(this, void 0);
2434
- }
2340
+ G.create = Ze;
2341
+ class ve extends y {
2435
2342
  _parse(e) {
2436
- const s = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2437
- if (n.parsedType !== f.string && n.parsedType !== f.number) {
2438
- const r = x.objectValues(s);
2439
- return l(n, {
2440
- expected: x.joinValues(r),
2343
+ const s = v.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2344
+ if (n.parsedType !== d.string && n.parsedType !== d.number) {
2345
+ const r = v.objectValues(s);
2346
+ return u(n, {
2347
+ expected: v.joinValues(r),
2441
2348
  received: n.parsedType,
2442
- code: c.invalid_type
2443
- }), y;
2349
+ code: o.invalid_type
2350
+ }), p;
2444
2351
  }
2445
- if (be(this, ee) || Le(this, ee, new Set(x.getValidEnumValues(this._def.values))), !be(this, ee).has(e.data)) {
2446
- const r = x.objectValues(s);
2447
- return l(n, {
2352
+ if (this._cache || (this._cache = new Set(v.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2353
+ const r = v.objectValues(s);
2354
+ return u(n, {
2448
2355
  received: n.data,
2449
- code: c.invalid_enum_value,
2356
+ code: o.invalid_enum_value,
2450
2357
  options: r
2451
- }), y;
2358
+ }), p;
2452
2359
  }
2453
2360
  return T(e.data);
2454
2361
  }
@@ -2456,37 +2363,36 @@ class fe extends _ {
2456
2363
  return this._def.values;
2457
2364
  }
2458
2365
  }
2459
- ee = /* @__PURE__ */ new WeakMap();
2460
- fe.create = (t, e) => new fe({
2366
+ ve.create = (t, e) => new ve({
2461
2367
  values: t,
2462
2368
  typeName: m.ZodNativeEnum,
2463
- ...v(e)
2369
+ ...g(e)
2464
2370
  });
2465
- class X extends _ {
2371
+ class ne extends y {
2466
2372
  unwrap() {
2467
2373
  return this._def.type;
2468
2374
  }
2469
2375
  _parse(e) {
2470
2376
  const { ctx: s } = this._processInputParams(e);
2471
- if (s.parsedType !== f.promise && s.common.async === !1)
2472
- return l(s, {
2473
- code: c.invalid_type,
2474
- expected: f.promise,
2377
+ if (s.parsedType !== d.promise && s.common.async === !1)
2378
+ return u(s, {
2379
+ code: o.invalid_type,
2380
+ expected: d.promise,
2475
2381
  received: s.parsedType
2476
- }), y;
2477
- const n = s.parsedType === f.promise ? s.data : Promise.resolve(s.data);
2382
+ }), p;
2383
+ const n = s.parsedType === d.promise ? s.data : Promise.resolve(s.data);
2478
2384
  return T(n.then((r) => this._def.type.parseAsync(r, {
2479
2385
  path: s.path,
2480
2386
  errorMap: s.common.contextualErrorMap
2481
2387
  })));
2482
2388
  }
2483
2389
  }
2484
- X.create = (t, e) => new X({
2390
+ ne.create = (t, e) => new ne({
2485
2391
  type: t,
2486
2392
  typeName: m.ZodPromise,
2487
- ...v(e)
2393
+ ...g(e)
2488
2394
  });
2489
- class M extends _ {
2395
+ class j extends y {
2490
2396
  innerType() {
2491
2397
  return this._def.schema;
2492
2398
  }
@@ -2496,7 +2402,7 @@ class M extends _ {
2496
2402
  _parse(e) {
2497
2403
  const { status: s, ctx: n } = this._processInputParams(e), r = this._def.effect || null, a = {
2498
2404
  addIssue: (i) => {
2499
- l(n, i), i.fatal ? s.abort() : s.dirty();
2405
+ u(n, i), i.fatal ? s.abort() : s.dirty();
2500
2406
  },
2501
2407
  get path() {
2502
2408
  return n.path;
@@ -2505,45 +2411,45 @@ class M extends _ {
2505
2411
  if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
2506
2412
  const i = r.transform(n.data, a);
2507
2413
  if (n.common.async)
2508
- return Promise.resolve(i).then(async (o) => {
2414
+ return Promise.resolve(i).then(async (c) => {
2509
2415
  if (s.value === "aborted")
2510
- return y;
2511
- const d = await this._def.schema._parseAsync({
2512
- data: o,
2416
+ return p;
2417
+ const f = await this._def.schema._parseAsync({
2418
+ data: c,
2513
2419
  path: n.path,
2514
2420
  parent: n
2515
2421
  });
2516
- return d.status === "aborted" ? y : d.status === "dirty" || s.value === "dirty" ? W(d.value) : d;
2422
+ return f.status === "aborted" ? p : f.status === "dirty" || s.value === "dirty" ? W(f.value) : f;
2517
2423
  });
2518
2424
  {
2519
2425
  if (s.value === "aborted")
2520
- return y;
2521
- const o = this._def.schema._parseSync({
2426
+ return p;
2427
+ const c = this._def.schema._parseSync({
2522
2428
  data: i,
2523
2429
  path: n.path,
2524
2430
  parent: n
2525
2431
  });
2526
- return o.status === "aborted" ? y : o.status === "dirty" || s.value === "dirty" ? W(o.value) : o;
2432
+ return c.status === "aborted" ? p : c.status === "dirty" || s.value === "dirty" ? W(c.value) : c;
2527
2433
  }
2528
2434
  }
2529
2435
  if (r.type === "refinement") {
2530
- const i = (o) => {
2531
- const d = r.refinement(o, a);
2436
+ const i = (c) => {
2437
+ const f = r.refinement(c, a);
2532
2438
  if (n.common.async)
2533
- return Promise.resolve(d);
2534
- if (d instanceof Promise)
2439
+ return Promise.resolve(f);
2440
+ if (f instanceof Promise)
2535
2441
  throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2536
- return o;
2442
+ return c;
2537
2443
  };
2538
2444
  if (n.common.async === !1) {
2539
- const o = this._def.schema._parseSync({
2445
+ const c = this._def.schema._parseSync({
2540
2446
  data: n.data,
2541
2447
  path: n.path,
2542
2448
  parent: n
2543
2449
  });
2544
- return o.status === "aborted" ? y : (o.status === "dirty" && s.dirty(), i(o.value), { status: s.value, value: o.value });
2450
+ return c.status === "aborted" ? p : (c.status === "dirty" && s.dirty(), i(c.value), { status: s.value, value: c.value });
2545
2451
  } else
2546
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && s.dirty(), i(o.value).then(() => ({ status: s.value, value: o.value }))));
2452
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => c.status === "aborted" ? p : (c.status === "dirty" && s.dirty(), i(c.value).then(() => ({ status: s.value, value: c.value }))));
2547
2453
  }
2548
2454
  if (r.type === "transform")
2549
2455
  if (n.common.async === !1) {
@@ -2552,60 +2458,63 @@ class M extends _ {
2552
2458
  path: n.path,
2553
2459
  parent: n
2554
2460
  });
2555
- if (!se(i))
2556
- return i;
2557
- const o = r.transform(i.value, a);
2558
- if (o instanceof Promise)
2461
+ if (!V(i))
2462
+ return p;
2463
+ const c = r.transform(i.value, a);
2464
+ if (c instanceof Promise)
2559
2465
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2560
- return { status: s.value, value: o };
2466
+ return { status: s.value, value: c };
2561
2467
  } else
2562
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => se(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({ status: s.value, value: o })) : i);
2563
- x.assertNever(r);
2468
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => V(i) ? Promise.resolve(r.transform(i.value, a)).then((c) => ({
2469
+ status: s.value,
2470
+ value: c
2471
+ })) : p);
2472
+ v.assertNever(r);
2564
2473
  }
2565
2474
  }
2566
- M.create = (t, e, s) => new M({
2475
+ j.create = (t, e, s) => new j({
2567
2476
  schema: t,
2568
2477
  typeName: m.ZodEffects,
2569
2478
  effect: e,
2570
- ...v(s)
2479
+ ...g(s)
2571
2480
  });
2572
- M.createWithPreprocess = (t, e, s) => new M({
2481
+ j.createWithPreprocess = (t, e, s) => new j({
2573
2482
  schema: e,
2574
2483
  effect: { type: "preprocess", transform: t },
2575
2484
  typeName: m.ZodEffects,
2576
- ...v(s)
2485
+ ...g(s)
2577
2486
  });
2578
- class I extends _ {
2487
+ class M extends y {
2579
2488
  _parse(e) {
2580
- return this._getType(e) === f.undefined ? T(void 0) : this._def.innerType._parse(e);
2489
+ return this._getType(e) === d.undefined ? T(void 0) : this._def.innerType._parse(e);
2581
2490
  }
2582
2491
  unwrap() {
2583
2492
  return this._def.innerType;
2584
2493
  }
2585
2494
  }
2586
- I.create = (t, e) => new I({
2495
+ M.create = (t, e) => new M({
2587
2496
  innerType: t,
2588
2497
  typeName: m.ZodOptional,
2589
- ...v(e)
2498
+ ...g(e)
2590
2499
  });
2591
- class V extends _ {
2500
+ class F extends y {
2592
2501
  _parse(e) {
2593
- return this._getType(e) === f.null ? T(null) : this._def.innerType._parse(e);
2502
+ return this._getType(e) === d.null ? T(null) : this._def.innerType._parse(e);
2594
2503
  }
2595
2504
  unwrap() {
2596
2505
  return this._def.innerType;
2597
2506
  }
2598
2507
  }
2599
- V.create = (t, e) => new V({
2508
+ F.create = (t, e) => new F({
2600
2509
  innerType: t,
2601
2510
  typeName: m.ZodNullable,
2602
- ...v(e)
2511
+ ...g(e)
2603
2512
  });
2604
- class he extends _ {
2513
+ class xe extends y {
2605
2514
  _parse(e) {
2606
2515
  const { ctx: s } = this._processInputParams(e);
2607
2516
  let n = s.data;
2608
- return s.parsedType === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
2517
+ return s.parsedType === d.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
2609
2518
  data: n,
2610
2519
  path: s.path,
2611
2520
  parent: s
@@ -2615,13 +2524,13 @@ class he extends _ {
2615
2524
  return this._def.innerType;
2616
2525
  }
2617
2526
  }
2618
- he.create = (t, e) => new he({
2527
+ xe.create = (t, e) => new xe({
2619
2528
  innerType: t,
2620
2529
  typeName: m.ZodDefault,
2621
2530
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2622
- ...v(e)
2531
+ ...g(e)
2623
2532
  });
2624
- class pe extends _ {
2533
+ class be extends y {
2625
2534
  _parse(e) {
2626
2535
  const { ctx: s } = this._processInputParams(e), n = {
2627
2536
  ...s,
@@ -2636,7 +2545,7 @@ class pe extends _ {
2636
2545
  ...n
2637
2546
  }
2638
2547
  });
2639
- return ne(r) ? r.then((a) => ({
2548
+ return K(r) ? r.then((a) => ({
2640
2549
  status: "valid",
2641
2550
  value: a.status === "valid" ? a.value : this._def.catchValue({
2642
2551
  get error() {
@@ -2658,31 +2567,30 @@ class pe extends _ {
2658
2567
  return this._def.innerType;
2659
2568
  }
2660
2569
  }
2661
- pe.create = (t, e) => new pe({
2570
+ be.create = (t, e) => new be({
2662
2571
  innerType: t,
2663
2572
  typeName: m.ZodCatch,
2664
2573
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2665
- ...v(e)
2574
+ ...g(e)
2666
2575
  });
2667
- class Te extends _ {
2576
+ class ke extends y {
2668
2577
  _parse(e) {
2669
- if (this._getType(e) !== f.nan) {
2578
+ if (this._getType(e) !== d.nan) {
2670
2579
  const n = this._getOrReturnCtx(e);
2671
- return l(n, {
2672
- code: c.invalid_type,
2673
- expected: f.nan,
2580
+ return u(n, {
2581
+ code: o.invalid_type,
2582
+ expected: d.nan,
2674
2583
  received: n.parsedType
2675
- }), y;
2584
+ }), p;
2676
2585
  }
2677
2586
  return { status: "valid", value: e.data };
2678
2587
  }
2679
2588
  }
2680
- Te.create = (t) => new Te({
2589
+ ke.create = (t) => new ke({
2681
2590
  typeName: m.ZodNaN,
2682
- ...v(t)
2591
+ ...g(t)
2683
2592
  });
2684
- const bt = Symbol("zod_brand");
2685
- class Oe extends _ {
2593
+ class pt extends y {
2686
2594
  _parse(e) {
2687
2595
  const { ctx: s } = this._processInputParams(e), n = s.data;
2688
2596
  return this._def.type._parse({
@@ -2695,7 +2603,7 @@ class Oe extends _ {
2695
2603
  return this._def.type;
2696
2604
  }
2697
2605
  }
2698
- class ge extends _ {
2606
+ class Se extends y {
2699
2607
  _parse(e) {
2700
2608
  const { status: s, ctx: n } = this._processInputParams(e);
2701
2609
  if (n.common.async)
@@ -2705,7 +2613,7 @@ class ge extends _ {
2705
2613
  path: n.path,
2706
2614
  parent: n
2707
2615
  });
2708
- return a.status === "aborted" ? y : a.status === "dirty" ? (s.dirty(), W(a.value)) : this._def.out._parseAsync({
2616
+ return a.status === "aborted" ? p : a.status === "dirty" ? (s.dirty(), W(a.value)) : this._def.out._parseAsync({
2709
2617
  data: a.value,
2710
2618
  path: n.path,
2711
2619
  parent: n
@@ -2717,7 +2625,7 @@ class ge extends _ {
2717
2625
  path: n.path,
2718
2626
  parent: n
2719
2627
  });
2720
- return r.status === "aborted" ? y : r.status === "dirty" ? (s.dirty(), {
2628
+ return r.status === "aborted" ? p : r.status === "dirty" ? (s.dirty(), {
2721
2629
  status: "dirty",
2722
2630
  value: r.value
2723
2631
  }) : this._def.out._parseSync({
@@ -2728,363 +2636,253 @@ class ge extends _ {
2728
2636
  }
2729
2637
  }
2730
2638
  static create(e, s) {
2731
- return new ge({
2639
+ return new Se({
2732
2640
  in: e,
2733
2641
  out: s,
2734
2642
  typeName: m.ZodPipeline
2735
2643
  });
2736
2644
  }
2737
2645
  }
2738
- class me extends _ {
2646
+ class we extends y {
2739
2647
  _parse(e) {
2740
- const s = this._def.innerType._parse(e), n = (r) => (se(r) && (r.value = Object.freeze(r.value)), r);
2741
- return ne(s) ? s.then((r) => n(r)) : n(s);
2648
+ const s = this._def.innerType._parse(e), n = (r) => (V(r) && (r.value = Object.freeze(r.value)), r);
2649
+ return K(s) ? s.then((r) => n(r)) : n(s);
2742
2650
  }
2743
2651
  unwrap() {
2744
2652
  return this._def.innerType;
2745
2653
  }
2746
2654
  }
2747
- me.create = (t, e) => new me({
2655
+ we.create = (t, e) => new we({
2748
2656
  innerType: t,
2749
2657
  typeName: m.ZodReadonly,
2750
- ...v(e)
2658
+ ...g(e)
2751
2659
  });
2752
- function Ge(t, e = {}, s) {
2753
- return t ? J.create().superRefine((n, r) => {
2754
- var a, i;
2755
- if (!t(n)) {
2756
- const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, d = (i = (a = o.fatal) !== null && a !== void 0 ? a : s) !== null && i !== void 0 ? i : !0, u = typeof o == "string" ? { message: o } : o;
2757
- r.addIssue({ code: "custom", ...u, fatal: d });
2758
- }
2759
- }) : J.create();
2760
- }
2761
- const wt = {
2762
- object: b.lazycreate
2763
- };
2660
+ b.lazycreate;
2764
2661
  var m;
2765
2662
  (function(t) {
2766
2663
  t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
2767
2664
  })(m || (m = {}));
2768
- const kt = (t, e = {
2769
- message: `Input not instance of ${t.name}`
2770
- }) => Ge((s) => s instanceof t, e), Qe = Z.create, We = $.create, St = Te.create, Tt = U.create, He = re.create, Rt = z.create, Et = we.create, Ct = ae.create, Zt = ie.create, Nt = J.create, Mt = B.create, It = P.create, Ot = ke.create, At = N.create, jt = b.create, Pt = b.strictCreate, qt = oe.create, $t = Re.create, Ut = ce.create, Lt = A.create, Vt = ue.create, Dt = Se.create, Bt = G.create, zt = H.create, Gt = de.create, Qt = le.create, Wt = L.create, Ht = fe.create, Yt = X.create, qe = M.create, Jt = I.create, Xt = V.create, Kt = M.createWithPreprocess, Ft = ge.create, es = () => Qe().optional(), ts = () => We().optional(), ss = () => He().optional(), ns = {
2771
- string: (t) => Z.create({ ...t, coerce: !0 }),
2772
- number: (t) => $.create({ ...t, coerce: !0 }),
2773
- boolean: (t) => re.create({
2774
- ...t,
2775
- coerce: !0
2776
- }),
2777
- bigint: (t) => U.create({ ...t, coerce: !0 }),
2778
- date: (t) => z.create({ ...t, coerce: !0 })
2779
- }, rs = y;
2780
- var h = /* @__PURE__ */ Object.freeze({
2781
- __proto__: null,
2782
- defaultErrorMap: Y,
2783
- setErrorMap: rt,
2784
- getErrorMap: _e,
2785
- makeIssue: xe,
2786
- EMPTY_PATH: at,
2787
- addIssueToContext: l,
2788
- ParseStatus: S,
2789
- INVALID: y,
2790
- DIRTY: W,
2791
- OK: T,
2792
- isAborted: Ne,
2793
- isDirty: Me,
2794
- isValid: se,
2795
- isAsync: ne,
2796
- get util() {
2797
- return x;
2798
- },
2799
- get objectUtil() {
2800
- return Ze;
2801
- },
2802
- ZodParsedType: f,
2803
- getParsedType: q,
2804
- ZodType: _,
2805
- datetimeRegex: Be,
2806
- ZodString: Z,
2807
- ZodNumber: $,
2808
- ZodBigInt: U,
2809
- ZodBoolean: re,
2810
- ZodDate: z,
2811
- ZodSymbol: we,
2812
- ZodUndefined: ae,
2813
- ZodNull: ie,
2814
- ZodAny: J,
2815
- ZodUnknown: B,
2816
- ZodNever: P,
2817
- ZodVoid: ke,
2818
- ZodArray: N,
2819
- ZodObject: b,
2820
- ZodUnion: oe,
2821
- ZodDiscriminatedUnion: Re,
2822
- ZodIntersection: ce,
2823
- ZodTuple: A,
2824
- ZodRecord: ue,
2825
- ZodMap: Se,
2826
- ZodSet: G,
2827
- ZodFunction: H,
2828
- ZodLazy: de,
2829
- ZodLiteral: le,
2830
- ZodEnum: L,
2831
- ZodNativeEnum: fe,
2832
- ZodPromise: X,
2833
- ZodEffects: M,
2834
- ZodTransformer: M,
2835
- ZodOptional: I,
2836
- ZodNullable: V,
2837
- ZodDefault: he,
2838
- ZodCatch: pe,
2839
- ZodNaN: Te,
2840
- BRAND: bt,
2841
- ZodBranded: Oe,
2842
- ZodPipeline: ge,
2843
- ZodReadonly: me,
2844
- custom: Ge,
2845
- Schema: _,
2846
- ZodSchema: _,
2847
- late: wt,
2848
- get ZodFirstPartyTypeKind() {
2849
- return m;
2850
- },
2851
- coerce: ns,
2852
- any: Nt,
2853
- array: At,
2854
- bigint: Tt,
2855
- boolean: He,
2856
- date: Rt,
2857
- discriminatedUnion: $t,
2858
- effect: qe,
2859
- enum: Wt,
2860
- function: zt,
2861
- instanceof: kt,
2862
- intersection: Ut,
2863
- lazy: Gt,
2864
- literal: Qt,
2865
- map: Dt,
2866
- nan: St,
2867
- nativeEnum: Ht,
2868
- never: It,
2869
- null: Zt,
2870
- nullable: Xt,
2871
- number: We,
2872
- object: jt,
2873
- oboolean: ss,
2874
- onumber: ts,
2875
- optional: Jt,
2876
- ostring: es,
2877
- pipeline: Ft,
2878
- preprocess: Kt,
2879
- promise: Yt,
2880
- record: Vt,
2881
- set: Bt,
2882
- strictObject: Pt,
2883
- string: Qe,
2884
- symbol: Et,
2885
- transformer: qe,
2886
- tuple: Lt,
2887
- undefined: Ct,
2888
- union: qt,
2889
- unknown: Mt,
2890
- void: Ot,
2891
- NEVER: rs,
2892
- ZodIssueCode: c,
2893
- quotelessJson: nt,
2894
- ZodError: E
2895
- });
2896
- const w = h.object({
2897
- type: h.literal("qp-bridge"),
2898
- id: h.string().optional()
2899
- }), as = w.extend({
2900
- status: h.literal("answerChanged"),
2901
- question: h.string(),
2902
- answer: h.unknown()
2903
- }), K = w.extend({
2904
- status: h.literal("success")
2905
- }), is = w.extend({
2906
- status: h.literal("error"),
2907
- message: h.string()
2908
- }), Ye = h.object({
2909
- semanticColor: h.string().optional(),
2910
- label: h.string(),
2911
- description: h.string(),
2912
- disabled: h.boolean(),
2913
- required: h.boolean(),
2914
- hidden: h.boolean(),
2915
- errorMessage: h.string().optional(),
2916
- answer: h.unknown().optional()
2917
- }), os = Ye.partial(), cs = h.object({
2918
- id: h.string().uuid(),
2919
- name: h.string(),
2920
- mimeType: h.string(),
2921
- blobUrl: h.string()
2922
- }), Ae = h.record(h.unknown()), Je = h.object({
2923
- label: h.string(),
2924
- hidden: h.boolean(),
2925
- collapsed: h.boolean()
2926
- }), us = Je.partial(), ds = w.extend({
2927
- action: h.literal("getQuestion"),
2928
- question: h.string()
2929
- }), ls = K.extend({
2930
- question: Ye
2931
- }), fs = w.extend({
2932
- action: h.literal("setQuestion"),
2933
- question: h.string(),
2934
- questionData: os
2935
- }), hs = w.extend({
2936
- action: h.literal("getGroup"),
2937
- group: h.string()
2938
- }), ps = K.extend({
2939
- group: Je
2940
- }), ms = K.extend({
2941
- canSave: h.boolean()
2942
- }), gs = w.extend({
2943
- action: h.literal("canSave")
2944
- }), ys = w.extend({
2945
- action: h.literal("setGroup"),
2946
- group: h.string(),
2947
- groupData: us
2948
- }), vs = w.extend({
2949
- action: h.literal("setAnswer"),
2950
- question: h.string(),
2951
- answer: h.unknown()
2952
- }), _s = w.extend({
2953
- action: h.literal("busyIndicatorStart")
2954
- }), xs = w.extend({
2955
- action: h.literal("busyIndicatorEnd")
2956
- }), bs = w.extend({
2957
- action: h.literal("saveQuestionnaire")
2958
- }), ws = w.extend({
2959
- action: h.literal("completeAndCloseQuestionnaire")
2960
- }), ks = w.extend({
2961
- action: h.literal("executeCustomCommand"),
2962
- commandName: h.string()
2963
- }), Ss = w.extend({
2964
- action: h.literal("fetchEntities"),
2965
- fetchXml: h.string()
2966
- }), Ts = K.extend({
2967
- entities: h.array(Ae)
2968
- }), Rs = w.extend({
2969
- action: h.literal("getEntityById"),
2970
- entityName: h.string(),
2971
- entityId: h.string()
2972
- }), Es = K.extend({
2973
- entity: Ae
2974
- }), Cs = w.extend({
2975
- action: h.literal("saveEntity"),
2976
- entity: Ae
2977
- }), Zs = w.extend({
2978
- action: h.literal("repeatGroup"),
2979
- parentGroupName: h.string(),
2980
- groupIndex: h.number()
2981
- }), Ns = w.extend({
2982
- action: h.literal("addNewGroup"),
2983
- groupName: h.string()
2984
- }), Ms = w.extend({
2985
- action: h.literal("deleteGroup"),
2986
- parentGroupName: h.string(),
2987
- groupIndex: h.number()
2665
+ const x = O.create, je = B.create;
2666
+ ke.create;
2667
+ z.create;
2668
+ const U = oe.create;
2669
+ H.create;
2670
+ ue.create;
2671
+ de.create;
2672
+ le.create;
2673
+ fe.create;
2674
+ const re = he.create;
2675
+ Z.create;
2676
+ me.create;
2677
+ const gt = A.create, ae = b.create;
2678
+ b.strictCreate;
2679
+ ee.create;
2680
+ te.create;
2681
+ P.create;
2682
+ const yt = se.create;
2683
+ ge.create;
2684
+ D.create;
2685
+ ye.create;
2686
+ const k = _e.create;
2687
+ G.create;
2688
+ ve.create;
2689
+ ne.create;
2690
+ j.create;
2691
+ M.create;
2692
+ F.create;
2693
+ j.createWithPreprocess;
2694
+ const w = ae({
2695
+ type: k("qp-bridge"),
2696
+ id: x().optional()
2697
+ }), _t = w.extend({
2698
+ status: k("answerChanged"),
2699
+ question: x(),
2700
+ answer: re()
2701
+ }), Q = w.extend({
2702
+ status: k("success")
2703
+ }), vt = w.extend({
2704
+ status: k("error"),
2705
+ message: x()
2706
+ }), qe = ae({
2707
+ semanticColor: x().optional(),
2708
+ label: x(),
2709
+ description: x(),
2710
+ disabled: U(),
2711
+ required: U(),
2712
+ hidden: U(),
2713
+ errorMessage: x().optional(),
2714
+ answer: re().optional()
2715
+ }), xt = qe.partial(), bt = ae({
2716
+ id: x().uuid(),
2717
+ name: x(),
2718
+ mimeType: x(),
2719
+ blobUrl: x()
2720
+ }), Re = yt(re()), Pe = ae({
2721
+ label: x(),
2722
+ hidden: U(),
2723
+ collapsed: U()
2724
+ }), kt = Pe.partial(), wt = w.extend({
2725
+ action: k("getQuestion"),
2726
+ question: x()
2727
+ }), St = Q.extend({
2728
+ question: qe
2729
+ }), Rt = w.extend({
2730
+ action: k("setQuestion"),
2731
+ question: x(),
2732
+ questionData: xt
2733
+ }), Ct = w.extend({
2734
+ action: k("getGroup"),
2735
+ group: x()
2736
+ }), Tt = Q.extend({
2737
+ group: Pe
2738
+ }), At = Q.extend({
2739
+ canSave: U()
2740
+ }), Nt = w.extend({
2741
+ action: k("canSave")
2742
+ }), Ot = w.extend({
2743
+ action: k("setGroup"),
2744
+ group: x(),
2745
+ groupData: kt
2746
+ }), Et = w.extend({
2747
+ action: k("setAnswer"),
2748
+ question: x(),
2749
+ answer: re()
2750
+ }), It = w.extend({
2751
+ action: k("busyIndicatorStart")
2752
+ }), Mt = w.extend({
2753
+ action: k("busyIndicatorEnd")
2754
+ }), Zt = w.extend({
2755
+ action: k("saveQuestionnaire")
2756
+ }), jt = w.extend({
2757
+ action: k("completeAndCloseQuestionnaire")
2758
+ }), qt = w.extend({
2759
+ action: k("executeCustomCommand"),
2760
+ commandName: x()
2761
+ }), Pt = w.extend({
2762
+ action: k("fetchEntities"),
2763
+ fetchXml: x()
2764
+ }), $t = Q.extend({
2765
+ entities: gt(Re)
2766
+ }), Lt = w.extend({
2767
+ action: k("getEntityById"),
2768
+ entityName: x(),
2769
+ entityId: x()
2770
+ }), Ut = Q.extend({
2771
+ entity: Re
2772
+ }), Vt = w.extend({
2773
+ action: k("saveEntity"),
2774
+ entity: Re
2775
+ }), Bt = w.extend({
2776
+ action: k("repeatGroup"),
2777
+ parentGroupName: x(),
2778
+ groupIndex: je()
2779
+ }), zt = w.extend({
2780
+ action: k("addNewGroup"),
2781
+ groupName: x()
2782
+ }), Dt = w.extend({
2783
+ action: k("deleteGroup"),
2784
+ parentGroupName: x(),
2785
+ groupIndex: je()
2988
2786
  });
2989
- function Hs(t) {
2990
- return cs.safeParse(t).success;
2787
+ function cs(t) {
2788
+ return bt.safeParse(t).success;
2991
2789
  }
2992
- function Is(t) {
2993
- return as.safeParse(t).success;
2790
+ function Gt(t) {
2791
+ return _t.safeParse(t).success;
2994
2792
  }
2995
- function Xe(t) {
2793
+ function $e(t) {
2996
2794
  return w.safeParse(t).success;
2997
2795
  }
2998
- function Os(t) {
2999
- return K.safeParse(t).success;
2796
+ function Ft(t) {
2797
+ return Q.safeParse(t).success;
3000
2798
  }
3001
- function As(t) {
3002
- return is.safeParse(t).success;
2799
+ function Qt(t) {
2800
+ return vt.safeParse(t).success;
3003
2801
  }
3004
- function Ys(t) {
3005
- return ds.safeParse(t).success;
2802
+ function os(t) {
2803
+ return wt.safeParse(t).success;
3006
2804
  }
3007
- function js(t) {
3008
- return ls.safeParse(t).success;
2805
+ function Wt(t) {
2806
+ return St.safeParse(t).success;
3009
2807
  }
3010
- function Js(t) {
3011
- return vs.safeParse(t).success;
2808
+ function us(t) {
2809
+ return Et.safeParse(t).success;
3012
2810
  }
3013
- function Xs(t) {
3014
- return fs.safeParse(t).success;
2811
+ function ds(t) {
2812
+ return Rt.safeParse(t).success;
3015
2813
  }
3016
- function Ks(t) {
3017
- return ys.safeParse(t).success;
2814
+ function ls(t) {
2815
+ return Ot.safeParse(t).success;
3018
2816
  }
3019
- function Fs(t) {
3020
- return hs.safeParse(t).success;
2817
+ function fs(t) {
2818
+ return Ct.safeParse(t).success;
3021
2819
  }
3022
- function Ps(t) {
3023
- return ps.safeParse(t).success;
2820
+ function Jt(t) {
2821
+ return Tt.safeParse(t).success;
3024
2822
  }
3025
- function en(t) {
3026
- return ms.safeParse(t).success;
2823
+ function hs(t) {
2824
+ return At.safeParse(t).success;
3027
2825
  }
3028
- function qs(t) {
3029
- return gs.safeParse(t).success;
2826
+ function Ht(t) {
2827
+ return Nt.safeParse(t).success;
3030
2828
  }
3031
- function $s(t) {
3032
- return _s.safeParse(t).success;
2829
+ function Yt(t) {
2830
+ return It.safeParse(t).success;
3033
2831
  }
3034
- function Us(t) {
3035
- return xs.safeParse(t).success;
2832
+ function Xt(t) {
2833
+ return Mt.safeParse(t).success;
3036
2834
  }
3037
- function tn(t) {
3038
- return bs.safeParse(t).success;
2835
+ function ms(t) {
2836
+ return Zt.safeParse(t).success;
3039
2837
  }
3040
- function sn(t) {
3041
- return ws.safeParse(t).success;
2838
+ function ps(t) {
2839
+ return jt.safeParse(t).success;
3042
2840
  }
3043
- function nn(t) {
3044
- return ks.safeParse(t).success;
2841
+ function gs(t) {
2842
+ return qt.safeParse(t).success;
3045
2843
  }
3046
- function rn(t) {
3047
- return $s(t) || Us(t);
2844
+ function ys(t) {
2845
+ return Yt(t) || Xt(t);
3048
2846
  }
3049
- function Ls(t, e) {
3050
- return !Xe(t) || t.id !== e || !("status" in t);
2847
+ function Kt(t, e) {
2848
+ return !$e(t) || t.id !== e || !("status" in t);
3051
2849
  }
3052
- function an(t) {
3053
- return Ss.safeParse(t).success;
2850
+ function _s(t) {
2851
+ return Pt.safeParse(t).success;
3054
2852
  }
3055
- function Vs(t) {
3056
- return Ts.safeParse(t).success;
2853
+ function es(t) {
2854
+ return $t.safeParse(t).success;
3057
2855
  }
3058
- function on(t) {
3059
- return Rs.safeParse(t).success;
2856
+ function vs(t) {
2857
+ return Lt.safeParse(t).success;
3060
2858
  }
3061
- function Ds(t) {
3062
- return Es.safeParse(t).success;
2859
+ function ts(t) {
2860
+ return Ut.safeParse(t).success;
3063
2861
  }
3064
- function cn(t) {
3065
- return Cs.safeParse(t).success;
2862
+ function xs(t) {
2863
+ return Vt.safeParse(t).success;
3066
2864
  }
3067
- function un(t) {
3068
- return Zs.safeParse(t).success;
2865
+ function bs(t) {
2866
+ return Bt.safeParse(t).success;
3069
2867
  }
3070
- function dn(t) {
3071
- return Ns.safeParse(t).success;
2868
+ function ks(t) {
2869
+ return zt.safeParse(t).success;
3072
2870
  }
3073
- function ln(t) {
3074
- return Ms.safeParse(t).success;
2871
+ function ws(t) {
2872
+ return Dt.safeParse(t).success;
3075
2873
  }
3076
- function Ke(t) {
2874
+ function Le(t) {
3077
2875
  if (t instanceof File || t instanceof Blob)
3078
2876
  return URL.createObjectURL(t);
3079
2877
  if (typeof t == "string") {
3080
2878
  if (/^data:/.test(t)) {
3081
2879
  const a = t.match(/^data:([^;]+);base64,(.*)$/);
3082
2880
  if (a) {
3083
- const i = a[1], o = a[2], d = atob(o), u = new ArrayBuffer(d.length), g = new Uint8Array(u);
3084
- for (let D = 0; D < d.length; D++)
3085
- g[D] = d.charCodeAt(D);
3086
- const R = new Blob([u], { type: i });
3087
- return URL.createObjectURL(R);
2881
+ const i = a[1], c = a[2], f = atob(c), h = new ArrayBuffer(f.length), _ = new Uint8Array(h);
2882
+ for (let $ = 0; $ < f.length; $++)
2883
+ _[$] = f.charCodeAt($);
2884
+ const q = new Blob([h], { type: i });
2885
+ return URL.createObjectURL(q);
3088
2886
  }
3089
2887
  throw new Error("Invalid data URL format. Only base64 data URLs are supported.");
3090
2888
  }
@@ -3100,24 +2898,24 @@ function Ke(t) {
3100
2898
  }
3101
2899
  throw new Error("Unsupported content type for blobUrl");
3102
2900
  }
3103
- function fn(t, e, s, n) {
2901
+ function Ss(t, e, s, n) {
3104
2902
  return {
3105
- id: n ?? $e(),
2903
+ id: n ?? Ee(),
3106
2904
  name: t,
3107
2905
  mimeType: e,
3108
- blobUrl: Ke(s)
2906
+ blobUrl: Le(s)
3109
2907
  };
3110
2908
  }
3111
- function hn(t, e) {
2909
+ function Rs(t, e) {
3112
2910
  let s = t.blobUrl;
3113
- return e.content !== void 0 && (s = Ke(e.content)), {
2911
+ return e.content !== void 0 && (s = Le(e.content)), {
3114
2912
  ...t,
3115
2913
  ...e,
3116
2914
  blobUrl: s
3117
2915
  };
3118
2916
  }
3119
- window.addEventListener("message", Bs);
3120
- async function pn(t, e) {
2917
+ window.addEventListener("message", ss);
2918
+ async function Cs(t, e) {
3121
2919
  await C({
3122
2920
  type: "qp-bridge",
3123
2921
  action: "setAnswer",
@@ -3125,14 +2923,14 @@ async function pn(t, e) {
3125
2923
  answer: e
3126
2924
  });
3127
2925
  }
3128
- async function mn(t) {
3129
- return await zs({
2926
+ async function Ts(t) {
2927
+ return await ns({
3130
2928
  type: "qp-bridge",
3131
2929
  action: "getQuestion",
3132
2930
  question: t
3133
2931
  });
3134
2932
  }
3135
- async function gn(t, e) {
2933
+ async function As(t, e) {
3136
2934
  await C({
3137
2935
  type: "qp-bridge",
3138
2936
  action: "setQuestion",
@@ -3140,14 +2938,14 @@ async function gn(t, e) {
3140
2938
  questionData: e
3141
2939
  });
3142
2940
  }
3143
- async function yn(t) {
3144
- return await Gs({
2941
+ async function Ns(t) {
2942
+ return await rs({
3145
2943
  type: "qp-bridge",
3146
2944
  action: "getGroup",
3147
2945
  group: t
3148
2946
  });
3149
2947
  }
3150
- async function vn(t, e) {
2948
+ async function Os(t, e) {
3151
2949
  await C({
3152
2950
  type: "qp-bridge",
3153
2951
  action: "setGroup",
@@ -3155,9 +2953,9 @@ async function vn(t, e) {
3155
2953
  groupData: e
3156
2954
  });
3157
2955
  }
3158
- function _n(t) {
2956
+ function Es(t) {
3159
2957
  const e = (s) => {
3160
- Is(s.data) && t(s.data.question, s.data.answer);
2958
+ Gt(s.data) && t(s.data.question, s.data.answer);
3161
2959
  };
3162
2960
  return window.addEventListener("message", e), {
3163
2961
  cancelSubscription: () => {
@@ -3165,7 +2963,7 @@ function _n(t) {
3165
2963
  }
3166
2964
  };
3167
2965
  }
3168
- async function xn(t) {
2966
+ async function Is(t) {
3169
2967
  await C({
3170
2968
  type: "qp-bridge",
3171
2969
  action: "busyIndicatorStart"
@@ -3179,38 +2977,38 @@ async function xn(t) {
3179
2977
  });
3180
2978
  }
3181
2979
  }
3182
- async function bn() {
2980
+ async function Ms() {
3183
2981
  await C({
3184
2982
  type: "qp-bridge",
3185
2983
  action: "saveQuestionnaire"
3186
2984
  });
3187
2985
  }
3188
- async function wn() {
2986
+ async function Zs() {
3189
2987
  await C({
3190
2988
  type: "qp-bridge",
3191
2989
  action: "completeAndCloseQuestionnaire"
3192
2990
  });
3193
2991
  }
3194
- async function kn(t) {
2992
+ async function js(t) {
3195
2993
  await C({
3196
2994
  type: "qp-bridge",
3197
2995
  action: "executeCustomCommand",
3198
2996
  commandName: t
3199
2997
  });
3200
2998
  }
3201
- const te = [];
3202
- function Sn(t) {
3203
- return te.includes(t) || te.push(t), {
2999
+ const J = [];
3000
+ function qs(t) {
3001
+ return J.includes(t) || J.push(t), {
3204
3002
  cancelSubscription: () => {
3205
- const e = te.indexOf(t);
3206
- e !== -1 && te.splice(e, 1);
3003
+ const e = J.indexOf(t);
3004
+ e !== -1 && J.splice(e, 1);
3207
3005
  }
3208
3006
  };
3209
3007
  }
3210
- async function Bs(t) {
3008
+ async function ss(t) {
3211
3009
  try {
3212
- if (qs(t.data)) {
3213
- const e = await Promise.all(te.map((n) => n())), s = {
3010
+ if (Ht(t.data)) {
3011
+ const e = await Promise.all(J.map((n) => n())), s = {
3214
3012
  type: "qp-bridge",
3215
3013
  status: "success",
3216
3014
  id: t.data.id,
@@ -3222,38 +3020,38 @@ async function Bs(t) {
3222
3020
  const s = {
3223
3021
  type: "qp-bridge",
3224
3022
  status: "error",
3225
- id: Xe(t.data) ? t.data.id : void 0,
3023
+ id: $e(t.data) ? t.data.id : void 0,
3226
3024
  message: e instanceof Error ? e.message : "Unknown error"
3227
3025
  };
3228
3026
  window.parent.postMessage(s, "*");
3229
3027
  }
3230
3028
  }
3231
- async function Tn(t) {
3232
- return await Qs({
3029
+ async function Ps(t) {
3030
+ return await as({
3233
3031
  type: "qp-bridge",
3234
3032
  action: "fetchEntities",
3235
3033
  fetchXml: t
3236
3034
  });
3237
3035
  }
3238
- async function Rn(t, e) {
3239
- return await Ws({
3036
+ async function $s(t, e) {
3037
+ return await is({
3240
3038
  type: "qp-bridge",
3241
3039
  action: "getEntityById",
3242
3040
  entityName: t,
3243
3041
  entityId: e
3244
3042
  });
3245
3043
  }
3246
- function En() {
3044
+ function Ls() {
3247
3045
  return { isNew: !0 };
3248
3046
  }
3249
- async function Cn(t) {
3047
+ async function Us(t) {
3250
3048
  await C({
3251
3049
  type: "qp-bridge",
3252
3050
  action: "saveEntity",
3253
3051
  entity: t
3254
3052
  });
3255
3053
  }
3256
- async function Zn(t, e) {
3054
+ async function Vs(t, e) {
3257
3055
  await C({
3258
3056
  type: "qp-bridge",
3259
3057
  action: "repeatGroup",
@@ -3261,14 +3059,14 @@ async function Zn(t, e) {
3261
3059
  groupIndex: e
3262
3060
  });
3263
3061
  }
3264
- async function Nn(t) {
3062
+ async function Bs(t) {
3265
3063
  await C({
3266
3064
  type: "qp-bridge",
3267
3065
  action: "addNewGroup",
3268
3066
  groupName: t
3269
3067
  });
3270
3068
  }
3271
- async function Mn(t, e) {
3069
+ async function zs(t, e) {
3272
3070
  await C({
3273
3071
  type: "qp-bridge",
3274
3072
  action: "deleteGroup",
@@ -3276,112 +3074,112 @@ async function Mn(t, e) {
3276
3074
  groupIndex: e
3277
3075
  });
3278
3076
  }
3279
- async function ye(t, e) {
3077
+ async function Y(t, e) {
3280
3078
  return new Promise((s, n) => {
3281
- const r = $e(), a = (i) => {
3282
- if (Ls(i.data, r))
3079
+ const r = Ee(), a = (i) => {
3080
+ if (Kt(i.data, r))
3283
3081
  return;
3284
- const o = e(i.data);
3285
- o.success ? s(o.data) : As(i.data) ? n(new Error(i.data.message)) : n(new Error("Unknown message received")), window.removeEventListener("message", a);
3082
+ const c = e(i.data);
3083
+ c.success ? s(c.data) : Qt(i.data) ? n(new Error(i.data.message)) : n(new Error("Unknown message received")), window.removeEventListener("message", a);
3286
3084
  };
3287
3085
  window.addEventListener("message", a), window.parent.postMessage({ ...t, id: r }, "*");
3288
3086
  });
3289
3087
  }
3290
- async function zs(t) {
3291
- return ye(t, (e) => js(e) ? { success: !0, data: e.question } : { success: !1 });
3088
+ async function ns(t) {
3089
+ return Y(t, (e) => Wt(e) ? { success: !0, data: e.question } : { success: !1 });
3292
3090
  }
3293
- async function Gs(t) {
3294
- return ye(t, (e) => Ps(e) ? { success: !0, data: e.group } : { success: !1 });
3091
+ async function rs(t) {
3092
+ return Y(t, (e) => Jt(e) ? { success: !0, data: e.group } : { success: !1 });
3295
3093
  }
3296
3094
  function C(t) {
3297
- return ye(t, (e) => Os(e) ? { success: !0, data: void 0 } : { success: !1 });
3095
+ return Y(t, (e) => Ft(e) ? { success: !0, data: void 0 } : { success: !1 });
3298
3096
  }
3299
- async function Qs(t) {
3300
- return ye(t, (e) => Vs(e) ? { success: !0, data: e.entities } : { success: !1 });
3097
+ async function as(t) {
3098
+ return Y(t, (e) => es(e) ? { success: !0, data: e.entities } : { success: !1 });
3301
3099
  }
3302
- async function Ws(t) {
3303
- return ye(t, (e) => Ds(e) ? { success: !0, data: e.entity } : { success: !1 });
3100
+ async function is(t) {
3101
+ return Y(t, (e) => ts(e) ? { success: !0, data: e.entity } : { success: !1 });
3304
3102
  }
3305
3103
  export {
3306
- Nn as addNewGroup,
3307
- Ns as addNewGroupRequestMessageSchema,
3308
- xs as busyIndicatorEndRequestMessageSchema,
3309
- _s as busyIndicatorStartRequestMessageSchema,
3310
- gs as canSaveRequestMessageSchema,
3311
- ms as canSaveSuccessResponseMessageSchema,
3312
- wn as completeAndCloseQuestionnaire,
3313
- ws as completeAndCloseQuestionnaireRequestMessageSchema,
3314
- fn as createMediaItem,
3315
- En as createNewEntity,
3316
- Mn as deleteGroup,
3317
- Ms as deleteGroupRequestMessageSchema,
3318
- Ae as entitySchema,
3319
- kn as executeCustomCommand,
3320
- ks as executeCustomCommandRequestMessageSchema,
3321
- Tn as fetchEntities,
3322
- Ss as fetchEntitiesRequestMessageSchema,
3323
- Ts as fetchEntitiesSuccessResponseMessageSchema,
3324
- Rn as getEntityById,
3325
- Rs as getEntityByIdRequestMessageSchema,
3326
- Es as getEntityByIdSuccessResponseMessageSchema,
3327
- yn as getGroup,
3328
- hs as getGroupRequestMessageSchema,
3329
- ps as getGroupSuccessResponseMessageSchema,
3330
- mn as getQuestion,
3331
- ds as getQuestionRequestMessageSchema,
3332
- ls as getQuestionSuccessResponseMessageSchema,
3333
- us as groupOptionalScheme,
3334
- Je as groupSchema,
3335
- dn as isAddNewGroupRequestMessage,
3336
- Us as isBusyIndicatorEndRequestMessage,
3337
- $s as isBusyIndicatorStartRequestMessage,
3338
- qs as isCanSaveRequestMessage,
3339
- en as isCanSaveSuccessResponseMessage,
3340
- sn as isCompleteAndCloseQuestionnaireRequestMessage,
3341
- ln as isDeleteGroupRequestMessage,
3342
- As as isErrorMessage,
3343
- nn as isExecuteCustomCommandRequestMessage,
3344
- an as isFetchEntitiesRequestMessage,
3345
- Vs as isFetchEntitiesSuccessResponseMessage,
3346
- on as isGetEntityByIdRequestMessage,
3347
- Ds as isGetEntityByIdSuccessResponseMessage,
3348
- Fs as isGetGroupRequestMessage,
3349
- Ps as isGetGroupSuccessResponseMessage,
3350
- Ys as isGetQuestionRequestMessage,
3351
- js as isGetQuestionSuccessResponseMessage,
3352
- Hs as isMediaItem,
3353
- Ls as isNotRelevantMessage,
3354
- Is as isOnAnswerChangeMessage,
3355
- Xe as isQpBridgeMessage,
3356
- un as isRepeatGroupRequestMessage,
3357
- cn as isSaveEntityRequestMessage,
3358
- tn as isSaveQuestionnaireRequestMessage,
3359
- Js as isSetAnswerRequestMessage,
3360
- Ks as isSetGroupRequestMessage,
3361
- Xs as isSetQuestionRequestMessage,
3362
- Os as isSuccessMessage,
3363
- rn as isWithBusyIndicatorRequestMessage,
3364
- cs as mediaItemSchema,
3365
- _n as onAnswerChange,
3366
- as as onAnswerChangeMessageSchema,
3367
- Sn as onSave,
3104
+ Bs as addNewGroup,
3105
+ zt as addNewGroupRequestMessageSchema,
3106
+ Mt as busyIndicatorEndRequestMessageSchema,
3107
+ It as busyIndicatorStartRequestMessageSchema,
3108
+ Nt as canSaveRequestMessageSchema,
3109
+ At as canSaveSuccessResponseMessageSchema,
3110
+ Zs as completeAndCloseQuestionnaire,
3111
+ jt as completeAndCloseQuestionnaireRequestMessageSchema,
3112
+ Ss as createMediaItem,
3113
+ Ls as createNewEntity,
3114
+ zs as deleteGroup,
3115
+ Dt as deleteGroupRequestMessageSchema,
3116
+ Re as entitySchema,
3117
+ js as executeCustomCommand,
3118
+ qt as executeCustomCommandRequestMessageSchema,
3119
+ Ps as fetchEntities,
3120
+ Pt as fetchEntitiesRequestMessageSchema,
3121
+ $t as fetchEntitiesSuccessResponseMessageSchema,
3122
+ $s as getEntityById,
3123
+ Lt as getEntityByIdRequestMessageSchema,
3124
+ Ut as getEntityByIdSuccessResponseMessageSchema,
3125
+ Ns as getGroup,
3126
+ Ct as getGroupRequestMessageSchema,
3127
+ Tt as getGroupSuccessResponseMessageSchema,
3128
+ Ts as getQuestion,
3129
+ wt as getQuestionRequestMessageSchema,
3130
+ St as getQuestionSuccessResponseMessageSchema,
3131
+ kt as groupOptionalScheme,
3132
+ Pe as groupSchema,
3133
+ ks as isAddNewGroupRequestMessage,
3134
+ Xt as isBusyIndicatorEndRequestMessage,
3135
+ Yt as isBusyIndicatorStartRequestMessage,
3136
+ Ht as isCanSaveRequestMessage,
3137
+ hs as isCanSaveSuccessResponseMessage,
3138
+ ps as isCompleteAndCloseQuestionnaireRequestMessage,
3139
+ ws as isDeleteGroupRequestMessage,
3140
+ Qt as isErrorMessage,
3141
+ gs as isExecuteCustomCommandRequestMessage,
3142
+ _s as isFetchEntitiesRequestMessage,
3143
+ es as isFetchEntitiesSuccessResponseMessage,
3144
+ vs as isGetEntityByIdRequestMessage,
3145
+ ts as isGetEntityByIdSuccessResponseMessage,
3146
+ fs as isGetGroupRequestMessage,
3147
+ Jt as isGetGroupSuccessResponseMessage,
3148
+ os as isGetQuestionRequestMessage,
3149
+ Wt as isGetQuestionSuccessResponseMessage,
3150
+ cs as isMediaItem,
3151
+ Kt as isNotRelevantMessage,
3152
+ Gt as isOnAnswerChangeMessage,
3153
+ $e as isQpBridgeMessage,
3154
+ bs as isRepeatGroupRequestMessage,
3155
+ xs as isSaveEntityRequestMessage,
3156
+ ms as isSaveQuestionnaireRequestMessage,
3157
+ us as isSetAnswerRequestMessage,
3158
+ ls as isSetGroupRequestMessage,
3159
+ ds as isSetQuestionRequestMessage,
3160
+ Ft as isSuccessMessage,
3161
+ ys as isWithBusyIndicatorRequestMessage,
3162
+ bt as mediaItemSchema,
3163
+ Es as onAnswerChange,
3164
+ _t as onAnswerChangeMessageSchema,
3165
+ qs as onSave,
3368
3166
  w as qpBridgeMessageSchema,
3369
- os as questionOptionalScheme,
3370
- Ye as questionSchema,
3371
- Zn as repeatGroup,
3372
- Zs as repeatGroupRequestMessageSchema,
3373
- is as responseErrorMessageSchema,
3374
- K as responseSuccessMessageSchema,
3375
- Cn as saveEntity,
3376
- Cs as saveEntityRequestMessageSchema,
3377
- bn as saveQuestionnaire,
3378
- bs as saveQuestionnaireRequestMessageSchema,
3379
- pn as setAnswer,
3380
- vs as setAnswerRequestMessageSchema,
3381
- vn as setGroup,
3382
- ys as setGroupRequestMessageSchema,
3383
- gn as setQuestion,
3384
- fs as setQuestionRequestMessageSchema,
3385
- hn as updateMediaItem,
3386
- xn as withBusyIndicator
3167
+ xt as questionOptionalScheme,
3168
+ qe as questionSchema,
3169
+ Vs as repeatGroup,
3170
+ Bt as repeatGroupRequestMessageSchema,
3171
+ vt as responseErrorMessageSchema,
3172
+ Q as responseSuccessMessageSchema,
3173
+ Us as saveEntity,
3174
+ Vt as saveEntityRequestMessageSchema,
3175
+ Ms as saveQuestionnaire,
3176
+ Zt as saveQuestionnaireRequestMessageSchema,
3177
+ Cs as setAnswer,
3178
+ Et as setAnswerRequestMessageSchema,
3179
+ Os as setGroup,
3180
+ Ot as setGroupRequestMessageSchema,
3181
+ As as setQuestion,
3182
+ Rt as setQuestionRequestMessageSchema,
3183
+ Rs as updateMediaItem,
3184
+ Is as withBusyIndicator
3387
3185
  };