(input)
| 31999 | }; |
| 32000 | var ZodSet = class _ZodSet extends ZodType { |
| 32001 | _parse(input) { |
| 32002 | const { status, ctx } = this._processInputParams(input); |
| 32003 | if (ctx.parsedType !== util_1.ZodParsedType.set) { |
| 32004 | (0, parseUtil_1.addIssueToContext)(ctx, { |
| 32005 | code: ZodError_1.ZodIssueCode.invalid_type, |
| 32006 | expected: util_1.ZodParsedType.set, |
| 32007 | received: ctx.parsedType |
| 32008 | }); |
| 32009 | return parseUtil_1.INVALID; |
| 32010 | } |
| 32011 | const def = this._def; |
| 32012 | if (def.minSize !== null) { |
| 32013 | if (ctx.data.size < def.minSize.value) { |
| 32014 | (0, parseUtil_1.addIssueToContext)(ctx, { |
| 32015 | code: ZodError_1.ZodIssueCode.too_small, |
| 32016 | minimum: def.minSize.value, |
| 32017 | type: "set", |
| 32018 | inclusive: true, |
| 32019 | exact: false, |
| 32020 | message: def.minSize.message |
| 32021 | }); |
| 32022 | status.dirty(); |
| 32023 | } |
| 32024 | } |
| 32025 | if (def.maxSize !== null) { |
| 32026 | if (ctx.data.size > def.maxSize.value) { |
| 32027 | (0, parseUtil_1.addIssueToContext)(ctx, { |
| 32028 | code: ZodError_1.ZodIssueCode.too_big, |
| 32029 | maximum: def.maxSize.value, |
| 32030 | type: "set", |
| 32031 | inclusive: true, |
| 32032 | exact: false, |
| 32033 | message: def.maxSize.message |
| 32034 | }); |
| 32035 | status.dirty(); |
| 32036 | } |
| 32037 | } |
| 32038 | const valueType = this._def.valueType; |
| 32039 | function finalizeSet(elements2) { |
| 32040 | const parsedSet = /* @__PURE__ */ new Set(); |
| 32041 | for (const element of elements2) { |
| 32042 | if (element.status === "aborted") |
| 32043 | return parseUtil_1.INVALID; |
| 32044 | if (element.status === "dirty") |
| 32045 | status.dirty(); |
| 32046 | parsedSet.add(element.value); |
| 32047 | } |
| 32048 | return { status: status.value, value: parsedSet }; |
| 32049 | } |
| 32050 | const elements = [...ctx.data.values()].map((item, i3) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i3))); |
| 32051 | if (ctx.common.async) { |
| 32052 | return Promise.all(elements).then((elements2) => finalizeSet(elements2)); |
| 32053 | } else { |
| 32054 | return finalizeSet(elements); |
| 32055 | } |
| 32056 | } |
| 32057 | min(minSize, message) { |
| 32058 | return new _ZodSet({ |
nothing calls this directly
no test coverage detected