@t2000/cli 0.22.21 → 0.22.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/{ccip-3TXHQUZ5.js → ccip-JEEJV65M.js} +3 -3
  2. package/dist/{chunk-3W7OQGNS.js → chunk-3XUF7GM3.js} +21 -42
  3. package/dist/chunk-3XUF7GM3.js.map +1 -0
  4. package/dist/chunk-77SWBATH.js +204 -0
  5. package/dist/chunk-77SWBATH.js.map +1 -0
  6. package/dist/{chunk-ML6HST4W.js → chunk-A5X4KG7U.js} +1878 -341
  7. package/dist/chunk-A5X4KG7U.js.map +1 -0
  8. package/dist/{chunk-VREOXJUB.js → chunk-EEPD7SHV.js} +15455 -14941
  9. package/dist/chunk-EEPD7SHV.js.map +1 -0
  10. package/dist/chunk-KHIL2KNW.js +4016 -0
  11. package/dist/chunk-KHIL2KNW.js.map +1 -0
  12. package/dist/{chunk-ZNF5QSAT.js → chunk-RN7Z6TWD.js} +33444 -24623
  13. package/dist/chunk-RN7Z6TWD.js.map +1 -0
  14. package/dist/{chunk-AB65Y674.js → chunk-V7PXDEKG.js} +2 -2
  15. package/dist/chunk-V7PXDEKG.js.map +1 -0
  16. package/dist/client-I4SGZLVD.js +746 -0
  17. package/dist/client-I4SGZLVD.js.map +1 -0
  18. package/dist/{client-SYS6Z5RX.js → client-R3NRAXMD.js} +5715 -2933
  19. package/dist/client-R3NRAXMD.js.map +1 -0
  20. package/dist/{dist-73ESA7QZ.js → dist-FDS4MNUV.js} +135 -4160
  21. package/dist/dist-FDS4MNUV.js.map +1 -0
  22. package/dist/{dist-IANNA5N7.js → dist-G5YKLWC5.js} +5 -5
  23. package/dist/{esm-IQVNJILX.js → esm-QBJBHFZA.js} +11 -11
  24. package/dist/esm-QBJBHFZA.js.map +1 -0
  25. package/dist/index.js +48 -36
  26. package/dist/index.js.map +1 -1
  27. package/package.json +4 -4
  28. package/dist/chunk-3W7OQGNS.js.map +0 -1
  29. package/dist/chunk-AB65Y674.js.map +0 -1
  30. package/dist/chunk-H66DC3S3.js +0 -1908
  31. package/dist/chunk-H66DC3S3.js.map +0 -1
  32. package/dist/chunk-IHPSFXUW.js +0 -5002
  33. package/dist/chunk-IHPSFXUW.js.map +0 -1
  34. package/dist/chunk-ML6HST4W.js.map +0 -1
  35. package/dist/chunk-VREOXJUB.js.map +0 -1
  36. package/dist/chunk-ZNF5QSAT.js.map +0 -1
  37. package/dist/client-4DBCJNJO.js +0 -117
  38. package/dist/client-4DBCJNJO.js.map +0 -1
  39. package/dist/client-SYS6Z5RX.js.map +0 -1
  40. package/dist/dist-73ESA7QZ.js.map +0 -1
  41. package/dist/esm-IQVNJILX.js.map +0 -1
  42. /package/dist/{ccip-3TXHQUZ5.js.map → ccip-JEEJV65M.js.map} +0 -0
  43. /package/dist/{dist-IANNA5N7.js.map → dist-G5YKLWC5.js.map} +0 -0
@@ -3,11 +3,15 @@ import {
3
3
  INVESTMENT_ASSETS,
4
4
  SafeguardError,
5
5
  T2000,
6
- T2000Error
7
- } from "./chunk-ZNF5QSAT.js";
8
- import "./chunk-AB65Y674.js";
9
- import "./chunk-IHPSFXUW.js";
10
- import "./chunk-3W7OQGNS.js";
6
+ T2000Error,
7
+ ZodFirstPartyTypeKind,
8
+ ZodOptional,
9
+ external_exports,
10
+ objectType
11
+ } from "./chunk-RN7Z6TWD.js";
12
+ import "./chunk-V7PXDEKG.js";
13
+ import "./chunk-KHIL2KNW.js";
14
+ import "./chunk-3XUF7GM3.js";
11
15
  import {
12
16
  __commonJS,
13
17
  __export,
@@ -1125,9 +1129,9 @@ var require_util = __commonJS({
1125
1129
  }
1126
1130
  }
1127
1131
  exports.eachItem = eachItem;
1128
- function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues: mergeValues3, resultToName }) {
1132
+ function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues: mergeValues2, resultToName }) {
1129
1133
  return (gen, from, to, toName) => {
1130
- const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues3(from, to);
1134
+ const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues2(from, to);
1131
1135
  return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
1132
1136
  };
1133
1137
  }
@@ -6783,4049 +6787,8 @@ var require_dist = __commonJS({
6783
6787
  }
6784
6788
  });
6785
6789
 
6786
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
6787
- var external_exports = {};
6788
- __export(external_exports, {
6789
- BRAND: () => BRAND,
6790
- DIRTY: () => DIRTY,
6791
- EMPTY_PATH: () => EMPTY_PATH,
6792
- INVALID: () => INVALID,
6793
- NEVER: () => NEVER,
6794
- OK: () => OK,
6795
- ParseStatus: () => ParseStatus,
6796
- Schema: () => ZodType,
6797
- ZodAny: () => ZodAny,
6798
- ZodArray: () => ZodArray,
6799
- ZodBigInt: () => ZodBigInt,
6800
- ZodBoolean: () => ZodBoolean,
6801
- ZodBranded: () => ZodBranded,
6802
- ZodCatch: () => ZodCatch,
6803
- ZodDate: () => ZodDate,
6804
- ZodDefault: () => ZodDefault,
6805
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
6806
- ZodEffects: () => ZodEffects,
6807
- ZodEnum: () => ZodEnum,
6808
- ZodError: () => ZodError,
6809
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
6810
- ZodFunction: () => ZodFunction,
6811
- ZodIntersection: () => ZodIntersection,
6812
- ZodIssueCode: () => ZodIssueCode,
6813
- ZodLazy: () => ZodLazy,
6814
- ZodLiteral: () => ZodLiteral,
6815
- ZodMap: () => ZodMap,
6816
- ZodNaN: () => ZodNaN,
6817
- ZodNativeEnum: () => ZodNativeEnum,
6818
- ZodNever: () => ZodNever,
6819
- ZodNull: () => ZodNull,
6820
- ZodNullable: () => ZodNullable,
6821
- ZodNumber: () => ZodNumber,
6822
- ZodObject: () => ZodObject,
6823
- ZodOptional: () => ZodOptional,
6824
- ZodParsedType: () => ZodParsedType,
6825
- ZodPipeline: () => ZodPipeline,
6826
- ZodPromise: () => ZodPromise,
6827
- ZodReadonly: () => ZodReadonly,
6828
- ZodRecord: () => ZodRecord,
6829
- ZodSchema: () => ZodType,
6830
- ZodSet: () => ZodSet,
6831
- ZodString: () => ZodString,
6832
- ZodSymbol: () => ZodSymbol,
6833
- ZodTransformer: () => ZodEffects,
6834
- ZodTuple: () => ZodTuple,
6835
- ZodType: () => ZodType,
6836
- ZodUndefined: () => ZodUndefined,
6837
- ZodUnion: () => ZodUnion,
6838
- ZodUnknown: () => ZodUnknown,
6839
- ZodVoid: () => ZodVoid,
6840
- addIssueToContext: () => addIssueToContext,
6841
- any: () => anyType,
6842
- array: () => arrayType,
6843
- bigint: () => bigIntType,
6844
- boolean: () => booleanType,
6845
- coerce: () => coerce,
6846
- custom: () => custom,
6847
- date: () => dateType,
6848
- datetimeRegex: () => datetimeRegex,
6849
- defaultErrorMap: () => en_default,
6850
- discriminatedUnion: () => discriminatedUnionType,
6851
- effect: () => effectsType,
6852
- enum: () => enumType,
6853
- function: () => functionType,
6854
- getErrorMap: () => getErrorMap,
6855
- getParsedType: () => getParsedType,
6856
- instanceof: () => instanceOfType,
6857
- intersection: () => intersectionType,
6858
- isAborted: () => isAborted,
6859
- isAsync: () => isAsync,
6860
- isDirty: () => isDirty,
6861
- isValid: () => isValid,
6862
- late: () => late,
6863
- lazy: () => lazyType,
6864
- literal: () => literalType,
6865
- makeIssue: () => makeIssue,
6866
- map: () => mapType,
6867
- nan: () => nanType,
6868
- nativeEnum: () => nativeEnumType,
6869
- never: () => neverType,
6870
- null: () => nullType,
6871
- nullable: () => nullableType,
6872
- number: () => numberType,
6873
- object: () => objectType,
6874
- objectUtil: () => objectUtil,
6875
- oboolean: () => oboolean,
6876
- onumber: () => onumber,
6877
- optional: () => optionalType,
6878
- ostring: () => ostring,
6879
- pipeline: () => pipelineType,
6880
- preprocess: () => preprocessType,
6881
- promise: () => promiseType,
6882
- quotelessJson: () => quotelessJson,
6883
- record: () => recordType,
6884
- set: () => setType,
6885
- setErrorMap: () => setErrorMap,
6886
- strictObject: () => strictObjectType,
6887
- string: () => stringType,
6888
- symbol: () => symbolType,
6889
- transformer: () => effectsType,
6890
- tuple: () => tupleType,
6891
- undefined: () => undefinedType,
6892
- union: () => unionType,
6893
- unknown: () => unknownType,
6894
- util: () => util,
6895
- void: () => voidType
6896
- });
6897
-
6898
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
6899
- var util;
6900
- (function(util2) {
6901
- util2.assertEqual = (_) => {
6902
- };
6903
- function assertIs2(_arg) {
6904
- }
6905
- util2.assertIs = assertIs2;
6906
- function assertNever2(_x) {
6907
- throw new Error();
6908
- }
6909
- util2.assertNever = assertNever2;
6910
- util2.arrayToEnum = (items) => {
6911
- const obj = {};
6912
- for (const item of items) {
6913
- obj[item] = item;
6914
- }
6915
- return obj;
6916
- };
6917
- util2.getValidEnumValues = (obj) => {
6918
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
6919
- const filtered = {};
6920
- for (const k of validKeys) {
6921
- filtered[k] = obj[k];
6922
- }
6923
- return util2.objectValues(filtered);
6924
- };
6925
- util2.objectValues = (obj) => {
6926
- return util2.objectKeys(obj).map(function(e) {
6927
- return obj[e];
6928
- });
6929
- };
6930
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
6931
- const keys = [];
6932
- for (const key in object3) {
6933
- if (Object.prototype.hasOwnProperty.call(object3, key)) {
6934
- keys.push(key);
6935
- }
6936
- }
6937
- return keys;
6938
- };
6939
- util2.find = (arr, checker) => {
6940
- for (const item of arr) {
6941
- if (checker(item))
6942
- return item;
6943
- }
6944
- return void 0;
6945
- };
6946
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
6947
- function joinValues2(array2, separator = " | ") {
6948
- return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
6949
- }
6950
- util2.joinValues = joinValues2;
6951
- util2.jsonStringifyReplacer = (_, value) => {
6952
- if (typeof value === "bigint") {
6953
- return value.toString();
6954
- }
6955
- return value;
6956
- };
6957
- })(util || (util = {}));
6958
- var objectUtil;
6959
- (function(objectUtil2) {
6960
- objectUtil2.mergeShapes = (first, second) => {
6961
- return {
6962
- ...first,
6963
- ...second
6964
- // second overwrites first
6965
- };
6966
- };
6967
- })(objectUtil || (objectUtil = {}));
6968
- var ZodParsedType = util.arrayToEnum([
6969
- "string",
6970
- "nan",
6971
- "number",
6972
- "integer",
6973
- "float",
6974
- "boolean",
6975
- "date",
6976
- "bigint",
6977
- "symbol",
6978
- "function",
6979
- "undefined",
6980
- "null",
6981
- "array",
6982
- "object",
6983
- "unknown",
6984
- "promise",
6985
- "void",
6986
- "never",
6987
- "map",
6988
- "set"
6989
- ]);
6990
- var getParsedType = (data) => {
6991
- const t = typeof data;
6992
- switch (t) {
6993
- case "undefined":
6994
- return ZodParsedType.undefined;
6995
- case "string":
6996
- return ZodParsedType.string;
6997
- case "number":
6998
- return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
6999
- case "boolean":
7000
- return ZodParsedType.boolean;
7001
- case "function":
7002
- return ZodParsedType.function;
7003
- case "bigint":
7004
- return ZodParsedType.bigint;
7005
- case "symbol":
7006
- return ZodParsedType.symbol;
7007
- case "object":
7008
- if (Array.isArray(data)) {
7009
- return ZodParsedType.array;
7010
- }
7011
- if (data === null) {
7012
- return ZodParsedType.null;
7013
- }
7014
- if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
7015
- return ZodParsedType.promise;
7016
- }
7017
- if (typeof Map !== "undefined" && data instanceof Map) {
7018
- return ZodParsedType.map;
7019
- }
7020
- if (typeof Set !== "undefined" && data instanceof Set) {
7021
- return ZodParsedType.set;
7022
- }
7023
- if (typeof Date !== "undefined" && data instanceof Date) {
7024
- return ZodParsedType.date;
7025
- }
7026
- return ZodParsedType.object;
7027
- default:
7028
- return ZodParsedType.unknown;
7029
- }
7030
- };
7031
-
7032
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
7033
- var ZodIssueCode = util.arrayToEnum([
7034
- "invalid_type",
7035
- "invalid_literal",
7036
- "custom",
7037
- "invalid_union",
7038
- "invalid_union_discriminator",
7039
- "invalid_enum_value",
7040
- "unrecognized_keys",
7041
- "invalid_arguments",
7042
- "invalid_return_type",
7043
- "invalid_date",
7044
- "invalid_string",
7045
- "too_small",
7046
- "too_big",
7047
- "invalid_intersection_types",
7048
- "not_multiple_of",
7049
- "not_finite"
7050
- ]);
7051
- var quotelessJson = (obj) => {
7052
- const json = JSON.stringify(obj, null, 2);
7053
- return json.replace(/"([^"]+)":/g, "$1:");
7054
- };
7055
- var ZodError = class _ZodError extends Error {
7056
- get errors() {
7057
- return this.issues;
7058
- }
7059
- constructor(issues) {
7060
- super();
7061
- this.issues = [];
7062
- this.addIssue = (sub) => {
7063
- this.issues = [...this.issues, sub];
7064
- };
7065
- this.addIssues = (subs = []) => {
7066
- this.issues = [...this.issues, ...subs];
7067
- };
7068
- const actualProto = new.target.prototype;
7069
- if (Object.setPrototypeOf) {
7070
- Object.setPrototypeOf(this, actualProto);
7071
- } else {
7072
- this.__proto__ = actualProto;
7073
- }
7074
- this.name = "ZodError";
7075
- this.issues = issues;
7076
- }
7077
- format(_mapper) {
7078
- const mapper = _mapper || function(issue2) {
7079
- return issue2.message;
7080
- };
7081
- const fieldErrors = { _errors: [] };
7082
- const processError = (error2) => {
7083
- for (const issue2 of error2.issues) {
7084
- if (issue2.code === "invalid_union") {
7085
- issue2.unionErrors.map(processError);
7086
- } else if (issue2.code === "invalid_return_type") {
7087
- processError(issue2.returnTypeError);
7088
- } else if (issue2.code === "invalid_arguments") {
7089
- processError(issue2.argumentsError);
7090
- } else if (issue2.path.length === 0) {
7091
- fieldErrors._errors.push(mapper(issue2));
7092
- } else {
7093
- let curr = fieldErrors;
7094
- let i = 0;
7095
- while (i < issue2.path.length) {
7096
- const el = issue2.path[i];
7097
- const terminal = i === issue2.path.length - 1;
7098
- if (!terminal) {
7099
- curr[el] = curr[el] || { _errors: [] };
7100
- } else {
7101
- curr[el] = curr[el] || { _errors: [] };
7102
- curr[el]._errors.push(mapper(issue2));
7103
- }
7104
- curr = curr[el];
7105
- i++;
7106
- }
7107
- }
7108
- }
7109
- };
7110
- processError(this);
7111
- return fieldErrors;
7112
- }
7113
- static assert(value) {
7114
- if (!(value instanceof _ZodError)) {
7115
- throw new Error(`Not a ZodError: ${value}`);
7116
- }
7117
- }
7118
- toString() {
7119
- return this.message;
7120
- }
7121
- get message() {
7122
- return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
7123
- }
7124
- get isEmpty() {
7125
- return this.issues.length === 0;
7126
- }
7127
- flatten(mapper = (issue2) => issue2.message) {
7128
- const fieldErrors = {};
7129
- const formErrors = [];
7130
- for (const sub of this.issues) {
7131
- if (sub.path.length > 0) {
7132
- const firstEl = sub.path[0];
7133
- fieldErrors[firstEl] = fieldErrors[firstEl] || [];
7134
- fieldErrors[firstEl].push(mapper(sub));
7135
- } else {
7136
- formErrors.push(mapper(sub));
7137
- }
7138
- }
7139
- return { formErrors, fieldErrors };
7140
- }
7141
- get formErrors() {
7142
- return this.flatten();
7143
- }
7144
- };
7145
- ZodError.create = (issues) => {
7146
- const error2 = new ZodError(issues);
7147
- return error2;
7148
- };
7149
-
7150
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
7151
- var errorMap = (issue2, _ctx) => {
7152
- let message;
7153
- switch (issue2.code) {
7154
- case ZodIssueCode.invalid_type:
7155
- if (issue2.received === ZodParsedType.undefined) {
7156
- message = "Required";
7157
- } else {
7158
- message = `Expected ${issue2.expected}, received ${issue2.received}`;
7159
- }
7160
- break;
7161
- case ZodIssueCode.invalid_literal:
7162
- message = `Invalid literal value, expected ${JSON.stringify(issue2.expected, util.jsonStringifyReplacer)}`;
7163
- break;
7164
- case ZodIssueCode.unrecognized_keys:
7165
- message = `Unrecognized key(s) in object: ${util.joinValues(issue2.keys, ", ")}`;
7166
- break;
7167
- case ZodIssueCode.invalid_union:
7168
- message = `Invalid input`;
7169
- break;
7170
- case ZodIssueCode.invalid_union_discriminator:
7171
- message = `Invalid discriminator value. Expected ${util.joinValues(issue2.options)}`;
7172
- break;
7173
- case ZodIssueCode.invalid_enum_value:
7174
- message = `Invalid enum value. Expected ${util.joinValues(issue2.options)}, received '${issue2.received}'`;
7175
- break;
7176
- case ZodIssueCode.invalid_arguments:
7177
- message = `Invalid function arguments`;
7178
- break;
7179
- case ZodIssueCode.invalid_return_type:
7180
- message = `Invalid function return type`;
7181
- break;
7182
- case ZodIssueCode.invalid_date:
7183
- message = `Invalid date`;
7184
- break;
7185
- case ZodIssueCode.invalid_string:
7186
- if (typeof issue2.validation === "object") {
7187
- if ("includes" in issue2.validation) {
7188
- message = `Invalid input: must include "${issue2.validation.includes}"`;
7189
- if (typeof issue2.validation.position === "number") {
7190
- message = `${message} at one or more positions greater than or equal to ${issue2.validation.position}`;
7191
- }
7192
- } else if ("startsWith" in issue2.validation) {
7193
- message = `Invalid input: must start with "${issue2.validation.startsWith}"`;
7194
- } else if ("endsWith" in issue2.validation) {
7195
- message = `Invalid input: must end with "${issue2.validation.endsWith}"`;
7196
- } else {
7197
- util.assertNever(issue2.validation);
7198
- }
7199
- } else if (issue2.validation !== "regex") {
7200
- message = `Invalid ${issue2.validation}`;
7201
- } else {
7202
- message = "Invalid";
7203
- }
7204
- break;
7205
- case ZodIssueCode.too_small:
7206
- if (issue2.type === "array")
7207
- message = `Array must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `more than`} ${issue2.minimum} element(s)`;
7208
- else if (issue2.type === "string")
7209
- message = `String must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `over`} ${issue2.minimum} character(s)`;
7210
- else if (issue2.type === "number")
7211
- message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`;
7212
- else if (issue2.type === "bigint")
7213
- message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`;
7214
- else if (issue2.type === "date")
7215
- message = `Date must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue2.minimum))}`;
7216
- else
7217
- message = "Invalid input";
7218
- break;
7219
- case ZodIssueCode.too_big:
7220
- if (issue2.type === "array")
7221
- message = `Array must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `less than`} ${issue2.maximum} element(s)`;
7222
- else if (issue2.type === "string")
7223
- message = `String must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `under`} ${issue2.maximum} character(s)`;
7224
- else if (issue2.type === "number")
7225
- message = `Number must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`;
7226
- else if (issue2.type === "bigint")
7227
- message = `BigInt must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`;
7228
- else if (issue2.type === "date")
7229
- message = `Date must be ${issue2.exact ? `exactly` : issue2.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue2.maximum))}`;
7230
- else
7231
- message = "Invalid input";
7232
- break;
7233
- case ZodIssueCode.custom:
7234
- message = `Invalid input`;
7235
- break;
7236
- case ZodIssueCode.invalid_intersection_types:
7237
- message = `Intersection results could not be merged`;
7238
- break;
7239
- case ZodIssueCode.not_multiple_of:
7240
- message = `Number must be a multiple of ${issue2.multipleOf}`;
7241
- break;
7242
- case ZodIssueCode.not_finite:
7243
- message = "Number must be finite";
7244
- break;
7245
- default:
7246
- message = _ctx.defaultError;
7247
- util.assertNever(issue2);
7248
- }
7249
- return { message };
7250
- };
7251
- var en_default = errorMap;
7252
-
7253
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
7254
- var overrideErrorMap = en_default;
7255
- function setErrorMap(map) {
7256
- overrideErrorMap = map;
7257
- }
7258
- function getErrorMap() {
7259
- return overrideErrorMap;
7260
- }
7261
-
7262
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
7263
- var makeIssue = (params) => {
7264
- const { data, path, errorMaps, issueData } = params;
7265
- const fullPath = [...path, ...issueData.path || []];
7266
- const fullIssue = {
7267
- ...issueData,
7268
- path: fullPath
7269
- };
7270
- if (issueData.message !== void 0) {
7271
- return {
7272
- ...issueData,
7273
- path: fullPath,
7274
- message: issueData.message
7275
- };
7276
- }
7277
- let errorMessage = "";
7278
- const maps = errorMaps.filter((m) => !!m).slice().reverse();
7279
- for (const map of maps) {
7280
- errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
7281
- }
7282
- return {
7283
- ...issueData,
7284
- path: fullPath,
7285
- message: errorMessage
7286
- };
7287
- };
7288
- var EMPTY_PATH = [];
7289
- function addIssueToContext(ctx, issueData) {
7290
- const overrideMap = getErrorMap();
7291
- const issue2 = makeIssue({
7292
- issueData,
7293
- data: ctx.data,
7294
- path: ctx.path,
7295
- errorMaps: [
7296
- ctx.common.contextualErrorMap,
7297
- // contextual error map is first priority
7298
- ctx.schemaErrorMap,
7299
- // then schema-bound map if available
7300
- overrideMap,
7301
- // then global override map
7302
- overrideMap === en_default ? void 0 : en_default
7303
- // then global default map
7304
- ].filter((x) => !!x)
7305
- });
7306
- ctx.common.issues.push(issue2);
7307
- }
7308
- var ParseStatus = class _ParseStatus {
7309
- constructor() {
7310
- this.value = "valid";
7311
- }
7312
- dirty() {
7313
- if (this.value === "valid")
7314
- this.value = "dirty";
7315
- }
7316
- abort() {
7317
- if (this.value !== "aborted")
7318
- this.value = "aborted";
7319
- }
7320
- static mergeArray(status, results) {
7321
- const arrayValue = [];
7322
- for (const s of results) {
7323
- if (s.status === "aborted")
7324
- return INVALID;
7325
- if (s.status === "dirty")
7326
- status.dirty();
7327
- arrayValue.push(s.value);
7328
- }
7329
- return { status: status.value, value: arrayValue };
7330
- }
7331
- static async mergeObjectAsync(status, pairs) {
7332
- const syncPairs = [];
7333
- for (const pair of pairs) {
7334
- const key = await pair.key;
7335
- const value = await pair.value;
7336
- syncPairs.push({
7337
- key,
7338
- value
7339
- });
7340
- }
7341
- return _ParseStatus.mergeObjectSync(status, syncPairs);
7342
- }
7343
- static mergeObjectSync(status, pairs) {
7344
- const finalObject = {};
7345
- for (const pair of pairs) {
7346
- const { key, value } = pair;
7347
- if (key.status === "aborted")
7348
- return INVALID;
7349
- if (value.status === "aborted")
7350
- return INVALID;
7351
- if (key.status === "dirty")
7352
- status.dirty();
7353
- if (value.status === "dirty")
7354
- status.dirty();
7355
- if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
7356
- finalObject[key.value] = value.value;
7357
- }
7358
- }
7359
- return { status: status.value, value: finalObject };
7360
- }
7361
- };
7362
- var INVALID = Object.freeze({
7363
- status: "aborted"
7364
- });
7365
- var DIRTY = (value) => ({ status: "dirty", value });
7366
- var OK = (value) => ({ status: "valid", value });
7367
- var isAborted = (x) => x.status === "aborted";
7368
- var isDirty = (x) => x.status === "dirty";
7369
- var isValid = (x) => x.status === "valid";
7370
- var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
7371
-
7372
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
7373
- var errorUtil;
7374
- (function(errorUtil2) {
7375
- errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
7376
- errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
7377
- })(errorUtil || (errorUtil = {}));
7378
-
7379
- // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
7380
- var ParseInputLazyPath = class {
7381
- constructor(parent, value, path, key) {
7382
- this._cachedPath = [];
7383
- this.parent = parent;
7384
- this.data = value;
7385
- this._path = path;
7386
- this._key = key;
7387
- }
7388
- get path() {
7389
- if (!this._cachedPath.length) {
7390
- if (Array.isArray(this._key)) {
7391
- this._cachedPath.push(...this._path, ...this._key);
7392
- } else {
7393
- this._cachedPath.push(...this._path, this._key);
7394
- }
7395
- }
7396
- return this._cachedPath;
7397
- }
7398
- };
7399
- var handleResult = (ctx, result) => {
7400
- if (isValid(result)) {
7401
- return { success: true, data: result.value };
7402
- } else {
7403
- if (!ctx.common.issues.length) {
7404
- throw new Error("Validation failed but no issues detected.");
7405
- }
7406
- return {
7407
- success: false,
7408
- get error() {
7409
- if (this._error)
7410
- return this._error;
7411
- const error2 = new ZodError(ctx.common.issues);
7412
- this._error = error2;
7413
- return this._error;
7414
- }
7415
- };
7416
- }
7417
- };
7418
- function processCreateParams(params) {
7419
- if (!params)
7420
- return {};
7421
- const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
7422
- if (errorMap2 && (invalid_type_error || required_error)) {
7423
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
7424
- }
7425
- if (errorMap2)
7426
- return { errorMap: errorMap2, description };
7427
- const customMap = (iss, ctx) => {
7428
- const { message } = params;
7429
- if (iss.code === "invalid_enum_value") {
7430
- return { message: message ?? ctx.defaultError };
7431
- }
7432
- if (typeof ctx.data === "undefined") {
7433
- return { message: message ?? required_error ?? ctx.defaultError };
7434
- }
7435
- if (iss.code !== "invalid_type")
7436
- return { message: ctx.defaultError };
7437
- return { message: message ?? invalid_type_error ?? ctx.defaultError };
7438
- };
7439
- return { errorMap: customMap, description };
7440
- }
7441
- var ZodType = class {
7442
- get description() {
7443
- return this._def.description;
7444
- }
7445
- _getType(input) {
7446
- return getParsedType(input.data);
7447
- }
7448
- _getOrReturnCtx(input, ctx) {
7449
- return ctx || {
7450
- common: input.parent.common,
7451
- data: input.data,
7452
- parsedType: getParsedType(input.data),
7453
- schemaErrorMap: this._def.errorMap,
7454
- path: input.path,
7455
- parent: input.parent
7456
- };
7457
- }
7458
- _processInputParams(input) {
7459
- return {
7460
- status: new ParseStatus(),
7461
- ctx: {
7462
- common: input.parent.common,
7463
- data: input.data,
7464
- parsedType: getParsedType(input.data),
7465
- schemaErrorMap: this._def.errorMap,
7466
- path: input.path,
7467
- parent: input.parent
7468
- }
7469
- };
7470
- }
7471
- _parseSync(input) {
7472
- const result = this._parse(input);
7473
- if (isAsync(result)) {
7474
- throw new Error("Synchronous parse encountered promise.");
7475
- }
7476
- return result;
7477
- }
7478
- _parseAsync(input) {
7479
- const result = this._parse(input);
7480
- return Promise.resolve(result);
7481
- }
7482
- parse(data, params) {
7483
- const result = this.safeParse(data, params);
7484
- if (result.success)
7485
- return result.data;
7486
- throw result.error;
7487
- }
7488
- safeParse(data, params) {
7489
- const ctx = {
7490
- common: {
7491
- issues: [],
7492
- async: params?.async ?? false,
7493
- contextualErrorMap: params?.errorMap
7494
- },
7495
- path: params?.path || [],
7496
- schemaErrorMap: this._def.errorMap,
7497
- parent: null,
7498
- data,
7499
- parsedType: getParsedType(data)
7500
- };
7501
- const result = this._parseSync({ data, path: ctx.path, parent: ctx });
7502
- return handleResult(ctx, result);
7503
- }
7504
- "~validate"(data) {
7505
- const ctx = {
7506
- common: {
7507
- issues: [],
7508
- async: !!this["~standard"].async
7509
- },
7510
- path: [],
7511
- schemaErrorMap: this._def.errorMap,
7512
- parent: null,
7513
- data,
7514
- parsedType: getParsedType(data)
7515
- };
7516
- if (!this["~standard"].async) {
7517
- try {
7518
- const result = this._parseSync({ data, path: [], parent: ctx });
7519
- return isValid(result) ? {
7520
- value: result.value
7521
- } : {
7522
- issues: ctx.common.issues
7523
- };
7524
- } catch (err) {
7525
- if (err?.message?.toLowerCase()?.includes("encountered")) {
7526
- this["~standard"].async = true;
7527
- }
7528
- ctx.common = {
7529
- issues: [],
7530
- async: true
7531
- };
7532
- }
7533
- }
7534
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
7535
- value: result.value
7536
- } : {
7537
- issues: ctx.common.issues
7538
- });
7539
- }
7540
- async parseAsync(data, params) {
7541
- const result = await this.safeParseAsync(data, params);
7542
- if (result.success)
7543
- return result.data;
7544
- throw result.error;
7545
- }
7546
- async safeParseAsync(data, params) {
7547
- const ctx = {
7548
- common: {
7549
- issues: [],
7550
- contextualErrorMap: params?.errorMap,
7551
- async: true
7552
- },
7553
- path: params?.path || [],
7554
- schemaErrorMap: this._def.errorMap,
7555
- parent: null,
7556
- data,
7557
- parsedType: getParsedType(data)
7558
- };
7559
- const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
7560
- const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
7561
- return handleResult(ctx, result);
7562
- }
7563
- refine(check2, message) {
7564
- const getIssueProperties = (val) => {
7565
- if (typeof message === "string" || typeof message === "undefined") {
7566
- return { message };
7567
- } else if (typeof message === "function") {
7568
- return message(val);
7569
- } else {
7570
- return message;
7571
- }
7572
- };
7573
- return this._refinement((val, ctx) => {
7574
- const result = check2(val);
7575
- const setError = () => ctx.addIssue({
7576
- code: ZodIssueCode.custom,
7577
- ...getIssueProperties(val)
7578
- });
7579
- if (typeof Promise !== "undefined" && result instanceof Promise) {
7580
- return result.then((data) => {
7581
- if (!data) {
7582
- setError();
7583
- return false;
7584
- } else {
7585
- return true;
7586
- }
7587
- });
7588
- }
7589
- if (!result) {
7590
- setError();
7591
- return false;
7592
- } else {
7593
- return true;
7594
- }
7595
- });
7596
- }
7597
- refinement(check2, refinementData) {
7598
- return this._refinement((val, ctx) => {
7599
- if (!check2(val)) {
7600
- ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
7601
- return false;
7602
- } else {
7603
- return true;
7604
- }
7605
- });
7606
- }
7607
- _refinement(refinement) {
7608
- return new ZodEffects({
7609
- schema: this,
7610
- typeName: ZodFirstPartyTypeKind.ZodEffects,
7611
- effect: { type: "refinement", refinement }
7612
- });
7613
- }
7614
- superRefine(refinement) {
7615
- return this._refinement(refinement);
7616
- }
7617
- constructor(def) {
7618
- this.spa = this.safeParseAsync;
7619
- this._def = def;
7620
- this.parse = this.parse.bind(this);
7621
- this.safeParse = this.safeParse.bind(this);
7622
- this.parseAsync = this.parseAsync.bind(this);
7623
- this.safeParseAsync = this.safeParseAsync.bind(this);
7624
- this.spa = this.spa.bind(this);
7625
- this.refine = this.refine.bind(this);
7626
- this.refinement = this.refinement.bind(this);
7627
- this.superRefine = this.superRefine.bind(this);
7628
- this.optional = this.optional.bind(this);
7629
- this.nullable = this.nullable.bind(this);
7630
- this.nullish = this.nullish.bind(this);
7631
- this.array = this.array.bind(this);
7632
- this.promise = this.promise.bind(this);
7633
- this.or = this.or.bind(this);
7634
- this.and = this.and.bind(this);
7635
- this.transform = this.transform.bind(this);
7636
- this.brand = this.brand.bind(this);
7637
- this.default = this.default.bind(this);
7638
- this.catch = this.catch.bind(this);
7639
- this.describe = this.describe.bind(this);
7640
- this.pipe = this.pipe.bind(this);
7641
- this.readonly = this.readonly.bind(this);
7642
- this.isNullable = this.isNullable.bind(this);
7643
- this.isOptional = this.isOptional.bind(this);
7644
- this["~standard"] = {
7645
- version: 1,
7646
- vendor: "zod",
7647
- validate: (data) => this["~validate"](data)
7648
- };
7649
- }
7650
- optional() {
7651
- return ZodOptional.create(this, this._def);
7652
- }
7653
- nullable() {
7654
- return ZodNullable.create(this, this._def);
7655
- }
7656
- nullish() {
7657
- return this.nullable().optional();
7658
- }
7659
- array() {
7660
- return ZodArray.create(this);
7661
- }
7662
- promise() {
7663
- return ZodPromise.create(this, this._def);
7664
- }
7665
- or(option) {
7666
- return ZodUnion.create([this, option], this._def);
7667
- }
7668
- and(incoming) {
7669
- return ZodIntersection.create(this, incoming, this._def);
7670
- }
7671
- transform(transform2) {
7672
- return new ZodEffects({
7673
- ...processCreateParams(this._def),
7674
- schema: this,
7675
- typeName: ZodFirstPartyTypeKind.ZodEffects,
7676
- effect: { type: "transform", transform: transform2 }
7677
- });
7678
- }
7679
- default(def) {
7680
- const defaultValueFunc = typeof def === "function" ? def : () => def;
7681
- return new ZodDefault({
7682
- ...processCreateParams(this._def),
7683
- innerType: this,
7684
- defaultValue: defaultValueFunc,
7685
- typeName: ZodFirstPartyTypeKind.ZodDefault
7686
- });
7687
- }
7688
- brand() {
7689
- return new ZodBranded({
7690
- typeName: ZodFirstPartyTypeKind.ZodBranded,
7691
- type: this,
7692
- ...processCreateParams(this._def)
7693
- });
7694
- }
7695
- catch(def) {
7696
- const catchValueFunc = typeof def === "function" ? def : () => def;
7697
- return new ZodCatch({
7698
- ...processCreateParams(this._def),
7699
- innerType: this,
7700
- catchValue: catchValueFunc,
7701
- typeName: ZodFirstPartyTypeKind.ZodCatch
7702
- });
7703
- }
7704
- describe(description) {
7705
- const This = this.constructor;
7706
- return new This({
7707
- ...this._def,
7708
- description
7709
- });
7710
- }
7711
- pipe(target) {
7712
- return ZodPipeline.create(this, target);
7713
- }
7714
- readonly() {
7715
- return ZodReadonly.create(this);
7716
- }
7717
- isOptional() {
7718
- return this.safeParse(void 0).success;
7719
- }
7720
- isNullable() {
7721
- return this.safeParse(null).success;
7722
- }
7723
- };
7724
- var cuidRegex = /^c[^\s-]{8,}$/i;
7725
- var cuid2Regex = /^[0-9a-z]+$/;
7726
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
7727
- var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
7728
- var nanoidRegex = /^[a-z0-9_-]{21}$/i;
7729
- var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
7730
- var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
7731
- var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
7732
- var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
7733
- var emojiRegex;
7734
- var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
7735
- var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
7736
- var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
7737
- var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
7738
- var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
7739
- var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
7740
- var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
7741
- var dateRegex = new RegExp(`^${dateRegexSource}$`);
7742
- function timeRegexSource(args) {
7743
- let secondsRegexSource = `[0-5]\\d`;
7744
- if (args.precision) {
7745
- secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
7746
- } else if (args.precision == null) {
7747
- secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
7748
- }
7749
- const secondsQuantifier = args.precision ? "+" : "?";
7750
- return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
7751
- }
7752
- function timeRegex(args) {
7753
- return new RegExp(`^${timeRegexSource(args)}$`);
7754
- }
7755
- function datetimeRegex(args) {
7756
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
7757
- const opts = [];
7758
- opts.push(args.local ? `Z?` : `Z`);
7759
- if (args.offset)
7760
- opts.push(`([+-]\\d{2}:?\\d{2})`);
7761
- regex = `${regex}(${opts.join("|")})`;
7762
- return new RegExp(`^${regex}$`);
7763
- }
7764
- function isValidIP(ip, version2) {
7765
- if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
7766
- return true;
7767
- }
7768
- if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
7769
- return true;
7770
- }
7771
- return false;
7772
- }
7773
- function isValidJWT(jwt, alg) {
7774
- if (!jwtRegex.test(jwt))
7775
- return false;
7776
- try {
7777
- const [header] = jwt.split(".");
7778
- if (!header)
7779
- return false;
7780
- const base642 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
7781
- const decoded = JSON.parse(atob(base642));
7782
- if (typeof decoded !== "object" || decoded === null)
7783
- return false;
7784
- if ("typ" in decoded && decoded?.typ !== "JWT")
7785
- return false;
7786
- if (!decoded.alg)
7787
- return false;
7788
- if (alg && decoded.alg !== alg)
7789
- return false;
7790
- return true;
7791
- } catch {
7792
- return false;
7793
- }
7794
- }
7795
- function isValidCidr(ip, version2) {
7796
- if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
7797
- return true;
7798
- }
7799
- if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
7800
- return true;
7801
- }
7802
- return false;
7803
- }
7804
- var ZodString = class _ZodString2 extends ZodType {
7805
- _parse(input) {
7806
- if (this._def.coerce) {
7807
- input.data = String(input.data);
7808
- }
7809
- const parsedType2 = this._getType(input);
7810
- if (parsedType2 !== ZodParsedType.string) {
7811
- const ctx2 = this._getOrReturnCtx(input);
7812
- addIssueToContext(ctx2, {
7813
- code: ZodIssueCode.invalid_type,
7814
- expected: ZodParsedType.string,
7815
- received: ctx2.parsedType
7816
- });
7817
- return INVALID;
7818
- }
7819
- const status = new ParseStatus();
7820
- let ctx = void 0;
7821
- for (const check2 of this._def.checks) {
7822
- if (check2.kind === "min") {
7823
- if (input.data.length < check2.value) {
7824
- ctx = this._getOrReturnCtx(input, ctx);
7825
- addIssueToContext(ctx, {
7826
- code: ZodIssueCode.too_small,
7827
- minimum: check2.value,
7828
- type: "string",
7829
- inclusive: true,
7830
- exact: false,
7831
- message: check2.message
7832
- });
7833
- status.dirty();
7834
- }
7835
- } else if (check2.kind === "max") {
7836
- if (input.data.length > check2.value) {
7837
- ctx = this._getOrReturnCtx(input, ctx);
7838
- addIssueToContext(ctx, {
7839
- code: ZodIssueCode.too_big,
7840
- maximum: check2.value,
7841
- type: "string",
7842
- inclusive: true,
7843
- exact: false,
7844
- message: check2.message
7845
- });
7846
- status.dirty();
7847
- }
7848
- } else if (check2.kind === "length") {
7849
- const tooBig = input.data.length > check2.value;
7850
- const tooSmall = input.data.length < check2.value;
7851
- if (tooBig || tooSmall) {
7852
- ctx = this._getOrReturnCtx(input, ctx);
7853
- if (tooBig) {
7854
- addIssueToContext(ctx, {
7855
- code: ZodIssueCode.too_big,
7856
- maximum: check2.value,
7857
- type: "string",
7858
- inclusive: true,
7859
- exact: true,
7860
- message: check2.message
7861
- });
7862
- } else if (tooSmall) {
7863
- addIssueToContext(ctx, {
7864
- code: ZodIssueCode.too_small,
7865
- minimum: check2.value,
7866
- type: "string",
7867
- inclusive: true,
7868
- exact: true,
7869
- message: check2.message
7870
- });
7871
- }
7872
- status.dirty();
7873
- }
7874
- } else if (check2.kind === "email") {
7875
- if (!emailRegex.test(input.data)) {
7876
- ctx = this._getOrReturnCtx(input, ctx);
7877
- addIssueToContext(ctx, {
7878
- validation: "email",
7879
- code: ZodIssueCode.invalid_string,
7880
- message: check2.message
7881
- });
7882
- status.dirty();
7883
- }
7884
- } else if (check2.kind === "emoji") {
7885
- if (!emojiRegex) {
7886
- emojiRegex = new RegExp(_emojiRegex, "u");
7887
- }
7888
- if (!emojiRegex.test(input.data)) {
7889
- ctx = this._getOrReturnCtx(input, ctx);
7890
- addIssueToContext(ctx, {
7891
- validation: "emoji",
7892
- code: ZodIssueCode.invalid_string,
7893
- message: check2.message
7894
- });
7895
- status.dirty();
7896
- }
7897
- } else if (check2.kind === "uuid") {
7898
- if (!uuidRegex.test(input.data)) {
7899
- ctx = this._getOrReturnCtx(input, ctx);
7900
- addIssueToContext(ctx, {
7901
- validation: "uuid",
7902
- code: ZodIssueCode.invalid_string,
7903
- message: check2.message
7904
- });
7905
- status.dirty();
7906
- }
7907
- } else if (check2.kind === "nanoid") {
7908
- if (!nanoidRegex.test(input.data)) {
7909
- ctx = this._getOrReturnCtx(input, ctx);
7910
- addIssueToContext(ctx, {
7911
- validation: "nanoid",
7912
- code: ZodIssueCode.invalid_string,
7913
- message: check2.message
7914
- });
7915
- status.dirty();
7916
- }
7917
- } else if (check2.kind === "cuid") {
7918
- if (!cuidRegex.test(input.data)) {
7919
- ctx = this._getOrReturnCtx(input, ctx);
7920
- addIssueToContext(ctx, {
7921
- validation: "cuid",
7922
- code: ZodIssueCode.invalid_string,
7923
- message: check2.message
7924
- });
7925
- status.dirty();
7926
- }
7927
- } else if (check2.kind === "cuid2") {
7928
- if (!cuid2Regex.test(input.data)) {
7929
- ctx = this._getOrReturnCtx(input, ctx);
7930
- addIssueToContext(ctx, {
7931
- validation: "cuid2",
7932
- code: ZodIssueCode.invalid_string,
7933
- message: check2.message
7934
- });
7935
- status.dirty();
7936
- }
7937
- } else if (check2.kind === "ulid") {
7938
- if (!ulidRegex.test(input.data)) {
7939
- ctx = this._getOrReturnCtx(input, ctx);
7940
- addIssueToContext(ctx, {
7941
- validation: "ulid",
7942
- code: ZodIssueCode.invalid_string,
7943
- message: check2.message
7944
- });
7945
- status.dirty();
7946
- }
7947
- } else if (check2.kind === "url") {
7948
- try {
7949
- new URL(input.data);
7950
- } catch {
7951
- ctx = this._getOrReturnCtx(input, ctx);
7952
- addIssueToContext(ctx, {
7953
- validation: "url",
7954
- code: ZodIssueCode.invalid_string,
7955
- message: check2.message
7956
- });
7957
- status.dirty();
7958
- }
7959
- } else if (check2.kind === "regex") {
7960
- check2.regex.lastIndex = 0;
7961
- const testResult = check2.regex.test(input.data);
7962
- if (!testResult) {
7963
- ctx = this._getOrReturnCtx(input, ctx);
7964
- addIssueToContext(ctx, {
7965
- validation: "regex",
7966
- code: ZodIssueCode.invalid_string,
7967
- message: check2.message
7968
- });
7969
- status.dirty();
7970
- }
7971
- } else if (check2.kind === "trim") {
7972
- input.data = input.data.trim();
7973
- } else if (check2.kind === "includes") {
7974
- if (!input.data.includes(check2.value, check2.position)) {
7975
- ctx = this._getOrReturnCtx(input, ctx);
7976
- addIssueToContext(ctx, {
7977
- code: ZodIssueCode.invalid_string,
7978
- validation: { includes: check2.value, position: check2.position },
7979
- message: check2.message
7980
- });
7981
- status.dirty();
7982
- }
7983
- } else if (check2.kind === "toLowerCase") {
7984
- input.data = input.data.toLowerCase();
7985
- } else if (check2.kind === "toUpperCase") {
7986
- input.data = input.data.toUpperCase();
7987
- } else if (check2.kind === "startsWith") {
7988
- if (!input.data.startsWith(check2.value)) {
7989
- ctx = this._getOrReturnCtx(input, ctx);
7990
- addIssueToContext(ctx, {
7991
- code: ZodIssueCode.invalid_string,
7992
- validation: { startsWith: check2.value },
7993
- message: check2.message
7994
- });
7995
- status.dirty();
7996
- }
7997
- } else if (check2.kind === "endsWith") {
7998
- if (!input.data.endsWith(check2.value)) {
7999
- ctx = this._getOrReturnCtx(input, ctx);
8000
- addIssueToContext(ctx, {
8001
- code: ZodIssueCode.invalid_string,
8002
- validation: { endsWith: check2.value },
8003
- message: check2.message
8004
- });
8005
- status.dirty();
8006
- }
8007
- } else if (check2.kind === "datetime") {
8008
- const regex = datetimeRegex(check2);
8009
- if (!regex.test(input.data)) {
8010
- ctx = this._getOrReturnCtx(input, ctx);
8011
- addIssueToContext(ctx, {
8012
- code: ZodIssueCode.invalid_string,
8013
- validation: "datetime",
8014
- message: check2.message
8015
- });
8016
- status.dirty();
8017
- }
8018
- } else if (check2.kind === "date") {
8019
- const regex = dateRegex;
8020
- if (!regex.test(input.data)) {
8021
- ctx = this._getOrReturnCtx(input, ctx);
8022
- addIssueToContext(ctx, {
8023
- code: ZodIssueCode.invalid_string,
8024
- validation: "date",
8025
- message: check2.message
8026
- });
8027
- status.dirty();
8028
- }
8029
- } else if (check2.kind === "time") {
8030
- const regex = timeRegex(check2);
8031
- if (!regex.test(input.data)) {
8032
- ctx = this._getOrReturnCtx(input, ctx);
8033
- addIssueToContext(ctx, {
8034
- code: ZodIssueCode.invalid_string,
8035
- validation: "time",
8036
- message: check2.message
8037
- });
8038
- status.dirty();
8039
- }
8040
- } else if (check2.kind === "duration") {
8041
- if (!durationRegex.test(input.data)) {
8042
- ctx = this._getOrReturnCtx(input, ctx);
8043
- addIssueToContext(ctx, {
8044
- validation: "duration",
8045
- code: ZodIssueCode.invalid_string,
8046
- message: check2.message
8047
- });
8048
- status.dirty();
8049
- }
8050
- } else if (check2.kind === "ip") {
8051
- if (!isValidIP(input.data, check2.version)) {
8052
- ctx = this._getOrReturnCtx(input, ctx);
8053
- addIssueToContext(ctx, {
8054
- validation: "ip",
8055
- code: ZodIssueCode.invalid_string,
8056
- message: check2.message
8057
- });
8058
- status.dirty();
8059
- }
8060
- } else if (check2.kind === "jwt") {
8061
- if (!isValidJWT(input.data, check2.alg)) {
8062
- ctx = this._getOrReturnCtx(input, ctx);
8063
- addIssueToContext(ctx, {
8064
- validation: "jwt",
8065
- code: ZodIssueCode.invalid_string,
8066
- message: check2.message
8067
- });
8068
- status.dirty();
8069
- }
8070
- } else if (check2.kind === "cidr") {
8071
- if (!isValidCidr(input.data, check2.version)) {
8072
- ctx = this._getOrReturnCtx(input, ctx);
8073
- addIssueToContext(ctx, {
8074
- validation: "cidr",
8075
- code: ZodIssueCode.invalid_string,
8076
- message: check2.message
8077
- });
8078
- status.dirty();
8079
- }
8080
- } else if (check2.kind === "base64") {
8081
- if (!base64Regex.test(input.data)) {
8082
- ctx = this._getOrReturnCtx(input, ctx);
8083
- addIssueToContext(ctx, {
8084
- validation: "base64",
8085
- code: ZodIssueCode.invalid_string,
8086
- message: check2.message
8087
- });
8088
- status.dirty();
8089
- }
8090
- } else if (check2.kind === "base64url") {
8091
- if (!base64urlRegex.test(input.data)) {
8092
- ctx = this._getOrReturnCtx(input, ctx);
8093
- addIssueToContext(ctx, {
8094
- validation: "base64url",
8095
- code: ZodIssueCode.invalid_string,
8096
- message: check2.message
8097
- });
8098
- status.dirty();
8099
- }
8100
- } else {
8101
- util.assertNever(check2);
8102
- }
8103
- }
8104
- return { status: status.value, value: input.data };
8105
- }
8106
- _regex(regex, validation, message) {
8107
- return this.refinement((data) => regex.test(data), {
8108
- validation,
8109
- code: ZodIssueCode.invalid_string,
8110
- ...errorUtil.errToObj(message)
8111
- });
8112
- }
8113
- _addCheck(check2) {
8114
- return new _ZodString2({
8115
- ...this._def,
8116
- checks: [...this._def.checks, check2]
8117
- });
8118
- }
8119
- email(message) {
8120
- return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
8121
- }
8122
- url(message) {
8123
- return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
8124
- }
8125
- emoji(message) {
8126
- return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
8127
- }
8128
- uuid(message) {
8129
- return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
8130
- }
8131
- nanoid(message) {
8132
- return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
8133
- }
8134
- cuid(message) {
8135
- return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
8136
- }
8137
- cuid2(message) {
8138
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
8139
- }
8140
- ulid(message) {
8141
- return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
8142
- }
8143
- base64(message) {
8144
- return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
8145
- }
8146
- base64url(message) {
8147
- return this._addCheck({
8148
- kind: "base64url",
8149
- ...errorUtil.errToObj(message)
8150
- });
8151
- }
8152
- jwt(options) {
8153
- return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
8154
- }
8155
- ip(options) {
8156
- return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
8157
- }
8158
- cidr(options) {
8159
- return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
8160
- }
8161
- datetime(options) {
8162
- if (typeof options === "string") {
8163
- return this._addCheck({
8164
- kind: "datetime",
8165
- precision: null,
8166
- offset: false,
8167
- local: false,
8168
- message: options
8169
- });
8170
- }
8171
- return this._addCheck({
8172
- kind: "datetime",
8173
- precision: typeof options?.precision === "undefined" ? null : options?.precision,
8174
- offset: options?.offset ?? false,
8175
- local: options?.local ?? false,
8176
- ...errorUtil.errToObj(options?.message)
8177
- });
8178
- }
8179
- date(message) {
8180
- return this._addCheck({ kind: "date", message });
8181
- }
8182
- time(options) {
8183
- if (typeof options === "string") {
8184
- return this._addCheck({
8185
- kind: "time",
8186
- precision: null,
8187
- message: options
8188
- });
8189
- }
8190
- return this._addCheck({
8191
- kind: "time",
8192
- precision: typeof options?.precision === "undefined" ? null : options?.precision,
8193
- ...errorUtil.errToObj(options?.message)
8194
- });
8195
- }
8196
- duration(message) {
8197
- return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
8198
- }
8199
- regex(regex, message) {
8200
- return this._addCheck({
8201
- kind: "regex",
8202
- regex,
8203
- ...errorUtil.errToObj(message)
8204
- });
8205
- }
8206
- includes(value, options) {
8207
- return this._addCheck({
8208
- kind: "includes",
8209
- value,
8210
- position: options?.position,
8211
- ...errorUtil.errToObj(options?.message)
8212
- });
8213
- }
8214
- startsWith(value, message) {
8215
- return this._addCheck({
8216
- kind: "startsWith",
8217
- value,
8218
- ...errorUtil.errToObj(message)
8219
- });
8220
- }
8221
- endsWith(value, message) {
8222
- return this._addCheck({
8223
- kind: "endsWith",
8224
- value,
8225
- ...errorUtil.errToObj(message)
8226
- });
8227
- }
8228
- min(minLength, message) {
8229
- return this._addCheck({
8230
- kind: "min",
8231
- value: minLength,
8232
- ...errorUtil.errToObj(message)
8233
- });
8234
- }
8235
- max(maxLength, message) {
8236
- return this._addCheck({
8237
- kind: "max",
8238
- value: maxLength,
8239
- ...errorUtil.errToObj(message)
8240
- });
8241
- }
8242
- length(len, message) {
8243
- return this._addCheck({
8244
- kind: "length",
8245
- value: len,
8246
- ...errorUtil.errToObj(message)
8247
- });
8248
- }
8249
- /**
8250
- * Equivalent to `.min(1)`
8251
- */
8252
- nonempty(message) {
8253
- return this.min(1, errorUtil.errToObj(message));
8254
- }
8255
- trim() {
8256
- return new _ZodString2({
8257
- ...this._def,
8258
- checks: [...this._def.checks, { kind: "trim" }]
8259
- });
8260
- }
8261
- toLowerCase() {
8262
- return new _ZodString2({
8263
- ...this._def,
8264
- checks: [...this._def.checks, { kind: "toLowerCase" }]
8265
- });
8266
- }
8267
- toUpperCase() {
8268
- return new _ZodString2({
8269
- ...this._def,
8270
- checks: [...this._def.checks, { kind: "toUpperCase" }]
8271
- });
8272
- }
8273
- get isDatetime() {
8274
- return !!this._def.checks.find((ch) => ch.kind === "datetime");
8275
- }
8276
- get isDate() {
8277
- return !!this._def.checks.find((ch) => ch.kind === "date");
8278
- }
8279
- get isTime() {
8280
- return !!this._def.checks.find((ch) => ch.kind === "time");
8281
- }
8282
- get isDuration() {
8283
- return !!this._def.checks.find((ch) => ch.kind === "duration");
8284
- }
8285
- get isEmail() {
8286
- return !!this._def.checks.find((ch) => ch.kind === "email");
8287
- }
8288
- get isURL() {
8289
- return !!this._def.checks.find((ch) => ch.kind === "url");
8290
- }
8291
- get isEmoji() {
8292
- return !!this._def.checks.find((ch) => ch.kind === "emoji");
8293
- }
8294
- get isUUID() {
8295
- return !!this._def.checks.find((ch) => ch.kind === "uuid");
8296
- }
8297
- get isNANOID() {
8298
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
8299
- }
8300
- get isCUID() {
8301
- return !!this._def.checks.find((ch) => ch.kind === "cuid");
8302
- }
8303
- get isCUID2() {
8304
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
8305
- }
8306
- get isULID() {
8307
- return !!this._def.checks.find((ch) => ch.kind === "ulid");
8308
- }
8309
- get isIP() {
8310
- return !!this._def.checks.find((ch) => ch.kind === "ip");
8311
- }
8312
- get isCIDR() {
8313
- return !!this._def.checks.find((ch) => ch.kind === "cidr");
8314
- }
8315
- get isBase64() {
8316
- return !!this._def.checks.find((ch) => ch.kind === "base64");
8317
- }
8318
- get isBase64url() {
8319
- return !!this._def.checks.find((ch) => ch.kind === "base64url");
8320
- }
8321
- get minLength() {
8322
- let min = null;
8323
- for (const ch of this._def.checks) {
8324
- if (ch.kind === "min") {
8325
- if (min === null || ch.value > min)
8326
- min = ch.value;
8327
- }
8328
- }
8329
- return min;
8330
- }
8331
- get maxLength() {
8332
- let max = null;
8333
- for (const ch of this._def.checks) {
8334
- if (ch.kind === "max") {
8335
- if (max === null || ch.value < max)
8336
- max = ch.value;
8337
- }
8338
- }
8339
- return max;
8340
- }
8341
- };
8342
- ZodString.create = (params) => {
8343
- return new ZodString({
8344
- checks: [],
8345
- typeName: ZodFirstPartyTypeKind.ZodString,
8346
- coerce: params?.coerce ?? false,
8347
- ...processCreateParams(params)
8348
- });
8349
- };
8350
- function floatSafeRemainder(val, step) {
8351
- const valDecCount = (val.toString().split(".")[1] || "").length;
8352
- const stepDecCount = (step.toString().split(".")[1] || "").length;
8353
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
8354
- const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
8355
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
8356
- return valInt % stepInt / 10 ** decCount;
8357
- }
8358
- var ZodNumber = class _ZodNumber extends ZodType {
8359
- constructor() {
8360
- super(...arguments);
8361
- this.min = this.gte;
8362
- this.max = this.lte;
8363
- this.step = this.multipleOf;
8364
- }
8365
- _parse(input) {
8366
- if (this._def.coerce) {
8367
- input.data = Number(input.data);
8368
- }
8369
- const parsedType2 = this._getType(input);
8370
- if (parsedType2 !== ZodParsedType.number) {
8371
- const ctx2 = this._getOrReturnCtx(input);
8372
- addIssueToContext(ctx2, {
8373
- code: ZodIssueCode.invalid_type,
8374
- expected: ZodParsedType.number,
8375
- received: ctx2.parsedType
8376
- });
8377
- return INVALID;
8378
- }
8379
- let ctx = void 0;
8380
- const status = new ParseStatus();
8381
- for (const check2 of this._def.checks) {
8382
- if (check2.kind === "int") {
8383
- if (!util.isInteger(input.data)) {
8384
- ctx = this._getOrReturnCtx(input, ctx);
8385
- addIssueToContext(ctx, {
8386
- code: ZodIssueCode.invalid_type,
8387
- expected: "integer",
8388
- received: "float",
8389
- message: check2.message
8390
- });
8391
- status.dirty();
8392
- }
8393
- } else if (check2.kind === "min") {
8394
- const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
8395
- if (tooSmall) {
8396
- ctx = this._getOrReturnCtx(input, ctx);
8397
- addIssueToContext(ctx, {
8398
- code: ZodIssueCode.too_small,
8399
- minimum: check2.value,
8400
- type: "number",
8401
- inclusive: check2.inclusive,
8402
- exact: false,
8403
- message: check2.message
8404
- });
8405
- status.dirty();
8406
- }
8407
- } else if (check2.kind === "max") {
8408
- const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
8409
- if (tooBig) {
8410
- ctx = this._getOrReturnCtx(input, ctx);
8411
- addIssueToContext(ctx, {
8412
- code: ZodIssueCode.too_big,
8413
- maximum: check2.value,
8414
- type: "number",
8415
- inclusive: check2.inclusive,
8416
- exact: false,
8417
- message: check2.message
8418
- });
8419
- status.dirty();
8420
- }
8421
- } else if (check2.kind === "multipleOf") {
8422
- if (floatSafeRemainder(input.data, check2.value) !== 0) {
8423
- ctx = this._getOrReturnCtx(input, ctx);
8424
- addIssueToContext(ctx, {
8425
- code: ZodIssueCode.not_multiple_of,
8426
- multipleOf: check2.value,
8427
- message: check2.message
8428
- });
8429
- status.dirty();
8430
- }
8431
- } else if (check2.kind === "finite") {
8432
- if (!Number.isFinite(input.data)) {
8433
- ctx = this._getOrReturnCtx(input, ctx);
8434
- addIssueToContext(ctx, {
8435
- code: ZodIssueCode.not_finite,
8436
- message: check2.message
8437
- });
8438
- status.dirty();
8439
- }
8440
- } else {
8441
- util.assertNever(check2);
8442
- }
8443
- }
8444
- return { status: status.value, value: input.data };
8445
- }
8446
- gte(value, message) {
8447
- return this.setLimit("min", value, true, errorUtil.toString(message));
8448
- }
8449
- gt(value, message) {
8450
- return this.setLimit("min", value, false, errorUtil.toString(message));
8451
- }
8452
- lte(value, message) {
8453
- return this.setLimit("max", value, true, errorUtil.toString(message));
8454
- }
8455
- lt(value, message) {
8456
- return this.setLimit("max", value, false, errorUtil.toString(message));
8457
- }
8458
- setLimit(kind, value, inclusive, message) {
8459
- return new _ZodNumber({
8460
- ...this._def,
8461
- checks: [
8462
- ...this._def.checks,
8463
- {
8464
- kind,
8465
- value,
8466
- inclusive,
8467
- message: errorUtil.toString(message)
8468
- }
8469
- ]
8470
- });
8471
- }
8472
- _addCheck(check2) {
8473
- return new _ZodNumber({
8474
- ...this._def,
8475
- checks: [...this._def.checks, check2]
8476
- });
8477
- }
8478
- int(message) {
8479
- return this._addCheck({
8480
- kind: "int",
8481
- message: errorUtil.toString(message)
8482
- });
8483
- }
8484
- positive(message) {
8485
- return this._addCheck({
8486
- kind: "min",
8487
- value: 0,
8488
- inclusive: false,
8489
- message: errorUtil.toString(message)
8490
- });
8491
- }
8492
- negative(message) {
8493
- return this._addCheck({
8494
- kind: "max",
8495
- value: 0,
8496
- inclusive: false,
8497
- message: errorUtil.toString(message)
8498
- });
8499
- }
8500
- nonpositive(message) {
8501
- return this._addCheck({
8502
- kind: "max",
8503
- value: 0,
8504
- inclusive: true,
8505
- message: errorUtil.toString(message)
8506
- });
8507
- }
8508
- nonnegative(message) {
8509
- return this._addCheck({
8510
- kind: "min",
8511
- value: 0,
8512
- inclusive: true,
8513
- message: errorUtil.toString(message)
8514
- });
8515
- }
8516
- multipleOf(value, message) {
8517
- return this._addCheck({
8518
- kind: "multipleOf",
8519
- value,
8520
- message: errorUtil.toString(message)
8521
- });
8522
- }
8523
- finite(message) {
8524
- return this._addCheck({
8525
- kind: "finite",
8526
- message: errorUtil.toString(message)
8527
- });
8528
- }
8529
- safe(message) {
8530
- return this._addCheck({
8531
- kind: "min",
8532
- inclusive: true,
8533
- value: Number.MIN_SAFE_INTEGER,
8534
- message: errorUtil.toString(message)
8535
- })._addCheck({
8536
- kind: "max",
8537
- inclusive: true,
8538
- value: Number.MAX_SAFE_INTEGER,
8539
- message: errorUtil.toString(message)
8540
- });
8541
- }
8542
- get minValue() {
8543
- let min = null;
8544
- for (const ch of this._def.checks) {
8545
- if (ch.kind === "min") {
8546
- if (min === null || ch.value > min)
8547
- min = ch.value;
8548
- }
8549
- }
8550
- return min;
8551
- }
8552
- get maxValue() {
8553
- let max = null;
8554
- for (const ch of this._def.checks) {
8555
- if (ch.kind === "max") {
8556
- if (max === null || ch.value < max)
8557
- max = ch.value;
8558
- }
8559
- }
8560
- return max;
8561
- }
8562
- get isInt() {
8563
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
8564
- }
8565
- get isFinite() {
8566
- let max = null;
8567
- let min = null;
8568
- for (const ch of this._def.checks) {
8569
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
8570
- return true;
8571
- } else if (ch.kind === "min") {
8572
- if (min === null || ch.value > min)
8573
- min = ch.value;
8574
- } else if (ch.kind === "max") {
8575
- if (max === null || ch.value < max)
8576
- max = ch.value;
8577
- }
8578
- }
8579
- return Number.isFinite(min) && Number.isFinite(max);
8580
- }
8581
- };
8582
- ZodNumber.create = (params) => {
8583
- return new ZodNumber({
8584
- checks: [],
8585
- typeName: ZodFirstPartyTypeKind.ZodNumber,
8586
- coerce: params?.coerce || false,
8587
- ...processCreateParams(params)
8588
- });
8589
- };
8590
- var ZodBigInt = class _ZodBigInt extends ZodType {
8591
- constructor() {
8592
- super(...arguments);
8593
- this.min = this.gte;
8594
- this.max = this.lte;
8595
- }
8596
- _parse(input) {
8597
- if (this._def.coerce) {
8598
- try {
8599
- input.data = BigInt(input.data);
8600
- } catch {
8601
- return this._getInvalidInput(input);
8602
- }
8603
- }
8604
- const parsedType2 = this._getType(input);
8605
- if (parsedType2 !== ZodParsedType.bigint) {
8606
- return this._getInvalidInput(input);
8607
- }
8608
- let ctx = void 0;
8609
- const status = new ParseStatus();
8610
- for (const check2 of this._def.checks) {
8611
- if (check2.kind === "min") {
8612
- const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
8613
- if (tooSmall) {
8614
- ctx = this._getOrReturnCtx(input, ctx);
8615
- addIssueToContext(ctx, {
8616
- code: ZodIssueCode.too_small,
8617
- type: "bigint",
8618
- minimum: check2.value,
8619
- inclusive: check2.inclusive,
8620
- message: check2.message
8621
- });
8622
- status.dirty();
8623
- }
8624
- } else if (check2.kind === "max") {
8625
- const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
8626
- if (tooBig) {
8627
- ctx = this._getOrReturnCtx(input, ctx);
8628
- addIssueToContext(ctx, {
8629
- code: ZodIssueCode.too_big,
8630
- type: "bigint",
8631
- maximum: check2.value,
8632
- inclusive: check2.inclusive,
8633
- message: check2.message
8634
- });
8635
- status.dirty();
8636
- }
8637
- } else if (check2.kind === "multipleOf") {
8638
- if (input.data % check2.value !== BigInt(0)) {
8639
- ctx = this._getOrReturnCtx(input, ctx);
8640
- addIssueToContext(ctx, {
8641
- code: ZodIssueCode.not_multiple_of,
8642
- multipleOf: check2.value,
8643
- message: check2.message
8644
- });
8645
- status.dirty();
8646
- }
8647
- } else {
8648
- util.assertNever(check2);
8649
- }
8650
- }
8651
- return { status: status.value, value: input.data };
8652
- }
8653
- _getInvalidInput(input) {
8654
- const ctx = this._getOrReturnCtx(input);
8655
- addIssueToContext(ctx, {
8656
- code: ZodIssueCode.invalid_type,
8657
- expected: ZodParsedType.bigint,
8658
- received: ctx.parsedType
8659
- });
8660
- return INVALID;
8661
- }
8662
- gte(value, message) {
8663
- return this.setLimit("min", value, true, errorUtil.toString(message));
8664
- }
8665
- gt(value, message) {
8666
- return this.setLimit("min", value, false, errorUtil.toString(message));
8667
- }
8668
- lte(value, message) {
8669
- return this.setLimit("max", value, true, errorUtil.toString(message));
8670
- }
8671
- lt(value, message) {
8672
- return this.setLimit("max", value, false, errorUtil.toString(message));
8673
- }
8674
- setLimit(kind, value, inclusive, message) {
8675
- return new _ZodBigInt({
8676
- ...this._def,
8677
- checks: [
8678
- ...this._def.checks,
8679
- {
8680
- kind,
8681
- value,
8682
- inclusive,
8683
- message: errorUtil.toString(message)
8684
- }
8685
- ]
8686
- });
8687
- }
8688
- _addCheck(check2) {
8689
- return new _ZodBigInt({
8690
- ...this._def,
8691
- checks: [...this._def.checks, check2]
8692
- });
8693
- }
8694
- positive(message) {
8695
- return this._addCheck({
8696
- kind: "min",
8697
- value: BigInt(0),
8698
- inclusive: false,
8699
- message: errorUtil.toString(message)
8700
- });
8701
- }
8702
- negative(message) {
8703
- return this._addCheck({
8704
- kind: "max",
8705
- value: BigInt(0),
8706
- inclusive: false,
8707
- message: errorUtil.toString(message)
8708
- });
8709
- }
8710
- nonpositive(message) {
8711
- return this._addCheck({
8712
- kind: "max",
8713
- value: BigInt(0),
8714
- inclusive: true,
8715
- message: errorUtil.toString(message)
8716
- });
8717
- }
8718
- nonnegative(message) {
8719
- return this._addCheck({
8720
- kind: "min",
8721
- value: BigInt(0),
8722
- inclusive: true,
8723
- message: errorUtil.toString(message)
8724
- });
8725
- }
8726
- multipleOf(value, message) {
8727
- return this._addCheck({
8728
- kind: "multipleOf",
8729
- value,
8730
- message: errorUtil.toString(message)
8731
- });
8732
- }
8733
- get minValue() {
8734
- let min = null;
8735
- for (const ch of this._def.checks) {
8736
- if (ch.kind === "min") {
8737
- if (min === null || ch.value > min)
8738
- min = ch.value;
8739
- }
8740
- }
8741
- return min;
8742
- }
8743
- get maxValue() {
8744
- let max = null;
8745
- for (const ch of this._def.checks) {
8746
- if (ch.kind === "max") {
8747
- if (max === null || ch.value < max)
8748
- max = ch.value;
8749
- }
8750
- }
8751
- return max;
8752
- }
8753
- };
8754
- ZodBigInt.create = (params) => {
8755
- return new ZodBigInt({
8756
- checks: [],
8757
- typeName: ZodFirstPartyTypeKind.ZodBigInt,
8758
- coerce: params?.coerce ?? false,
8759
- ...processCreateParams(params)
8760
- });
8761
- };
8762
- var ZodBoolean = class extends ZodType {
8763
- _parse(input) {
8764
- if (this._def.coerce) {
8765
- input.data = Boolean(input.data);
8766
- }
8767
- const parsedType2 = this._getType(input);
8768
- if (parsedType2 !== ZodParsedType.boolean) {
8769
- const ctx = this._getOrReturnCtx(input);
8770
- addIssueToContext(ctx, {
8771
- code: ZodIssueCode.invalid_type,
8772
- expected: ZodParsedType.boolean,
8773
- received: ctx.parsedType
8774
- });
8775
- return INVALID;
8776
- }
8777
- return OK(input.data);
8778
- }
8779
- };
8780
- ZodBoolean.create = (params) => {
8781
- return new ZodBoolean({
8782
- typeName: ZodFirstPartyTypeKind.ZodBoolean,
8783
- coerce: params?.coerce || false,
8784
- ...processCreateParams(params)
8785
- });
8786
- };
8787
- var ZodDate = class _ZodDate extends ZodType {
8788
- _parse(input) {
8789
- if (this._def.coerce) {
8790
- input.data = new Date(input.data);
8791
- }
8792
- const parsedType2 = this._getType(input);
8793
- if (parsedType2 !== ZodParsedType.date) {
8794
- const ctx2 = this._getOrReturnCtx(input);
8795
- addIssueToContext(ctx2, {
8796
- code: ZodIssueCode.invalid_type,
8797
- expected: ZodParsedType.date,
8798
- received: ctx2.parsedType
8799
- });
8800
- return INVALID;
8801
- }
8802
- if (Number.isNaN(input.data.getTime())) {
8803
- const ctx2 = this._getOrReturnCtx(input);
8804
- addIssueToContext(ctx2, {
8805
- code: ZodIssueCode.invalid_date
8806
- });
8807
- return INVALID;
8808
- }
8809
- const status = new ParseStatus();
8810
- let ctx = void 0;
8811
- for (const check2 of this._def.checks) {
8812
- if (check2.kind === "min") {
8813
- if (input.data.getTime() < check2.value) {
8814
- ctx = this._getOrReturnCtx(input, ctx);
8815
- addIssueToContext(ctx, {
8816
- code: ZodIssueCode.too_small,
8817
- message: check2.message,
8818
- inclusive: true,
8819
- exact: false,
8820
- minimum: check2.value,
8821
- type: "date"
8822
- });
8823
- status.dirty();
8824
- }
8825
- } else if (check2.kind === "max") {
8826
- if (input.data.getTime() > check2.value) {
8827
- ctx = this._getOrReturnCtx(input, ctx);
8828
- addIssueToContext(ctx, {
8829
- code: ZodIssueCode.too_big,
8830
- message: check2.message,
8831
- inclusive: true,
8832
- exact: false,
8833
- maximum: check2.value,
8834
- type: "date"
8835
- });
8836
- status.dirty();
8837
- }
8838
- } else {
8839
- util.assertNever(check2);
8840
- }
8841
- }
8842
- return {
8843
- status: status.value,
8844
- value: new Date(input.data.getTime())
8845
- };
8846
- }
8847
- _addCheck(check2) {
8848
- return new _ZodDate({
8849
- ...this._def,
8850
- checks: [...this._def.checks, check2]
8851
- });
8852
- }
8853
- min(minDate, message) {
8854
- return this._addCheck({
8855
- kind: "min",
8856
- value: minDate.getTime(),
8857
- message: errorUtil.toString(message)
8858
- });
8859
- }
8860
- max(maxDate, message) {
8861
- return this._addCheck({
8862
- kind: "max",
8863
- value: maxDate.getTime(),
8864
- message: errorUtil.toString(message)
8865
- });
8866
- }
8867
- get minDate() {
8868
- let min = null;
8869
- for (const ch of this._def.checks) {
8870
- if (ch.kind === "min") {
8871
- if (min === null || ch.value > min)
8872
- min = ch.value;
8873
- }
8874
- }
8875
- return min != null ? new Date(min) : null;
8876
- }
8877
- get maxDate() {
8878
- let max = null;
8879
- for (const ch of this._def.checks) {
8880
- if (ch.kind === "max") {
8881
- if (max === null || ch.value < max)
8882
- max = ch.value;
8883
- }
8884
- }
8885
- return max != null ? new Date(max) : null;
8886
- }
8887
- };
8888
- ZodDate.create = (params) => {
8889
- return new ZodDate({
8890
- checks: [],
8891
- coerce: params?.coerce || false,
8892
- typeName: ZodFirstPartyTypeKind.ZodDate,
8893
- ...processCreateParams(params)
8894
- });
8895
- };
8896
- var ZodSymbol = class extends ZodType {
8897
- _parse(input) {
8898
- const parsedType2 = this._getType(input);
8899
- if (parsedType2 !== ZodParsedType.symbol) {
8900
- const ctx = this._getOrReturnCtx(input);
8901
- addIssueToContext(ctx, {
8902
- code: ZodIssueCode.invalid_type,
8903
- expected: ZodParsedType.symbol,
8904
- received: ctx.parsedType
8905
- });
8906
- return INVALID;
8907
- }
8908
- return OK(input.data);
8909
- }
8910
- };
8911
- ZodSymbol.create = (params) => {
8912
- return new ZodSymbol({
8913
- typeName: ZodFirstPartyTypeKind.ZodSymbol,
8914
- ...processCreateParams(params)
8915
- });
8916
- };
8917
- var ZodUndefined = class extends ZodType {
8918
- _parse(input) {
8919
- const parsedType2 = this._getType(input);
8920
- if (parsedType2 !== ZodParsedType.undefined) {
8921
- const ctx = this._getOrReturnCtx(input);
8922
- addIssueToContext(ctx, {
8923
- code: ZodIssueCode.invalid_type,
8924
- expected: ZodParsedType.undefined,
8925
- received: ctx.parsedType
8926
- });
8927
- return INVALID;
8928
- }
8929
- return OK(input.data);
8930
- }
8931
- };
8932
- ZodUndefined.create = (params) => {
8933
- return new ZodUndefined({
8934
- typeName: ZodFirstPartyTypeKind.ZodUndefined,
8935
- ...processCreateParams(params)
8936
- });
8937
- };
8938
- var ZodNull = class extends ZodType {
8939
- _parse(input) {
8940
- const parsedType2 = this._getType(input);
8941
- if (parsedType2 !== ZodParsedType.null) {
8942
- const ctx = this._getOrReturnCtx(input);
8943
- addIssueToContext(ctx, {
8944
- code: ZodIssueCode.invalid_type,
8945
- expected: ZodParsedType.null,
8946
- received: ctx.parsedType
8947
- });
8948
- return INVALID;
8949
- }
8950
- return OK(input.data);
8951
- }
8952
- };
8953
- ZodNull.create = (params) => {
8954
- return new ZodNull({
8955
- typeName: ZodFirstPartyTypeKind.ZodNull,
8956
- ...processCreateParams(params)
8957
- });
8958
- };
8959
- var ZodAny = class extends ZodType {
8960
- constructor() {
8961
- super(...arguments);
8962
- this._any = true;
8963
- }
8964
- _parse(input) {
8965
- return OK(input.data);
8966
- }
8967
- };
8968
- ZodAny.create = (params) => {
8969
- return new ZodAny({
8970
- typeName: ZodFirstPartyTypeKind.ZodAny,
8971
- ...processCreateParams(params)
8972
- });
8973
- };
8974
- var ZodUnknown = class extends ZodType {
8975
- constructor() {
8976
- super(...arguments);
8977
- this._unknown = true;
8978
- }
8979
- _parse(input) {
8980
- return OK(input.data);
8981
- }
8982
- };
8983
- ZodUnknown.create = (params) => {
8984
- return new ZodUnknown({
8985
- typeName: ZodFirstPartyTypeKind.ZodUnknown,
8986
- ...processCreateParams(params)
8987
- });
8988
- };
8989
- var ZodNever = class extends ZodType {
8990
- _parse(input) {
8991
- const ctx = this._getOrReturnCtx(input);
8992
- addIssueToContext(ctx, {
8993
- code: ZodIssueCode.invalid_type,
8994
- expected: ZodParsedType.never,
8995
- received: ctx.parsedType
8996
- });
8997
- return INVALID;
8998
- }
8999
- };
9000
- ZodNever.create = (params) => {
9001
- return new ZodNever({
9002
- typeName: ZodFirstPartyTypeKind.ZodNever,
9003
- ...processCreateParams(params)
9004
- });
9005
- };
9006
- var ZodVoid = class extends ZodType {
9007
- _parse(input) {
9008
- const parsedType2 = this._getType(input);
9009
- if (parsedType2 !== ZodParsedType.undefined) {
9010
- const ctx = this._getOrReturnCtx(input);
9011
- addIssueToContext(ctx, {
9012
- code: ZodIssueCode.invalid_type,
9013
- expected: ZodParsedType.void,
9014
- received: ctx.parsedType
9015
- });
9016
- return INVALID;
9017
- }
9018
- return OK(input.data);
9019
- }
9020
- };
9021
- ZodVoid.create = (params) => {
9022
- return new ZodVoid({
9023
- typeName: ZodFirstPartyTypeKind.ZodVoid,
9024
- ...processCreateParams(params)
9025
- });
9026
- };
9027
- var ZodArray = class _ZodArray extends ZodType {
9028
- _parse(input) {
9029
- const { ctx, status } = this._processInputParams(input);
9030
- const def = this._def;
9031
- if (ctx.parsedType !== ZodParsedType.array) {
9032
- addIssueToContext(ctx, {
9033
- code: ZodIssueCode.invalid_type,
9034
- expected: ZodParsedType.array,
9035
- received: ctx.parsedType
9036
- });
9037
- return INVALID;
9038
- }
9039
- if (def.exactLength !== null) {
9040
- const tooBig = ctx.data.length > def.exactLength.value;
9041
- const tooSmall = ctx.data.length < def.exactLength.value;
9042
- if (tooBig || tooSmall) {
9043
- addIssueToContext(ctx, {
9044
- code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
9045
- minimum: tooSmall ? def.exactLength.value : void 0,
9046
- maximum: tooBig ? def.exactLength.value : void 0,
9047
- type: "array",
9048
- inclusive: true,
9049
- exact: true,
9050
- message: def.exactLength.message
9051
- });
9052
- status.dirty();
9053
- }
9054
- }
9055
- if (def.minLength !== null) {
9056
- if (ctx.data.length < def.minLength.value) {
9057
- addIssueToContext(ctx, {
9058
- code: ZodIssueCode.too_small,
9059
- minimum: def.minLength.value,
9060
- type: "array",
9061
- inclusive: true,
9062
- exact: false,
9063
- message: def.minLength.message
9064
- });
9065
- status.dirty();
9066
- }
9067
- }
9068
- if (def.maxLength !== null) {
9069
- if (ctx.data.length > def.maxLength.value) {
9070
- addIssueToContext(ctx, {
9071
- code: ZodIssueCode.too_big,
9072
- maximum: def.maxLength.value,
9073
- type: "array",
9074
- inclusive: true,
9075
- exact: false,
9076
- message: def.maxLength.message
9077
- });
9078
- status.dirty();
9079
- }
9080
- }
9081
- if (ctx.common.async) {
9082
- return Promise.all([...ctx.data].map((item, i) => {
9083
- return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
9084
- })).then((result2) => {
9085
- return ParseStatus.mergeArray(status, result2);
9086
- });
9087
- }
9088
- const result = [...ctx.data].map((item, i) => {
9089
- return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
9090
- });
9091
- return ParseStatus.mergeArray(status, result);
9092
- }
9093
- get element() {
9094
- return this._def.type;
9095
- }
9096
- min(minLength, message) {
9097
- return new _ZodArray({
9098
- ...this._def,
9099
- minLength: { value: minLength, message: errorUtil.toString(message) }
9100
- });
9101
- }
9102
- max(maxLength, message) {
9103
- return new _ZodArray({
9104
- ...this._def,
9105
- maxLength: { value: maxLength, message: errorUtil.toString(message) }
9106
- });
9107
- }
9108
- length(len, message) {
9109
- return new _ZodArray({
9110
- ...this._def,
9111
- exactLength: { value: len, message: errorUtil.toString(message) }
9112
- });
9113
- }
9114
- nonempty(message) {
9115
- return this.min(1, message);
9116
- }
9117
- };
9118
- ZodArray.create = (schema, params) => {
9119
- return new ZodArray({
9120
- type: schema,
9121
- minLength: null,
9122
- maxLength: null,
9123
- exactLength: null,
9124
- typeName: ZodFirstPartyTypeKind.ZodArray,
9125
- ...processCreateParams(params)
9126
- });
9127
- };
9128
- function deepPartialify(schema) {
9129
- if (schema instanceof ZodObject) {
9130
- const newShape = {};
9131
- for (const key in schema.shape) {
9132
- const fieldSchema = schema.shape[key];
9133
- newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
9134
- }
9135
- return new ZodObject({
9136
- ...schema._def,
9137
- shape: () => newShape
9138
- });
9139
- } else if (schema instanceof ZodArray) {
9140
- return new ZodArray({
9141
- ...schema._def,
9142
- type: deepPartialify(schema.element)
9143
- });
9144
- } else if (schema instanceof ZodOptional) {
9145
- return ZodOptional.create(deepPartialify(schema.unwrap()));
9146
- } else if (schema instanceof ZodNullable) {
9147
- return ZodNullable.create(deepPartialify(schema.unwrap()));
9148
- } else if (schema instanceof ZodTuple) {
9149
- return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
9150
- } else {
9151
- return schema;
9152
- }
9153
- }
9154
- var ZodObject = class _ZodObject extends ZodType {
9155
- constructor() {
9156
- super(...arguments);
9157
- this._cached = null;
9158
- this.nonstrict = this.passthrough;
9159
- this.augment = this.extend;
9160
- }
9161
- _getCached() {
9162
- if (this._cached !== null)
9163
- return this._cached;
9164
- const shape = this._def.shape();
9165
- const keys = util.objectKeys(shape);
9166
- this._cached = { shape, keys };
9167
- return this._cached;
9168
- }
9169
- _parse(input) {
9170
- const parsedType2 = this._getType(input);
9171
- if (parsedType2 !== ZodParsedType.object) {
9172
- const ctx2 = this._getOrReturnCtx(input);
9173
- addIssueToContext(ctx2, {
9174
- code: ZodIssueCode.invalid_type,
9175
- expected: ZodParsedType.object,
9176
- received: ctx2.parsedType
9177
- });
9178
- return INVALID;
9179
- }
9180
- const { status, ctx } = this._processInputParams(input);
9181
- const { shape, keys: shapeKeys } = this._getCached();
9182
- const extraKeys = [];
9183
- if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
9184
- for (const key in ctx.data) {
9185
- if (!shapeKeys.includes(key)) {
9186
- extraKeys.push(key);
9187
- }
9188
- }
9189
- }
9190
- const pairs = [];
9191
- for (const key of shapeKeys) {
9192
- const keyValidator = shape[key];
9193
- const value = ctx.data[key];
9194
- pairs.push({
9195
- key: { status: "valid", value: key },
9196
- value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
9197
- alwaysSet: key in ctx.data
9198
- });
9199
- }
9200
- if (this._def.catchall instanceof ZodNever) {
9201
- const unknownKeys = this._def.unknownKeys;
9202
- if (unknownKeys === "passthrough") {
9203
- for (const key of extraKeys) {
9204
- pairs.push({
9205
- key: { status: "valid", value: key },
9206
- value: { status: "valid", value: ctx.data[key] }
9207
- });
9208
- }
9209
- } else if (unknownKeys === "strict") {
9210
- if (extraKeys.length > 0) {
9211
- addIssueToContext(ctx, {
9212
- code: ZodIssueCode.unrecognized_keys,
9213
- keys: extraKeys
9214
- });
9215
- status.dirty();
9216
- }
9217
- } else if (unknownKeys === "strip") {
9218
- } else {
9219
- throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
9220
- }
9221
- } else {
9222
- const catchall = this._def.catchall;
9223
- for (const key of extraKeys) {
9224
- const value = ctx.data[key];
9225
- pairs.push({
9226
- key: { status: "valid", value: key },
9227
- value: catchall._parse(
9228
- new ParseInputLazyPath(ctx, value, ctx.path, key)
9229
- //, ctx.child(key), value, getParsedType(value)
9230
- ),
9231
- alwaysSet: key in ctx.data
9232
- });
9233
- }
9234
- }
9235
- if (ctx.common.async) {
9236
- return Promise.resolve().then(async () => {
9237
- const syncPairs = [];
9238
- for (const pair of pairs) {
9239
- const key = await pair.key;
9240
- const value = await pair.value;
9241
- syncPairs.push({
9242
- key,
9243
- value,
9244
- alwaysSet: pair.alwaysSet
9245
- });
9246
- }
9247
- return syncPairs;
9248
- }).then((syncPairs) => {
9249
- return ParseStatus.mergeObjectSync(status, syncPairs);
9250
- });
9251
- } else {
9252
- return ParseStatus.mergeObjectSync(status, pairs);
9253
- }
9254
- }
9255
- get shape() {
9256
- return this._def.shape();
9257
- }
9258
- strict(message) {
9259
- errorUtil.errToObj;
9260
- return new _ZodObject({
9261
- ...this._def,
9262
- unknownKeys: "strict",
9263
- ...message !== void 0 ? {
9264
- errorMap: (issue2, ctx) => {
9265
- const defaultError = this._def.errorMap?.(issue2, ctx).message ?? ctx.defaultError;
9266
- if (issue2.code === "unrecognized_keys")
9267
- return {
9268
- message: errorUtil.errToObj(message).message ?? defaultError
9269
- };
9270
- return {
9271
- message: defaultError
9272
- };
9273
- }
9274
- } : {}
9275
- });
9276
- }
9277
- strip() {
9278
- return new _ZodObject({
9279
- ...this._def,
9280
- unknownKeys: "strip"
9281
- });
9282
- }
9283
- passthrough() {
9284
- return new _ZodObject({
9285
- ...this._def,
9286
- unknownKeys: "passthrough"
9287
- });
9288
- }
9289
- // const AugmentFactory =
9290
- // <Def extends ZodObjectDef>(def: Def) =>
9291
- // <Augmentation extends ZodRawShape>(
9292
- // augmentation: Augmentation
9293
- // ): ZodObject<
9294
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
9295
- // Def["unknownKeys"],
9296
- // Def["catchall"]
9297
- // > => {
9298
- // return new ZodObject({
9299
- // ...def,
9300
- // shape: () => ({
9301
- // ...def.shape(),
9302
- // ...augmentation,
9303
- // }),
9304
- // }) as any;
9305
- // };
9306
- extend(augmentation) {
9307
- return new _ZodObject({
9308
- ...this._def,
9309
- shape: () => ({
9310
- ...this._def.shape(),
9311
- ...augmentation
9312
- })
9313
- });
9314
- }
9315
- /**
9316
- * Prior to zod@1.0.12 there was a bug in the
9317
- * inferred type of merged objects. Please
9318
- * upgrade if you are experiencing issues.
9319
- */
9320
- merge(merging) {
9321
- const merged = new _ZodObject({
9322
- unknownKeys: merging._def.unknownKeys,
9323
- catchall: merging._def.catchall,
9324
- shape: () => ({
9325
- ...this._def.shape(),
9326
- ...merging._def.shape()
9327
- }),
9328
- typeName: ZodFirstPartyTypeKind.ZodObject
9329
- });
9330
- return merged;
9331
- }
9332
- // merge<
9333
- // Incoming extends AnyZodObject,
9334
- // Augmentation extends Incoming["shape"],
9335
- // NewOutput extends {
9336
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
9337
- // ? Augmentation[k]["_output"]
9338
- // : k extends keyof Output
9339
- // ? Output[k]
9340
- // : never;
9341
- // },
9342
- // NewInput extends {
9343
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
9344
- // ? Augmentation[k]["_input"]
9345
- // : k extends keyof Input
9346
- // ? Input[k]
9347
- // : never;
9348
- // }
9349
- // >(
9350
- // merging: Incoming
9351
- // ): ZodObject<
9352
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
9353
- // Incoming["_def"]["unknownKeys"],
9354
- // Incoming["_def"]["catchall"],
9355
- // NewOutput,
9356
- // NewInput
9357
- // > {
9358
- // const merged: any = new ZodObject({
9359
- // unknownKeys: merging._def.unknownKeys,
9360
- // catchall: merging._def.catchall,
9361
- // shape: () =>
9362
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
9363
- // typeName: ZodFirstPartyTypeKind.ZodObject,
9364
- // }) as any;
9365
- // return merged;
9366
- // }
9367
- setKey(key, schema) {
9368
- return this.augment({ [key]: schema });
9369
- }
9370
- // merge<Incoming extends AnyZodObject>(
9371
- // merging: Incoming
9372
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
9373
- // ZodObject<
9374
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
9375
- // Incoming["_def"]["unknownKeys"],
9376
- // Incoming["_def"]["catchall"]
9377
- // > {
9378
- // // const mergedShape = objectUtil.mergeShapes(
9379
- // // this._def.shape(),
9380
- // // merging._def.shape()
9381
- // // );
9382
- // const merged: any = new ZodObject({
9383
- // unknownKeys: merging._def.unknownKeys,
9384
- // catchall: merging._def.catchall,
9385
- // shape: () =>
9386
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
9387
- // typeName: ZodFirstPartyTypeKind.ZodObject,
9388
- // }) as any;
9389
- // return merged;
9390
- // }
9391
- catchall(index) {
9392
- return new _ZodObject({
9393
- ...this._def,
9394
- catchall: index
9395
- });
9396
- }
9397
- pick(mask) {
9398
- const shape = {};
9399
- for (const key of util.objectKeys(mask)) {
9400
- if (mask[key] && this.shape[key]) {
9401
- shape[key] = this.shape[key];
9402
- }
9403
- }
9404
- return new _ZodObject({
9405
- ...this._def,
9406
- shape: () => shape
9407
- });
9408
- }
9409
- omit(mask) {
9410
- const shape = {};
9411
- for (const key of util.objectKeys(this.shape)) {
9412
- if (!mask[key]) {
9413
- shape[key] = this.shape[key];
9414
- }
9415
- }
9416
- return new _ZodObject({
9417
- ...this._def,
9418
- shape: () => shape
9419
- });
9420
- }
9421
- /**
9422
- * @deprecated
9423
- */
9424
- deepPartial() {
9425
- return deepPartialify(this);
9426
- }
9427
- partial(mask) {
9428
- const newShape = {};
9429
- for (const key of util.objectKeys(this.shape)) {
9430
- const fieldSchema = this.shape[key];
9431
- if (mask && !mask[key]) {
9432
- newShape[key] = fieldSchema;
9433
- } else {
9434
- newShape[key] = fieldSchema.optional();
9435
- }
9436
- }
9437
- return new _ZodObject({
9438
- ...this._def,
9439
- shape: () => newShape
9440
- });
9441
- }
9442
- required(mask) {
9443
- const newShape = {};
9444
- for (const key of util.objectKeys(this.shape)) {
9445
- if (mask && !mask[key]) {
9446
- newShape[key] = this.shape[key];
9447
- } else {
9448
- const fieldSchema = this.shape[key];
9449
- let newField = fieldSchema;
9450
- while (newField instanceof ZodOptional) {
9451
- newField = newField._def.innerType;
9452
- }
9453
- newShape[key] = newField;
9454
- }
9455
- }
9456
- return new _ZodObject({
9457
- ...this._def,
9458
- shape: () => newShape
9459
- });
9460
- }
9461
- keyof() {
9462
- return createZodEnum(util.objectKeys(this.shape));
9463
- }
9464
- };
9465
- ZodObject.create = (shape, params) => {
9466
- return new ZodObject({
9467
- shape: () => shape,
9468
- unknownKeys: "strip",
9469
- catchall: ZodNever.create(),
9470
- typeName: ZodFirstPartyTypeKind.ZodObject,
9471
- ...processCreateParams(params)
9472
- });
9473
- };
9474
- ZodObject.strictCreate = (shape, params) => {
9475
- return new ZodObject({
9476
- shape: () => shape,
9477
- unknownKeys: "strict",
9478
- catchall: ZodNever.create(),
9479
- typeName: ZodFirstPartyTypeKind.ZodObject,
9480
- ...processCreateParams(params)
9481
- });
9482
- };
9483
- ZodObject.lazycreate = (shape, params) => {
9484
- return new ZodObject({
9485
- shape,
9486
- unknownKeys: "strip",
9487
- catchall: ZodNever.create(),
9488
- typeName: ZodFirstPartyTypeKind.ZodObject,
9489
- ...processCreateParams(params)
9490
- });
9491
- };
9492
- var ZodUnion = class extends ZodType {
9493
- _parse(input) {
9494
- const { ctx } = this._processInputParams(input);
9495
- const options = this._def.options;
9496
- function handleResults(results) {
9497
- for (const result of results) {
9498
- if (result.result.status === "valid") {
9499
- return result.result;
9500
- }
9501
- }
9502
- for (const result of results) {
9503
- if (result.result.status === "dirty") {
9504
- ctx.common.issues.push(...result.ctx.common.issues);
9505
- return result.result;
9506
- }
9507
- }
9508
- const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
9509
- addIssueToContext(ctx, {
9510
- code: ZodIssueCode.invalid_union,
9511
- unionErrors
9512
- });
9513
- return INVALID;
9514
- }
9515
- if (ctx.common.async) {
9516
- return Promise.all(options.map(async (option) => {
9517
- const childCtx = {
9518
- ...ctx,
9519
- common: {
9520
- ...ctx.common,
9521
- issues: []
9522
- },
9523
- parent: null
9524
- };
9525
- return {
9526
- result: await option._parseAsync({
9527
- data: ctx.data,
9528
- path: ctx.path,
9529
- parent: childCtx
9530
- }),
9531
- ctx: childCtx
9532
- };
9533
- })).then(handleResults);
9534
- } else {
9535
- let dirty = void 0;
9536
- const issues = [];
9537
- for (const option of options) {
9538
- const childCtx = {
9539
- ...ctx,
9540
- common: {
9541
- ...ctx.common,
9542
- issues: []
9543
- },
9544
- parent: null
9545
- };
9546
- const result = option._parseSync({
9547
- data: ctx.data,
9548
- path: ctx.path,
9549
- parent: childCtx
9550
- });
9551
- if (result.status === "valid") {
9552
- return result;
9553
- } else if (result.status === "dirty" && !dirty) {
9554
- dirty = { result, ctx: childCtx };
9555
- }
9556
- if (childCtx.common.issues.length) {
9557
- issues.push(childCtx.common.issues);
9558
- }
9559
- }
9560
- if (dirty) {
9561
- ctx.common.issues.push(...dirty.ctx.common.issues);
9562
- return dirty.result;
9563
- }
9564
- const unionErrors = issues.map((issues2) => new ZodError(issues2));
9565
- addIssueToContext(ctx, {
9566
- code: ZodIssueCode.invalid_union,
9567
- unionErrors
9568
- });
9569
- return INVALID;
9570
- }
9571
- }
9572
- get options() {
9573
- return this._def.options;
9574
- }
9575
- };
9576
- ZodUnion.create = (types, params) => {
9577
- return new ZodUnion({
9578
- options: types,
9579
- typeName: ZodFirstPartyTypeKind.ZodUnion,
9580
- ...processCreateParams(params)
9581
- });
9582
- };
9583
- var getDiscriminator = (type) => {
9584
- if (type instanceof ZodLazy) {
9585
- return getDiscriminator(type.schema);
9586
- } else if (type instanceof ZodEffects) {
9587
- return getDiscriminator(type.innerType());
9588
- } else if (type instanceof ZodLiteral) {
9589
- return [type.value];
9590
- } else if (type instanceof ZodEnum) {
9591
- return type.options;
9592
- } else if (type instanceof ZodNativeEnum) {
9593
- return util.objectValues(type.enum);
9594
- } else if (type instanceof ZodDefault) {
9595
- return getDiscriminator(type._def.innerType);
9596
- } else if (type instanceof ZodUndefined) {
9597
- return [void 0];
9598
- } else if (type instanceof ZodNull) {
9599
- return [null];
9600
- } else if (type instanceof ZodOptional) {
9601
- return [void 0, ...getDiscriminator(type.unwrap())];
9602
- } else if (type instanceof ZodNullable) {
9603
- return [null, ...getDiscriminator(type.unwrap())];
9604
- } else if (type instanceof ZodBranded) {
9605
- return getDiscriminator(type.unwrap());
9606
- } else if (type instanceof ZodReadonly) {
9607
- return getDiscriminator(type.unwrap());
9608
- } else if (type instanceof ZodCatch) {
9609
- return getDiscriminator(type._def.innerType);
9610
- } else {
9611
- return [];
9612
- }
9613
- };
9614
- var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
9615
- _parse(input) {
9616
- const { ctx } = this._processInputParams(input);
9617
- if (ctx.parsedType !== ZodParsedType.object) {
9618
- addIssueToContext(ctx, {
9619
- code: ZodIssueCode.invalid_type,
9620
- expected: ZodParsedType.object,
9621
- received: ctx.parsedType
9622
- });
9623
- return INVALID;
9624
- }
9625
- const discriminator = this.discriminator;
9626
- const discriminatorValue = ctx.data[discriminator];
9627
- const option = this.optionsMap.get(discriminatorValue);
9628
- if (!option) {
9629
- addIssueToContext(ctx, {
9630
- code: ZodIssueCode.invalid_union_discriminator,
9631
- options: Array.from(this.optionsMap.keys()),
9632
- path: [discriminator]
9633
- });
9634
- return INVALID;
9635
- }
9636
- if (ctx.common.async) {
9637
- return option._parseAsync({
9638
- data: ctx.data,
9639
- path: ctx.path,
9640
- parent: ctx
9641
- });
9642
- } else {
9643
- return option._parseSync({
9644
- data: ctx.data,
9645
- path: ctx.path,
9646
- parent: ctx
9647
- });
9648
- }
9649
- }
9650
- get discriminator() {
9651
- return this._def.discriminator;
9652
- }
9653
- get options() {
9654
- return this._def.options;
9655
- }
9656
- get optionsMap() {
9657
- return this._def.optionsMap;
9658
- }
9659
- /**
9660
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
9661
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
9662
- * have a different value for each object in the union.
9663
- * @param discriminator the name of the discriminator property
9664
- * @param types an array of object schemas
9665
- * @param params
9666
- */
9667
- static create(discriminator, options, params) {
9668
- const optionsMap = /* @__PURE__ */ new Map();
9669
- for (const type of options) {
9670
- const discriminatorValues = getDiscriminator(type.shape[discriminator]);
9671
- if (!discriminatorValues.length) {
9672
- throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
9673
- }
9674
- for (const value of discriminatorValues) {
9675
- if (optionsMap.has(value)) {
9676
- throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
9677
- }
9678
- optionsMap.set(value, type);
9679
- }
9680
- }
9681
- return new _ZodDiscriminatedUnion({
9682
- typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
9683
- discriminator,
9684
- options,
9685
- optionsMap,
9686
- ...processCreateParams(params)
9687
- });
9688
- }
9689
- };
9690
- function mergeValues(a, b) {
9691
- const aType = getParsedType(a);
9692
- const bType = getParsedType(b);
9693
- if (a === b) {
9694
- return { valid: true, data: a };
9695
- } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
9696
- const bKeys = util.objectKeys(b);
9697
- const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
9698
- const newObj = { ...a, ...b };
9699
- for (const key of sharedKeys) {
9700
- const sharedValue = mergeValues(a[key], b[key]);
9701
- if (!sharedValue.valid) {
9702
- return { valid: false };
9703
- }
9704
- newObj[key] = sharedValue.data;
9705
- }
9706
- return { valid: true, data: newObj };
9707
- } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
9708
- if (a.length !== b.length) {
9709
- return { valid: false };
9710
- }
9711
- const newArray = [];
9712
- for (let index = 0; index < a.length; index++) {
9713
- const itemA = a[index];
9714
- const itemB = b[index];
9715
- const sharedValue = mergeValues(itemA, itemB);
9716
- if (!sharedValue.valid) {
9717
- return { valid: false };
9718
- }
9719
- newArray.push(sharedValue.data);
9720
- }
9721
- return { valid: true, data: newArray };
9722
- } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
9723
- return { valid: true, data: a };
9724
- } else {
9725
- return { valid: false };
9726
- }
9727
- }
9728
- var ZodIntersection = class extends ZodType {
9729
- _parse(input) {
9730
- const { status, ctx } = this._processInputParams(input);
9731
- const handleParsed = (parsedLeft, parsedRight) => {
9732
- if (isAborted(parsedLeft) || isAborted(parsedRight)) {
9733
- return INVALID;
9734
- }
9735
- const merged = mergeValues(parsedLeft.value, parsedRight.value);
9736
- if (!merged.valid) {
9737
- addIssueToContext(ctx, {
9738
- code: ZodIssueCode.invalid_intersection_types
9739
- });
9740
- return INVALID;
9741
- }
9742
- if (isDirty(parsedLeft) || isDirty(parsedRight)) {
9743
- status.dirty();
9744
- }
9745
- return { status: status.value, value: merged.data };
9746
- };
9747
- if (ctx.common.async) {
9748
- return Promise.all([
9749
- this._def.left._parseAsync({
9750
- data: ctx.data,
9751
- path: ctx.path,
9752
- parent: ctx
9753
- }),
9754
- this._def.right._parseAsync({
9755
- data: ctx.data,
9756
- path: ctx.path,
9757
- parent: ctx
9758
- })
9759
- ]).then(([left, right]) => handleParsed(left, right));
9760
- } else {
9761
- return handleParsed(this._def.left._parseSync({
9762
- data: ctx.data,
9763
- path: ctx.path,
9764
- parent: ctx
9765
- }), this._def.right._parseSync({
9766
- data: ctx.data,
9767
- path: ctx.path,
9768
- parent: ctx
9769
- }));
9770
- }
9771
- }
9772
- };
9773
- ZodIntersection.create = (left, right, params) => {
9774
- return new ZodIntersection({
9775
- left,
9776
- right,
9777
- typeName: ZodFirstPartyTypeKind.ZodIntersection,
9778
- ...processCreateParams(params)
9779
- });
9780
- };
9781
- var ZodTuple = class _ZodTuple extends ZodType {
9782
- _parse(input) {
9783
- const { status, ctx } = this._processInputParams(input);
9784
- if (ctx.parsedType !== ZodParsedType.array) {
9785
- addIssueToContext(ctx, {
9786
- code: ZodIssueCode.invalid_type,
9787
- expected: ZodParsedType.array,
9788
- received: ctx.parsedType
9789
- });
9790
- return INVALID;
9791
- }
9792
- if (ctx.data.length < this._def.items.length) {
9793
- addIssueToContext(ctx, {
9794
- code: ZodIssueCode.too_small,
9795
- minimum: this._def.items.length,
9796
- inclusive: true,
9797
- exact: false,
9798
- type: "array"
9799
- });
9800
- return INVALID;
9801
- }
9802
- const rest = this._def.rest;
9803
- if (!rest && ctx.data.length > this._def.items.length) {
9804
- addIssueToContext(ctx, {
9805
- code: ZodIssueCode.too_big,
9806
- maximum: this._def.items.length,
9807
- inclusive: true,
9808
- exact: false,
9809
- type: "array"
9810
- });
9811
- status.dirty();
9812
- }
9813
- const items = [...ctx.data].map((item, itemIndex) => {
9814
- const schema = this._def.items[itemIndex] || this._def.rest;
9815
- if (!schema)
9816
- return null;
9817
- return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
9818
- }).filter((x) => !!x);
9819
- if (ctx.common.async) {
9820
- return Promise.all(items).then((results) => {
9821
- return ParseStatus.mergeArray(status, results);
9822
- });
9823
- } else {
9824
- return ParseStatus.mergeArray(status, items);
9825
- }
9826
- }
9827
- get items() {
9828
- return this._def.items;
9829
- }
9830
- rest(rest) {
9831
- return new _ZodTuple({
9832
- ...this._def,
9833
- rest
9834
- });
9835
- }
9836
- };
9837
- ZodTuple.create = (schemas, params) => {
9838
- if (!Array.isArray(schemas)) {
9839
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
9840
- }
9841
- return new ZodTuple({
9842
- items: schemas,
9843
- typeName: ZodFirstPartyTypeKind.ZodTuple,
9844
- rest: null,
9845
- ...processCreateParams(params)
9846
- });
9847
- };
9848
- var ZodRecord = class _ZodRecord extends ZodType {
9849
- get keySchema() {
9850
- return this._def.keyType;
9851
- }
9852
- get valueSchema() {
9853
- return this._def.valueType;
9854
- }
9855
- _parse(input) {
9856
- const { status, ctx } = this._processInputParams(input);
9857
- if (ctx.parsedType !== ZodParsedType.object) {
9858
- addIssueToContext(ctx, {
9859
- code: ZodIssueCode.invalid_type,
9860
- expected: ZodParsedType.object,
9861
- received: ctx.parsedType
9862
- });
9863
- return INVALID;
9864
- }
9865
- const pairs = [];
9866
- const keyType = this._def.keyType;
9867
- const valueType = this._def.valueType;
9868
- for (const key in ctx.data) {
9869
- pairs.push({
9870
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
9871
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
9872
- alwaysSet: key in ctx.data
9873
- });
9874
- }
9875
- if (ctx.common.async) {
9876
- return ParseStatus.mergeObjectAsync(status, pairs);
9877
- } else {
9878
- return ParseStatus.mergeObjectSync(status, pairs);
9879
- }
9880
- }
9881
- get element() {
9882
- return this._def.valueType;
9883
- }
9884
- static create(first, second, third) {
9885
- if (second instanceof ZodType) {
9886
- return new _ZodRecord({
9887
- keyType: first,
9888
- valueType: second,
9889
- typeName: ZodFirstPartyTypeKind.ZodRecord,
9890
- ...processCreateParams(third)
9891
- });
9892
- }
9893
- return new _ZodRecord({
9894
- keyType: ZodString.create(),
9895
- valueType: first,
9896
- typeName: ZodFirstPartyTypeKind.ZodRecord,
9897
- ...processCreateParams(second)
9898
- });
9899
- }
9900
- };
9901
- var ZodMap = class extends ZodType {
9902
- get keySchema() {
9903
- return this._def.keyType;
9904
- }
9905
- get valueSchema() {
9906
- return this._def.valueType;
9907
- }
9908
- _parse(input) {
9909
- const { status, ctx } = this._processInputParams(input);
9910
- if (ctx.parsedType !== ZodParsedType.map) {
9911
- addIssueToContext(ctx, {
9912
- code: ZodIssueCode.invalid_type,
9913
- expected: ZodParsedType.map,
9914
- received: ctx.parsedType
9915
- });
9916
- return INVALID;
9917
- }
9918
- const keyType = this._def.keyType;
9919
- const valueType = this._def.valueType;
9920
- const pairs = [...ctx.data.entries()].map(([key, value], index) => {
9921
- return {
9922
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
9923
- value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
9924
- };
9925
- });
9926
- if (ctx.common.async) {
9927
- const finalMap = /* @__PURE__ */ new Map();
9928
- return Promise.resolve().then(async () => {
9929
- for (const pair of pairs) {
9930
- const key = await pair.key;
9931
- const value = await pair.value;
9932
- if (key.status === "aborted" || value.status === "aborted") {
9933
- return INVALID;
9934
- }
9935
- if (key.status === "dirty" || value.status === "dirty") {
9936
- status.dirty();
9937
- }
9938
- finalMap.set(key.value, value.value);
9939
- }
9940
- return { status: status.value, value: finalMap };
9941
- });
9942
- } else {
9943
- const finalMap = /* @__PURE__ */ new Map();
9944
- for (const pair of pairs) {
9945
- const key = pair.key;
9946
- const value = pair.value;
9947
- if (key.status === "aborted" || value.status === "aborted") {
9948
- return INVALID;
9949
- }
9950
- if (key.status === "dirty" || value.status === "dirty") {
9951
- status.dirty();
9952
- }
9953
- finalMap.set(key.value, value.value);
9954
- }
9955
- return { status: status.value, value: finalMap };
9956
- }
9957
- }
9958
- };
9959
- ZodMap.create = (keyType, valueType, params) => {
9960
- return new ZodMap({
9961
- valueType,
9962
- keyType,
9963
- typeName: ZodFirstPartyTypeKind.ZodMap,
9964
- ...processCreateParams(params)
9965
- });
9966
- };
9967
- var ZodSet = class _ZodSet extends ZodType {
9968
- _parse(input) {
9969
- const { status, ctx } = this._processInputParams(input);
9970
- if (ctx.parsedType !== ZodParsedType.set) {
9971
- addIssueToContext(ctx, {
9972
- code: ZodIssueCode.invalid_type,
9973
- expected: ZodParsedType.set,
9974
- received: ctx.parsedType
9975
- });
9976
- return INVALID;
9977
- }
9978
- const def = this._def;
9979
- if (def.minSize !== null) {
9980
- if (ctx.data.size < def.minSize.value) {
9981
- addIssueToContext(ctx, {
9982
- code: ZodIssueCode.too_small,
9983
- minimum: def.minSize.value,
9984
- type: "set",
9985
- inclusive: true,
9986
- exact: false,
9987
- message: def.minSize.message
9988
- });
9989
- status.dirty();
9990
- }
9991
- }
9992
- if (def.maxSize !== null) {
9993
- if (ctx.data.size > def.maxSize.value) {
9994
- addIssueToContext(ctx, {
9995
- code: ZodIssueCode.too_big,
9996
- maximum: def.maxSize.value,
9997
- type: "set",
9998
- inclusive: true,
9999
- exact: false,
10000
- message: def.maxSize.message
10001
- });
10002
- status.dirty();
10003
- }
10004
- }
10005
- const valueType = this._def.valueType;
10006
- function finalizeSet(elements2) {
10007
- const parsedSet = /* @__PURE__ */ new Set();
10008
- for (const element of elements2) {
10009
- if (element.status === "aborted")
10010
- return INVALID;
10011
- if (element.status === "dirty")
10012
- status.dirty();
10013
- parsedSet.add(element.value);
10014
- }
10015
- return { status: status.value, value: parsedSet };
10016
- }
10017
- const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
10018
- if (ctx.common.async) {
10019
- return Promise.all(elements).then((elements2) => finalizeSet(elements2));
10020
- } else {
10021
- return finalizeSet(elements);
10022
- }
10023
- }
10024
- min(minSize, message) {
10025
- return new _ZodSet({
10026
- ...this._def,
10027
- minSize: { value: minSize, message: errorUtil.toString(message) }
10028
- });
10029
- }
10030
- max(maxSize, message) {
10031
- return new _ZodSet({
10032
- ...this._def,
10033
- maxSize: { value: maxSize, message: errorUtil.toString(message) }
10034
- });
10035
- }
10036
- size(size, message) {
10037
- return this.min(size, message).max(size, message);
10038
- }
10039
- nonempty(message) {
10040
- return this.min(1, message);
10041
- }
10042
- };
10043
- ZodSet.create = (valueType, params) => {
10044
- return new ZodSet({
10045
- valueType,
10046
- minSize: null,
10047
- maxSize: null,
10048
- typeName: ZodFirstPartyTypeKind.ZodSet,
10049
- ...processCreateParams(params)
10050
- });
10051
- };
10052
- var ZodFunction = class _ZodFunction extends ZodType {
10053
- constructor() {
10054
- super(...arguments);
10055
- this.validate = this.implement;
10056
- }
10057
- _parse(input) {
10058
- const { ctx } = this._processInputParams(input);
10059
- if (ctx.parsedType !== ZodParsedType.function) {
10060
- addIssueToContext(ctx, {
10061
- code: ZodIssueCode.invalid_type,
10062
- expected: ZodParsedType.function,
10063
- received: ctx.parsedType
10064
- });
10065
- return INVALID;
10066
- }
10067
- function makeArgsIssue(args, error2) {
10068
- return makeIssue({
10069
- data: args,
10070
- path: ctx.path,
10071
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
10072
- issueData: {
10073
- code: ZodIssueCode.invalid_arguments,
10074
- argumentsError: error2
10075
- }
10076
- });
10077
- }
10078
- function makeReturnsIssue(returns, error2) {
10079
- return makeIssue({
10080
- data: returns,
10081
- path: ctx.path,
10082
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
10083
- issueData: {
10084
- code: ZodIssueCode.invalid_return_type,
10085
- returnTypeError: error2
10086
- }
10087
- });
10088
- }
10089
- const params = { errorMap: ctx.common.contextualErrorMap };
10090
- const fn = ctx.data;
10091
- if (this._def.returns instanceof ZodPromise) {
10092
- const me = this;
10093
- return OK(async function(...args) {
10094
- const error2 = new ZodError([]);
10095
- const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
10096
- error2.addIssue(makeArgsIssue(args, e));
10097
- throw error2;
10098
- });
10099
- const result = await Reflect.apply(fn, this, parsedArgs);
10100
- const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
10101
- error2.addIssue(makeReturnsIssue(result, e));
10102
- throw error2;
10103
- });
10104
- return parsedReturns;
10105
- });
10106
- } else {
10107
- const me = this;
10108
- return OK(function(...args) {
10109
- const parsedArgs = me._def.args.safeParse(args, params);
10110
- if (!parsedArgs.success) {
10111
- throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
10112
- }
10113
- const result = Reflect.apply(fn, this, parsedArgs.data);
10114
- const parsedReturns = me._def.returns.safeParse(result, params);
10115
- if (!parsedReturns.success) {
10116
- throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
10117
- }
10118
- return parsedReturns.data;
10119
- });
10120
- }
10121
- }
10122
- parameters() {
10123
- return this._def.args;
10124
- }
10125
- returnType() {
10126
- return this._def.returns;
10127
- }
10128
- args(...items) {
10129
- return new _ZodFunction({
10130
- ...this._def,
10131
- args: ZodTuple.create(items).rest(ZodUnknown.create())
10132
- });
10133
- }
10134
- returns(returnType) {
10135
- return new _ZodFunction({
10136
- ...this._def,
10137
- returns: returnType
10138
- });
10139
- }
10140
- implement(func) {
10141
- const validatedFunc = this.parse(func);
10142
- return validatedFunc;
10143
- }
10144
- strictImplement(func) {
10145
- const validatedFunc = this.parse(func);
10146
- return validatedFunc;
10147
- }
10148
- static create(args, returns, params) {
10149
- return new _ZodFunction({
10150
- args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
10151
- returns: returns || ZodUnknown.create(),
10152
- typeName: ZodFirstPartyTypeKind.ZodFunction,
10153
- ...processCreateParams(params)
10154
- });
10155
- }
10156
- };
10157
- var ZodLazy = class extends ZodType {
10158
- get schema() {
10159
- return this._def.getter();
10160
- }
10161
- _parse(input) {
10162
- const { ctx } = this._processInputParams(input);
10163
- const lazySchema = this._def.getter();
10164
- return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
10165
- }
10166
- };
10167
- ZodLazy.create = (getter, params) => {
10168
- return new ZodLazy({
10169
- getter,
10170
- typeName: ZodFirstPartyTypeKind.ZodLazy,
10171
- ...processCreateParams(params)
10172
- });
10173
- };
10174
- var ZodLiteral = class extends ZodType {
10175
- _parse(input) {
10176
- if (input.data !== this._def.value) {
10177
- const ctx = this._getOrReturnCtx(input);
10178
- addIssueToContext(ctx, {
10179
- received: ctx.data,
10180
- code: ZodIssueCode.invalid_literal,
10181
- expected: this._def.value
10182
- });
10183
- return INVALID;
10184
- }
10185
- return { status: "valid", value: input.data };
10186
- }
10187
- get value() {
10188
- return this._def.value;
10189
- }
10190
- };
10191
- ZodLiteral.create = (value, params) => {
10192
- return new ZodLiteral({
10193
- value,
10194
- typeName: ZodFirstPartyTypeKind.ZodLiteral,
10195
- ...processCreateParams(params)
10196
- });
10197
- };
10198
- function createZodEnum(values, params) {
10199
- return new ZodEnum({
10200
- values,
10201
- typeName: ZodFirstPartyTypeKind.ZodEnum,
10202
- ...processCreateParams(params)
10203
- });
10204
- }
10205
- var ZodEnum = class _ZodEnum extends ZodType {
10206
- _parse(input) {
10207
- if (typeof input.data !== "string") {
10208
- const ctx = this._getOrReturnCtx(input);
10209
- const expectedValues = this._def.values;
10210
- addIssueToContext(ctx, {
10211
- expected: util.joinValues(expectedValues),
10212
- received: ctx.parsedType,
10213
- code: ZodIssueCode.invalid_type
10214
- });
10215
- return INVALID;
10216
- }
10217
- if (!this._cache) {
10218
- this._cache = new Set(this._def.values);
10219
- }
10220
- if (!this._cache.has(input.data)) {
10221
- const ctx = this._getOrReturnCtx(input);
10222
- const expectedValues = this._def.values;
10223
- addIssueToContext(ctx, {
10224
- received: ctx.data,
10225
- code: ZodIssueCode.invalid_enum_value,
10226
- options: expectedValues
10227
- });
10228
- return INVALID;
10229
- }
10230
- return OK(input.data);
10231
- }
10232
- get options() {
10233
- return this._def.values;
10234
- }
10235
- get enum() {
10236
- const enumValues = {};
10237
- for (const val of this._def.values) {
10238
- enumValues[val] = val;
10239
- }
10240
- return enumValues;
10241
- }
10242
- get Values() {
10243
- const enumValues = {};
10244
- for (const val of this._def.values) {
10245
- enumValues[val] = val;
10246
- }
10247
- return enumValues;
10248
- }
10249
- get Enum() {
10250
- const enumValues = {};
10251
- for (const val of this._def.values) {
10252
- enumValues[val] = val;
10253
- }
10254
- return enumValues;
10255
- }
10256
- extract(values, newDef = this._def) {
10257
- return _ZodEnum.create(values, {
10258
- ...this._def,
10259
- ...newDef
10260
- });
10261
- }
10262
- exclude(values, newDef = this._def) {
10263
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
10264
- ...this._def,
10265
- ...newDef
10266
- });
10267
- }
10268
- };
10269
- ZodEnum.create = createZodEnum;
10270
- var ZodNativeEnum = class extends ZodType {
10271
- _parse(input) {
10272
- const nativeEnumValues = util.getValidEnumValues(this._def.values);
10273
- const ctx = this._getOrReturnCtx(input);
10274
- if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
10275
- const expectedValues = util.objectValues(nativeEnumValues);
10276
- addIssueToContext(ctx, {
10277
- expected: util.joinValues(expectedValues),
10278
- received: ctx.parsedType,
10279
- code: ZodIssueCode.invalid_type
10280
- });
10281
- return INVALID;
10282
- }
10283
- if (!this._cache) {
10284
- this._cache = new Set(util.getValidEnumValues(this._def.values));
10285
- }
10286
- if (!this._cache.has(input.data)) {
10287
- const expectedValues = util.objectValues(nativeEnumValues);
10288
- addIssueToContext(ctx, {
10289
- received: ctx.data,
10290
- code: ZodIssueCode.invalid_enum_value,
10291
- options: expectedValues
10292
- });
10293
- return INVALID;
10294
- }
10295
- return OK(input.data);
10296
- }
10297
- get enum() {
10298
- return this._def.values;
10299
- }
10300
- };
10301
- ZodNativeEnum.create = (values, params) => {
10302
- return new ZodNativeEnum({
10303
- values,
10304
- typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
10305
- ...processCreateParams(params)
10306
- });
10307
- };
10308
- var ZodPromise = class extends ZodType {
10309
- unwrap() {
10310
- return this._def.type;
10311
- }
10312
- _parse(input) {
10313
- const { ctx } = this._processInputParams(input);
10314
- if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
10315
- addIssueToContext(ctx, {
10316
- code: ZodIssueCode.invalid_type,
10317
- expected: ZodParsedType.promise,
10318
- received: ctx.parsedType
10319
- });
10320
- return INVALID;
10321
- }
10322
- const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
10323
- return OK(promisified.then((data) => {
10324
- return this._def.type.parseAsync(data, {
10325
- path: ctx.path,
10326
- errorMap: ctx.common.contextualErrorMap
10327
- });
10328
- }));
10329
- }
10330
- };
10331
- ZodPromise.create = (schema, params) => {
10332
- return new ZodPromise({
10333
- type: schema,
10334
- typeName: ZodFirstPartyTypeKind.ZodPromise,
10335
- ...processCreateParams(params)
10336
- });
10337
- };
10338
- var ZodEffects = class extends ZodType {
10339
- innerType() {
10340
- return this._def.schema;
10341
- }
10342
- sourceType() {
10343
- return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
10344
- }
10345
- _parse(input) {
10346
- const { status, ctx } = this._processInputParams(input);
10347
- const effect = this._def.effect || null;
10348
- const checkCtx = {
10349
- addIssue: (arg) => {
10350
- addIssueToContext(ctx, arg);
10351
- if (arg.fatal) {
10352
- status.abort();
10353
- } else {
10354
- status.dirty();
10355
- }
10356
- },
10357
- get path() {
10358
- return ctx.path;
10359
- }
10360
- };
10361
- checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
10362
- if (effect.type === "preprocess") {
10363
- const processed = effect.transform(ctx.data, checkCtx);
10364
- if (ctx.common.async) {
10365
- return Promise.resolve(processed).then(async (processed2) => {
10366
- if (status.value === "aborted")
10367
- return INVALID;
10368
- const result = await this._def.schema._parseAsync({
10369
- data: processed2,
10370
- path: ctx.path,
10371
- parent: ctx
10372
- });
10373
- if (result.status === "aborted")
10374
- return INVALID;
10375
- if (result.status === "dirty")
10376
- return DIRTY(result.value);
10377
- if (status.value === "dirty")
10378
- return DIRTY(result.value);
10379
- return result;
10380
- });
10381
- } else {
10382
- if (status.value === "aborted")
10383
- return INVALID;
10384
- const result = this._def.schema._parseSync({
10385
- data: processed,
10386
- path: ctx.path,
10387
- parent: ctx
10388
- });
10389
- if (result.status === "aborted")
10390
- return INVALID;
10391
- if (result.status === "dirty")
10392
- return DIRTY(result.value);
10393
- if (status.value === "dirty")
10394
- return DIRTY(result.value);
10395
- return result;
10396
- }
10397
- }
10398
- if (effect.type === "refinement") {
10399
- const executeRefinement = (acc) => {
10400
- const result = effect.refinement(acc, checkCtx);
10401
- if (ctx.common.async) {
10402
- return Promise.resolve(result);
10403
- }
10404
- if (result instanceof Promise) {
10405
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
10406
- }
10407
- return acc;
10408
- };
10409
- if (ctx.common.async === false) {
10410
- const inner = this._def.schema._parseSync({
10411
- data: ctx.data,
10412
- path: ctx.path,
10413
- parent: ctx
10414
- });
10415
- if (inner.status === "aborted")
10416
- return INVALID;
10417
- if (inner.status === "dirty")
10418
- status.dirty();
10419
- executeRefinement(inner.value);
10420
- return { status: status.value, value: inner.value };
10421
- } else {
10422
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
10423
- if (inner.status === "aborted")
10424
- return INVALID;
10425
- if (inner.status === "dirty")
10426
- status.dirty();
10427
- return executeRefinement(inner.value).then(() => {
10428
- return { status: status.value, value: inner.value };
10429
- });
10430
- });
10431
- }
10432
- }
10433
- if (effect.type === "transform") {
10434
- if (ctx.common.async === false) {
10435
- const base = this._def.schema._parseSync({
10436
- data: ctx.data,
10437
- path: ctx.path,
10438
- parent: ctx
10439
- });
10440
- if (!isValid(base))
10441
- return INVALID;
10442
- const result = effect.transform(base.value, checkCtx);
10443
- if (result instanceof Promise) {
10444
- throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
10445
- }
10446
- return { status: status.value, value: result };
10447
- } else {
10448
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
10449
- if (!isValid(base))
10450
- return INVALID;
10451
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
10452
- status: status.value,
10453
- value: result
10454
- }));
10455
- });
10456
- }
10457
- }
10458
- util.assertNever(effect);
10459
- }
10460
- };
10461
- ZodEffects.create = (schema, effect, params) => {
10462
- return new ZodEffects({
10463
- schema,
10464
- typeName: ZodFirstPartyTypeKind.ZodEffects,
10465
- effect,
10466
- ...processCreateParams(params)
10467
- });
10468
- };
10469
- ZodEffects.createWithPreprocess = (preprocess2, schema, params) => {
10470
- return new ZodEffects({
10471
- schema,
10472
- effect: { type: "preprocess", transform: preprocess2 },
10473
- typeName: ZodFirstPartyTypeKind.ZodEffects,
10474
- ...processCreateParams(params)
10475
- });
10476
- };
10477
- var ZodOptional = class extends ZodType {
10478
- _parse(input) {
10479
- const parsedType2 = this._getType(input);
10480
- if (parsedType2 === ZodParsedType.undefined) {
10481
- return OK(void 0);
10482
- }
10483
- return this._def.innerType._parse(input);
10484
- }
10485
- unwrap() {
10486
- return this._def.innerType;
10487
- }
10488
- };
10489
- ZodOptional.create = (type, params) => {
10490
- return new ZodOptional({
10491
- innerType: type,
10492
- typeName: ZodFirstPartyTypeKind.ZodOptional,
10493
- ...processCreateParams(params)
10494
- });
10495
- };
10496
- var ZodNullable = class extends ZodType {
10497
- _parse(input) {
10498
- const parsedType2 = this._getType(input);
10499
- if (parsedType2 === ZodParsedType.null) {
10500
- return OK(null);
10501
- }
10502
- return this._def.innerType._parse(input);
10503
- }
10504
- unwrap() {
10505
- return this._def.innerType;
10506
- }
10507
- };
10508
- ZodNullable.create = (type, params) => {
10509
- return new ZodNullable({
10510
- innerType: type,
10511
- typeName: ZodFirstPartyTypeKind.ZodNullable,
10512
- ...processCreateParams(params)
10513
- });
10514
- };
10515
- var ZodDefault = class extends ZodType {
10516
- _parse(input) {
10517
- const { ctx } = this._processInputParams(input);
10518
- let data = ctx.data;
10519
- if (ctx.parsedType === ZodParsedType.undefined) {
10520
- data = this._def.defaultValue();
10521
- }
10522
- return this._def.innerType._parse({
10523
- data,
10524
- path: ctx.path,
10525
- parent: ctx
10526
- });
10527
- }
10528
- removeDefault() {
10529
- return this._def.innerType;
10530
- }
10531
- };
10532
- ZodDefault.create = (type, params) => {
10533
- return new ZodDefault({
10534
- innerType: type,
10535
- typeName: ZodFirstPartyTypeKind.ZodDefault,
10536
- defaultValue: typeof params.default === "function" ? params.default : () => params.default,
10537
- ...processCreateParams(params)
10538
- });
10539
- };
10540
- var ZodCatch = class extends ZodType {
10541
- _parse(input) {
10542
- const { ctx } = this._processInputParams(input);
10543
- const newCtx = {
10544
- ...ctx,
10545
- common: {
10546
- ...ctx.common,
10547
- issues: []
10548
- }
10549
- };
10550
- const result = this._def.innerType._parse({
10551
- data: newCtx.data,
10552
- path: newCtx.path,
10553
- parent: {
10554
- ...newCtx
10555
- }
10556
- });
10557
- if (isAsync(result)) {
10558
- return result.then((result2) => {
10559
- return {
10560
- status: "valid",
10561
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
10562
- get error() {
10563
- return new ZodError(newCtx.common.issues);
10564
- },
10565
- input: newCtx.data
10566
- })
10567
- };
10568
- });
10569
- } else {
10570
- return {
10571
- status: "valid",
10572
- value: result.status === "valid" ? result.value : this._def.catchValue({
10573
- get error() {
10574
- return new ZodError(newCtx.common.issues);
10575
- },
10576
- input: newCtx.data
10577
- })
10578
- };
10579
- }
10580
- }
10581
- removeCatch() {
10582
- return this._def.innerType;
10583
- }
10584
- };
10585
- ZodCatch.create = (type, params) => {
10586
- return new ZodCatch({
10587
- innerType: type,
10588
- typeName: ZodFirstPartyTypeKind.ZodCatch,
10589
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
10590
- ...processCreateParams(params)
10591
- });
10592
- };
10593
- var ZodNaN = class extends ZodType {
10594
- _parse(input) {
10595
- const parsedType2 = this._getType(input);
10596
- if (parsedType2 !== ZodParsedType.nan) {
10597
- const ctx = this._getOrReturnCtx(input);
10598
- addIssueToContext(ctx, {
10599
- code: ZodIssueCode.invalid_type,
10600
- expected: ZodParsedType.nan,
10601
- received: ctx.parsedType
10602
- });
10603
- return INVALID;
10604
- }
10605
- return { status: "valid", value: input.data };
10606
- }
10607
- };
10608
- ZodNaN.create = (params) => {
10609
- return new ZodNaN({
10610
- typeName: ZodFirstPartyTypeKind.ZodNaN,
10611
- ...processCreateParams(params)
10612
- });
10613
- };
10614
- var BRAND = /* @__PURE__ */ Symbol("zod_brand");
10615
- var ZodBranded = class extends ZodType {
10616
- _parse(input) {
10617
- const { ctx } = this._processInputParams(input);
10618
- const data = ctx.data;
10619
- return this._def.type._parse({
10620
- data,
10621
- path: ctx.path,
10622
- parent: ctx
10623
- });
10624
- }
10625
- unwrap() {
10626
- return this._def.type;
10627
- }
10628
- };
10629
- var ZodPipeline = class _ZodPipeline extends ZodType {
10630
- _parse(input) {
10631
- const { status, ctx } = this._processInputParams(input);
10632
- if (ctx.common.async) {
10633
- const handleAsync = async () => {
10634
- const inResult = await this._def.in._parseAsync({
10635
- data: ctx.data,
10636
- path: ctx.path,
10637
- parent: ctx
10638
- });
10639
- if (inResult.status === "aborted")
10640
- return INVALID;
10641
- if (inResult.status === "dirty") {
10642
- status.dirty();
10643
- return DIRTY(inResult.value);
10644
- } else {
10645
- return this._def.out._parseAsync({
10646
- data: inResult.value,
10647
- path: ctx.path,
10648
- parent: ctx
10649
- });
10650
- }
10651
- };
10652
- return handleAsync();
10653
- } else {
10654
- const inResult = this._def.in._parseSync({
10655
- data: ctx.data,
10656
- path: ctx.path,
10657
- parent: ctx
10658
- });
10659
- if (inResult.status === "aborted")
10660
- return INVALID;
10661
- if (inResult.status === "dirty") {
10662
- status.dirty();
10663
- return {
10664
- status: "dirty",
10665
- value: inResult.value
10666
- };
10667
- } else {
10668
- return this._def.out._parseSync({
10669
- data: inResult.value,
10670
- path: ctx.path,
10671
- parent: ctx
10672
- });
10673
- }
10674
- }
10675
- }
10676
- static create(a, b) {
10677
- return new _ZodPipeline({
10678
- in: a,
10679
- out: b,
10680
- typeName: ZodFirstPartyTypeKind.ZodPipeline
10681
- });
10682
- }
10683
- };
10684
- var ZodReadonly = class extends ZodType {
10685
- _parse(input) {
10686
- const result = this._def.innerType._parse(input);
10687
- const freeze = (data) => {
10688
- if (isValid(data)) {
10689
- data.value = Object.freeze(data.value);
10690
- }
10691
- return data;
10692
- };
10693
- return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
10694
- }
10695
- unwrap() {
10696
- return this._def.innerType;
10697
- }
10698
- };
10699
- ZodReadonly.create = (type, params) => {
10700
- return new ZodReadonly({
10701
- innerType: type,
10702
- typeName: ZodFirstPartyTypeKind.ZodReadonly,
10703
- ...processCreateParams(params)
10704
- });
10705
- };
10706
- function cleanParams(params, data) {
10707
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
10708
- const p2 = typeof p === "string" ? { message: p } : p;
10709
- return p2;
10710
- }
10711
- function custom(check2, _params = {}, fatal) {
10712
- if (check2)
10713
- return ZodAny.create().superRefine((data, ctx) => {
10714
- const r = check2(data);
10715
- if (r instanceof Promise) {
10716
- return r.then((r2) => {
10717
- if (!r2) {
10718
- const params = cleanParams(_params, data);
10719
- const _fatal = params.fatal ?? fatal ?? true;
10720
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
10721
- }
10722
- });
10723
- }
10724
- if (!r) {
10725
- const params = cleanParams(_params, data);
10726
- const _fatal = params.fatal ?? fatal ?? true;
10727
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
10728
- }
10729
- return;
10730
- });
10731
- return ZodAny.create();
10732
- }
10733
- var late = {
10734
- object: ZodObject.lazycreate
10735
- };
10736
- var ZodFirstPartyTypeKind;
10737
- (function(ZodFirstPartyTypeKind2) {
10738
- ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
10739
- ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
10740
- ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
10741
- ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
10742
- ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
10743
- ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
10744
- ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
10745
- ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
10746
- ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
10747
- ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
10748
- ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
10749
- ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
10750
- ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
10751
- ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
10752
- ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
10753
- ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
10754
- ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
10755
- ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
10756
- ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
10757
- ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
10758
- ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
10759
- ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
10760
- ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
10761
- ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
10762
- ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
10763
- ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
10764
- ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
10765
- ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
10766
- ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
10767
- ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
10768
- ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
10769
- ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
10770
- ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
10771
- ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
10772
- ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
10773
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
10774
- })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
10775
- var instanceOfType = (cls, params = {
10776
- message: `Input not instance of ${cls.name}`
10777
- }) => custom((data) => data instanceof cls, params);
10778
- var stringType = ZodString.create;
10779
- var numberType = ZodNumber.create;
10780
- var nanType = ZodNaN.create;
10781
- var bigIntType = ZodBigInt.create;
10782
- var booleanType = ZodBoolean.create;
10783
- var dateType = ZodDate.create;
10784
- var symbolType = ZodSymbol.create;
10785
- var undefinedType = ZodUndefined.create;
10786
- var nullType = ZodNull.create;
10787
- var anyType = ZodAny.create;
10788
- var unknownType = ZodUnknown.create;
10789
- var neverType = ZodNever.create;
10790
- var voidType = ZodVoid.create;
10791
- var arrayType = ZodArray.create;
10792
- var objectType = ZodObject.create;
10793
- var strictObjectType = ZodObject.strictCreate;
10794
- var unionType = ZodUnion.create;
10795
- var discriminatedUnionType = ZodDiscriminatedUnion.create;
10796
- var intersectionType = ZodIntersection.create;
10797
- var tupleType = ZodTuple.create;
10798
- var recordType = ZodRecord.create;
10799
- var mapType = ZodMap.create;
10800
- var setType = ZodSet.create;
10801
- var functionType = ZodFunction.create;
10802
- var lazyType = ZodLazy.create;
10803
- var literalType = ZodLiteral.create;
10804
- var enumType = ZodEnum.create;
10805
- var nativeEnumType = ZodNativeEnum.create;
10806
- var promiseType = ZodPromise.create;
10807
- var effectsType = ZodEffects.create;
10808
- var optionalType = ZodOptional.create;
10809
- var nullableType = ZodNullable.create;
10810
- var preprocessType = ZodEffects.createWithPreprocess;
10811
- var pipelineType = ZodPipeline.create;
10812
- var ostring = () => stringType().optional();
10813
- var onumber = () => numberType().optional();
10814
- var oboolean = () => booleanType().optional();
10815
- var coerce = {
10816
- string: ((arg) => ZodString.create({ ...arg, coerce: true })),
10817
- number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
10818
- boolean: ((arg) => ZodBoolean.create({
10819
- ...arg,
10820
- coerce: true
10821
- })),
10822
- bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
10823
- date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
10824
- };
10825
- var NEVER = INVALID;
10826
-
10827
6790
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js
10828
- var NEVER2 = Object.freeze({
6791
+ var NEVER = Object.freeze({
10829
6792
  status: "aborted"
10830
6793
  });
10831
6794
  // @__NO_SIDE_EFFECTS__
@@ -10908,11 +6871,11 @@ __export(util_exports, {
10908
6871
  escapeRegex: () => escapeRegex,
10909
6872
  extend: () => extend,
10910
6873
  finalizeIssue: () => finalizeIssue,
10911
- floatSafeRemainder: () => floatSafeRemainder2,
6874
+ floatSafeRemainder: () => floatSafeRemainder,
10912
6875
  getElementAtPath: () => getElementAtPath,
10913
6876
  getEnumValues: () => getEnumValues,
10914
6877
  getLengthableOrigin: () => getLengthableOrigin,
10915
- getParsedType: () => getParsedType2,
6878
+ getParsedType: () => getParsedType,
10916
6879
  getSizableOrigin: () => getSizableOrigin,
10917
6880
  isObject: () => isObject,
10918
6881
  isPlainObject: () => isPlainObject,
@@ -10983,7 +6946,7 @@ function cleanRegex(source) {
10983
6946
  const end = source.endsWith("$") ? source.length - 1 : source.length;
10984
6947
  return source.slice(start, end);
10985
6948
  }
10986
- function floatSafeRemainder2(val, step) {
6949
+ function floatSafeRemainder(val, step) {
10987
6950
  const valDecCount = (val.toString().split(".")[1] || "").length;
10988
6951
  const stepDecCount = (step.toString().split(".")[1] || "").length;
10989
6952
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
@@ -11086,7 +7049,7 @@ function numKeys(data) {
11086
7049
  }
11087
7050
  return keyCount;
11088
7051
  }
11089
- var getParsedType2 = (data) => {
7052
+ var getParsedType = (data) => {
11090
7053
  const t = typeof data;
11091
7054
  switch (t) {
11092
7055
  case "undefined":
@@ -11575,8 +7538,8 @@ function datetime(args) {
11575
7538
  opts.push("");
11576
7539
  if (args.offset)
11577
7540
  opts.push(`([+-]\\d{2}:\\d{2})`);
11578
- const timeRegex2 = `${time3}(?:${opts.join("|")})`;
11579
- return new RegExp(`^${dateSource}T(?:${timeRegex2})$`);
7541
+ const timeRegex = `${time3}(?:${opts.join("|")})`;
7542
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
11580
7543
  }
11581
7544
  var string = (params) => {
11582
7545
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
@@ -11666,7 +7629,7 @@ var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (i
11666
7629
  inst._zod.check = (payload) => {
11667
7630
  if (typeof payload.value !== typeof def.value)
11668
7631
  throw new Error("Cannot mix number and bigint in multiple_of check.");
11669
- const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder2(payload.value, def.value) === 0;
7632
+ const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
11670
7633
  if (isMultiple)
11671
7634
  return;
11672
7635
  payload.issues.push({
@@ -12040,14 +8003,14 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
12040
8003
  });
12041
8004
  } else {
12042
8005
  const runChecks = (payload, checks2, ctx) => {
12043
- let isAborted2 = aborted(payload);
8006
+ let isAborted = aborted(payload);
12044
8007
  let asyncResult;
12045
8008
  for (const ch of checks2) {
12046
8009
  if (ch._zod.def.when) {
12047
8010
  const shouldRun = ch._zod.def.when(payload);
12048
8011
  if (!shouldRun)
12049
8012
  continue;
12050
- } else if (isAborted2) {
8013
+ } else if (isAborted) {
12051
8014
  continue;
12052
8015
  }
12053
8016
  const currLen = payload.issues.length;
@@ -12061,15 +8024,15 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
12061
8024
  const nextLen = payload.issues.length;
12062
8025
  if (nextLen === currLen)
12063
8026
  return;
12064
- if (!isAborted2)
12065
- isAborted2 = aborted(payload, currLen);
8027
+ if (!isAborted)
8028
+ isAborted = aborted(payload, currLen);
12066
8029
  });
12067
8030
  } else {
12068
8031
  const nextLen = payload.issues.length;
12069
8032
  if (nextLen === currLen)
12070
8033
  continue;
12071
- if (!isAborted2)
12072
- isAborted2 = aborted(payload, currLen);
8034
+ if (!isAborted)
8035
+ isAborted = aborted(payload, currLen);
12073
8036
  }
12074
8037
  }
12075
8038
  if (asyncResult) {
@@ -12367,7 +8330,7 @@ var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
12367
8330
  def.pattern ?? (def.pattern = e164);
12368
8331
  $ZodStringFormat.init(inst, def);
12369
8332
  });
12370
- function isValidJWT2(token, algorithm = null) {
8333
+ function isValidJWT(token, algorithm = null) {
12371
8334
  try {
12372
8335
  const tokensParts = token.split(".");
12373
8336
  if (tokensParts.length !== 3)
@@ -12390,7 +8353,7 @@ function isValidJWT2(token, algorithm = null) {
12390
8353
  var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
12391
8354
  $ZodStringFormat.init(inst, def);
12392
8355
  inst._zod.check = (payload) => {
12393
- if (isValidJWT2(payload.value, def.alg))
8356
+ if (isValidJWT(payload.value, def.alg))
12394
8357
  return;
12395
8358
  payload.issues.push({
12396
8359
  code: "invalid_format",
@@ -12843,7 +8806,7 @@ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, d
12843
8806
  return handleIntersectionResults(payload, left, right);
12844
8807
  };
12845
8808
  });
12846
- function mergeValues2(a, b) {
8809
+ function mergeValues(a, b) {
12847
8810
  if (a === b) {
12848
8811
  return { valid: true, data: a };
12849
8812
  }
@@ -12855,7 +8818,7 @@ function mergeValues2(a, b) {
12855
8818
  const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
12856
8819
  const newObj = { ...a, ...b };
12857
8820
  for (const key of sharedKeys) {
12858
- const sharedValue = mergeValues2(a[key], b[key]);
8821
+ const sharedValue = mergeValues(a[key], b[key]);
12859
8822
  if (!sharedValue.valid) {
12860
8823
  return {
12861
8824
  valid: false,
@@ -12874,7 +8837,7 @@ function mergeValues2(a, b) {
12874
8837
  for (let index = 0; index < a.length; index++) {
12875
8838
  const itemA = a[index];
12876
8839
  const itemB = b[index];
12877
- const sharedValue = mergeValues2(itemA, itemB);
8840
+ const sharedValue = mergeValues(itemA, itemB);
12878
8841
  if (!sharedValue.valid) {
12879
8842
  return {
12880
8843
  valid: false,
@@ -12896,7 +8859,7 @@ function handleIntersectionResults(result, left, right) {
12896
8859
  }
12897
8860
  if (aborted(result))
12898
8861
  return result;
12899
- const merged = mergeValues2(left.value, right.value);
8862
+ const merged = mergeValues(left.value, right.value);
12900
8863
  if (!merged.valid) {
12901
8864
  throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
12902
8865
  }
@@ -13367,7 +9330,7 @@ var error = () => {
13367
9330
  }
13368
9331
  };
13369
9332
  };
13370
- function en_default2() {
9333
+ function en_default() {
13371
9334
  return {
13372
9335
  localeError: error()
13373
9336
  };
@@ -14673,7 +10636,7 @@ function object(shape, params) {
14673
10636
  return new ZodMiniObject(def);
14674
10637
  }
14675
10638
 
14676
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
10639
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
14677
10640
  function isZ4Schema(s) {
14678
10641
  const schema = s;
14679
10642
  return !!schema._zod;
@@ -14887,7 +10850,7 @@ var initializer2 = (inst, issues) => {
14887
10850
  }
14888
10851
  });
14889
10852
  };
14890
- var ZodError2 = $constructor("ZodError", initializer2);
10853
+ var ZodError = $constructor("ZodError", initializer2);
14891
10854
  var ZodRealError = $constructor("ZodError", initializer2, {
14892
10855
  Parent: Error
14893
10856
  });
@@ -14899,7 +10862,7 @@ var safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
14899
10862
  var safeParseAsync3 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
14900
10863
 
14901
10864
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/schemas.js
14902
- var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
10865
+ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
14903
10866
  $ZodType.init(inst, def);
14904
10867
  inst.def = def;
14905
10868
  Object.defineProperty(inst, "_def", { value: def });
@@ -14967,7 +10930,7 @@ var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
14967
10930
  });
14968
10931
  var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
14969
10932
  $ZodString.init(inst, def);
14970
- ZodType2.init(inst, def);
10933
+ ZodType.init(inst, def);
14971
10934
  const bag = inst._zod.bag;
14972
10935
  inst.format = bag.format ?? null;
14973
10936
  inst.minLength = bag.minimum ?? null;
@@ -14987,7 +10950,7 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
14987
10950
  inst.toLowerCase = () => inst.check(_toLowerCase());
14988
10951
  inst.toUpperCase = () => inst.check(_toUpperCase());
14989
10952
  });
14990
- var ZodString2 = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
10953
+ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
14991
10954
  $ZodString.init(inst, def);
14992
10955
  _ZodString.init(inst, def);
14993
10956
  inst.email = (params) => inst.check(_email(ZodEmail, params));
@@ -15019,7 +10982,7 @@ var ZodString2 = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
15019
10982
  inst.duration = (params) => inst.check(duration2(params));
15020
10983
  });
15021
10984
  function string2(params) {
15022
- return _string(ZodString2, params);
10985
+ return _string(ZodString, params);
15023
10986
  }
15024
10987
  var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
15025
10988
  $ZodStringFormat.init(inst, def);
@@ -15101,9 +11064,9 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
15101
11064
  $ZodJWT.init(inst, def);
15102
11065
  ZodStringFormat.init(inst, def);
15103
11066
  });
15104
- var ZodNumber2 = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
11067
+ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
15105
11068
  $ZodNumber.init(inst, def);
15106
- ZodType2.init(inst, def);
11069
+ ZodType.init(inst, def);
15107
11070
  inst.gt = (value, params) => inst.check(_gt(value, params));
15108
11071
  inst.gte = (value, params) => inst.check(_gte(value, params));
15109
11072
  inst.min = (value, params) => inst.check(_gte(value, params));
@@ -15127,46 +11090,46 @@ var ZodNumber2 = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
15127
11090
  inst.format = bag.format ?? null;
15128
11091
  });
15129
11092
  function number2(params) {
15130
- return _number(ZodNumber2, params);
11093
+ return _number(ZodNumber, params);
15131
11094
  }
15132
11095
  var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
15133
11096
  $ZodNumberFormat.init(inst, def);
15134
- ZodNumber2.init(inst, def);
11097
+ ZodNumber.init(inst, def);
15135
11098
  });
15136
11099
  function int(params) {
15137
11100
  return _int(ZodNumberFormat, params);
15138
11101
  }
15139
- var ZodBoolean2 = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
11102
+ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
15140
11103
  $ZodBoolean.init(inst, def);
15141
- ZodType2.init(inst, def);
11104
+ ZodType.init(inst, def);
15142
11105
  });
15143
11106
  function boolean2(params) {
15144
- return _boolean(ZodBoolean2, params);
11107
+ return _boolean(ZodBoolean, params);
15145
11108
  }
15146
- var ZodNull2 = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
11109
+ var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
15147
11110
  $ZodNull.init(inst, def);
15148
- ZodType2.init(inst, def);
11111
+ ZodType.init(inst, def);
15149
11112
  });
15150
11113
  function _null3(params) {
15151
- return _null2(ZodNull2, params);
11114
+ return _null2(ZodNull, params);
15152
11115
  }
15153
- var ZodUnknown2 = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
11116
+ var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
15154
11117
  $ZodUnknown.init(inst, def);
15155
- ZodType2.init(inst, def);
11118
+ ZodType.init(inst, def);
15156
11119
  });
15157
11120
  function unknown() {
15158
- return _unknown(ZodUnknown2);
11121
+ return _unknown(ZodUnknown);
15159
11122
  }
15160
- var ZodNever2 = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
11123
+ var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
15161
11124
  $ZodNever.init(inst, def);
15162
- ZodType2.init(inst, def);
11125
+ ZodType.init(inst, def);
15163
11126
  });
15164
11127
  function never(params) {
15165
- return _never(ZodNever2, params);
11128
+ return _never(ZodNever, params);
15166
11129
  }
15167
- var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
11130
+ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
15168
11131
  $ZodArray.init(inst, def);
15169
- ZodType2.init(inst, def);
11132
+ ZodType.init(inst, def);
15170
11133
  inst.element = def.element;
15171
11134
  inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
15172
11135
  inst.nonempty = (params) => inst.check(_minLength(1, params));
@@ -15175,11 +11138,11 @@ var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
15175
11138
  inst.unwrap = () => inst.element;
15176
11139
  });
15177
11140
  function array(element, params) {
15178
- return _array(ZodArray2, element, params);
11141
+ return _array(ZodArray, element, params);
15179
11142
  }
15180
- var ZodObject2 = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
11143
+ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
15181
11144
  $ZodObject.init(inst, def);
15182
- ZodType2.init(inst, def);
11145
+ ZodType.init(inst, def);
15183
11146
  util_exports.defineLazy(inst, "shape", () => def.shape);
15184
11147
  inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
15185
11148
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
@@ -15205,10 +11168,10 @@ function object2(shape, params) {
15205
11168
  },
15206
11169
  ...util_exports.normalizeParams(params)
15207
11170
  };
15208
- return new ZodObject2(def);
11171
+ return new ZodObject(def);
15209
11172
  }
15210
11173
  function looseObject(shape, params) {
15211
- return new ZodObject2({
11174
+ return new ZodObject({
15212
11175
  type: "object",
15213
11176
  get shape() {
15214
11177
  util_exports.assignProp(this, "shape", { ...shape });
@@ -15218,58 +11181,58 @@ function looseObject(shape, params) {
15218
11181
  ...util_exports.normalizeParams(params)
15219
11182
  });
15220
11183
  }
15221
- var ZodUnion2 = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
11184
+ var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
15222
11185
  $ZodUnion.init(inst, def);
15223
- ZodType2.init(inst, def);
11186
+ ZodType.init(inst, def);
15224
11187
  inst.options = def.options;
15225
11188
  });
15226
11189
  function union(options, params) {
15227
- return new ZodUnion2({
11190
+ return new ZodUnion({
15228
11191
  type: "union",
15229
11192
  options,
15230
11193
  ...util_exports.normalizeParams(params)
15231
11194
  });
15232
11195
  }
15233
- var ZodDiscriminatedUnion2 = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
15234
- ZodUnion2.init(inst, def);
11196
+ var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
11197
+ ZodUnion.init(inst, def);
15235
11198
  $ZodDiscriminatedUnion.init(inst, def);
15236
11199
  });
15237
11200
  function discriminatedUnion(discriminator, options, params) {
15238
- return new ZodDiscriminatedUnion2({
11201
+ return new ZodDiscriminatedUnion({
15239
11202
  type: "union",
15240
11203
  options,
15241
11204
  discriminator,
15242
11205
  ...util_exports.normalizeParams(params)
15243
11206
  });
15244
11207
  }
15245
- var ZodIntersection2 = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
11208
+ var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
15246
11209
  $ZodIntersection.init(inst, def);
15247
- ZodType2.init(inst, def);
11210
+ ZodType.init(inst, def);
15248
11211
  });
15249
11212
  function intersection(left, right) {
15250
- return new ZodIntersection2({
11213
+ return new ZodIntersection({
15251
11214
  type: "intersection",
15252
11215
  left,
15253
11216
  right
15254
11217
  });
15255
11218
  }
15256
- var ZodRecord2 = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
11219
+ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
15257
11220
  $ZodRecord.init(inst, def);
15258
- ZodType2.init(inst, def);
11221
+ ZodType.init(inst, def);
15259
11222
  inst.keyType = def.keyType;
15260
11223
  inst.valueType = def.valueType;
15261
11224
  });
15262
11225
  function record(keyType, valueType, params) {
15263
- return new ZodRecord2({
11226
+ return new ZodRecord({
15264
11227
  type: "record",
15265
11228
  keyType,
15266
11229
  valueType,
15267
11230
  ...util_exports.normalizeParams(params)
15268
11231
  });
15269
11232
  }
15270
- var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
11233
+ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
15271
11234
  $ZodEnum.init(inst, def);
15272
- ZodType2.init(inst, def);
11235
+ ZodType.init(inst, def);
15273
11236
  inst.enum = def.entries;
15274
11237
  inst.options = Object.values(def.entries);
15275
11238
  const keys = new Set(Object.keys(def.entries));
@@ -15281,7 +11244,7 @@ var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
15281
11244
  } else
15282
11245
  throw new Error(`Key ${value} not found in enum`);
15283
11246
  }
15284
- return new ZodEnum2({
11247
+ return new ZodEnum({
15285
11248
  ...def,
15286
11249
  checks: [],
15287
11250
  ...util_exports.normalizeParams(params),
@@ -15296,7 +11259,7 @@ var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
15296
11259
  } else
15297
11260
  throw new Error(`Key ${value} not found in enum`);
15298
11261
  }
15299
- return new ZodEnum2({
11262
+ return new ZodEnum({
15300
11263
  ...def,
15301
11264
  checks: [],
15302
11265
  ...util_exports.normalizeParams(params),
@@ -15306,15 +11269,15 @@ var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
15306
11269
  });
15307
11270
  function _enum(values, params) {
15308
11271
  const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
15309
- return new ZodEnum2({
11272
+ return new ZodEnum({
15310
11273
  type: "enum",
15311
11274
  entries,
15312
11275
  ...util_exports.normalizeParams(params)
15313
11276
  });
15314
11277
  }
15315
- var ZodLiteral2 = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
11278
+ var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
15316
11279
  $ZodLiteral.init(inst, def);
15317
- ZodType2.init(inst, def);
11280
+ ZodType.init(inst, def);
15318
11281
  inst.values = new Set(def.values);
15319
11282
  Object.defineProperty(inst, "value", {
15320
11283
  get() {
@@ -15326,7 +11289,7 @@ var ZodLiteral2 = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
15326
11289
  });
15327
11290
  });
15328
11291
  function literal(value, params) {
15329
- return new ZodLiteral2({
11292
+ return new ZodLiteral({
15330
11293
  type: "literal",
15331
11294
  values: Array.isArray(value) ? value : [value],
15332
11295
  ...util_exports.normalizeParams(params)
@@ -15334,7 +11297,7 @@ function literal(value, params) {
15334
11297
  }
15335
11298
  var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
15336
11299
  $ZodTransform.init(inst, def);
15337
- ZodType2.init(inst, def);
11300
+ ZodType.init(inst, def);
15338
11301
  inst._zod.parse = (payload, _ctx) => {
15339
11302
  payload.addIssue = (issue2) => {
15340
11303
  if (typeof issue2 === "string") {
@@ -15369,7 +11332,7 @@ function transform(fn) {
15369
11332
  }
15370
11333
  var ZodOptional2 = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
15371
11334
  $ZodOptional.init(inst, def);
15372
- ZodType2.init(inst, def);
11335
+ ZodType.init(inst, def);
15373
11336
  inst.unwrap = () => inst._zod.def.innerType;
15374
11337
  });
15375
11338
  function optional(innerType) {
@@ -15378,25 +11341,25 @@ function optional(innerType) {
15378
11341
  innerType
15379
11342
  });
15380
11343
  }
15381
- var ZodNullable2 = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
11344
+ var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
15382
11345
  $ZodNullable.init(inst, def);
15383
- ZodType2.init(inst, def);
11346
+ ZodType.init(inst, def);
15384
11347
  inst.unwrap = () => inst._zod.def.innerType;
15385
11348
  });
15386
11349
  function nullable(innerType) {
15387
- return new ZodNullable2({
11350
+ return new ZodNullable({
15388
11351
  type: "nullable",
15389
11352
  innerType
15390
11353
  });
15391
11354
  }
15392
- var ZodDefault2 = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
11355
+ var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
15393
11356
  $ZodDefault.init(inst, def);
15394
- ZodType2.init(inst, def);
11357
+ ZodType.init(inst, def);
15395
11358
  inst.unwrap = () => inst._zod.def.innerType;
15396
11359
  inst.removeDefault = inst.unwrap;
15397
11360
  });
15398
11361
  function _default(innerType, defaultValue) {
15399
- return new ZodDefault2({
11362
+ return new ZodDefault({
15400
11363
  type: "default",
15401
11364
  innerType,
15402
11365
  get defaultValue() {
@@ -15406,7 +11369,7 @@ function _default(innerType, defaultValue) {
15406
11369
  }
15407
11370
  var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
15408
11371
  $ZodPrefault.init(inst, def);
15409
- ZodType2.init(inst, def);
11372
+ ZodType.init(inst, def);
15410
11373
  inst.unwrap = () => inst._zod.def.innerType;
15411
11374
  });
15412
11375
  function prefault(innerType, defaultValue) {
@@ -15420,7 +11383,7 @@ function prefault(innerType, defaultValue) {
15420
11383
  }
15421
11384
  var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
15422
11385
  $ZodNonOptional.init(inst, def);
15423
- ZodType2.init(inst, def);
11386
+ ZodType.init(inst, def);
15424
11387
  inst.unwrap = () => inst._zod.def.innerType;
15425
11388
  });
15426
11389
  function nonoptional(innerType, params) {
@@ -15430,14 +11393,14 @@ function nonoptional(innerType, params) {
15430
11393
  ...util_exports.normalizeParams(params)
15431
11394
  });
15432
11395
  }
15433
- var ZodCatch2 = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
11396
+ var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
15434
11397
  $ZodCatch.init(inst, def);
15435
- ZodType2.init(inst, def);
11398
+ ZodType.init(inst, def);
15436
11399
  inst.unwrap = () => inst._zod.def.innerType;
15437
11400
  inst.removeCatch = inst.unwrap;
15438
11401
  });
15439
11402
  function _catch(innerType, catchValue) {
15440
- return new ZodCatch2({
11403
+ return new ZodCatch({
15441
11404
  type: "catch",
15442
11405
  innerType,
15443
11406
  catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
@@ -15445,7 +11408,7 @@ function _catch(innerType, catchValue) {
15445
11408
  }
15446
11409
  var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
15447
11410
  $ZodPipe.init(inst, def);
15448
- ZodType2.init(inst, def);
11411
+ ZodType.init(inst, def);
15449
11412
  inst.in = def.in;
15450
11413
  inst.out = def.out;
15451
11414
  });
@@ -15457,19 +11420,19 @@ function pipe(in_, out) {
15457
11420
  // ...util.normalizeParams(params),
15458
11421
  });
15459
11422
  }
15460
- var ZodReadonly2 = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
11423
+ var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
15461
11424
  $ZodReadonly.init(inst, def);
15462
- ZodType2.init(inst, def);
11425
+ ZodType.init(inst, def);
15463
11426
  });
15464
11427
  function readonly(innerType) {
15465
- return new ZodReadonly2({
11428
+ return new ZodReadonly({
15466
11429
  type: "readonly",
15467
11430
  innerType
15468
11431
  });
15469
11432
  }
15470
11433
  var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
15471
11434
  $ZodCustom.init(inst, def);
15472
- ZodType2.init(inst, def);
11435
+ ZodType.init(inst, def);
15473
11436
  });
15474
11437
  function check(fn) {
15475
11438
  const ch = new $ZodCheck({
@@ -15479,7 +11442,7 @@ function check(fn) {
15479
11442
  ch._zod.check = fn;
15480
11443
  return ch;
15481
11444
  }
15482
- function custom2(fn, _params) {
11445
+ function custom(fn, _params) {
15483
11446
  return _custom(ZodCustom, fn ?? (() => true), _params);
15484
11447
  }
15485
11448
  function refine(fn, _params = {}) {
@@ -15510,14 +11473,14 @@ function preprocess(fn, schema) {
15510
11473
  }
15511
11474
 
15512
11475
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
15513
- config(en_default2());
11476
+ config(en_default());
15514
11477
 
15515
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
11478
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
15516
11479
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
15517
11480
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
15518
11481
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
15519
11482
  var JSONRPC_VERSION = "2.0";
15520
- var AssertObjectSchema = custom2((v) => v !== null && (typeof v === "object" || typeof v === "function"));
11483
+ var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || typeof v === "function"));
15521
11484
  var ProgressTokenSchema = union([string2(), number2().int()]);
15522
11485
  var CursorSchema = string2();
15523
11486
  var TaskCreationParamsSchema = looseObject({
@@ -17030,7 +12993,7 @@ var UrlElicitationRequiredError = class extends McpError {
17030
12993
  }
17031
12994
  };
17032
12995
 
17033
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
12996
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
17034
12997
  function isTerminal(status) {
17035
12998
  return status === "completed" || status === "failed" || status === "cancelled";
17036
12999
  }
@@ -17362,7 +13325,7 @@ function parseLiteralDef(def, refs) {
17362
13325
  }
17363
13326
 
17364
13327
  // ../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
17365
- var emojiRegex2 = void 0;
13328
+ var emojiRegex = void 0;
17366
13329
  var zodPatterns = {
17367
13330
  /**
17368
13331
  * `c` was changed to `[cC]` to replicate /i flag
@@ -17386,10 +13349,10 @@ var zodPatterns = {
17386
13349
  * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
17387
13350
  */
17388
13351
  emoji: () => {
17389
- if (emojiRegex2 === void 0) {
17390
- emojiRegex2 = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
13352
+ if (emojiRegex === void 0) {
13353
+ emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
17391
13354
  }
17392
- return emojiRegex2;
13355
+ return emojiRegex;
17393
13356
  },
17394
13357
  /**
17395
13358
  * Unused
@@ -18319,7 +14282,7 @@ var zodToJsonSchema = (schema, options) => {
18319
14282
  return combined;
18320
14283
  };
18321
14284
 
18322
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
14285
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
18323
14286
  function mapMiniTarget(t) {
18324
14287
  if (!t)
18325
14288
  return "draft-7";
@@ -18361,7 +14324,7 @@ function parseWithCompat(schema, data) {
18361
14324
  return result.data;
18362
14325
  }
18363
14326
 
18364
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
14327
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
18365
14328
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
18366
14329
  var Protocol = class {
18367
14330
  constructor(_options) {
@@ -18573,6 +14536,10 @@ var Protocol = class {
18573
14536
  this._progressHandlers.clear();
18574
14537
  this._taskProgressTokens.clear();
18575
14538
  this._pendingDebouncedNotifications.clear();
14539
+ for (const info of this._timeoutInfo.values()) {
14540
+ clearTimeout(info.timeoutId);
14541
+ }
14542
+ this._timeoutInfo.clear();
18576
14543
  for (const controller of this._requestHandlerAbortControllers.values()) {
18577
14544
  controller.abort();
18578
14545
  }
@@ -18703,7 +14670,9 @@ var Protocol = class {
18703
14670
  await capturedTransport?.send(errorResponse);
18704
14671
  }
18705
14672
  }).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
18706
- this._requestHandlerAbortControllers.delete(request.id);
14673
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
14674
+ this._requestHandlerAbortControllers.delete(request.id);
14675
+ }
18707
14676
  });
18708
14677
  }
18709
14678
  _onprogress(notification) {
@@ -19309,7 +15278,7 @@ function mergeCapabilities(base, additional) {
19309
15278
  return result;
19310
15279
  }
19311
15280
 
19312
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
15281
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19313
15282
  var import_ajv = __toESM(require_ajv(), 1);
19314
15283
  var import_ajv_formats = __toESM(require_dist(), 1);
19315
15284
  function createDefaultAjvInstance() {
@@ -19377,7 +15346,7 @@ var AjvJsonSchemaValidator = class {
19377
15346
  }
19378
15347
  };
19379
15348
 
19380
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
15349
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
19381
15350
  var ExperimentalServerTasks = class {
19382
15351
  constructor(_server) {
19383
15352
  this._server = _server;
@@ -19590,7 +15559,7 @@ var ExperimentalServerTasks = class {
19590
15559
  }
19591
15560
  };
19592
15561
 
19593
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
15562
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
19594
15563
  function assertToolsCallTaskCapability(requests, method, entityName) {
19595
15564
  if (!requests) {
19596
15565
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -19625,7 +15594,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
19625
15594
  }
19626
15595
  }
19627
15596
 
19628
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
15597
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
19629
15598
  var Server = class extends Protocol {
19630
15599
  /**
19631
15600
  * Initializes this server with the given name and version information.
@@ -20005,7 +15974,7 @@ var Server = class extends Protocol {
20005
15974
  }
20006
15975
  };
20007
15976
 
20008
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
15977
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20009
15978
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
20010
15979
  function isCompletable(schema) {
20011
15980
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -20019,7 +15988,7 @@ var McpZodTypeKind;
20019
15988
  McpZodTypeKind2["Completable"] = "McpCompletable";
20020
15989
  })(McpZodTypeKind || (McpZodTypeKind = {}));
20021
15990
 
20022
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
15991
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
20023
15992
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
20024
15993
  function validateToolName(name) {
20025
15994
  const warnings = [];
@@ -20077,7 +16046,7 @@ function validateAndWarnToolName(name) {
20077
16046
  return result.isValid;
20078
16047
  }
20079
16048
 
20080
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
16049
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
20081
16050
  var ExperimentalMcpServerTasks = class {
20082
16051
  constructor(_mcpServer) {
20083
16052
  this._mcpServer = _mcpServer;
@@ -20092,7 +16061,7 @@ var ExperimentalMcpServerTasks = class {
20092
16061
  }
20093
16062
  };
20094
16063
 
20095
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
16064
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
20096
16065
  var McpServer = class {
20097
16066
  constructor(serverInfo, options) {
20098
16067
  this._registeredResources = {};
@@ -20716,6 +16685,9 @@ var McpServer = class {
20716
16685
  annotations = rest.shift();
20717
16686
  }
20718
16687
  } else if (typeof firstArg === "object" && firstArg !== null) {
16688
+ if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
16689
+ throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
16690
+ }
20719
16691
  annotations = rest.shift();
20720
16692
  }
20721
16693
  }
@@ -20834,6 +16806,9 @@ function getZodSchemaObject(schema) {
20834
16806
  if (isZodRawShapeCompat(schema)) {
20835
16807
  return objectFromShape(schema);
20836
16808
  }
16809
+ if (!isZodSchemaInstance(schema)) {
16810
+ throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
16811
+ }
20837
16812
  return schema;
20838
16813
  }
20839
16814
  function promptArgumentsFromSchema(schema) {
@@ -20878,10 +16853,10 @@ var EMPTY_COMPLETION_RESULT = {
20878
16853
  }
20879
16854
  };
20880
16855
 
20881
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
16856
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
20882
16857
  import process2 from "process";
20883
16858
 
20884
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
16859
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
20885
16860
  var ReadBuffer = class {
20886
16861
  append(chunk) {
20887
16862
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
@@ -20909,7 +16884,7 @@ function serializeMessage(message) {
20909
16884
  return JSON.stringify(message) + "\n";
20910
16885
  }
20911
16886
 
20912
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
16887
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.28.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
20913
16888
  var StdioServerTransport = class {
20914
16889
  constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
20915
16890
  this._stdin = _stdin;
@@ -22833,4 +18808,4 @@ async function startMcpServer(opts) {
22833
18808
  export {
22834
18809
  startMcpServer
22835
18810
  };
22836
- //# sourceMappingURL=dist-73ESA7QZ.js.map
18811
+ //# sourceMappingURL=dist-FDS4MNUV.js.map