react-luminus-components 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +3 -0
  2. package/dist/.vite/manifest.json +133 -0
  3. package/dist/Modal-JLnYbEat.js +1 -0
  4. package/dist/Modal-_FnSEPRk.mjs +623 -0
  5. package/dist/SimpleTooltip-BjlbHsKC.mjs +1767 -0
  6. package/dist/SimpleTooltip-D9shMl1R.js +1 -0
  7. package/dist/components/EmployeePicker/EmployeeSearch/EmployeeSearch.d.ts +7 -0
  8. package/dist/components/EmployeePicker/EmployeeSearchModal/EmployeeSearchModal.d.ts +9 -0
  9. package/dist/components/EmployeePicker/comps/EmployeeSearchItem/EmployeeSearchItem.d.ts +7 -0
  10. package/dist/components/EmployeePicker/comps/index.d.ts +1 -0
  11. package/dist/components/EmployeePicker/index.d.ts +2 -0
  12. package/dist/components/Form/CheckInput/CheckInput.d.ts +11 -0
  13. package/dist/components/Form/Container/InputContainer.d.ts +8 -0
  14. package/dist/components/Form/EmployeePicker/EmployeePicker.d.ts +12 -0
  15. package/dist/components/Form/SelectInput/SelectInput.d.ts +17 -0
  16. package/dist/components/Form/TextInput/TextInput.d.ts +16 -0
  17. package/dist/components/Form/index.d.ts +4 -0
  18. package/dist/components/HookForm/CheckInput/HookFormCheckInput.d.ts +9 -0
  19. package/dist/components/HookForm/EmployeePicker/HookFormEmployeePicker.d.ts +9 -0
  20. package/dist/components/HookForm/FloatingSubmit/FloatingFormSubmit.d.ts +6 -0
  21. package/dist/components/HookForm/RadioInput/HookFormRadioInput.d.ts +9 -0
  22. package/dist/components/HookForm/SelectInput/HookFormSelectInput.d.ts +9 -0
  23. package/dist/components/HookForm/TextAreaInput/HookFormTextAreaInput.d.ts +9 -0
  24. package/dist/components/HookForm/TextInput/HookFormTextInput.d.ts +9 -0
  25. package/dist/components/HookForm/index.d.ts +7 -0
  26. package/dist/components/Tooltip/HtmlTooltip/HtmlTooltip.d.ts +10 -0
  27. package/dist/components/Tooltip/SimpleTooltip/SimpleTooltip.d.ts +8 -0
  28. package/dist/components/Tooltip/index.d.ts +2 -0
  29. package/dist/components/UserAvatar/AvatarIcon/AvatarIcon.d.ts +8 -0
  30. package/dist/components/UserAvatar/UserAvatarDropdown/UserAvatarDropdown.d.ts +7 -0
  31. package/dist/components/UserAvatar/UserAvatarToggle/UserAvatarToggle.d.ts +8 -0
  32. package/dist/components/UserAvatar/index.d.ts +2 -0
  33. package/dist/components/common/ApiFileDownloadButton/ApiFileDownloadButton.d.ts +9 -0
  34. package/dist/components/common/ConfirmDialog/ConfirmDialog.d.ts +3 -0
  35. package/dist/components/common/HomeDashboard/HomeDashboard.d.ts +9 -0
  36. package/dist/components/common/HomeDashboard/comps/FreeSpaceWidget/FreeSpaceWidget.d.ts +6 -0
  37. package/dist/components/common/HomeDashboard/comps/index.d.ts +1 -0
  38. package/dist/components/common/HomeDashboard/hooks/useUserDashboard.d.ts +6 -0
  39. package/dist/components/common/Loading/Loading.d.ts +3 -0
  40. package/dist/components/common/MonthPicker/MonthPicker.d.ts +9 -0
  41. package/dist/components/common/Typography/Typography.d.ts +9 -0
  42. package/dist/components/common/index.d.ts +6 -0
  43. package/dist/constants-CT2hnPeO.js +1 -0
  44. package/dist/constants-CzNy5yO3.mjs +7 -0
  45. package/dist/contexts/confirm/ConfirmContext.d.ts +9 -0
  46. package/dist/contexts/confirm/ConfirmProvider.d.ts +6 -0
  47. package/dist/contexts/index.d.ts +6 -0
  48. package/dist/contexts/loading/LoadingContext.d.ts +8 -0
  49. package/dist/contexts/loading/LoadingProvider.d.ts +6 -0
  50. package/dist/contexts/luminus-components/LuminusComponentsContext.d.ts +15 -0
  51. package/dist/contexts/luminus-components/LuminusComponentsProvider.d.ts +16 -0
  52. package/dist/contexts/user/UserContext.d.ts +9 -0
  53. package/dist/contexts/user/UserProvider.d.ts +6 -0
  54. package/dist/contexts.cjs.js +1 -0
  55. package/dist/contexts.d.ts +1 -0
  56. package/dist/contexts.es.js +86 -0
  57. package/dist/hasClass-3JW9Qluf.mjs +1482 -0
  58. package/dist/hasClass-6m1Qq_DA.js +20 -0
  59. package/dist/hooks/index.d.ts +5 -0
  60. package/dist/hooks/useAuth/useAuth.d.ts +7 -0
  61. package/dist/hooks/useAxios/useAxios.d.ts +3 -0
  62. package/dist/hooks/useConfirm/useConfirm.d.ts +8 -0
  63. package/dist/hooks/useNotifications/useNotifications.d.ts +4 -0
  64. package/dist/hooks/useZodSchemaTypes/useZodSchemaTypes.d.ts +44 -0
  65. package/dist/hooks.cjs.js +1 -0
  66. package/dist/hooks.d.ts +1 -0
  67. package/dist/hooks.es.js +2781 -0
  68. package/dist/layout/FullScreenContainer/FullScreenContainer.d.ts +4 -0
  69. package/dist/layout/MainContainer/MainContainer.d.ts +4 -0
  70. package/dist/layout/SideContentBar/SideContentBar.d.ts +7 -0
  71. package/dist/layout/SideMenu/MenuItem/MenuItem.d.ts +10 -0
  72. package/dist/layout/SideMenu/SideMenu.d.ts +10 -0
  73. package/dist/layout/TopBar/TopBar.d.ts +7 -0
  74. package/dist/layout/index.d.ts +5 -0
  75. package/dist/layout.cjs.js +1 -0
  76. package/dist/layout.d.ts +1 -0
  77. package/dist/layout.es.js +164 -0
  78. package/dist/main.cjs.js +1 -0
  79. package/dist/main.d.ts +11 -0
  80. package/dist/main.es.js +2788 -0
  81. package/dist/models/index.d.ts +23 -0
  82. package/dist/models/prop-types/ContainerProps.d.ts +6 -0
  83. package/dist/models/prop-types/HookFormCheckInputProps.d.ts +7 -0
  84. package/dist/models/prop-types/HookFormEmployeePickerProps.d.ts +9 -0
  85. package/dist/models/prop-types/HookFormInputProps.d.ts +9 -0
  86. package/dist/models/prop-types/HookFormRadioInputProps.d.ts +7 -0
  87. package/dist/models/prop-types/HookFormSelectInputProps.d.ts +12 -0
  88. package/dist/models/prop-types/HookFormTextAreaInputProps.d.ts +9 -0
  89. package/dist/models/prop-types/HookFormTextInputProps.d.ts +11 -0
  90. package/dist/models/texts/AxiosTexts.d.ts +6 -0
  91. package/dist/models/texts/ConfirmTexts.d.ts +5 -0
  92. package/dist/models/texts/EmployeeSearchModalTexts.d.ts +6 -0
  93. package/dist/models/texts/FormValidationTexts.d.ts +5 -0
  94. package/dist/models/texts/HomeDashboardTexts.d.ts +5 -0
  95. package/dist/models/types/ApiErrorResult.d.ts +7 -0
  96. package/dist/models/types/DashboardConfig.d.ts +5 -0
  97. package/dist/models/types/DashboardWidget.d.ts +7 -0
  98. package/dist/models/types/DashboardWidgetConfig.d.ts +5 -0
  99. package/dist/models/types/EmployeeIndexModel.d.ts +14 -0
  100. package/dist/models/types/ErrorField.d.ts +5 -0
  101. package/dist/models/types/FormSelectOption.d.ts +5 -0
  102. package/dist/models/types/HookFormInputProps.d.ts +9 -0
  103. package/dist/models/types/MenuItemType.d.ts +9 -0
  104. package/dist/models/types/NameIdIntModel.d.ts +5 -0
  105. package/dist/models/types/NameIdStringModel.d.ts +5 -0
  106. package/dist/models/types/UserModel.d.ts +13 -0
  107. package/dist/style.css +1 -0
  108. package/dist/textUtils-9KFqOvA8.mjs +27 -0
  109. package/dist/textUtils-C0nqWp3S.js +1 -0
  110. package/dist/useAxios-BU-BqYrK.mjs +2663 -0
  111. package/dist/useAxios-ZEhq7C_H.js +212 -0
  112. package/dist/useConfirm-BazFQNRI.js +1 -0
  113. package/dist/useConfirm-DH9Pmz_w.mjs +18 -0
  114. package/dist/utils/apiErrorFields/apiErrorFieldsUtils.d.ts +4 -0
  115. package/dist/utils/date/dateUtils.d.ts +1 -0
  116. package/dist/utils/index.d.ts +4 -0
  117. package/dist/utils/object/objectUtils.d.ts +2 -0
  118. package/dist/utils/text/textUtils.d.ts +1 -0
  119. package/dist/utils.cjs.js +1 -0
  120. package/dist/utils.d.ts +1 -0
  121. package/dist/utils.es.js +137 -0
  122. package/package.json +94 -0
@@ -0,0 +1,2781 @@
1
+ import { L as Ae } from "./useAxios-BU-BqYrK.mjs";
2
+ import { c as Ut, u as Bt, b as qt, a as Wt } from "./useAxios-BU-BqYrK.mjs";
3
+ import { u as Yt } from "./useConfirm-DH9Pmz_w.mjs";
4
+ import { useContext as Me } from "react";
5
+ import { isISODate as Pe } from "./utils.es.js";
6
+ var g;
7
+ (function(r) {
8
+ r.assertEqual = (n) => n;
9
+ function e(n) {
10
+ }
11
+ r.assertIs = e;
12
+ function t(n) {
13
+ throw new Error();
14
+ }
15
+ r.assertNever = t, r.arrayToEnum = (n) => {
16
+ const a = {};
17
+ for (const i of n)
18
+ a[i] = i;
19
+ return a;
20
+ }, r.getValidEnumValues = (n) => {
21
+ const a = r.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
22
+ for (const o of a)
23
+ i[o] = n[o];
24
+ return r.objectValues(i);
25
+ }, r.objectValues = (n) => r.objectKeys(n).map(function(a) {
26
+ return n[a];
27
+ }), r.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
28
+ const a = [];
29
+ for (const i in n)
30
+ Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
31
+ return a;
32
+ }, r.find = (n, a) => {
33
+ for (const i of n)
34
+ if (a(i))
35
+ return i;
36
+ }, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
37
+ function s(n, a = " | ") {
38
+ return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
39
+ }
40
+ r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
41
+ })(g || (g = {}));
42
+ var ge;
43
+ (function(r) {
44
+ r.mergeShapes = (e, t) => ({
45
+ ...e,
46
+ ...t
47
+ // second overwrites first
48
+ });
49
+ })(ge || (ge = {}));
50
+ const u = g.arrayToEnum([
51
+ "string",
52
+ "nan",
53
+ "number",
54
+ "integer",
55
+ "float",
56
+ "boolean",
57
+ "date",
58
+ "bigint",
59
+ "symbol",
60
+ "function",
61
+ "undefined",
62
+ "null",
63
+ "array",
64
+ "object",
65
+ "unknown",
66
+ "promise",
67
+ "void",
68
+ "never",
69
+ "map",
70
+ "set"
71
+ ]), M = (r) => {
72
+ switch (typeof r) {
73
+ case "undefined":
74
+ return u.undefined;
75
+ case "string":
76
+ return u.string;
77
+ case "number":
78
+ return isNaN(r) ? u.nan : u.number;
79
+ case "boolean":
80
+ return u.boolean;
81
+ case "function":
82
+ return u.function;
83
+ case "bigint":
84
+ return u.bigint;
85
+ case "symbol":
86
+ return u.symbol;
87
+ case "object":
88
+ return Array.isArray(r) ? u.array : r === null ? u.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? u.promise : typeof Map < "u" && r instanceof Map ? u.map : typeof Set < "u" && r instanceof Set ? u.set : typeof Date < "u" && r instanceof Date ? u.date : u.object;
89
+ default:
90
+ return u.unknown;
91
+ }
92
+ }, c = g.arrayToEnum([
93
+ "invalid_type",
94
+ "invalid_literal",
95
+ "custom",
96
+ "invalid_union",
97
+ "invalid_union_discriminator",
98
+ "invalid_enum_value",
99
+ "unrecognized_keys",
100
+ "invalid_arguments",
101
+ "invalid_return_type",
102
+ "invalid_date",
103
+ "invalid_string",
104
+ "too_small",
105
+ "too_big",
106
+ "invalid_intersection_types",
107
+ "not_multiple_of",
108
+ "not_finite"
109
+ ]), Ve = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
110
+ class C extends Error {
111
+ constructor(e) {
112
+ super(), this.issues = [], this.addIssue = (s) => {
113
+ this.issues = [...this.issues, s];
114
+ }, this.addIssues = (s = []) => {
115
+ this.issues = [...this.issues, ...s];
116
+ };
117
+ const t = new.target.prototype;
118
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
119
+ }
120
+ get errors() {
121
+ return this.issues;
122
+ }
123
+ format(e) {
124
+ const t = e || function(a) {
125
+ return a.message;
126
+ }, s = { _errors: [] }, n = (a) => {
127
+ for (const i of a.issues)
128
+ if (i.code === "invalid_union")
129
+ i.unionErrors.map(n);
130
+ else if (i.code === "invalid_return_type")
131
+ n(i.returnTypeError);
132
+ else if (i.code === "invalid_arguments")
133
+ n(i.argumentsError);
134
+ else if (i.path.length === 0)
135
+ s._errors.push(t(i));
136
+ else {
137
+ let o = s, h = 0;
138
+ for (; h < i.path.length; ) {
139
+ const d = i.path[h];
140
+ h === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], h++;
141
+ }
142
+ }
143
+ };
144
+ return n(this), s;
145
+ }
146
+ toString() {
147
+ return this.message;
148
+ }
149
+ get message() {
150
+ return JSON.stringify(this.issues, g.jsonStringifyReplacer, 2);
151
+ }
152
+ get isEmpty() {
153
+ return this.issues.length === 0;
154
+ }
155
+ flatten(e = (t) => t.message) {
156
+ const t = {}, s = [];
157
+ for (const n of this.issues)
158
+ n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : s.push(e(n));
159
+ return { formErrors: s, fieldErrors: t };
160
+ }
161
+ get formErrors() {
162
+ return this.flatten();
163
+ }
164
+ }
165
+ C.create = (r) => new C(r);
166
+ const Y = (r, e) => {
167
+ let t;
168
+ switch (r.code) {
169
+ case c.invalid_type:
170
+ r.received === u.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
171
+ break;
172
+ case c.invalid_literal:
173
+ t = `Invalid literal value, expected ${JSON.stringify(r.expected, g.jsonStringifyReplacer)}`;
174
+ break;
175
+ case c.unrecognized_keys:
176
+ t = `Unrecognized key(s) in object: ${g.joinValues(r.keys, ", ")}`;
177
+ break;
178
+ case c.invalid_union:
179
+ t = "Invalid input";
180
+ break;
181
+ case c.invalid_union_discriminator:
182
+ t = `Invalid discriminator value. Expected ${g.joinValues(r.options)}`;
183
+ break;
184
+ case c.invalid_enum_value:
185
+ t = `Invalid enum value. Expected ${g.joinValues(r.options)}, received '${r.received}'`;
186
+ break;
187
+ case c.invalid_arguments:
188
+ t = "Invalid function arguments";
189
+ break;
190
+ case c.invalid_return_type:
191
+ t = "Invalid function return type";
192
+ break;
193
+ case c.invalid_date:
194
+ t = "Invalid date";
195
+ break;
196
+ case c.invalid_string:
197
+ typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : g.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
198
+ break;
199
+ case c.too_small:
200
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
201
+ break;
202
+ case c.too_big:
203
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
204
+ break;
205
+ case c.custom:
206
+ t = "Invalid input";
207
+ break;
208
+ case c.invalid_intersection_types:
209
+ t = "Intersection results could not be merged";
210
+ break;
211
+ case c.not_multiple_of:
212
+ t = `Number must be a multiple of ${r.multipleOf}`;
213
+ break;
214
+ case c.not_finite:
215
+ t = "Number must be finite";
216
+ break;
217
+ default:
218
+ t = e.defaultError, g.assertNever(r);
219
+ }
220
+ return { message: t };
221
+ };
222
+ let Ze = Y;
223
+ function ze(r) {
224
+ Ze = r;
225
+ }
226
+ function ce() {
227
+ return Ze;
228
+ }
229
+ const de = (r) => {
230
+ const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = {
231
+ ...n,
232
+ path: a
233
+ };
234
+ let o = "";
235
+ const h = s.filter((d) => !!d).slice().reverse();
236
+ for (const d of h)
237
+ o = d(i, { data: e, defaultError: o }).message;
238
+ return {
239
+ ...n,
240
+ path: a,
241
+ message: n.message || o
242
+ };
243
+ }, $e = [];
244
+ function l(r, e) {
245
+ const t = de({
246
+ issueData: e,
247
+ data: r.data,
248
+ path: r.path,
249
+ errorMaps: [
250
+ r.common.contextualErrorMap,
251
+ r.schemaErrorMap,
252
+ ce(),
253
+ Y
254
+ // then global default map
255
+ ].filter((s) => !!s)
256
+ });
257
+ r.common.issues.push(t);
258
+ }
259
+ class k {
260
+ constructor() {
261
+ this.value = "valid";
262
+ }
263
+ dirty() {
264
+ this.value === "valid" && (this.value = "dirty");
265
+ }
266
+ abort() {
267
+ this.value !== "aborted" && (this.value = "aborted");
268
+ }
269
+ static mergeArray(e, t) {
270
+ const s = [];
271
+ for (const n of t) {
272
+ if (n.status === "aborted")
273
+ return m;
274
+ n.status === "dirty" && e.dirty(), s.push(n.value);
275
+ }
276
+ return { status: e.value, value: s };
277
+ }
278
+ static async mergeObjectAsync(e, t) {
279
+ const s = [];
280
+ for (const n of t)
281
+ s.push({
282
+ key: await n.key,
283
+ value: await n.value
284
+ });
285
+ return k.mergeObjectSync(e, s);
286
+ }
287
+ static mergeObjectSync(e, t) {
288
+ const s = {};
289
+ for (const n of t) {
290
+ const { key: a, value: i } = n;
291
+ if (a.status === "aborted" || i.status === "aborted")
292
+ return m;
293
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (s[a.value] = i.value);
294
+ }
295
+ return { status: e.value, value: s };
296
+ }
297
+ }
298
+ const m = Object.freeze({
299
+ status: "aborted"
300
+ }), Se = (r) => ({ status: "dirty", value: r }), w = (r) => ({ status: "valid", value: r }), xe = (r) => r.status === "aborted", be = (r) => r.status === "dirty", H = (r) => r.status === "valid", ue = (r) => typeof Promise < "u" && r instanceof Promise;
301
+ var f;
302
+ (function(r) {
303
+ r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
304
+ })(f || (f = {}));
305
+ class E {
306
+ constructor(e, t, s, n) {
307
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
308
+ }
309
+ get path() {
310
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
311
+ }
312
+ }
313
+ const we = (r, e) => {
314
+ if (H(e))
315
+ return { success: !0, data: e.value };
316
+ if (!r.common.issues.length)
317
+ throw new Error("Validation failed but no issues detected.");
318
+ return {
319
+ success: !1,
320
+ get error() {
321
+ if (this._error)
322
+ return this._error;
323
+ const t = new C(r.common.issues);
324
+ return this._error = t, this._error;
325
+ }
326
+ };
327
+ };
328
+ function y(r) {
329
+ if (!r)
330
+ return {};
331
+ const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
332
+ if (e && (t || s))
333
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
334
+ return e ? { errorMap: e, description: n } : { errorMap: (i, o) => i.code !== "invalid_type" ? { message: o.defaultError } : typeof o.data > "u" ? { message: s ?? o.defaultError } : { message: t ?? o.defaultError }, description: n };
335
+ }
336
+ class v {
337
+ constructor(e) {
338
+ 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);
339
+ }
340
+ get description() {
341
+ return this._def.description;
342
+ }
343
+ _getType(e) {
344
+ return M(e.data);
345
+ }
346
+ _getOrReturnCtx(e, t) {
347
+ return t || {
348
+ common: e.parent.common,
349
+ data: e.data,
350
+ parsedType: M(e.data),
351
+ schemaErrorMap: this._def.errorMap,
352
+ path: e.path,
353
+ parent: e.parent
354
+ };
355
+ }
356
+ _processInputParams(e) {
357
+ return {
358
+ status: new k(),
359
+ ctx: {
360
+ common: e.parent.common,
361
+ data: e.data,
362
+ parsedType: M(e.data),
363
+ schemaErrorMap: this._def.errorMap,
364
+ path: e.path,
365
+ parent: e.parent
366
+ }
367
+ };
368
+ }
369
+ _parseSync(e) {
370
+ const t = this._parse(e);
371
+ if (ue(t))
372
+ throw new Error("Synchronous parse encountered promise.");
373
+ return t;
374
+ }
375
+ _parseAsync(e) {
376
+ const t = this._parse(e);
377
+ return Promise.resolve(t);
378
+ }
379
+ parse(e, t) {
380
+ const s = this.safeParse(e, t);
381
+ if (s.success)
382
+ return s.data;
383
+ throw s.error;
384
+ }
385
+ safeParse(e, t) {
386
+ var s;
387
+ const n = {
388
+ common: {
389
+ issues: [],
390
+ async: (s = t == null ? void 0 : t.async) !== null && s !== void 0 ? s : !1,
391
+ contextualErrorMap: t == null ? void 0 : t.errorMap
392
+ },
393
+ path: (t == null ? void 0 : t.path) || [],
394
+ schemaErrorMap: this._def.errorMap,
395
+ parent: null,
396
+ data: e,
397
+ parsedType: M(e)
398
+ }, a = this._parseSync({ data: e, path: n.path, parent: n });
399
+ return we(n, a);
400
+ }
401
+ async parseAsync(e, t) {
402
+ const s = await this.safeParseAsync(e, t);
403
+ if (s.success)
404
+ return s.data;
405
+ throw s.error;
406
+ }
407
+ async safeParseAsync(e, t) {
408
+ const s = {
409
+ common: {
410
+ issues: [],
411
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
412
+ async: !0
413
+ },
414
+ path: (t == null ? void 0 : t.path) || [],
415
+ schemaErrorMap: this._def.errorMap,
416
+ parent: null,
417
+ data: e,
418
+ parsedType: M(e)
419
+ }, n = this._parse({ data: e, path: s.path, parent: s }), a = await (ue(n) ? n : Promise.resolve(n));
420
+ return we(s, a);
421
+ }
422
+ refine(e, t) {
423
+ const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
424
+ return this._refinement((n, a) => {
425
+ const i = e(n), o = () => a.addIssue({
426
+ code: c.custom,
427
+ ...s(n)
428
+ });
429
+ return typeof Promise < "u" && i instanceof Promise ? i.then((h) => h ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
430
+ });
431
+ }
432
+ refinement(e, t) {
433
+ return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
434
+ }
435
+ _refinement(e) {
436
+ return new O({
437
+ schema: this,
438
+ typeName: p.ZodEffects,
439
+ effect: { type: "refinement", refinement: e }
440
+ });
441
+ }
442
+ superRefine(e) {
443
+ return this._refinement(e);
444
+ }
445
+ optional() {
446
+ return R.create(this, this._def);
447
+ }
448
+ nullable() {
449
+ return U.create(this, this._def);
450
+ }
451
+ nullish() {
452
+ return this.nullable().optional();
453
+ }
454
+ array() {
455
+ return N.create(this, this._def);
456
+ }
457
+ promise() {
458
+ return J.create(this, this._def);
459
+ }
460
+ or(e) {
461
+ return K.create([this, e], this._def);
462
+ }
463
+ and(e) {
464
+ return F.create(this, e, this._def);
465
+ }
466
+ transform(e) {
467
+ return new O({
468
+ ...y(this._def),
469
+ schema: this,
470
+ typeName: p.ZodEffects,
471
+ effect: { type: "transform", transform: e }
472
+ });
473
+ }
474
+ default(e) {
475
+ const t = typeof e == "function" ? e : () => e;
476
+ return new ne({
477
+ ...y(this._def),
478
+ innerType: this,
479
+ defaultValue: t,
480
+ typeName: p.ZodDefault
481
+ });
482
+ }
483
+ brand() {
484
+ return new Ne({
485
+ typeName: p.ZodBranded,
486
+ type: this,
487
+ ...y(this._def)
488
+ });
489
+ }
490
+ catch(e) {
491
+ const t = typeof e == "function" ? e : () => e;
492
+ return new pe({
493
+ ...y(this._def),
494
+ innerType: this,
495
+ catchValue: t,
496
+ typeName: p.ZodCatch
497
+ });
498
+ }
499
+ describe(e) {
500
+ const t = this.constructor;
501
+ return new t({
502
+ ...this._def,
503
+ description: e
504
+ });
505
+ }
506
+ pipe(e) {
507
+ return ae.create(this, e);
508
+ }
509
+ readonly() {
510
+ return ye.create(this);
511
+ }
512
+ isOptional() {
513
+ return this.safeParse(void 0).success;
514
+ }
515
+ isNullable() {
516
+ return this.safeParse(null).success;
517
+ }
518
+ }
519
+ const Le = /^c[^\s-]{8,}$/i, De = /^[a-z][a-z0-9]*$/, Ue = /^[0-9A-HJKMNP-TV-Z]{26}$/, Be = /^[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, qe = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, We = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
520
+ let _e;
521
+ const Je = /^(((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}))$/, Ye = /^(([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})))$/, He = (r) => r.precision ? r.offset ? new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`) : new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`) : r.precision === 0 ? r.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$") : r.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");
522
+ function Ge(r, e) {
523
+ return !!((e === "v4" || !e) && Je.test(r) || (e === "v6" || !e) && Ye.test(r));
524
+ }
525
+ class S extends v {
526
+ _parse(e) {
527
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== u.string) {
528
+ const a = this._getOrReturnCtx(e);
529
+ return l(
530
+ a,
531
+ {
532
+ code: c.invalid_type,
533
+ expected: u.string,
534
+ received: a.parsedType
535
+ }
536
+ //
537
+ ), m;
538
+ }
539
+ const s = new k();
540
+ let n;
541
+ for (const a of this._def.checks)
542
+ if (a.kind === "min")
543
+ e.data.length < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
544
+ code: c.too_small,
545
+ minimum: a.value,
546
+ type: "string",
547
+ inclusive: !0,
548
+ exact: !1,
549
+ message: a.message
550
+ }), s.dirty());
551
+ else if (a.kind === "max")
552
+ e.data.length > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
553
+ code: c.too_big,
554
+ maximum: a.value,
555
+ type: "string",
556
+ inclusive: !0,
557
+ exact: !1,
558
+ message: a.message
559
+ }), s.dirty());
560
+ else if (a.kind === "length") {
561
+ const i = e.data.length > a.value, o = e.data.length < a.value;
562
+ (i || o) && (n = this._getOrReturnCtx(e, n), i ? l(n, {
563
+ code: c.too_big,
564
+ maximum: a.value,
565
+ type: "string",
566
+ inclusive: !0,
567
+ exact: !0,
568
+ message: a.message
569
+ }) : o && l(n, {
570
+ code: c.too_small,
571
+ minimum: a.value,
572
+ type: "string",
573
+ inclusive: !0,
574
+ exact: !0,
575
+ message: a.message
576
+ }), s.dirty());
577
+ } else if (a.kind === "email")
578
+ qe.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
579
+ validation: "email",
580
+ code: c.invalid_string,
581
+ message: a.message
582
+ }), s.dirty());
583
+ else if (a.kind === "emoji")
584
+ _e || (_e = new RegExp(We, "u")), _e.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
585
+ validation: "emoji",
586
+ code: c.invalid_string,
587
+ message: a.message
588
+ }), s.dirty());
589
+ else if (a.kind === "uuid")
590
+ Be.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
591
+ validation: "uuid",
592
+ code: c.invalid_string,
593
+ message: a.message
594
+ }), s.dirty());
595
+ else if (a.kind === "cuid")
596
+ Le.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
597
+ validation: "cuid",
598
+ code: c.invalid_string,
599
+ message: a.message
600
+ }), s.dirty());
601
+ else if (a.kind === "cuid2")
602
+ De.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
603
+ validation: "cuid2",
604
+ code: c.invalid_string,
605
+ message: a.message
606
+ }), s.dirty());
607
+ else if (a.kind === "ulid")
608
+ Ue.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
609
+ validation: "ulid",
610
+ code: c.invalid_string,
611
+ message: a.message
612
+ }), s.dirty());
613
+ else if (a.kind === "url")
614
+ try {
615
+ new URL(e.data);
616
+ } catch {
617
+ n = this._getOrReturnCtx(e, n), l(n, {
618
+ validation: "url",
619
+ code: c.invalid_string,
620
+ message: a.message
621
+ }), s.dirty();
622
+ }
623
+ else
624
+ a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
625
+ validation: "regex",
626
+ code: c.invalid_string,
627
+ message: a.message
628
+ }), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), l(n, {
629
+ code: c.invalid_string,
630
+ validation: { includes: a.value, position: a.position },
631
+ message: a.message
632
+ }), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
633
+ code: c.invalid_string,
634
+ validation: { startsWith: a.value },
635
+ message: a.message
636
+ }), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
637
+ code: c.invalid_string,
638
+ validation: { endsWith: a.value },
639
+ message: a.message
640
+ }), s.dirty()) : a.kind === "datetime" ? He(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
641
+ code: c.invalid_string,
642
+ validation: "datetime",
643
+ message: a.message
644
+ }), s.dirty()) : a.kind === "ip" ? Ge(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
645
+ validation: "ip",
646
+ code: c.invalid_string,
647
+ message: a.message
648
+ }), s.dirty()) : g.assertNever(a);
649
+ return { status: s.value, value: e.data };
650
+ }
651
+ _regex(e, t, s) {
652
+ return this.refinement((n) => e.test(n), {
653
+ validation: t,
654
+ code: c.invalid_string,
655
+ ...f.errToObj(s)
656
+ });
657
+ }
658
+ _addCheck(e) {
659
+ return new S({
660
+ ...this._def,
661
+ checks: [...this._def.checks, e]
662
+ });
663
+ }
664
+ email(e) {
665
+ return this._addCheck({ kind: "email", ...f.errToObj(e) });
666
+ }
667
+ url(e) {
668
+ return this._addCheck({ kind: "url", ...f.errToObj(e) });
669
+ }
670
+ emoji(e) {
671
+ return this._addCheck({ kind: "emoji", ...f.errToObj(e) });
672
+ }
673
+ uuid(e) {
674
+ return this._addCheck({ kind: "uuid", ...f.errToObj(e) });
675
+ }
676
+ cuid(e) {
677
+ return this._addCheck({ kind: "cuid", ...f.errToObj(e) });
678
+ }
679
+ cuid2(e) {
680
+ return this._addCheck({ kind: "cuid2", ...f.errToObj(e) });
681
+ }
682
+ ulid(e) {
683
+ return this._addCheck({ kind: "ulid", ...f.errToObj(e) });
684
+ }
685
+ ip(e) {
686
+ return this._addCheck({ kind: "ip", ...f.errToObj(e) });
687
+ }
688
+ datetime(e) {
689
+ var t;
690
+ return typeof e == "string" ? this._addCheck({
691
+ kind: "datetime",
692
+ precision: null,
693
+ offset: !1,
694
+ message: e
695
+ }) : this._addCheck({
696
+ kind: "datetime",
697
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
698
+ offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
699
+ ...f.errToObj(e == null ? void 0 : e.message)
700
+ });
701
+ }
702
+ regex(e, t) {
703
+ return this._addCheck({
704
+ kind: "regex",
705
+ regex: e,
706
+ ...f.errToObj(t)
707
+ });
708
+ }
709
+ includes(e, t) {
710
+ return this._addCheck({
711
+ kind: "includes",
712
+ value: e,
713
+ position: t == null ? void 0 : t.position,
714
+ ...f.errToObj(t == null ? void 0 : t.message)
715
+ });
716
+ }
717
+ startsWith(e, t) {
718
+ return this._addCheck({
719
+ kind: "startsWith",
720
+ value: e,
721
+ ...f.errToObj(t)
722
+ });
723
+ }
724
+ endsWith(e, t) {
725
+ return this._addCheck({
726
+ kind: "endsWith",
727
+ value: e,
728
+ ...f.errToObj(t)
729
+ });
730
+ }
731
+ min(e, t) {
732
+ return this._addCheck({
733
+ kind: "min",
734
+ value: e,
735
+ ...f.errToObj(t)
736
+ });
737
+ }
738
+ max(e, t) {
739
+ return this._addCheck({
740
+ kind: "max",
741
+ value: e,
742
+ ...f.errToObj(t)
743
+ });
744
+ }
745
+ length(e, t) {
746
+ return this._addCheck({
747
+ kind: "length",
748
+ value: e,
749
+ ...f.errToObj(t)
750
+ });
751
+ }
752
+ /**
753
+ * @deprecated Use z.string().min(1) instead.
754
+ * @see {@link ZodString.min}
755
+ */
756
+ nonempty(e) {
757
+ return this.min(1, f.errToObj(e));
758
+ }
759
+ trim() {
760
+ return new S({
761
+ ...this._def,
762
+ checks: [...this._def.checks, { kind: "trim" }]
763
+ });
764
+ }
765
+ toLowerCase() {
766
+ return new S({
767
+ ...this._def,
768
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
769
+ });
770
+ }
771
+ toUpperCase() {
772
+ return new S({
773
+ ...this._def,
774
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
775
+ });
776
+ }
777
+ get isDatetime() {
778
+ return !!this._def.checks.find((e) => e.kind === "datetime");
779
+ }
780
+ get isEmail() {
781
+ return !!this._def.checks.find((e) => e.kind === "email");
782
+ }
783
+ get isURL() {
784
+ return !!this._def.checks.find((e) => e.kind === "url");
785
+ }
786
+ get isEmoji() {
787
+ return !!this._def.checks.find((e) => e.kind === "emoji");
788
+ }
789
+ get isUUID() {
790
+ return !!this._def.checks.find((e) => e.kind === "uuid");
791
+ }
792
+ get isCUID() {
793
+ return !!this._def.checks.find((e) => e.kind === "cuid");
794
+ }
795
+ get isCUID2() {
796
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
797
+ }
798
+ get isULID() {
799
+ return !!this._def.checks.find((e) => e.kind === "ulid");
800
+ }
801
+ get isIP() {
802
+ return !!this._def.checks.find((e) => e.kind === "ip");
803
+ }
804
+ get minLength() {
805
+ let e = null;
806
+ for (const t of this._def.checks)
807
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
808
+ return e;
809
+ }
810
+ get maxLength() {
811
+ let e = null;
812
+ for (const t of this._def.checks)
813
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
814
+ return e;
815
+ }
816
+ }
817
+ S.create = (r) => {
818
+ var e;
819
+ return new S({
820
+ checks: [],
821
+ typeName: p.ZodString,
822
+ coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
823
+ ...y(r)
824
+ });
825
+ };
826
+ function Xe(r, e) {
827
+ const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
828
+ return a % i / Math.pow(10, n);
829
+ }
830
+ class P extends v {
831
+ constructor() {
832
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
833
+ }
834
+ _parse(e) {
835
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== u.number) {
836
+ const a = this._getOrReturnCtx(e);
837
+ return l(a, {
838
+ code: c.invalid_type,
839
+ expected: u.number,
840
+ received: a.parsedType
841
+ }), m;
842
+ }
843
+ let s;
844
+ const n = new k();
845
+ for (const a of this._def.checks)
846
+ a.kind === "int" ? g.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
847
+ code: c.invalid_type,
848
+ expected: "integer",
849
+ received: "float",
850
+ message: a.message
851
+ }), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
852
+ code: c.too_small,
853
+ minimum: a.value,
854
+ type: "number",
855
+ inclusive: a.inclusive,
856
+ exact: !1,
857
+ message: a.message
858
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
859
+ code: c.too_big,
860
+ maximum: a.value,
861
+ type: "number",
862
+ inclusive: a.inclusive,
863
+ exact: !1,
864
+ message: a.message
865
+ }), n.dirty()) : a.kind === "multipleOf" ? Xe(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
866
+ code: c.not_multiple_of,
867
+ multipleOf: a.value,
868
+ message: a.message
869
+ }), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
870
+ code: c.not_finite,
871
+ message: a.message
872
+ }), n.dirty()) : g.assertNever(a);
873
+ return { status: n.value, value: e.data };
874
+ }
875
+ gte(e, t) {
876
+ return this.setLimit("min", e, !0, f.toString(t));
877
+ }
878
+ gt(e, t) {
879
+ return this.setLimit("min", e, !1, f.toString(t));
880
+ }
881
+ lte(e, t) {
882
+ return this.setLimit("max", e, !0, f.toString(t));
883
+ }
884
+ lt(e, t) {
885
+ return this.setLimit("max", e, !1, f.toString(t));
886
+ }
887
+ setLimit(e, t, s, n) {
888
+ return new P({
889
+ ...this._def,
890
+ checks: [
891
+ ...this._def.checks,
892
+ {
893
+ kind: e,
894
+ value: t,
895
+ inclusive: s,
896
+ message: f.toString(n)
897
+ }
898
+ ]
899
+ });
900
+ }
901
+ _addCheck(e) {
902
+ return new P({
903
+ ...this._def,
904
+ checks: [...this._def.checks, e]
905
+ });
906
+ }
907
+ int(e) {
908
+ return this._addCheck({
909
+ kind: "int",
910
+ message: f.toString(e)
911
+ });
912
+ }
913
+ positive(e) {
914
+ return this._addCheck({
915
+ kind: "min",
916
+ value: 0,
917
+ inclusive: !1,
918
+ message: f.toString(e)
919
+ });
920
+ }
921
+ negative(e) {
922
+ return this._addCheck({
923
+ kind: "max",
924
+ value: 0,
925
+ inclusive: !1,
926
+ message: f.toString(e)
927
+ });
928
+ }
929
+ nonpositive(e) {
930
+ return this._addCheck({
931
+ kind: "max",
932
+ value: 0,
933
+ inclusive: !0,
934
+ message: f.toString(e)
935
+ });
936
+ }
937
+ nonnegative(e) {
938
+ return this._addCheck({
939
+ kind: "min",
940
+ value: 0,
941
+ inclusive: !0,
942
+ message: f.toString(e)
943
+ });
944
+ }
945
+ multipleOf(e, t) {
946
+ return this._addCheck({
947
+ kind: "multipleOf",
948
+ value: e,
949
+ message: f.toString(t)
950
+ });
951
+ }
952
+ finite(e) {
953
+ return this._addCheck({
954
+ kind: "finite",
955
+ message: f.toString(e)
956
+ });
957
+ }
958
+ safe(e) {
959
+ return this._addCheck({
960
+ kind: "min",
961
+ inclusive: !0,
962
+ value: Number.MIN_SAFE_INTEGER,
963
+ message: f.toString(e)
964
+ })._addCheck({
965
+ kind: "max",
966
+ inclusive: !0,
967
+ value: Number.MAX_SAFE_INTEGER,
968
+ message: f.toString(e)
969
+ });
970
+ }
971
+ get minValue() {
972
+ let e = null;
973
+ for (const t of this._def.checks)
974
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
975
+ return e;
976
+ }
977
+ get maxValue() {
978
+ let e = null;
979
+ for (const t of this._def.checks)
980
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
981
+ return e;
982
+ }
983
+ get isInt() {
984
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && g.isInteger(e.value));
985
+ }
986
+ get isFinite() {
987
+ let e = null, t = null;
988
+ for (const s of this._def.checks) {
989
+ if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
990
+ return !0;
991
+ s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
992
+ }
993
+ return Number.isFinite(t) && Number.isFinite(e);
994
+ }
995
+ }
996
+ P.create = (r) => new P({
997
+ checks: [],
998
+ typeName: p.ZodNumber,
999
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1000
+ ...y(r)
1001
+ });
1002
+ class V extends v {
1003
+ constructor() {
1004
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1005
+ }
1006
+ _parse(e) {
1007
+ if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== u.bigint) {
1008
+ const a = this._getOrReturnCtx(e);
1009
+ return l(a, {
1010
+ code: c.invalid_type,
1011
+ expected: u.bigint,
1012
+ received: a.parsedType
1013
+ }), m;
1014
+ }
1015
+ let s;
1016
+ const n = new k();
1017
+ for (const a of this._def.checks)
1018
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1019
+ code: c.too_small,
1020
+ type: "bigint",
1021
+ minimum: a.value,
1022
+ inclusive: a.inclusive,
1023
+ message: a.message
1024
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1025
+ code: c.too_big,
1026
+ type: "bigint",
1027
+ maximum: a.value,
1028
+ inclusive: a.inclusive,
1029
+ message: a.message
1030
+ }), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), l(s, {
1031
+ code: c.not_multiple_of,
1032
+ multipleOf: a.value,
1033
+ message: a.message
1034
+ }), n.dirty()) : g.assertNever(a);
1035
+ return { status: n.value, value: e.data };
1036
+ }
1037
+ gte(e, t) {
1038
+ return this.setLimit("min", e, !0, f.toString(t));
1039
+ }
1040
+ gt(e, t) {
1041
+ return this.setLimit("min", e, !1, f.toString(t));
1042
+ }
1043
+ lte(e, t) {
1044
+ return this.setLimit("max", e, !0, f.toString(t));
1045
+ }
1046
+ lt(e, t) {
1047
+ return this.setLimit("max", e, !1, f.toString(t));
1048
+ }
1049
+ setLimit(e, t, s, n) {
1050
+ return new V({
1051
+ ...this._def,
1052
+ checks: [
1053
+ ...this._def.checks,
1054
+ {
1055
+ kind: e,
1056
+ value: t,
1057
+ inclusive: s,
1058
+ message: f.toString(n)
1059
+ }
1060
+ ]
1061
+ });
1062
+ }
1063
+ _addCheck(e) {
1064
+ return new V({
1065
+ ...this._def,
1066
+ checks: [...this._def.checks, e]
1067
+ });
1068
+ }
1069
+ positive(e) {
1070
+ return this._addCheck({
1071
+ kind: "min",
1072
+ value: BigInt(0),
1073
+ inclusive: !1,
1074
+ message: f.toString(e)
1075
+ });
1076
+ }
1077
+ negative(e) {
1078
+ return this._addCheck({
1079
+ kind: "max",
1080
+ value: BigInt(0),
1081
+ inclusive: !1,
1082
+ message: f.toString(e)
1083
+ });
1084
+ }
1085
+ nonpositive(e) {
1086
+ return this._addCheck({
1087
+ kind: "max",
1088
+ value: BigInt(0),
1089
+ inclusive: !0,
1090
+ message: f.toString(e)
1091
+ });
1092
+ }
1093
+ nonnegative(e) {
1094
+ return this._addCheck({
1095
+ kind: "min",
1096
+ value: BigInt(0),
1097
+ inclusive: !0,
1098
+ message: f.toString(e)
1099
+ });
1100
+ }
1101
+ multipleOf(e, t) {
1102
+ return this._addCheck({
1103
+ kind: "multipleOf",
1104
+ value: e,
1105
+ message: f.toString(t)
1106
+ });
1107
+ }
1108
+ get minValue() {
1109
+ let e = null;
1110
+ for (const t of this._def.checks)
1111
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1112
+ return e;
1113
+ }
1114
+ get maxValue() {
1115
+ let e = null;
1116
+ for (const t of this._def.checks)
1117
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1118
+ return e;
1119
+ }
1120
+ }
1121
+ V.create = (r) => {
1122
+ var e;
1123
+ return new V({
1124
+ checks: [],
1125
+ typeName: p.ZodBigInt,
1126
+ coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1127
+ ...y(r)
1128
+ });
1129
+ };
1130
+ class G extends v {
1131
+ _parse(e) {
1132
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== u.boolean) {
1133
+ const s = this._getOrReturnCtx(e);
1134
+ return l(s, {
1135
+ code: c.invalid_type,
1136
+ expected: u.boolean,
1137
+ received: s.parsedType
1138
+ }), m;
1139
+ }
1140
+ return w(e.data);
1141
+ }
1142
+ }
1143
+ G.create = (r) => new G({
1144
+ typeName: p.ZodBoolean,
1145
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1146
+ ...y(r)
1147
+ });
1148
+ class L extends v {
1149
+ _parse(e) {
1150
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== u.date) {
1151
+ const a = this._getOrReturnCtx(e);
1152
+ return l(a, {
1153
+ code: c.invalid_type,
1154
+ expected: u.date,
1155
+ received: a.parsedType
1156
+ }), m;
1157
+ }
1158
+ if (isNaN(e.data.getTime())) {
1159
+ const a = this._getOrReturnCtx(e);
1160
+ return l(a, {
1161
+ code: c.invalid_date
1162
+ }), m;
1163
+ }
1164
+ const s = new k();
1165
+ let n;
1166
+ for (const a of this._def.checks)
1167
+ a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
1168
+ code: c.too_small,
1169
+ message: a.message,
1170
+ inclusive: !0,
1171
+ exact: !1,
1172
+ minimum: a.value,
1173
+ type: "date"
1174
+ }), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
1175
+ code: c.too_big,
1176
+ message: a.message,
1177
+ inclusive: !0,
1178
+ exact: !1,
1179
+ maximum: a.value,
1180
+ type: "date"
1181
+ }), s.dirty()) : g.assertNever(a);
1182
+ return {
1183
+ status: s.value,
1184
+ value: new Date(e.data.getTime())
1185
+ };
1186
+ }
1187
+ _addCheck(e) {
1188
+ return new L({
1189
+ ...this._def,
1190
+ checks: [...this._def.checks, e]
1191
+ });
1192
+ }
1193
+ min(e, t) {
1194
+ return this._addCheck({
1195
+ kind: "min",
1196
+ value: e.getTime(),
1197
+ message: f.toString(t)
1198
+ });
1199
+ }
1200
+ max(e, t) {
1201
+ return this._addCheck({
1202
+ kind: "max",
1203
+ value: e.getTime(),
1204
+ message: f.toString(t)
1205
+ });
1206
+ }
1207
+ get minDate() {
1208
+ let e = null;
1209
+ for (const t of this._def.checks)
1210
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1211
+ return e != null ? new Date(e) : null;
1212
+ }
1213
+ get maxDate() {
1214
+ let e = null;
1215
+ for (const t of this._def.checks)
1216
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1217
+ return e != null ? new Date(e) : null;
1218
+ }
1219
+ }
1220
+ L.create = (r) => new L({
1221
+ checks: [],
1222
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1223
+ typeName: p.ZodDate,
1224
+ ...y(r)
1225
+ });
1226
+ class le extends v {
1227
+ _parse(e) {
1228
+ if (this._getType(e) !== u.symbol) {
1229
+ const s = this._getOrReturnCtx(e);
1230
+ return l(s, {
1231
+ code: c.invalid_type,
1232
+ expected: u.symbol,
1233
+ received: s.parsedType
1234
+ }), m;
1235
+ }
1236
+ return w(e.data);
1237
+ }
1238
+ }
1239
+ le.create = (r) => new le({
1240
+ typeName: p.ZodSymbol,
1241
+ ...y(r)
1242
+ });
1243
+ class X extends v {
1244
+ _parse(e) {
1245
+ if (this._getType(e) !== u.undefined) {
1246
+ const s = this._getOrReturnCtx(e);
1247
+ return l(s, {
1248
+ code: c.invalid_type,
1249
+ expected: u.undefined,
1250
+ received: s.parsedType
1251
+ }), m;
1252
+ }
1253
+ return w(e.data);
1254
+ }
1255
+ }
1256
+ X.create = (r) => new X({
1257
+ typeName: p.ZodUndefined,
1258
+ ...y(r)
1259
+ });
1260
+ class Q extends v {
1261
+ _parse(e) {
1262
+ if (this._getType(e) !== u.null) {
1263
+ const s = this._getOrReturnCtx(e);
1264
+ return l(s, {
1265
+ code: c.invalid_type,
1266
+ expected: u.null,
1267
+ received: s.parsedType
1268
+ }), m;
1269
+ }
1270
+ return w(e.data);
1271
+ }
1272
+ }
1273
+ Q.create = (r) => new Q({
1274
+ typeName: p.ZodNull,
1275
+ ...y(r)
1276
+ });
1277
+ class W extends v {
1278
+ constructor() {
1279
+ super(...arguments), this._any = !0;
1280
+ }
1281
+ _parse(e) {
1282
+ return w(e.data);
1283
+ }
1284
+ }
1285
+ W.create = (r) => new W({
1286
+ typeName: p.ZodAny,
1287
+ ...y(r)
1288
+ });
1289
+ class $ extends v {
1290
+ constructor() {
1291
+ super(...arguments), this._unknown = !0;
1292
+ }
1293
+ _parse(e) {
1294
+ return w(e.data);
1295
+ }
1296
+ }
1297
+ $.create = (r) => new $({
1298
+ typeName: p.ZodUnknown,
1299
+ ...y(r)
1300
+ });
1301
+ class j extends v {
1302
+ _parse(e) {
1303
+ const t = this._getOrReturnCtx(e);
1304
+ return l(t, {
1305
+ code: c.invalid_type,
1306
+ expected: u.never,
1307
+ received: t.parsedType
1308
+ }), m;
1309
+ }
1310
+ }
1311
+ j.create = (r) => new j({
1312
+ typeName: p.ZodNever,
1313
+ ...y(r)
1314
+ });
1315
+ class he extends v {
1316
+ _parse(e) {
1317
+ if (this._getType(e) !== u.undefined) {
1318
+ const s = this._getOrReturnCtx(e);
1319
+ return l(s, {
1320
+ code: c.invalid_type,
1321
+ expected: u.void,
1322
+ received: s.parsedType
1323
+ }), m;
1324
+ }
1325
+ return w(e.data);
1326
+ }
1327
+ }
1328
+ he.create = (r) => new he({
1329
+ typeName: p.ZodVoid,
1330
+ ...y(r)
1331
+ });
1332
+ class N extends v {
1333
+ _parse(e) {
1334
+ const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
1335
+ if (t.parsedType !== u.array)
1336
+ return l(t, {
1337
+ code: c.invalid_type,
1338
+ expected: u.array,
1339
+ received: t.parsedType
1340
+ }), m;
1341
+ if (n.exactLength !== null) {
1342
+ const i = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
1343
+ (i || o) && (l(t, {
1344
+ code: i ? c.too_big : c.too_small,
1345
+ minimum: o ? n.exactLength.value : void 0,
1346
+ maximum: i ? n.exactLength.value : void 0,
1347
+ type: "array",
1348
+ inclusive: !0,
1349
+ exact: !0,
1350
+ message: n.exactLength.message
1351
+ }), s.dirty());
1352
+ }
1353
+ if (n.minLength !== null && t.data.length < n.minLength.value && (l(t, {
1354
+ code: c.too_small,
1355
+ minimum: n.minLength.value,
1356
+ type: "array",
1357
+ inclusive: !0,
1358
+ exact: !1,
1359
+ message: n.minLength.message
1360
+ }), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (l(t, {
1361
+ code: c.too_big,
1362
+ maximum: n.maxLength.value,
1363
+ type: "array",
1364
+ inclusive: !0,
1365
+ exact: !1,
1366
+ message: n.maxLength.message
1367
+ }), s.dirty()), t.common.async)
1368
+ return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new E(t, i, t.path, o)))).then((i) => k.mergeArray(s, i));
1369
+ const a = [...t.data].map((i, o) => n.type._parseSync(new E(t, i, t.path, o)));
1370
+ return k.mergeArray(s, a);
1371
+ }
1372
+ get element() {
1373
+ return this._def.type;
1374
+ }
1375
+ min(e, t) {
1376
+ return new N({
1377
+ ...this._def,
1378
+ minLength: { value: e, message: f.toString(t) }
1379
+ });
1380
+ }
1381
+ max(e, t) {
1382
+ return new N({
1383
+ ...this._def,
1384
+ maxLength: { value: e, message: f.toString(t) }
1385
+ });
1386
+ }
1387
+ length(e, t) {
1388
+ return new N({
1389
+ ...this._def,
1390
+ exactLength: { value: e, message: f.toString(t) }
1391
+ });
1392
+ }
1393
+ nonempty(e) {
1394
+ return this.min(1, e);
1395
+ }
1396
+ }
1397
+ N.create = (r, e) => new N({
1398
+ type: r,
1399
+ minLength: null,
1400
+ maxLength: null,
1401
+ exactLength: null,
1402
+ typeName: p.ZodArray,
1403
+ ...y(e)
1404
+ });
1405
+ function B(r) {
1406
+ if (r instanceof b) {
1407
+ const e = {};
1408
+ for (const t in r.shape) {
1409
+ const s = r.shape[t];
1410
+ e[t] = R.create(B(s));
1411
+ }
1412
+ return new b({
1413
+ ...r._def,
1414
+ shape: () => e
1415
+ });
1416
+ } else
1417
+ return r instanceof N ? new N({
1418
+ ...r._def,
1419
+ type: B(r.element)
1420
+ }) : r instanceof R ? R.create(B(r.unwrap())) : r instanceof U ? U.create(B(r.unwrap())) : r instanceof I ? I.create(r.items.map((e) => B(e))) : r;
1421
+ }
1422
+ class b extends v {
1423
+ constructor() {
1424
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1425
+ }
1426
+ _getCached() {
1427
+ if (this._cached !== null)
1428
+ return this._cached;
1429
+ const e = this._def.shape(), t = g.objectKeys(e);
1430
+ return this._cached = { shape: e, keys: t };
1431
+ }
1432
+ _parse(e) {
1433
+ if (this._getType(e) !== u.object) {
1434
+ const d = this._getOrReturnCtx(e);
1435
+ return l(d, {
1436
+ code: c.invalid_type,
1437
+ expected: u.object,
1438
+ received: d.parsedType
1439
+ }), m;
1440
+ }
1441
+ const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1442
+ if (!(this._def.catchall instanceof j && this._def.unknownKeys === "strip"))
1443
+ for (const d in n.data)
1444
+ i.includes(d) || o.push(d);
1445
+ const h = [];
1446
+ for (const d of i) {
1447
+ const _ = a[d], T = n.data[d];
1448
+ h.push({
1449
+ key: { status: "valid", value: d },
1450
+ value: _._parse(new E(n, T, n.path, d)),
1451
+ alwaysSet: d in n.data
1452
+ });
1453
+ }
1454
+ if (this._def.catchall instanceof j) {
1455
+ const d = this._def.unknownKeys;
1456
+ if (d === "passthrough")
1457
+ for (const _ of o)
1458
+ h.push({
1459
+ key: { status: "valid", value: _ },
1460
+ value: { status: "valid", value: n.data[_] }
1461
+ });
1462
+ else if (d === "strict")
1463
+ o.length > 0 && (l(n, {
1464
+ code: c.unrecognized_keys,
1465
+ keys: o
1466
+ }), s.dirty());
1467
+ else if (d !== "strip")
1468
+ throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1469
+ } else {
1470
+ const d = this._def.catchall;
1471
+ for (const _ of o) {
1472
+ const T = n.data[_];
1473
+ h.push({
1474
+ key: { status: "valid", value: _ },
1475
+ value: d._parse(
1476
+ new E(n, T, n.path, _)
1477
+ //, ctx.child(key), value, getParsedType(value)
1478
+ ),
1479
+ alwaysSet: _ in n.data
1480
+ });
1481
+ }
1482
+ }
1483
+ return n.common.async ? Promise.resolve().then(async () => {
1484
+ const d = [];
1485
+ for (const _ of h) {
1486
+ const T = await _.key;
1487
+ d.push({
1488
+ key: T,
1489
+ value: await _.value,
1490
+ alwaysSet: _.alwaysSet
1491
+ });
1492
+ }
1493
+ return d;
1494
+ }).then((d) => k.mergeObjectSync(s, d)) : k.mergeObjectSync(s, h);
1495
+ }
1496
+ get shape() {
1497
+ return this._def.shape();
1498
+ }
1499
+ strict(e) {
1500
+ return f.errToObj, new b({
1501
+ ...this._def,
1502
+ unknownKeys: "strict",
1503
+ ...e !== void 0 ? {
1504
+ errorMap: (t, s) => {
1505
+ var n, a, i, o;
1506
+ const h = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t, s).message) !== null && i !== void 0 ? i : s.defaultError;
1507
+ return t.code === "unrecognized_keys" ? {
1508
+ message: (o = f.errToObj(e).message) !== null && o !== void 0 ? o : h
1509
+ } : {
1510
+ message: h
1511
+ };
1512
+ }
1513
+ } : {}
1514
+ });
1515
+ }
1516
+ strip() {
1517
+ return new b({
1518
+ ...this._def,
1519
+ unknownKeys: "strip"
1520
+ });
1521
+ }
1522
+ passthrough() {
1523
+ return new b({
1524
+ ...this._def,
1525
+ unknownKeys: "passthrough"
1526
+ });
1527
+ }
1528
+ // const AugmentFactory =
1529
+ // <Def extends ZodObjectDef>(def: Def) =>
1530
+ // <Augmentation extends ZodRawShape>(
1531
+ // augmentation: Augmentation
1532
+ // ): ZodObject<
1533
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1534
+ // Def["unknownKeys"],
1535
+ // Def["catchall"]
1536
+ // > => {
1537
+ // return new ZodObject({
1538
+ // ...def,
1539
+ // shape: () => ({
1540
+ // ...def.shape(),
1541
+ // ...augmentation,
1542
+ // }),
1543
+ // }) as any;
1544
+ // };
1545
+ extend(e) {
1546
+ return new b({
1547
+ ...this._def,
1548
+ shape: () => ({
1549
+ ...this._def.shape(),
1550
+ ...e
1551
+ })
1552
+ });
1553
+ }
1554
+ /**
1555
+ * Prior to zod@1.0.12 there was a bug in the
1556
+ * inferred type of merged objects. Please
1557
+ * upgrade if you are experiencing issues.
1558
+ */
1559
+ merge(e) {
1560
+ return new b({
1561
+ unknownKeys: e._def.unknownKeys,
1562
+ catchall: e._def.catchall,
1563
+ shape: () => ({
1564
+ ...this._def.shape(),
1565
+ ...e._def.shape()
1566
+ }),
1567
+ typeName: p.ZodObject
1568
+ });
1569
+ }
1570
+ // merge<
1571
+ // Incoming extends AnyZodObject,
1572
+ // Augmentation extends Incoming["shape"],
1573
+ // NewOutput extends {
1574
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1575
+ // ? Augmentation[k]["_output"]
1576
+ // : k extends keyof Output
1577
+ // ? Output[k]
1578
+ // : never;
1579
+ // },
1580
+ // NewInput extends {
1581
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1582
+ // ? Augmentation[k]["_input"]
1583
+ // : k extends keyof Input
1584
+ // ? Input[k]
1585
+ // : never;
1586
+ // }
1587
+ // >(
1588
+ // merging: Incoming
1589
+ // ): ZodObject<
1590
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1591
+ // Incoming["_def"]["unknownKeys"],
1592
+ // Incoming["_def"]["catchall"],
1593
+ // NewOutput,
1594
+ // NewInput
1595
+ // > {
1596
+ // const merged: any = new ZodObject({
1597
+ // unknownKeys: merging._def.unknownKeys,
1598
+ // catchall: merging._def.catchall,
1599
+ // shape: () =>
1600
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1601
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1602
+ // }) as any;
1603
+ // return merged;
1604
+ // }
1605
+ setKey(e, t) {
1606
+ return this.augment({ [e]: t });
1607
+ }
1608
+ // merge<Incoming extends AnyZodObject>(
1609
+ // merging: Incoming
1610
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1611
+ // ZodObject<
1612
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1613
+ // Incoming["_def"]["unknownKeys"],
1614
+ // Incoming["_def"]["catchall"]
1615
+ // > {
1616
+ // // const mergedShape = objectUtil.mergeShapes(
1617
+ // // this._def.shape(),
1618
+ // // merging._def.shape()
1619
+ // // );
1620
+ // const merged: any = new ZodObject({
1621
+ // unknownKeys: merging._def.unknownKeys,
1622
+ // catchall: merging._def.catchall,
1623
+ // shape: () =>
1624
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1625
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1626
+ // }) as any;
1627
+ // return merged;
1628
+ // }
1629
+ catchall(e) {
1630
+ return new b({
1631
+ ...this._def,
1632
+ catchall: e
1633
+ });
1634
+ }
1635
+ pick(e) {
1636
+ const t = {};
1637
+ return g.objectKeys(e).forEach((s) => {
1638
+ e[s] && this.shape[s] && (t[s] = this.shape[s]);
1639
+ }), new b({
1640
+ ...this._def,
1641
+ shape: () => t
1642
+ });
1643
+ }
1644
+ omit(e) {
1645
+ const t = {};
1646
+ return g.objectKeys(this.shape).forEach((s) => {
1647
+ e[s] || (t[s] = this.shape[s]);
1648
+ }), new b({
1649
+ ...this._def,
1650
+ shape: () => t
1651
+ });
1652
+ }
1653
+ /**
1654
+ * @deprecated
1655
+ */
1656
+ deepPartial() {
1657
+ return B(this);
1658
+ }
1659
+ partial(e) {
1660
+ const t = {};
1661
+ return g.objectKeys(this.shape).forEach((s) => {
1662
+ const n = this.shape[s];
1663
+ e && !e[s] ? t[s] = n : t[s] = n.optional();
1664
+ }), new b({
1665
+ ...this._def,
1666
+ shape: () => t
1667
+ });
1668
+ }
1669
+ required(e) {
1670
+ const t = {};
1671
+ return g.objectKeys(this.shape).forEach((s) => {
1672
+ if (e && !e[s])
1673
+ t[s] = this.shape[s];
1674
+ else {
1675
+ let a = this.shape[s];
1676
+ for (; a instanceof R; )
1677
+ a = a._def.innerType;
1678
+ t[s] = a;
1679
+ }
1680
+ }), new b({
1681
+ ...this._def,
1682
+ shape: () => t
1683
+ });
1684
+ }
1685
+ keyof() {
1686
+ return Ce(g.objectKeys(this.shape));
1687
+ }
1688
+ }
1689
+ b.create = (r, e) => new b({
1690
+ shape: () => r,
1691
+ unknownKeys: "strip",
1692
+ catchall: j.create(),
1693
+ typeName: p.ZodObject,
1694
+ ...y(e)
1695
+ });
1696
+ b.strictCreate = (r, e) => new b({
1697
+ shape: () => r,
1698
+ unknownKeys: "strict",
1699
+ catchall: j.create(),
1700
+ typeName: p.ZodObject,
1701
+ ...y(e)
1702
+ });
1703
+ b.lazycreate = (r, e) => new b({
1704
+ shape: r,
1705
+ unknownKeys: "strip",
1706
+ catchall: j.create(),
1707
+ typeName: p.ZodObject,
1708
+ ...y(e)
1709
+ });
1710
+ class K extends v {
1711
+ _parse(e) {
1712
+ const { ctx: t } = this._processInputParams(e), s = this._def.options;
1713
+ function n(a) {
1714
+ for (const o of a)
1715
+ if (o.result.status === "valid")
1716
+ return o.result;
1717
+ for (const o of a)
1718
+ if (o.result.status === "dirty")
1719
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
1720
+ const i = a.map((o) => new C(o.ctx.common.issues));
1721
+ return l(t, {
1722
+ code: c.invalid_union,
1723
+ unionErrors: i
1724
+ }), m;
1725
+ }
1726
+ if (t.common.async)
1727
+ return Promise.all(s.map(async (a) => {
1728
+ const i = {
1729
+ ...t,
1730
+ common: {
1731
+ ...t.common,
1732
+ issues: []
1733
+ },
1734
+ parent: null
1735
+ };
1736
+ return {
1737
+ result: await a._parseAsync({
1738
+ data: t.data,
1739
+ path: t.path,
1740
+ parent: i
1741
+ }),
1742
+ ctx: i
1743
+ };
1744
+ })).then(n);
1745
+ {
1746
+ let a;
1747
+ const i = [];
1748
+ for (const h of s) {
1749
+ const d = {
1750
+ ...t,
1751
+ common: {
1752
+ ...t.common,
1753
+ issues: []
1754
+ },
1755
+ parent: null
1756
+ }, _ = h._parseSync({
1757
+ data: t.data,
1758
+ path: t.path,
1759
+ parent: d
1760
+ });
1761
+ if (_.status === "valid")
1762
+ return _;
1763
+ _.status === "dirty" && !a && (a = { result: _, ctx: d }), d.common.issues.length && i.push(d.common.issues);
1764
+ }
1765
+ if (a)
1766
+ return t.common.issues.push(...a.ctx.common.issues), a.result;
1767
+ const o = i.map((h) => new C(h));
1768
+ return l(t, {
1769
+ code: c.invalid_union,
1770
+ unionErrors: o
1771
+ }), m;
1772
+ }
1773
+ }
1774
+ get options() {
1775
+ return this._def.options;
1776
+ }
1777
+ }
1778
+ K.create = (r, e) => new K({
1779
+ options: r,
1780
+ typeName: p.ZodUnion,
1781
+ ...y(e)
1782
+ });
1783
+ const oe = (r) => r instanceof te ? oe(r.schema) : r instanceof O ? oe(r.innerType()) : r instanceof re ? [r.value] : r instanceof z ? r.options : r instanceof se ? Object.keys(r.enum) : r instanceof ne ? oe(r._def.innerType) : r instanceof X ? [void 0] : r instanceof Q ? [null] : null;
1784
+ class ve extends v {
1785
+ _parse(e) {
1786
+ const { ctx: t } = this._processInputParams(e);
1787
+ if (t.parsedType !== u.object)
1788
+ return l(t, {
1789
+ code: c.invalid_type,
1790
+ expected: u.object,
1791
+ received: t.parsedType
1792
+ }), m;
1793
+ const s = this.discriminator, n = t.data[s], a = this.optionsMap.get(n);
1794
+ return a ? t.common.async ? a._parseAsync({
1795
+ data: t.data,
1796
+ path: t.path,
1797
+ parent: t
1798
+ }) : a._parseSync({
1799
+ data: t.data,
1800
+ path: t.path,
1801
+ parent: t
1802
+ }) : (l(t, {
1803
+ code: c.invalid_union_discriminator,
1804
+ options: Array.from(this.optionsMap.keys()),
1805
+ path: [s]
1806
+ }), m);
1807
+ }
1808
+ get discriminator() {
1809
+ return this._def.discriminator;
1810
+ }
1811
+ get options() {
1812
+ return this._def.options;
1813
+ }
1814
+ get optionsMap() {
1815
+ return this._def.optionsMap;
1816
+ }
1817
+ /**
1818
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
1819
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
1820
+ * have a different value for each object in the union.
1821
+ * @param discriminator the name of the discriminator property
1822
+ * @param types an array of object schemas
1823
+ * @param params
1824
+ */
1825
+ static create(e, t, s) {
1826
+ const n = /* @__PURE__ */ new Map();
1827
+ for (const a of t) {
1828
+ const i = oe(a.shape[e]);
1829
+ if (!i)
1830
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1831
+ for (const o of i) {
1832
+ if (n.has(o))
1833
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
1834
+ n.set(o, a);
1835
+ }
1836
+ }
1837
+ return new ve({
1838
+ typeName: p.ZodDiscriminatedUnion,
1839
+ discriminator: e,
1840
+ options: t,
1841
+ optionsMap: n,
1842
+ ...y(s)
1843
+ });
1844
+ }
1845
+ }
1846
+ function ke(r, e) {
1847
+ const t = M(r), s = M(e);
1848
+ if (r === e)
1849
+ return { valid: !0, data: r };
1850
+ if (t === u.object && s === u.object) {
1851
+ const n = g.objectKeys(e), a = g.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = { ...r, ...e };
1852
+ for (const o of a) {
1853
+ const h = ke(r[o], e[o]);
1854
+ if (!h.valid)
1855
+ return { valid: !1 };
1856
+ i[o] = h.data;
1857
+ }
1858
+ return { valid: !0, data: i };
1859
+ } else if (t === u.array && s === u.array) {
1860
+ if (r.length !== e.length)
1861
+ return { valid: !1 };
1862
+ const n = [];
1863
+ for (let a = 0; a < r.length; a++) {
1864
+ const i = r[a], o = e[a], h = ke(i, o);
1865
+ if (!h.valid)
1866
+ return { valid: !1 };
1867
+ n.push(h.data);
1868
+ }
1869
+ return { valid: !0, data: n };
1870
+ } else
1871
+ return t === u.date && s === u.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
1872
+ }
1873
+ class F extends v {
1874
+ _parse(e) {
1875
+ const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
1876
+ if (xe(a) || xe(i))
1877
+ return m;
1878
+ const o = ke(a.value, i.value);
1879
+ return o.valid ? ((be(a) || be(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(s, {
1880
+ code: c.invalid_intersection_types
1881
+ }), m);
1882
+ };
1883
+ return s.common.async ? Promise.all([
1884
+ this._def.left._parseAsync({
1885
+ data: s.data,
1886
+ path: s.path,
1887
+ parent: s
1888
+ }),
1889
+ this._def.right._parseAsync({
1890
+ data: s.data,
1891
+ path: s.path,
1892
+ parent: s
1893
+ })
1894
+ ]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
1895
+ data: s.data,
1896
+ path: s.path,
1897
+ parent: s
1898
+ }), this._def.right._parseSync({
1899
+ data: s.data,
1900
+ path: s.path,
1901
+ parent: s
1902
+ }));
1903
+ }
1904
+ }
1905
+ F.create = (r, e, t) => new F({
1906
+ left: r,
1907
+ right: e,
1908
+ typeName: p.ZodIntersection,
1909
+ ...y(t)
1910
+ });
1911
+ class I extends v {
1912
+ _parse(e) {
1913
+ const { status: t, ctx: s } = this._processInputParams(e);
1914
+ if (s.parsedType !== u.array)
1915
+ return l(s, {
1916
+ code: c.invalid_type,
1917
+ expected: u.array,
1918
+ received: s.parsedType
1919
+ }), m;
1920
+ if (s.data.length < this._def.items.length)
1921
+ return l(s, {
1922
+ code: c.too_small,
1923
+ minimum: this._def.items.length,
1924
+ inclusive: !0,
1925
+ exact: !1,
1926
+ type: "array"
1927
+ }), m;
1928
+ !this._def.rest && s.data.length > this._def.items.length && (l(s, {
1929
+ code: c.too_big,
1930
+ maximum: this._def.items.length,
1931
+ inclusive: !0,
1932
+ exact: !1,
1933
+ type: "array"
1934
+ }), t.dirty());
1935
+ const a = [...s.data].map((i, o) => {
1936
+ const h = this._def.items[o] || this._def.rest;
1937
+ return h ? h._parse(new E(s, i, s.path, o)) : null;
1938
+ }).filter((i) => !!i);
1939
+ return s.common.async ? Promise.all(a).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, a);
1940
+ }
1941
+ get items() {
1942
+ return this._def.items;
1943
+ }
1944
+ rest(e) {
1945
+ return new I({
1946
+ ...this._def,
1947
+ rest: e
1948
+ });
1949
+ }
1950
+ }
1951
+ I.create = (r, e) => {
1952
+ if (!Array.isArray(r))
1953
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
1954
+ return new I({
1955
+ items: r,
1956
+ typeName: p.ZodTuple,
1957
+ rest: null,
1958
+ ...y(e)
1959
+ });
1960
+ };
1961
+ class ee extends v {
1962
+ get keySchema() {
1963
+ return this._def.keyType;
1964
+ }
1965
+ get valueSchema() {
1966
+ return this._def.valueType;
1967
+ }
1968
+ _parse(e) {
1969
+ const { status: t, ctx: s } = this._processInputParams(e);
1970
+ if (s.parsedType !== u.object)
1971
+ return l(s, {
1972
+ code: c.invalid_type,
1973
+ expected: u.object,
1974
+ received: s.parsedType
1975
+ }), m;
1976
+ const n = [], a = this._def.keyType, i = this._def.valueType;
1977
+ for (const o in s.data)
1978
+ n.push({
1979
+ key: a._parse(new E(s, o, s.path, o)),
1980
+ value: i._parse(new E(s, s.data[o], s.path, o))
1981
+ });
1982
+ return s.common.async ? k.mergeObjectAsync(t, n) : k.mergeObjectSync(t, n);
1983
+ }
1984
+ get element() {
1985
+ return this._def.valueType;
1986
+ }
1987
+ static create(e, t, s) {
1988
+ return t instanceof v ? new ee({
1989
+ keyType: e,
1990
+ valueType: t,
1991
+ typeName: p.ZodRecord,
1992
+ ...y(s)
1993
+ }) : new ee({
1994
+ keyType: S.create(),
1995
+ valueType: e,
1996
+ typeName: p.ZodRecord,
1997
+ ...y(t)
1998
+ });
1999
+ }
2000
+ }
2001
+ class fe extends v {
2002
+ get keySchema() {
2003
+ return this._def.keyType;
2004
+ }
2005
+ get valueSchema() {
2006
+ return this._def.valueType;
2007
+ }
2008
+ _parse(e) {
2009
+ const { status: t, ctx: s } = this._processInputParams(e);
2010
+ if (s.parsedType !== u.map)
2011
+ return l(s, {
2012
+ code: c.invalid_type,
2013
+ expected: u.map,
2014
+ received: s.parsedType
2015
+ }), m;
2016
+ const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, h], d) => ({
2017
+ key: n._parse(new E(s, o, s.path, [d, "key"])),
2018
+ value: a._parse(new E(s, h, s.path, [d, "value"]))
2019
+ }));
2020
+ if (s.common.async) {
2021
+ const o = /* @__PURE__ */ new Map();
2022
+ return Promise.resolve().then(async () => {
2023
+ for (const h of i) {
2024
+ const d = await h.key, _ = await h.value;
2025
+ if (d.status === "aborted" || _.status === "aborted")
2026
+ return m;
2027
+ (d.status === "dirty" || _.status === "dirty") && t.dirty(), o.set(d.value, _.value);
2028
+ }
2029
+ return { status: t.value, value: o };
2030
+ });
2031
+ } else {
2032
+ const o = /* @__PURE__ */ new Map();
2033
+ for (const h of i) {
2034
+ const d = h.key, _ = h.value;
2035
+ if (d.status === "aborted" || _.status === "aborted")
2036
+ return m;
2037
+ (d.status === "dirty" || _.status === "dirty") && t.dirty(), o.set(d.value, _.value);
2038
+ }
2039
+ return { status: t.value, value: o };
2040
+ }
2041
+ }
2042
+ }
2043
+ fe.create = (r, e, t) => new fe({
2044
+ valueType: e,
2045
+ keyType: r,
2046
+ typeName: p.ZodMap,
2047
+ ...y(t)
2048
+ });
2049
+ class D extends v {
2050
+ _parse(e) {
2051
+ const { status: t, ctx: s } = this._processInputParams(e);
2052
+ if (s.parsedType !== u.set)
2053
+ return l(s, {
2054
+ code: c.invalid_type,
2055
+ expected: u.set,
2056
+ received: s.parsedType
2057
+ }), m;
2058
+ const n = this._def;
2059
+ n.minSize !== null && s.data.size < n.minSize.value && (l(s, {
2060
+ code: c.too_small,
2061
+ minimum: n.minSize.value,
2062
+ type: "set",
2063
+ inclusive: !0,
2064
+ exact: !1,
2065
+ message: n.minSize.message
2066
+ }), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (l(s, {
2067
+ code: c.too_big,
2068
+ maximum: n.maxSize.value,
2069
+ type: "set",
2070
+ inclusive: !0,
2071
+ exact: !1,
2072
+ message: n.maxSize.message
2073
+ }), t.dirty());
2074
+ const a = this._def.valueType;
2075
+ function i(h) {
2076
+ const d = /* @__PURE__ */ new Set();
2077
+ for (const _ of h) {
2078
+ if (_.status === "aborted")
2079
+ return m;
2080
+ _.status === "dirty" && t.dirty(), d.add(_.value);
2081
+ }
2082
+ return { status: t.value, value: d };
2083
+ }
2084
+ const o = [...s.data.values()].map((h, d) => a._parse(new E(s, h, s.path, d)));
2085
+ return s.common.async ? Promise.all(o).then((h) => i(h)) : i(o);
2086
+ }
2087
+ min(e, t) {
2088
+ return new D({
2089
+ ...this._def,
2090
+ minSize: { value: e, message: f.toString(t) }
2091
+ });
2092
+ }
2093
+ max(e, t) {
2094
+ return new D({
2095
+ ...this._def,
2096
+ maxSize: { value: e, message: f.toString(t) }
2097
+ });
2098
+ }
2099
+ size(e, t) {
2100
+ return this.min(e, t).max(e, t);
2101
+ }
2102
+ nonempty(e) {
2103
+ return this.min(1, e);
2104
+ }
2105
+ }
2106
+ D.create = (r, e) => new D({
2107
+ valueType: r,
2108
+ minSize: null,
2109
+ maxSize: null,
2110
+ typeName: p.ZodSet,
2111
+ ...y(e)
2112
+ });
2113
+ class q extends v {
2114
+ constructor() {
2115
+ super(...arguments), this.validate = this.implement;
2116
+ }
2117
+ _parse(e) {
2118
+ const { ctx: t } = this._processInputParams(e);
2119
+ if (t.parsedType !== u.function)
2120
+ return l(t, {
2121
+ code: c.invalid_type,
2122
+ expected: u.function,
2123
+ received: t.parsedType
2124
+ }), m;
2125
+ function s(o, h) {
2126
+ return de({
2127
+ data: o,
2128
+ path: t.path,
2129
+ errorMaps: [
2130
+ t.common.contextualErrorMap,
2131
+ t.schemaErrorMap,
2132
+ ce(),
2133
+ Y
2134
+ ].filter((d) => !!d),
2135
+ issueData: {
2136
+ code: c.invalid_arguments,
2137
+ argumentsError: h
2138
+ }
2139
+ });
2140
+ }
2141
+ function n(o, h) {
2142
+ return de({
2143
+ data: o,
2144
+ path: t.path,
2145
+ errorMaps: [
2146
+ t.common.contextualErrorMap,
2147
+ t.schemaErrorMap,
2148
+ ce(),
2149
+ Y
2150
+ ].filter((d) => !!d),
2151
+ issueData: {
2152
+ code: c.invalid_return_type,
2153
+ returnTypeError: h
2154
+ }
2155
+ });
2156
+ }
2157
+ const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2158
+ if (this._def.returns instanceof J) {
2159
+ const o = this;
2160
+ return w(async function(...h) {
2161
+ const d = new C([]), _ = await o._def.args.parseAsync(h, a).catch((ie) => {
2162
+ throw d.addIssue(s(h, ie)), d;
2163
+ }), T = await Reflect.apply(i, this, _);
2164
+ return await o._def.returns._def.type.parseAsync(T, a).catch((ie) => {
2165
+ throw d.addIssue(n(T, ie)), d;
2166
+ });
2167
+ });
2168
+ } else {
2169
+ const o = this;
2170
+ return w(function(...h) {
2171
+ const d = o._def.args.safeParse(h, a);
2172
+ if (!d.success)
2173
+ throw new C([s(h, d.error)]);
2174
+ const _ = Reflect.apply(i, this, d.data), T = o._def.returns.safeParse(_, a);
2175
+ if (!T.success)
2176
+ throw new C([n(_, T.error)]);
2177
+ return T.data;
2178
+ });
2179
+ }
2180
+ }
2181
+ parameters() {
2182
+ return this._def.args;
2183
+ }
2184
+ returnType() {
2185
+ return this._def.returns;
2186
+ }
2187
+ args(...e) {
2188
+ return new q({
2189
+ ...this._def,
2190
+ args: I.create(e).rest($.create())
2191
+ });
2192
+ }
2193
+ returns(e) {
2194
+ return new q({
2195
+ ...this._def,
2196
+ returns: e
2197
+ });
2198
+ }
2199
+ implement(e) {
2200
+ return this.parse(e);
2201
+ }
2202
+ strictImplement(e) {
2203
+ return this.parse(e);
2204
+ }
2205
+ static create(e, t, s) {
2206
+ return new q({
2207
+ args: e || I.create([]).rest($.create()),
2208
+ returns: t || $.create(),
2209
+ typeName: p.ZodFunction,
2210
+ ...y(s)
2211
+ });
2212
+ }
2213
+ }
2214
+ class te extends v {
2215
+ get schema() {
2216
+ return this._def.getter();
2217
+ }
2218
+ _parse(e) {
2219
+ const { ctx: t } = this._processInputParams(e);
2220
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2221
+ }
2222
+ }
2223
+ te.create = (r, e) => new te({
2224
+ getter: r,
2225
+ typeName: p.ZodLazy,
2226
+ ...y(e)
2227
+ });
2228
+ class re extends v {
2229
+ _parse(e) {
2230
+ if (e.data !== this._def.value) {
2231
+ const t = this._getOrReturnCtx(e);
2232
+ return l(t, {
2233
+ received: t.data,
2234
+ code: c.invalid_literal,
2235
+ expected: this._def.value
2236
+ }), m;
2237
+ }
2238
+ return { status: "valid", value: e.data };
2239
+ }
2240
+ get value() {
2241
+ return this._def.value;
2242
+ }
2243
+ }
2244
+ re.create = (r, e) => new re({
2245
+ value: r,
2246
+ typeName: p.ZodLiteral,
2247
+ ...y(e)
2248
+ });
2249
+ function Ce(r, e) {
2250
+ return new z({
2251
+ values: r,
2252
+ typeName: p.ZodEnum,
2253
+ ...y(e)
2254
+ });
2255
+ }
2256
+ class z extends v {
2257
+ _parse(e) {
2258
+ if (typeof e.data != "string") {
2259
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2260
+ return l(t, {
2261
+ expected: g.joinValues(s),
2262
+ received: t.parsedType,
2263
+ code: c.invalid_type
2264
+ }), m;
2265
+ }
2266
+ if (this._def.values.indexOf(e.data) === -1) {
2267
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2268
+ return l(t, {
2269
+ received: t.data,
2270
+ code: c.invalid_enum_value,
2271
+ options: s
2272
+ }), m;
2273
+ }
2274
+ return w(e.data);
2275
+ }
2276
+ get options() {
2277
+ return this._def.values;
2278
+ }
2279
+ get enum() {
2280
+ const e = {};
2281
+ for (const t of this._def.values)
2282
+ e[t] = t;
2283
+ return e;
2284
+ }
2285
+ get Values() {
2286
+ const e = {};
2287
+ for (const t of this._def.values)
2288
+ e[t] = t;
2289
+ return e;
2290
+ }
2291
+ get Enum() {
2292
+ const e = {};
2293
+ for (const t of this._def.values)
2294
+ e[t] = t;
2295
+ return e;
2296
+ }
2297
+ extract(e) {
2298
+ return z.create(e);
2299
+ }
2300
+ exclude(e) {
2301
+ return z.create(this.options.filter((t) => !e.includes(t)));
2302
+ }
2303
+ }
2304
+ z.create = Ce;
2305
+ class se extends v {
2306
+ _parse(e) {
2307
+ const t = g.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2308
+ if (s.parsedType !== u.string && s.parsedType !== u.number) {
2309
+ const n = g.objectValues(t);
2310
+ return l(s, {
2311
+ expected: g.joinValues(n),
2312
+ received: s.parsedType,
2313
+ code: c.invalid_type
2314
+ }), m;
2315
+ }
2316
+ if (t.indexOf(e.data) === -1) {
2317
+ const n = g.objectValues(t);
2318
+ return l(s, {
2319
+ received: s.data,
2320
+ code: c.invalid_enum_value,
2321
+ options: n
2322
+ }), m;
2323
+ }
2324
+ return w(e.data);
2325
+ }
2326
+ get enum() {
2327
+ return this._def.values;
2328
+ }
2329
+ }
2330
+ se.create = (r, e) => new se({
2331
+ values: r,
2332
+ typeName: p.ZodNativeEnum,
2333
+ ...y(e)
2334
+ });
2335
+ class J extends v {
2336
+ unwrap() {
2337
+ return this._def.type;
2338
+ }
2339
+ _parse(e) {
2340
+ const { ctx: t } = this._processInputParams(e);
2341
+ if (t.parsedType !== u.promise && t.common.async === !1)
2342
+ return l(t, {
2343
+ code: c.invalid_type,
2344
+ expected: u.promise,
2345
+ received: t.parsedType
2346
+ }), m;
2347
+ const s = t.parsedType === u.promise ? t.data : Promise.resolve(t.data);
2348
+ return w(s.then((n) => this._def.type.parseAsync(n, {
2349
+ path: t.path,
2350
+ errorMap: t.common.contextualErrorMap
2351
+ })));
2352
+ }
2353
+ }
2354
+ J.create = (r, e) => new J({
2355
+ type: r,
2356
+ typeName: p.ZodPromise,
2357
+ ...y(e)
2358
+ });
2359
+ class O extends v {
2360
+ innerType() {
2361
+ return this._def.schema;
2362
+ }
2363
+ sourceType() {
2364
+ return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2365
+ }
2366
+ _parse(e) {
2367
+ const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
2368
+ addIssue: (i) => {
2369
+ l(s, i), i.fatal ? t.abort() : t.dirty();
2370
+ },
2371
+ get path() {
2372
+ return s.path;
2373
+ }
2374
+ };
2375
+ if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
2376
+ const i = n.transform(s.data, a);
2377
+ return s.common.issues.length ? {
2378
+ status: "dirty",
2379
+ value: s.data
2380
+ } : s.common.async ? Promise.resolve(i).then((o) => this._def.schema._parseAsync({
2381
+ data: o,
2382
+ path: s.path,
2383
+ parent: s
2384
+ })) : this._def.schema._parseSync({
2385
+ data: i,
2386
+ path: s.path,
2387
+ parent: s
2388
+ });
2389
+ }
2390
+ if (n.type === "refinement") {
2391
+ const i = (o) => {
2392
+ const h = n.refinement(o, a);
2393
+ if (s.common.async)
2394
+ return Promise.resolve(h);
2395
+ if (h instanceof Promise)
2396
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2397
+ return o;
2398
+ };
2399
+ if (s.common.async === !1) {
2400
+ const o = this._def.schema._parseSync({
2401
+ data: s.data,
2402
+ path: s.path,
2403
+ parent: s
2404
+ });
2405
+ return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2406
+ } else
2407
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2408
+ }
2409
+ if (n.type === "transform")
2410
+ if (s.common.async === !1) {
2411
+ const i = this._def.schema._parseSync({
2412
+ data: s.data,
2413
+ path: s.path,
2414
+ parent: s
2415
+ });
2416
+ if (!H(i))
2417
+ return i;
2418
+ const o = n.transform(i.value, a);
2419
+ if (o instanceof Promise)
2420
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2421
+ return { status: t.value, value: o };
2422
+ } else
2423
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => H(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2424
+ g.assertNever(n);
2425
+ }
2426
+ }
2427
+ O.create = (r, e, t) => new O({
2428
+ schema: r,
2429
+ typeName: p.ZodEffects,
2430
+ effect: e,
2431
+ ...y(t)
2432
+ });
2433
+ O.createWithPreprocess = (r, e, t) => new O({
2434
+ schema: e,
2435
+ effect: { type: "preprocess", transform: r },
2436
+ typeName: p.ZodEffects,
2437
+ ...y(t)
2438
+ });
2439
+ class R extends v {
2440
+ _parse(e) {
2441
+ return this._getType(e) === u.undefined ? w(void 0) : this._def.innerType._parse(e);
2442
+ }
2443
+ unwrap() {
2444
+ return this._def.innerType;
2445
+ }
2446
+ }
2447
+ R.create = (r, e) => new R({
2448
+ innerType: r,
2449
+ typeName: p.ZodOptional,
2450
+ ...y(e)
2451
+ });
2452
+ class U extends v {
2453
+ _parse(e) {
2454
+ return this._getType(e) === u.null ? w(null) : this._def.innerType._parse(e);
2455
+ }
2456
+ unwrap() {
2457
+ return this._def.innerType;
2458
+ }
2459
+ }
2460
+ U.create = (r, e) => new U({
2461
+ innerType: r,
2462
+ typeName: p.ZodNullable,
2463
+ ...y(e)
2464
+ });
2465
+ class ne extends v {
2466
+ _parse(e) {
2467
+ const { ctx: t } = this._processInputParams(e);
2468
+ let s = t.data;
2469
+ return t.parsedType === u.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2470
+ data: s,
2471
+ path: t.path,
2472
+ parent: t
2473
+ });
2474
+ }
2475
+ removeDefault() {
2476
+ return this._def.innerType;
2477
+ }
2478
+ }
2479
+ ne.create = (r, e) => new ne({
2480
+ innerType: r,
2481
+ typeName: p.ZodDefault,
2482
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2483
+ ...y(e)
2484
+ });
2485
+ class pe extends v {
2486
+ _parse(e) {
2487
+ const { ctx: t } = this._processInputParams(e), s = {
2488
+ ...t,
2489
+ common: {
2490
+ ...t.common,
2491
+ issues: []
2492
+ }
2493
+ }, n = this._def.innerType._parse({
2494
+ data: s.data,
2495
+ path: s.path,
2496
+ parent: {
2497
+ ...s
2498
+ }
2499
+ });
2500
+ return ue(n) ? n.then((a) => ({
2501
+ status: "valid",
2502
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2503
+ get error() {
2504
+ return new C(s.common.issues);
2505
+ },
2506
+ input: s.data
2507
+ })
2508
+ })) : {
2509
+ status: "valid",
2510
+ value: n.status === "valid" ? n.value : this._def.catchValue({
2511
+ get error() {
2512
+ return new C(s.common.issues);
2513
+ },
2514
+ input: s.data
2515
+ })
2516
+ };
2517
+ }
2518
+ removeCatch() {
2519
+ return this._def.innerType;
2520
+ }
2521
+ }
2522
+ pe.create = (r, e) => new pe({
2523
+ innerType: r,
2524
+ typeName: p.ZodCatch,
2525
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2526
+ ...y(e)
2527
+ });
2528
+ class me extends v {
2529
+ _parse(e) {
2530
+ if (this._getType(e) !== u.nan) {
2531
+ const s = this._getOrReturnCtx(e);
2532
+ return l(s, {
2533
+ code: c.invalid_type,
2534
+ expected: u.nan,
2535
+ received: s.parsedType
2536
+ }), m;
2537
+ }
2538
+ return { status: "valid", value: e.data };
2539
+ }
2540
+ }
2541
+ me.create = (r) => new me({
2542
+ typeName: p.ZodNaN,
2543
+ ...y(r)
2544
+ });
2545
+ const Qe = Symbol("zod_brand");
2546
+ class Ne extends v {
2547
+ _parse(e) {
2548
+ const { ctx: t } = this._processInputParams(e), s = t.data;
2549
+ return this._def.type._parse({
2550
+ data: s,
2551
+ path: t.path,
2552
+ parent: t
2553
+ });
2554
+ }
2555
+ unwrap() {
2556
+ return this._def.type;
2557
+ }
2558
+ }
2559
+ class ae extends v {
2560
+ _parse(e) {
2561
+ const { status: t, ctx: s } = this._processInputParams(e);
2562
+ if (s.common.async)
2563
+ return (async () => {
2564
+ const a = await this._def.in._parseAsync({
2565
+ data: s.data,
2566
+ path: s.path,
2567
+ parent: s
2568
+ });
2569
+ return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), Se(a.value)) : this._def.out._parseAsync({
2570
+ data: a.value,
2571
+ path: s.path,
2572
+ parent: s
2573
+ });
2574
+ })();
2575
+ {
2576
+ const n = this._def.in._parseSync({
2577
+ data: s.data,
2578
+ path: s.path,
2579
+ parent: s
2580
+ });
2581
+ return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), {
2582
+ status: "dirty",
2583
+ value: n.value
2584
+ }) : this._def.out._parseSync({
2585
+ data: n.value,
2586
+ path: s.path,
2587
+ parent: s
2588
+ });
2589
+ }
2590
+ }
2591
+ static create(e, t) {
2592
+ return new ae({
2593
+ in: e,
2594
+ out: t,
2595
+ typeName: p.ZodPipeline
2596
+ });
2597
+ }
2598
+ }
2599
+ class ye extends v {
2600
+ _parse(e) {
2601
+ const t = this._def.innerType._parse(e);
2602
+ return H(t) && (t.value = Object.freeze(t.value)), t;
2603
+ }
2604
+ }
2605
+ ye.create = (r, e) => new ye({
2606
+ innerType: r,
2607
+ typeName: p.ZodReadonly,
2608
+ ...y(e)
2609
+ });
2610
+ const Oe = (r, e = {}, t) => r ? W.create().superRefine((s, n) => {
2611
+ var a, i;
2612
+ if (!r(s)) {
2613
+ const o = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, h = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
2614
+ n.addIssue({ code: "custom", ...d, fatal: h });
2615
+ }
2616
+ }) : W.create(), Ke = {
2617
+ object: b.lazycreate
2618
+ };
2619
+ var p;
2620
+ (function(r) {
2621
+ r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
2622
+ })(p || (p = {}));
2623
+ const Fe = (r, e = {
2624
+ message: `Input not instance of ${r.name}`
2625
+ }) => Oe((t) => t instanceof r, e), Ee = S.create, Ie = P.create, et = me.create, tt = V.create, Re = G.create, rt = L.create, st = le.create, nt = X.create, at = Q.create, it = W.create, ot = $.create, ct = j.create, dt = he.create, ut = N.create, lt = b.create, ht = b.strictCreate, ft = K.create, pt = ve.create, mt = F.create, yt = I.create, vt = ee.create, _t = fe.create, gt = D.create, xt = q.create, bt = te.create, kt = re.create, wt = z.create, Tt = se.create, Zt = J.create, Te = O.create, St = R.create, Ct = U.create, Nt = O.createWithPreprocess, Ot = ae.create, Et = () => Ee().optional(), It = () => Ie().optional(), Rt = () => Re().optional(), jt = {
2626
+ string: (r) => S.create({ ...r, coerce: !0 }),
2627
+ number: (r) => P.create({ ...r, coerce: !0 }),
2628
+ boolean: (r) => G.create({
2629
+ ...r,
2630
+ coerce: !0
2631
+ }),
2632
+ bigint: (r) => V.create({ ...r, coerce: !0 }),
2633
+ date: (r) => L.create({ ...r, coerce: !0 })
2634
+ }, At = m;
2635
+ var Z = /* @__PURE__ */ Object.freeze({
2636
+ __proto__: null,
2637
+ defaultErrorMap: Y,
2638
+ setErrorMap: ze,
2639
+ getErrorMap: ce,
2640
+ makeIssue: de,
2641
+ EMPTY_PATH: $e,
2642
+ addIssueToContext: l,
2643
+ ParseStatus: k,
2644
+ INVALID: m,
2645
+ DIRTY: Se,
2646
+ OK: w,
2647
+ isAborted: xe,
2648
+ isDirty: be,
2649
+ isValid: H,
2650
+ isAsync: ue,
2651
+ get util() {
2652
+ return g;
2653
+ },
2654
+ get objectUtil() {
2655
+ return ge;
2656
+ },
2657
+ ZodParsedType: u,
2658
+ getParsedType: M,
2659
+ ZodType: v,
2660
+ ZodString: S,
2661
+ ZodNumber: P,
2662
+ ZodBigInt: V,
2663
+ ZodBoolean: G,
2664
+ ZodDate: L,
2665
+ ZodSymbol: le,
2666
+ ZodUndefined: X,
2667
+ ZodNull: Q,
2668
+ ZodAny: W,
2669
+ ZodUnknown: $,
2670
+ ZodNever: j,
2671
+ ZodVoid: he,
2672
+ ZodArray: N,
2673
+ ZodObject: b,
2674
+ ZodUnion: K,
2675
+ ZodDiscriminatedUnion: ve,
2676
+ ZodIntersection: F,
2677
+ ZodTuple: I,
2678
+ ZodRecord: ee,
2679
+ ZodMap: fe,
2680
+ ZodSet: D,
2681
+ ZodFunction: q,
2682
+ ZodLazy: te,
2683
+ ZodLiteral: re,
2684
+ ZodEnum: z,
2685
+ ZodNativeEnum: se,
2686
+ ZodPromise: J,
2687
+ ZodEffects: O,
2688
+ ZodTransformer: O,
2689
+ ZodOptional: R,
2690
+ ZodNullable: U,
2691
+ ZodDefault: ne,
2692
+ ZodCatch: pe,
2693
+ ZodNaN: me,
2694
+ BRAND: Qe,
2695
+ ZodBranded: Ne,
2696
+ ZodPipeline: ae,
2697
+ ZodReadonly: ye,
2698
+ custom: Oe,
2699
+ Schema: v,
2700
+ ZodSchema: v,
2701
+ late: Ke,
2702
+ get ZodFirstPartyTypeKind() {
2703
+ return p;
2704
+ },
2705
+ coerce: jt,
2706
+ any: it,
2707
+ array: ut,
2708
+ bigint: tt,
2709
+ boolean: Re,
2710
+ date: rt,
2711
+ discriminatedUnion: pt,
2712
+ effect: Te,
2713
+ enum: wt,
2714
+ function: xt,
2715
+ instanceof: Fe,
2716
+ intersection: mt,
2717
+ lazy: bt,
2718
+ literal: kt,
2719
+ map: _t,
2720
+ nan: et,
2721
+ nativeEnum: Tt,
2722
+ never: ct,
2723
+ null: at,
2724
+ nullable: Ct,
2725
+ number: Ie,
2726
+ object: lt,
2727
+ oboolean: Rt,
2728
+ onumber: It,
2729
+ optional: St,
2730
+ ostring: Et,
2731
+ pipeline: Ot,
2732
+ preprocess: Nt,
2733
+ promise: Zt,
2734
+ record: vt,
2735
+ set: gt,
2736
+ strictObject: ht,
2737
+ string: Ee,
2738
+ symbol: st,
2739
+ transformer: Te,
2740
+ tuple: yt,
2741
+ undefined: nt,
2742
+ union: ft,
2743
+ unknown: ot,
2744
+ void: dt,
2745
+ NEVER: At,
2746
+ ZodIssueCode: c,
2747
+ quotelessJson: Ve,
2748
+ ZodError: C
2749
+ });
2750
+ const $t = () => {
2751
+ const { formValidationTexts: r } = Me(Ae), e = (x) => (x != null && x.useCoerce ? Z.coerce : Z).string({
2752
+ invalid_type_error: r.required
2753
+ }), t = (x) => e(x).nullable().optional(), s = (x) => (x != null && x.useCoerce ? Z.coerce : Z).number({
2754
+ invalid_type_error: r.required
2755
+ }), n = (x) => s(x).nullable().optional(), a = (x) => (x != null && x.useCoerce ? Z.coerce : Z).boolean({
2756
+ invalid_type_error: r.required
2757
+ }), i = (x) => (x != null && x.useCoerce ? Z.coerce : Z).string({ invalid_type_error: r.required }).refine(Pe, { message: r.invalidDate }), o = (x) => i(x).nullable(), h = (x, A) => Z.enum(x, { invalid_type_error: r.required });
2758
+ return {
2759
+ zString: t,
2760
+ zStringRequired: e,
2761
+ zNumber: n,
2762
+ zNumberRequired: s,
2763
+ zBool: a,
2764
+ zDate: o,
2765
+ zDateRequired: i,
2766
+ zEnum: (x, A) => h(x).nullable(),
2767
+ zEnumRequired: h,
2768
+ zObjectIdInt: (x) => Z.object({ id: n({ useCoerce: !0 }) }).nullable(),
2769
+ zObjectIdIntRequired: (x) => Z.object({ id: s() }),
2770
+ zObjectIdStr: (x) => Z.object({ id: t({ useCoerce: !0 }) }).nullable(),
2771
+ zObjectIdStrRequired: (x) => Z.object({ id: e() })
2772
+ };
2773
+ };
2774
+ export {
2775
+ Ut as cancelToken,
2776
+ Bt as useAuth,
2777
+ qt as useAxios,
2778
+ Yt as useConfirm,
2779
+ Wt as useNotifications,
2780
+ $t as useZodSchemaTypes
2781
+ };