@aiaiai-pt/martha-cli 0.63.0 → 0.63.2

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 (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.js +3652 -14
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9531,7 +9531,7 @@ class MarthaAPIClient {
9531
9531
  const tenant = this.tenantFor(token);
9532
9532
  return {
9533
9533
  Authorization: `Bearer ${token}`,
9534
- ...tenant ? { "X-Martha-Tenant": tenant } : {}
9534
+ ...tenant ? { "X-Tenant-Id": tenant } : {}
9535
9535
  };
9536
9536
  }
9537
9537
  log(msg) {
@@ -11244,7 +11244,7 @@ init_config();
11244
11244
  init_errors();
11245
11245
 
11246
11246
  // src/version.ts
11247
- var CLI_VERSION = "0.63.0";
11247
+ var CLI_VERSION = "0.63.2";
11248
11248
 
11249
11249
  // src/commands/sessions.ts
11250
11250
  function relativeTime(iso) {
@@ -21877,6 +21877,3646 @@ function registerBudgetCommands(program) {
21877
21877
 
21878
21878
  // src/commands/wiki.ts
21879
21879
  import fs11 from "node:fs";
21880
+
21881
+ // node_modules/zod/v4/core/core.js
21882
+ var NEVER = Object.freeze({
21883
+ status: "aborted"
21884
+ });
21885
+ function $constructor(name, initializer, params) {
21886
+ function init(inst, def) {
21887
+ if (!inst._zod) {
21888
+ Object.defineProperty(inst, "_zod", {
21889
+ value: {
21890
+ def,
21891
+ constr: _,
21892
+ traits: new Set
21893
+ },
21894
+ enumerable: false
21895
+ });
21896
+ }
21897
+ if (inst._zod.traits.has(name)) {
21898
+ return;
21899
+ }
21900
+ inst._zod.traits.add(name);
21901
+ initializer(inst, def);
21902
+ const proto = _.prototype;
21903
+ const keys = Object.keys(proto);
21904
+ for (let i = 0;i < keys.length; i++) {
21905
+ const k = keys[i];
21906
+ if (!(k in inst)) {
21907
+ inst[k] = proto[k].bind(inst);
21908
+ }
21909
+ }
21910
+ }
21911
+ const Parent = params?.Parent ?? Object;
21912
+
21913
+ class Definition extends Parent {
21914
+ }
21915
+ Object.defineProperty(Definition, "name", { value: name });
21916
+ function _(def) {
21917
+ var _a;
21918
+ const inst = params?.Parent ? new Definition : this;
21919
+ init(inst, def);
21920
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
21921
+ for (const fn of inst._zod.deferred) {
21922
+ fn();
21923
+ }
21924
+ return inst;
21925
+ }
21926
+ Object.defineProperty(_, "init", { value: init });
21927
+ Object.defineProperty(_, Symbol.hasInstance, {
21928
+ value: (inst) => {
21929
+ if (params?.Parent && inst instanceof params.Parent)
21930
+ return true;
21931
+ return inst?._zod?.traits?.has(name);
21932
+ }
21933
+ });
21934
+ Object.defineProperty(_, "name", { value: name });
21935
+ return _;
21936
+ }
21937
+ var $brand = Symbol("zod_brand");
21938
+
21939
+ class $ZodAsyncError extends Error {
21940
+ constructor() {
21941
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
21942
+ }
21943
+ }
21944
+
21945
+ class $ZodEncodeError extends Error {
21946
+ constructor(name) {
21947
+ super(`Encountered unidirectional transform during encode: ${name}`);
21948
+ this.name = "ZodEncodeError";
21949
+ }
21950
+ }
21951
+ var globalConfig = {};
21952
+ function config(newConfig) {
21953
+ if (newConfig)
21954
+ Object.assign(globalConfig, newConfig);
21955
+ return globalConfig;
21956
+ }
21957
+ // node_modules/zod/v4/core/util.js
21958
+ function getEnumValues(entries) {
21959
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
21960
+ const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
21961
+ return values;
21962
+ }
21963
+ function jsonStringifyReplacer(_, value) {
21964
+ if (typeof value === "bigint")
21965
+ return value.toString();
21966
+ return value;
21967
+ }
21968
+ function cached(getter) {
21969
+ const set = false;
21970
+ return {
21971
+ get value() {
21972
+ if (!set) {
21973
+ const value = getter();
21974
+ Object.defineProperty(this, "value", { value });
21975
+ return value;
21976
+ }
21977
+ throw new Error("cached value already set");
21978
+ }
21979
+ };
21980
+ }
21981
+ function nullish(input) {
21982
+ return input === null || input === undefined;
21983
+ }
21984
+ function cleanRegex(source) {
21985
+ const start = source.startsWith("^") ? 1 : 0;
21986
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
21987
+ return source.slice(start, end);
21988
+ }
21989
+ var EVALUATING = Symbol("evaluating");
21990
+ function defineLazy(object, key, getter) {
21991
+ let value = undefined;
21992
+ Object.defineProperty(object, key, {
21993
+ get() {
21994
+ if (value === EVALUATING) {
21995
+ return;
21996
+ }
21997
+ if (value === undefined) {
21998
+ value = EVALUATING;
21999
+ value = getter();
22000
+ }
22001
+ return value;
22002
+ },
22003
+ set(v) {
22004
+ Object.defineProperty(object, key, {
22005
+ value: v
22006
+ });
22007
+ },
22008
+ configurable: true
22009
+ });
22010
+ }
22011
+ function assignProp(target, prop, value) {
22012
+ Object.defineProperty(target, prop, {
22013
+ value,
22014
+ writable: true,
22015
+ enumerable: true,
22016
+ configurable: true
22017
+ });
22018
+ }
22019
+ function mergeDefs(...defs) {
22020
+ const mergedDescriptors = {};
22021
+ for (const def of defs) {
22022
+ const descriptors = Object.getOwnPropertyDescriptors(def);
22023
+ Object.assign(mergedDescriptors, descriptors);
22024
+ }
22025
+ return Object.defineProperties({}, mergedDescriptors);
22026
+ }
22027
+ function esc(str) {
22028
+ return JSON.stringify(str);
22029
+ }
22030
+ function slugify(input) {
22031
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
22032
+ }
22033
+ var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
22034
+ function isObject(data) {
22035
+ return typeof data === "object" && data !== null && !Array.isArray(data);
22036
+ }
22037
+ var allowsEval = cached(() => {
22038
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
22039
+ return false;
22040
+ }
22041
+ try {
22042
+ const F = Function;
22043
+ new F("");
22044
+ return true;
22045
+ } catch (_) {
22046
+ return false;
22047
+ }
22048
+ });
22049
+ function isPlainObject2(o) {
22050
+ if (isObject(o) === false)
22051
+ return false;
22052
+ const ctor = o.constructor;
22053
+ if (ctor === undefined)
22054
+ return true;
22055
+ if (typeof ctor !== "function")
22056
+ return true;
22057
+ const prot = ctor.prototype;
22058
+ if (isObject(prot) === false)
22059
+ return false;
22060
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
22061
+ return false;
22062
+ }
22063
+ return true;
22064
+ }
22065
+ function shallowClone(o) {
22066
+ if (isPlainObject2(o))
22067
+ return { ...o };
22068
+ if (Array.isArray(o))
22069
+ return [...o];
22070
+ return o;
22071
+ }
22072
+ var propertyKeyTypes = new Set(["string", "number", "symbol"]);
22073
+ var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
22074
+ function escapeRegex(str) {
22075
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
22076
+ }
22077
+ function clone(inst, def, params) {
22078
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
22079
+ if (!def || params?.parent)
22080
+ cl._zod.parent = inst;
22081
+ return cl;
22082
+ }
22083
+ function normalizeParams(_params) {
22084
+ const params = _params;
22085
+ if (!params)
22086
+ return {};
22087
+ if (typeof params === "string")
22088
+ return { error: () => params };
22089
+ if (params?.message !== undefined) {
22090
+ if (params?.error !== undefined)
22091
+ throw new Error("Cannot specify both `message` and `error` params");
22092
+ params.error = params.message;
22093
+ }
22094
+ delete params.message;
22095
+ if (typeof params.error === "string")
22096
+ return { ...params, error: () => params.error };
22097
+ return params;
22098
+ }
22099
+ function optionalKeys(shape) {
22100
+ return Object.keys(shape).filter((k) => {
22101
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
22102
+ });
22103
+ }
22104
+ var NUMBER_FORMAT_RANGES = {
22105
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
22106
+ int32: [-2147483648, 2147483647],
22107
+ uint32: [0, 4294967295],
22108
+ float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000],
22109
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
22110
+ };
22111
+ function pick(schema, mask) {
22112
+ const currDef = schema._zod.def;
22113
+ const checks = currDef.checks;
22114
+ const hasChecks = checks && checks.length > 0;
22115
+ if (hasChecks) {
22116
+ throw new Error(".pick() cannot be used on object schemas containing refinements");
22117
+ }
22118
+ const def = mergeDefs(schema._zod.def, {
22119
+ get shape() {
22120
+ const newShape = {};
22121
+ for (const key in mask) {
22122
+ if (!(key in currDef.shape)) {
22123
+ throw new Error(`Unrecognized key: "${key}"`);
22124
+ }
22125
+ if (!mask[key])
22126
+ continue;
22127
+ newShape[key] = currDef.shape[key];
22128
+ }
22129
+ assignProp(this, "shape", newShape);
22130
+ return newShape;
22131
+ },
22132
+ checks: []
22133
+ });
22134
+ return clone(schema, def);
22135
+ }
22136
+ function omit(schema, mask) {
22137
+ const currDef = schema._zod.def;
22138
+ const checks = currDef.checks;
22139
+ const hasChecks = checks && checks.length > 0;
22140
+ if (hasChecks) {
22141
+ throw new Error(".omit() cannot be used on object schemas containing refinements");
22142
+ }
22143
+ const def = mergeDefs(schema._zod.def, {
22144
+ get shape() {
22145
+ const newShape = { ...schema._zod.def.shape };
22146
+ for (const key in mask) {
22147
+ if (!(key in currDef.shape)) {
22148
+ throw new Error(`Unrecognized key: "${key}"`);
22149
+ }
22150
+ if (!mask[key])
22151
+ continue;
22152
+ delete newShape[key];
22153
+ }
22154
+ assignProp(this, "shape", newShape);
22155
+ return newShape;
22156
+ },
22157
+ checks: []
22158
+ });
22159
+ return clone(schema, def);
22160
+ }
22161
+ function extend(schema, shape) {
22162
+ if (!isPlainObject2(shape)) {
22163
+ throw new Error("Invalid input to extend: expected a plain object");
22164
+ }
22165
+ const checks = schema._zod.def.checks;
22166
+ const hasChecks = checks && checks.length > 0;
22167
+ if (hasChecks) {
22168
+ const existingShape = schema._zod.def.shape;
22169
+ for (const key in shape) {
22170
+ if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
22171
+ throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
22172
+ }
22173
+ }
22174
+ }
22175
+ const def = mergeDefs(schema._zod.def, {
22176
+ get shape() {
22177
+ const _shape = { ...schema._zod.def.shape, ...shape };
22178
+ assignProp(this, "shape", _shape);
22179
+ return _shape;
22180
+ }
22181
+ });
22182
+ return clone(schema, def);
22183
+ }
22184
+ function safeExtend(schema, shape) {
22185
+ if (!isPlainObject2(shape)) {
22186
+ throw new Error("Invalid input to safeExtend: expected a plain object");
22187
+ }
22188
+ const def = mergeDefs(schema._zod.def, {
22189
+ get shape() {
22190
+ const _shape = { ...schema._zod.def.shape, ...shape };
22191
+ assignProp(this, "shape", _shape);
22192
+ return _shape;
22193
+ }
22194
+ });
22195
+ return clone(schema, def);
22196
+ }
22197
+ function merge(a, b) {
22198
+ const def = mergeDefs(a._zod.def, {
22199
+ get shape() {
22200
+ const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
22201
+ assignProp(this, "shape", _shape);
22202
+ return _shape;
22203
+ },
22204
+ get catchall() {
22205
+ return b._zod.def.catchall;
22206
+ },
22207
+ checks: []
22208
+ });
22209
+ return clone(a, def);
22210
+ }
22211
+ function partial(Class, schema, mask) {
22212
+ const currDef = schema._zod.def;
22213
+ const checks = currDef.checks;
22214
+ const hasChecks = checks && checks.length > 0;
22215
+ if (hasChecks) {
22216
+ throw new Error(".partial() cannot be used on object schemas containing refinements");
22217
+ }
22218
+ const def = mergeDefs(schema._zod.def, {
22219
+ get shape() {
22220
+ const oldShape = schema._zod.def.shape;
22221
+ const shape = { ...oldShape };
22222
+ if (mask) {
22223
+ for (const key in mask) {
22224
+ if (!(key in oldShape)) {
22225
+ throw new Error(`Unrecognized key: "${key}"`);
22226
+ }
22227
+ if (!mask[key])
22228
+ continue;
22229
+ shape[key] = Class ? new Class({
22230
+ type: "optional",
22231
+ innerType: oldShape[key]
22232
+ }) : oldShape[key];
22233
+ }
22234
+ } else {
22235
+ for (const key in oldShape) {
22236
+ shape[key] = Class ? new Class({
22237
+ type: "optional",
22238
+ innerType: oldShape[key]
22239
+ }) : oldShape[key];
22240
+ }
22241
+ }
22242
+ assignProp(this, "shape", shape);
22243
+ return shape;
22244
+ },
22245
+ checks: []
22246
+ });
22247
+ return clone(schema, def);
22248
+ }
22249
+ function required(Class, schema, mask) {
22250
+ const def = mergeDefs(schema._zod.def, {
22251
+ get shape() {
22252
+ const oldShape = schema._zod.def.shape;
22253
+ const shape = { ...oldShape };
22254
+ if (mask) {
22255
+ for (const key in mask) {
22256
+ if (!(key in shape)) {
22257
+ throw new Error(`Unrecognized key: "${key}"`);
22258
+ }
22259
+ if (!mask[key])
22260
+ continue;
22261
+ shape[key] = new Class({
22262
+ type: "nonoptional",
22263
+ innerType: oldShape[key]
22264
+ });
22265
+ }
22266
+ } else {
22267
+ for (const key in oldShape) {
22268
+ shape[key] = new Class({
22269
+ type: "nonoptional",
22270
+ innerType: oldShape[key]
22271
+ });
22272
+ }
22273
+ }
22274
+ assignProp(this, "shape", shape);
22275
+ return shape;
22276
+ }
22277
+ });
22278
+ return clone(schema, def);
22279
+ }
22280
+ function aborted(x, startIndex = 0) {
22281
+ if (x.aborted === true)
22282
+ return true;
22283
+ for (let i = startIndex;i < x.issues.length; i++) {
22284
+ if (x.issues[i]?.continue !== true) {
22285
+ return true;
22286
+ }
22287
+ }
22288
+ return false;
22289
+ }
22290
+ function prefixIssues(path, issues) {
22291
+ return issues.map((iss) => {
22292
+ var _a;
22293
+ (_a = iss).path ?? (_a.path = []);
22294
+ iss.path.unshift(path);
22295
+ return iss;
22296
+ });
22297
+ }
22298
+ function unwrapMessage(message) {
22299
+ return typeof message === "string" ? message : message?.message;
22300
+ }
22301
+ function finalizeIssue(iss, ctx, config) {
22302
+ const full = { ...iss, path: iss.path ?? [] };
22303
+ if (!iss.message) {
22304
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
22305
+ full.message = message;
22306
+ }
22307
+ delete full.inst;
22308
+ delete full.continue;
22309
+ if (!ctx?.reportInput) {
22310
+ delete full.input;
22311
+ }
22312
+ return full;
22313
+ }
22314
+ function getLengthableOrigin(input) {
22315
+ if (Array.isArray(input))
22316
+ return "array";
22317
+ if (typeof input === "string")
22318
+ return "string";
22319
+ return "unknown";
22320
+ }
22321
+ function issue(...args) {
22322
+ const [iss, input, inst] = args;
22323
+ if (typeof iss === "string") {
22324
+ return {
22325
+ message: iss,
22326
+ code: "custom",
22327
+ input,
22328
+ inst
22329
+ };
22330
+ }
22331
+ return { ...iss };
22332
+ }
22333
+
22334
+ // node_modules/zod/v4/core/errors.js
22335
+ var initializer = (inst, def) => {
22336
+ inst.name = "$ZodError";
22337
+ Object.defineProperty(inst, "_zod", {
22338
+ value: inst._zod,
22339
+ enumerable: false
22340
+ });
22341
+ Object.defineProperty(inst, "issues", {
22342
+ value: def,
22343
+ enumerable: false
22344
+ });
22345
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
22346
+ Object.defineProperty(inst, "toString", {
22347
+ value: () => inst.message,
22348
+ enumerable: false
22349
+ });
22350
+ };
22351
+ var $ZodError = $constructor("$ZodError", initializer);
22352
+ var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
22353
+ function flattenError(error, mapper = (issue) => issue.message) {
22354
+ const fieldErrors = {};
22355
+ const formErrors = [];
22356
+ for (const sub of error.issues) {
22357
+ if (sub.path.length > 0) {
22358
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
22359
+ fieldErrors[sub.path[0]].push(mapper(sub));
22360
+ } else {
22361
+ formErrors.push(mapper(sub));
22362
+ }
22363
+ }
22364
+ return { formErrors, fieldErrors };
22365
+ }
22366
+ function formatError(error, mapper = (issue) => issue.message) {
22367
+ const fieldErrors = { _errors: [] };
22368
+ const processError = (error) => {
22369
+ for (const issue of error.issues) {
22370
+ if (issue.code === "invalid_union" && issue.errors.length) {
22371
+ issue.errors.map((issues) => processError({ issues }));
22372
+ } else if (issue.code === "invalid_key") {
22373
+ processError({ issues: issue.issues });
22374
+ } else if (issue.code === "invalid_element") {
22375
+ processError({ issues: issue.issues });
22376
+ } else if (issue.path.length === 0) {
22377
+ fieldErrors._errors.push(mapper(issue));
22378
+ } else {
22379
+ let curr = fieldErrors;
22380
+ let i = 0;
22381
+ while (i < issue.path.length) {
22382
+ const el = issue.path[i];
22383
+ const terminal = i === issue.path.length - 1;
22384
+ if (!terminal) {
22385
+ curr[el] = curr[el] || { _errors: [] };
22386
+ } else {
22387
+ curr[el] = curr[el] || { _errors: [] };
22388
+ curr[el]._errors.push(mapper(issue));
22389
+ }
22390
+ curr = curr[el];
22391
+ i++;
22392
+ }
22393
+ }
22394
+ }
22395
+ };
22396
+ processError(error);
22397
+ return fieldErrors;
22398
+ }
22399
+
22400
+ // node_modules/zod/v4/core/parse.js
22401
+ var _parse = (_Err) => (schema, value, _ctx, _params) => {
22402
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
22403
+ const result = schema._zod.run({ value, issues: [] }, ctx);
22404
+ if (result instanceof Promise) {
22405
+ throw new $ZodAsyncError;
22406
+ }
22407
+ if (result.issues.length) {
22408
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
22409
+ captureStackTrace(e, _params?.callee);
22410
+ throw e;
22411
+ }
22412
+ return result.value;
22413
+ };
22414
+ var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
22415
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
22416
+ let result = schema._zod.run({ value, issues: [] }, ctx);
22417
+ if (result instanceof Promise)
22418
+ result = await result;
22419
+ if (result.issues.length) {
22420
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
22421
+ captureStackTrace(e, params?.callee);
22422
+ throw e;
22423
+ }
22424
+ return result.value;
22425
+ };
22426
+ var _safeParse = (_Err) => (schema, value, _ctx) => {
22427
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
22428
+ const result = schema._zod.run({ value, issues: [] }, ctx);
22429
+ if (result instanceof Promise) {
22430
+ throw new $ZodAsyncError;
22431
+ }
22432
+ return result.issues.length ? {
22433
+ success: false,
22434
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
22435
+ } : { success: true, data: result.value };
22436
+ };
22437
+ var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
22438
+ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
22439
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
22440
+ let result = schema._zod.run({ value, issues: [] }, ctx);
22441
+ if (result instanceof Promise)
22442
+ result = await result;
22443
+ return result.issues.length ? {
22444
+ success: false,
22445
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
22446
+ } : { success: true, data: result.value };
22447
+ };
22448
+ var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
22449
+ var _encode = (_Err) => (schema, value, _ctx) => {
22450
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
22451
+ return _parse(_Err)(schema, value, ctx);
22452
+ };
22453
+ var _decode = (_Err) => (schema, value, _ctx) => {
22454
+ return _parse(_Err)(schema, value, _ctx);
22455
+ };
22456
+ var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
22457
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
22458
+ return _parseAsync(_Err)(schema, value, ctx);
22459
+ };
22460
+ var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
22461
+ return _parseAsync(_Err)(schema, value, _ctx);
22462
+ };
22463
+ var _safeEncode = (_Err) => (schema, value, _ctx) => {
22464
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
22465
+ return _safeParse(_Err)(schema, value, ctx);
22466
+ };
22467
+ var _safeDecode = (_Err) => (schema, value, _ctx) => {
22468
+ return _safeParse(_Err)(schema, value, _ctx);
22469
+ };
22470
+ var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
22471
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
22472
+ return _safeParseAsync(_Err)(schema, value, ctx);
22473
+ };
22474
+ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
22475
+ return _safeParseAsync(_Err)(schema, value, _ctx);
22476
+ };
22477
+ // node_modules/zod/v4/core/regexes.js
22478
+ var cuid = /^[cC][^\s-]{8,}$/;
22479
+ var cuid2 = /^[0-9a-z]+$/;
22480
+ var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
22481
+ var xid = /^[0-9a-vA-V]{20}$/;
22482
+ var ksuid = /^[A-Za-z0-9]{27}$/;
22483
+ var nanoid = /^[a-zA-Z0-9_-]{21}$/;
22484
+ var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
22485
+ var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
22486
+ var uuid = (version) => {
22487
+ if (!version)
22488
+ return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
22489
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
22490
+ };
22491
+ var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
22492
+ var _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
22493
+ function emoji() {
22494
+ return new RegExp(_emoji, "u");
22495
+ }
22496
+ var ipv4 = /^(?:(?: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])$/;
22497
+ var ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/;
22498
+ var cidrv4 = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/;
22499
+ var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
22500
+ var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
22501
+ var base64url = /^[A-Za-z0-9_-]*$/;
22502
+ var e164 = /^\+[1-9]\d{6,14}$/;
22503
+ var dateSource = `(?:(?:\\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])))`;
22504
+ var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
22505
+ function timeSource(args) {
22506
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
22507
+ const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
22508
+ return regex;
22509
+ }
22510
+ function time(args) {
22511
+ return new RegExp(`^${timeSource(args)}$`);
22512
+ }
22513
+ function datetime(args) {
22514
+ const time = timeSource({ precision: args.precision });
22515
+ const opts = ["Z"];
22516
+ if (args.local)
22517
+ opts.push("");
22518
+ if (args.offset)
22519
+ opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
22520
+ const timeRegex = `${time}(?:${opts.join("|")})`;
22521
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
22522
+ }
22523
+ var string = (params) => {
22524
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
22525
+ return new RegExp(`^${regex}$`);
22526
+ };
22527
+ var lowercase = /^[^A-Z]*$/;
22528
+ var uppercase = /^[^a-z]*$/;
22529
+
22530
+ // node_modules/zod/v4/core/checks.js
22531
+ var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
22532
+ var _a;
22533
+ inst._zod ?? (inst._zod = {});
22534
+ inst._zod.def = def;
22535
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
22536
+ });
22537
+ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
22538
+ var _a;
22539
+ $ZodCheck.init(inst, def);
22540
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
22541
+ const val = payload.value;
22542
+ return !nullish(val) && val.length !== undefined;
22543
+ });
22544
+ inst._zod.onattach.push((inst) => {
22545
+ const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
22546
+ if (def.maximum < curr)
22547
+ inst._zod.bag.maximum = def.maximum;
22548
+ });
22549
+ inst._zod.check = (payload) => {
22550
+ const input = payload.value;
22551
+ const length = input.length;
22552
+ if (length <= def.maximum)
22553
+ return;
22554
+ const origin = getLengthableOrigin(input);
22555
+ payload.issues.push({
22556
+ origin,
22557
+ code: "too_big",
22558
+ maximum: def.maximum,
22559
+ inclusive: true,
22560
+ input,
22561
+ inst,
22562
+ continue: !def.abort
22563
+ });
22564
+ };
22565
+ });
22566
+ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
22567
+ var _a;
22568
+ $ZodCheck.init(inst, def);
22569
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
22570
+ const val = payload.value;
22571
+ return !nullish(val) && val.length !== undefined;
22572
+ });
22573
+ inst._zod.onattach.push((inst) => {
22574
+ const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
22575
+ if (def.minimum > curr)
22576
+ inst._zod.bag.minimum = def.minimum;
22577
+ });
22578
+ inst._zod.check = (payload) => {
22579
+ const input = payload.value;
22580
+ const length = input.length;
22581
+ if (length >= def.minimum)
22582
+ return;
22583
+ const origin = getLengthableOrigin(input);
22584
+ payload.issues.push({
22585
+ origin,
22586
+ code: "too_small",
22587
+ minimum: def.minimum,
22588
+ inclusive: true,
22589
+ input,
22590
+ inst,
22591
+ continue: !def.abort
22592
+ });
22593
+ };
22594
+ });
22595
+ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
22596
+ var _a;
22597
+ $ZodCheck.init(inst, def);
22598
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
22599
+ const val = payload.value;
22600
+ return !nullish(val) && val.length !== undefined;
22601
+ });
22602
+ inst._zod.onattach.push((inst) => {
22603
+ const bag = inst._zod.bag;
22604
+ bag.minimum = def.length;
22605
+ bag.maximum = def.length;
22606
+ bag.length = def.length;
22607
+ });
22608
+ inst._zod.check = (payload) => {
22609
+ const input = payload.value;
22610
+ const length = input.length;
22611
+ if (length === def.length)
22612
+ return;
22613
+ const origin = getLengthableOrigin(input);
22614
+ const tooBig = length > def.length;
22615
+ payload.issues.push({
22616
+ origin,
22617
+ ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
22618
+ inclusive: true,
22619
+ exact: true,
22620
+ input: payload.value,
22621
+ inst,
22622
+ continue: !def.abort
22623
+ });
22624
+ };
22625
+ });
22626
+ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
22627
+ var _a, _b;
22628
+ $ZodCheck.init(inst, def);
22629
+ inst._zod.onattach.push((inst) => {
22630
+ const bag = inst._zod.bag;
22631
+ bag.format = def.format;
22632
+ if (def.pattern) {
22633
+ bag.patterns ?? (bag.patterns = new Set);
22634
+ bag.patterns.add(def.pattern);
22635
+ }
22636
+ });
22637
+ if (def.pattern)
22638
+ (_a = inst._zod).check ?? (_a.check = (payload) => {
22639
+ def.pattern.lastIndex = 0;
22640
+ if (def.pattern.test(payload.value))
22641
+ return;
22642
+ payload.issues.push({
22643
+ origin: "string",
22644
+ code: "invalid_format",
22645
+ format: def.format,
22646
+ input: payload.value,
22647
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
22648
+ inst,
22649
+ continue: !def.abort
22650
+ });
22651
+ });
22652
+ else
22653
+ (_b = inst._zod).check ?? (_b.check = () => {});
22654
+ });
22655
+ var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
22656
+ $ZodCheckStringFormat.init(inst, def);
22657
+ inst._zod.check = (payload) => {
22658
+ def.pattern.lastIndex = 0;
22659
+ if (def.pattern.test(payload.value))
22660
+ return;
22661
+ payload.issues.push({
22662
+ origin: "string",
22663
+ code: "invalid_format",
22664
+ format: "regex",
22665
+ input: payload.value,
22666
+ pattern: def.pattern.toString(),
22667
+ inst,
22668
+ continue: !def.abort
22669
+ });
22670
+ };
22671
+ });
22672
+ var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
22673
+ def.pattern ?? (def.pattern = lowercase);
22674
+ $ZodCheckStringFormat.init(inst, def);
22675
+ });
22676
+ var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
22677
+ def.pattern ?? (def.pattern = uppercase);
22678
+ $ZodCheckStringFormat.init(inst, def);
22679
+ });
22680
+ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
22681
+ $ZodCheck.init(inst, def);
22682
+ const escapedRegex = escapeRegex(def.includes);
22683
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
22684
+ def.pattern = pattern;
22685
+ inst._zod.onattach.push((inst) => {
22686
+ const bag = inst._zod.bag;
22687
+ bag.patterns ?? (bag.patterns = new Set);
22688
+ bag.patterns.add(pattern);
22689
+ });
22690
+ inst._zod.check = (payload) => {
22691
+ if (payload.value.includes(def.includes, def.position))
22692
+ return;
22693
+ payload.issues.push({
22694
+ origin: "string",
22695
+ code: "invalid_format",
22696
+ format: "includes",
22697
+ includes: def.includes,
22698
+ input: payload.value,
22699
+ inst,
22700
+ continue: !def.abort
22701
+ });
22702
+ };
22703
+ });
22704
+ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
22705
+ $ZodCheck.init(inst, def);
22706
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
22707
+ def.pattern ?? (def.pattern = pattern);
22708
+ inst._zod.onattach.push((inst) => {
22709
+ const bag = inst._zod.bag;
22710
+ bag.patterns ?? (bag.patterns = new Set);
22711
+ bag.patterns.add(pattern);
22712
+ });
22713
+ inst._zod.check = (payload) => {
22714
+ if (payload.value.startsWith(def.prefix))
22715
+ return;
22716
+ payload.issues.push({
22717
+ origin: "string",
22718
+ code: "invalid_format",
22719
+ format: "starts_with",
22720
+ prefix: def.prefix,
22721
+ input: payload.value,
22722
+ inst,
22723
+ continue: !def.abort
22724
+ });
22725
+ };
22726
+ });
22727
+ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
22728
+ $ZodCheck.init(inst, def);
22729
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
22730
+ def.pattern ?? (def.pattern = pattern);
22731
+ inst._zod.onattach.push((inst) => {
22732
+ const bag = inst._zod.bag;
22733
+ bag.patterns ?? (bag.patterns = new Set);
22734
+ bag.patterns.add(pattern);
22735
+ });
22736
+ inst._zod.check = (payload) => {
22737
+ if (payload.value.endsWith(def.suffix))
22738
+ return;
22739
+ payload.issues.push({
22740
+ origin: "string",
22741
+ code: "invalid_format",
22742
+ format: "ends_with",
22743
+ suffix: def.suffix,
22744
+ input: payload.value,
22745
+ inst,
22746
+ continue: !def.abort
22747
+ });
22748
+ };
22749
+ });
22750
+ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
22751
+ $ZodCheck.init(inst, def);
22752
+ inst._zod.check = (payload) => {
22753
+ payload.value = def.tx(payload.value);
22754
+ };
22755
+ });
22756
+
22757
+ // node_modules/zod/v4/core/doc.js
22758
+ class Doc {
22759
+ constructor(args = []) {
22760
+ this.content = [];
22761
+ this.indent = 0;
22762
+ if (this)
22763
+ this.args = args;
22764
+ }
22765
+ indented(fn) {
22766
+ this.indent += 1;
22767
+ fn(this);
22768
+ this.indent -= 1;
22769
+ }
22770
+ write(arg) {
22771
+ if (typeof arg === "function") {
22772
+ arg(this, { execution: "sync" });
22773
+ arg(this, { execution: "async" });
22774
+ return;
22775
+ }
22776
+ const content = arg;
22777
+ const lines = content.split(`
22778
+ `).filter((x) => x);
22779
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
22780
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
22781
+ for (const line of dedented) {
22782
+ this.content.push(line);
22783
+ }
22784
+ }
22785
+ compile() {
22786
+ const F = Function;
22787
+ const args = this?.args;
22788
+ const content = this?.content ?? [``];
22789
+ const lines = [...content.map((x) => ` ${x}`)];
22790
+ return new F(...args, lines.join(`
22791
+ `));
22792
+ }
22793
+ }
22794
+
22795
+ // node_modules/zod/v4/core/versions.js
22796
+ var version = {
22797
+ major: 4,
22798
+ minor: 3,
22799
+ patch: 6
22800
+ };
22801
+
22802
+ // node_modules/zod/v4/core/schemas.js
22803
+ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
22804
+ var _a;
22805
+ inst ?? (inst = {});
22806
+ inst._zod.def = def;
22807
+ inst._zod.bag = inst._zod.bag || {};
22808
+ inst._zod.version = version;
22809
+ const checks = [...inst._zod.def.checks ?? []];
22810
+ if (inst._zod.traits.has("$ZodCheck")) {
22811
+ checks.unshift(inst);
22812
+ }
22813
+ for (const ch of checks) {
22814
+ for (const fn of ch._zod.onattach) {
22815
+ fn(inst);
22816
+ }
22817
+ }
22818
+ if (checks.length === 0) {
22819
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
22820
+ inst._zod.deferred?.push(() => {
22821
+ inst._zod.run = inst._zod.parse;
22822
+ });
22823
+ } else {
22824
+ const runChecks = (payload, checks, ctx) => {
22825
+ let isAborted = aborted(payload);
22826
+ let asyncResult;
22827
+ for (const ch of checks) {
22828
+ if (ch._zod.def.when) {
22829
+ const shouldRun = ch._zod.def.when(payload);
22830
+ if (!shouldRun)
22831
+ continue;
22832
+ } else if (isAborted) {
22833
+ continue;
22834
+ }
22835
+ const currLen = payload.issues.length;
22836
+ const _ = ch._zod.check(payload);
22837
+ if (_ instanceof Promise && ctx?.async === false) {
22838
+ throw new $ZodAsyncError;
22839
+ }
22840
+ if (asyncResult || _ instanceof Promise) {
22841
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
22842
+ await _;
22843
+ const nextLen = payload.issues.length;
22844
+ if (nextLen === currLen)
22845
+ return;
22846
+ if (!isAborted)
22847
+ isAborted = aborted(payload, currLen);
22848
+ });
22849
+ } else {
22850
+ const nextLen = payload.issues.length;
22851
+ if (nextLen === currLen)
22852
+ continue;
22853
+ if (!isAborted)
22854
+ isAborted = aborted(payload, currLen);
22855
+ }
22856
+ }
22857
+ if (asyncResult) {
22858
+ return asyncResult.then(() => {
22859
+ return payload;
22860
+ });
22861
+ }
22862
+ return payload;
22863
+ };
22864
+ const handleCanaryResult = (canary, payload, ctx) => {
22865
+ if (aborted(canary)) {
22866
+ canary.aborted = true;
22867
+ return canary;
22868
+ }
22869
+ const checkResult = runChecks(payload, checks, ctx);
22870
+ if (checkResult instanceof Promise) {
22871
+ if (ctx.async === false)
22872
+ throw new $ZodAsyncError;
22873
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
22874
+ }
22875
+ return inst._zod.parse(checkResult, ctx);
22876
+ };
22877
+ inst._zod.run = (payload, ctx) => {
22878
+ if (ctx.skipChecks) {
22879
+ return inst._zod.parse(payload, ctx);
22880
+ }
22881
+ if (ctx.direction === "backward") {
22882
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
22883
+ if (canary instanceof Promise) {
22884
+ return canary.then((canary) => {
22885
+ return handleCanaryResult(canary, payload, ctx);
22886
+ });
22887
+ }
22888
+ return handleCanaryResult(canary, payload, ctx);
22889
+ }
22890
+ const result = inst._zod.parse(payload, ctx);
22891
+ if (result instanceof Promise) {
22892
+ if (ctx.async === false)
22893
+ throw new $ZodAsyncError;
22894
+ return result.then((result) => runChecks(result, checks, ctx));
22895
+ }
22896
+ return runChecks(result, checks, ctx);
22897
+ };
22898
+ }
22899
+ defineLazy(inst, "~standard", () => ({
22900
+ validate: (value) => {
22901
+ try {
22902
+ const r = safeParse(inst, value);
22903
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
22904
+ } catch (_) {
22905
+ return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
22906
+ }
22907
+ },
22908
+ vendor: "zod",
22909
+ version: 1
22910
+ }));
22911
+ });
22912
+ var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
22913
+ $ZodType.init(inst, def);
22914
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
22915
+ inst._zod.parse = (payload, _) => {
22916
+ if (def.coerce)
22917
+ try {
22918
+ payload.value = String(payload.value);
22919
+ } catch (_) {}
22920
+ if (typeof payload.value === "string")
22921
+ return payload;
22922
+ payload.issues.push({
22923
+ expected: "string",
22924
+ code: "invalid_type",
22925
+ input: payload.value,
22926
+ inst
22927
+ });
22928
+ return payload;
22929
+ };
22930
+ });
22931
+ var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
22932
+ $ZodCheckStringFormat.init(inst, def);
22933
+ $ZodString.init(inst, def);
22934
+ });
22935
+ var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
22936
+ def.pattern ?? (def.pattern = guid);
22937
+ $ZodStringFormat.init(inst, def);
22938
+ });
22939
+ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
22940
+ if (def.version) {
22941
+ const versionMap = {
22942
+ v1: 1,
22943
+ v2: 2,
22944
+ v3: 3,
22945
+ v4: 4,
22946
+ v5: 5,
22947
+ v6: 6,
22948
+ v7: 7,
22949
+ v8: 8
22950
+ };
22951
+ const v = versionMap[def.version];
22952
+ if (v === undefined)
22953
+ throw new Error(`Invalid UUID version: "${def.version}"`);
22954
+ def.pattern ?? (def.pattern = uuid(v));
22955
+ } else
22956
+ def.pattern ?? (def.pattern = uuid());
22957
+ $ZodStringFormat.init(inst, def);
22958
+ });
22959
+ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
22960
+ def.pattern ?? (def.pattern = email);
22961
+ $ZodStringFormat.init(inst, def);
22962
+ });
22963
+ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
22964
+ $ZodStringFormat.init(inst, def);
22965
+ inst._zod.check = (payload) => {
22966
+ try {
22967
+ const trimmed = payload.value.trim();
22968
+ const url = new URL(trimmed);
22969
+ if (def.hostname) {
22970
+ def.hostname.lastIndex = 0;
22971
+ if (!def.hostname.test(url.hostname)) {
22972
+ payload.issues.push({
22973
+ code: "invalid_format",
22974
+ format: "url",
22975
+ note: "Invalid hostname",
22976
+ pattern: def.hostname.source,
22977
+ input: payload.value,
22978
+ inst,
22979
+ continue: !def.abort
22980
+ });
22981
+ }
22982
+ }
22983
+ if (def.protocol) {
22984
+ def.protocol.lastIndex = 0;
22985
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
22986
+ payload.issues.push({
22987
+ code: "invalid_format",
22988
+ format: "url",
22989
+ note: "Invalid protocol",
22990
+ pattern: def.protocol.source,
22991
+ input: payload.value,
22992
+ inst,
22993
+ continue: !def.abort
22994
+ });
22995
+ }
22996
+ }
22997
+ if (def.normalize) {
22998
+ payload.value = url.href;
22999
+ } else {
23000
+ payload.value = trimmed;
23001
+ }
23002
+ return;
23003
+ } catch (_) {
23004
+ payload.issues.push({
23005
+ code: "invalid_format",
23006
+ format: "url",
23007
+ input: payload.value,
23008
+ inst,
23009
+ continue: !def.abort
23010
+ });
23011
+ }
23012
+ };
23013
+ });
23014
+ var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
23015
+ def.pattern ?? (def.pattern = emoji());
23016
+ $ZodStringFormat.init(inst, def);
23017
+ });
23018
+ var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
23019
+ def.pattern ?? (def.pattern = nanoid);
23020
+ $ZodStringFormat.init(inst, def);
23021
+ });
23022
+ var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
23023
+ def.pattern ?? (def.pattern = cuid);
23024
+ $ZodStringFormat.init(inst, def);
23025
+ });
23026
+ var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
23027
+ def.pattern ?? (def.pattern = cuid2);
23028
+ $ZodStringFormat.init(inst, def);
23029
+ });
23030
+ var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
23031
+ def.pattern ?? (def.pattern = ulid);
23032
+ $ZodStringFormat.init(inst, def);
23033
+ });
23034
+ var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
23035
+ def.pattern ?? (def.pattern = xid);
23036
+ $ZodStringFormat.init(inst, def);
23037
+ });
23038
+ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
23039
+ def.pattern ?? (def.pattern = ksuid);
23040
+ $ZodStringFormat.init(inst, def);
23041
+ });
23042
+ var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
23043
+ def.pattern ?? (def.pattern = datetime(def));
23044
+ $ZodStringFormat.init(inst, def);
23045
+ });
23046
+ var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
23047
+ def.pattern ?? (def.pattern = date);
23048
+ $ZodStringFormat.init(inst, def);
23049
+ });
23050
+ var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
23051
+ def.pattern ?? (def.pattern = time(def));
23052
+ $ZodStringFormat.init(inst, def);
23053
+ });
23054
+ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
23055
+ def.pattern ?? (def.pattern = duration);
23056
+ $ZodStringFormat.init(inst, def);
23057
+ });
23058
+ var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
23059
+ def.pattern ?? (def.pattern = ipv4);
23060
+ $ZodStringFormat.init(inst, def);
23061
+ inst._zod.bag.format = `ipv4`;
23062
+ });
23063
+ var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
23064
+ def.pattern ?? (def.pattern = ipv6);
23065
+ $ZodStringFormat.init(inst, def);
23066
+ inst._zod.bag.format = `ipv6`;
23067
+ inst._zod.check = (payload) => {
23068
+ try {
23069
+ new URL(`http://[${payload.value}]`);
23070
+ } catch {
23071
+ payload.issues.push({
23072
+ code: "invalid_format",
23073
+ format: "ipv6",
23074
+ input: payload.value,
23075
+ inst,
23076
+ continue: !def.abort
23077
+ });
23078
+ }
23079
+ };
23080
+ });
23081
+ var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
23082
+ def.pattern ?? (def.pattern = cidrv4);
23083
+ $ZodStringFormat.init(inst, def);
23084
+ });
23085
+ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
23086
+ def.pattern ?? (def.pattern = cidrv6);
23087
+ $ZodStringFormat.init(inst, def);
23088
+ inst._zod.check = (payload) => {
23089
+ const parts = payload.value.split("/");
23090
+ try {
23091
+ if (parts.length !== 2)
23092
+ throw new Error;
23093
+ const [address, prefix] = parts;
23094
+ if (!prefix)
23095
+ throw new Error;
23096
+ const prefixNum = Number(prefix);
23097
+ if (`${prefixNum}` !== prefix)
23098
+ throw new Error;
23099
+ if (prefixNum < 0 || prefixNum > 128)
23100
+ throw new Error;
23101
+ new URL(`http://[${address}]`);
23102
+ } catch {
23103
+ payload.issues.push({
23104
+ code: "invalid_format",
23105
+ format: "cidrv6",
23106
+ input: payload.value,
23107
+ inst,
23108
+ continue: !def.abort
23109
+ });
23110
+ }
23111
+ };
23112
+ });
23113
+ function isValidBase64(data) {
23114
+ if (data === "")
23115
+ return true;
23116
+ if (data.length % 4 !== 0)
23117
+ return false;
23118
+ try {
23119
+ atob(data);
23120
+ return true;
23121
+ } catch {
23122
+ return false;
23123
+ }
23124
+ }
23125
+ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
23126
+ def.pattern ?? (def.pattern = base64);
23127
+ $ZodStringFormat.init(inst, def);
23128
+ inst._zod.bag.contentEncoding = "base64";
23129
+ inst._zod.check = (payload) => {
23130
+ if (isValidBase64(payload.value))
23131
+ return;
23132
+ payload.issues.push({
23133
+ code: "invalid_format",
23134
+ format: "base64",
23135
+ input: payload.value,
23136
+ inst,
23137
+ continue: !def.abort
23138
+ });
23139
+ };
23140
+ });
23141
+ function isValidBase64URL(data) {
23142
+ if (!base64url.test(data))
23143
+ return false;
23144
+ const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
23145
+ const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
23146
+ return isValidBase64(padded);
23147
+ }
23148
+ var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
23149
+ def.pattern ?? (def.pattern = base64url);
23150
+ $ZodStringFormat.init(inst, def);
23151
+ inst._zod.bag.contentEncoding = "base64url";
23152
+ inst._zod.check = (payload) => {
23153
+ if (isValidBase64URL(payload.value))
23154
+ return;
23155
+ payload.issues.push({
23156
+ code: "invalid_format",
23157
+ format: "base64url",
23158
+ input: payload.value,
23159
+ inst,
23160
+ continue: !def.abort
23161
+ });
23162
+ };
23163
+ });
23164
+ var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
23165
+ def.pattern ?? (def.pattern = e164);
23166
+ $ZodStringFormat.init(inst, def);
23167
+ });
23168
+ function isValidJWT(token, algorithm = null) {
23169
+ try {
23170
+ const tokensParts = token.split(".");
23171
+ if (tokensParts.length !== 3)
23172
+ return false;
23173
+ const [header] = tokensParts;
23174
+ if (!header)
23175
+ return false;
23176
+ const parsedHeader = JSON.parse(atob(header));
23177
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
23178
+ return false;
23179
+ if (!parsedHeader.alg)
23180
+ return false;
23181
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
23182
+ return false;
23183
+ return true;
23184
+ } catch {
23185
+ return false;
23186
+ }
23187
+ }
23188
+ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
23189
+ $ZodStringFormat.init(inst, def);
23190
+ inst._zod.check = (payload) => {
23191
+ if (isValidJWT(payload.value, def.alg))
23192
+ return;
23193
+ payload.issues.push({
23194
+ code: "invalid_format",
23195
+ format: "jwt",
23196
+ input: payload.value,
23197
+ inst,
23198
+ continue: !def.abort
23199
+ });
23200
+ };
23201
+ });
23202
+ var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
23203
+ $ZodType.init(inst, def);
23204
+ inst._zod.parse = (payload) => payload;
23205
+ });
23206
+ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
23207
+ $ZodType.init(inst, def);
23208
+ inst._zod.parse = (payload, _ctx) => {
23209
+ payload.issues.push({
23210
+ expected: "never",
23211
+ code: "invalid_type",
23212
+ input: payload.value,
23213
+ inst
23214
+ });
23215
+ return payload;
23216
+ };
23217
+ });
23218
+ function handleArrayResult(result, final, index) {
23219
+ if (result.issues.length) {
23220
+ final.issues.push(...prefixIssues(index, result.issues));
23221
+ }
23222
+ final.value[index] = result.value;
23223
+ }
23224
+ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
23225
+ $ZodType.init(inst, def);
23226
+ inst._zod.parse = (payload, ctx) => {
23227
+ const input = payload.value;
23228
+ if (!Array.isArray(input)) {
23229
+ payload.issues.push({
23230
+ expected: "array",
23231
+ code: "invalid_type",
23232
+ input,
23233
+ inst
23234
+ });
23235
+ return payload;
23236
+ }
23237
+ payload.value = Array(input.length);
23238
+ const proms = [];
23239
+ for (let i = 0;i < input.length; i++) {
23240
+ const item = input[i];
23241
+ const result = def.element._zod.run({
23242
+ value: item,
23243
+ issues: []
23244
+ }, ctx);
23245
+ if (result instanceof Promise) {
23246
+ proms.push(result.then((result) => handleArrayResult(result, payload, i)));
23247
+ } else {
23248
+ handleArrayResult(result, payload, i);
23249
+ }
23250
+ }
23251
+ if (proms.length) {
23252
+ return Promise.all(proms).then(() => payload);
23253
+ }
23254
+ return payload;
23255
+ };
23256
+ });
23257
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
23258
+ if (result.issues.length) {
23259
+ if (isOptionalOut && !(key in input)) {
23260
+ return;
23261
+ }
23262
+ final.issues.push(...prefixIssues(key, result.issues));
23263
+ }
23264
+ if (result.value === undefined) {
23265
+ if (key in input) {
23266
+ final.value[key] = undefined;
23267
+ }
23268
+ } else {
23269
+ final.value[key] = result.value;
23270
+ }
23271
+ }
23272
+ function normalizeDef(def) {
23273
+ const keys = Object.keys(def.shape);
23274
+ for (const k of keys) {
23275
+ if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
23276
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
23277
+ }
23278
+ }
23279
+ const okeys = optionalKeys(def.shape);
23280
+ return {
23281
+ ...def,
23282
+ keys,
23283
+ keySet: new Set(keys),
23284
+ numKeys: keys.length,
23285
+ optionalKeys: new Set(okeys)
23286
+ };
23287
+ }
23288
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
23289
+ const unrecognized = [];
23290
+ const keySet = def.keySet;
23291
+ const _catchall = def.catchall._zod;
23292
+ const t = _catchall.def.type;
23293
+ const isOptionalOut = _catchall.optout === "optional";
23294
+ for (const key in input) {
23295
+ if (keySet.has(key))
23296
+ continue;
23297
+ if (t === "never") {
23298
+ unrecognized.push(key);
23299
+ continue;
23300
+ }
23301
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
23302
+ if (r instanceof Promise) {
23303
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
23304
+ } else {
23305
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
23306
+ }
23307
+ }
23308
+ if (unrecognized.length) {
23309
+ payload.issues.push({
23310
+ code: "unrecognized_keys",
23311
+ keys: unrecognized,
23312
+ input,
23313
+ inst
23314
+ });
23315
+ }
23316
+ if (!proms.length)
23317
+ return payload;
23318
+ return Promise.all(proms).then(() => {
23319
+ return payload;
23320
+ });
23321
+ }
23322
+ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
23323
+ $ZodType.init(inst, def);
23324
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
23325
+ if (!desc?.get) {
23326
+ const sh = def.shape;
23327
+ Object.defineProperty(def, "shape", {
23328
+ get: () => {
23329
+ const newSh = { ...sh };
23330
+ Object.defineProperty(def, "shape", {
23331
+ value: newSh
23332
+ });
23333
+ return newSh;
23334
+ }
23335
+ });
23336
+ }
23337
+ const _normalized = cached(() => normalizeDef(def));
23338
+ defineLazy(inst._zod, "propValues", () => {
23339
+ const shape = def.shape;
23340
+ const propValues = {};
23341
+ for (const key in shape) {
23342
+ const field = shape[key]._zod;
23343
+ if (field.values) {
23344
+ propValues[key] ?? (propValues[key] = new Set);
23345
+ for (const v of field.values)
23346
+ propValues[key].add(v);
23347
+ }
23348
+ }
23349
+ return propValues;
23350
+ });
23351
+ const isObject2 = isObject;
23352
+ const catchall = def.catchall;
23353
+ let value;
23354
+ inst._zod.parse = (payload, ctx) => {
23355
+ value ?? (value = _normalized.value);
23356
+ const input = payload.value;
23357
+ if (!isObject2(input)) {
23358
+ payload.issues.push({
23359
+ expected: "object",
23360
+ code: "invalid_type",
23361
+ input,
23362
+ inst
23363
+ });
23364
+ return payload;
23365
+ }
23366
+ payload.value = {};
23367
+ const proms = [];
23368
+ const shape = value.shape;
23369
+ for (const key of value.keys) {
23370
+ const el = shape[key];
23371
+ const isOptionalOut = el._zod.optout === "optional";
23372
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
23373
+ if (r instanceof Promise) {
23374
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
23375
+ } else {
23376
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
23377
+ }
23378
+ }
23379
+ if (!catchall) {
23380
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
23381
+ }
23382
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
23383
+ };
23384
+ });
23385
+ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
23386
+ $ZodObject.init(inst, def);
23387
+ const superParse = inst._zod.parse;
23388
+ const _normalized = cached(() => normalizeDef(def));
23389
+ const generateFastpass = (shape) => {
23390
+ const doc = new Doc(["shape", "payload", "ctx"]);
23391
+ const normalized = _normalized.value;
23392
+ const parseStr = (key) => {
23393
+ const k = esc(key);
23394
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
23395
+ };
23396
+ doc.write(`const input = payload.value;`);
23397
+ const ids = Object.create(null);
23398
+ let counter = 0;
23399
+ for (const key of normalized.keys) {
23400
+ ids[key] = `key_${counter++}`;
23401
+ }
23402
+ doc.write(`const newResult = {};`);
23403
+ for (const key of normalized.keys) {
23404
+ const id = ids[key];
23405
+ const k = esc(key);
23406
+ const schema = shape[key];
23407
+ const isOptionalOut = schema?._zod?.optout === "optional";
23408
+ doc.write(`const ${id} = ${parseStr(key)};`);
23409
+ if (isOptionalOut) {
23410
+ doc.write(`
23411
+ if (${id}.issues.length) {
23412
+ if (${k} in input) {
23413
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
23414
+ ...iss,
23415
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
23416
+ })));
23417
+ }
23418
+ }
23419
+
23420
+ if (${id}.value === undefined) {
23421
+ if (${k} in input) {
23422
+ newResult[${k}] = undefined;
23423
+ }
23424
+ } else {
23425
+ newResult[${k}] = ${id}.value;
23426
+ }
23427
+
23428
+ `);
23429
+ } else {
23430
+ doc.write(`
23431
+ if (${id}.issues.length) {
23432
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
23433
+ ...iss,
23434
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
23435
+ })));
23436
+ }
23437
+
23438
+ if (${id}.value === undefined) {
23439
+ if (${k} in input) {
23440
+ newResult[${k}] = undefined;
23441
+ }
23442
+ } else {
23443
+ newResult[${k}] = ${id}.value;
23444
+ }
23445
+
23446
+ `);
23447
+ }
23448
+ }
23449
+ doc.write(`payload.value = newResult;`);
23450
+ doc.write(`return payload;`);
23451
+ const fn = doc.compile();
23452
+ return (payload, ctx) => fn(shape, payload, ctx);
23453
+ };
23454
+ let fastpass;
23455
+ const isObject2 = isObject;
23456
+ const jit = !globalConfig.jitless;
23457
+ const allowsEval2 = allowsEval;
23458
+ const fastEnabled = jit && allowsEval2.value;
23459
+ const catchall = def.catchall;
23460
+ let value;
23461
+ inst._zod.parse = (payload, ctx) => {
23462
+ value ?? (value = _normalized.value);
23463
+ const input = payload.value;
23464
+ if (!isObject2(input)) {
23465
+ payload.issues.push({
23466
+ expected: "object",
23467
+ code: "invalid_type",
23468
+ input,
23469
+ inst
23470
+ });
23471
+ return payload;
23472
+ }
23473
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
23474
+ if (!fastpass)
23475
+ fastpass = generateFastpass(def.shape);
23476
+ payload = fastpass(payload, ctx);
23477
+ if (!catchall)
23478
+ return payload;
23479
+ return handleCatchall([], input, payload, ctx, value, inst);
23480
+ }
23481
+ return superParse(payload, ctx);
23482
+ };
23483
+ });
23484
+ function handleUnionResults(results, final, inst, ctx) {
23485
+ for (const result of results) {
23486
+ if (result.issues.length === 0) {
23487
+ final.value = result.value;
23488
+ return final;
23489
+ }
23490
+ }
23491
+ const nonaborted = results.filter((r) => !aborted(r));
23492
+ if (nonaborted.length === 1) {
23493
+ final.value = nonaborted[0].value;
23494
+ return nonaborted[0];
23495
+ }
23496
+ final.issues.push({
23497
+ code: "invalid_union",
23498
+ input: final.value,
23499
+ inst,
23500
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
23501
+ });
23502
+ return final;
23503
+ }
23504
+ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
23505
+ $ZodType.init(inst, def);
23506
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
23507
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
23508
+ defineLazy(inst._zod, "values", () => {
23509
+ if (def.options.every((o) => o._zod.values)) {
23510
+ return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
23511
+ }
23512
+ return;
23513
+ });
23514
+ defineLazy(inst._zod, "pattern", () => {
23515
+ if (def.options.every((o) => o._zod.pattern)) {
23516
+ const patterns = def.options.map((o) => o._zod.pattern);
23517
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
23518
+ }
23519
+ return;
23520
+ });
23521
+ const single = def.options.length === 1;
23522
+ const first = def.options[0]._zod.run;
23523
+ inst._zod.parse = (payload, ctx) => {
23524
+ if (single) {
23525
+ return first(payload, ctx);
23526
+ }
23527
+ let async = false;
23528
+ const results = [];
23529
+ for (const option of def.options) {
23530
+ const result = option._zod.run({
23531
+ value: payload.value,
23532
+ issues: []
23533
+ }, ctx);
23534
+ if (result instanceof Promise) {
23535
+ results.push(result);
23536
+ async = true;
23537
+ } else {
23538
+ if (result.issues.length === 0)
23539
+ return result;
23540
+ results.push(result);
23541
+ }
23542
+ }
23543
+ if (!async)
23544
+ return handleUnionResults(results, payload, inst, ctx);
23545
+ return Promise.all(results).then((results) => {
23546
+ return handleUnionResults(results, payload, inst, ctx);
23547
+ });
23548
+ };
23549
+ });
23550
+ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
23551
+ $ZodType.init(inst, def);
23552
+ inst._zod.parse = (payload, ctx) => {
23553
+ const input = payload.value;
23554
+ const left = def.left._zod.run({ value: input, issues: [] }, ctx);
23555
+ const right = def.right._zod.run({ value: input, issues: [] }, ctx);
23556
+ const async = left instanceof Promise || right instanceof Promise;
23557
+ if (async) {
23558
+ return Promise.all([left, right]).then(([left, right]) => {
23559
+ return handleIntersectionResults(payload, left, right);
23560
+ });
23561
+ }
23562
+ return handleIntersectionResults(payload, left, right);
23563
+ };
23564
+ });
23565
+ function mergeValues(a, b) {
23566
+ if (a === b) {
23567
+ return { valid: true, data: a };
23568
+ }
23569
+ if (a instanceof Date && b instanceof Date && +a === +b) {
23570
+ return { valid: true, data: a };
23571
+ }
23572
+ if (isPlainObject2(a) && isPlainObject2(b)) {
23573
+ const bKeys = Object.keys(b);
23574
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
23575
+ const newObj = { ...a, ...b };
23576
+ for (const key of sharedKeys) {
23577
+ const sharedValue = mergeValues(a[key], b[key]);
23578
+ if (!sharedValue.valid) {
23579
+ return {
23580
+ valid: false,
23581
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
23582
+ };
23583
+ }
23584
+ newObj[key] = sharedValue.data;
23585
+ }
23586
+ return { valid: true, data: newObj };
23587
+ }
23588
+ if (Array.isArray(a) && Array.isArray(b)) {
23589
+ if (a.length !== b.length) {
23590
+ return { valid: false, mergeErrorPath: [] };
23591
+ }
23592
+ const newArray = [];
23593
+ for (let index = 0;index < a.length; index++) {
23594
+ const itemA = a[index];
23595
+ const itemB = b[index];
23596
+ const sharedValue = mergeValues(itemA, itemB);
23597
+ if (!sharedValue.valid) {
23598
+ return {
23599
+ valid: false,
23600
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
23601
+ };
23602
+ }
23603
+ newArray.push(sharedValue.data);
23604
+ }
23605
+ return { valid: true, data: newArray };
23606
+ }
23607
+ return { valid: false, mergeErrorPath: [] };
23608
+ }
23609
+ function handleIntersectionResults(result, left, right) {
23610
+ const unrecKeys = new Map;
23611
+ let unrecIssue;
23612
+ for (const iss of left.issues) {
23613
+ if (iss.code === "unrecognized_keys") {
23614
+ unrecIssue ?? (unrecIssue = iss);
23615
+ for (const k of iss.keys) {
23616
+ if (!unrecKeys.has(k))
23617
+ unrecKeys.set(k, {});
23618
+ unrecKeys.get(k).l = true;
23619
+ }
23620
+ } else {
23621
+ result.issues.push(iss);
23622
+ }
23623
+ }
23624
+ for (const iss of right.issues) {
23625
+ if (iss.code === "unrecognized_keys") {
23626
+ for (const k of iss.keys) {
23627
+ if (!unrecKeys.has(k))
23628
+ unrecKeys.set(k, {});
23629
+ unrecKeys.get(k).r = true;
23630
+ }
23631
+ } else {
23632
+ result.issues.push(iss);
23633
+ }
23634
+ }
23635
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
23636
+ if (bothKeys.length && unrecIssue) {
23637
+ result.issues.push({ ...unrecIssue, keys: bothKeys });
23638
+ }
23639
+ if (aborted(result))
23640
+ return result;
23641
+ const merged = mergeValues(left.value, right.value);
23642
+ if (!merged.valid) {
23643
+ throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
23644
+ }
23645
+ result.value = merged.data;
23646
+ return result;
23647
+ }
23648
+ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
23649
+ $ZodType.init(inst, def);
23650
+ const values = getEnumValues(def.entries);
23651
+ const valuesSet = new Set(values);
23652
+ inst._zod.values = valuesSet;
23653
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
23654
+ inst._zod.parse = (payload, _ctx) => {
23655
+ const input = payload.value;
23656
+ if (valuesSet.has(input)) {
23657
+ return payload;
23658
+ }
23659
+ payload.issues.push({
23660
+ code: "invalid_value",
23661
+ values,
23662
+ input,
23663
+ inst
23664
+ });
23665
+ return payload;
23666
+ };
23667
+ });
23668
+ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
23669
+ $ZodType.init(inst, def);
23670
+ inst._zod.parse = (payload, ctx) => {
23671
+ if (ctx.direction === "backward") {
23672
+ throw new $ZodEncodeError(inst.constructor.name);
23673
+ }
23674
+ const _out = def.transform(payload.value, payload);
23675
+ if (ctx.async) {
23676
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
23677
+ return output.then((output) => {
23678
+ payload.value = output;
23679
+ return payload;
23680
+ });
23681
+ }
23682
+ if (_out instanceof Promise) {
23683
+ throw new $ZodAsyncError;
23684
+ }
23685
+ payload.value = _out;
23686
+ return payload;
23687
+ };
23688
+ });
23689
+ function handleOptionalResult(result, input) {
23690
+ if (result.issues.length && input === undefined) {
23691
+ return { issues: [], value: undefined };
23692
+ }
23693
+ return result;
23694
+ }
23695
+ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
23696
+ $ZodType.init(inst, def);
23697
+ inst._zod.optin = "optional";
23698
+ inst._zod.optout = "optional";
23699
+ defineLazy(inst._zod, "values", () => {
23700
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
23701
+ });
23702
+ defineLazy(inst._zod, "pattern", () => {
23703
+ const pattern = def.innerType._zod.pattern;
23704
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;
23705
+ });
23706
+ inst._zod.parse = (payload, ctx) => {
23707
+ if (def.innerType._zod.optin === "optional") {
23708
+ const result = def.innerType._zod.run(payload, ctx);
23709
+ if (result instanceof Promise)
23710
+ return result.then((r) => handleOptionalResult(r, payload.value));
23711
+ return handleOptionalResult(result, payload.value);
23712
+ }
23713
+ if (payload.value === undefined) {
23714
+ return payload;
23715
+ }
23716
+ return def.innerType._zod.run(payload, ctx);
23717
+ };
23718
+ });
23719
+ var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
23720
+ $ZodOptional.init(inst, def);
23721
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
23722
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
23723
+ inst._zod.parse = (payload, ctx) => {
23724
+ return def.innerType._zod.run(payload, ctx);
23725
+ };
23726
+ });
23727
+ var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
23728
+ $ZodType.init(inst, def);
23729
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
23730
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
23731
+ defineLazy(inst._zod, "pattern", () => {
23732
+ const pattern = def.innerType._zod.pattern;
23733
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;
23734
+ });
23735
+ defineLazy(inst._zod, "values", () => {
23736
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
23737
+ });
23738
+ inst._zod.parse = (payload, ctx) => {
23739
+ if (payload.value === null)
23740
+ return payload;
23741
+ return def.innerType._zod.run(payload, ctx);
23742
+ };
23743
+ });
23744
+ var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
23745
+ $ZodType.init(inst, def);
23746
+ inst._zod.optin = "optional";
23747
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
23748
+ inst._zod.parse = (payload, ctx) => {
23749
+ if (ctx.direction === "backward") {
23750
+ return def.innerType._zod.run(payload, ctx);
23751
+ }
23752
+ if (payload.value === undefined) {
23753
+ payload.value = def.defaultValue;
23754
+ return payload;
23755
+ }
23756
+ const result = def.innerType._zod.run(payload, ctx);
23757
+ if (result instanceof Promise) {
23758
+ return result.then((result) => handleDefaultResult(result, def));
23759
+ }
23760
+ return handleDefaultResult(result, def);
23761
+ };
23762
+ });
23763
+ function handleDefaultResult(payload, def) {
23764
+ if (payload.value === undefined) {
23765
+ payload.value = def.defaultValue;
23766
+ }
23767
+ return payload;
23768
+ }
23769
+ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
23770
+ $ZodType.init(inst, def);
23771
+ inst._zod.optin = "optional";
23772
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
23773
+ inst._zod.parse = (payload, ctx) => {
23774
+ if (ctx.direction === "backward") {
23775
+ return def.innerType._zod.run(payload, ctx);
23776
+ }
23777
+ if (payload.value === undefined) {
23778
+ payload.value = def.defaultValue;
23779
+ }
23780
+ return def.innerType._zod.run(payload, ctx);
23781
+ };
23782
+ });
23783
+ var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
23784
+ $ZodType.init(inst, def);
23785
+ defineLazy(inst._zod, "values", () => {
23786
+ const v = def.innerType._zod.values;
23787
+ return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
23788
+ });
23789
+ inst._zod.parse = (payload, ctx) => {
23790
+ const result = def.innerType._zod.run(payload, ctx);
23791
+ if (result instanceof Promise) {
23792
+ return result.then((result) => handleNonOptionalResult(result, inst));
23793
+ }
23794
+ return handleNonOptionalResult(result, inst);
23795
+ };
23796
+ });
23797
+ function handleNonOptionalResult(payload, inst) {
23798
+ if (!payload.issues.length && payload.value === undefined) {
23799
+ payload.issues.push({
23800
+ code: "invalid_type",
23801
+ expected: "nonoptional",
23802
+ input: payload.value,
23803
+ inst
23804
+ });
23805
+ }
23806
+ return payload;
23807
+ }
23808
+ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
23809
+ $ZodType.init(inst, def);
23810
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
23811
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
23812
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
23813
+ inst._zod.parse = (payload, ctx) => {
23814
+ if (ctx.direction === "backward") {
23815
+ return def.innerType._zod.run(payload, ctx);
23816
+ }
23817
+ const result = def.innerType._zod.run(payload, ctx);
23818
+ if (result instanceof Promise) {
23819
+ return result.then((result) => {
23820
+ payload.value = result.value;
23821
+ if (result.issues.length) {
23822
+ payload.value = def.catchValue({
23823
+ ...payload,
23824
+ error: {
23825
+ issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
23826
+ },
23827
+ input: payload.value
23828
+ });
23829
+ payload.issues = [];
23830
+ }
23831
+ return payload;
23832
+ });
23833
+ }
23834
+ payload.value = result.value;
23835
+ if (result.issues.length) {
23836
+ payload.value = def.catchValue({
23837
+ ...payload,
23838
+ error: {
23839
+ issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
23840
+ },
23841
+ input: payload.value
23842
+ });
23843
+ payload.issues = [];
23844
+ }
23845
+ return payload;
23846
+ };
23847
+ });
23848
+ var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
23849
+ $ZodType.init(inst, def);
23850
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
23851
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
23852
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
23853
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
23854
+ inst._zod.parse = (payload, ctx) => {
23855
+ if (ctx.direction === "backward") {
23856
+ const right = def.out._zod.run(payload, ctx);
23857
+ if (right instanceof Promise) {
23858
+ return right.then((right) => handlePipeResult(right, def.in, ctx));
23859
+ }
23860
+ return handlePipeResult(right, def.in, ctx);
23861
+ }
23862
+ const left = def.in._zod.run(payload, ctx);
23863
+ if (left instanceof Promise) {
23864
+ return left.then((left) => handlePipeResult(left, def.out, ctx));
23865
+ }
23866
+ return handlePipeResult(left, def.out, ctx);
23867
+ };
23868
+ });
23869
+ function handlePipeResult(left, next, ctx) {
23870
+ if (left.issues.length) {
23871
+ left.aborted = true;
23872
+ return left;
23873
+ }
23874
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
23875
+ }
23876
+ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
23877
+ $ZodType.init(inst, def);
23878
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
23879
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
23880
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
23881
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
23882
+ inst._zod.parse = (payload, ctx) => {
23883
+ if (ctx.direction === "backward") {
23884
+ return def.innerType._zod.run(payload, ctx);
23885
+ }
23886
+ const result = def.innerType._zod.run(payload, ctx);
23887
+ if (result instanceof Promise) {
23888
+ return result.then(handleReadonlyResult);
23889
+ }
23890
+ return handleReadonlyResult(result);
23891
+ };
23892
+ });
23893
+ function handleReadonlyResult(payload) {
23894
+ payload.value = Object.freeze(payload.value);
23895
+ return payload;
23896
+ }
23897
+ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
23898
+ $ZodCheck.init(inst, def);
23899
+ $ZodType.init(inst, def);
23900
+ inst._zod.parse = (payload, _) => {
23901
+ return payload;
23902
+ };
23903
+ inst._zod.check = (payload) => {
23904
+ const input = payload.value;
23905
+ const r = def.fn(input);
23906
+ if (r instanceof Promise) {
23907
+ return r.then((r) => handleRefineResult(r, payload, input, inst));
23908
+ }
23909
+ handleRefineResult(r, payload, input, inst);
23910
+ return;
23911
+ };
23912
+ });
23913
+ function handleRefineResult(result, payload, input, inst) {
23914
+ if (!result) {
23915
+ const _iss = {
23916
+ code: "custom",
23917
+ input,
23918
+ inst,
23919
+ path: [...inst._zod.def.path ?? []],
23920
+ continue: !inst._zod.def.abort
23921
+ };
23922
+ if (inst._zod.def.params)
23923
+ _iss.params = inst._zod.def.params;
23924
+ payload.issues.push(issue(_iss));
23925
+ }
23926
+ }
23927
+ // node_modules/zod/v4/core/registries.js
23928
+ var _a;
23929
+ var $output = Symbol("ZodOutput");
23930
+ var $input = Symbol("ZodInput");
23931
+
23932
+ class $ZodRegistry {
23933
+ constructor() {
23934
+ this._map = new WeakMap;
23935
+ this._idmap = new Map;
23936
+ }
23937
+ add(schema, ..._meta) {
23938
+ const meta = _meta[0];
23939
+ this._map.set(schema, meta);
23940
+ if (meta && typeof meta === "object" && "id" in meta) {
23941
+ this._idmap.set(meta.id, schema);
23942
+ }
23943
+ return this;
23944
+ }
23945
+ clear() {
23946
+ this._map = new WeakMap;
23947
+ this._idmap = new Map;
23948
+ return this;
23949
+ }
23950
+ remove(schema) {
23951
+ const meta = this._map.get(schema);
23952
+ if (meta && typeof meta === "object" && "id" in meta) {
23953
+ this._idmap.delete(meta.id);
23954
+ }
23955
+ this._map.delete(schema);
23956
+ return this;
23957
+ }
23958
+ get(schema) {
23959
+ const p = schema._zod.parent;
23960
+ if (p) {
23961
+ const pm = { ...this.get(p) ?? {} };
23962
+ delete pm.id;
23963
+ const f = { ...pm, ...this._map.get(schema) };
23964
+ return Object.keys(f).length ? f : undefined;
23965
+ }
23966
+ return this._map.get(schema);
23967
+ }
23968
+ has(schema) {
23969
+ return this._map.has(schema);
23970
+ }
23971
+ }
23972
+ function registry() {
23973
+ return new $ZodRegistry;
23974
+ }
23975
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
23976
+ var globalRegistry = globalThis.__zod_globalRegistry;
23977
+ // node_modules/zod/v4/core/api.js
23978
+ function _string(Class, params) {
23979
+ return new Class({
23980
+ type: "string",
23981
+ ...normalizeParams(params)
23982
+ });
23983
+ }
23984
+ function _email(Class, params) {
23985
+ return new Class({
23986
+ type: "string",
23987
+ format: "email",
23988
+ check: "string_format",
23989
+ abort: false,
23990
+ ...normalizeParams(params)
23991
+ });
23992
+ }
23993
+ function _guid(Class, params) {
23994
+ return new Class({
23995
+ type: "string",
23996
+ format: "guid",
23997
+ check: "string_format",
23998
+ abort: false,
23999
+ ...normalizeParams(params)
24000
+ });
24001
+ }
24002
+ function _uuid(Class, params) {
24003
+ return new Class({
24004
+ type: "string",
24005
+ format: "uuid",
24006
+ check: "string_format",
24007
+ abort: false,
24008
+ ...normalizeParams(params)
24009
+ });
24010
+ }
24011
+ function _uuidv4(Class, params) {
24012
+ return new Class({
24013
+ type: "string",
24014
+ format: "uuid",
24015
+ check: "string_format",
24016
+ abort: false,
24017
+ version: "v4",
24018
+ ...normalizeParams(params)
24019
+ });
24020
+ }
24021
+ function _uuidv6(Class, params) {
24022
+ return new Class({
24023
+ type: "string",
24024
+ format: "uuid",
24025
+ check: "string_format",
24026
+ abort: false,
24027
+ version: "v6",
24028
+ ...normalizeParams(params)
24029
+ });
24030
+ }
24031
+ function _uuidv7(Class, params) {
24032
+ return new Class({
24033
+ type: "string",
24034
+ format: "uuid",
24035
+ check: "string_format",
24036
+ abort: false,
24037
+ version: "v7",
24038
+ ...normalizeParams(params)
24039
+ });
24040
+ }
24041
+ function _url(Class, params) {
24042
+ return new Class({
24043
+ type: "string",
24044
+ format: "url",
24045
+ check: "string_format",
24046
+ abort: false,
24047
+ ...normalizeParams(params)
24048
+ });
24049
+ }
24050
+ function _emoji2(Class, params) {
24051
+ return new Class({
24052
+ type: "string",
24053
+ format: "emoji",
24054
+ check: "string_format",
24055
+ abort: false,
24056
+ ...normalizeParams(params)
24057
+ });
24058
+ }
24059
+ function _nanoid(Class, params) {
24060
+ return new Class({
24061
+ type: "string",
24062
+ format: "nanoid",
24063
+ check: "string_format",
24064
+ abort: false,
24065
+ ...normalizeParams(params)
24066
+ });
24067
+ }
24068
+ function _cuid(Class, params) {
24069
+ return new Class({
24070
+ type: "string",
24071
+ format: "cuid",
24072
+ check: "string_format",
24073
+ abort: false,
24074
+ ...normalizeParams(params)
24075
+ });
24076
+ }
24077
+ function _cuid2(Class, params) {
24078
+ return new Class({
24079
+ type: "string",
24080
+ format: "cuid2",
24081
+ check: "string_format",
24082
+ abort: false,
24083
+ ...normalizeParams(params)
24084
+ });
24085
+ }
24086
+ function _ulid(Class, params) {
24087
+ return new Class({
24088
+ type: "string",
24089
+ format: "ulid",
24090
+ check: "string_format",
24091
+ abort: false,
24092
+ ...normalizeParams(params)
24093
+ });
24094
+ }
24095
+ function _xid(Class, params) {
24096
+ return new Class({
24097
+ type: "string",
24098
+ format: "xid",
24099
+ check: "string_format",
24100
+ abort: false,
24101
+ ...normalizeParams(params)
24102
+ });
24103
+ }
24104
+ function _ksuid(Class, params) {
24105
+ return new Class({
24106
+ type: "string",
24107
+ format: "ksuid",
24108
+ check: "string_format",
24109
+ abort: false,
24110
+ ...normalizeParams(params)
24111
+ });
24112
+ }
24113
+ function _ipv4(Class, params) {
24114
+ return new Class({
24115
+ type: "string",
24116
+ format: "ipv4",
24117
+ check: "string_format",
24118
+ abort: false,
24119
+ ...normalizeParams(params)
24120
+ });
24121
+ }
24122
+ function _ipv6(Class, params) {
24123
+ return new Class({
24124
+ type: "string",
24125
+ format: "ipv6",
24126
+ check: "string_format",
24127
+ abort: false,
24128
+ ...normalizeParams(params)
24129
+ });
24130
+ }
24131
+ function _cidrv4(Class, params) {
24132
+ return new Class({
24133
+ type: "string",
24134
+ format: "cidrv4",
24135
+ check: "string_format",
24136
+ abort: false,
24137
+ ...normalizeParams(params)
24138
+ });
24139
+ }
24140
+ function _cidrv6(Class, params) {
24141
+ return new Class({
24142
+ type: "string",
24143
+ format: "cidrv6",
24144
+ check: "string_format",
24145
+ abort: false,
24146
+ ...normalizeParams(params)
24147
+ });
24148
+ }
24149
+ function _base64(Class, params) {
24150
+ return new Class({
24151
+ type: "string",
24152
+ format: "base64",
24153
+ check: "string_format",
24154
+ abort: false,
24155
+ ...normalizeParams(params)
24156
+ });
24157
+ }
24158
+ function _base64url(Class, params) {
24159
+ return new Class({
24160
+ type: "string",
24161
+ format: "base64url",
24162
+ check: "string_format",
24163
+ abort: false,
24164
+ ...normalizeParams(params)
24165
+ });
24166
+ }
24167
+ function _e164(Class, params) {
24168
+ return new Class({
24169
+ type: "string",
24170
+ format: "e164",
24171
+ check: "string_format",
24172
+ abort: false,
24173
+ ...normalizeParams(params)
24174
+ });
24175
+ }
24176
+ function _jwt(Class, params) {
24177
+ return new Class({
24178
+ type: "string",
24179
+ format: "jwt",
24180
+ check: "string_format",
24181
+ abort: false,
24182
+ ...normalizeParams(params)
24183
+ });
24184
+ }
24185
+ function _isoDateTime(Class, params) {
24186
+ return new Class({
24187
+ type: "string",
24188
+ format: "datetime",
24189
+ check: "string_format",
24190
+ offset: false,
24191
+ local: false,
24192
+ precision: null,
24193
+ ...normalizeParams(params)
24194
+ });
24195
+ }
24196
+ function _isoDate(Class, params) {
24197
+ return new Class({
24198
+ type: "string",
24199
+ format: "date",
24200
+ check: "string_format",
24201
+ ...normalizeParams(params)
24202
+ });
24203
+ }
24204
+ function _isoTime(Class, params) {
24205
+ return new Class({
24206
+ type: "string",
24207
+ format: "time",
24208
+ check: "string_format",
24209
+ precision: null,
24210
+ ...normalizeParams(params)
24211
+ });
24212
+ }
24213
+ function _isoDuration(Class, params) {
24214
+ return new Class({
24215
+ type: "string",
24216
+ format: "duration",
24217
+ check: "string_format",
24218
+ ...normalizeParams(params)
24219
+ });
24220
+ }
24221
+ function _unknown(Class) {
24222
+ return new Class({
24223
+ type: "unknown"
24224
+ });
24225
+ }
24226
+ function _never(Class, params) {
24227
+ return new Class({
24228
+ type: "never",
24229
+ ...normalizeParams(params)
24230
+ });
24231
+ }
24232
+ function _maxLength(maximum, params) {
24233
+ const ch = new $ZodCheckMaxLength({
24234
+ check: "max_length",
24235
+ ...normalizeParams(params),
24236
+ maximum
24237
+ });
24238
+ return ch;
24239
+ }
24240
+ function _minLength(minimum, params) {
24241
+ return new $ZodCheckMinLength({
24242
+ check: "min_length",
24243
+ ...normalizeParams(params),
24244
+ minimum
24245
+ });
24246
+ }
24247
+ function _length(length, params) {
24248
+ return new $ZodCheckLengthEquals({
24249
+ check: "length_equals",
24250
+ ...normalizeParams(params),
24251
+ length
24252
+ });
24253
+ }
24254
+ function _regex(pattern, params) {
24255
+ return new $ZodCheckRegex({
24256
+ check: "string_format",
24257
+ format: "regex",
24258
+ ...normalizeParams(params),
24259
+ pattern
24260
+ });
24261
+ }
24262
+ function _lowercase(params) {
24263
+ return new $ZodCheckLowerCase({
24264
+ check: "string_format",
24265
+ format: "lowercase",
24266
+ ...normalizeParams(params)
24267
+ });
24268
+ }
24269
+ function _uppercase(params) {
24270
+ return new $ZodCheckUpperCase({
24271
+ check: "string_format",
24272
+ format: "uppercase",
24273
+ ...normalizeParams(params)
24274
+ });
24275
+ }
24276
+ function _includes(includes, params) {
24277
+ return new $ZodCheckIncludes({
24278
+ check: "string_format",
24279
+ format: "includes",
24280
+ ...normalizeParams(params),
24281
+ includes
24282
+ });
24283
+ }
24284
+ function _startsWith(prefix, params) {
24285
+ return new $ZodCheckStartsWith({
24286
+ check: "string_format",
24287
+ format: "starts_with",
24288
+ ...normalizeParams(params),
24289
+ prefix
24290
+ });
24291
+ }
24292
+ function _endsWith(suffix, params) {
24293
+ return new $ZodCheckEndsWith({
24294
+ check: "string_format",
24295
+ format: "ends_with",
24296
+ ...normalizeParams(params),
24297
+ suffix
24298
+ });
24299
+ }
24300
+ function _overwrite(tx) {
24301
+ return new $ZodCheckOverwrite({
24302
+ check: "overwrite",
24303
+ tx
24304
+ });
24305
+ }
24306
+ function _normalize(form) {
24307
+ return _overwrite((input) => input.normalize(form));
24308
+ }
24309
+ function _trim() {
24310
+ return _overwrite((input) => input.trim());
24311
+ }
24312
+ function _toLowerCase() {
24313
+ return _overwrite((input) => input.toLowerCase());
24314
+ }
24315
+ function _toUpperCase() {
24316
+ return _overwrite((input) => input.toUpperCase());
24317
+ }
24318
+ function _slugify() {
24319
+ return _overwrite((input) => slugify(input));
24320
+ }
24321
+ function _array(Class, element, params) {
24322
+ return new Class({
24323
+ type: "array",
24324
+ element,
24325
+ ...normalizeParams(params)
24326
+ });
24327
+ }
24328
+ function _refine(Class, fn, _params) {
24329
+ const schema = new Class({
24330
+ type: "custom",
24331
+ check: "custom",
24332
+ fn,
24333
+ ...normalizeParams(_params)
24334
+ });
24335
+ return schema;
24336
+ }
24337
+ function _superRefine(fn) {
24338
+ const ch = _check((payload) => {
24339
+ payload.addIssue = (issue2) => {
24340
+ if (typeof issue2 === "string") {
24341
+ payload.issues.push(issue(issue2, payload.value, ch._zod.def));
24342
+ } else {
24343
+ const _issue = issue2;
24344
+ if (_issue.fatal)
24345
+ _issue.continue = false;
24346
+ _issue.code ?? (_issue.code = "custom");
24347
+ _issue.input ?? (_issue.input = payload.value);
24348
+ _issue.inst ?? (_issue.inst = ch);
24349
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
24350
+ payload.issues.push(issue(_issue));
24351
+ }
24352
+ };
24353
+ return fn(payload.value, payload);
24354
+ });
24355
+ return ch;
24356
+ }
24357
+ function _check(fn, params) {
24358
+ const ch = new $ZodCheck({
24359
+ check: "custom",
24360
+ ...normalizeParams(params)
24361
+ });
24362
+ ch._zod.check = fn;
24363
+ return ch;
24364
+ }
24365
+ // node_modules/zod/v4/core/to-json-schema.js
24366
+ function initializeContext(params) {
24367
+ let target = params?.target ?? "draft-2020-12";
24368
+ if (target === "draft-4")
24369
+ target = "draft-04";
24370
+ if (target === "draft-7")
24371
+ target = "draft-07";
24372
+ return {
24373
+ processors: params.processors ?? {},
24374
+ metadataRegistry: params?.metadata ?? globalRegistry,
24375
+ target,
24376
+ unrepresentable: params?.unrepresentable ?? "throw",
24377
+ override: params?.override ?? (() => {}),
24378
+ io: params?.io ?? "output",
24379
+ counter: 0,
24380
+ seen: new Map,
24381
+ cycles: params?.cycles ?? "ref",
24382
+ reused: params?.reused ?? "inline",
24383
+ external: params?.external ?? undefined
24384
+ };
24385
+ }
24386
+ function process3(schema, ctx, _params = { path: [], schemaPath: [] }) {
24387
+ var _a;
24388
+ const def = schema._zod.def;
24389
+ const seen = ctx.seen.get(schema);
24390
+ if (seen) {
24391
+ seen.count++;
24392
+ const isCycle = _params.schemaPath.includes(schema);
24393
+ if (isCycle) {
24394
+ seen.cycle = _params.path;
24395
+ }
24396
+ return seen.schema;
24397
+ }
24398
+ const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
24399
+ ctx.seen.set(schema, result);
24400
+ const overrideSchema = schema._zod.toJSONSchema?.();
24401
+ if (overrideSchema) {
24402
+ result.schema = overrideSchema;
24403
+ } else {
24404
+ const params = {
24405
+ ..._params,
24406
+ schemaPath: [..._params.schemaPath, schema],
24407
+ path: _params.path
24408
+ };
24409
+ if (schema._zod.processJSONSchema) {
24410
+ schema._zod.processJSONSchema(ctx, result.schema, params);
24411
+ } else {
24412
+ const _json = result.schema;
24413
+ const processor = ctx.processors[def.type];
24414
+ if (!processor) {
24415
+ throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
24416
+ }
24417
+ processor(schema, ctx, _json, params);
24418
+ }
24419
+ const parent = schema._zod.parent;
24420
+ if (parent) {
24421
+ if (!result.ref)
24422
+ result.ref = parent;
24423
+ process3(parent, ctx, params);
24424
+ ctx.seen.get(parent).isParent = true;
24425
+ }
24426
+ }
24427
+ const meta = ctx.metadataRegistry.get(schema);
24428
+ if (meta)
24429
+ Object.assign(result.schema, meta);
24430
+ if (ctx.io === "input" && isTransforming(schema)) {
24431
+ delete result.schema.examples;
24432
+ delete result.schema.default;
24433
+ }
24434
+ if (ctx.io === "input" && result.schema._prefault)
24435
+ (_a = result.schema).default ?? (_a.default = result.schema._prefault);
24436
+ delete result.schema._prefault;
24437
+ const _result = ctx.seen.get(schema);
24438
+ return _result.schema;
24439
+ }
24440
+ function extractDefs(ctx, schema) {
24441
+ const root = ctx.seen.get(schema);
24442
+ if (!root)
24443
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
24444
+ const idToSchema = new Map;
24445
+ for (const entry of ctx.seen.entries()) {
24446
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
24447
+ if (id) {
24448
+ const existing = idToSchema.get(id);
24449
+ if (existing && existing !== entry[0]) {
24450
+ throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
24451
+ }
24452
+ idToSchema.set(id, entry[0]);
24453
+ }
24454
+ }
24455
+ const makeURI = (entry) => {
24456
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
24457
+ if (ctx.external) {
24458
+ const externalId = ctx.external.registry.get(entry[0])?.id;
24459
+ const uriGenerator = ctx.external.uri ?? ((id) => id);
24460
+ if (externalId) {
24461
+ return { ref: uriGenerator(externalId) };
24462
+ }
24463
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
24464
+ entry[1].defId = id;
24465
+ return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
24466
+ }
24467
+ if (entry[1] === root) {
24468
+ return { ref: "#" };
24469
+ }
24470
+ const uriPrefix = `#`;
24471
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
24472
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
24473
+ return { defId, ref: defUriPrefix + defId };
24474
+ };
24475
+ const extractToDef = (entry) => {
24476
+ if (entry[1].schema.$ref) {
24477
+ return;
24478
+ }
24479
+ const seen = entry[1];
24480
+ const { ref, defId } = makeURI(entry);
24481
+ seen.def = { ...seen.schema };
24482
+ if (defId)
24483
+ seen.defId = defId;
24484
+ const schema = seen.schema;
24485
+ for (const key in schema) {
24486
+ delete schema[key];
24487
+ }
24488
+ schema.$ref = ref;
24489
+ };
24490
+ if (ctx.cycles === "throw") {
24491
+ for (const entry of ctx.seen.entries()) {
24492
+ const seen = entry[1];
24493
+ if (seen.cycle) {
24494
+ throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
24495
+ }
24496
+ }
24497
+ }
24498
+ for (const entry of ctx.seen.entries()) {
24499
+ const seen = entry[1];
24500
+ if (schema === entry[0]) {
24501
+ extractToDef(entry);
24502
+ continue;
24503
+ }
24504
+ if (ctx.external) {
24505
+ const ext = ctx.external.registry.get(entry[0])?.id;
24506
+ if (schema !== entry[0] && ext) {
24507
+ extractToDef(entry);
24508
+ continue;
24509
+ }
24510
+ }
24511
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
24512
+ if (id) {
24513
+ extractToDef(entry);
24514
+ continue;
24515
+ }
24516
+ if (seen.cycle) {
24517
+ extractToDef(entry);
24518
+ continue;
24519
+ }
24520
+ if (seen.count > 1) {
24521
+ if (ctx.reused === "ref") {
24522
+ extractToDef(entry);
24523
+ continue;
24524
+ }
24525
+ }
24526
+ }
24527
+ }
24528
+ function finalize(ctx, schema) {
24529
+ const root = ctx.seen.get(schema);
24530
+ if (!root)
24531
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
24532
+ const flattenRef = (zodSchema) => {
24533
+ const seen = ctx.seen.get(zodSchema);
24534
+ if (seen.ref === null)
24535
+ return;
24536
+ const schema = seen.def ?? seen.schema;
24537
+ const _cached = { ...schema };
24538
+ const ref = seen.ref;
24539
+ seen.ref = null;
24540
+ if (ref) {
24541
+ flattenRef(ref);
24542
+ const refSeen = ctx.seen.get(ref);
24543
+ const refSchema = refSeen.schema;
24544
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
24545
+ schema.allOf = schema.allOf ?? [];
24546
+ schema.allOf.push(refSchema);
24547
+ } else {
24548
+ Object.assign(schema, refSchema);
24549
+ }
24550
+ Object.assign(schema, _cached);
24551
+ const isParentRef = zodSchema._zod.parent === ref;
24552
+ if (isParentRef) {
24553
+ for (const key in schema) {
24554
+ if (key === "$ref" || key === "allOf")
24555
+ continue;
24556
+ if (!(key in _cached)) {
24557
+ delete schema[key];
24558
+ }
24559
+ }
24560
+ }
24561
+ if (refSchema.$ref && refSeen.def) {
24562
+ for (const key in schema) {
24563
+ if (key === "$ref" || key === "allOf")
24564
+ continue;
24565
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) {
24566
+ delete schema[key];
24567
+ }
24568
+ }
24569
+ }
24570
+ }
24571
+ const parent = zodSchema._zod.parent;
24572
+ if (parent && parent !== ref) {
24573
+ flattenRef(parent);
24574
+ const parentSeen = ctx.seen.get(parent);
24575
+ if (parentSeen?.schema.$ref) {
24576
+ schema.$ref = parentSeen.schema.$ref;
24577
+ if (parentSeen.def) {
24578
+ for (const key in schema) {
24579
+ if (key === "$ref" || key === "allOf")
24580
+ continue;
24581
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) {
24582
+ delete schema[key];
24583
+ }
24584
+ }
24585
+ }
24586
+ }
24587
+ }
24588
+ ctx.override({
24589
+ zodSchema,
24590
+ jsonSchema: schema,
24591
+ path: seen.path ?? []
24592
+ });
24593
+ };
24594
+ for (const entry of [...ctx.seen.entries()].reverse()) {
24595
+ flattenRef(entry[0]);
24596
+ }
24597
+ const result = {};
24598
+ if (ctx.target === "draft-2020-12") {
24599
+ result.$schema = "https://json-schema.org/draft/2020-12/schema";
24600
+ } else if (ctx.target === "draft-07") {
24601
+ result.$schema = "http://json-schema.org/draft-07/schema#";
24602
+ } else if (ctx.target === "draft-04") {
24603
+ result.$schema = "http://json-schema.org/draft-04/schema#";
24604
+ } else if (ctx.target === "openapi-3.0") {}
24605
+ if (ctx.external?.uri) {
24606
+ const id = ctx.external.registry.get(schema)?.id;
24607
+ if (!id)
24608
+ throw new Error("Schema is missing an `id` property");
24609
+ result.$id = ctx.external.uri(id);
24610
+ }
24611
+ Object.assign(result, root.def ?? root.schema);
24612
+ const defs = ctx.external?.defs ?? {};
24613
+ for (const entry of ctx.seen.entries()) {
24614
+ const seen = entry[1];
24615
+ if (seen.def && seen.defId) {
24616
+ defs[seen.defId] = seen.def;
24617
+ }
24618
+ }
24619
+ if (ctx.external) {} else {
24620
+ if (Object.keys(defs).length > 0) {
24621
+ if (ctx.target === "draft-2020-12") {
24622
+ result.$defs = defs;
24623
+ } else {
24624
+ result.definitions = defs;
24625
+ }
24626
+ }
24627
+ }
24628
+ try {
24629
+ const finalized = JSON.parse(JSON.stringify(result));
24630
+ Object.defineProperty(finalized, "~standard", {
24631
+ value: {
24632
+ ...schema["~standard"],
24633
+ jsonSchema: {
24634
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
24635
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
24636
+ }
24637
+ },
24638
+ enumerable: false,
24639
+ writable: false
24640
+ });
24641
+ return finalized;
24642
+ } catch (_err) {
24643
+ throw new Error("Error converting schema to JSON.");
24644
+ }
24645
+ }
24646
+ function isTransforming(_schema, _ctx) {
24647
+ const ctx = _ctx ?? { seen: new Set };
24648
+ if (ctx.seen.has(_schema))
24649
+ return false;
24650
+ ctx.seen.add(_schema);
24651
+ const def = _schema._zod.def;
24652
+ if (def.type === "transform")
24653
+ return true;
24654
+ if (def.type === "array")
24655
+ return isTransforming(def.element, ctx);
24656
+ if (def.type === "set")
24657
+ return isTransforming(def.valueType, ctx);
24658
+ if (def.type === "lazy")
24659
+ return isTransforming(def.getter(), ctx);
24660
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
24661
+ return isTransforming(def.innerType, ctx);
24662
+ }
24663
+ if (def.type === "intersection") {
24664
+ return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
24665
+ }
24666
+ if (def.type === "record" || def.type === "map") {
24667
+ return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
24668
+ }
24669
+ if (def.type === "pipe") {
24670
+ return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
24671
+ }
24672
+ if (def.type === "object") {
24673
+ for (const key in def.shape) {
24674
+ if (isTransforming(def.shape[key], ctx))
24675
+ return true;
24676
+ }
24677
+ return false;
24678
+ }
24679
+ if (def.type === "union") {
24680
+ for (const option of def.options) {
24681
+ if (isTransforming(option, ctx))
24682
+ return true;
24683
+ }
24684
+ return false;
24685
+ }
24686
+ if (def.type === "tuple") {
24687
+ for (const item of def.items) {
24688
+ if (isTransforming(item, ctx))
24689
+ return true;
24690
+ }
24691
+ if (def.rest && isTransforming(def.rest, ctx))
24692
+ return true;
24693
+ return false;
24694
+ }
24695
+ return false;
24696
+ }
24697
+ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
24698
+ const ctx = initializeContext({ ...params, processors });
24699
+ process3(schema, ctx);
24700
+ extractDefs(ctx, schema);
24701
+ return finalize(ctx, schema);
24702
+ };
24703
+ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
24704
+ const { libraryOptions, target } = params ?? {};
24705
+ const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
24706
+ process3(schema, ctx);
24707
+ extractDefs(ctx, schema);
24708
+ return finalize(ctx, schema);
24709
+ };
24710
+ // node_modules/zod/v4/core/json-schema-processors.js
24711
+ var formatMap = {
24712
+ guid: "uuid",
24713
+ url: "uri",
24714
+ datetime: "date-time",
24715
+ json_string: "json-string",
24716
+ regex: ""
24717
+ };
24718
+ var stringProcessor = (schema, ctx, _json, _params) => {
24719
+ const json = _json;
24720
+ json.type = "string";
24721
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
24722
+ if (typeof minimum === "number")
24723
+ json.minLength = minimum;
24724
+ if (typeof maximum === "number")
24725
+ json.maxLength = maximum;
24726
+ if (format) {
24727
+ json.format = formatMap[format] ?? format;
24728
+ if (json.format === "")
24729
+ delete json.format;
24730
+ if (format === "time") {
24731
+ delete json.format;
24732
+ }
24733
+ }
24734
+ if (contentEncoding)
24735
+ json.contentEncoding = contentEncoding;
24736
+ if (patterns && patterns.size > 0) {
24737
+ const regexes = [...patterns];
24738
+ if (regexes.length === 1)
24739
+ json.pattern = regexes[0].source;
24740
+ else if (regexes.length > 1) {
24741
+ json.allOf = [
24742
+ ...regexes.map((regex) => ({
24743
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
24744
+ pattern: regex.source
24745
+ }))
24746
+ ];
24747
+ }
24748
+ }
24749
+ };
24750
+ var neverProcessor = (_schema, _ctx, json, _params) => {
24751
+ json.not = {};
24752
+ };
24753
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
24754
+ var enumProcessor = (schema, _ctx, json, _params) => {
24755
+ const def = schema._zod.def;
24756
+ const values = getEnumValues(def.entries);
24757
+ if (values.every((v) => typeof v === "number"))
24758
+ json.type = "number";
24759
+ if (values.every((v) => typeof v === "string"))
24760
+ json.type = "string";
24761
+ json.enum = values;
24762
+ };
24763
+ var customProcessor = (_schema, ctx, _json, _params) => {
24764
+ if (ctx.unrepresentable === "throw") {
24765
+ throw new Error("Custom types cannot be represented in JSON Schema");
24766
+ }
24767
+ };
24768
+ var transformProcessor = (_schema, ctx, _json, _params) => {
24769
+ if (ctx.unrepresentable === "throw") {
24770
+ throw new Error("Transforms cannot be represented in JSON Schema");
24771
+ }
24772
+ };
24773
+ var arrayProcessor = (schema, ctx, _json, params) => {
24774
+ const json = _json;
24775
+ const def = schema._zod.def;
24776
+ const { minimum, maximum } = schema._zod.bag;
24777
+ if (typeof minimum === "number")
24778
+ json.minItems = minimum;
24779
+ if (typeof maximum === "number")
24780
+ json.maxItems = maximum;
24781
+ json.type = "array";
24782
+ json.items = process3(def.element, ctx, { ...params, path: [...params.path, "items"] });
24783
+ };
24784
+ var objectProcessor = (schema, ctx, _json, params) => {
24785
+ const json = _json;
24786
+ const def = schema._zod.def;
24787
+ json.type = "object";
24788
+ json.properties = {};
24789
+ const shape = def.shape;
24790
+ for (const key in shape) {
24791
+ json.properties[key] = process3(shape[key], ctx, {
24792
+ ...params,
24793
+ path: [...params.path, "properties", key]
24794
+ });
24795
+ }
24796
+ const allKeys = new Set(Object.keys(shape));
24797
+ const requiredKeys = new Set([...allKeys].filter((key) => {
24798
+ const v = def.shape[key]._zod;
24799
+ if (ctx.io === "input") {
24800
+ return v.optin === undefined;
24801
+ } else {
24802
+ return v.optout === undefined;
24803
+ }
24804
+ }));
24805
+ if (requiredKeys.size > 0) {
24806
+ json.required = Array.from(requiredKeys);
24807
+ }
24808
+ if (def.catchall?._zod.def.type === "never") {
24809
+ json.additionalProperties = false;
24810
+ } else if (!def.catchall) {
24811
+ if (ctx.io === "output")
24812
+ json.additionalProperties = false;
24813
+ } else if (def.catchall) {
24814
+ json.additionalProperties = process3(def.catchall, ctx, {
24815
+ ...params,
24816
+ path: [...params.path, "additionalProperties"]
24817
+ });
24818
+ }
24819
+ };
24820
+ var unionProcessor = (schema, ctx, json, params) => {
24821
+ const def = schema._zod.def;
24822
+ const isExclusive = def.inclusive === false;
24823
+ const options = def.options.map((x, i) => process3(x, ctx, {
24824
+ ...params,
24825
+ path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
24826
+ }));
24827
+ if (isExclusive) {
24828
+ json.oneOf = options;
24829
+ } else {
24830
+ json.anyOf = options;
24831
+ }
24832
+ };
24833
+ var intersectionProcessor = (schema, ctx, json, params) => {
24834
+ const def = schema._zod.def;
24835
+ const a = process3(def.left, ctx, {
24836
+ ...params,
24837
+ path: [...params.path, "allOf", 0]
24838
+ });
24839
+ const b = process3(def.right, ctx, {
24840
+ ...params,
24841
+ path: [...params.path, "allOf", 1]
24842
+ });
24843
+ const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
24844
+ const allOf = [
24845
+ ...isSimpleIntersection(a) ? a.allOf : [a],
24846
+ ...isSimpleIntersection(b) ? b.allOf : [b]
24847
+ ];
24848
+ json.allOf = allOf;
24849
+ };
24850
+ var nullableProcessor = (schema, ctx, json, params) => {
24851
+ const def = schema._zod.def;
24852
+ const inner = process3(def.innerType, ctx, params);
24853
+ const seen = ctx.seen.get(schema);
24854
+ if (ctx.target === "openapi-3.0") {
24855
+ seen.ref = def.innerType;
24856
+ json.nullable = true;
24857
+ } else {
24858
+ json.anyOf = [inner, { type: "null" }];
24859
+ }
24860
+ };
24861
+ var nonoptionalProcessor = (schema, ctx, _json, params) => {
24862
+ const def = schema._zod.def;
24863
+ process3(def.innerType, ctx, params);
24864
+ const seen = ctx.seen.get(schema);
24865
+ seen.ref = def.innerType;
24866
+ };
24867
+ var defaultProcessor = (schema, ctx, json, params) => {
24868
+ const def = schema._zod.def;
24869
+ process3(def.innerType, ctx, params);
24870
+ const seen = ctx.seen.get(schema);
24871
+ seen.ref = def.innerType;
24872
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
24873
+ };
24874
+ var prefaultProcessor = (schema, ctx, json, params) => {
24875
+ const def = schema._zod.def;
24876
+ process3(def.innerType, ctx, params);
24877
+ const seen = ctx.seen.get(schema);
24878
+ seen.ref = def.innerType;
24879
+ if (ctx.io === "input")
24880
+ json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
24881
+ };
24882
+ var catchProcessor = (schema, ctx, json, params) => {
24883
+ const def = schema._zod.def;
24884
+ process3(def.innerType, ctx, params);
24885
+ const seen = ctx.seen.get(schema);
24886
+ seen.ref = def.innerType;
24887
+ let catchValue;
24888
+ try {
24889
+ catchValue = def.catchValue(undefined);
24890
+ } catch {
24891
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
24892
+ }
24893
+ json.default = catchValue;
24894
+ };
24895
+ var pipeProcessor = (schema, ctx, _json, params) => {
24896
+ const def = schema._zod.def;
24897
+ const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
24898
+ process3(innerType, ctx, params);
24899
+ const seen = ctx.seen.get(schema);
24900
+ seen.ref = innerType;
24901
+ };
24902
+ var readonlyProcessor = (schema, ctx, json, params) => {
24903
+ const def = schema._zod.def;
24904
+ process3(def.innerType, ctx, params);
24905
+ const seen = ctx.seen.get(schema);
24906
+ seen.ref = def.innerType;
24907
+ json.readOnly = true;
24908
+ };
24909
+ var optionalProcessor = (schema, ctx, _json, params) => {
24910
+ const def = schema._zod.def;
24911
+ process3(def.innerType, ctx, params);
24912
+ const seen = ctx.seen.get(schema);
24913
+ seen.ref = def.innerType;
24914
+ };
24915
+ // node_modules/zod/v4/classic/iso.js
24916
+ var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
24917
+ $ZodISODateTime.init(inst, def);
24918
+ ZodStringFormat.init(inst, def);
24919
+ });
24920
+ function datetime2(params) {
24921
+ return _isoDateTime(ZodISODateTime, params);
24922
+ }
24923
+ var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
24924
+ $ZodISODate.init(inst, def);
24925
+ ZodStringFormat.init(inst, def);
24926
+ });
24927
+ function date2(params) {
24928
+ return _isoDate(ZodISODate, params);
24929
+ }
24930
+ var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
24931
+ $ZodISOTime.init(inst, def);
24932
+ ZodStringFormat.init(inst, def);
24933
+ });
24934
+ function time2(params) {
24935
+ return _isoTime(ZodISOTime, params);
24936
+ }
24937
+ var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
24938
+ $ZodISODuration.init(inst, def);
24939
+ ZodStringFormat.init(inst, def);
24940
+ });
24941
+ function duration2(params) {
24942
+ return _isoDuration(ZodISODuration, params);
24943
+ }
24944
+
24945
+ // node_modules/zod/v4/classic/errors.js
24946
+ var initializer2 = (inst, issues) => {
24947
+ $ZodError.init(inst, issues);
24948
+ inst.name = "ZodError";
24949
+ Object.defineProperties(inst, {
24950
+ format: {
24951
+ value: (mapper) => formatError(inst, mapper)
24952
+ },
24953
+ flatten: {
24954
+ value: (mapper) => flattenError(inst, mapper)
24955
+ },
24956
+ addIssue: {
24957
+ value: (issue) => {
24958
+ inst.issues.push(issue);
24959
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
24960
+ }
24961
+ },
24962
+ addIssues: {
24963
+ value: (issues) => {
24964
+ inst.issues.push(...issues);
24965
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
24966
+ }
24967
+ },
24968
+ isEmpty: {
24969
+ get() {
24970
+ return inst.issues.length === 0;
24971
+ }
24972
+ }
24973
+ });
24974
+ };
24975
+ var ZodError = $constructor("ZodError", initializer2);
24976
+ var ZodRealError = $constructor("ZodError", initializer2, {
24977
+ Parent: Error
24978
+ });
24979
+
24980
+ // node_modules/zod/v4/classic/parse.js
24981
+ var parse3 = /* @__PURE__ */ _parse(ZodRealError);
24982
+ var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
24983
+ var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
24984
+ var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
24985
+ var encode = /* @__PURE__ */ _encode(ZodRealError);
24986
+ var decode = /* @__PURE__ */ _decode(ZodRealError);
24987
+ var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
24988
+ var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
24989
+ var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
24990
+ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
24991
+ var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
24992
+ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
24993
+
24994
+ // node_modules/zod/v4/classic/schemas.js
24995
+ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
24996
+ $ZodType.init(inst, def);
24997
+ Object.assign(inst["~standard"], {
24998
+ jsonSchema: {
24999
+ input: createStandardJSONSchemaMethod(inst, "input"),
25000
+ output: createStandardJSONSchemaMethod(inst, "output")
25001
+ }
25002
+ });
25003
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
25004
+ inst.def = def;
25005
+ inst.type = def.type;
25006
+ Object.defineProperty(inst, "_def", { value: def });
25007
+ inst.check = (...checks) => {
25008
+ return inst.clone(mergeDefs(def, {
25009
+ checks: [
25010
+ ...def.checks ?? [],
25011
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
25012
+ ]
25013
+ }), {
25014
+ parent: true
25015
+ });
25016
+ };
25017
+ inst.with = inst.check;
25018
+ inst.clone = (def, params) => clone(inst, def, params);
25019
+ inst.brand = () => inst;
25020
+ inst.register = (reg, meta) => {
25021
+ reg.add(inst, meta);
25022
+ return inst;
25023
+ };
25024
+ inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
25025
+ inst.safeParse = (data, params) => safeParse2(inst, data, params);
25026
+ inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
25027
+ inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
25028
+ inst.spa = inst.safeParseAsync;
25029
+ inst.encode = (data, params) => encode(inst, data, params);
25030
+ inst.decode = (data, params) => decode(inst, data, params);
25031
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
25032
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
25033
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
25034
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
25035
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
25036
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
25037
+ inst.refine = (check, params) => inst.check(refine(check, params));
25038
+ inst.superRefine = (refinement) => inst.check(superRefine(refinement));
25039
+ inst.overwrite = (fn) => inst.check(_overwrite(fn));
25040
+ inst.optional = () => optional(inst);
25041
+ inst.exactOptional = () => exactOptional(inst);
25042
+ inst.nullable = () => nullable(inst);
25043
+ inst.nullish = () => optional(nullable(inst));
25044
+ inst.nonoptional = (params) => nonoptional(inst, params);
25045
+ inst.array = () => array(inst);
25046
+ inst.or = (arg) => union([inst, arg]);
25047
+ inst.and = (arg) => intersection(inst, arg);
25048
+ inst.transform = (tx) => pipe(inst, transform(tx));
25049
+ inst.default = (def) => _default(inst, def);
25050
+ inst.prefault = (def) => prefault(inst, def);
25051
+ inst.catch = (params) => _catch(inst, params);
25052
+ inst.pipe = (target) => pipe(inst, target);
25053
+ inst.readonly = () => readonly(inst);
25054
+ inst.describe = (description) => {
25055
+ const cl = inst.clone();
25056
+ globalRegistry.add(cl, { description });
25057
+ return cl;
25058
+ };
25059
+ Object.defineProperty(inst, "description", {
25060
+ get() {
25061
+ return globalRegistry.get(inst)?.description;
25062
+ },
25063
+ configurable: true
25064
+ });
25065
+ inst.meta = (...args) => {
25066
+ if (args.length === 0) {
25067
+ return globalRegistry.get(inst);
25068
+ }
25069
+ const cl = inst.clone();
25070
+ globalRegistry.add(cl, args[0]);
25071
+ return cl;
25072
+ };
25073
+ inst.isOptional = () => inst.safeParse(undefined).success;
25074
+ inst.isNullable = () => inst.safeParse(null).success;
25075
+ inst.apply = (fn) => fn(inst);
25076
+ return inst;
25077
+ });
25078
+ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
25079
+ $ZodString.init(inst, def);
25080
+ ZodType.init(inst, def);
25081
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
25082
+ const bag = inst._zod.bag;
25083
+ inst.format = bag.format ?? null;
25084
+ inst.minLength = bag.minimum ?? null;
25085
+ inst.maxLength = bag.maximum ?? null;
25086
+ inst.regex = (...args) => inst.check(_regex(...args));
25087
+ inst.includes = (...args) => inst.check(_includes(...args));
25088
+ inst.startsWith = (...args) => inst.check(_startsWith(...args));
25089
+ inst.endsWith = (...args) => inst.check(_endsWith(...args));
25090
+ inst.min = (...args) => inst.check(_minLength(...args));
25091
+ inst.max = (...args) => inst.check(_maxLength(...args));
25092
+ inst.length = (...args) => inst.check(_length(...args));
25093
+ inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
25094
+ inst.lowercase = (params) => inst.check(_lowercase(params));
25095
+ inst.uppercase = (params) => inst.check(_uppercase(params));
25096
+ inst.trim = () => inst.check(_trim());
25097
+ inst.normalize = (...args) => inst.check(_normalize(...args));
25098
+ inst.toLowerCase = () => inst.check(_toLowerCase());
25099
+ inst.toUpperCase = () => inst.check(_toUpperCase());
25100
+ inst.slugify = () => inst.check(_slugify());
25101
+ });
25102
+ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
25103
+ $ZodString.init(inst, def);
25104
+ _ZodString.init(inst, def);
25105
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
25106
+ inst.url = (params) => inst.check(_url(ZodURL, params));
25107
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
25108
+ inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));
25109
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
25110
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
25111
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
25112
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
25113
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
25114
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
25115
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
25116
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
25117
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
25118
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
25119
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
25120
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
25121
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
25122
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
25123
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
25124
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
25125
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
25126
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
25127
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
25128
+ inst.datetime = (params) => inst.check(datetime2(params));
25129
+ inst.date = (params) => inst.check(date2(params));
25130
+ inst.time = (params) => inst.check(time2(params));
25131
+ inst.duration = (params) => inst.check(duration2(params));
25132
+ });
25133
+ function string2(params) {
25134
+ return _string(ZodString, params);
25135
+ }
25136
+ var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
25137
+ $ZodStringFormat.init(inst, def);
25138
+ _ZodString.init(inst, def);
25139
+ });
25140
+ var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
25141
+ $ZodEmail.init(inst, def);
25142
+ ZodStringFormat.init(inst, def);
25143
+ });
25144
+ var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
25145
+ $ZodGUID.init(inst, def);
25146
+ ZodStringFormat.init(inst, def);
25147
+ });
25148
+ var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
25149
+ $ZodUUID.init(inst, def);
25150
+ ZodStringFormat.init(inst, def);
25151
+ });
25152
+ var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
25153
+ $ZodURL.init(inst, def);
25154
+ ZodStringFormat.init(inst, def);
25155
+ });
25156
+ var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
25157
+ $ZodEmoji.init(inst, def);
25158
+ ZodStringFormat.init(inst, def);
25159
+ });
25160
+ var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
25161
+ $ZodNanoID.init(inst, def);
25162
+ ZodStringFormat.init(inst, def);
25163
+ });
25164
+ var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
25165
+ $ZodCUID.init(inst, def);
25166
+ ZodStringFormat.init(inst, def);
25167
+ });
25168
+ var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
25169
+ $ZodCUID2.init(inst, def);
25170
+ ZodStringFormat.init(inst, def);
25171
+ });
25172
+ var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
25173
+ $ZodULID.init(inst, def);
25174
+ ZodStringFormat.init(inst, def);
25175
+ });
25176
+ var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
25177
+ $ZodXID.init(inst, def);
25178
+ ZodStringFormat.init(inst, def);
25179
+ });
25180
+ var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
25181
+ $ZodKSUID.init(inst, def);
25182
+ ZodStringFormat.init(inst, def);
25183
+ });
25184
+ var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
25185
+ $ZodIPv4.init(inst, def);
25186
+ ZodStringFormat.init(inst, def);
25187
+ });
25188
+ var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
25189
+ $ZodIPv6.init(inst, def);
25190
+ ZodStringFormat.init(inst, def);
25191
+ });
25192
+ var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
25193
+ $ZodCIDRv4.init(inst, def);
25194
+ ZodStringFormat.init(inst, def);
25195
+ });
25196
+ var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
25197
+ $ZodCIDRv6.init(inst, def);
25198
+ ZodStringFormat.init(inst, def);
25199
+ });
25200
+ var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
25201
+ $ZodBase64.init(inst, def);
25202
+ ZodStringFormat.init(inst, def);
25203
+ });
25204
+ var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
25205
+ $ZodBase64URL.init(inst, def);
25206
+ ZodStringFormat.init(inst, def);
25207
+ });
25208
+ var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
25209
+ $ZodE164.init(inst, def);
25210
+ ZodStringFormat.init(inst, def);
25211
+ });
25212
+ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
25213
+ $ZodJWT.init(inst, def);
25214
+ ZodStringFormat.init(inst, def);
25215
+ });
25216
+ var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
25217
+ $ZodUnknown.init(inst, def);
25218
+ ZodType.init(inst, def);
25219
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
25220
+ });
25221
+ function unknown() {
25222
+ return _unknown(ZodUnknown);
25223
+ }
25224
+ var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
25225
+ $ZodNever.init(inst, def);
25226
+ ZodType.init(inst, def);
25227
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
25228
+ });
25229
+ function never(params) {
25230
+ return _never(ZodNever, params);
25231
+ }
25232
+ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
25233
+ $ZodArray.init(inst, def);
25234
+ ZodType.init(inst, def);
25235
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
25236
+ inst.element = def.element;
25237
+ inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
25238
+ inst.nonempty = (params) => inst.check(_minLength(1, params));
25239
+ inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
25240
+ inst.length = (len, params) => inst.check(_length(len, params));
25241
+ inst.unwrap = () => inst.element;
25242
+ });
25243
+ function array(element, params) {
25244
+ return _array(ZodArray, element, params);
25245
+ }
25246
+ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
25247
+ $ZodObjectJIT.init(inst, def);
25248
+ ZodType.init(inst, def);
25249
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
25250
+ defineLazy(inst, "shape", () => {
25251
+ return def.shape;
25252
+ });
25253
+ inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
25254
+ inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
25255
+ inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
25256
+ inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
25257
+ inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
25258
+ inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
25259
+ inst.extend = (incoming) => {
25260
+ return extend(inst, incoming);
25261
+ };
25262
+ inst.safeExtend = (incoming) => {
25263
+ return safeExtend(inst, incoming);
25264
+ };
25265
+ inst.merge = (other) => merge(inst, other);
25266
+ inst.pick = (mask) => pick(inst, mask);
25267
+ inst.omit = (mask) => omit(inst, mask);
25268
+ inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
25269
+ inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
25270
+ });
25271
+ function object(shape, params) {
25272
+ const def = {
25273
+ type: "object",
25274
+ shape: shape ?? {},
25275
+ ...normalizeParams(params)
25276
+ };
25277
+ return new ZodObject(def);
25278
+ }
25279
+ var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
25280
+ $ZodUnion.init(inst, def);
25281
+ ZodType.init(inst, def);
25282
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
25283
+ inst.options = def.options;
25284
+ });
25285
+ function union(options, params) {
25286
+ return new ZodUnion({
25287
+ type: "union",
25288
+ options,
25289
+ ...normalizeParams(params)
25290
+ });
25291
+ }
25292
+ var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
25293
+ $ZodIntersection.init(inst, def);
25294
+ ZodType.init(inst, def);
25295
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
25296
+ });
25297
+ function intersection(left, right) {
25298
+ return new ZodIntersection({
25299
+ type: "intersection",
25300
+ left,
25301
+ right
25302
+ });
25303
+ }
25304
+ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
25305
+ $ZodEnum.init(inst, def);
25306
+ ZodType.init(inst, def);
25307
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
25308
+ inst.enum = def.entries;
25309
+ inst.options = Object.values(def.entries);
25310
+ const keys = new Set(Object.keys(def.entries));
25311
+ inst.extract = (values, params) => {
25312
+ const newEntries = {};
25313
+ for (const value of values) {
25314
+ if (keys.has(value)) {
25315
+ newEntries[value] = def.entries[value];
25316
+ } else
25317
+ throw new Error(`Key ${value} not found in enum`);
25318
+ }
25319
+ return new ZodEnum({
25320
+ ...def,
25321
+ checks: [],
25322
+ ...normalizeParams(params),
25323
+ entries: newEntries
25324
+ });
25325
+ };
25326
+ inst.exclude = (values, params) => {
25327
+ const newEntries = { ...def.entries };
25328
+ for (const value of values) {
25329
+ if (keys.has(value)) {
25330
+ delete newEntries[value];
25331
+ } else
25332
+ throw new Error(`Key ${value} not found in enum`);
25333
+ }
25334
+ return new ZodEnum({
25335
+ ...def,
25336
+ checks: [],
25337
+ ...normalizeParams(params),
25338
+ entries: newEntries
25339
+ });
25340
+ };
25341
+ });
25342
+ function _enum(values, params) {
25343
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
25344
+ return new ZodEnum({
25345
+ type: "enum",
25346
+ entries,
25347
+ ...normalizeParams(params)
25348
+ });
25349
+ }
25350
+ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
25351
+ $ZodTransform.init(inst, def);
25352
+ ZodType.init(inst, def);
25353
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
25354
+ inst._zod.parse = (payload, _ctx) => {
25355
+ if (_ctx.direction === "backward") {
25356
+ throw new $ZodEncodeError(inst.constructor.name);
25357
+ }
25358
+ payload.addIssue = (issue2) => {
25359
+ if (typeof issue2 === "string") {
25360
+ payload.issues.push(issue(issue2, payload.value, def));
25361
+ } else {
25362
+ const _issue = issue2;
25363
+ if (_issue.fatal)
25364
+ _issue.continue = false;
25365
+ _issue.code ?? (_issue.code = "custom");
25366
+ _issue.input ?? (_issue.input = payload.value);
25367
+ _issue.inst ?? (_issue.inst = inst);
25368
+ payload.issues.push(issue(_issue));
25369
+ }
25370
+ };
25371
+ const output = def.transform(payload.value, payload);
25372
+ if (output instanceof Promise) {
25373
+ return output.then((output) => {
25374
+ payload.value = output;
25375
+ return payload;
25376
+ });
25377
+ }
25378
+ payload.value = output;
25379
+ return payload;
25380
+ };
25381
+ });
25382
+ function transform(fn) {
25383
+ return new ZodTransform({
25384
+ type: "transform",
25385
+ transform: fn
25386
+ });
25387
+ }
25388
+ var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
25389
+ $ZodOptional.init(inst, def);
25390
+ ZodType.init(inst, def);
25391
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
25392
+ inst.unwrap = () => inst._zod.def.innerType;
25393
+ });
25394
+ function optional(innerType) {
25395
+ return new ZodOptional({
25396
+ type: "optional",
25397
+ innerType
25398
+ });
25399
+ }
25400
+ var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
25401
+ $ZodExactOptional.init(inst, def);
25402
+ ZodType.init(inst, def);
25403
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
25404
+ inst.unwrap = () => inst._zod.def.innerType;
25405
+ });
25406
+ function exactOptional(innerType) {
25407
+ return new ZodExactOptional({
25408
+ type: "optional",
25409
+ innerType
25410
+ });
25411
+ }
25412
+ var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
25413
+ $ZodNullable.init(inst, def);
25414
+ ZodType.init(inst, def);
25415
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
25416
+ inst.unwrap = () => inst._zod.def.innerType;
25417
+ });
25418
+ function nullable(innerType) {
25419
+ return new ZodNullable({
25420
+ type: "nullable",
25421
+ innerType
25422
+ });
25423
+ }
25424
+ var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
25425
+ $ZodDefault.init(inst, def);
25426
+ ZodType.init(inst, def);
25427
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
25428
+ inst.unwrap = () => inst._zod.def.innerType;
25429
+ inst.removeDefault = inst.unwrap;
25430
+ });
25431
+ function _default(innerType, defaultValue) {
25432
+ return new ZodDefault({
25433
+ type: "default",
25434
+ innerType,
25435
+ get defaultValue() {
25436
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
25437
+ }
25438
+ });
25439
+ }
25440
+ var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
25441
+ $ZodPrefault.init(inst, def);
25442
+ ZodType.init(inst, def);
25443
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
25444
+ inst.unwrap = () => inst._zod.def.innerType;
25445
+ });
25446
+ function prefault(innerType, defaultValue) {
25447
+ return new ZodPrefault({
25448
+ type: "prefault",
25449
+ innerType,
25450
+ get defaultValue() {
25451
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
25452
+ }
25453
+ });
25454
+ }
25455
+ var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
25456
+ $ZodNonOptional.init(inst, def);
25457
+ ZodType.init(inst, def);
25458
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
25459
+ inst.unwrap = () => inst._zod.def.innerType;
25460
+ });
25461
+ function nonoptional(innerType, params) {
25462
+ return new ZodNonOptional({
25463
+ type: "nonoptional",
25464
+ innerType,
25465
+ ...normalizeParams(params)
25466
+ });
25467
+ }
25468
+ var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
25469
+ $ZodCatch.init(inst, def);
25470
+ ZodType.init(inst, def);
25471
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
25472
+ inst.unwrap = () => inst._zod.def.innerType;
25473
+ inst.removeCatch = inst.unwrap;
25474
+ });
25475
+ function _catch(innerType, catchValue) {
25476
+ return new ZodCatch({
25477
+ type: "catch",
25478
+ innerType,
25479
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
25480
+ });
25481
+ }
25482
+ var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
25483
+ $ZodPipe.init(inst, def);
25484
+ ZodType.init(inst, def);
25485
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
25486
+ inst.in = def.in;
25487
+ inst.out = def.out;
25488
+ });
25489
+ function pipe(in_, out) {
25490
+ return new ZodPipe({
25491
+ type: "pipe",
25492
+ in: in_,
25493
+ out
25494
+ });
25495
+ }
25496
+ var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
25497
+ $ZodReadonly.init(inst, def);
25498
+ ZodType.init(inst, def);
25499
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
25500
+ inst.unwrap = () => inst._zod.def.innerType;
25501
+ });
25502
+ function readonly(innerType) {
25503
+ return new ZodReadonly({
25504
+ type: "readonly",
25505
+ innerType
25506
+ });
25507
+ }
25508
+ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
25509
+ $ZodCustom.init(inst, def);
25510
+ ZodType.init(inst, def);
25511
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
25512
+ });
25513
+ function refine(fn, _params = {}) {
25514
+ return _refine(ZodCustom, fn, _params);
25515
+ }
25516
+ function superRefine(fn) {
25517
+ return _superRefine(fn);
25518
+ }
25519
+ // src/commands/wiki.ts
21880
25520
  init_errors();
21881
25521
 
21882
25522
  // src/lib/collections.ts
@@ -22031,22 +25671,20 @@ ${pages.length} pages`));
22031
25671
  const slug = encodeURIComponent(opts.wiki ?? DEFAULT_WIKI_SLUG);
22032
25672
  const endpoint = `/api/wiki/${slug}/pages/${safe}`;
22033
25673
  const resp = await ctx.api.getRaw(endpoint, {
22034
- headers: { Accept: "text/markdown,*/*" }
25674
+ headers: { Accept: "application/json" }
22035
25675
  });
22036
- if (resp.status === 404) {
22037
- throw new CLIError(`page not found: ${path}`, 3 /* NotFound */);
25676
+ const page = object({ body: string2() }).safeParse(await resp.json());
25677
+ if (!page.success) {
25678
+ throw new CLIError("Invalid wiki page response: missing markdown body", 1 /* Error */);
22038
25679
  }
22039
- if (!resp.ok) {
22040
- const detail = await resp.text();
22041
- throw new CLIError(`${resp.status}: ${detail.slice(0, 200)}`, 1 /* Error */);
22042
- }
22043
- const body = await resp.text();
25680
+ const body = page.data.body;
25681
+ const bytes = Buffer.byteLength(body, "utf8");
22044
25682
  if (opts.out) {
22045
25683
  fs11.writeFileSync(opts.out, body);
22046
25684
  if (!isJson()) {
22047
- console.log(source_default.dim(`wrote ${body.length} bytes to ${opts.out}`));
25685
+ console.log(source_default.dim(`wrote ${bytes} bytes to ${opts.out}`));
22048
25686
  } else {
22049
- console.log(JSON.stringify({ path, bytes: body.length, file: opts.out }));
25687
+ console.log(JSON.stringify({ path, bytes, file: opts.out }));
22050
25688
  }
22051
25689
  return;
22052
25690
  }
@@ -23933,7 +27571,7 @@ function authHeaders(ctx, token) {
23933
27571
  const tenant = ctx.tenantFor(token);
23934
27572
  return {
23935
27573
  Authorization: `Bearer ${token}`,
23936
- ...tenant ? { "X-Martha-Tenant": tenant } : {}
27574
+ ...tenant ? { "X-Tenant-Id": tenant } : {}
23937
27575
  };
23938
27576
  }
23939
27577
  function apiUrl(ctx, path) {
@@ -24396,7 +28034,7 @@ function registerUpdateCommand(program) {
24396
28034
 
24397
28035
  // src/index.ts
24398
28036
  var program2 = new Command2;
24399
- program2.name("martha").description("Terminal-first client for the Martha AI platform").version(CLI_VERSION).option("--profile <name>", "Use a named profile").option("--json", "Machine-readable JSON output").option("--quiet", "Suppress non-essential output").option("--verbose", "Verbose logging").option("--no-color", "Disable color output").option("--api-url <url>", "Override API base URL").option("--org <tenant>", "Organization to act in (X-Martha-Tenant); needed when your token authorizes several");
28037
+ program2.name("martha").description("Terminal-first client for the Martha AI platform").version(CLI_VERSION).option("--profile <name>", "Use a named profile").option("--json", "Machine-readable JSON output").option("--quiet", "Suppress non-essential output").option("--verbose", "Verbose logging").option("--no-color", "Disable color output").option("--api-url <url>", "Override API base URL").option("--org <tenant>", "Organization to act in (X-Tenant-Id); needed when your token authorizes several");
24400
28038
  registerOrgSelection(program2);
24401
28039
  program2.command("status").description("Check connection and auth status").action(async () => {
24402
28040
  const ctx = createContext({