Leon4gr45 commited on
Commit
a320833
·
verified ·
1 Parent(s): 8f40892

Upload folder using huggingface_hub (part 9)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +3 -0
  2. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4-mini/index.ts +1 -0
  3. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/iso.ts +62 -0
  4. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/parse.ts +1 -0
  5. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
  6. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  7. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
  8. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  9. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  10. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  11. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
  12. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
  13. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  14. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
  15. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  16. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
  17. node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
  18. node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.cjs +138 -0
  19. node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.d.cts +164 -0
  20. node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.d.ts +164 -0
  21. node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.js +133 -0
  22. node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.cjs +17 -0
  23. node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.d.cts +5 -0
  24. node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.d.ts +5 -0
  25. node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.js +9 -0
  26. node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.cjs +22 -0
  27. node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.d.cts +6 -0
  28. node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.d.ts +6 -0
  29. node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.js +6 -0
  30. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  31. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  32. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  33. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  34. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  35. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  36. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  37. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  38. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  39. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  40. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  41. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  42. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  43. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  44. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  45. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  46. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  47. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  48. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  49. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  50. node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/util.cjs +137 -0
.gitattributes CHANGED
@@ -27,3 +27,6 @@
27
  *.zip binary
28
  node_modules/@jimp/js-bmp/src/images/windows95.bmp filter=lfs diff=lfs merge=lfs -text
29
  node_modules/@jimp/js-bmp/src/images/windows95.png filter=lfs diff=lfs merge=lfs -text
 
 
 
 
27
  *.zip binary
28
  node_modules/@jimp/js-bmp/src/images/windows95.bmp filter=lfs diff=lfs merge=lfs -text
29
  node_modules/@jimp/js-bmp/src/images/windows95.png filter=lfs diff=lfs merge=lfs -text
30
+ node_modules/@jimp/plugin-blit/src/__image_snapshots__/index-node-test-ts-blit-over-image-blit-alpha-1-snap.png filter=lfs diff=lfs merge=lfs -text
31
+ node_modules/@jimp/plugin-blit/src/images/blit-alpha.png filter=lfs diff=lfs merge=lfs -text
32
+ node_modules/@jimp/plugin-blur/src/__image_snapshots__/index-node-test-ts-has-alpha-image-with-alpha-1-snap.png filter=lfs diff=lfs merge=lfs -text
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4-mini/index.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from "../v4/mini/index.js";
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/iso.ts ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as core from "../core/index.js";
2
+ import * as schemas from "./schemas.js";
3
+
4
+ // iso time
5
+ export interface ZodMiniISODateTime extends schemas.ZodMiniStringFormat<"datetime"> {
6
+ _zod: core.$ZodISODateTimeInternals;
7
+ }
8
+ export const ZodMiniISODateTime: core.$constructor<ZodMiniISODateTime> = /*@__PURE__*/ core.$constructor(
9
+ "$ZodISODateTime",
10
+ (inst, def) => {
11
+ core.$ZodISODateTime.init(inst, def);
12
+ schemas.ZodMiniStringFormat.init(inst, def);
13
+ }
14
+ );
15
+ export function datetime(params?: string | core.$ZodISODateTimeParams): ZodMiniISODateTime {
16
+ return core._isoDateTime(ZodMiniISODateTime, params);
17
+ }
18
+
19
+ // iso date
20
+ export interface ZodMiniISODate extends schemas.ZodMiniStringFormat<"date"> {
21
+ _zod: core.$ZodISODateInternals;
22
+ }
23
+ export const ZodMiniISODate: core.$constructor<ZodMiniISODate> = /*@__PURE__*/ core.$constructor(
24
+ "$ZodISODate",
25
+ (inst, def) => {
26
+ core.$ZodISODate.init(inst, def);
27
+ schemas.ZodMiniStringFormat.init(inst, def);
28
+ }
29
+ );
30
+ export function date(params?: string | core.$ZodISODateParams): ZodMiniISODate {
31
+ return core._isoDate(ZodMiniISODate, params);
32
+ }
33
+
34
+ // iso time
35
+ export interface ZodMiniISOTime extends schemas.ZodMiniStringFormat<"time"> {
36
+ _zod: core.$ZodISOTimeInternals;
37
+ }
38
+ export const ZodMiniISOTime: core.$constructor<ZodMiniISOTime> = /*@__PURE__*/ core.$constructor(
39
+ "$ZodISOTime",
40
+ (inst, def) => {
41
+ core.$ZodISOTime.init(inst, def);
42
+ schemas.ZodMiniStringFormat.init(inst, def);
43
+ }
44
+ );
45
+ export function time(params?: string | core.$ZodISOTimeParams): ZodMiniISOTime {
46
+ return core._isoTime(ZodMiniISOTime, params);
47
+ }
48
+
49
+ // iso duration
50
+ export interface ZodMiniISODuration extends schemas.ZodMiniStringFormat<"duration"> {
51
+ _zod: core.$ZodISODurationInternals;
52
+ }
53
+ export const ZodMiniISODuration: core.$constructor<ZodMiniISODuration> = /*@__PURE__*/ core.$constructor(
54
+ "$ZodISODuration",
55
+ (inst, def) => {
56
+ core.$ZodISODuration.init(inst, def);
57
+ schemas.ZodMiniStringFormat.init(inst, def);
58
+ }
59
+ );
60
+ export function duration(params?: string | core.$ZodISODurationParams): ZodMiniISODuration {
61
+ return core._isoDuration(ZodMiniISODuration, params);
62
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/parse.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export { parse, safeParse, parseAsync, safeParseAsync } from "../core/index.js";
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/schemas.ts ADDED
@@ -0,0 +1,1579 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as core from "../core/index.js";
2
+ import { util } from "../core/index.js";
3
+ import * as parse from "./parse.js";
4
+
5
+ type SomeType = core.SomeType;
6
+
7
+ export interface ZodMiniType<
8
+ out Output = unknown,
9
+ out Input = unknown,
10
+ out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,
11
+ > extends core.$ZodType<Output, Input, Internals> {
12
+ check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
13
+ clone(def?: Internals["def"], params?: { parent: boolean }): this;
14
+ register<R extends core.$ZodRegistry>(
15
+ registry: R,
16
+ ...meta: this extends R["_schema"]
17
+ ? undefined extends R["_meta"]
18
+ ? [core.$replace<R["_meta"], this>?]
19
+ : [core.$replace<R["_meta"], this>]
20
+ : ["Incompatible schema"]
21
+ ): this;
22
+ brand<T extends PropertyKey = PropertyKey>(
23
+ value?: T
24
+ ): PropertyKey extends T ? this : this & Record<"_zod", Record<"output", core.output<this> & core.$brand<T>>>;
25
+
26
+ def: Internals["def"];
27
+
28
+ parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
29
+ safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): util.SafeParseResult<core.output<this>>;
30
+ parseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
31
+ safeParseAsync(
32
+ data: unknown,
33
+ params?: core.ParseContext<core.$ZodIssue>
34
+ ): Promise<util.SafeParseResult<core.output<this>>>;
35
+ }
36
+
37
+ interface _ZodMiniType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals>
38
+ extends ZodMiniType<any, any, Internals> {}
39
+
40
+ export const ZodMiniType: core.$constructor<ZodMiniType> = /*@__PURE__*/ core.$constructor(
41
+ "ZodMiniType",
42
+ (inst, def) => {
43
+ if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType.");
44
+
45
+ core.$ZodType.init(inst, def);
46
+ inst.def = def;
47
+ inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
48
+ inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
49
+ inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
50
+ inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
51
+ inst.check = (...checks) => {
52
+ return inst.clone(
53
+ {
54
+ ...def,
55
+ checks: [
56
+ ...(def.checks ?? []),
57
+ ...checks.map((ch) =>
58
+ typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch
59
+ ),
60
+ ],
61
+ }
62
+ // { parent: true }
63
+ );
64
+ };
65
+ inst.clone = (_def, params) => core.clone(inst, _def, params);
66
+ inst.brand = () => inst as any;
67
+ inst.register = ((reg: any, meta: any) => {
68
+ reg.add(inst, meta);
69
+ return inst;
70
+ }) as any;
71
+ }
72
+ );
73
+
74
+ export interface _ZodMiniString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>>
75
+ extends _ZodMiniType<T>,
76
+ core.$ZodString<T["input"]> {
77
+ _zod: T;
78
+ }
79
+
80
+ // ZodMiniString
81
+ export interface ZodMiniString<Input = unknown>
82
+ extends _ZodMiniString<core.$ZodStringInternals<Input>>,
83
+ core.$ZodString<Input> {}
84
+ export const ZodMiniString: core.$constructor<ZodMiniString> = /*@__PURE__*/ core.$constructor(
85
+ "ZodMiniString",
86
+ (inst, def) => {
87
+ core.$ZodString.init(inst, def);
88
+ ZodMiniType.init(inst, def);
89
+ }
90
+ );
91
+
92
+ export function string(params?: string | core.$ZodStringParams): ZodMiniString<string> {
93
+ return core._string(ZodMiniString, params) as any;
94
+ }
95
+
96
+ // ZodMiniStringFormat
97
+ export interface ZodMiniStringFormat<Format extends string = string>
98
+ extends _ZodMiniString<core.$ZodStringFormatInternals<Format>>,
99
+ core.$ZodStringFormat<Format> {
100
+ // _zod: core.$ZodStringFormatInternals<Format>;
101
+ }
102
+ export const ZodMiniStringFormat: core.$constructor<ZodMiniStringFormat> = /*@__PURE__*/ core.$constructor(
103
+ "ZodMiniStringFormat",
104
+ (inst, def) => {
105
+ core.$ZodStringFormat.init(inst, def);
106
+ ZodMiniString.init(inst, def);
107
+ }
108
+ );
109
+
110
+ // ZodMiniEmail
111
+ export interface ZodMiniEmail extends _ZodMiniString<core.$ZodEmailInternals> {}
112
+ export const ZodMiniEmail: core.$constructor<ZodMiniEmail> = /*@__PURE__*/ core.$constructor(
113
+ "ZodMiniEmail",
114
+ (inst, def) => {
115
+ core.$ZodEmail.init(inst, def);
116
+ ZodMiniStringFormat.init(inst, def);
117
+ }
118
+ );
119
+
120
+ export function email(params?: string | core.$ZodEmailParams): ZodMiniEmail {
121
+ return core._email(ZodMiniEmail, params);
122
+ }
123
+
124
+ // ZodMiniGUID
125
+ export interface ZodMiniGUID extends _ZodMiniString<core.$ZodGUIDInternals> {
126
+ // _zod: core.$ZodGUIDInternals;
127
+ }
128
+ export const ZodMiniGUID: core.$constructor<ZodMiniGUID> = /*@__PURE__*/ core.$constructor(
129
+ "ZodMiniGUID",
130
+ (inst, def) => {
131
+ core.$ZodGUID.init(inst, def);
132
+ ZodMiniStringFormat.init(inst, def);
133
+ }
134
+ );
135
+
136
+ export function guid(params?: string | core.$ZodGUIDParams): ZodMiniGUID {
137
+ return core._guid(ZodMiniGUID, params);
138
+ }
139
+
140
+ // ZodMiniUUID
141
+ export interface ZodMiniUUID extends _ZodMiniString<core.$ZodUUIDInternals> {
142
+ // _zod: core.$ZodUUIDInternals;
143
+ }
144
+ export const ZodMiniUUID: core.$constructor<ZodMiniUUID> = /*@__PURE__*/ core.$constructor(
145
+ "ZodMiniUUID",
146
+ (inst, def) => {
147
+ core.$ZodUUID.init(inst, def);
148
+ ZodMiniStringFormat.init(inst, def);
149
+ }
150
+ );
151
+
152
+ export function uuid(params?: string | core.$ZodUUIDParams): ZodMiniUUID {
153
+ return core._uuid(ZodMiniUUID, params);
154
+ }
155
+
156
+ export function uuidv4(params?: string | core.$ZodUUIDv4Params): ZodMiniUUID {
157
+ return core._uuidv4(ZodMiniUUID, params);
158
+ }
159
+
160
+ // ZodMiniUUIDv6
161
+
162
+ export function uuidv6(params?: string | core.$ZodUUIDv6Params): ZodMiniUUID {
163
+ return core._uuidv6(ZodMiniUUID, params);
164
+ }
165
+
166
+ // ZodMiniUUIDv7
167
+
168
+ export function uuidv7(params?: string | core.$ZodUUIDv7Params): ZodMiniUUID {
169
+ return core._uuidv7(ZodMiniUUID, params);
170
+ }
171
+
172
+ // ZodMiniURL
173
+ export interface ZodMiniURL extends _ZodMiniString<core.$ZodURLInternals> {
174
+ // _zod: core.$ZodURLInternals;
175
+ }
176
+ export const ZodMiniURL: core.$constructor<ZodMiniURL> = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, def) => {
177
+ core.$ZodURL.init(inst, def);
178
+ ZodMiniStringFormat.init(inst, def);
179
+ });
180
+
181
+ export function url(params?: string | core.$ZodURLParams): ZodMiniURL {
182
+ return core._url(ZodMiniURL, params);
183
+ }
184
+
185
+ // ZodMiniEmoji
186
+ export interface ZodMiniEmoji extends _ZodMiniString<core.$ZodEmojiInternals> {
187
+ // _zod: core.$ZodEmojiInternals;
188
+ }
189
+ export const ZodMiniEmoji: core.$constructor<ZodMiniEmoji> = /*@__PURE__*/ core.$constructor(
190
+ "ZodMiniEmoji",
191
+ (inst, def) => {
192
+ core.$ZodEmoji.init(inst, def);
193
+ ZodMiniStringFormat.init(inst, def);
194
+ }
195
+ );
196
+
197
+ export function emoji(params?: string | core.$ZodEmojiParams): ZodMiniEmoji {
198
+ return core._emoji(ZodMiniEmoji, params);
199
+ }
200
+
201
+ // ZodMiniNanoID
202
+ export interface ZodMiniNanoID extends _ZodMiniString<core.$ZodNanoIDInternals> {
203
+ // _zod: core.$ZodNanoIDInternals;
204
+ }
205
+ export const ZodMiniNanoID: core.$constructor<ZodMiniNanoID> = /*@__PURE__*/ core.$constructor(
206
+ "ZodMiniNanoID",
207
+ (inst, def) => {
208
+ core.$ZodNanoID.init(inst, def);
209
+ ZodMiniStringFormat.init(inst, def);
210
+ }
211
+ );
212
+
213
+ export function nanoid(params?: string | core.$ZodNanoIDParams): ZodMiniNanoID {
214
+ return core._nanoid(ZodMiniNanoID, params);
215
+ }
216
+
217
+ // ZodMiniCUID
218
+ export interface ZodMiniCUID extends _ZodMiniString<core.$ZodCUIDInternals> {
219
+ // _zod: core.$ZodCUIDInternals;
220
+ }
221
+ export const ZodMiniCUID: core.$constructor<ZodMiniCUID> = /*@__PURE__*/ core.$constructor(
222
+ "ZodMiniCUID",
223
+ (inst, def) => {
224
+ core.$ZodCUID.init(inst, def);
225
+ ZodMiniStringFormat.init(inst, def);
226
+ }
227
+ );
228
+
229
+ export function cuid(params?: string | core.$ZodCUIDParams): ZodMiniCUID {
230
+ return core._cuid(ZodMiniCUID, params);
231
+ }
232
+
233
+ // ZodMiniCUID2
234
+ export interface ZodMiniCUID2 extends _ZodMiniString<core.$ZodCUID2Internals> {
235
+ // _zod: core.$ZodCUID2Internals;
236
+ }
237
+ export const ZodMiniCUID2: core.$constructor<ZodMiniCUID2> = /*@__PURE__*/ core.$constructor(
238
+ "ZodMiniCUID2",
239
+ (inst, def) => {
240
+ core.$ZodCUID2.init(inst, def);
241
+ ZodMiniStringFormat.init(inst, def);
242
+ }
243
+ );
244
+
245
+ export function cuid2(params?: string | core.$ZodCUID2Params): ZodMiniCUID2 {
246
+ return core._cuid2(ZodMiniCUID2, params);
247
+ }
248
+
249
+ // ZodMiniULID
250
+ export interface ZodMiniULID extends _ZodMiniString<core.$ZodULIDInternals> {
251
+ // _zod: core.$ZodULIDInternals;
252
+ }
253
+ export const ZodMiniULID: core.$constructor<ZodMiniULID> = /*@__PURE__*/ core.$constructor(
254
+ "ZodMiniULID",
255
+ (inst, def) => {
256
+ core.$ZodULID.init(inst, def);
257
+ ZodMiniStringFormat.init(inst, def);
258
+ }
259
+ );
260
+
261
+ export function ulid(params?: string | core.$ZodULIDParams): ZodMiniULID {
262
+ return core._ulid(ZodMiniULID, params);
263
+ }
264
+
265
+ // ZodMiniXID
266
+ export interface ZodMiniXID extends _ZodMiniString<core.$ZodXIDInternals> {
267
+ // _zod: core.$ZodXIDInternals;
268
+ }
269
+ export const ZodMiniXID: core.$constructor<ZodMiniXID> = /*@__PURE__*/ core.$constructor("ZodMiniXID", (inst, def) => {
270
+ core.$ZodXID.init(inst, def);
271
+ ZodMiniStringFormat.init(inst, def);
272
+ });
273
+
274
+ export function xid(params?: string | core.$ZodXIDParams): ZodMiniXID {
275
+ return core._xid(ZodMiniXID, params);
276
+ }
277
+
278
+ // ZodMiniKSUID
279
+ export interface ZodMiniKSUID extends _ZodMiniString<core.$ZodKSUIDInternals> {
280
+ // _zod: core.$ZodKSUIDInternals;
281
+ }
282
+ export const ZodMiniKSUID: core.$constructor<ZodMiniKSUID> = /*@__PURE__*/ core.$constructor(
283
+ "ZodMiniKSUID",
284
+ (inst, def) => {
285
+ core.$ZodKSUID.init(inst, def);
286
+ ZodMiniStringFormat.init(inst, def);
287
+ }
288
+ );
289
+
290
+ export function ksuid(params?: string | core.$ZodKSUIDParams): ZodMiniKSUID {
291
+ return core._ksuid(ZodMiniKSUID, params);
292
+ }
293
+
294
+ // ZodMiniIPv4
295
+ export interface ZodMiniIPv4 extends _ZodMiniString<core.$ZodIPv4Internals> {
296
+ // _zod: core.$ZodIPv4Internals;
297
+ }
298
+ export const ZodMiniIPv4: core.$constructor<ZodMiniIPv4> = /*@__PURE__*/ core.$constructor(
299
+ "ZodMiniIPv4",
300
+ (inst, def) => {
301
+ core.$ZodIPv4.init(inst, def);
302
+ ZodMiniStringFormat.init(inst, def);
303
+ }
304
+ );
305
+
306
+ export function ipv4(params?: string | core.$ZodIPv4Params): ZodMiniIPv4 {
307
+ return core._ipv4(ZodMiniIPv4, params);
308
+ }
309
+
310
+ // ZodMiniIPv6
311
+ export interface ZodMiniIPv6 extends _ZodMiniString<core.$ZodIPv6Internals> {
312
+ // _zod: core.$ZodIPv6Internals;
313
+ }
314
+ export const ZodMiniIPv6: core.$constructor<ZodMiniIPv6> = /*@__PURE__*/ core.$constructor(
315
+ "ZodMiniIPv6",
316
+ (inst, def) => {
317
+ core.$ZodIPv6.init(inst, def);
318
+ ZodMiniStringFormat.init(inst, def);
319
+ }
320
+ );
321
+
322
+ export function ipv6(params?: string | core.$ZodIPv6Params): ZodMiniIPv6 {
323
+ return core._ipv6(ZodMiniIPv6, params);
324
+ }
325
+
326
+ // ZodMiniCIDRv4
327
+ export interface ZodMiniCIDRv4 extends _ZodMiniString<core.$ZodCIDRv4Internals> {
328
+ // _zod: core.$ZodCIDRv4Internals;
329
+ }
330
+ export const ZodMiniCIDRv4: core.$constructor<ZodMiniCIDRv4> = /*@__PURE__*/ core.$constructor(
331
+ "ZodMiniCIDRv4",
332
+ (inst, def) => {
333
+ core.$ZodCIDRv4.init(inst, def);
334
+ ZodMiniStringFormat.init(inst, def);
335
+ }
336
+ );
337
+
338
+ export function cidrv4(params?: string | core.$ZodCIDRv4Params): ZodMiniCIDRv4 {
339
+ return core._cidrv4(ZodMiniCIDRv4, params);
340
+ }
341
+
342
+ // ZodMiniCIDRv6
343
+ export interface ZodMiniCIDRv6 extends _ZodMiniString<core.$ZodCIDRv6Internals> {
344
+ // _zod: core.$ZodCIDRv6Internals;
345
+ }
346
+ export const ZodMiniCIDRv6: core.$constructor<ZodMiniCIDRv6> = /*@__PURE__*/ core.$constructor(
347
+ "ZodMiniCIDRv6",
348
+ (inst, def) => {
349
+ core.$ZodCIDRv6.init(inst, def);
350
+ ZodMiniStringFormat.init(inst, def);
351
+ }
352
+ );
353
+
354
+ export function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6 {
355
+ return core._cidrv6(ZodMiniCIDRv6, params);
356
+ }
357
+
358
+ // ZodMiniBase64
359
+ export interface ZodMiniBase64 extends _ZodMiniString<core.$ZodBase64Internals> {
360
+ // _zod: core.$ZodBase64Internals;
361
+ }
362
+ export const ZodMiniBase64: core.$constructor<ZodMiniBase64> = /*@__PURE__*/ core.$constructor(
363
+ "ZodMiniBase64",
364
+ (inst, def) => {
365
+ core.$ZodBase64.init(inst, def);
366
+ ZodMiniStringFormat.init(inst, def);
367
+ }
368
+ );
369
+ export function base64(params?: string | core.$ZodBase64Params): ZodMiniBase64 {
370
+ return core._base64(ZodMiniBase64, params);
371
+ }
372
+
373
+ // ZodMiniBase64URL
374
+ export interface ZodMiniBase64URL extends _ZodMiniString<core.$ZodBase64URLInternals> {
375
+ // _zod: core.$ZodBase64URLInternals;
376
+ }
377
+ export const ZodMiniBase64URL: core.$constructor<ZodMiniBase64URL> = /*@__PURE__*/ core.$constructor(
378
+ "ZodMiniBase64URL",
379
+ (inst, def) => {
380
+ core.$ZodBase64URL.init(inst, def);
381
+ ZodMiniStringFormat.init(inst, def);
382
+ }
383
+ );
384
+ export function base64url(params?: string | core.$ZodBase64URLParams): ZodMiniBase64URL {
385
+ return core._base64url(ZodMiniBase64URL, params);
386
+ }
387
+
388
+ // ZodMiniE164
389
+ export interface ZodMiniE164 extends _ZodMiniString<core.$ZodE164Internals> {
390
+ // _zod: core.$ZodE164Internals;
391
+ }
392
+ export const ZodMiniE164: core.$constructor<ZodMiniE164> = /*@__PURE__*/ core.$constructor(
393
+ "ZodMiniE164",
394
+ (inst, def) => {
395
+ core.$ZodE164.init(inst, def);
396
+ ZodMiniStringFormat.init(inst, def);
397
+ }
398
+ );
399
+
400
+ export function e164(params?: string | core.$ZodE164Params): ZodMiniE164 {
401
+ return core._e164(ZodMiniE164, params);
402
+ }
403
+
404
+ // ZodMiniJWT
405
+ export interface ZodMiniJWT extends _ZodMiniString<core.$ZodJWTInternals> {
406
+ // _zod: core.$ZodJWTInternals;
407
+ }
408
+ export const ZodMiniJWT: core.$constructor<ZodMiniJWT> = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => {
409
+ core.$ZodJWT.init(inst, def);
410
+ ZodMiniStringFormat.init(inst, def);
411
+ });
412
+
413
+ export function jwt(params?: string | core.$ZodJWTParams): ZodMiniJWT {
414
+ return core._jwt(ZodMiniJWT, params);
415
+ }
416
+
417
+ // ZodMiniCustomStringFormat
418
+ export interface ZodMiniCustomStringFormat<Format extends string = string>
419
+ extends ZodMiniStringFormat<Format>,
420
+ core.$ZodCustomStringFormat<Format> {
421
+ _zod: core.$ZodCustomStringFormatInternals<Format>;
422
+ }
423
+ export const ZodMiniCustomStringFormat: core.$constructor<ZodMiniCustomStringFormat> = /*@__PURE__*/ core.$constructor(
424
+ "ZodMiniCustomStringFormat",
425
+ (inst, def) => {
426
+ core.$ZodCustomStringFormat.init(inst, def);
427
+ ZodMiniStringFormat.init(inst, def);
428
+ }
429
+ );
430
+
431
+ export function stringFormat<Format extends string>(
432
+ format: Format,
433
+ fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp,
434
+ _params: string | core.$ZodStringFormatParams = {}
435
+ ): ZodMiniCustomStringFormat<Format> {
436
+ return core._stringFormat(ZodMiniCustomStringFormat, format, fnOrRegex, _params) as any;
437
+ }
438
+
439
+ // ZodMiniNumber
440
+ interface _ZodMiniNumber<T extends core.$ZodNumberInternals<unknown> = core.$ZodNumberInternals<unknown>>
441
+ extends _ZodMiniType<T>,
442
+ core.$ZodNumber<T["input"]> {
443
+ _zod: T;
444
+ }
445
+ export interface ZodMiniNumber<Input = unknown>
446
+ extends _ZodMiniNumber<core.$ZodNumberInternals<Input>>,
447
+ core.$ZodNumber<Input> {}
448
+ export const ZodMiniNumber: core.$constructor<ZodMiniNumber> = /*@__PURE__*/ core.$constructor(
449
+ "ZodMiniNumber",
450
+ (inst, def) => {
451
+ core.$ZodNumber.init(inst, def);
452
+ ZodMiniType.init(inst, def);
453
+ }
454
+ );
455
+
456
+ export function number(params?: string | core.$ZodNumberParams): ZodMiniNumber<number> {
457
+ return core._number(ZodMiniNumber, params) as any;
458
+ }
459
+
460
+ // ZodMiniNumberFormat
461
+ export interface ZodMiniNumberFormat extends _ZodMiniNumber<core.$ZodNumberFormatInternals>, core.$ZodNumberFormat {}
462
+ export const ZodMiniNumberFormat: core.$constructor<ZodMiniNumberFormat> = /*@__PURE__*/ core.$constructor(
463
+ "ZodMiniNumberFormat",
464
+ (inst, def) => {
465
+ core.$ZodNumberFormat.init(inst, def);
466
+ ZodMiniNumber.init(inst, def);
467
+ }
468
+ );
469
+
470
+ // int
471
+
472
+ export function int(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
473
+ return core._int(ZodMiniNumberFormat, params);
474
+ }
475
+
476
+ // float32
477
+
478
+ export function float32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
479
+ return core._float32(ZodMiniNumberFormat, params);
480
+ }
481
+
482
+ // float64
483
+
484
+ export function float64(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
485
+ return core._float64(ZodMiniNumberFormat, params);
486
+ }
487
+
488
+ // int32
489
+
490
+ export function int32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
491
+ return core._int32(ZodMiniNumberFormat, params);
492
+ }
493
+
494
+ // uint32
495
+
496
+ export function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
497
+ return core._uint32(ZodMiniNumberFormat, params);
498
+ }
499
+
500
+ // ZodMiniBoolean
501
+ export interface ZodMiniBoolean<T = unknown> extends _ZodMiniType<core.$ZodBooleanInternals<T>> {
502
+ // _zod: core.$ZodBooleanInternals<T>;
503
+ }
504
+ export const ZodMiniBoolean: core.$constructor<ZodMiniBoolean> = /*@__PURE__*/ core.$constructor(
505
+ "ZodMiniBoolean",
506
+ (inst, def) => {
507
+ core.$ZodBoolean.init(inst, def);
508
+ ZodMiniType.init(inst, def);
509
+ }
510
+ );
511
+
512
+ export function boolean(params?: string | core.$ZodBooleanParams): ZodMiniBoolean<boolean> {
513
+ return core._boolean(ZodMiniBoolean, params) as any;
514
+ }
515
+
516
+ // ZodMiniBigInt
517
+ export interface ZodMiniBigInt<T = unknown> extends _ZodMiniType<core.$ZodBigIntInternals<T>>, core.$ZodBigInt<T> {
518
+ // _zod: core.$ZodBigIntInternals<T>;
519
+ }
520
+ export const ZodMiniBigInt: core.$constructor<ZodMiniBigInt> = /*@__PURE__*/ core.$constructor(
521
+ "ZodMiniBigInt",
522
+ (inst, def) => {
523
+ core.$ZodBigInt.init(inst, def);
524
+ ZodMiniType.init(inst, def);
525
+ }
526
+ );
527
+
528
+ export function bigint(params?: string | core.$ZodBigIntParams): ZodMiniBigInt<bigint> {
529
+ return core._bigint(ZodMiniBigInt, params) as any;
530
+ }
531
+
532
+ // bigint formats
533
+
534
+ // ZodMiniBigIntFormat
535
+ export interface ZodMiniBigIntFormat extends _ZodMiniType<core.$ZodBigIntFormatInternals> {
536
+ // _zod: core.$ZodBigIntFormatInternals;
537
+ }
538
+ export const ZodMiniBigIntFormat: core.$constructor<ZodMiniBigIntFormat> = /*@__PURE__*/ core.$constructor(
539
+ "ZodMiniBigIntFormat",
540
+ (inst, def) => {
541
+ core.$ZodBigIntFormat.init(inst, def);
542
+ ZodMiniBigInt.init(inst, def);
543
+ }
544
+ );
545
+
546
+ // int64
547
+
548
+ export function int64(params?: string | core.$ZodBigIntFormatParams): ZodMiniBigIntFormat {
549
+ return core._int64(ZodMiniBigIntFormat, params);
550
+ }
551
+
552
+ // uint64
553
+
554
+ export function uint64(params?: string | core.$ZodBigIntFormatParams): ZodMiniBigIntFormat {
555
+ return core._uint64(ZodMiniBigIntFormat, params);
556
+ }
557
+
558
+ // ZodMiniSymbol
559
+ export interface ZodMiniSymbol extends _ZodMiniType<core.$ZodSymbolInternals> {
560
+ // _zod: core.$ZodSymbolInternals;
561
+ }
562
+ export const ZodMiniSymbol: core.$constructor<ZodMiniSymbol> = /*@__PURE__*/ core.$constructor(
563
+ "ZodMiniSymbol",
564
+ (inst, def) => {
565
+ core.$ZodSymbol.init(inst, def);
566
+ ZodMiniType.init(inst, def);
567
+ }
568
+ );
569
+
570
+ export function symbol(params?: string | core.$ZodSymbolParams): ZodMiniSymbol {
571
+ return core._symbol(ZodMiniSymbol, params) as any;
572
+ }
573
+
574
+ // ZodMiniUndefined
575
+ export interface ZodMiniUndefined extends _ZodMiniType<core.$ZodUndefinedInternals> {
576
+ // _zod: core.$ZodUndefinedInternals;
577
+ }
578
+ export const ZodMiniUndefined: core.$constructor<ZodMiniUndefined> = /*@__PURE__*/ core.$constructor(
579
+ "ZodMiniUndefined",
580
+ (inst, def) => {
581
+ core.$ZodUndefined.init(inst, def);
582
+ ZodMiniType.init(inst, def);
583
+ }
584
+ );
585
+
586
+ function _undefined(params?: string | core.$ZodUndefinedParams): ZodMiniUndefined {
587
+ return core._undefined(ZodMiniUndefined, params) as any;
588
+ }
589
+ export { _undefined as undefined };
590
+
591
+ // ZodMiniNull
592
+ export interface ZodMiniNull extends _ZodMiniType<core.$ZodNullInternals> {
593
+ // _zod: core.$ZodNullInternals;
594
+ }
595
+ export const ZodMiniNull: core.$constructor<ZodMiniNull> = /*@__PURE__*/ core.$constructor(
596
+ "ZodMiniNull",
597
+ (inst, def) => {
598
+ core.$ZodNull.init(inst, def);
599
+ ZodMiniType.init(inst, def);
600
+ }
601
+ );
602
+
603
+ function _null(params?: string | core.$ZodNullParams): ZodMiniNull {
604
+ return core._null(ZodMiniNull, params) as any;
605
+ }
606
+ export { _null as null };
607
+
608
+ // ZodMiniAny
609
+ export interface ZodMiniAny extends _ZodMiniType<core.$ZodAnyInternals> {
610
+ // _zod: core.$ZodAnyInternals;
611
+ }
612
+ export const ZodMiniAny: core.$constructor<ZodMiniAny> = /*@__PURE__*/ core.$constructor("ZodMiniAny", (inst, def) => {
613
+ core.$ZodAny.init(inst, def);
614
+ ZodMiniType.init(inst, def);
615
+ });
616
+
617
+ export function any(): ZodMiniAny {
618
+ return core._any(ZodMiniAny) as any;
619
+ }
620
+
621
+ // ZodMiniUnknown
622
+ export interface ZodMiniUnknown extends _ZodMiniType<core.$ZodUnknownInternals> {
623
+ // _zod: core.$ZodUnknownInternals;
624
+ }
625
+ export const ZodMiniUnknown: core.$constructor<ZodMiniUnknown> = /*@__PURE__*/ core.$constructor(
626
+ "ZodMiniUnknown",
627
+ (inst, def) => {
628
+ core.$ZodUnknown.init(inst, def);
629
+ ZodMiniType.init(inst, def);
630
+ }
631
+ );
632
+
633
+ export function unknown(): ZodMiniUnknown {
634
+ return core._unknown(ZodMiniUnknown) as any;
635
+ }
636
+
637
+ // ZodMiniNever
638
+ export interface ZodMiniNever extends _ZodMiniType<core.$ZodNeverInternals> {
639
+ // _zod: core.$ZodNeverInternals;
640
+ }
641
+ export const ZodMiniNever: core.$constructor<ZodMiniNever> = /*@__PURE__*/ core.$constructor(
642
+ "ZodMiniNever",
643
+ (inst, def) => {
644
+ core.$ZodNever.init(inst, def);
645
+ ZodMiniType.init(inst, def);
646
+ }
647
+ );
648
+
649
+ export function never(params?: string | core.$ZodNeverParams): ZodMiniNever {
650
+ return core._never(ZodMiniNever, params) as any;
651
+ }
652
+
653
+ // ZodMiniVoid
654
+ export interface ZodMiniVoid extends _ZodMiniType<core.$ZodVoidInternals> {
655
+ // _zod: core.$ZodVoidInternals;
656
+ }
657
+ export const ZodMiniVoid: core.$constructor<ZodMiniVoid> = /*@__PURE__*/ core.$constructor(
658
+ "ZodMiniVoid",
659
+ (inst, def) => {
660
+ core.$ZodVoid.init(inst, def);
661
+ ZodMiniType.init(inst, def);
662
+ }
663
+ );
664
+
665
+ function _void(params?: string | core.$ZodVoidParams): ZodMiniVoid {
666
+ return core._void(ZodMiniVoid, params) as any;
667
+ }
668
+ export { _void as void };
669
+
670
+ // ZodMiniDate
671
+ export interface ZodMiniDate<T = unknown> extends _ZodMiniType<core.$ZodDateInternals<T>> {
672
+ // _zod: core.$ZodDateInternals<T>;
673
+ }
674
+
675
+ export const ZodMiniDate: core.$constructor<ZodMiniDate> = /*@__PURE__*/ core.$constructor(
676
+ "ZodMiniDate",
677
+ (inst, def) => {
678
+ core.$ZodDate.init(inst, def);
679
+ ZodMiniType.init(inst, def);
680
+ }
681
+ );
682
+
683
+ export function date(params?: string | core.$ZodDateParams): ZodMiniDate<Date> {
684
+ return core._date(ZodMiniDate, params) as any;
685
+ }
686
+
687
+ // ZodMiniArray
688
+ export interface ZodMiniArray<T extends SomeType = core.$ZodType>
689
+ extends _ZodMiniType<core.$ZodArrayInternals<T>>,
690
+ core.$ZodArray<T> {
691
+ // _zod: core.$ZodArrayInternals<T>;
692
+ }
693
+ export const ZodMiniArray: core.$constructor<ZodMiniArray> = /*@__PURE__*/ core.$constructor(
694
+ "ZodMiniArray",
695
+ (inst, def) => {
696
+ core.$ZodArray.init(inst, def);
697
+ ZodMiniType.init(inst, def);
698
+ }
699
+ );
700
+
701
+ export function array<T extends SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodMiniArray<T>;
702
+ export function array<T extends SomeType>(element: SomeType, params?: any): ZodMiniArray<T> {
703
+ return new ZodMiniArray({
704
+ type: "array",
705
+ element: element as core.$ZodType,
706
+ ...util.normalizeParams(params),
707
+ }) as any;
708
+ }
709
+
710
+ // .keyof
711
+ export function keyof<T extends ZodMiniObject>(schema: T): ZodMiniLiteral<Exclude<keyof T["shape"], symbol>> {
712
+ const shape = schema._zod.def.shape;
713
+ return literal(Object.keys(shape)) as any;
714
+ }
715
+
716
+ // ZodMiniObject
717
+ export interface ZodMiniObject<
718
+ /** @ts-ignore Cast variance */
719
+ out Shape extends core.$ZodShape = core.$ZodShape,
720
+ out Config extends core.$ZodObjectConfig = core.$strip,
721
+ > extends ZodMiniType<any, any, core.$ZodObjectInternals<Shape, Config>>,
722
+ core.$ZodObject<Shape, Config> {
723
+ shape: Shape;
724
+ }
725
+ export const ZodMiniObject: core.$constructor<ZodMiniObject> = /*@__PURE__*/ core.$constructor(
726
+ "ZodMiniObject",
727
+ (inst, def) => {
728
+ core.$ZodObject.init(inst, def);
729
+ ZodMiniType.init(inst, def);
730
+ util.defineLazy(inst, "shape", () => def.shape);
731
+ }
732
+ );
733
+ export function object<T extends core.$ZodLooseShape = Record<never, SomeType>>(
734
+ shape?: T,
735
+ params?: string | core.$ZodObjectParams
736
+ ): ZodMiniObject<T, core.$strip> {
737
+ const def: core.$ZodObjectDef = {
738
+ type: "object",
739
+ get shape() {
740
+ util.assignProp(this, "shape", { ...shape });
741
+ return this.shape;
742
+ },
743
+ ...util.normalizeParams(params),
744
+ };
745
+ return new ZodMiniObject(def) as any;
746
+ }
747
+
748
+ // strictObject
749
+ export function strictObject<T extends core.$ZodLooseShape>(
750
+ shape: T,
751
+ params?: string | core.$ZodObjectParams
752
+ ): ZodMiniObject<T, core.$strict> {
753
+ return new ZodMiniObject({
754
+ type: "object",
755
+ // shape: shape as core.$ZodLooseShape,
756
+ get shape() {
757
+ util.assignProp(this, "shape", { ...shape });
758
+ return this.shape;
759
+ },
760
+ catchall: never(),
761
+ ...util.normalizeParams(params),
762
+ }) as any;
763
+ }
764
+
765
+ // looseObject
766
+ export function looseObject<T extends core.$ZodLooseShape>(
767
+ shape: T,
768
+ params?: string | core.$ZodObjectParams
769
+ ): ZodMiniObject<T, core.$loose> {
770
+ return new ZodMiniObject({
771
+ type: "object",
772
+ // shape: shape as core.$ZodLooseShape,
773
+ get shape() {
774
+ util.assignProp(this, "shape", { ...shape });
775
+ return this.shape;
776
+ },
777
+ // get optional() {
778
+ // return util.optionalKeys(shape);
779
+ // },
780
+ catchall: unknown(),
781
+ ...util.normalizeParams(params),
782
+ }) as any;
783
+ }
784
+
785
+ // object methods
786
+ export function extend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(
787
+ schema: T,
788
+ shape: U
789
+ ): ZodMiniObject<util.Extend<T["shape"], U>, T["_zod"]["config"]> {
790
+ return util.extend(schema, shape);
791
+ }
792
+
793
+ /** @deprecated Identical to `z.extend(A, B)` */
794
+ export function merge<T extends ZodMiniObject, U extends ZodMiniObject>(
795
+ a: T,
796
+ b: U
797
+ ): ZodMiniObject<util.Extend<T["shape"], U["shape"]>, T["_zod"]["config"]>;
798
+ export function merge(schema: ZodMiniObject, shape: any): ZodMiniObject {
799
+ return util.extend(schema, shape);
800
+ }
801
+
802
+ export function pick<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(
803
+ schema: T,
804
+ mask: M
805
+ ): ZodMiniObject<util.Flatten<Pick<T["shape"], keyof T["shape"] & keyof M>>, T["_zod"]["config"]> {
806
+ return util.pick(schema, mask as any);
807
+ }
808
+
809
+ // .omit
810
+
811
+ export function omit<T extends ZodMiniObject, const M extends util.Mask<keyof T["shape"]>>(
812
+ schema: T,
813
+ mask: M
814
+ ): ZodMiniObject<util.Flatten<Omit<T["shape"], keyof M>>, T["_zod"]["config"]> {
815
+ return util.omit(schema, mask);
816
+ }
817
+
818
+ export function partial<T extends ZodMiniObject>(
819
+ schema: T
820
+ ): ZodMiniObject<
821
+ {
822
+ [k in keyof T["shape"]]: ZodMiniOptional<T["shape"][k]>;
823
+ },
824
+ T["_zod"]["config"]
825
+ >;
826
+ export function partial<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(
827
+ schema: T,
828
+ mask: M
829
+ ): ZodMiniObject<
830
+ {
831
+ [k in keyof T["shape"]]: k extends keyof M ? ZodMiniOptional<T["shape"][k]> : T["shape"][k];
832
+ },
833
+ T["_zod"]["config"]
834
+ >;
835
+ export function partial(schema: ZodMiniObject, mask?: object) {
836
+ return util.partial(ZodMiniOptional, schema, mask);
837
+ }
838
+
839
+ export type RequiredInterfaceShape<
840
+ Shape extends core.$ZodLooseShape,
841
+ Keys extends PropertyKey = keyof Shape,
842
+ > = util.Identity<
843
+ {
844
+ [k in keyof Shape as k extends Keys ? k : never]: ZodMiniNonOptional<Shape[k]>;
845
+ } & {
846
+ [k in keyof Shape as k extends Keys ? never : k]: Shape[k];
847
+ }
848
+ >;
849
+
850
+ export function required<T extends ZodMiniObject>(
851
+ schema: T
852
+ ): ZodMiniObject<
853
+ {
854
+ [k in keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
855
+ },
856
+ T["_zod"]["config"]
857
+ >;
858
+ export function required<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(
859
+ schema: T,
860
+ mask: M
861
+ ): ZodMiniObject<
862
+ util.Extend<
863
+ T["shape"],
864
+ {
865
+ [k in keyof M & keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
866
+ }
867
+ >,
868
+ T["_zod"]["config"]
869
+ >;
870
+ export function required(schema: ZodMiniObject, mask?: object) {
871
+ return util.required(ZodMiniNonOptional, schema, mask);
872
+ }
873
+
874
+ export function catchall<T extends ZodMiniObject, U extends SomeType>(
875
+ inst: T,
876
+ catchall: U
877
+ ): ZodMiniObject<T["shape"], core.$catchall<U>> {
878
+ return inst.clone({ ...inst._zod.def, catchall: catchall as any }) as any;
879
+ }
880
+
881
+ // ZodMiniUnion
882
+ export interface ZodMiniUnion<T extends readonly SomeType[] = readonly core.$ZodType[]>
883
+ extends _ZodMiniType<core.$ZodUnionInternals<T>> {
884
+ // _zod: core.$ZodUnionInternals<T>;
885
+ }
886
+ export const ZodMiniUnion: core.$constructor<ZodMiniUnion> = /*@__PURE__*/ core.$constructor(
887
+ "ZodMiniUnion",
888
+ (inst, def) => {
889
+ core.$ZodUnion.init(inst, def);
890
+ ZodMiniType.init(inst, def);
891
+ }
892
+ );
893
+
894
+ export function union<const T extends readonly SomeType[]>(
895
+ options: T,
896
+ params?: string | core.$ZodUnionParams
897
+ ): ZodMiniUnion<T> {
898
+ return new ZodMiniUnion({
899
+ type: "union",
900
+ options: options as any as core.$ZodType[],
901
+ ...util.normalizeParams(params),
902
+ }) as any;
903
+ }
904
+
905
+ // ZodMiniDiscriminatedUnion
906
+ export interface ZodMiniDiscriminatedUnion<Options extends readonly SomeType[] = readonly core.$ZodType[]>
907
+ extends ZodMiniUnion<Options> {
908
+ _zod: core.$ZodDiscriminatedUnionInternals<Options>;
909
+ }
910
+ export const ZodMiniDiscriminatedUnion: core.$constructor<ZodMiniDiscriminatedUnion> = /*@__PURE__*/ core.$constructor(
911
+ "ZodMiniDiscriminatedUnion",
912
+ (inst, def) => {
913
+ core.$ZodDiscriminatedUnion.init(inst, def);
914
+ ZodMiniType.init(inst, def);
915
+ }
916
+ );
917
+
918
+ export function discriminatedUnion<
919
+ Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]],
920
+ >(
921
+ discriminator: string,
922
+ options: Types,
923
+ params?: string | core.$ZodDiscriminatedUnionParams
924
+ ): ZodMiniDiscriminatedUnion<Types> {
925
+ return new ZodMiniDiscriminatedUnion({
926
+ type: "union",
927
+ options,
928
+ discriminator,
929
+ ...util.normalizeParams(params),
930
+ }) as ZodMiniDiscriminatedUnion<Types>;
931
+ }
932
+
933
+ // ZodMiniIntersection
934
+ export interface ZodMiniIntersection<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType>
935
+ extends _ZodMiniType<core.$ZodIntersectionInternals<A, B>> {
936
+ // _zod: core.$ZodIntersectionInternals<A, B>;
937
+ }
938
+ export const ZodMiniIntersection: core.$constructor<ZodMiniIntersection> = /*@__PURE__*/ core.$constructor(
939
+ "ZodMiniIntersection",
940
+ (inst, def) => {
941
+ core.$ZodIntersection.init(inst, def);
942
+ ZodMiniType.init(inst, def);
943
+ }
944
+ );
945
+
946
+ export function intersection<T extends SomeType, U extends SomeType>(left: T, right: U): ZodMiniIntersection<T, U> {
947
+ return new ZodMiniIntersection({
948
+ type: "intersection",
949
+ left: left as any as core.$ZodType,
950
+ right: right as any as core.$ZodType,
951
+ }) as any;
952
+ }
953
+
954
+ // ZodMiniTuple
955
+ export interface ZodMiniTuple<
956
+ T extends util.TupleItems = readonly core.$ZodType[],
957
+ Rest extends SomeType | null = core.$ZodType | null,
958
+ > extends _ZodMiniType<core.$ZodTupleInternals<T, Rest>> {
959
+ // _zod: core.$ZodTupleInternals<T, Rest>;
960
+ }
961
+ export const ZodMiniTuple: core.$constructor<ZodMiniTuple> = /*@__PURE__*/ core.$constructor(
962
+ "ZodMiniTuple",
963
+ (inst, def) => {
964
+ core.$ZodTuple.init(inst, def);
965
+ ZodMiniType.init(inst, def);
966
+ }
967
+ );
968
+
969
+ export function tuple<const T extends readonly [SomeType, ...SomeType[]]>(
970
+ items: T,
971
+ params?: string | core.$ZodTupleParams
972
+ ): ZodMiniTuple<T, null>;
973
+ export function tuple<const T extends readonly [SomeType, ...SomeType[]], Rest extends SomeType>(
974
+ items: T,
975
+ rest: Rest,
976
+ params?: string | core.$ZodTupleParams
977
+ ): ZodMiniTuple<T, Rest>;
978
+ export function tuple(items: [], params?: string | core.$ZodTupleParams): ZodMiniTuple<[], null>;
979
+ export function tuple(
980
+ items: SomeType[],
981
+ _paramsOrRest?: string | core.$ZodTupleParams | SomeType,
982
+ _params?: string | core.$ZodTupleParams
983
+ ) {
984
+ const hasRest = _paramsOrRest instanceof core.$ZodType;
985
+ const params = hasRest ? _params : _paramsOrRest;
986
+ const rest = hasRest ? _paramsOrRest : null;
987
+ return new ZodMiniTuple({
988
+ type: "tuple",
989
+ items: items as any as core.$ZodType[],
990
+ rest,
991
+ ...util.normalizeParams(params),
992
+ });
993
+ }
994
+
995
+ // ZodMiniRecord
996
+ export interface ZodMiniRecord<
997
+ Key extends core.$ZodRecordKey = core.$ZodRecordKey,
998
+ Value extends SomeType = core.$ZodType,
999
+ > extends _ZodMiniType<core.$ZodRecordInternals<Key, Value>> {
1000
+ // _zod: core.$ZodRecordInternals<Key, Value>;
1001
+ }
1002
+ export const ZodMiniRecord: core.$constructor<ZodMiniRecord> = /*@__PURE__*/ core.$constructor(
1003
+ "ZodMiniRecord",
1004
+ (inst, def) => {
1005
+ core.$ZodRecord.init(inst, def);
1006
+ ZodMiniType.init(inst, def);
1007
+ }
1008
+ );
1009
+
1010
+ export function record<Key extends core.$ZodRecordKey, Value extends SomeType>(
1011
+ keyType: Key,
1012
+ valueType: Value,
1013
+ params?: string | core.$ZodRecordParams
1014
+ ): ZodMiniRecord<Key, Value> {
1015
+ return new ZodMiniRecord({
1016
+ type: "record",
1017
+ keyType,
1018
+ valueType: valueType as any as core.$ZodType,
1019
+ ...util.normalizeParams(params),
1020
+ }) as any;
1021
+ }
1022
+ export function partialRecord<Key extends core.$ZodRecordKey, Value extends SomeType>(
1023
+ keyType: Key,
1024
+ valueType: Value,
1025
+ params?: string | core.$ZodRecordParams
1026
+ ): ZodMiniRecord<Key & core.$partial, Value> {
1027
+ return new ZodMiniRecord({
1028
+ type: "record",
1029
+ keyType: union([keyType, never()]),
1030
+ valueType: valueType as any,
1031
+ ...util.normalizeParams(params),
1032
+ }) as any;
1033
+ }
1034
+
1035
+ // ZodMiniMap
1036
+ export interface ZodMiniMap<Key extends SomeType = core.$ZodType, Value extends SomeType = core.$ZodType>
1037
+ extends _ZodMiniType<core.$ZodMapInternals<Key, Value>> {
1038
+ // _zod: core.$ZodMapInternals<Key, Value>;
1039
+ }
1040
+ export const ZodMiniMap: core.$constructor<ZodMiniMap> = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => {
1041
+ core.$ZodMap.init(inst, def);
1042
+ ZodMiniType.init(inst, def);
1043
+ });
1044
+
1045
+ export function map<Key extends SomeType, Value extends SomeType>(
1046
+ keyType: Key,
1047
+ valueType: Value,
1048
+ params?: string | core.$ZodMapParams
1049
+ ): ZodMiniMap<Key, Value> {
1050
+ return new ZodMiniMap({
1051
+ type: "map",
1052
+ keyType: keyType as any as core.$ZodType,
1053
+ valueType: valueType as any as core.$ZodType,
1054
+ ...util.normalizeParams(params),
1055
+ }) as any;
1056
+ }
1057
+
1058
+ // ZodMiniSet
1059
+ export interface ZodMiniSet<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodSetInternals<T>> {
1060
+ // _zod: core.$ZodSetInternals<T>;
1061
+ }
1062
+ export const ZodMiniSet: core.$constructor<ZodMiniSet> = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => {
1063
+ core.$ZodSet.init(inst, def);
1064
+ ZodMiniType.init(inst, def);
1065
+ });
1066
+
1067
+ export function set<Value extends SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodMiniSet<Value> {
1068
+ return new ZodMiniSet({
1069
+ type: "set",
1070
+ valueType: valueType as any as core.$ZodType,
1071
+ ...util.normalizeParams(params),
1072
+ }) as any;
1073
+ }
1074
+
1075
+ // ZodMiniEnum
1076
+ export interface ZodMiniEnum<T extends util.EnumLike = util.EnumLike> extends _ZodMiniType<core.$ZodEnumInternals<T>> {
1077
+ // _zod: core.$ZodEnumInternals<T>;
1078
+ }
1079
+ export const ZodMiniEnum: core.$constructor<ZodMiniEnum> = /*@__PURE__*/ core.$constructor(
1080
+ "ZodMiniEnum",
1081
+ (inst, def) => {
1082
+ core.$ZodEnum.init(inst, def);
1083
+ ZodMiniType.init(inst, def);
1084
+ }
1085
+ );
1086
+
1087
+ function _enum<const T extends readonly string[]>(
1088
+ values: T,
1089
+ params?: string | core.$ZodEnumParams
1090
+ ): ZodMiniEnum<util.ToEnum<T[number]>>;
1091
+ function _enum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodMiniEnum<T>;
1092
+ function _enum(values: any, params?: string | core.$ZodEnumParams) {
1093
+ const entries: any = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
1094
+
1095
+ return new ZodMiniEnum({
1096
+ type: "enum",
1097
+ entries,
1098
+ ...util.normalizeParams(params),
1099
+ }) as any;
1100
+ }
1101
+ export { _enum as enum };
1102
+
1103
+ /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
1104
+ *
1105
+ * ```ts
1106
+ * enum Colors { red, green, blue }
1107
+ * z.enum(Colors);
1108
+ * ```
1109
+ */
1110
+ export function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodMiniEnum<T> {
1111
+ return new ZodMiniEnum({
1112
+ type: "enum",
1113
+ entries,
1114
+ ...util.normalizeParams(params),
1115
+ }) as any as ZodMiniEnum<T>;
1116
+ }
1117
+
1118
+ // ZodMiniLiteral
1119
+ export interface ZodMiniLiteral<T extends util.Literal = util.Literal>
1120
+ extends _ZodMiniType<core.$ZodLiteralInternals<T>> {
1121
+ // _zod: core.$ZodLiteralInternals<T>;
1122
+ }
1123
+ export const ZodMiniLiteral: core.$constructor<ZodMiniLiteral> = /*@__PURE__*/ core.$constructor(
1124
+ "ZodMiniLiteral",
1125
+ (inst, def) => {
1126
+ core.$ZodLiteral.init(inst, def);
1127
+ ZodMiniType.init(inst, def);
1128
+ }
1129
+ );
1130
+
1131
+ export function literal<const T extends ReadonlyArray<util.Literal>>(
1132
+ value: T,
1133
+ params?: string | core.$ZodLiteralParams
1134
+ ): ZodMiniLiteral<T[number]>;
1135
+ export function literal<const T extends util.Literal>(
1136
+ value: T,
1137
+ params?: string | core.$ZodLiteralParams
1138
+ ): ZodMiniLiteral<T>;
1139
+ export function literal(value: any, params: any) {
1140
+ return new ZodMiniLiteral({
1141
+ type: "literal",
1142
+ values: Array.isArray(value) ? value : [value],
1143
+ ...util.normalizeParams(params),
1144
+ });
1145
+ }
1146
+
1147
+ // ZodMiniFile
1148
+ export interface ZodMiniFile extends _ZodMiniType<core.$ZodFileInternals> {
1149
+ // _zod: core.$ZodFileInternals;
1150
+ }
1151
+ export const ZodMiniFile: core.$constructor<ZodMiniFile> = /*@__PURE__*/ core.$constructor(
1152
+ "ZodMiniFile",
1153
+ (inst, def) => {
1154
+ core.$ZodFile.init(inst, def);
1155
+ ZodMiniType.init(inst, def);
1156
+ }
1157
+ );
1158
+
1159
+ export function file(params?: string | core.$ZodFileParams): ZodMiniFile {
1160
+ return core._file(ZodMiniFile, params) as any;
1161
+ }
1162
+
1163
+ // ZodMiniTransform
1164
+ export interface ZodMiniTransform<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodTransformInternals<O, I>> {
1165
+ // _zod: core.$ZodTransformInternals<O, I>;
1166
+ }
1167
+ export const ZodMiniTransform: core.$constructor<ZodMiniTransform> = /*@__PURE__*/ core.$constructor(
1168
+ "ZodMiniTransform",
1169
+ (inst, def) => {
1170
+ core.$ZodTransform.init(inst, def);
1171
+ ZodMiniType.init(inst, def);
1172
+ }
1173
+ );
1174
+
1175
+ export function transform<I = unknown, O = I>(
1176
+ fn: (input: I, ctx: core.ParsePayload) => O
1177
+ ): ZodMiniTransform<Awaited<O>, I> {
1178
+ return new ZodMiniTransform({
1179
+ type: "transform",
1180
+ transform: fn as any,
1181
+ }) as any;
1182
+ }
1183
+
1184
+ // ZodMiniOptional
1185
+ export interface ZodMiniOptional<T extends SomeType = core.$ZodType>
1186
+ extends _ZodMiniType<core.$ZodOptionalInternals<T>>,
1187
+ core.$ZodOptional<T> {
1188
+ // _zod: core.$ZodOptionalInternals<T>;
1189
+ }
1190
+ export const ZodMiniOptional: core.$constructor<ZodMiniOptional> = /*@__PURE__*/ core.$constructor(
1191
+ "ZodMiniOptional",
1192
+ (inst, def) => {
1193
+ core.$ZodOptional.init(inst, def);
1194
+ ZodMiniType.init(inst, def);
1195
+ }
1196
+ );
1197
+
1198
+ export function optional<T extends SomeType>(innerType: T): ZodMiniOptional<T> {
1199
+ return new ZodMiniOptional({
1200
+ type: "optional",
1201
+ innerType: innerType as any as core.$ZodType,
1202
+ }) as any;
1203
+ }
1204
+
1205
+ // ZodMiniNullable
1206
+ export interface ZodMiniNullable<T extends SomeType = core.$ZodType>
1207
+ extends _ZodMiniType<core.$ZodNullableInternals<T>> {
1208
+ // _zod: core.$ZodNullableInternals<T>;
1209
+ }
1210
+ export const ZodMiniNullable: core.$constructor<ZodMiniNullable> = /*@__PURE__*/ core.$constructor(
1211
+ "ZodMiniNullable",
1212
+ (inst, def) => {
1213
+ core.$ZodNullable.init(inst, def);
1214
+ ZodMiniType.init(inst, def);
1215
+ }
1216
+ );
1217
+
1218
+ export function nullable<T extends SomeType>(innerType: T): ZodMiniNullable<T> {
1219
+ return new ZodMiniNullable({
1220
+ type: "nullable",
1221
+ innerType: innerType as any as core.$ZodType,
1222
+ }) as any;
1223
+ }
1224
+
1225
+ // nullish
1226
+ export function nullish<T extends SomeType>(innerType: T): ZodMiniOptional<ZodMiniNullable<T>> {
1227
+ return optional(nullable(innerType));
1228
+ }
1229
+
1230
+ // ZodMiniDefault
1231
+ export interface ZodMiniDefault<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodDefaultInternals<T>> {
1232
+ // _zod: core.$ZodDefaultInternals<T>;
1233
+ }
1234
+ export const ZodMiniDefault: core.$constructor<ZodMiniDefault> = /*@__PURE__*/ core.$constructor(
1235
+ "ZodMiniDefault",
1236
+ (inst, def) => {
1237
+ core.$ZodDefault.init(inst, def);
1238
+ ZodMiniType.init(inst, def);
1239
+ }
1240
+ );
1241
+
1242
+ export function _default<T extends SomeType>(
1243
+ innerType: T,
1244
+ defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)
1245
+ ): ZodMiniDefault<T> {
1246
+ return new ZodMiniDefault({
1247
+ type: "default",
1248
+ innerType: innerType as any as core.$ZodType,
1249
+ get defaultValue() {
1250
+ return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
1251
+ },
1252
+ }) as any;
1253
+ }
1254
+
1255
+ // ZodMiniPrefault
1256
+ export interface ZodMiniPrefault<T extends SomeType = core.$ZodType>
1257
+ extends _ZodMiniType<core.$ZodPrefaultInternals<T>> {
1258
+ // _zod: core.$ZodPrefaultInternals<T>;
1259
+ }
1260
+ export const ZodMiniPrefault: core.$constructor<ZodMiniPrefault> = /*@__PURE__*/ core.$constructor(
1261
+ "ZodMiniPrefault",
1262
+ (inst, def) => {
1263
+ core.$ZodPrefault.init(inst, def);
1264
+ ZodMiniType.init(inst, def);
1265
+ }
1266
+ );
1267
+ export function prefault<T extends SomeType>(
1268
+ innerType: T,
1269
+ defaultValue: util.NoUndefined<core.input<T>> | (() => util.NoUndefined<core.input<T>>)
1270
+ ): ZodMiniPrefault<T> {
1271
+ return new ZodMiniPrefault({
1272
+ type: "prefault",
1273
+ innerType: innerType as any as core.$ZodType,
1274
+ get defaultValue() {
1275
+ return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
1276
+ },
1277
+ }) as any;
1278
+ }
1279
+
1280
+ // ZodMiniNonOptional
1281
+ export interface ZodMiniNonOptional<T extends SomeType = core.$ZodType>
1282
+ extends _ZodMiniType<core.$ZodNonOptionalInternals<T>> {
1283
+ // _zod: core.$ZodNonOptionalInternals<T>;
1284
+ }
1285
+ export const ZodMiniNonOptional: core.$constructor<ZodMiniNonOptional> = /*@__PURE__*/ core.$constructor(
1286
+ "ZodMiniNonOptional",
1287
+ (inst, def) => {
1288
+ core.$ZodNonOptional.init(inst, def);
1289
+ ZodMiniType.init(inst, def);
1290
+ }
1291
+ );
1292
+
1293
+ export function nonoptional<T extends SomeType>(
1294
+ innerType: T,
1295
+ params?: string | core.$ZodNonOptionalParams
1296
+ ): ZodMiniNonOptional<T> {
1297
+ return new ZodMiniNonOptional({
1298
+ type: "nonoptional",
1299
+ innerType: innerType as any as core.$ZodType,
1300
+ ...util.normalizeParams(params),
1301
+ }) as any;
1302
+ }
1303
+
1304
+ // ZodMiniSuccess
1305
+ export interface ZodMiniSuccess<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodSuccessInternals<T>> {
1306
+ // _zod: core.$ZodSuccessInternals<T>;
1307
+ }
1308
+ export const ZodMiniSuccess: core.$constructor<ZodMiniSuccess> = /*@__PURE__*/ core.$constructor(
1309
+ "ZodMiniSuccess",
1310
+ (inst, def) => {
1311
+ core.$ZodSuccess.init(inst, def);
1312
+ ZodMiniType.init(inst, def);
1313
+ }
1314
+ );
1315
+
1316
+ export function success<T extends SomeType>(innerType: T): ZodMiniSuccess<T> {
1317
+ return new ZodMiniSuccess({
1318
+ type: "success",
1319
+ innerType: innerType as any as core.$ZodType,
1320
+ }) as any;
1321
+ }
1322
+
1323
+ // ZodMiniCatch
1324
+ export interface ZodMiniCatch<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodCatchInternals<T>> {
1325
+ // _zod: core.$ZodCatchInternals<T>;
1326
+ }
1327
+ export const ZodMiniCatch: core.$constructor<ZodMiniCatch> = /*@__PURE__*/ core.$constructor(
1328
+ "ZodMiniCatch",
1329
+ (inst, def) => {
1330
+ core.$ZodCatch.init(inst, def);
1331
+ ZodMiniType.init(inst, def);
1332
+ }
1333
+ );
1334
+
1335
+ function _catch<T extends SomeType>(
1336
+ innerType: T,
1337
+ catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)
1338
+ ): ZodMiniCatch<T> {
1339
+ return new ZodMiniCatch({
1340
+ type: "catch",
1341
+ innerType: innerType as any as core.$ZodType,
1342
+ catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue) as (
1343
+ ctx: core.$ZodCatchCtx
1344
+ ) => core.output<T>,
1345
+ }) as any;
1346
+ }
1347
+ export { _catch as catch };
1348
+
1349
+ // ZodMiniNaN
1350
+ export interface ZodMiniNaN extends _ZodMiniType<core.$ZodNaNInternals> {
1351
+ // _zod: core.$ZodNaNInternals;
1352
+ }
1353
+ export const ZodMiniNaN: core.$constructor<ZodMiniNaN> = /*@__PURE__*/ core.$constructor("ZodMiniNaN", (inst, def) => {
1354
+ core.$ZodNaN.init(inst, def);
1355
+ ZodMiniType.init(inst, def);
1356
+ });
1357
+
1358
+ export function nan(params?: string | core.$ZodNaNParams): ZodMiniNaN {
1359
+ return core._nan(ZodMiniNaN, params) as any;
1360
+ }
1361
+
1362
+ // ZodMiniPipe
1363
+ export interface ZodMiniPipe<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType>
1364
+ extends _ZodMiniType<core.$ZodPipeInternals<A, B>> {
1365
+ // _zod: core.$ZodPipeInternals<A, B>;
1366
+ }
1367
+ export const ZodMiniPipe: core.$constructor<ZodMiniPipe> = /*@__PURE__*/ core.$constructor(
1368
+ "ZodMiniPipe",
1369
+ (inst, def) => {
1370
+ core.$ZodPipe.init(inst, def);
1371
+ ZodMiniType.init(inst, def);
1372
+ }
1373
+ );
1374
+
1375
+ export function pipe<
1376
+ const A extends SomeType,
1377
+ B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>,
1378
+ >(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodMiniPipe<A, B> {
1379
+ return new ZodMiniPipe({
1380
+ type: "pipe",
1381
+ in: in_ as any as core.$ZodType,
1382
+ out: out as any as core.$ZodType,
1383
+ }) as any;
1384
+ }
1385
+
1386
+ // /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
1387
+ // export function preprocess<A, U extends core.$ZodType>(
1388
+ // fn: (arg: unknown, ctx: core.ParsePayload) => A,
1389
+ // schema: U,
1390
+ // params?: ZodPreprocessParams
1391
+ // ): ZodPipe<ZodTransform<A, unknown>, U> {
1392
+ // return pipe(transform(fn as any, params), schema as any, params);
1393
+ // }
1394
+
1395
+ // ZodMiniReadonly
1396
+ export interface ZodMiniReadonly<T extends SomeType = core.$ZodType>
1397
+ extends _ZodMiniType<core.$ZodReadonlyInternals<T>> {
1398
+ // _zod: core.$ZodReadonlyInternals<T>;
1399
+ }
1400
+ export const ZodMiniReadonly: core.$constructor<ZodMiniReadonly> = /*@__PURE__*/ core.$constructor(
1401
+ "ZodMiniReadonly",
1402
+ (inst, def) => {
1403
+ core.$ZodReadonly.init(inst, def);
1404
+ ZodMiniType.init(inst, def);
1405
+ }
1406
+ );
1407
+
1408
+ export function readonly<T extends SomeType>(innerType: T): ZodMiniReadonly<T> {
1409
+ return new ZodMiniReadonly({
1410
+ type: "readonly",
1411
+ innerType: innerType as any as core.$ZodType,
1412
+ }) as any;
1413
+ }
1414
+
1415
+ // ZodMiniTemplateLiteral
1416
+ export interface ZodMiniTemplateLiteral<Template extends string = string>
1417
+ extends _ZodMiniType<core.$ZodTemplateLiteralInternals<Template>> {
1418
+ // _zod: core.$ZodTemplateLiteralInternals<Template>;
1419
+ }
1420
+ export const ZodMiniTemplateLiteral: core.$constructor<ZodMiniTemplateLiteral> = /*@__PURE__*/ core.$constructor(
1421
+ "ZodMiniTemplateLiteral",
1422
+ (inst, def) => {
1423
+ core.$ZodTemplateLiteral.init(inst, def);
1424
+ ZodMiniType.init(inst, def);
1425
+ }
1426
+ );
1427
+
1428
+ export function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[]>(
1429
+ parts: Parts,
1430
+ params?: string | core.$ZodTemplateLiteralParams
1431
+ ): ZodMiniTemplateLiteral<core.$PartsToTemplateLiteral<Parts>> {
1432
+ return new ZodMiniTemplateLiteral({
1433
+ type: "template_literal",
1434
+ parts,
1435
+ ...util.normalizeParams(params),
1436
+ }) as any;
1437
+ }
1438
+
1439
+ // ZodMiniLazy
1440
+ export interface ZodMiniLazy<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodLazyInternals<T>> {
1441
+ // _zod: core.$ZodLazyInternals<T>;
1442
+ }
1443
+ export const ZodMiniLazy: core.$constructor<ZodMiniLazy> = /*@__PURE__*/ core.$constructor(
1444
+ "ZodMiniLazy",
1445
+ (inst, def) => {
1446
+ core.$ZodLazy.init(inst, def);
1447
+ ZodMiniType.init(inst, def);
1448
+ }
1449
+ );
1450
+
1451
+ // export function lazy<T extends object>(getter: () => T): T {
1452
+ // return util.createTransparentProxy<T>(getter);
1453
+ // }
1454
+ function _lazy<T extends SomeType>(getter: () => T): ZodMiniLazy<T> {
1455
+ return new ZodMiniLazy({
1456
+ type: "lazy",
1457
+ getter: getter as any,
1458
+ }) as any;
1459
+ }
1460
+ export { _lazy as lazy };
1461
+
1462
+ // ZodMiniPromise
1463
+ export interface ZodMiniPromise<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodPromiseInternals<T>> {
1464
+ // _zod: core.$ZodPromiseInternals<T>;
1465
+ }
1466
+ export const ZodMiniPromise: core.$constructor<ZodMiniPromise> = /*@__PURE__*/ core.$constructor(
1467
+ "ZodMiniPromise",
1468
+ (inst, def) => {
1469
+ core.$ZodPromise.init(inst, def);
1470
+ ZodMiniType.init(inst, def);
1471
+ }
1472
+ );
1473
+
1474
+ export function promise<T extends SomeType>(innerType: T): ZodMiniPromise<T> {
1475
+ return new ZodMiniPromise({
1476
+ type: "promise",
1477
+ innerType: innerType as any as core.$ZodType,
1478
+ }) as any;
1479
+ }
1480
+
1481
+ // ZodMiniCustom
1482
+ export interface ZodMiniCustom<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodCustomInternals<O, I>> {
1483
+ // _zod: core.$ZodCustomInternals<O, I>;
1484
+ }
1485
+ export const ZodMiniCustom: core.$constructor<ZodMiniCustom> = /*@__PURE__*/ core.$constructor(
1486
+ "ZodMiniCustom",
1487
+ (inst, def) => {
1488
+ core.$ZodCustom.init(inst, def);
1489
+ ZodMiniType.init(inst, def);
1490
+ }
1491
+ );
1492
+
1493
+ // custom checks
1494
+ export function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O> {
1495
+ const ch = new core.$ZodCheck({
1496
+ check: "custom",
1497
+ ...util.normalizeParams(params),
1498
+ });
1499
+
1500
+ ch._zod.check = fn;
1501
+ return ch;
1502
+ }
1503
+
1504
+ // ZodCustom
1505
+ // custom schema
1506
+ export function custom<O = unknown, I = O>(
1507
+ fn?: (data: O) => unknown,
1508
+ _params?: string | core.$ZodCustomParams | undefined
1509
+ ): ZodMiniCustom<O, I> {
1510
+ return core._custom(ZodMiniCustom, fn ?? (() => true), _params) as any;
1511
+ }
1512
+
1513
+ // refine
1514
+ export function refine<T>(
1515
+ fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
1516
+ _params: string | core.$ZodCustomParams = {}
1517
+ ): core.$ZodCheck<T> {
1518
+ return core._refine(ZodMiniCustom, fn, _params);
1519
+ }
1520
+
1521
+ // instanceof
1522
+ abstract class Class {
1523
+ constructor(..._args: any[]) {}
1524
+ }
1525
+ function _instanceof<T extends typeof Class>(
1526
+ cls: T,
1527
+ params: core.$ZodCustomParams = {
1528
+ error: `Input not instance of ${cls.name}`,
1529
+ }
1530
+ ): ZodMiniCustom<InstanceType<T>, InstanceType<T>> {
1531
+ const inst = custom((data) => data instanceof cls, params);
1532
+ inst._zod.bag.Class = cls;
1533
+ return inst as any;
1534
+ }
1535
+ export { _instanceof as instanceof };
1536
+
1537
+ // stringbool
1538
+ export const stringbool: (
1539
+ _params?: string | core.$ZodStringBoolParams
1540
+ ) => ZodMiniPipe<ZodMiniPipe<ZodMiniString, ZodMiniTransform<boolean, string>>, ZodMiniBoolean> = (...args) =>
1541
+ core._stringbool(
1542
+ {
1543
+ Pipe: ZodMiniPipe,
1544
+ Boolean: ZodMiniBoolean,
1545
+ String: ZodMiniString,
1546
+ Transform: ZodMiniTransform,
1547
+ },
1548
+ ...args
1549
+ ) as any;
1550
+
1551
+ // json
1552
+
1553
+ // json
1554
+ type _ZodMiniJSONSchema = ZodMiniUnion<
1555
+ [
1556
+ ZodMiniString,
1557
+ ZodMiniNumber,
1558
+ ZodMiniBoolean,
1559
+ ZodMiniNull,
1560
+ ZodMiniArray<ZodMiniJSONSchema>,
1561
+ ZodMiniRecord<ZodMiniString<string>, ZodMiniJSONSchema>,
1562
+ ]
1563
+ >;
1564
+ type _ZodMiniJSONSchemaInternals = _ZodMiniJSONSchema["_zod"];
1565
+
1566
+ export interface ZodMiniJSONSchemaInternals extends _ZodMiniJSONSchemaInternals {
1567
+ output: util.JSONType;
1568
+ input: util.JSONType;
1569
+ }
1570
+ export interface ZodMiniJSONSchema extends _ZodMiniJSONSchema {
1571
+ _zod: ZodMiniJSONSchemaInternals;
1572
+ }
1573
+
1574
+ export function json(): ZodMiniJSONSchema {
1575
+ const jsonSchema: any = _lazy(() => {
1576
+ return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
1577
+ });
1578
+ return jsonSchema;
1579
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/assignability.test.ts ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { test } from "vitest";
2
+
3
+ import * as z from "zod/v4-mini";
4
+
5
+ test("assignability", () => {
6
+ // $ZodString
7
+ z.string() satisfies z.core.$ZodString;
8
+
9
+ // $ZodNumber
10
+ z.number() satisfies z.core.$ZodNumber;
11
+
12
+ // $ZodBigInt
13
+ z.bigint() satisfies z.core.$ZodBigInt;
14
+
15
+ // $ZodBoolean
16
+ z.boolean() satisfies z.core.$ZodBoolean;
17
+
18
+ // $ZodDate
19
+ z.date() satisfies z.core.$ZodDate;
20
+
21
+ // $ZodSymbol
22
+ z.symbol() satisfies z.core.$ZodSymbol;
23
+
24
+ // $ZodUndefined
25
+ z.undefined() satisfies z.core.$ZodUndefined;
26
+
27
+ // $ZodNullable
28
+ z.nullable(z.string()) satisfies z.core.$ZodNullable;
29
+
30
+ // $ZodNull
31
+ z.null() satisfies z.core.$ZodNull;
32
+
33
+ // $ZodAny
34
+ z.any() satisfies z.core.$ZodAny;
35
+
36
+ // $ZodUnknown
37
+ z.unknown() satisfies z.core.$ZodUnknown;
38
+
39
+ // $ZodNever
40
+ z.never() satisfies z.core.$ZodNever;
41
+
42
+ // $ZodVoid
43
+ z.void() satisfies z.core.$ZodVoid;
44
+
45
+ // $ZodArray
46
+ z.array(z.string()) satisfies z.core.$ZodArray;
47
+
48
+ // $ZodObject
49
+ z.object({ key: z.string() }) satisfies z.core.$ZodObject;
50
+
51
+ // $ZodUnion
52
+ z.union([z.string(), z.number()]) satisfies z.core.$ZodUnion;
53
+
54
+ // $ZodIntersection
55
+ z.intersection(z.string(), z.number()) satisfies z.core.$ZodIntersection;
56
+
57
+ // $ZodTuple
58
+ z.tuple([z.string(), z.number()]) satisfies z.core.$ZodTuple;
59
+
60
+ // $ZodRecord
61
+ z.record(z.string(), z.number()) satisfies z.core.$ZodRecord;
62
+
63
+ // $ZodMap
64
+ z.map(z.string(), z.number()) satisfies z.core.$ZodMap;
65
+
66
+ // $ZodSet
67
+ z.set(z.string()) satisfies z.core.$ZodSet;
68
+
69
+ // $ZodLiteral
70
+ z.literal("example") satisfies z.core.$ZodLiteral;
71
+
72
+ // $ZodEnum
73
+ z.enum(["a", "b", "c"]) satisfies z.core.$ZodEnum;
74
+
75
+ // $ZodPromise
76
+ z.promise(z.string()) satisfies z.core.$ZodPromise;
77
+
78
+ // $ZodLazy
79
+ const lazySchema = z.lazy(() => z.string());
80
+ lazySchema satisfies z.core.$ZodLazy;
81
+
82
+ // $ZodOptional
83
+ z.optional(z.string()) satisfies z.core.$ZodOptional;
84
+
85
+ // $ZodDefault
86
+ z._default(z.string(), "default") satisfies z.core.$ZodDefault;
87
+
88
+ // $ZodTemplateLiteral
89
+ z.templateLiteral([z.literal("a"), z.literal("b")]) satisfies z.core.$ZodTemplateLiteral;
90
+
91
+ // $ZodCustom
92
+ z.custom<string>((val) => typeof val === "string") satisfies z.core.$ZodCustom;
93
+
94
+ // $ZodTransform
95
+ z.transform((val) => val as string) satisfies z.core.$ZodTransform;
96
+
97
+ // $ZodNonOptional
98
+ z.nonoptional(z.optional(z.string())) satisfies z.core.$ZodNonOptional;
99
+
100
+ // $ZodReadonly
101
+ z.readonly(z.object({ key: z.string() })) satisfies z.core.$ZodReadonly;
102
+
103
+ // $ZodNaN
104
+ z.nan() satisfies z.core.$ZodNaN;
105
+
106
+ // $ZodPipe
107
+ z.pipe(z.unknown(), z.number()) satisfies z.core.$ZodPipe;
108
+
109
+ // $ZodSuccess
110
+ z.success(z.string()) satisfies z.core.$ZodSuccess;
111
+
112
+ // $ZodCatch
113
+ z.catch(z.string(), "fallback") satisfies z.core.$ZodCatch;
114
+
115
+ // $ZodFile
116
+ z.file() satisfies z.core.$ZodFile;
117
+ });
118
+
119
+ test("assignability with type narrowing", () => {
120
+ type _RefinedSchema<T extends z.ZodMiniType<object> | z.ZodMiniUnion> = T extends z.ZodMiniUnion
121
+ ? RefinedUnionSchema<T> // <-- Type instantiation is excessively deep and possibly infinite.
122
+ : T extends z.ZodMiniType<object>
123
+ ? RefinedTypeSchema<z.output<T>> // <-- Type instantiation is excessively deep and possibly infinite.
124
+ : never;
125
+
126
+ type RefinedTypeSchema<T extends object> = T;
127
+
128
+ type RefinedUnionSchema<T extends z.ZodMiniUnion> = T;
129
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/brand.test.ts ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expectTypeOf, test } from "vitest";
2
+ import * as z from "../index.js";
3
+
4
+ test("branded types", () => {
5
+ const mySchema = z
6
+ .object({
7
+ name: z.string(),
8
+ })
9
+ .brand<"superschema">();
10
+
11
+ // simple branding
12
+ type MySchema = z.infer<typeof mySchema>;
13
+ // Using true for type equality assertion
14
+ expectTypeOf<MySchema>().toEqualTypeOf<{ name: string } & z.$brand<"superschema">>();
15
+
16
+ const doStuff = (arg: MySchema) => arg;
17
+ doStuff(z.parse(mySchema, { name: "hello there" }));
18
+
19
+ // inheritance
20
+ const extendedSchema = mySchema.brand<"subschema">();
21
+ type ExtendedSchema = z.infer<typeof extendedSchema>;
22
+ expectTypeOf<ExtendedSchema>().toEqualTypeOf<{ name: string } & z.$brand<"superschema"> & z.$brand<"subschema">>();
23
+
24
+ doStuff(z.parse(extendedSchema, { name: "hello again" }));
25
+
26
+ // number branding
27
+ const numberSchema = z.number().brand<42>();
28
+ type NumberSchema = z.infer<typeof numberSchema>;
29
+ expectTypeOf<NumberSchema>().toEqualTypeOf<number & { [z.$brand]: { 42: true } }>();
30
+
31
+ // symbol branding
32
+ const MyBrand: unique symbol = Symbol("hello");
33
+ type MyBrand = typeof MyBrand;
34
+ const symbolBrand = z.number().brand<"sup">().brand<typeof MyBrand>();
35
+ type SymbolBrand = z.infer<typeof symbolBrand>;
36
+ // number & { [z.$brand]: { sup: true, [MyBrand]: true } }
37
+ expectTypeOf<SymbolBrand>().toEqualTypeOf<number & z.$brand<"sup"> & z.$brand<MyBrand>>();
38
+
39
+ // keeping brands out of input types
40
+ const age = z.number().brand<"age">();
41
+ type Age1 = z.infer<typeof age>;
42
+ type AgeInput1 = z.input<typeof age>;
43
+
44
+ // Using not for type inequality assertion
45
+ expectTypeOf<AgeInput1>().not.toEqualTypeOf<Age1>();
46
+ expectTypeOf<number>().toEqualTypeOf<AgeInput1>();
47
+ expectTypeOf<number & z.$brand<"age">>().toEqualTypeOf<Age1>();
48
+
49
+ // @ts-expect-error
50
+ doStuff({ name: "hello there!" });
51
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/checks.test.ts ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, test } from "vitest";
2
+ import * as z from "../index.js";
3
+
4
+ // lt;
5
+ test("z.lt", () => {
6
+ const a = z.number().check(z.lt(10));
7
+ expect(z.safeParse(a, 9).success).toEqual(true);
8
+ expect(z.safeParse(a, 9).data).toEqual(9);
9
+ expect(z.safeParse(a, 10).success).toEqual(false);
10
+ });
11
+
12
+ // lte;
13
+ test("z.lte", () => {
14
+ const a = z.number().check(z.lte(10));
15
+ expect(z.safeParse(a, 10).success).toEqual(true);
16
+ expect(z.safeParse(a, 10).data).toEqual(10);
17
+ expect(z.safeParse(a, 11).success).toEqual(false);
18
+ });
19
+
20
+ // min;
21
+ test("z.max", () => {
22
+ const a = z.number().check(z.maximum(10));
23
+ expect(z.safeParse(a, 10).success).toEqual(true);
24
+ expect(z.safeParse(a, 10).data).toEqual(10);
25
+ expect(z.safeParse(a, 11).success).toEqual(false);
26
+ });
27
+
28
+ // gt;
29
+ test("z.gt", () => {
30
+ const a = z.number().check(z.gt(10));
31
+ expect(z.safeParse(a, 11).success).toEqual(true);
32
+ expect(z.safeParse(a, 11).data).toEqual(11);
33
+ expect(z.safeParse(a, 10).success).toEqual(false);
34
+ });
35
+
36
+ // gte;
37
+ test("z.gte", () => {
38
+ const a = z.number().check(z.gte(10));
39
+ expect(z.safeParse(a, 10).success).toEqual(true);
40
+ expect(z.safeParse(a, 10).data).toEqual(10);
41
+ expect(z.safeParse(a, 9).success).toEqual(false);
42
+ });
43
+
44
+ // min;
45
+ test("z.min", () => {
46
+ const a = z.number().check(z.minimum(10));
47
+ expect(z.safeParse(a, 10).success).toEqual(true);
48
+ expect(z.safeParse(a, 10).data).toEqual(10);
49
+ expect(z.safeParse(a, 9).success).toEqual(false);
50
+ });
51
+
52
+ // maxSize;
53
+ test("z.maxLength", () => {
54
+ const a = z.array(z.string()).check(z.maxLength(3));
55
+ expect(z.safeParse(a, ["a", "b", "c"]).success).toEqual(true);
56
+ expect(z.safeParse(a, ["a", "b", "c", "d"]).success).toEqual(false);
57
+ });
58
+
59
+ // minSize;
60
+ test("z.minLength", () => {
61
+ const a = z.array(z.string()).check(z.minLength(3));
62
+ expect(z.safeParse(a, ["a", "b"]).success).toEqual(false);
63
+ expect(z.safeParse(a, ["a", "b", "c"]).success).toEqual(true);
64
+ });
65
+
66
+ // size;
67
+ test("z.length", () => {
68
+ const a = z.array(z.string()).check(z.length(3));
69
+ expect(z.safeParse(a, ["a", "b"]).success).toEqual(false);
70
+ expect(z.safeParse(a, ["a", "b", "c"]).success).toEqual(true);
71
+ expect(z.safeParse(a, ["a", "b", "c", "d"]).success).toEqual(false);
72
+ });
73
+
74
+ // regex;
75
+ test("z.regex", () => {
76
+ const a = z.string().check(z.regex(/^aaa$/));
77
+ expect(z.safeParse(a, "aaa")).toMatchObject({ success: true, data: "aaa" });
78
+ expect(z.safeParse(a, "aa")).toMatchObject({ success: false });
79
+ });
80
+
81
+ // includes;
82
+ test("z.includes", () => {
83
+ const a = z.string().check(z.includes("asdf"));
84
+ z.parse(a, "qqqasdfqqq");
85
+ z.parse(a, "asdf");
86
+ z.parse(a, "qqqasdf");
87
+ z.parse(a, "asdfqqq");
88
+ expect(z.safeParse(a, "qqq")).toMatchObject({ success: false });
89
+ });
90
+
91
+ // startsWith;
92
+ test("z.startsWith", () => {
93
+ const a = z.string().check(z.startsWith("asdf"));
94
+ z.parse(a, "asdf");
95
+ z.parse(a, "asdfqqq");
96
+ expect(z.safeParse(a, "qqq")).toMatchObject({ success: false });
97
+ });
98
+
99
+ // endsWith;
100
+ test("z.endsWith", () => {
101
+ const a = z.string().check(z.endsWith("asdf"));
102
+ z.parse(a, "asdf");
103
+ z.parse(a, "qqqasdf");
104
+ expect(z.safeParse(a, "asdfqqq")).toMatchObject({ success: false });
105
+ });
106
+
107
+ // lowercase;
108
+ test("z.lowercase", () => {
109
+ const a = z.string().check(z.lowercase());
110
+ z.parse(a, "asdf");
111
+ expect(z.safeParse(a, "ASDF")).toMatchObject({ success: false });
112
+ });
113
+
114
+ // uppercase;
115
+ test("z.uppercase", () => {
116
+ const a = z.string().check(z.uppercase());
117
+ z.parse(a, "ASDF");
118
+ expect(z.safeParse(a, "asdf")).toMatchObject({ success: false });
119
+ });
120
+
121
+ // filename;
122
+ // fileType;
123
+ // overwrite;
124
+ test("z.overwrite", () => {
125
+ const a = z.string().check(z.overwrite((val) => val.toUpperCase()));
126
+ expect(z.safeParse(a, "asdf")).toMatchObject({ data: "ASDF" });
127
+ });
128
+
129
+ // normalize;
130
+ // trim;
131
+ // toLowerCase;
132
+ // toUpperCase;
133
+ // property
134
+
135
+ test("abort early", () => {
136
+ const schema = z.string().check(
137
+ z.refine((val) => val.length > 1),
138
+ z.refine((val) => val.length > 2, { abort: true }),
139
+ z.refine((val) => val.length > 3)
140
+ );
141
+ const data = "";
142
+ const result = z.safeParse(schema, data);
143
+ expect(result.error!.issues.length).toEqual(2);
144
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/computed.test.ts ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, test } from "vitest";
2
+ import * as z from "zod/v4-mini";
3
+ import { util as zc } from "zod/v4/core";
4
+
5
+ test("min/max", () => {
6
+ const a = z.number().check(z.minimum(5), z.minimum(6), z.minimum(7), z.maximum(10), z.maximum(11), z.maximum(12));
7
+
8
+ expect(a._zod.bag.minimum).toEqual(7);
9
+ expect(a._zod.bag.maximum).toEqual(10);
10
+ });
11
+
12
+ test("multipleOf", () => {
13
+ const b = z.number().check(z.multipleOf(5));
14
+ expect(b._zod.bag.multipleOf).toEqual(5);
15
+ });
16
+
17
+ test("int64 format", () => {
18
+ const c = z.int64();
19
+ expect(c._zod.bag.format).toEqual("int64");
20
+ expect(c._zod.bag.minimum).toEqual(zc.BIGINT_FORMAT_RANGES.int64[0]);
21
+ expect(c._zod.bag.maximum).toEqual(zc.BIGINT_FORMAT_RANGES.int64[1]);
22
+ });
23
+
24
+ test("int32 format", () => {
25
+ const d = z.int32();
26
+ expect(d._zod.bag.format).toEqual("int32");
27
+ expect(d._zod.bag.minimum).toEqual(zc.NUMBER_FORMAT_RANGES.int32[0]);
28
+ expect(d._zod.bag.maximum).toEqual(zc.NUMBER_FORMAT_RANGES.int32[1]);
29
+ });
30
+
31
+ test("array size", () => {
32
+ const e = z.array(z.string()).check(z.length(5));
33
+ expect(e._zod.bag.length).toEqual(5);
34
+ expect(e._zod.bag.minimum).toEqual(5);
35
+ expect(e._zod.bag.maximum).toEqual(5);
36
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/error.test.ts ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, test } from "vitest";
2
+ import * as z from "zod/v4-mini";
3
+
4
+ test("no locale by default", () => {
5
+ const result = z.safeParse(z.string(), 12);
6
+ expect(result.success).toEqual(false);
7
+ expect(result.error!.issues.length).toEqual(1);
8
+ expect(result.error!.issues[0].message).toEqual("Invalid input");
9
+ });
10
+
11
+ test("error inheritance", () => {
12
+ const e1 = z.string().safeParse(123).error!;
13
+ expect(e1).toBeInstanceOf(z.core.$ZodError);
14
+ // expect(e1).not.toBeInstanceOf(Error);
15
+
16
+ try {
17
+ z.string().parse(123);
18
+ } catch (e2) {
19
+ expect(e2).toBeInstanceOf(z.core.$ZodRealError);
20
+ expect(e2).toBeInstanceOf(Error);
21
+ }
22
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/functions.test.ts ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, test } from "vitest";
2
+ // import * as z from "zod/v4/core";
3
+
4
+ test("z.function", () => {
5
+ expect(true).toEqual(true);
6
+ });
7
+
8
+ // test("z.function", () => {
9
+ // const a = z.function({
10
+ // args: z.tuple([z.string()]),
11
+ // returns: z.string(),
12
+ // });
13
+
14
+ // const myFunc = a.implement((name: string | number) => `Hello, ${name}!`);
15
+
16
+ // expect(myFunc("world")).toEqual("Hello, world!");
17
+ // expect(() => myFunc(123 as any)).toThrow();
18
+
19
+ // // this won't run
20
+ // () => {
21
+ // // @ts-expect-error
22
+ // const r = myFunc(123);
23
+ // expectTypeOf(r).toEqualTypeOf<string>();
24
+ // };
25
+ // });
26
+
27
+ // test("z.function async", async () => {
28
+ // const b = z.function({
29
+ // args: z.tuple([z.string()]).$check(async (_) => {}),
30
+ // returns: z.string().$check(async (_) => {}),
31
+ // });
32
+ // const myFuncAsync = b.implementAsync(async (name) => `Hello, ${name}!`);
33
+
34
+ // expect(await myFuncAsync("world")).toEqual("Hello, world!");
35
+ // expect(myFuncAsync(123 as any)).rejects.toThrow();
36
+
37
+ // // this won't run
38
+ // () => {
39
+ // // @ts-expect-error
40
+ // const r = myFuncAsync(123);
41
+ // expectTypeOf(r).toEqualTypeOf<Promise<string>>();
42
+ // };
43
+ // });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/index.test.ts ADDED
@@ -0,0 +1,871 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, expectTypeOf, test } from "vitest";
2
+ import * as z from "zod/v4-mini";
3
+ import type { util } from "zod/v4/core";
4
+
5
+ test("z.boolean", () => {
6
+ const a = z.boolean();
7
+ expect(z.parse(a, true)).toEqual(true);
8
+ expect(z.parse(a, false)).toEqual(false);
9
+ expect(() => z.parse(a, 123)).toThrow();
10
+ expect(() => z.parse(a, "true")).toThrow();
11
+ type a = z.output<typeof a>;
12
+ expectTypeOf<a>().toEqualTypeOf<boolean>();
13
+ });
14
+
15
+ test("z.bigint", () => {
16
+ const a = z.bigint();
17
+ expect(z.parse(a, BigInt(123))).toEqual(BigInt(123));
18
+ expect(() => z.parse(a, 123)).toThrow();
19
+ expect(() => z.parse(a, "123")).toThrow();
20
+ });
21
+
22
+ test("z.symbol", () => {
23
+ const a = z.symbol();
24
+ const sym = Symbol();
25
+ expect(z.parse(a, sym)).toEqual(sym);
26
+ expect(() => z.parse(a, "symbol")).toThrow();
27
+ });
28
+
29
+ test("z.date", () => {
30
+ const a = z.date();
31
+ const date = new Date();
32
+ expect(z.parse(a, date)).toEqual(date);
33
+ expect(() => z.parse(a, "date")).toThrow();
34
+ });
35
+
36
+ test("z.coerce.string", () => {
37
+ const a = z.coerce.string();
38
+ expect(z.parse(a, 123)).toEqual("123");
39
+ expect(z.parse(a, true)).toEqual("true");
40
+ expect(z.parse(a, null)).toEqual("null");
41
+ expect(z.parse(a, undefined)).toEqual("undefined");
42
+ });
43
+
44
+ test("z.coerce.number", () => {
45
+ const a = z.coerce.number();
46
+ expect(z.parse(a, "123")).toEqual(123);
47
+ expect(z.parse(a, "123.45")).toEqual(123.45);
48
+ expect(z.parse(a, true)).toEqual(1);
49
+ expect(z.parse(a, false)).toEqual(0);
50
+ expect(() => z.parse(a, "abc")).toThrow();
51
+ });
52
+
53
+ test("z.coerce.boolean", () => {
54
+ const a = z.coerce.boolean();
55
+ // test booleans
56
+ expect(z.parse(a, true)).toEqual(true);
57
+ expect(z.parse(a, false)).toEqual(false);
58
+ expect(z.parse(a, "true")).toEqual(true);
59
+ expect(z.parse(a, "false")).toEqual(true);
60
+ expect(z.parse(a, 1)).toEqual(true);
61
+ expect(z.parse(a, 0)).toEqual(false);
62
+ expect(z.parse(a, {})).toEqual(true);
63
+ expect(z.parse(a, [])).toEqual(true);
64
+ expect(z.parse(a, undefined)).toEqual(false);
65
+ expect(z.parse(a, null)).toEqual(false);
66
+ expect(z.parse(a, "")).toEqual(false);
67
+ });
68
+
69
+ test("z.coerce.bigint", () => {
70
+ const a = z.coerce.bigint();
71
+ expect(z.parse(a, "123")).toEqual(BigInt(123));
72
+ expect(z.parse(a, 123)).toEqual(BigInt(123));
73
+ expect(() => z.parse(a, "abc")).toThrow();
74
+ });
75
+
76
+ test("z.coerce.date", () => {
77
+ const a = z.coerce.date();
78
+ const date = new Date();
79
+ expect(z.parse(a, date.toISOString())).toEqual(date);
80
+ expect(z.parse(a, date.getTime())).toEqual(date);
81
+ expect(() => z.parse(a, "invalid date")).toThrow();
82
+ });
83
+
84
+ test("z.iso.datetime", () => {
85
+ const d1 = "2021-01-01T00:00:00Z";
86
+ const d2 = "2021-01-01T00:00:00.123Z";
87
+ const d3 = "2021-01-01T00:00:00";
88
+ const d4 = "2021-01-01T00:00:00+07:00";
89
+ const d5 = "bad data";
90
+
91
+ // local: false, offset: false, precision: null
92
+ const a = z.iso.datetime();
93
+ expect(z.safeParse(a, d1).success).toEqual(true);
94
+ expect(z.safeParse(a, d2).success).toEqual(true);
95
+ expect(z.safeParse(a, d3).success).toEqual(false);
96
+ expect(z.safeParse(a, d4).success).toEqual(false);
97
+ expect(z.safeParse(a, d5).success).toEqual(false);
98
+
99
+ const b = z.iso.datetime({ local: true });
100
+ expect(z.safeParse(b, d1).success).toEqual(true);
101
+ expect(z.safeParse(b, d2).success).toEqual(true);
102
+ expect(z.safeParse(b, d3).success).toEqual(true);
103
+ expect(z.safeParse(b, d4).success).toEqual(false);
104
+ expect(z.safeParse(b, d5).success).toEqual(false);
105
+
106
+ const c = z.iso.datetime({ offset: true });
107
+ expect(z.safeParse(c, d1).success).toEqual(true);
108
+ expect(z.safeParse(c, d2).success).toEqual(true);
109
+ expect(z.safeParse(c, d3).success).toEqual(false);
110
+ expect(z.safeParse(c, d4).success).toEqual(true);
111
+ expect(z.safeParse(c, d5).success).toEqual(false);
112
+
113
+ const d = z.iso.datetime({ precision: 3 });
114
+ expect(z.safeParse(d, d1).success).toEqual(false);
115
+ expect(z.safeParse(d, d2).success).toEqual(true);
116
+ expect(z.safeParse(d, d3).success).toEqual(false);
117
+ expect(z.safeParse(d, d4).success).toEqual(false);
118
+ expect(z.safeParse(d, d5).success).toEqual(false);
119
+ });
120
+
121
+ test("z.iso.date", () => {
122
+ const d1 = "2021-01-01";
123
+ const d2 = "bad data";
124
+
125
+ const a = z.iso.date();
126
+ expect(z.safeParse(a, d1).success).toEqual(true);
127
+ expect(z.safeParse(a, d2).success).toEqual(false);
128
+
129
+ const b = z.string().check(z.iso.date());
130
+ expect(z.safeParse(b, d1).success).toEqual(true);
131
+ expect(z.safeParse(b, d2).success).toEqual(false);
132
+ });
133
+
134
+ test("z.iso.time", () => {
135
+ const d1 = "00:00:00";
136
+ const d2 = "00:00:00.123";
137
+ const d3 = "bad data";
138
+
139
+ const a = z.iso.time();
140
+ expect(z.safeParse(a, d1).success).toEqual(true);
141
+ expect(z.safeParse(a, d2).success).toEqual(true);
142
+ expect(z.safeParse(a, d3).success).toEqual(false);
143
+
144
+ const b = z.iso.time({ precision: 3 });
145
+ expect(z.safeParse(b, d1).success).toEqual(false);
146
+ expect(z.safeParse(b, d2).success).toEqual(true);
147
+ expect(z.safeParse(b, d3).success).toEqual(false);
148
+
149
+ const c = z.string().check(z.iso.time());
150
+ expect(z.safeParse(c, d1).success).toEqual(true);
151
+ expect(z.safeParse(c, d2).success).toEqual(true);
152
+ expect(z.safeParse(c, d3).success).toEqual(false);
153
+ });
154
+
155
+ test("z.iso.duration", () => {
156
+ const d1 = "P3Y6M4DT12H30M5S";
157
+ const d2 = "bad data";
158
+
159
+ const a = z.iso.duration();
160
+ expect(z.safeParse(a, d1).success).toEqual(true);
161
+ expect(z.safeParse(a, d2).success).toEqual(false);
162
+
163
+ const b = z.string().check(z.iso.duration());
164
+ expect(z.safeParse(b, d1).success).toEqual(true);
165
+ expect(z.safeParse(b, d2).success).toEqual(false);
166
+ });
167
+
168
+ test("z.undefined", () => {
169
+ const a = z.undefined();
170
+ expect(z.parse(a, undefined)).toEqual(undefined);
171
+ expect(() => z.parse(a, "undefined")).toThrow();
172
+ });
173
+
174
+ test("z.null", () => {
175
+ const a = z.null();
176
+ expect(z.parse(a, null)).toEqual(null);
177
+ expect(() => z.parse(a, "null")).toThrow();
178
+ });
179
+
180
+ test("z.any", () => {
181
+ const a = z.any();
182
+ expect(z.parse(a, "hello")).toEqual("hello");
183
+ expect(z.parse(a, 123)).toEqual(123);
184
+ expect(z.parse(a, true)).toEqual(true);
185
+ expect(z.parse(a, null)).toEqual(null);
186
+ expect(z.parse(a, undefined)).toEqual(undefined);
187
+ z.parse(a, {});
188
+ z.parse(a, []);
189
+ z.parse(a, Symbol());
190
+ z.parse(a, new Date());
191
+ });
192
+
193
+ test("z.unknown", () => {
194
+ const a = z.unknown();
195
+ expect(z.parse(a, "hello")).toEqual("hello");
196
+ expect(z.parse(a, 123)).toEqual(123);
197
+ expect(z.parse(a, true)).toEqual(true);
198
+ expect(z.parse(a, null)).toEqual(null);
199
+ expect(z.parse(a, undefined)).toEqual(undefined);
200
+ z.parse(a, {});
201
+ z.parse(a, []);
202
+ z.parse(a, Symbol());
203
+ z.parse(a, new Date());
204
+ });
205
+
206
+ test("z.never", () => {
207
+ const a = z.never();
208
+ expect(() => z.parse(a, "hello")).toThrow();
209
+ });
210
+
211
+ test("z.void", () => {
212
+ const a = z.void();
213
+ expect(z.parse(a, undefined)).toEqual(undefined);
214
+ expect(() => z.parse(a, null)).toThrow();
215
+ });
216
+
217
+ test("z.array", () => {
218
+ const a = z.array(z.string());
219
+ expect(z.parse(a, ["hello", "world"])).toEqual(["hello", "world"]);
220
+ expect(() => z.parse(a, [123])).toThrow();
221
+ expect(() => z.parse(a, "hello")).toThrow();
222
+ });
223
+
224
+ test("z.union", () => {
225
+ const a = z.union([z.string(), z.number()]);
226
+ expect(z.parse(a, "hello")).toEqual("hello");
227
+ expect(z.parse(a, 123)).toEqual(123);
228
+ expect(() => z.parse(a, true)).toThrow();
229
+ });
230
+
231
+ test("z.intersection", () => {
232
+ const a = z.intersection(z.object({ a: z.string() }), z.object({ b: z.number() }));
233
+ expect(z.parse(a, { a: "hello", b: 123 })).toEqual({ a: "hello", b: 123 });
234
+ expect(() => z.parse(a, { a: "hello" })).toThrow();
235
+ expect(() => z.parse(a, { b: 123 })).toThrow();
236
+ expect(() => z.parse(a, "hello")).toThrow();
237
+ });
238
+
239
+ test("z.tuple", () => {
240
+ const a = z.tuple([z.string(), z.number()]);
241
+ expect(z.parse(a, ["hello", 123])).toEqual(["hello", 123]);
242
+ expect(() => z.parse(a, ["hello", "world"])).toThrow();
243
+ expect(() => z.parse(a, [123, 456])).toThrow();
244
+ expect(() => z.parse(a, "hello")).toThrow();
245
+
246
+ // tuple with rest
247
+ const b = z.tuple([z.string(), z.number(), z.optional(z.string())], z.boolean());
248
+ type b = z.output<typeof b>;
249
+
250
+ expectTypeOf<b>().toEqualTypeOf<[string, number, string?, ...boolean[]]>();
251
+ const datas = [
252
+ ["hello", 123],
253
+ ["hello", 123, "world"],
254
+ ["hello", 123, "world", true],
255
+ ["hello", 123, "world", true, false, true],
256
+ ];
257
+ for (const data of datas) {
258
+ expect(z.parse(b, data)).toEqual(data);
259
+ }
260
+
261
+ expect(() => z.parse(b, ["hello", 123, 123])).toThrow();
262
+ expect(() => z.parse(b, ["hello", 123, "world", 123])).toThrow();
263
+
264
+ // tuple with readonly args
265
+ const cArgs = [z.string(), z.number(), z.optional(z.string())] as const;
266
+ const c = z.tuple(cArgs, z.boolean());
267
+ type c = z.output<typeof c>;
268
+ expectTypeOf<c>().toEqualTypeOf<[string, number, string?, ...boolean[]]>();
269
+ });
270
+
271
+ test("z.record", () => {
272
+ // record schema with enum keys
273
+ const a = z.record(z.string(), z.string());
274
+ type a = z.output<typeof a>;
275
+ expectTypeOf<a>().toEqualTypeOf<Record<string, string>>();
276
+
277
+ const b = z.record(z.union([z.string(), z.number(), z.symbol()]), z.string());
278
+ type b = z.output<typeof b>;
279
+ expectTypeOf<b>().toEqualTypeOf<Record<string | number | symbol, string>>();
280
+ expect(z.parse(b, { a: "hello", 1: "world", [Symbol.for("asdf")]: "symbol" })).toEqual({
281
+ a: "hello",
282
+ 1: "world",
283
+ [Symbol.for("asdf")]: "symbol",
284
+ });
285
+
286
+ // enum keys
287
+ const c = z.record(z.enum(["a", "b", "c"]), z.string());
288
+ type c = z.output<typeof c>;
289
+ expectTypeOf<c>().toEqualTypeOf<Record<"a" | "b" | "c", string>>();
290
+ expect(z.parse(c, { a: "hello", b: "world", c: "world" })).toEqual({
291
+ a: "hello",
292
+ b: "world",
293
+ c: "world",
294
+ });
295
+ // missing keys
296
+ expect(() => z.parse(c, { a: "hello", b: "world" })).toThrow();
297
+ // extra keys
298
+ expect(() => z.parse(c, { a: "hello", b: "world", c: "world", d: "world" })).toThrow();
299
+ });
300
+
301
+ test("z.map", () => {
302
+ const a = z.map(z.string(), z.number());
303
+ type a = z.output<typeof a>;
304
+ expectTypeOf<a>().toEqualTypeOf<Map<string, number>>();
305
+ expect(z.parse(a, new Map([["hello", 123]]))).toEqual(new Map([["hello", 123]]));
306
+ expect(() => z.parse(a, new Map([["hello", "world"]]))).toThrow();
307
+ expect(() => z.parse(a, new Map([[1243, "world"]]))).toThrow();
308
+ expect(() => z.parse(a, "hello")).toThrow();
309
+
310
+ const r1 = z.safeParse(a, new Map([[123, 123]]));
311
+ expect(r1.error?.issues[0].code).toEqual("invalid_type");
312
+ expect(r1.error?.issues[0].path).toEqual([123]);
313
+
314
+ const r2: any = z.safeParse(a, new Map([[BigInt(123), 123]]));
315
+ expect(r2.error!.issues[0].code).toEqual("invalid_key");
316
+ expect(r2.error!.issues[0].path).toEqual([]);
317
+
318
+ const r3: any = z.safeParse(a, new Map([["hello", "world"]]));
319
+ expect(r3.error!.issues[0].code).toEqual("invalid_type");
320
+ expect(r3.error!.issues[0].path).toEqual(["hello"]);
321
+ });
322
+
323
+ test("z.map invalid_element", () => {
324
+ const a = z.map(z.bigint(), z.number());
325
+ const r1 = z.safeParse(a, new Map([[BigInt(123), BigInt(123)]]));
326
+
327
+ expect(r1.error!.issues[0].code).toEqual("invalid_element");
328
+ expect(r1.error!.issues[0].path).toEqual([]);
329
+ });
330
+
331
+ test("z.map async", async () => {
332
+ const a = z.map(z.string().check(z.refine(async () => true)), z.number().check(z.refine(async () => true)));
333
+ const d1 = new Map([["hello", 123]]);
334
+ expect(await z.parseAsync(a, d1)).toEqual(d1);
335
+
336
+ await expect(z.parseAsync(a, new Map([[123, 123]]))).rejects.toThrow();
337
+ await expect(z.parseAsync(a, new Map([["hi", "world"]]))).rejects.toThrow();
338
+ await expect(z.parseAsync(a, new Map([[1243, "world"]]))).rejects.toThrow();
339
+ await expect(z.parseAsync(a, "hello")).rejects.toThrow();
340
+
341
+ const r = await z.safeParseAsync(a, new Map([[123, 123]]));
342
+ expect(r.success).toEqual(false);
343
+ expect(r.error!.issues[0].code).toEqual("invalid_type");
344
+ expect(r.error!.issues[0].path).toEqual([123]);
345
+ });
346
+
347
+ test("z.set", () => {
348
+ const a = z.set(z.string());
349
+ type a = z.output<typeof a>;
350
+ expectTypeOf<a>().toEqualTypeOf<Set<string>>();
351
+ expect(z.parse(a, new Set(["hello", "world"]))).toEqual(new Set(["hello", "world"]));
352
+ expect(() => z.parse(a, new Set([123]))).toThrow();
353
+ expect(() => z.parse(a, ["hello", "world"])).toThrow();
354
+ expect(() => z.parse(a, "hello")).toThrow();
355
+
356
+ const b = z.set(z.number());
357
+ expect(z.parse(b, new Set([1, 2, 3]))).toEqual(new Set([1, 2, 3]));
358
+ expect(() => z.parse(b, new Set(["hello"]))).toThrow();
359
+ expect(() => z.parse(b, [1, 2, 3])).toThrow();
360
+ expect(() => z.parse(b, 123)).toThrow();
361
+ });
362
+
363
+ test("z.enum", () => {
364
+ const a = z.enum(["A", "B", "C"]);
365
+ type a = z.output<typeof a>;
366
+ expectTypeOf<a>().toEqualTypeOf<"A" | "B" | "C">();
367
+ expect(z.parse(a, "A")).toEqual("A");
368
+ expect(z.parse(a, "B")).toEqual("B");
369
+ expect(z.parse(a, "C")).toEqual("C");
370
+ expect(() => z.parse(a, "D")).toThrow();
371
+ expect(() => z.parse(a, 123)).toThrow();
372
+
373
+ // expect(a.enum.A).toEqual("A");
374
+ // expect(a.enum.B).toEqual("B");
375
+ // expect(a.enum.C).toEqual("C");
376
+ // expect((a.enum as any).D).toEqual(undefined);
377
+ });
378
+
379
+ test("z.enum - native", () => {
380
+ enum NativeEnum {
381
+ A = "A",
382
+ B = "B",
383
+ C = "C",
384
+ }
385
+ const a = z.enum(NativeEnum);
386
+ type a = z.output<typeof a>;
387
+ expectTypeOf<a>().toEqualTypeOf<NativeEnum>();
388
+ expect(z.parse(a, NativeEnum.A)).toEqual(NativeEnum.A);
389
+ expect(z.parse(a, NativeEnum.B)).toEqual(NativeEnum.B);
390
+ expect(z.parse(a, NativeEnum.C)).toEqual(NativeEnum.C);
391
+ expect(() => z.parse(a, "D")).toThrow();
392
+ expect(() => z.parse(a, 123)).toThrow();
393
+
394
+ // test a.enum
395
+ a;
396
+ // expect(a.enum.A).toEqual(NativeEnum.A);
397
+ // expect(a.enum.B).toEqual(NativeEnum.B);
398
+ // expect(a.enum.C).toEqual(NativeEnum.C);
399
+ });
400
+
401
+ test("z.nativeEnum", () => {
402
+ enum NativeEnum {
403
+ A = "A",
404
+ B = "B",
405
+ C = "C",
406
+ }
407
+ const a = z.nativeEnum(NativeEnum);
408
+ type a = z.output<typeof a>;
409
+ expectTypeOf<a>().toEqualTypeOf<NativeEnum>();
410
+ expect(z.parse(a, NativeEnum.A)).toEqual(NativeEnum.A);
411
+ expect(z.parse(a, NativeEnum.B)).toEqual(NativeEnum.B);
412
+ expect(z.parse(a, NativeEnum.C)).toEqual(NativeEnum.C);
413
+ expect(() => z.parse(a, "D")).toThrow();
414
+ expect(() => z.parse(a, 123)).toThrow();
415
+
416
+ // test a.enum
417
+ a;
418
+ // expect(a.enum.A).toEqual(NativeEnum.A);
419
+ // expect(a.enum.B).toEqual(NativeEnum.B);
420
+ // expect(a.enum.C).toEqual(NativeEnum.C);
421
+ });
422
+
423
+ test("z.literal", () => {
424
+ const a = z.literal("hello");
425
+ type a = z.output<typeof a>;
426
+ expectTypeOf<a>().toEqualTypeOf<"hello">();
427
+ expect(z.parse(a, "hello")).toEqual("hello");
428
+ expect(() => z.parse(a, "world")).toThrow();
429
+ expect(() => z.parse(a, 123)).toThrow();
430
+
431
+ z.literal(["adf"] as const);
432
+ });
433
+
434
+ test("z.file", () => {
435
+ const a = z.file();
436
+ const file = new File(["content"], "filename.txt", { type: "text/plain" });
437
+ expect(z.parse(a, file)).toEqual(file);
438
+ expect(() => z.parse(a, "file")).toThrow();
439
+ expect(() => z.parse(a, 123)).toThrow();
440
+ });
441
+
442
+ test("z.transform", () => {
443
+ const a = z.pipe(
444
+ z.string(),
445
+ z.transform((val) => val.toUpperCase())
446
+ );
447
+ type a = z.output<typeof a>;
448
+ expectTypeOf<a>().toEqualTypeOf<string>();
449
+ expect(z.parse(a, "hello")).toEqual("HELLO");
450
+ expect(() => z.parse(a, 123)).toThrow();
451
+ });
452
+
453
+ test("z.transform async", async () => {
454
+ const a = z.pipe(
455
+ z.string(),
456
+ z.transform(async (val) => val.toUpperCase())
457
+ );
458
+ type a = z.output<typeof a>;
459
+ expectTypeOf<a>().toEqualTypeOf<string>();
460
+ expect(await z.parseAsync(a, "hello")).toEqual("HELLO");
461
+ await expect(() => z.parseAsync(a, 123)).rejects.toThrow();
462
+ });
463
+
464
+ test("z.preprocess", () => {
465
+ const a = z.pipe(
466
+ z.transform((val) => String(val).toUpperCase()),
467
+ z.string()
468
+ );
469
+ type a = z.output<typeof a>;
470
+ expectTypeOf<a>().toEqualTypeOf<string>();
471
+ expect(z.parse(a, 123)).toEqual("123");
472
+ expect(z.parse(a, true)).toEqual("TRUE");
473
+ expect(z.parse(a, BigInt(1234))).toEqual("1234");
474
+ // expect(() => z.parse(a, Symbol("asdf"))).toThrow();
475
+ });
476
+
477
+ // test("z.preprocess async", () => {
478
+ // const a = z.preprocess(async (val) => String(val), z.string());
479
+ // type a = z.output<typeof a>;
480
+ // expectTypeOf<a>().toEqualTypeOf<string>();
481
+ // expect(z.parse(a, 123)).toEqual("123");
482
+ // expect(z.parse(a, true)).toEqual("true");
483
+ // expect(() => z.parse(a, {})).toThrow();
484
+ // });
485
+
486
+ test("z.optional", () => {
487
+ const a = z.optional(z.string());
488
+ type a = z.output<typeof a>;
489
+ expectTypeOf<a>().toEqualTypeOf<string | undefined>();
490
+ expect(z.parse(a, "hello")).toEqual("hello");
491
+ expect(z.parse(a, undefined)).toEqual(undefined);
492
+ expect(() => z.parse(a, 123)).toThrow();
493
+ });
494
+
495
+ test("z.nullable", () => {
496
+ const a = z.nullable(z.string());
497
+ type a = z.output<typeof a>;
498
+ expectTypeOf<a>().toEqualTypeOf<string | null>();
499
+ expect(z.parse(a, "hello")).toEqual("hello");
500
+ expect(z.parse(a, null)).toEqual(null);
501
+ expect(() => z.parse(a, 123)).toThrow();
502
+ });
503
+
504
+ test("z.default", () => {
505
+ const a = z._default(z.string(), "default");
506
+ type a = z.output<typeof a>;
507
+ expectTypeOf<a>().toEqualTypeOf<string>();
508
+ expect(z.parse(a, undefined)).toEqual("default");
509
+ expect(z.parse(a, "hello")).toEqual("hello");
510
+ expect(() => z.parse(a, 123)).toThrow();
511
+
512
+ const b = z._default(z.string(), () => "default");
513
+ expect(z.parse(b, undefined)).toEqual("default");
514
+ expect(z.parse(b, "hello")).toEqual("hello");
515
+ expect(() => z.parse(b, 123)).toThrow();
516
+ });
517
+
518
+ test("z.catch", () => {
519
+ const a = z.catch(z.string(), "default");
520
+ type a = z.output<typeof a>;
521
+ expectTypeOf<a>().toEqualTypeOf<string>();
522
+ expect(z.parse(a, "hello")).toEqual("hello");
523
+ expect(z.parse(a, 123)).toEqual("default");
524
+
525
+ const b = z.catch(z.string(), () => "default");
526
+ expect(z.parse(b, "hello")).toEqual("hello");
527
+ expect(z.parse(b, 123)).toEqual("default");
528
+
529
+ const c = z.catch(z.string(), (ctx) => {
530
+ return `${ctx.error.issues.length}issues`;
531
+ });
532
+ expect(z.parse(c, 1234)).toEqual("1issues");
533
+ });
534
+
535
+ test("z.nan", () => {
536
+ const a = z.nan();
537
+ type a = z.output<typeof a>;
538
+ expectTypeOf<a>().toEqualTypeOf<number>();
539
+ expect(z.parse(a, Number.NaN)).toEqual(Number.NaN);
540
+ expect(() => z.parse(a, 123)).toThrow();
541
+ expect(() => z.parse(a, "NaN")).toThrow();
542
+ });
543
+
544
+ test("z.pipe", () => {
545
+ const a = z.pipe(
546
+ z.pipe(
547
+ z.string(),
548
+ z.transform((val) => val.length)
549
+ ),
550
+ z.number()
551
+ );
552
+ type a_in = z.input<typeof a>;
553
+ expectTypeOf<a_in>().toEqualTypeOf<string>();
554
+ type a_out = z.output<typeof a>;
555
+ expectTypeOf<a_out>().toEqualTypeOf<number>();
556
+
557
+ expect(z.parse(a, "123")).toEqual(3);
558
+ expect(z.parse(a, "hello")).toEqual(5);
559
+ expect(() => z.parse(a, 123)).toThrow();
560
+ });
561
+
562
+ test("z.readonly", () => {
563
+ const a = z.readonly(z.string());
564
+ type a = z.output<typeof a>;
565
+ expectTypeOf<a>().toEqualTypeOf<Readonly<string>>();
566
+ expect(z.parse(a, "hello")).toEqual("hello");
567
+ expect(() => z.parse(a, 123)).toThrow();
568
+ });
569
+
570
+ test("z.templateLiteral", () => {
571
+ const a = z.templateLiteral([z.string(), z.number()]);
572
+ type a = z.output<typeof a>;
573
+ expectTypeOf<a>().toEqualTypeOf<`${string}${number}`>();
574
+ expect(z.parse(a, "hello123")).toEqual("hello123");
575
+ expect(() => z.parse(a, "hello")).toThrow();
576
+ expect(() => z.parse(a, 123)).toThrow();
577
+
578
+ // multipart
579
+ const b = z.templateLiteral([z.string(), z.number(), z.string()]);
580
+ type b = z.output<typeof b>;
581
+ expectTypeOf<b>().toEqualTypeOf<`${string}${number}${string}`>();
582
+ expect(z.parse(b, "hello123world")).toEqual("hello123world");
583
+ expect(z.parse(b, "123")).toEqual("123");
584
+ expect(() => z.parse(b, "hello")).toThrow();
585
+ expect(() => z.parse(b, 123)).toThrow();
586
+
587
+ // include boolean
588
+ const c = z.templateLiteral([z.string(), z.boolean()]);
589
+ type c = z.output<typeof c>;
590
+ expectTypeOf<c>().toEqualTypeOf<`${string}${boolean}`>();
591
+ expect(z.parse(c, "hellotrue")).toEqual("hellotrue");
592
+ expect(z.parse(c, "hellofalse")).toEqual("hellofalse");
593
+ expect(() => z.parse(c, "hello")).toThrow();
594
+ expect(() => z.parse(c, 123)).toThrow();
595
+
596
+ // include literal prefix
597
+ const d = z.templateLiteral([z.literal("hello"), z.number()]);
598
+ type d = z.output<typeof d>;
599
+ expectTypeOf<d>().toEqualTypeOf<`hello${number}`>();
600
+ expect(z.parse(d, "hello123")).toEqual("hello123");
601
+ expect(() => z.parse(d, 123)).toThrow();
602
+ expect(() => z.parse(d, "world123")).toThrow();
603
+
604
+ // include literal union
605
+ const e = z.templateLiteral([z.literal(["aa", "bb"]), z.number()]);
606
+ type e = z.output<typeof e>;
607
+ expectTypeOf<e>().toEqualTypeOf<`aa${number}` | `bb${number}`>();
608
+ expect(z.parse(e, "aa123")).toEqual("aa123");
609
+ expect(z.parse(e, "bb123")).toEqual("bb123");
610
+ expect(() => z.parse(e, "cc123")).toThrow();
611
+ expect(() => z.parse(e, 123)).toThrow();
612
+ });
613
+
614
+ // this returns both a schema and a check
615
+ test("z.custom", () => {
616
+ const a = z.custom((val) => {
617
+ return typeof val === "string";
618
+ });
619
+ expect(z.parse(a, "hello")).toEqual("hello");
620
+ expect(() => z.parse(a, 123)).toThrow();
621
+
622
+ const b = z.string().check(z.custom((val) => val.length > 3));
623
+
624
+ expect(z.parse(b, "hello")).toEqual("hello");
625
+ expect(() => z.parse(b, "hi")).toThrow();
626
+ });
627
+
628
+ test("z.check", () => {
629
+ // this is a more flexible version of z.custom that accepts an arbitrary _parse logic
630
+ // the function should return core.$ZodResult
631
+ const a = z.any().check(
632
+ z.check<string>((ctx) => {
633
+ if (typeof ctx.value === "string") return;
634
+ ctx.issues.push({
635
+ code: "custom",
636
+ origin: "custom",
637
+ message: "Expected a string",
638
+ input: ctx.value,
639
+ });
640
+ })
641
+ );
642
+ expect(z.safeParse(a, "hello")).toMatchObject({
643
+ success: true,
644
+ data: "hello",
645
+ });
646
+ expect(z.safeParse(a, 123)).toMatchObject({
647
+ success: false,
648
+ error: { issues: [{ code: "custom", message: "Expected a string" }] },
649
+ });
650
+ });
651
+
652
+ test("z.instanceof", () => {
653
+ class A {}
654
+
655
+ const a = z.instanceof(A);
656
+ expect(z.parse(a, new A())).toBeInstanceOf(A);
657
+ expect(() => z.parse(a, {})).toThrow();
658
+ });
659
+
660
+ test("z.refine", () => {
661
+ const a = z.number().check(
662
+ z.refine((val) => val > 3),
663
+ z.refine((val) => val < 10)
664
+ );
665
+ expect(z.parse(a, 5)).toEqual(5);
666
+ expect(() => z.parse(a, 2)).toThrow();
667
+ expect(() => z.parse(a, 11)).toThrow();
668
+ expect(() => z.parse(a, "hi")).toThrow();
669
+ });
670
+
671
+ // test("z.superRefine", () => {
672
+ // const a = z.number([
673
+ // z.superRefine((val, ctx) => {
674
+ // if (val < 3) {
675
+ // return ctx.addIssue({
676
+ // code: "custom",
677
+ // origin: "custom",
678
+ // message: "Too small",
679
+ // input: val,
680
+ // });
681
+ // }
682
+ // if (val > 10) {
683
+ // return ctx.addIssue("Too big");
684
+ // }
685
+ // }),
686
+ // ]);
687
+
688
+ // expect(z.parse(a, 5)).toEqual(5);
689
+ // expect(() => z.parse(a, 2)).toThrow();
690
+ // expect(() => z.parse(a, 11)).toThrow();
691
+ // expect(() => z.parse(a, "hi")).toThrow();
692
+ // });
693
+
694
+ test("z.transform", () => {
695
+ const a = z.transform((val: number) => {
696
+ return `${val}`;
697
+ });
698
+ type a_in = z.input<typeof a>;
699
+ expectTypeOf<a_in>().toEqualTypeOf<number>();
700
+ type a_out = z.output<typeof a>;
701
+ expectTypeOf<a_out>().toEqualTypeOf<string>();
702
+ expect(z.parse(a, 123)).toEqual("123");
703
+ });
704
+
705
+ test("z.$brand()", () => {
706
+ const a = z.string().brand<"my-brand">();
707
+ type a = z.output<typeof a>;
708
+ const branded = (_: a) => {};
709
+ // @ts-expect-error
710
+ branded("asdf");
711
+ });
712
+
713
+ test("z.lazy", () => {
714
+ const a = z.lazy(() => z.string());
715
+ type a = z.output<typeof a>;
716
+ expectTypeOf<a>().toEqualTypeOf<string>();
717
+ expect(z.parse(a, "hello")).toEqual("hello");
718
+ expect(() => z.parse(a, 123)).toThrow();
719
+ });
720
+
721
+ // schema that validates JSON-like data
722
+ test("z.json", () => {
723
+ const a = z.json();
724
+ type a = z.output<typeof a>;
725
+ a._zod.output;
726
+
727
+ expectTypeOf<a>().toEqualTypeOf<util.JSONType>();
728
+
729
+ expect(z.parse(a, "hello")).toEqual("hello");
730
+ expect(z.parse(a, 123)).toEqual(123);
731
+ expect(z.parse(a, true)).toEqual(true);
732
+ expect(z.parse(a, null)).toEqual(null);
733
+ expect(z.parse(a, {})).toEqual({});
734
+ expect(z.parse(a, { a: "hello" })).toEqual({ a: "hello" });
735
+ expect(z.parse(a, [1, 2, 3])).toEqual([1, 2, 3]);
736
+ expect(z.parse(a, [{ a: "hello" }])).toEqual([{ a: "hello" }]);
737
+
738
+ // fail cases
739
+ expect(() => z.parse(a, new Date())).toThrow();
740
+ expect(() => z.parse(a, Symbol())).toThrow();
741
+ expect(() => z.parse(a, { a: new Date() })).toThrow();
742
+ expect(() => z.parse(a, undefined)).toThrow();
743
+ expect(() => z.parse(a, { a: undefined })).toThrow();
744
+ });
745
+
746
+ test("z.stringbool", () => {
747
+ const a = z.stringbool();
748
+
749
+ expect(z.parse(a, "true")).toEqual(true);
750
+ expect(z.parse(a, "yes")).toEqual(true);
751
+ expect(z.parse(a, "1")).toEqual(true);
752
+ expect(z.parse(a, "on")).toEqual(true);
753
+ expect(z.parse(a, "y")).toEqual(true);
754
+ expect(z.parse(a, "enabled")).toEqual(true);
755
+ expect(z.parse(a, "TRUE")).toEqual(true);
756
+
757
+ expect(z.parse(a, "false")).toEqual(false);
758
+ expect(z.parse(a, "no")).toEqual(false);
759
+ expect(z.parse(a, "0")).toEqual(false);
760
+ expect(z.parse(a, "off")).toEqual(false);
761
+ expect(z.parse(a, "n")).toEqual(false);
762
+ expect(z.parse(a, "disabled")).toEqual(false);
763
+ expect(z.parse(a, "FALSE")).toEqual(false);
764
+
765
+ expect(z.safeParse(a, "other")).toMatchObject({ success: false });
766
+ expect(z.safeParse(a, "")).toMatchObject({ success: false });
767
+ expect(z.safeParse(a, undefined)).toMatchObject({ success: false });
768
+ expect(z.safeParse(a, {})).toMatchObject({ success: false });
769
+ expect(z.safeParse(a, true)).toMatchObject({ success: false });
770
+ expect(z.safeParse(a, false)).toMatchObject({ success: false });
771
+
772
+ const b = z.stringbool({
773
+ truthy: ["y"],
774
+ falsy: ["n"],
775
+ });
776
+ expect(z.parse(b, "y")).toEqual(true);
777
+ expect(z.parse(b, "n")).toEqual(false);
778
+ expect(z.safeParse(b, "true")).toMatchObject({ success: false });
779
+ expect(z.safeParse(b, "false")).toMatchObject({ success: false });
780
+
781
+ const c = z.stringbool({
782
+ case: "sensitive",
783
+ });
784
+ expect(z.parse(c, "true")).toEqual(true);
785
+ expect(z.safeParse(c, "TRUE")).toMatchObject({ success: false });
786
+ });
787
+
788
+ // promise
789
+ test("z.promise", async () => {
790
+ const a = z.promise(z.string());
791
+ type a = z.output<typeof a>;
792
+ expectTypeOf<a>().toEqualTypeOf<string>();
793
+
794
+ expect(await z.safeParseAsync(a, Promise.resolve("hello"))).toMatchObject({
795
+ success: true,
796
+ data: "hello",
797
+ });
798
+ expect(await z.safeParseAsync(a, Promise.resolve(123))).toMatchObject({
799
+ success: false,
800
+ });
801
+
802
+ const b = z.string();
803
+ expect(() => z.parse(b, Promise.resolve("hello"))).toThrow();
804
+ });
805
+
806
+ // test("type assertions", () => {
807
+ // const schema = z.pipe(
808
+ // z.string(),
809
+ // z.transform((val) => val.length)
810
+ // );
811
+ // schema.assertInput<string>();
812
+ // // @ts-expect-error
813
+ // schema.assertInput<number>();
814
+
815
+ // schema.assertOutput<number>();
816
+ // // @ts-expect-error
817
+ // schema.assertOutput<string>();
818
+ // });
819
+
820
+ test("z.pipe type enforcement", () => {
821
+ z.pipe(
822
+ z.pipe(
823
+ z.string().check(z.regex(/asdf/)),
824
+ z.transform((v) => new Date(v))
825
+ ),
826
+ z.date().check(z.maximum(new Date()))
827
+ );
828
+ });
829
+
830
+ test("def typing", () => {
831
+ z.string().def.type satisfies "string";
832
+ z.email().def.format satisfies "email";
833
+ z.number().def.type satisfies "number";
834
+ z.float64().def.format satisfies z.core.$ZodNumberFormats;
835
+ z.bigint().def.type satisfies "bigint";
836
+ z.boolean().def.type satisfies "boolean";
837
+ z.date().def.type satisfies "date";
838
+ z.symbol().def.type satisfies "symbol";
839
+ z.undefined().def.type satisfies "undefined";
840
+ z.nullable(z.string()).def.type satisfies "nullable";
841
+ z.null().def.type satisfies "null";
842
+ z.any().def.type satisfies "any";
843
+ z.unknown().def.type satisfies "unknown";
844
+ z.never().def.type satisfies "never";
845
+ z.void().def.type satisfies "void";
846
+ z.array(z.string()).def.type satisfies "array";
847
+ z.object({ key: z.string() }).def.type satisfies "object";
848
+ z.union([z.string(), z.number()]).def.type satisfies "union";
849
+ z.intersection(z.string(), z.number()).def.type satisfies "intersection";
850
+ z.tuple([z.string(), z.number()]).def.type satisfies "tuple";
851
+ z.record(z.string(), z.number()).def.type satisfies "record";
852
+ z.map(z.string(), z.number()).def.type satisfies "map";
853
+ z.set(z.string()).def.type satisfies "set";
854
+ z.literal("example").def.type satisfies "literal";
855
+ expectTypeOf(z.literal("example").def.values).toEqualTypeOf<"example"[]>();
856
+ z.enum(["a", "b", "c"]).def.type satisfies "enum";
857
+ z.promise(z.string()).def.type satisfies "promise";
858
+ z.lazy(() => z.string()).def.type satisfies "lazy";
859
+ z.optional(z.string()).def.type satisfies "optional";
860
+ z._default(z.string(), "default").def.type satisfies "default";
861
+ z.templateLiteral([z.literal("a"), z.literal("b")]).def.type satisfies "template_literal";
862
+ z.custom<string>((val) => typeof val === "string").def.type satisfies "custom";
863
+ z.transform((val) => val as string).def.type satisfies "transform";
864
+ z.nonoptional(z.string()).def.type satisfies "nonoptional";
865
+ z.readonly(z.unknown()).def.type satisfies "readonly";
866
+ z.nan().def.type satisfies "nan";
867
+ z.pipe(z.unknown(), z.number()).def.type satisfies "pipe";
868
+ z.success(z.string()).def.type satisfies "success";
869
+ z.catch(z.string(), "fallback").def.type satisfies "catch";
870
+ z.file().def.type satisfies "file";
871
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/number.test.ts ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, expectTypeOf, test } from "vitest";
2
+ import * as z from "zod/v4-mini";
3
+
4
+ test("z.number", () => {
5
+ const a = z.number();
6
+ expect(z.parse(a, 123)).toEqual(123);
7
+ expect(z.parse(a, 123.45)).toEqual(123.45);
8
+ expect(() => z.parse(a, "123")).toThrow();
9
+ expect(() => z.parse(a, false)).toThrow();
10
+
11
+ type a = z.infer<typeof a>;
12
+ expectTypeOf<a>().toEqualTypeOf<number>();
13
+ });
14
+
15
+ test("z.number async", async () => {
16
+ const a = z.number().check(z.refine(async (_) => _ > 0));
17
+ await expect(z.parseAsync(a, 123)).resolves.toEqual(123);
18
+ await expect(() => z.parseAsync(a, -123)).rejects.toThrow();
19
+ await expect(() => z.parseAsync(a, "123")).rejects.toThrow();
20
+ });
21
+
22
+ test("z.int", () => {
23
+ const a = z.int();
24
+ expect(z.parse(a, 123)).toEqual(123);
25
+ expect(() => z.parse(a, 123.45)).toThrow();
26
+ expect(() => z.parse(a, "123")).toThrow();
27
+ expect(() => z.parse(a, false)).toThrow();
28
+ });
29
+
30
+ test("z.float32", () => {
31
+ const a = z.float32();
32
+ expect(z.parse(a, 123.45)).toEqual(123.45);
33
+ expect(() => z.parse(a, "123.45")).toThrow();
34
+ expect(() => z.parse(a, false)).toThrow();
35
+ // -3.4028234663852886e38, 3.4028234663852886e38;
36
+ expect(() => z.parse(a, 3.4028234663852886e38 * 2)).toThrow(); // Exceeds max
37
+ expect(() => z.parse(a, -3.4028234663852886e38 * 2)).toThrow(); // Exceeds min
38
+ });
39
+
40
+ test("z.float64", () => {
41
+ const a = z.float64();
42
+ expect(z.parse(a, 123.45)).toEqual(123.45);
43
+ expect(() => z.parse(a, "123.45")).toThrow();
44
+ expect(() => z.parse(a, false)).toThrow();
45
+ expect(() => z.parse(a, 1.7976931348623157e308 * 2)).toThrow(); // Exceeds max
46
+ expect(() => z.parse(a, -1.7976931348623157e308 * 2)).toThrow(); // Exceeds min
47
+ });
48
+
49
+ test("z.int32", () => {
50
+ const a = z.int32();
51
+ expect(z.parse(a, 123)).toEqual(123);
52
+ expect(() => z.parse(a, 123.45)).toThrow();
53
+ expect(() => z.parse(a, "123")).toThrow();
54
+ expect(() => z.parse(a, false)).toThrow();
55
+ expect(() => z.parse(a, 2147483648)).toThrow(); // Exceeds max
56
+ expect(() => z.parse(a, -2147483649)).toThrow(); // Exceeds min
57
+ });
58
+
59
+ test("z.uint32", () => {
60
+ const a = z.uint32();
61
+ expect(z.parse(a, 123)).toEqual(123);
62
+ expect(() => z.parse(a, -123)).toThrow();
63
+ expect(() => z.parse(a, 123.45)).toThrow();
64
+ expect(() => z.parse(a, "123")).toThrow();
65
+ expect(() => z.parse(a, false)).toThrow();
66
+ expect(() => z.parse(a, 4294967296)).toThrow(); // Exceeds max
67
+ expect(() => z.parse(a, -1)).toThrow(); // Below min
68
+ });
69
+
70
+ test("z.int64", () => {
71
+ const a = z.int64();
72
+ expect(z.parse(a, BigInt(123))).toEqual(BigInt(123));
73
+ expect(() => z.parse(a, 123)).toThrow();
74
+ expect(() => z.parse(a, 123.45)).toThrow();
75
+ expect(() => z.parse(a, "123")).toThrow();
76
+ expect(() => z.parse(a, false)).toThrow();
77
+ expect(() => z.parse(a, BigInt("9223372036854775808"))).toThrow();
78
+ expect(() => z.parse(a, BigInt("-9223372036854775809"))).toThrow();
79
+ // expect(() => z.parse(a, BigInt("9223372036854775808"))).toThrow(); // Exceeds max
80
+ // expect(() => z.parse(a, BigInt("-9223372036854775809"))).toThrow(); // Exceeds min
81
+ });
82
+
83
+ test("z.uint64", () => {
84
+ const a = z.uint64();
85
+ expect(z.parse(a, BigInt(123))).toEqual(BigInt(123));
86
+ expect(() => z.parse(a, 123)).toThrow();
87
+ expect(() => z.parse(a, -123)).toThrow();
88
+ expect(() => z.parse(a, 123.45)).toThrow();
89
+ expect(() => z.parse(a, "123")).toThrow();
90
+ expect(() => z.parse(a, false)).toThrow();
91
+ expect(() => z.parse(a, BigInt("18446744073709551616"))).toThrow(); // Exceeds max
92
+ expect(() => z.parse(a, BigInt("-1"))).toThrow(); // Below min
93
+ // expect(() => z.parse(a, BigInt("18446744073709551616"))).toThrow(); // Exceeds max
94
+ // expect(() => z.parse(a, BigInt("-1"))).toThrow(); // Below min
95
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/object.test.ts ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, expectTypeOf, test } from "vitest";
2
+ import * as z from "zod/v4-mini";
3
+
4
+ test("z.object", () => {
5
+ const a = z.object({
6
+ name: z.string(),
7
+ age: z.number(),
8
+ points: z.optional(z.number()),
9
+ "test?": z.boolean(),
10
+ });
11
+
12
+ a._zod.def.shape["test?"];
13
+ a._zod.def.shape.points._zod.optin;
14
+
15
+ type a = z.output<typeof a>;
16
+
17
+ expectTypeOf<a>().toEqualTypeOf<{
18
+ name: string;
19
+ age: number;
20
+ points?: number;
21
+ "test?": boolean;
22
+ }>();
23
+ expect(z.parse(a, { name: "john", age: 30, "test?": true })).toEqual({
24
+ name: "john",
25
+ age: 30,
26
+ "test?": true,
27
+ });
28
+ // "test?" is required in ZodObject
29
+ expect(() => z.parse(a, { name: "john", age: "30" })).toThrow();
30
+ expect(() => z.parse(a, "hello")).toThrow();
31
+
32
+ // null prototype
33
+ const schema = z.object({ a: z.string() });
34
+ const obj = Object.create(null);
35
+ obj.a = "foo";
36
+ expect(schema.parse(obj)).toEqual({ a: "foo" });
37
+ });
38
+
39
+ test("z.object().check()", () => {
40
+ const a = z.object({
41
+ name: z.string(),
42
+ age: z.number(),
43
+ points: z.optional(z.number()),
44
+ "test?": z.boolean(),
45
+ });
46
+
47
+ type a = z.output<typeof a>;
48
+
49
+ a.check(({ value }) => {
50
+ expectTypeOf(value).toEqualTypeOf<a>();
51
+ });
52
+ });
53
+
54
+ test("z.strictObject", () => {
55
+ const a = z.strictObject({
56
+ name: z.string(),
57
+ });
58
+ expect(z.parse(a, { name: "john" })).toEqual({ name: "john" });
59
+ expect(() => z.parse(a, { name: "john", age: 30 })).toThrow();
60
+ expect(() => z.parse(a, "hello")).toThrow();
61
+ });
62
+
63
+ test("z.looseObject", () => {
64
+ const a = z.looseObject({
65
+ name: z.string(),
66
+ age: z.number(),
67
+ });
68
+ expect(z.parse(a, { name: "john", age: 30 })).toEqual({
69
+ name: "john",
70
+ age: 30,
71
+ });
72
+ expect(z.parse(a, { name: "john", age: 30, extra: true })).toEqual({
73
+ name: "john",
74
+ age: 30,
75
+ extra: true,
76
+ });
77
+ expect(() => z.parse(a, "hello")).toThrow();
78
+ });
79
+
80
+ const userSchema = z.object({
81
+ name: z.string(),
82
+ age: z.number(),
83
+ email: z.optional(z.string()),
84
+ });
85
+
86
+ test("z.keyof", () => {
87
+ // z.keyof returns an enum schema of the keys of an object schema
88
+ const userKeysSchema = z.keyof(userSchema);
89
+ type UserKeys = z.infer<typeof userKeysSchema>;
90
+ expectTypeOf<UserKeys>().toEqualTypeOf<"name" | "age" | "email">();
91
+ expect(userKeysSchema).toBeDefined();
92
+ expect(z.safeParse(userKeysSchema, "name").success).toBe(true);
93
+ expect(z.safeParse(userKeysSchema, "age").success).toBe(true);
94
+ expect(z.safeParse(userKeysSchema, "email").success).toBe(true);
95
+ expect(z.safeParse(userKeysSchema, "isAdmin").success).toBe(false);
96
+ });
97
+
98
+ test("z.extend", () => {
99
+ const extendedSchema = z.extend(userSchema, {
100
+ isAdmin: z.boolean(),
101
+ });
102
+ type ExtendedUser = z.infer<typeof extendedSchema>;
103
+ expectTypeOf<ExtendedUser>().toEqualTypeOf<{
104
+ name: string;
105
+ age: number;
106
+ email?: string;
107
+ isAdmin: boolean;
108
+ }>();
109
+ expect(extendedSchema).toBeDefined();
110
+ expect(z.safeParse(extendedSchema, { name: "John", age: 30, isAdmin: true }).success).toBe(true);
111
+ });
112
+
113
+ test("z.pick", () => {
114
+ const pickedSchema = z.pick(userSchema, { name: true, email: true });
115
+ type PickedUser = z.infer<typeof pickedSchema>;
116
+ expectTypeOf<PickedUser>().toEqualTypeOf<{ name: string; email?: string }>();
117
+ expect(pickedSchema).toBeDefined();
118
+ expect(z.safeParse(pickedSchema, { name: "John", email: "john@example.com" }).success).toBe(true);
119
+ });
120
+
121
+ test("z.omit", () => {
122
+ const omittedSchema = z.omit(userSchema, { age: true });
123
+ type OmittedUser = z.infer<typeof omittedSchema>;
124
+ expectTypeOf<OmittedUser>().toEqualTypeOf<{
125
+ name: string;
126
+ email?: string | undefined;
127
+ }>();
128
+ expect(omittedSchema).toBeDefined();
129
+ expect(Reflect.ownKeys(omittedSchema._zod.def.shape)).toEqual(["name", "email"]);
130
+ expect(z.safeParse(omittedSchema, { name: "John", email: "john@example.com" }).success).toBe(true);
131
+ });
132
+
133
+ test("z.partial", () => {
134
+ const partialSchema = z.partial(userSchema);
135
+ type PartialUser = z.infer<typeof partialSchema>;
136
+ expectTypeOf<PartialUser>().toEqualTypeOf<{
137
+ name?: string;
138
+ age?: number;
139
+ email?: string;
140
+ }>();
141
+ expect(z.safeParse(partialSchema, { name: "John" }).success).toBe(true);
142
+ });
143
+
144
+ test("z.partial with mask", () => {
145
+ const partialSchemaWithMask = z.partial(userSchema, { name: true });
146
+ type PartialUserWithMask = z.infer<typeof partialSchemaWithMask>;
147
+ expectTypeOf<PartialUserWithMask>().toEqualTypeOf<{
148
+ name?: string;
149
+ age: number;
150
+ email?: string;
151
+ }>();
152
+ expect(z.safeParse(partialSchemaWithMask, { age: 30 }).success).toBe(true);
153
+ expect(z.safeParse(partialSchemaWithMask, { name: "John" }).success).toBe(false);
154
+ });
155
+
156
+ test("z.catchall", () => {
157
+ // z.catchall()
158
+ const schema = z.catchall(
159
+ z.object({
160
+ name: z.string(),
161
+ // age: z.number(),
162
+ }),
163
+ z.string()
164
+ );
165
+
166
+ type schemaIn = z.input<typeof schema>;
167
+ type schemaOut = z.output<typeof schema>;
168
+ expectTypeOf<schemaIn>().toEqualTypeOf<{
169
+ name: string;
170
+ [key: string]: string;
171
+ }>();
172
+
173
+ expectTypeOf<schemaOut>().toEqualTypeOf<{
174
+ name: string;
175
+ [key: string]: string;
176
+ }>();
177
+
178
+ schema.parse({
179
+ name: "john",
180
+ age: "30",
181
+ extra: "extra value",
182
+ });
183
+
184
+ expect(() => schema.parse({ name: "john", age: 30 })).toThrow();
185
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/prototypes.test.ts ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, test } from "vitest";
2
+ import * as z from "zod/v4-mini";
3
+
4
+ declare module "zod/v4/core" {
5
+ interface $ZodType {
6
+ /** @deprecated */
7
+ _core(): string;
8
+ }
9
+ }
10
+
11
+ test("prototype extension", () => {
12
+ z.core.$ZodType.prototype._core = function () {
13
+ return "_core";
14
+ };
15
+
16
+ // should pass
17
+ const result = z.string()._core();
18
+ expect(result).toBe("_core");
19
+ // expectTypeOf<typeof result>().toEqualTypeOf<string>();
20
+
21
+ // clean up
22
+ z.ZodMiniType.prototype._core = undefined;
23
+ });
24
+
25
+ declare module "zod/v4/mini" {
26
+ interface ZodMiniType {
27
+ /** @deprecated */
28
+ _mini(): string;
29
+ }
30
+ }
31
+
32
+ test("prototype extension", () => {
33
+ z.ZodMiniType.prototype._mini = function () {
34
+ return "_mini";
35
+ };
36
+
37
+ // should pass
38
+ const result = z.string()._mini();
39
+ expect(result).toBe("_mini");
40
+
41
+ // clean up
42
+ z.ZodMiniType.prototype._mini = undefined;
43
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, expectTypeOf, test } from "vitest";
2
+ import { z } from "zod/v4-mini";
3
+
4
+ test("recursion with z.lazy", () => {
5
+ const data = {
6
+ name: "I",
7
+ subcategories: [
8
+ {
9
+ name: "A",
10
+ subcategories: [
11
+ {
12
+ name: "1",
13
+ subcategories: [
14
+ {
15
+ name: "a",
16
+ subcategories: [],
17
+ },
18
+ ],
19
+ },
20
+ ],
21
+ },
22
+ ],
23
+ };
24
+
25
+ const Category = z.object({
26
+ name: z.string(),
27
+ get subcategories(): z.ZodMiniOptional<z.ZodMiniArray<typeof Category>> {
28
+ return z.optional(z.array(Category));
29
+ },
30
+ });
31
+ Category.parse(data);
32
+
33
+ type Category = z.infer<typeof Category>;
34
+ interface _Category {
35
+ name: string;
36
+ subcategories?: _Category[];
37
+ }
38
+ expectTypeOf<Category>().toEqualTypeOf<_Category>();
39
+ });
40
+
41
+ test("recursion involving union type", () => {
42
+ const data = {
43
+ value: 1,
44
+ next: {
45
+ value: 2,
46
+ next: {
47
+ value: 3,
48
+ next: {
49
+ value: 4,
50
+ next: null,
51
+ },
52
+ },
53
+ },
54
+ };
55
+
56
+ const LL = z.object({
57
+ value: z.number(),
58
+ get next(): z.ZodMiniNullable<typeof LL> {
59
+ return z.nullable(LL);
60
+ },
61
+ });
62
+
63
+ LL.parse(data);
64
+ type LL = z.infer<typeof LL>;
65
+ type _LL = {
66
+ value: number;
67
+ next: _LL | null;
68
+ };
69
+ expectTypeOf<LL>().toEqualTypeOf<_LL>();
70
+ });
71
+
72
+ test("mutual recursion - native", () => {
73
+ const Alazy = z.object({
74
+ val: z.number(),
75
+ get b() {
76
+ return z.optional(Blazy);
77
+ },
78
+ });
79
+
80
+ const Blazy = z.object({
81
+ val: z.number(),
82
+ get a() {
83
+ return z.optional(Alazy);
84
+ },
85
+ });
86
+ const testData = {
87
+ val: 1,
88
+ b: {
89
+ val: 5,
90
+ a: {
91
+ val: 3,
92
+ b: {
93
+ val: 4,
94
+ a: {
95
+ val: 2,
96
+ b: {
97
+ val: 1,
98
+ },
99
+ },
100
+ },
101
+ },
102
+ },
103
+ };
104
+
105
+ Alazy.parse(testData);
106
+ Blazy.parse(testData.b);
107
+
108
+ type Alazy = z.infer<typeof Alazy>;
109
+ type Blazy = z.infer<typeof Blazy>;
110
+ interface _Alazy {
111
+ val: number;
112
+ b?: _Blazy | undefined;
113
+ }
114
+ interface _Blazy {
115
+ val: number;
116
+ a?: _Alazy | undefined;
117
+ }
118
+ expectTypeOf<Alazy>().toEqualTypeOf<_Alazy>();
119
+ expectTypeOf<Blazy>().toEqualTypeOf<_Blazy>();
120
+
121
+ expect(() => Alazy.parse({ val: "asdf" })).toThrow();
122
+ });
123
+
124
+ test("pick and omit with getter", () => {
125
+ const Category = z.strictObject({
126
+ name: z.string(),
127
+ get subcategories() {
128
+ return z.array(Category);
129
+ },
130
+ });
131
+
132
+ type Category = z.infer<typeof Category>;
133
+ interface _Category {
134
+ name: string;
135
+ subcategories: _Category[];
136
+ }
137
+ expectTypeOf<Category>().toEqualTypeOf<_Category>();
138
+
139
+ const PickedCategory = z.pick(Category, { name: true });
140
+ const OmittedCategory = z.omit(Category, { subcategories: true });
141
+ type PickedCategory = z.infer<typeof PickedCategory>;
142
+ type OmittedCategory = z.infer<typeof OmittedCategory>;
143
+ interface _PickedCategory {
144
+ name: string;
145
+ }
146
+ interface _OmittedCategory {
147
+ name: string;
148
+ }
149
+ expectTypeOf<PickedCategory>().toEqualTypeOf<_PickedCategory>();
150
+ expectTypeOf<OmittedCategory>().toEqualTypeOf<_OmittedCategory>();
151
+
152
+ const picked = { name: "test" };
153
+ const omitted = { name: "test" };
154
+
155
+ PickedCategory.parse(picked);
156
+ OmittedCategory.parse(omitted);
157
+
158
+ expect(() => PickedCategory.parse({ name: "test", subcategories: [] })).toThrow();
159
+ expect(() => OmittedCategory.parse({ name: "test", subcategories: [] })).toThrow();
160
+ });
161
+
162
+ test("deferred self-recursion", () => {
163
+ const Feature = z.object({
164
+ title: z.string(),
165
+ get features(): z.ZodMiniOptional<z.ZodMiniArray<typeof Feature>> {
166
+ return z.optional(z.array(Feature)); //.optional();
167
+ },
168
+ });
169
+ type Feature = z.infer<typeof Feature>;
170
+
171
+ const Output = z.object({
172
+ id: z.int(), //.nonnegative(),
173
+ name: z.string(),
174
+ features: z.array(Feature), //.array(), // <—
175
+ });
176
+
177
+ type Output = z.output<typeof Output>;
178
+
179
+ type _Feature = {
180
+ title: string;
181
+ features?: _Feature[] | undefined;
182
+ };
183
+
184
+ type _Output = {
185
+ id: number;
186
+ name: string;
187
+ features: _Feature[];
188
+ };
189
+
190
+ expectTypeOf<Feature>().toEqualTypeOf<_Feature>();
191
+ expectTypeOf<Output>().toEqualTypeOf<_Output>();
192
+ });
193
+
194
+ test("recursion compatibility", () => {
195
+ // array
196
+ const A = z.object({
197
+ get subcategories() {
198
+ return z.array(A);
199
+ },
200
+ });
201
+ // tuple
202
+ const B = z.object({
203
+ get subcategories() {
204
+ return z.tuple([B, B]);
205
+ },
206
+ });
207
+ // object
208
+ const C = z.object({
209
+ get subcategories() {
210
+ return z.object({
211
+ subcategories: C,
212
+ });
213
+ },
214
+ });
215
+ // union
216
+ const D = z.object({
217
+ get subcategories() {
218
+ return z.union([D, z.string()]);
219
+ },
220
+ });
221
+ // intersection
222
+ const E = z.object({
223
+ get subcategories() {
224
+ return z.intersection(E, E);
225
+ },
226
+ });
227
+ // record
228
+ const F = z.object({
229
+ get subcategories() {
230
+ return z.record(z.string(), F);
231
+ },
232
+ });
233
+ // map
234
+ const G = z.object({
235
+ get subcategories() {
236
+ return z.map(z.string(), G);
237
+ },
238
+ });
239
+ // set
240
+ const H = z.object({
241
+ get subcategories() {
242
+ return z.set(H);
243
+ },
244
+ });
245
+ // optional
246
+ const I = z.object({
247
+ get subcategories() {
248
+ return z.optional(I);
249
+ },
250
+ });
251
+ // nullable
252
+ const J = z.object({
253
+ get subcategories() {
254
+ return z.nullable(J);
255
+ },
256
+ });
257
+ // optional
258
+ const L = z.object({
259
+ get subcategories() {
260
+ return z.optional(L);
261
+ },
262
+ });
263
+ // nullable
264
+ const M = z.object({
265
+ get subcategories() {
266
+ return z.nullable(M);
267
+ },
268
+ });
269
+ // nonoptional
270
+ const N = z.object({
271
+ get subcategories() {
272
+ return z.nonoptional(N);
273
+ },
274
+ });
275
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/src/v4/mini/tests/string.test.ts ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, expectTypeOf, test } from "vitest";
2
+ import * as z from "zod/v4-mini";
3
+
4
+ const FAIL = { success: false };
5
+
6
+ test("z.string", async () => {
7
+ const a = z.string();
8
+ expect(z.parse(a, "hello")).toEqual("hello");
9
+ expect(() => z.parse(a, 123)).toThrow();
10
+ expect(() => z.parse(a, false)).toThrow();
11
+ type a = z.infer<typeof a>;
12
+ expectTypeOf<a>().toEqualTypeOf<string>();
13
+ });
14
+
15
+ // test("z.string with description", () => {
16
+ // const a = z.string({ description: "string description" });
17
+ // a._def;
18
+ // expect(a._def.description).toEqual("string description");
19
+ // });
20
+
21
+ test("z.string with custom error", () => {
22
+ const a = z.string({ error: () => "BAD" });
23
+ expect(z.safeParse(a, 123).error!.issues[0].message).toEqual("BAD");
24
+ });
25
+
26
+ test("inference in checks", () => {
27
+ const a = z.string().check(z.refine((val) => val.length));
28
+ z.parse(a, "___");
29
+ expect(() => z.parse(a, "")).toThrow();
30
+ const b = z.string().check(z.refine((val) => val.length));
31
+ z.parse(b, "___");
32
+ expect(() => z.parse(b, "")).toThrow();
33
+ const c = z.string().check(z.refine((val) => val.length));
34
+ z.parse(c, "___");
35
+ expect(() => z.parse(c, "")).toThrow();
36
+ const d = z.string().check(z.refine((val) => val.length));
37
+ z.parse(d, "___");
38
+ expect(() => z.parse(d, "")).toThrow();
39
+ });
40
+
41
+ test("z.string async", async () => {
42
+ // async
43
+ const a = z.string().check(z.refine(async (val) => val.length));
44
+ expect(await z.parseAsync(a, "___")).toEqual("___");
45
+ await expect(() => z.parseAsync(a, "")).rejects.toThrowError();
46
+ });
47
+
48
+ test("z.uuid", () => {
49
+ const a = z.uuid();
50
+ // parse uuid
51
+ z.parse(a, "550e8400-e29b-41d4-a716-446655440000");
52
+ z.parse(a, "550e8400-e29b-61d4-a716-446655440000");
53
+
54
+ // bad uuid
55
+ expect(() => z.parse(a, "hello")).toThrow();
56
+ // wrong type
57
+ expect(() => z.parse(a, 123)).toThrow();
58
+
59
+ const b = z.uuidv4();
60
+ z.parse(b, "550e8400-e29b-41d4-a716-446655440000");
61
+ expect(z.safeParse(b, "550e8400-e29b-61d4-a716-446655440000")).toMatchObject(FAIL);
62
+
63
+ const c = z.uuidv6();
64
+ z.parse(c, "550e8400-e29b-61d4-a716-446655440000");
65
+ expect(z.safeParse(c, "550e8400-e29b-41d4-a716-446655440000")).toMatchObject(FAIL);
66
+
67
+ const d = z.uuidv7();
68
+ z.parse(d, "550e8400-e29b-71d4-a716-446655440000");
69
+ expect(z.safeParse(d, "550e8400-e29b-41d4-a716-446655440000")).toMatchObject(FAIL);
70
+ expect(z.safeParse(d, "550e8400-e29b-61d4-a716-446655440000")).toMatchObject(FAIL);
71
+ });
72
+
73
+ test("z.email", () => {
74
+ const a = z.email();
75
+ expect(z.parse(a, "test@test.com")).toEqual("test@test.com");
76
+ expect(() => z.parse(a, "test")).toThrow();
77
+ expect(z.safeParse(a, "bad email", { error: () => "bad email" }).error!.issues[0].message).toEqual("bad email");
78
+
79
+ const b = z.email("bad email");
80
+ expect(z.safeParse(b, "bad email").error!.issues[0].message).toEqual("bad email");
81
+
82
+ const c = z.email({ error: "bad email" });
83
+ expect(z.safeParse(c, "bad email").error!.issues[0].message).toEqual("bad email");
84
+
85
+ const d = z.email({ error: () => "bad email" });
86
+ expect(z.safeParse(d, "bad email").error!.issues[0].message).toEqual("bad email");
87
+ });
88
+
89
+ test("z.url", () => {
90
+ const a = z.url();
91
+ // valid URLs
92
+ expect(a.parse("http://example.com")).toEqual("http://example.com");
93
+ expect(a.parse("https://example.com")).toEqual("https://example.com");
94
+ expect(a.parse("ftp://example.com")).toEqual("ftp://example.com");
95
+ expect(a.parse("http://sub.example.com")).toEqual("http://sub.example.com");
96
+ expect(a.parse("https://example.com/path?query=123#fragment")).toEqual("https://example.com/path?query=123#fragment");
97
+ expect(a.parse("http://localhost")).toEqual("http://localhost");
98
+ expect(a.parse("https://localhost")).toEqual("https://localhost");
99
+ expect(a.parse("http://localhost:3000")).toEqual("http://localhost:3000");
100
+ expect(a.parse("https://localhost:3000")).toEqual("https://localhost:3000");
101
+
102
+ // test trimming
103
+ expect(a.parse(" http://example.com ")).toEqual("http://example.com");
104
+ expect(a.parse(" http://example.com/")).toEqual("http://example.com/");
105
+ expect(a.parse(" http://example.com")).toEqual("http://example.com");
106
+ expect(a.parse(" http://example.com//")).toEqual("http://example.com//");
107
+
108
+ // invalid URLs
109
+ expect(() => a.parse("not-a-url")).toThrow();
110
+ // expect(() => a.parse("http:/example.com")).toThrow();
111
+ expect(() => a.parse("://example.com")).toThrow();
112
+ expect(() => a.parse("http://")).toThrow();
113
+ expect(() => a.parse("example.com")).toThrow();
114
+
115
+ // wrong type
116
+ expect(() => a.parse(123)).toThrow();
117
+ expect(() => a.parse(null)).toThrow();
118
+ expect(() => a.parse(undefined)).toThrow();
119
+ });
120
+
121
+ test("z.url with optional hostname regex", () => {
122
+ const a = z.url({ hostname: /example\.com$/ });
123
+ expect(a.parse("http://example.com")).toEqual("http://example.com");
124
+ expect(a.parse("https://sub.example.com")).toEqual("https://sub.example.com");
125
+ expect(() => a.parse("http://examples.com")).toThrow();
126
+ expect(() => a.parse("http://example.org")).toThrow();
127
+ expect(() => a.parse("asdf")).toThrow();
128
+ });
129
+
130
+ test("z.url - file urls", () => {
131
+ // file URLs
132
+ const a = z.url({ hostname: /.*/ }); // allow any hostname
133
+ expect(a.parse("file:///path/to/file.txt")).toEqual("file:///path/to/file.txt");
134
+ expect(a.parse("file:///C:/path/to/file.txt")).toEqual("file:///C:/path/to/file.txt");
135
+ expect(a.parse("file:///C:/path/to/file.txt?query=123#fragment")).toEqual(
136
+ "file:///C:/path/to/file.txt?query=123#fragment"
137
+ );
138
+ });
139
+ test("z.url with optional protocol regex", () => {
140
+ const a = z.url({ protocol: /^https?$/ });
141
+ expect(a.parse("http://example.com")).toEqual("http://example.com");
142
+ expect(a.parse("https://example.com")).toEqual("https://example.com");
143
+ expect(() => a.parse("ftp://example.com")).toThrow();
144
+ expect(() => a.parse("mailto:example@example.com")).toThrow();
145
+ expect(() => a.parse("asdf")).toThrow();
146
+ });
147
+
148
+ test("z.url with both hostname and protocol regexes", () => {
149
+ const a = z.url({ hostname: /example\.com$/, protocol: /^https$/ });
150
+ expect(a.parse("https://example.com")).toEqual("https://example.com");
151
+ expect(a.parse("https://sub.example.com")).toEqual("https://sub.example.com");
152
+ expect(() => a.parse("http://example.com")).toThrow();
153
+ expect(() => a.parse("https://example.org")).toThrow();
154
+ expect(() => a.parse("ftp://example.com")).toThrow();
155
+ expect(() => a.parse("asdf")).toThrow();
156
+ });
157
+
158
+ test("z.url with invalid regex patterns", () => {
159
+ const a = z.url({ hostname: /a+$/, protocol: /^ftp$/ });
160
+ a.parse("ftp://a");
161
+ a.parse("ftp://aaaaaaaa");
162
+ expect(() => a.parse("http://aaa")).toThrow();
163
+ expect(() => a.parse("https://example.com")).toThrow();
164
+ expect(() => a.parse("ftp://asdfasdf")).toThrow();
165
+ expect(() => a.parse("ftp://invalid")).toThrow();
166
+ });
167
+
168
+ test("z.emoji", () => {
169
+ const a = z.emoji();
170
+ expect(z.parse(a, "😀")).toEqual("😀");
171
+ expect(() => z.parse(a, "hello")).toThrow();
172
+ });
173
+
174
+ test("z.nanoid", () => {
175
+ const a = z.nanoid();
176
+ expect(z.parse(a, "8FHZpIxleEK3axQRBNNjN")).toEqual("8FHZpIxleEK3axQRBNNjN");
177
+ expect(() => z.parse(a, "abc")).toThrow();
178
+ });
179
+
180
+ test("z.cuid", () => {
181
+ const a = z.cuid();
182
+ expect(z.parse(a, "cixs7y0c0000f7x3b1z6m3w6r")).toEqual("cixs7y0c0000f7x3b1z6m3w6r");
183
+ expect(() => z.parse(a, "abc")).toThrow();
184
+ });
185
+
186
+ test("z.cuid2", () => {
187
+ const a = z.cuid2();
188
+ expect(z.parse(a, "cixs7y0c0000f7x3b1z6m3w6r")).toEqual("cixs7y0c0000f7x3b1z6m3w6r");
189
+ expect(() => z.parse(a, 123)).toThrow();
190
+ });
191
+
192
+ test("z.ulid", () => {
193
+ const a = z.ulid();
194
+ expect(z.parse(a, "01ETGRM9QYVX6S9V2F3B6JXG4N")).toEqual("01ETGRM9QYVX6S9V2F3B6JXG4N");
195
+ expect(() => z.parse(a, "abc")).toThrow();
196
+ });
197
+
198
+ test("z.xid", () => {
199
+ const a = z.xid();
200
+ expect(z.parse(a, "9m4e2mr0ui3e8a215n4g")).toEqual("9m4e2mr0ui3e8a215n4g");
201
+ expect(() => z.parse(a, "abc")).toThrow();
202
+ });
203
+
204
+ test("z.ksuid", () => {
205
+ const a = z.ksuid();
206
+ expect(z.parse(a, "2naeRjTrrHJAkfd3tOuEjw90WCA")).toEqual("2naeRjTrrHJAkfd3tOuEjw90WCA");
207
+ expect(() => z.parse(a, "abc")).toThrow();
208
+ });
209
+
210
+ // test("z.ip", () => {
211
+ // const a = z.ip();
212
+ // expect(z.parse(a, "127.0.0.1")).toEqual("127.0.0.1");
213
+ // expect(z.parse(a, "2001:0db8:85a3:0000:0000:8a2e:0370:7334")).toEqual("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
214
+ // expect(() => z.parse(a, "abc")).toThrow();
215
+ // });
216
+
217
+ test("z.ipv4", () => {
218
+ const a = z.ipv4();
219
+ // valid ipv4
220
+ expect(z.parse(a, "192.168.1.1")).toEqual("192.168.1.1");
221
+ expect(z.parse(a, "255.255.255.255")).toEqual("255.255.255.255");
222
+ // invalid ipv4
223
+ expect(() => z.parse(a, "999.999.999.999")).toThrow();
224
+ expect(() => z.parse(a, "256.256.256.256")).toThrow();
225
+ expect(() => z.parse(a, "192.168.1")).toThrow();
226
+ expect(() => z.parse(a, "hello")).toThrow();
227
+ // wrong type
228
+ expect(() => z.parse(a, 123)).toThrow();
229
+ });
230
+
231
+ test("z.ipv6", () => {
232
+ const a = z.ipv6();
233
+ // valid ipv6
234
+ expect(z.parse(a, "2001:0db8:85a3:0000:0000:8a2e:0370:7334")).toEqual("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
235
+ expect(z.parse(a, "::1")).toEqual("::1");
236
+ // invalid ipv6
237
+ expect(() => z.parse(a, "2001:db8::85a3::8a2e:370:7334")).toThrow();
238
+ expect(() => z.parse(a, "2001:db8:85a3:0:0:8a2e:370g:7334")).toThrow();
239
+ expect(() => z.parse(a, "hello")).toThrow();
240
+ // wrong type
241
+ expect(() => z.parse(a, 123)).toThrow();
242
+ });
243
+
244
+ test("z.base64", () => {
245
+ const a = z.base64();
246
+ // valid base64
247
+ expect(z.parse(a, "SGVsbG8gd29ybGQ=")).toEqual("SGVsbG8gd29ybGQ=");
248
+ expect(z.parse(a, "U29tZSBvdGhlciBzdHJpbmc=")).toEqual("U29tZSBvdGhlciBzdHJpbmc=");
249
+ // invalid base64
250
+ expect(() => z.parse(a, "SGVsbG8gd29ybGQ")).toThrow();
251
+ expect(() => z.parse(a, "U29tZSBvdGhlciBzdHJpbmc")).toThrow();
252
+ expect(() => z.parse(a, "hello")).toThrow();
253
+ // wrong type
254
+ expect(() => z.parse(a, 123)).toThrow();
255
+ });
256
+
257
+ // test("z.jsonString", () => {
258
+ // const a = z.jsonString();
259
+ // // valid JSON string
260
+ // expect(z.parse(a, '{"key":"value"}')).toEqual('{"key":"value"}');
261
+ // expect(z.parse(a, '["item1", "item2"]')).toEqual('["item1", "item2"]');
262
+ // // invalid JSON string
263
+ // expect(() => z.parse(a, '{"key":value}')).toThrow();
264
+ // expect(() => z.parse(a, '["item1", "item2"')).toThrow();
265
+ // expect(() => z.parse(a, "hello")).toThrow();
266
+ // // wrong type
267
+ // expect(() => z.parse(a, 123)).toThrow();
268
+ // });
269
+
270
+ test("z.e164", () => {
271
+ const a = z.e164();
272
+ // valid e164
273
+ expect(z.parse(a, "+1234567890")).toEqual("+1234567890");
274
+ expect(z.parse(a, "+19876543210")).toEqual("+19876543210");
275
+ // invalid e164
276
+ expect(() => z.parse(a, "1234567890")).toThrow();
277
+ expect(() => z.parse(a, "+12345")).toThrow();
278
+ expect(() => z.parse(a, "hello")).toThrow();
279
+ // wrong type
280
+ expect(() => z.parse(a, 123)).toThrow();
281
+ });
282
+
283
+ test("z.jwt", () => {
284
+ const a = z.jwt();
285
+ // valid jwt
286
+ expect(
287
+ z.parse(
288
+ a,
289
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
290
+ )
291
+ ).toEqual(
292
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
293
+ );
294
+ // invalid jwt
295
+ expect(() => z.parse(a, "invalid.jwt.token")).toThrow();
296
+ expect(() => z.parse(a, "hello")).toThrow();
297
+ // wrong type
298
+ expect(() => z.parse(a, 123)).toThrow();
299
+ });
node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.cjs ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
4
+ const util_js_1 = require("./helpers/util.cjs");
5
+ exports.ZodIssueCode = util_js_1.util.arrayToEnum([
6
+ "invalid_type",
7
+ "invalid_literal",
8
+ "custom",
9
+ "invalid_union",
10
+ "invalid_union_discriminator",
11
+ "invalid_enum_value",
12
+ "unrecognized_keys",
13
+ "invalid_arguments",
14
+ "invalid_return_type",
15
+ "invalid_date",
16
+ "invalid_string",
17
+ "too_small",
18
+ "too_big",
19
+ "invalid_intersection_types",
20
+ "not_multiple_of",
21
+ "not_finite",
22
+ ]);
23
+ const quotelessJson = (obj) => {
24
+ const json = JSON.stringify(obj, null, 2);
25
+ return json.replace(/"([^"]+)":/g, "$1:");
26
+ };
27
+ exports.quotelessJson = quotelessJson;
28
+ class ZodError extends Error {
29
+ get errors() {
30
+ return this.issues;
31
+ }
32
+ constructor(issues) {
33
+ super();
34
+ this.issues = [];
35
+ this.addIssue = (sub) => {
36
+ this.issues = [...this.issues, sub];
37
+ };
38
+ this.addIssues = (subs = []) => {
39
+ this.issues = [...this.issues, ...subs];
40
+ };
41
+ const actualProto = new.target.prototype;
42
+ if (Object.setPrototypeOf) {
43
+ // eslint-disable-next-line ban/ban
44
+ Object.setPrototypeOf(this, actualProto);
45
+ }
46
+ else {
47
+ this.__proto__ = actualProto;
48
+ }
49
+ this.name = "ZodError";
50
+ this.issues = issues;
51
+ }
52
+ format(_mapper) {
53
+ const mapper = _mapper ||
54
+ function (issue) {
55
+ return issue.message;
56
+ };
57
+ const fieldErrors = { _errors: [] };
58
+ const processError = (error) => {
59
+ for (const issue of error.issues) {
60
+ if (issue.code === "invalid_union") {
61
+ issue.unionErrors.map(processError);
62
+ }
63
+ else if (issue.code === "invalid_return_type") {
64
+ processError(issue.returnTypeError);
65
+ }
66
+ else if (issue.code === "invalid_arguments") {
67
+ processError(issue.argumentsError);
68
+ }
69
+ else if (issue.path.length === 0) {
70
+ fieldErrors._errors.push(mapper(issue));
71
+ }
72
+ else {
73
+ let curr = fieldErrors;
74
+ let i = 0;
75
+ while (i < issue.path.length) {
76
+ const el = issue.path[i];
77
+ const terminal = i === issue.path.length - 1;
78
+ if (!terminal) {
79
+ curr[el] = curr[el] || { _errors: [] };
80
+ // if (typeof el === "string") {
81
+ // curr[el] = curr[el] || { _errors: [] };
82
+ // } else if (typeof el === "number") {
83
+ // const errorArray: any = [];
84
+ // errorArray._errors = [];
85
+ // curr[el] = curr[el] || errorArray;
86
+ // }
87
+ }
88
+ else {
89
+ curr[el] = curr[el] || { _errors: [] };
90
+ curr[el]._errors.push(mapper(issue));
91
+ }
92
+ curr = curr[el];
93
+ i++;
94
+ }
95
+ }
96
+ }
97
+ };
98
+ processError(this);
99
+ return fieldErrors;
100
+ }
101
+ static assert(value) {
102
+ if (!(value instanceof ZodError)) {
103
+ throw new Error(`Not a ZodError: ${value}`);
104
+ }
105
+ }
106
+ toString() {
107
+ return this.message;
108
+ }
109
+ get message() {
110
+ return JSON.stringify(this.issues, util_js_1.util.jsonStringifyReplacer, 2);
111
+ }
112
+ get isEmpty() {
113
+ return this.issues.length === 0;
114
+ }
115
+ flatten(mapper = (issue) => issue.message) {
116
+ const fieldErrors = {};
117
+ const formErrors = [];
118
+ for (const sub of this.issues) {
119
+ if (sub.path.length > 0) {
120
+ const firstEl = sub.path[0];
121
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
122
+ fieldErrors[firstEl].push(mapper(sub));
123
+ }
124
+ else {
125
+ formErrors.push(mapper(sub));
126
+ }
127
+ }
128
+ return { formErrors, fieldErrors };
129
+ }
130
+ get formErrors() {
131
+ return this.flatten();
132
+ }
133
+ }
134
+ exports.ZodError = ZodError;
135
+ ZodError.create = (issues) => {
136
+ const error = new ZodError(issues);
137
+ return error;
138
+ };
node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.d.cts ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Primitive } from "./helpers/typeAliases.cjs";
2
+ import { util, type ZodParsedType } from "./helpers/util.cjs";
3
+ import type { TypeOf, ZodType } from "./index.cjs";
4
+ type allKeys<T> = T extends any ? keyof T : never;
5
+ export type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
6
+ export type typeToFlattenedError<T, U = string> = {
7
+ formErrors: U[];
8
+ fieldErrors: {
9
+ [P in allKeys<T>]?: U[];
10
+ };
11
+ };
12
+ export declare const ZodIssueCode: {
13
+ invalid_type: "invalid_type";
14
+ invalid_literal: "invalid_literal";
15
+ custom: "custom";
16
+ invalid_union: "invalid_union";
17
+ invalid_union_discriminator: "invalid_union_discriminator";
18
+ invalid_enum_value: "invalid_enum_value";
19
+ unrecognized_keys: "unrecognized_keys";
20
+ invalid_arguments: "invalid_arguments";
21
+ invalid_return_type: "invalid_return_type";
22
+ invalid_date: "invalid_date";
23
+ invalid_string: "invalid_string";
24
+ too_small: "too_small";
25
+ too_big: "too_big";
26
+ invalid_intersection_types: "invalid_intersection_types";
27
+ not_multiple_of: "not_multiple_of";
28
+ not_finite: "not_finite";
29
+ };
30
+ export type ZodIssueCode = keyof typeof ZodIssueCode;
31
+ export type ZodIssueBase = {
32
+ path: (string | number)[];
33
+ message?: string | undefined;
34
+ };
35
+ export interface ZodInvalidTypeIssue extends ZodIssueBase {
36
+ code: typeof ZodIssueCode.invalid_type;
37
+ expected: ZodParsedType;
38
+ received: ZodParsedType;
39
+ }
40
+ export interface ZodInvalidLiteralIssue extends ZodIssueBase {
41
+ code: typeof ZodIssueCode.invalid_literal;
42
+ expected: unknown;
43
+ received: unknown;
44
+ }
45
+ export interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
46
+ code: typeof ZodIssueCode.unrecognized_keys;
47
+ keys: string[];
48
+ }
49
+ export interface ZodInvalidUnionIssue extends ZodIssueBase {
50
+ code: typeof ZodIssueCode.invalid_union;
51
+ unionErrors: ZodError[];
52
+ }
53
+ export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
54
+ code: typeof ZodIssueCode.invalid_union_discriminator;
55
+ options: Primitive[];
56
+ }
57
+ export interface ZodInvalidEnumValueIssue extends ZodIssueBase {
58
+ received: string | number;
59
+ code: typeof ZodIssueCode.invalid_enum_value;
60
+ options: (string | number)[];
61
+ }
62
+ export interface ZodInvalidArgumentsIssue extends ZodIssueBase {
63
+ code: typeof ZodIssueCode.invalid_arguments;
64
+ argumentsError: ZodError;
65
+ }
66
+ export interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
67
+ code: typeof ZodIssueCode.invalid_return_type;
68
+ returnTypeError: ZodError;
69
+ }
70
+ export interface ZodInvalidDateIssue extends ZodIssueBase {
71
+ code: typeof ZodIssueCode.invalid_date;
72
+ }
73
+ export type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
74
+ includes: string;
75
+ position?: number | undefined;
76
+ } | {
77
+ startsWith: string;
78
+ } | {
79
+ endsWith: string;
80
+ };
81
+ export interface ZodInvalidStringIssue extends ZodIssueBase {
82
+ code: typeof ZodIssueCode.invalid_string;
83
+ validation: StringValidation;
84
+ }
85
+ export interface ZodTooSmallIssue extends ZodIssueBase {
86
+ code: typeof ZodIssueCode.too_small;
87
+ minimum: number | bigint;
88
+ inclusive: boolean;
89
+ exact?: boolean;
90
+ type: "array" | "string" | "number" | "set" | "date" | "bigint";
91
+ }
92
+ export interface ZodTooBigIssue extends ZodIssueBase {
93
+ code: typeof ZodIssueCode.too_big;
94
+ maximum: number | bigint;
95
+ inclusive: boolean;
96
+ exact?: boolean;
97
+ type: "array" | "string" | "number" | "set" | "date" | "bigint";
98
+ }
99
+ export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
100
+ code: typeof ZodIssueCode.invalid_intersection_types;
101
+ }
102
+ export interface ZodNotMultipleOfIssue extends ZodIssueBase {
103
+ code: typeof ZodIssueCode.not_multiple_of;
104
+ multipleOf: number | bigint;
105
+ }
106
+ export interface ZodNotFiniteIssue extends ZodIssueBase {
107
+ code: typeof ZodIssueCode.not_finite;
108
+ }
109
+ export interface ZodCustomIssue extends ZodIssueBase {
110
+ code: typeof ZodIssueCode.custom;
111
+ params?: {
112
+ [k: string]: any;
113
+ };
114
+ }
115
+ export type DenormalizedError = {
116
+ [k: string]: DenormalizedError | string[];
117
+ };
118
+ export type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
119
+ export type ZodIssue = ZodIssueOptionalMessage & {
120
+ fatal?: boolean | undefined;
121
+ message: string;
122
+ };
123
+ export declare const quotelessJson: (obj: any) => string;
124
+ type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? {
125
+ [K in keyof T]?: ZodFormattedError<T[K]>;
126
+ } : T extends any[] ? {
127
+ [k: number]: ZodFormattedError<T[number]>;
128
+ } : T extends object ? {
129
+ [K in keyof T]?: ZodFormattedError<T[K]>;
130
+ } : unknown;
131
+ export type ZodFormattedError<T, U = string> = {
132
+ _errors: U[];
133
+ } & recursiveZodFormattedError<NonNullable<T>>;
134
+ export type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
135
+ export declare class ZodError<T = any> extends Error {
136
+ issues: ZodIssue[];
137
+ get errors(): ZodIssue[];
138
+ constructor(issues: ZodIssue[]);
139
+ format(): ZodFormattedError<T>;
140
+ format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
141
+ static create: (issues: ZodIssue[]) => ZodError<any>;
142
+ static assert(value: unknown): asserts value is ZodError;
143
+ toString(): string;
144
+ get message(): string;
145
+ get isEmpty(): boolean;
146
+ addIssue: (sub: ZodIssue) => void;
147
+ addIssues: (subs?: ZodIssue[]) => void;
148
+ flatten(): typeToFlattenedError<T>;
149
+ flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
150
+ get formErrors(): typeToFlattenedError<T, string>;
151
+ }
152
+ type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
153
+ export type IssueData = stripPath<ZodIssueOptionalMessage> & {
154
+ path?: (string | number)[];
155
+ fatal?: boolean | undefined;
156
+ };
157
+ export type ErrorMapCtx = {
158
+ defaultError: string;
159
+ data: any;
160
+ };
161
+ export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
162
+ message: string;
163
+ };
164
+ export {};
node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.d.ts ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Primitive } from "./helpers/typeAliases.js";
2
+ import { util, type ZodParsedType } from "./helpers/util.js";
3
+ import type { TypeOf, ZodType } from "./index.js";
4
+ type allKeys<T> = T extends any ? keyof T : never;
5
+ export type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
6
+ export type typeToFlattenedError<T, U = string> = {
7
+ formErrors: U[];
8
+ fieldErrors: {
9
+ [P in allKeys<T>]?: U[];
10
+ };
11
+ };
12
+ export declare const ZodIssueCode: {
13
+ invalid_type: "invalid_type";
14
+ invalid_literal: "invalid_literal";
15
+ custom: "custom";
16
+ invalid_union: "invalid_union";
17
+ invalid_union_discriminator: "invalid_union_discriminator";
18
+ invalid_enum_value: "invalid_enum_value";
19
+ unrecognized_keys: "unrecognized_keys";
20
+ invalid_arguments: "invalid_arguments";
21
+ invalid_return_type: "invalid_return_type";
22
+ invalid_date: "invalid_date";
23
+ invalid_string: "invalid_string";
24
+ too_small: "too_small";
25
+ too_big: "too_big";
26
+ invalid_intersection_types: "invalid_intersection_types";
27
+ not_multiple_of: "not_multiple_of";
28
+ not_finite: "not_finite";
29
+ };
30
+ export type ZodIssueCode = keyof typeof ZodIssueCode;
31
+ export type ZodIssueBase = {
32
+ path: (string | number)[];
33
+ message?: string | undefined;
34
+ };
35
+ export interface ZodInvalidTypeIssue extends ZodIssueBase {
36
+ code: typeof ZodIssueCode.invalid_type;
37
+ expected: ZodParsedType;
38
+ received: ZodParsedType;
39
+ }
40
+ export interface ZodInvalidLiteralIssue extends ZodIssueBase {
41
+ code: typeof ZodIssueCode.invalid_literal;
42
+ expected: unknown;
43
+ received: unknown;
44
+ }
45
+ export interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
46
+ code: typeof ZodIssueCode.unrecognized_keys;
47
+ keys: string[];
48
+ }
49
+ export interface ZodInvalidUnionIssue extends ZodIssueBase {
50
+ code: typeof ZodIssueCode.invalid_union;
51
+ unionErrors: ZodError[];
52
+ }
53
+ export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
54
+ code: typeof ZodIssueCode.invalid_union_discriminator;
55
+ options: Primitive[];
56
+ }
57
+ export interface ZodInvalidEnumValueIssue extends ZodIssueBase {
58
+ received: string | number;
59
+ code: typeof ZodIssueCode.invalid_enum_value;
60
+ options: (string | number)[];
61
+ }
62
+ export interface ZodInvalidArgumentsIssue extends ZodIssueBase {
63
+ code: typeof ZodIssueCode.invalid_arguments;
64
+ argumentsError: ZodError;
65
+ }
66
+ export interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
67
+ code: typeof ZodIssueCode.invalid_return_type;
68
+ returnTypeError: ZodError;
69
+ }
70
+ export interface ZodInvalidDateIssue extends ZodIssueBase {
71
+ code: typeof ZodIssueCode.invalid_date;
72
+ }
73
+ export type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
74
+ includes: string;
75
+ position?: number | undefined;
76
+ } | {
77
+ startsWith: string;
78
+ } | {
79
+ endsWith: string;
80
+ };
81
+ export interface ZodInvalidStringIssue extends ZodIssueBase {
82
+ code: typeof ZodIssueCode.invalid_string;
83
+ validation: StringValidation;
84
+ }
85
+ export interface ZodTooSmallIssue extends ZodIssueBase {
86
+ code: typeof ZodIssueCode.too_small;
87
+ minimum: number | bigint;
88
+ inclusive: boolean;
89
+ exact?: boolean;
90
+ type: "array" | "string" | "number" | "set" | "date" | "bigint";
91
+ }
92
+ export interface ZodTooBigIssue extends ZodIssueBase {
93
+ code: typeof ZodIssueCode.too_big;
94
+ maximum: number | bigint;
95
+ inclusive: boolean;
96
+ exact?: boolean;
97
+ type: "array" | "string" | "number" | "set" | "date" | "bigint";
98
+ }
99
+ export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
100
+ code: typeof ZodIssueCode.invalid_intersection_types;
101
+ }
102
+ export interface ZodNotMultipleOfIssue extends ZodIssueBase {
103
+ code: typeof ZodIssueCode.not_multiple_of;
104
+ multipleOf: number | bigint;
105
+ }
106
+ export interface ZodNotFiniteIssue extends ZodIssueBase {
107
+ code: typeof ZodIssueCode.not_finite;
108
+ }
109
+ export interface ZodCustomIssue extends ZodIssueBase {
110
+ code: typeof ZodIssueCode.custom;
111
+ params?: {
112
+ [k: string]: any;
113
+ };
114
+ }
115
+ export type DenormalizedError = {
116
+ [k: string]: DenormalizedError | string[];
117
+ };
118
+ export type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
119
+ export type ZodIssue = ZodIssueOptionalMessage & {
120
+ fatal?: boolean | undefined;
121
+ message: string;
122
+ };
123
+ export declare const quotelessJson: (obj: any) => string;
124
+ type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? {
125
+ [K in keyof T]?: ZodFormattedError<T[K]>;
126
+ } : T extends any[] ? {
127
+ [k: number]: ZodFormattedError<T[number]>;
128
+ } : T extends object ? {
129
+ [K in keyof T]?: ZodFormattedError<T[K]>;
130
+ } : unknown;
131
+ export type ZodFormattedError<T, U = string> = {
132
+ _errors: U[];
133
+ } & recursiveZodFormattedError<NonNullable<T>>;
134
+ export type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
135
+ export declare class ZodError<T = any> extends Error {
136
+ issues: ZodIssue[];
137
+ get errors(): ZodIssue[];
138
+ constructor(issues: ZodIssue[]);
139
+ format(): ZodFormattedError<T>;
140
+ format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
141
+ static create: (issues: ZodIssue[]) => ZodError<any>;
142
+ static assert(value: unknown): asserts value is ZodError;
143
+ toString(): string;
144
+ get message(): string;
145
+ get isEmpty(): boolean;
146
+ addIssue: (sub: ZodIssue) => void;
147
+ addIssues: (subs?: ZodIssue[]) => void;
148
+ flatten(): typeToFlattenedError<T>;
149
+ flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
150
+ get formErrors(): typeToFlattenedError<T, string>;
151
+ }
152
+ type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
153
+ export type IssueData = stripPath<ZodIssueOptionalMessage> & {
154
+ path?: (string | number)[];
155
+ fatal?: boolean | undefined;
156
+ };
157
+ export type ErrorMapCtx = {
158
+ defaultError: string;
159
+ data: any;
160
+ };
161
+ export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
162
+ message: string;
163
+ };
164
+ export {};
node_modules/@jimp/plugin-blit/node_modules/zod/v3/ZodError.js ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { util } from "./helpers/util.js";
2
+ export const ZodIssueCode = util.arrayToEnum([
3
+ "invalid_type",
4
+ "invalid_literal",
5
+ "custom",
6
+ "invalid_union",
7
+ "invalid_union_discriminator",
8
+ "invalid_enum_value",
9
+ "unrecognized_keys",
10
+ "invalid_arguments",
11
+ "invalid_return_type",
12
+ "invalid_date",
13
+ "invalid_string",
14
+ "too_small",
15
+ "too_big",
16
+ "invalid_intersection_types",
17
+ "not_multiple_of",
18
+ "not_finite",
19
+ ]);
20
+ export const quotelessJson = (obj) => {
21
+ const json = JSON.stringify(obj, null, 2);
22
+ return json.replace(/"([^"]+)":/g, "$1:");
23
+ };
24
+ export class ZodError extends Error {
25
+ get errors() {
26
+ return this.issues;
27
+ }
28
+ constructor(issues) {
29
+ super();
30
+ this.issues = [];
31
+ this.addIssue = (sub) => {
32
+ this.issues = [...this.issues, sub];
33
+ };
34
+ this.addIssues = (subs = []) => {
35
+ this.issues = [...this.issues, ...subs];
36
+ };
37
+ const actualProto = new.target.prototype;
38
+ if (Object.setPrototypeOf) {
39
+ // eslint-disable-next-line ban/ban
40
+ Object.setPrototypeOf(this, actualProto);
41
+ }
42
+ else {
43
+ this.__proto__ = actualProto;
44
+ }
45
+ this.name = "ZodError";
46
+ this.issues = issues;
47
+ }
48
+ format(_mapper) {
49
+ const mapper = _mapper ||
50
+ function (issue) {
51
+ return issue.message;
52
+ };
53
+ const fieldErrors = { _errors: [] };
54
+ const processError = (error) => {
55
+ for (const issue of error.issues) {
56
+ if (issue.code === "invalid_union") {
57
+ issue.unionErrors.map(processError);
58
+ }
59
+ else if (issue.code === "invalid_return_type") {
60
+ processError(issue.returnTypeError);
61
+ }
62
+ else if (issue.code === "invalid_arguments") {
63
+ processError(issue.argumentsError);
64
+ }
65
+ else if (issue.path.length === 0) {
66
+ fieldErrors._errors.push(mapper(issue));
67
+ }
68
+ else {
69
+ let curr = fieldErrors;
70
+ let i = 0;
71
+ while (i < issue.path.length) {
72
+ const el = issue.path[i];
73
+ const terminal = i === issue.path.length - 1;
74
+ if (!terminal) {
75
+ curr[el] = curr[el] || { _errors: [] };
76
+ // if (typeof el === "string") {
77
+ // curr[el] = curr[el] || { _errors: [] };
78
+ // } else if (typeof el === "number") {
79
+ // const errorArray: any = [];
80
+ // errorArray._errors = [];
81
+ // curr[el] = curr[el] || errorArray;
82
+ // }
83
+ }
84
+ else {
85
+ curr[el] = curr[el] || { _errors: [] };
86
+ curr[el]._errors.push(mapper(issue));
87
+ }
88
+ curr = curr[el];
89
+ i++;
90
+ }
91
+ }
92
+ }
93
+ };
94
+ processError(this);
95
+ return fieldErrors;
96
+ }
97
+ static assert(value) {
98
+ if (!(value instanceof ZodError)) {
99
+ throw new Error(`Not a ZodError: ${value}`);
100
+ }
101
+ }
102
+ toString() {
103
+ return this.message;
104
+ }
105
+ get message() {
106
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
107
+ }
108
+ get isEmpty() {
109
+ return this.issues.length === 0;
110
+ }
111
+ flatten(mapper = (issue) => issue.message) {
112
+ const fieldErrors = {};
113
+ const formErrors = [];
114
+ for (const sub of this.issues) {
115
+ if (sub.path.length > 0) {
116
+ const firstEl = sub.path[0];
117
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
118
+ fieldErrors[firstEl].push(mapper(sub));
119
+ }
120
+ else {
121
+ formErrors.push(mapper(sub));
122
+ }
123
+ }
124
+ return { formErrors, fieldErrors };
125
+ }
126
+ get formErrors() {
127
+ return this.flatten();
128
+ }
129
+ }
130
+ ZodError.create = (issues) => {
131
+ const error = new ZodError(issues);
132
+ return error;
133
+ };
node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.cjs ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.defaultErrorMap = void 0;
7
+ exports.setErrorMap = setErrorMap;
8
+ exports.getErrorMap = getErrorMap;
9
+ const en_js_1 = __importDefault(require("./locales/en.cjs"));
10
+ exports.defaultErrorMap = en_js_1.default;
11
+ let overrideErrorMap = en_js_1.default;
12
+ function setErrorMap(map) {
13
+ overrideErrorMap = map;
14
+ }
15
+ function getErrorMap() {
16
+ return overrideErrorMap;
17
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.d.cts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import type { ZodErrorMap } from "./ZodError.cjs";
2
+ import defaultErrorMap from "./locales/en.cjs";
3
+ export { defaultErrorMap };
4
+ export declare function setErrorMap(map: ZodErrorMap): void;
5
+ export declare function getErrorMap(): ZodErrorMap;
node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.d.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import type { ZodErrorMap } from "./ZodError.js";
2
+ import defaultErrorMap from "./locales/en.js";
3
+ export { defaultErrorMap };
4
+ export declare function setErrorMap(map: ZodErrorMap): void;
5
+ export declare function getErrorMap(): ZodErrorMap;
node_modules/@jimp/plugin-blit/node_modules/zod/v3/errors.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import defaultErrorMap from "./locales/en.js";
2
+ let overrideErrorMap = defaultErrorMap;
3
+ export { defaultErrorMap };
4
+ export function setErrorMap(map) {
5
+ overrideErrorMap = map;
6
+ }
7
+ export function getErrorMap() {
8
+ return overrideErrorMap;
9
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.cjs ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./errors.cjs"), exports);
18
+ __exportStar(require("./helpers/parseUtil.cjs"), exports);
19
+ __exportStar(require("./helpers/typeAliases.cjs"), exports);
20
+ __exportStar(require("./helpers/util.cjs"), exports);
21
+ __exportStar(require("./types.cjs"), exports);
22
+ __exportStar(require("./ZodError.cjs"), exports);
node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.d.cts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export * from "./errors.cjs";
2
+ export * from "./helpers/parseUtil.cjs";
3
+ export * from "./helpers/typeAliases.cjs";
4
+ export * from "./helpers/util.cjs";
5
+ export * from "./types.cjs";
6
+ export * from "./ZodError.cjs";
node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.d.ts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export * from "./errors.js";
2
+ export * from "./helpers/parseUtil.js";
3
+ export * from "./helpers/typeAliases.js";
4
+ export * from "./helpers/util.js";
5
+ export * from "./types.js";
6
+ export * from "./ZodError.js";
node_modules/@jimp/plugin-blit/node_modules/zod/v3/external.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export * from "./errors.js";
2
+ export * from "./helpers/parseUtil.js";
3
+ export * from "./helpers/typeAliases.js";
4
+ export * from "./helpers/util.js";
5
+ export * from "./types.js";
6
+ export * from "./ZodError.js";
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/enumUtil.cjs ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/enumUtil.d.cts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ export declare namespace enumUtil {
2
+ type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
3
+ type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
4
+ type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
5
+ type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
6
+ export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
7
+ export {};
8
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/enumUtil.d.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ export declare namespace enumUtil {
2
+ type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
3
+ type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
4
+ type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
5
+ type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
6
+ export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
7
+ export {};
8
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/enumUtil.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export {};
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.cjs ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.errorUtil = void 0;
4
+ var errorUtil;
5
+ (function (errorUtil) {
6
+ errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
7
+ // biome-ignore lint:
8
+ errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
9
+ })(errorUtil || (exports.errorUtil = errorUtil = {}));
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.d.cts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ export declare namespace errorUtil {
2
+ type ErrMessage = string | {
3
+ message?: string | undefined;
4
+ };
5
+ const errToObj: (message?: ErrMessage) => {
6
+ message?: string | undefined;
7
+ };
8
+ const toString: (message?: ErrMessage) => string | undefined;
9
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.d.ts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ export declare namespace errorUtil {
2
+ type ErrMessage = string | {
3
+ message?: string | undefined;
4
+ };
5
+ const errToObj: (message?: ErrMessage) => {
6
+ message?: string | undefined;
7
+ };
8
+ const toString: (message?: ErrMessage) => string | undefined;
9
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/errorUtil.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export var errorUtil;
2
+ (function (errorUtil) {
3
+ errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
4
+ // biome-ignore lint:
5
+ errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
6
+ })(errorUtil || (errorUtil = {}));
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.cjs ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.EMPTY_PATH = exports.makeIssue = void 0;
7
+ exports.addIssueToContext = addIssueToContext;
8
+ const errors_js_1 = require("../errors.cjs");
9
+ const en_js_1 = __importDefault(require("../locales/en.cjs"));
10
+ const makeIssue = (params) => {
11
+ const { data, path, errorMaps, issueData } = params;
12
+ const fullPath = [...path, ...(issueData.path || [])];
13
+ const fullIssue = {
14
+ ...issueData,
15
+ path: fullPath,
16
+ };
17
+ if (issueData.message !== undefined) {
18
+ return {
19
+ ...issueData,
20
+ path: fullPath,
21
+ message: issueData.message,
22
+ };
23
+ }
24
+ let errorMessage = "";
25
+ const maps = errorMaps
26
+ .filter((m) => !!m)
27
+ .slice()
28
+ .reverse();
29
+ for (const map of maps) {
30
+ errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
31
+ }
32
+ return {
33
+ ...issueData,
34
+ path: fullPath,
35
+ message: errorMessage,
36
+ };
37
+ };
38
+ exports.makeIssue = makeIssue;
39
+ exports.EMPTY_PATH = [];
40
+ function addIssueToContext(ctx, issueData) {
41
+ const overrideMap = (0, errors_js_1.getErrorMap)();
42
+ const issue = (0, exports.makeIssue)({
43
+ issueData: issueData,
44
+ data: ctx.data,
45
+ path: ctx.path,
46
+ errorMaps: [
47
+ ctx.common.contextualErrorMap, // contextual error map is first priority
48
+ ctx.schemaErrorMap, // then schema-bound map if available
49
+ overrideMap, // then global override map
50
+ overrideMap === en_js_1.default ? undefined : en_js_1.default, // then global default map
51
+ ].filter((x) => !!x),
52
+ });
53
+ ctx.common.issues.push(issue);
54
+ }
55
+ class ParseStatus {
56
+ constructor() {
57
+ this.value = "valid";
58
+ }
59
+ dirty() {
60
+ if (this.value === "valid")
61
+ this.value = "dirty";
62
+ }
63
+ abort() {
64
+ if (this.value !== "aborted")
65
+ this.value = "aborted";
66
+ }
67
+ static mergeArray(status, results) {
68
+ const arrayValue = [];
69
+ for (const s of results) {
70
+ if (s.status === "aborted")
71
+ return exports.INVALID;
72
+ if (s.status === "dirty")
73
+ status.dirty();
74
+ arrayValue.push(s.value);
75
+ }
76
+ return { status: status.value, value: arrayValue };
77
+ }
78
+ static async mergeObjectAsync(status, pairs) {
79
+ const syncPairs = [];
80
+ for (const pair of pairs) {
81
+ const key = await pair.key;
82
+ const value = await pair.value;
83
+ syncPairs.push({
84
+ key,
85
+ value,
86
+ });
87
+ }
88
+ return ParseStatus.mergeObjectSync(status, syncPairs);
89
+ }
90
+ static mergeObjectSync(status, pairs) {
91
+ const finalObject = {};
92
+ for (const pair of pairs) {
93
+ const { key, value } = pair;
94
+ if (key.status === "aborted")
95
+ return exports.INVALID;
96
+ if (value.status === "aborted")
97
+ return exports.INVALID;
98
+ if (key.status === "dirty")
99
+ status.dirty();
100
+ if (value.status === "dirty")
101
+ status.dirty();
102
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
103
+ finalObject[key.value] = value.value;
104
+ }
105
+ }
106
+ return { status: status.value, value: finalObject };
107
+ }
108
+ }
109
+ exports.ParseStatus = ParseStatus;
110
+ exports.INVALID = Object.freeze({
111
+ status: "aborted",
112
+ });
113
+ const DIRTY = (value) => ({ status: "dirty", value });
114
+ exports.DIRTY = DIRTY;
115
+ const OK = (value) => ({ status: "valid", value });
116
+ exports.OK = OK;
117
+ const isAborted = (x) => x.status === "aborted";
118
+ exports.isAborted = isAborted;
119
+ const isDirty = (x) => x.status === "dirty";
120
+ exports.isDirty = isDirty;
121
+ const isValid = (x) => x.status === "valid";
122
+ exports.isValid = isValid;
123
+ const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
124
+ exports.isAsync = isAsync;
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.d.cts ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError.cjs";
2
+ import type { ZodParsedType } from "./util.cjs";
3
+ export declare const makeIssue: (params: {
4
+ data: any;
5
+ path: (string | number)[];
6
+ errorMaps: ZodErrorMap[];
7
+ issueData: IssueData;
8
+ }) => ZodIssue;
9
+ export type ParseParams = {
10
+ path: (string | number)[];
11
+ errorMap: ZodErrorMap;
12
+ async: boolean;
13
+ };
14
+ export type ParsePathComponent = string | number;
15
+ export type ParsePath = ParsePathComponent[];
16
+ export declare const EMPTY_PATH: ParsePath;
17
+ export interface ParseContext {
18
+ readonly common: {
19
+ readonly issues: ZodIssue[];
20
+ readonly contextualErrorMap?: ZodErrorMap | undefined;
21
+ readonly async: boolean;
22
+ };
23
+ readonly path: ParsePath;
24
+ readonly schemaErrorMap?: ZodErrorMap | undefined;
25
+ readonly parent: ParseContext | null;
26
+ readonly data: any;
27
+ readonly parsedType: ZodParsedType;
28
+ }
29
+ export type ParseInput = {
30
+ data: any;
31
+ path: (string | number)[];
32
+ parent: ParseContext;
33
+ };
34
+ export declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
35
+ export type ObjectPair = {
36
+ key: SyncParseReturnType<any>;
37
+ value: SyncParseReturnType<any>;
38
+ };
39
+ export declare class ParseStatus {
40
+ value: "aborted" | "dirty" | "valid";
41
+ dirty(): void;
42
+ abort(): void;
43
+ static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
44
+ static mergeObjectAsync(status: ParseStatus, pairs: {
45
+ key: ParseReturnType<any>;
46
+ value: ParseReturnType<any>;
47
+ }[]): Promise<SyncParseReturnType<any>>;
48
+ static mergeObjectSync(status: ParseStatus, pairs: {
49
+ key: SyncParseReturnType<any>;
50
+ value: SyncParseReturnType<any>;
51
+ alwaysSet?: boolean;
52
+ }[]): SyncParseReturnType;
53
+ }
54
+ export interface ParseResult {
55
+ status: "aborted" | "dirty" | "valid";
56
+ data: any;
57
+ }
58
+ export type INVALID = {
59
+ status: "aborted";
60
+ };
61
+ export declare const INVALID: INVALID;
62
+ export type DIRTY<T> = {
63
+ status: "dirty";
64
+ value: T;
65
+ };
66
+ export declare const DIRTY: <T>(value: T) => DIRTY<T>;
67
+ export type OK<T> = {
68
+ status: "valid";
69
+ value: T;
70
+ };
71
+ export declare const OK: <T>(value: T) => OK<T>;
72
+ export type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
73
+ export type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
74
+ export type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
75
+ export declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
76
+ export declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
77
+ export declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
78
+ export declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.d.ts ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError.js";
2
+ import type { ZodParsedType } from "./util.js";
3
+ export declare const makeIssue: (params: {
4
+ data: any;
5
+ path: (string | number)[];
6
+ errorMaps: ZodErrorMap[];
7
+ issueData: IssueData;
8
+ }) => ZodIssue;
9
+ export type ParseParams = {
10
+ path: (string | number)[];
11
+ errorMap: ZodErrorMap;
12
+ async: boolean;
13
+ };
14
+ export type ParsePathComponent = string | number;
15
+ export type ParsePath = ParsePathComponent[];
16
+ export declare const EMPTY_PATH: ParsePath;
17
+ export interface ParseContext {
18
+ readonly common: {
19
+ readonly issues: ZodIssue[];
20
+ readonly contextualErrorMap?: ZodErrorMap | undefined;
21
+ readonly async: boolean;
22
+ };
23
+ readonly path: ParsePath;
24
+ readonly schemaErrorMap?: ZodErrorMap | undefined;
25
+ readonly parent: ParseContext | null;
26
+ readonly data: any;
27
+ readonly parsedType: ZodParsedType;
28
+ }
29
+ export type ParseInput = {
30
+ data: any;
31
+ path: (string | number)[];
32
+ parent: ParseContext;
33
+ };
34
+ export declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
35
+ export type ObjectPair = {
36
+ key: SyncParseReturnType<any>;
37
+ value: SyncParseReturnType<any>;
38
+ };
39
+ export declare class ParseStatus {
40
+ value: "aborted" | "dirty" | "valid";
41
+ dirty(): void;
42
+ abort(): void;
43
+ static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
44
+ static mergeObjectAsync(status: ParseStatus, pairs: {
45
+ key: ParseReturnType<any>;
46
+ value: ParseReturnType<any>;
47
+ }[]): Promise<SyncParseReturnType<any>>;
48
+ static mergeObjectSync(status: ParseStatus, pairs: {
49
+ key: SyncParseReturnType<any>;
50
+ value: SyncParseReturnType<any>;
51
+ alwaysSet?: boolean;
52
+ }[]): SyncParseReturnType;
53
+ }
54
+ export interface ParseResult {
55
+ status: "aborted" | "dirty" | "valid";
56
+ data: any;
57
+ }
58
+ export type INVALID = {
59
+ status: "aborted";
60
+ };
61
+ export declare const INVALID: INVALID;
62
+ export type DIRTY<T> = {
63
+ status: "dirty";
64
+ value: T;
65
+ };
66
+ export declare const DIRTY: <T>(value: T) => DIRTY<T>;
67
+ export type OK<T> = {
68
+ status: "valid";
69
+ value: T;
70
+ };
71
+ export declare const OK: <T>(value: T) => OK<T>;
72
+ export type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
73
+ export type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
74
+ export type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
75
+ export declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
76
+ export declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
77
+ export declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
78
+ export declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/parseUtil.js ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { getErrorMap } from "../errors.js";
2
+ import defaultErrorMap from "../locales/en.js";
3
+ export const makeIssue = (params) => {
4
+ const { data, path, errorMaps, issueData } = params;
5
+ const fullPath = [...path, ...(issueData.path || [])];
6
+ const fullIssue = {
7
+ ...issueData,
8
+ path: fullPath,
9
+ };
10
+ if (issueData.message !== undefined) {
11
+ return {
12
+ ...issueData,
13
+ path: fullPath,
14
+ message: issueData.message,
15
+ };
16
+ }
17
+ let errorMessage = "";
18
+ const maps = errorMaps
19
+ .filter((m) => !!m)
20
+ .slice()
21
+ .reverse();
22
+ for (const map of maps) {
23
+ errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
24
+ }
25
+ return {
26
+ ...issueData,
27
+ path: fullPath,
28
+ message: errorMessage,
29
+ };
30
+ };
31
+ export const EMPTY_PATH = [];
32
+ export function addIssueToContext(ctx, issueData) {
33
+ const overrideMap = getErrorMap();
34
+ const issue = makeIssue({
35
+ issueData: issueData,
36
+ data: ctx.data,
37
+ path: ctx.path,
38
+ errorMaps: [
39
+ ctx.common.contextualErrorMap, // contextual error map is first priority
40
+ ctx.schemaErrorMap, // then schema-bound map if available
41
+ overrideMap, // then global override map
42
+ overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map
43
+ ].filter((x) => !!x),
44
+ });
45
+ ctx.common.issues.push(issue);
46
+ }
47
+ export class ParseStatus {
48
+ constructor() {
49
+ this.value = "valid";
50
+ }
51
+ dirty() {
52
+ if (this.value === "valid")
53
+ this.value = "dirty";
54
+ }
55
+ abort() {
56
+ if (this.value !== "aborted")
57
+ this.value = "aborted";
58
+ }
59
+ static mergeArray(status, results) {
60
+ const arrayValue = [];
61
+ for (const s of results) {
62
+ if (s.status === "aborted")
63
+ return INVALID;
64
+ if (s.status === "dirty")
65
+ status.dirty();
66
+ arrayValue.push(s.value);
67
+ }
68
+ return { status: status.value, value: arrayValue };
69
+ }
70
+ static async mergeObjectAsync(status, pairs) {
71
+ const syncPairs = [];
72
+ for (const pair of pairs) {
73
+ const key = await pair.key;
74
+ const value = await pair.value;
75
+ syncPairs.push({
76
+ key,
77
+ value,
78
+ });
79
+ }
80
+ return ParseStatus.mergeObjectSync(status, syncPairs);
81
+ }
82
+ static mergeObjectSync(status, pairs) {
83
+ const finalObject = {};
84
+ for (const pair of pairs) {
85
+ const { key, value } = pair;
86
+ if (key.status === "aborted")
87
+ return INVALID;
88
+ if (value.status === "aborted")
89
+ return INVALID;
90
+ if (key.status === "dirty")
91
+ status.dirty();
92
+ if (value.status === "dirty")
93
+ status.dirty();
94
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
95
+ finalObject[key.value] = value.value;
96
+ }
97
+ }
98
+ return { status: status.value, value: finalObject };
99
+ }
100
+ }
101
+ export const INVALID = Object.freeze({
102
+ status: "aborted",
103
+ });
104
+ export const DIRTY = (value) => ({ status: "dirty", value });
105
+ export const OK = (value) => ({ status: "valid", value });
106
+ export const isAborted = (x) => x.status === "aborted";
107
+ export const isDirty = (x) => x.status === "dirty";
108
+ export const isValid = (x) => x.status === "valid";
109
+ export const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/partialUtil.cjs ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/partialUtil.d.cts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import type { ZodArray, ZodNullable, ZodObject, ZodOptional, ZodRawShape, ZodTuple, ZodTupleItems, ZodTypeAny } from "../types.cjs";
2
+ export declare namespace partialUtil {
3
+ type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
4
+ [k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
5
+ }, T["_def"]["unknownKeys"], T["_def"]["catchall"]> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
6
+ [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
7
+ } extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
8
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/partialUtil.d.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import type { ZodArray, ZodNullable, ZodObject, ZodOptional, ZodRawShape, ZodTuple, ZodTupleItems, ZodTypeAny } from "../types.js";
2
+ export declare namespace partialUtil {
3
+ type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
4
+ [k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
5
+ }, T["_def"]["unknownKeys"], T["_def"]["catchall"]> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
6
+ [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
7
+ } extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
8
+ }
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/partialUtil.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export {};
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.cjs ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.d.cts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
2
+ export type Scalars = Primitive | Primitive[];
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.d.ts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
2
+ export type Scalars = Primitive | Primitive[];
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/typeAliases.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export {};
node_modules/@jimp/plugin-blit/node_modules/zod/v3/helpers/util.cjs ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getParsedType = exports.ZodParsedType = exports.objectUtil = exports.util = void 0;
4
+ var util;
5
+ (function (util) {
6
+ util.assertEqual = (_) => { };
7
+ function assertIs(_arg) { }
8
+ util.assertIs = assertIs;
9
+ function assertNever(_x) {
10
+ throw new Error();
11
+ }
12
+ util.assertNever = assertNever;
13
+ util.arrayToEnum = (items) => {
14
+ const obj = {};
15
+ for (const item of items) {
16
+ obj[item] = item;
17
+ }
18
+ return obj;
19
+ };
20
+ util.getValidEnumValues = (obj) => {
21
+ const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
22
+ const filtered = {};
23
+ for (const k of validKeys) {
24
+ filtered[k] = obj[k];
25
+ }
26
+ return util.objectValues(filtered);
27
+ };
28
+ util.objectValues = (obj) => {
29
+ return util.objectKeys(obj).map(function (e) {
30
+ return obj[e];
31
+ });
32
+ };
33
+ util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
34
+ ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
35
+ : (object) => {
36
+ const keys = [];
37
+ for (const key in object) {
38
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
39
+ keys.push(key);
40
+ }
41
+ }
42
+ return keys;
43
+ };
44
+ util.find = (arr, checker) => {
45
+ for (const item of arr) {
46
+ if (checker(item))
47
+ return item;
48
+ }
49
+ return undefined;
50
+ };
51
+ util.isInteger = typeof Number.isInteger === "function"
52
+ ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
53
+ : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
54
+ function joinValues(array, separator = " | ") {
55
+ return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
56
+ }
57
+ util.joinValues = joinValues;
58
+ util.jsonStringifyReplacer = (_, value) => {
59
+ if (typeof value === "bigint") {
60
+ return value.toString();
61
+ }
62
+ return value;
63
+ };
64
+ })(util || (exports.util = util = {}));
65
+ var objectUtil;
66
+ (function (objectUtil) {
67
+ objectUtil.mergeShapes = (first, second) => {
68
+ return {
69
+ ...first,
70
+ ...second, // second overwrites first
71
+ };
72
+ };
73
+ })(objectUtil || (exports.objectUtil = objectUtil = {}));
74
+ exports.ZodParsedType = util.arrayToEnum([
75
+ "string",
76
+ "nan",
77
+ "number",
78
+ "integer",
79
+ "float",
80
+ "boolean",
81
+ "date",
82
+ "bigint",
83
+ "symbol",
84
+ "function",
85
+ "undefined",
86
+ "null",
87
+ "array",
88
+ "object",
89
+ "unknown",
90
+ "promise",
91
+ "void",
92
+ "never",
93
+ "map",
94
+ "set",
95
+ ]);
96
+ const getParsedType = (data) => {
97
+ const t = typeof data;
98
+ switch (t) {
99
+ case "undefined":
100
+ return exports.ZodParsedType.undefined;
101
+ case "string":
102
+ return exports.ZodParsedType.string;
103
+ case "number":
104
+ return Number.isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
105
+ case "boolean":
106
+ return exports.ZodParsedType.boolean;
107
+ case "function":
108
+ return exports.ZodParsedType.function;
109
+ case "bigint":
110
+ return exports.ZodParsedType.bigint;
111
+ case "symbol":
112
+ return exports.ZodParsedType.symbol;
113
+ case "object":
114
+ if (Array.isArray(data)) {
115
+ return exports.ZodParsedType.array;
116
+ }
117
+ if (data === null) {
118
+ return exports.ZodParsedType.null;
119
+ }
120
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
121
+ return exports.ZodParsedType.promise;
122
+ }
123
+ if (typeof Map !== "undefined" && data instanceof Map) {
124
+ return exports.ZodParsedType.map;
125
+ }
126
+ if (typeof Set !== "undefined" && data instanceof Set) {
127
+ return exports.ZodParsedType.set;
128
+ }
129
+ if (typeof Date !== "undefined" && data instanceof Date) {
130
+ return exports.ZodParsedType.date;
131
+ }
132
+ return exports.ZodParsedType.object;
133
+ default:
134
+ return exports.ZodParsedType.unknown;
135
+ }
136
+ };
137
+ exports.getParsedType = getParsedType;