@khorsheed/dsh-file-preview 0.4.0 → 0.4.1
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.
- package/CHANGELOG.md +5 -0
- package/lib/client.js +2390 -1227
- package/lib/index.js +6 -6
- package/lib/types/open-external.js +1 -1
- package/lib/types/reveal.js +5 -5
- package/package.json +14 -14
package/lib/client.js
CHANGED
|
@@ -7,7 +7,7 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
-
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-util-workspace-path@0.
|
|
10
|
+
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-util-workspace-path@0.2.0-rc.2_@deepseek-ai+cordis@4.0.4/node_modules/@deepseek-ai/dsh-util-workspace-path/lib/index.js
|
|
11
11
|
/**
|
|
12
12
|
* The `dsh-resource://file/…` address grammar: how a file is named across the
|
|
13
13
|
* Sidebar and the resource model, built and parsed without touching a
|
|
@@ -123,82 +123,34 @@ window.__ModuleLoader__.load({
|
|
|
123
123
|
return sessionFileAddress(sessionId, normalized);
|
|
124
124
|
}
|
|
125
125
|
//#endregion
|
|
126
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
127
|
-
var _a$1;
|
|
128
|
-
function $constructor(name, initializer, params) {
|
|
129
|
-
function init(inst, def) {
|
|
130
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
131
|
-
value: {
|
|
132
|
-
def,
|
|
133
|
-
constr: _,
|
|
134
|
-
traits: /* @__PURE__ */ new Set()
|
|
135
|
-
},
|
|
136
|
-
enumerable: false
|
|
137
|
-
});
|
|
138
|
-
if (inst._zod.traits.has(name)) return;
|
|
139
|
-
inst._zod.traits.add(name);
|
|
140
|
-
initializer(inst, def);
|
|
141
|
-
const proto = _.prototype;
|
|
142
|
-
const keys = Object.keys(proto);
|
|
143
|
-
for (let i = 0; i < keys.length; i++) {
|
|
144
|
-
const k = keys[i];
|
|
145
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const Parent = params?.Parent ?? Object;
|
|
149
|
-
class Definition extends Parent {}
|
|
150
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
151
|
-
function _(def) {
|
|
152
|
-
var _a;
|
|
153
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
154
|
-
init(inst, def);
|
|
155
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
156
|
-
for (const fn of inst._zod.deferred) fn();
|
|
157
|
-
return inst;
|
|
158
|
-
}
|
|
159
|
-
Object.defineProperty(_, "init", { value: init });
|
|
160
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
161
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
162
|
-
return inst?._zod?.traits?.has(name);
|
|
163
|
-
} });
|
|
164
|
-
Object.defineProperty(_, "name", { value: name });
|
|
165
|
-
return _;
|
|
166
|
-
}
|
|
167
|
-
var $ZodAsyncError = class extends Error {
|
|
168
|
-
constructor() {
|
|
169
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
var $ZodEncodeError = class extends Error {
|
|
173
|
-
constructor(name) {
|
|
174
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
175
|
-
this.name = "ZodEncodeError";
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
179
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
180
|
-
function config(newConfig) {
|
|
181
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
182
|
-
return globalConfig;
|
|
183
|
-
}
|
|
184
|
-
//#endregion
|
|
185
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
126
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
|
|
186
127
|
function getEnumValues(entries) {
|
|
187
128
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
188
129
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
189
130
|
}
|
|
131
|
+
function joinValues(array, separator = "|") {
|
|
132
|
+
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
133
|
+
}
|
|
190
134
|
function jsonStringifyReplacer(_, value) {
|
|
191
135
|
if (typeof value === "bigint") return value.toString();
|
|
192
136
|
return value;
|
|
193
137
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
138
|
+
var Cached = class {
|
|
139
|
+
constructor(getter) {
|
|
140
|
+
this._getter = getter;
|
|
141
|
+
this._value = void 0;
|
|
142
|
+
}
|
|
143
|
+
get value() {
|
|
144
|
+
const getter = this._getter;
|
|
145
|
+
if (getter !== void 0) {
|
|
146
|
+
this._value = getter();
|
|
147
|
+
this._getter = void 0;
|
|
200
148
|
}
|
|
201
|
-
|
|
149
|
+
return this._value;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
function cached(getter) {
|
|
153
|
+
return new Cached(getter);
|
|
202
154
|
}
|
|
203
155
|
function nullish(input) {
|
|
204
156
|
return input === null || input === void 0;
|
|
@@ -211,28 +163,10 @@ window.__ModuleLoader__.load({
|
|
|
211
163
|
function floatSafeRemainder(val, step) {
|
|
212
164
|
const ratio = val / step;
|
|
213
165
|
const roundedRatio = Math.round(ratio);
|
|
214
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
166
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
215
167
|
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
216
168
|
return ratio - roundedRatio;
|
|
217
169
|
}
|
|
218
|
-
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
219
|
-
function defineLazy(object, key, getter) {
|
|
220
|
-
let value = void 0;
|
|
221
|
-
Object.defineProperty(object, key, {
|
|
222
|
-
get() {
|
|
223
|
-
if (value === EVALUATING) return;
|
|
224
|
-
if (value === void 0) {
|
|
225
|
-
value = EVALUATING;
|
|
226
|
-
value = getter();
|
|
227
|
-
}
|
|
228
|
-
return value;
|
|
229
|
-
},
|
|
230
|
-
set(v) {
|
|
231
|
-
Object.defineProperty(object, key, { value: v });
|
|
232
|
-
},
|
|
233
|
-
configurable: true
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
170
|
function assignProp(target, prop, value) {
|
|
237
171
|
Object.defineProperty(target, prop, {
|
|
238
172
|
value,
|
|
@@ -241,6 +175,58 @@ window.__ModuleLoader__.load({
|
|
|
241
175
|
configurable: true
|
|
242
176
|
});
|
|
243
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
|
|
180
|
+
*
|
|
181
|
+
* Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
|
|
182
|
+
*/
|
|
183
|
+
function rawShape(def) {
|
|
184
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
185
|
+
return desc?.get ? desc.get.raw : desc?.value;
|
|
186
|
+
}
|
|
187
|
+
function sourceShape(schema) {
|
|
188
|
+
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
189
|
+
}
|
|
190
|
+
function deferProp(target, key, getter) {
|
|
191
|
+
Object.defineProperty(target, key, {
|
|
192
|
+
get() {
|
|
193
|
+
const value = getter();
|
|
194
|
+
assignProp(this, key, value);
|
|
195
|
+
return value;
|
|
196
|
+
},
|
|
197
|
+
enumerable: true,
|
|
198
|
+
configurable: true
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function putProp(target, key, value) {
|
|
202
|
+
if (key in target) assignProp(target, key, value);
|
|
203
|
+
else target[key] = value;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
|
|
207
|
+
*
|
|
208
|
+
* A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
|
|
209
|
+
*/
|
|
210
|
+
function mirrorShape(target, source, keys, wrap) {
|
|
211
|
+
const raw = sourceShape(source);
|
|
212
|
+
for (const key of keys) {
|
|
213
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
214
|
+
if (!desc.enumerable) continue;
|
|
215
|
+
if (desc.get) deferProp(target, key, () => {
|
|
216
|
+
const value = source._zod.def.shape[key];
|
|
217
|
+
return wrap ? wrap(value, key) : value;
|
|
218
|
+
});
|
|
219
|
+
else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function mirrorProps(target, source) {
|
|
223
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
224
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
225
|
+
if (!desc.enumerable) continue;
|
|
226
|
+
if (desc.get) deferProp(target, key, () => source[key]);
|
|
227
|
+
else putProp(target, key, desc.value);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
244
230
|
function mergeDefs(...defs) {
|
|
245
231
|
const mergedDescriptors = {};
|
|
246
232
|
for (const def of defs) {
|
|
@@ -314,51 +300,56 @@ window.__ModuleLoader__.load({
|
|
|
314
300
|
};
|
|
315
301
|
return params;
|
|
316
302
|
}
|
|
303
|
+
function stringifyPrimitive(value) {
|
|
304
|
+
if (typeof value === "bigint") return value.toString() + "n";
|
|
305
|
+
if (typeof value === "string") return `"${value}"`;
|
|
306
|
+
return `${value}`;
|
|
307
|
+
}
|
|
317
308
|
function optionalKeys(shape) {
|
|
318
309
|
return Object.keys(shape).filter((k) => {
|
|
319
|
-
return shape[k]._zod.optin
|
|
310
|
+
return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
|
|
320
311
|
});
|
|
321
312
|
}
|
|
322
|
-
const NUMBER_FORMAT_RANGES = {
|
|
313
|
+
const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
323
314
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
324
315
|
int32: [-2147483648, 2147483647],
|
|
325
316
|
uint32: [0, 4294967295],
|
|
326
317
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
327
318
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
319
|
+
}))();
|
|
320
|
+
const BIGINT_FORMAT_RANGES = {
|
|
321
|
+
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
|
322
|
+
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
|
|
328
323
|
};
|
|
329
324
|
function pick(schema, mask) {
|
|
330
325
|
const currDef = schema._zod.def;
|
|
331
326
|
const checks = currDef.checks;
|
|
332
327
|
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
338
|
-
if (!mask[key]) continue;
|
|
339
|
-
newShape[key] = currDef.shape[key];
|
|
340
|
-
}
|
|
341
|
-
assignProp(this, "shape", newShape);
|
|
342
|
-
return newShape;
|
|
343
|
-
},
|
|
328
|
+
const newShape = {};
|
|
329
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask));
|
|
330
|
+
return clone(schema, mergeDefs(currDef, {
|
|
331
|
+
shape: newShape,
|
|
344
332
|
checks: []
|
|
345
333
|
}));
|
|
346
334
|
}
|
|
335
|
+
function maskedKeys(schema, mask) {
|
|
336
|
+
const raw = sourceShape(schema);
|
|
337
|
+
const keys = [];
|
|
338
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
339
|
+
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
340
|
+
if (mask[key]) keys.push(key);
|
|
341
|
+
}
|
|
342
|
+
return keys;
|
|
343
|
+
}
|
|
347
344
|
function omit(schema, mask) {
|
|
348
345
|
const currDef = schema._zod.def;
|
|
349
346
|
const checks = currDef.checks;
|
|
350
347
|
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
if (!mask[key]) continue;
|
|
357
|
-
delete newShape[key];
|
|
358
|
-
}
|
|
359
|
-
assignProp(this, "shape", newShape);
|
|
360
|
-
return newShape;
|
|
361
|
-
},
|
|
348
|
+
const omitted = new Set(maskedKeys(schema, mask));
|
|
349
|
+
const newShape = {};
|
|
350
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
|
|
351
|
+
return clone(schema, mergeDefs(currDef, {
|
|
352
|
+
shape: newShape,
|
|
362
353
|
checks: []
|
|
363
354
|
}));
|
|
364
355
|
}
|
|
@@ -366,90 +357,57 @@ window.__ModuleLoader__.load({
|
|
|
366
357
|
if (!isPlainObject$1(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
367
358
|
const checks = schema._zod.def.checks;
|
|
368
359
|
if (checks && checks.length > 0) {
|
|
369
|
-
const existingShape = schema
|
|
370
|
-
for (const key
|
|
360
|
+
const existingShape = sourceShape(schema);
|
|
361
|
+
for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
371
362
|
}
|
|
372
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
} }));
|
|
363
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
364
|
+
}
|
|
365
|
+
function extended(schema, shape) {
|
|
366
|
+
const newShape = {};
|
|
367
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
|
|
368
|
+
mirrorProps(newShape, shape);
|
|
369
|
+
return newShape;
|
|
380
370
|
}
|
|
381
371
|
function safeExtend(schema, shape) {
|
|
382
372
|
if (!isPlainObject$1(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
383
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
384
|
-
const _shape = {
|
|
385
|
-
...schema._zod.def.shape,
|
|
386
|
-
...shape
|
|
387
|
-
};
|
|
388
|
-
assignProp(this, "shape", _shape);
|
|
389
|
-
return _shape;
|
|
390
|
-
} }));
|
|
373
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
391
374
|
}
|
|
392
375
|
function merge(a, b) {
|
|
376
|
+
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
393
377
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
378
|
+
const newShape = {};
|
|
379
|
+
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
380
|
+
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
394
381
|
return clone(a, mergeDefs(a._zod.def, {
|
|
395
|
-
|
|
396
|
-
const _shape = {
|
|
397
|
-
...a._zod.def.shape,
|
|
398
|
-
...b._zod.def.shape
|
|
399
|
-
};
|
|
400
|
-
assignProp(this, "shape", _shape);
|
|
401
|
-
return _shape;
|
|
402
|
-
},
|
|
382
|
+
shape: newShape,
|
|
403
383
|
get catchall() {
|
|
404
384
|
return b._zod.def.catchall;
|
|
405
385
|
},
|
|
406
386
|
checks: b._zod.def.checks ?? []
|
|
407
387
|
}));
|
|
408
388
|
}
|
|
409
|
-
function partial(Class, schema, mask) {
|
|
389
|
+
function partial(Class, schema, mask, name = "partial") {
|
|
410
390
|
const checks = schema._zod.def.checks;
|
|
411
|
-
if (checks && checks.length > 0) throw new Error(
|
|
391
|
+
if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
392
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
393
|
+
const newShape = {};
|
|
394
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
|
|
395
|
+
type: "optional",
|
|
396
|
+
innerType: value
|
|
397
|
+
})));
|
|
412
398
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
413
|
-
|
|
414
|
-
const oldShape = schema._zod.def.shape;
|
|
415
|
-
const shape = { ...oldShape };
|
|
416
|
-
if (mask) for (const key in mask) {
|
|
417
|
-
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
418
|
-
if (!mask[key]) continue;
|
|
419
|
-
shape[key] = Class ? new Class({
|
|
420
|
-
type: "optional",
|
|
421
|
-
innerType: oldShape[key]
|
|
422
|
-
}) : oldShape[key];
|
|
423
|
-
}
|
|
424
|
-
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
425
|
-
type: "optional",
|
|
426
|
-
innerType: oldShape[key]
|
|
427
|
-
}) : oldShape[key];
|
|
428
|
-
assignProp(this, "shape", shape);
|
|
429
|
-
return shape;
|
|
430
|
-
},
|
|
399
|
+
shape: newShape,
|
|
431
400
|
checks: []
|
|
432
401
|
}));
|
|
433
402
|
}
|
|
434
403
|
function required(Class, schema, mask) {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
type: "nonoptional",
|
|
443
|
-
innerType: oldShape[key]
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
else for (const key in oldShape) shape[key] = new Class({
|
|
447
|
-
type: "nonoptional",
|
|
448
|
-
innerType: oldShape[key]
|
|
449
|
-
});
|
|
450
|
-
assignProp(this, "shape", shape);
|
|
451
|
-
return shape;
|
|
452
|
-
} }));
|
|
404
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
405
|
+
const newShape = {};
|
|
406
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({
|
|
407
|
+
type: "nonoptional",
|
|
408
|
+
innerType: value
|
|
409
|
+
}));
|
|
410
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
453
411
|
}
|
|
454
412
|
function aborted(x, startIndex = 0) {
|
|
455
413
|
if (x.aborted === true) return true;
|
|
@@ -472,19 +430,58 @@ window.__ModuleLoader__.load({
|
|
|
472
430
|
function unwrapMessage(message) {
|
|
473
431
|
return typeof message === "string" ? message : message?.message;
|
|
474
432
|
}
|
|
433
|
+
function attachSchema(issues, start, inst) {
|
|
434
|
+
var _a;
|
|
435
|
+
for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
|
|
436
|
+
}
|
|
475
437
|
function finalizeIssue(iss, ctx, config) {
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
438
|
+
var _a;
|
|
439
|
+
const traits = iss.inst?._zod?.traits;
|
|
440
|
+
if (traits?.has("$ZodType")) {
|
|
441
|
+
if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
|
|
442
|
+
else iss.schema = iss.inst;
|
|
443
|
+
}
|
|
444
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
445
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
446
|
+
const full = {};
|
|
447
|
+
for (const k of Object.keys(iss)) {
|
|
448
|
+
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__") continue;
|
|
449
|
+
full[k] = iss[k];
|
|
450
|
+
}
|
|
451
|
+
full.path ?? (full.path = []);
|
|
452
|
+
full.message = message;
|
|
453
|
+
if (ctx?.reportInput) full.input = iss.input;
|
|
454
|
+
return full;
|
|
455
|
+
}
|
|
456
|
+
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
457
|
+
function codePointLength(str) {
|
|
458
|
+
const units = str.length;
|
|
459
|
+
if (!highSurrogate.test(str)) return units;
|
|
460
|
+
let count = units;
|
|
461
|
+
for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
462
|
+
count--;
|
|
463
|
+
i++;
|
|
464
|
+
}
|
|
465
|
+
return count;
|
|
482
466
|
}
|
|
483
467
|
function getLengthableOrigin(input) {
|
|
484
468
|
if (Array.isArray(input)) return "array";
|
|
485
469
|
if (typeof input === "string") return "string";
|
|
486
470
|
return "unknown";
|
|
487
471
|
}
|
|
472
|
+
function parsedType(data) {
|
|
473
|
+
const t = typeof data;
|
|
474
|
+
switch (t) {
|
|
475
|
+
case "number": return Number.isNaN(data) ? "nan" : "number";
|
|
476
|
+
case "object": {
|
|
477
|
+
if (data === null) return "null";
|
|
478
|
+
if (Array.isArray(data)) return "array";
|
|
479
|
+
const obj = data;
|
|
480
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return t;
|
|
484
|
+
}
|
|
488
485
|
function issue(...args) {
|
|
489
486
|
const [iss, input, inst] = args;
|
|
490
487
|
if (typeof iss === "string") return {
|
|
@@ -495,33 +492,339 @@ window.__ModuleLoader__.load({
|
|
|
495
492
|
};
|
|
496
493
|
return { ...iss };
|
|
497
494
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
495
|
+
/**
|
|
496
|
+
* Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
|
|
497
|
+
*
|
|
498
|
+
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
499
|
+
*/
|
|
500
|
+
function members(proto, table) {
|
|
501
|
+
for (const key in table) {
|
|
502
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
503
|
+
if (desc.get) Object.defineProperty(proto, key, {
|
|
504
|
+
...desc,
|
|
505
|
+
enumerable: false
|
|
506
|
+
});
|
|
507
|
+
else defineBound(proto, key, desc.value);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
511
|
+
function own(inst, key, value, enumerable = true) {
|
|
512
|
+
Object.defineProperty(inst, key, {
|
|
513
|
+
configurable: true,
|
|
514
|
+
writable: true,
|
|
515
|
+
enumerable,
|
|
516
|
+
value
|
|
505
517
|
});
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
518
|
+
return value;
|
|
519
|
+
}
|
|
520
|
+
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
521
|
+
function hide(inst, key, value) {
|
|
522
|
+
return own(inst, key, value, false);
|
|
523
|
+
}
|
|
524
|
+
/** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
|
|
525
|
+
function derived(computes, table) {
|
|
526
|
+
for (const key in computes) {
|
|
527
|
+
const compute = computes[key];
|
|
528
|
+
Object.defineProperty(table, key, {
|
|
529
|
+
configurable: true,
|
|
530
|
+
enumerable: true,
|
|
531
|
+
get() {
|
|
532
|
+
return own(this, key, compute(this));
|
|
533
|
+
},
|
|
534
|
+
set(value) {
|
|
535
|
+
own(this, key, value);
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
return table;
|
|
540
|
+
}
|
|
541
|
+
function defineBound(proto, key, fn) {
|
|
542
|
+
Object.defineProperty(proto, key, {
|
|
543
|
+
configurable: true,
|
|
544
|
+
get() {
|
|
545
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
546
|
+
},
|
|
547
|
+
set(value) {
|
|
548
|
+
own(this, key, value);
|
|
549
|
+
}
|
|
509
550
|
});
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
551
|
+
}
|
|
552
|
+
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
553
|
+
function claim(inst, sentinel) {
|
|
554
|
+
const proto = Object.getPrototypeOf(inst);
|
|
555
|
+
return sentinel in proto ? void 0 : proto;
|
|
556
|
+
}
|
|
557
|
+
let installing;
|
|
558
|
+
let broke = false;
|
|
559
|
+
const breaker = {
|
|
560
|
+
configurable: true,
|
|
561
|
+
get() {
|
|
562
|
+
broke = true;
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
/**
|
|
566
|
+
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
567
|
+
* constructor, computed from the internals object itself and cached there on
|
|
568
|
+
* first read. One accessor per constructor rather than one per instance.
|
|
569
|
+
*/
|
|
570
|
+
function defineLazyInternal(inst, key, compute) {
|
|
571
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
572
|
+
if (key in proto && installing !== inst._zod) {
|
|
573
|
+
installing = void 0;
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
installing = inst._zod;
|
|
577
|
+
Object.defineProperty(proto, key, {
|
|
578
|
+
configurable: true,
|
|
579
|
+
get() {
|
|
580
|
+
Object.defineProperty(this, key, breaker);
|
|
581
|
+
const outer = broke;
|
|
582
|
+
broke = false;
|
|
583
|
+
try {
|
|
584
|
+
const value = compute(this);
|
|
585
|
+
if (broke) delete this[key];
|
|
586
|
+
else Object.defineProperty(this, key, {
|
|
587
|
+
configurable: true,
|
|
588
|
+
writable: true,
|
|
589
|
+
value
|
|
590
|
+
});
|
|
591
|
+
broke = broke || outer;
|
|
592
|
+
return value;
|
|
593
|
+
} catch (err) {
|
|
594
|
+
delete this[key];
|
|
595
|
+
broke = broke || outer;
|
|
596
|
+
throw err;
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
set(value) {
|
|
600
|
+
Object.defineProperty(this, key, {
|
|
601
|
+
configurable: true,
|
|
602
|
+
writable: true,
|
|
603
|
+
value
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
610
|
+
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
611
|
+
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
612
|
+
*/
|
|
613
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
614
|
+
const proto = claim(inst, key);
|
|
615
|
+
if (!proto) return;
|
|
616
|
+
Object.defineProperty(proto, key, {
|
|
617
|
+
configurable: true,
|
|
618
|
+
get() {
|
|
619
|
+
const desc = {
|
|
620
|
+
configurable: true,
|
|
621
|
+
writable: true,
|
|
622
|
+
enumerable,
|
|
623
|
+
value: void 0
|
|
624
|
+
};
|
|
625
|
+
Object.defineProperty(this, key, desc);
|
|
626
|
+
desc.value = make(this);
|
|
627
|
+
Object.defineProperty(this, key, desc);
|
|
628
|
+
return desc.value;
|
|
629
|
+
},
|
|
630
|
+
set(value) {
|
|
631
|
+
Object.defineProperty(this, key, {
|
|
632
|
+
configurable: true,
|
|
633
|
+
writable: true,
|
|
634
|
+
enumerable,
|
|
635
|
+
value
|
|
636
|
+
});
|
|
637
|
+
}
|
|
514
638
|
});
|
|
639
|
+
}
|
|
640
|
+
/** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
|
|
641
|
+
const CONSTANT_CATCH = "~constantCatch";
|
|
642
|
+
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
643
|
+
function constantCatch(value) {
|
|
644
|
+
const fn = () => value;
|
|
645
|
+
fn[CONSTANT_CATCH] = true;
|
|
646
|
+
return fn;
|
|
647
|
+
}
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
|
|
650
|
+
var _a$1;
|
|
651
|
+
const _zodDesc = {
|
|
652
|
+
value: void 0,
|
|
653
|
+
enumerable: false
|
|
654
|
+
};
|
|
655
|
+
let _E = "captureStackTrace" in Error ? Error : null;
|
|
656
|
+
function newError(Definition) {
|
|
657
|
+
const E = _E;
|
|
658
|
+
if (E) {
|
|
659
|
+
const saved = E.stackTraceLimit;
|
|
660
|
+
if (typeof saved === "number") {
|
|
661
|
+
try {
|
|
662
|
+
E.stackTraceLimit = 0;
|
|
663
|
+
} catch {
|
|
664
|
+
_E = null;
|
|
665
|
+
return new Definition();
|
|
666
|
+
}
|
|
667
|
+
try {
|
|
668
|
+
return new Definition();
|
|
669
|
+
} finally {
|
|
670
|
+
E.stackTraceLimit = saved;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return new Definition();
|
|
675
|
+
}
|
|
676
|
+
function $constructor(name, initializer, proto, params) {
|
|
677
|
+
const zodProto = {};
|
|
678
|
+
function Internals(def) {
|
|
679
|
+
this.def = def;
|
|
680
|
+
this.constr = _;
|
|
681
|
+
this.traits = /* @__PURE__ */ new Set();
|
|
682
|
+
}
|
|
683
|
+
Internals.prototype = zodProto;
|
|
684
|
+
const protoMembers = proto;
|
|
685
|
+
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
686
|
+
function init(inst, def) {
|
|
687
|
+
if (!inst._zod) {
|
|
688
|
+
_zodDesc.value = new Internals(def);
|
|
689
|
+
try {
|
|
690
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
691
|
+
} finally {
|
|
692
|
+
_zodDesc.value = void 0;
|
|
693
|
+
}
|
|
694
|
+
} else if (inst._zod.traits.has(name)) return;
|
|
695
|
+
inst._zod.traits.add(name);
|
|
696
|
+
initializer(inst, def);
|
|
697
|
+
if (initialized) {
|
|
698
|
+
const own = Object.getPrototypeOf(inst);
|
|
699
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
700
|
+
let up = own;
|
|
701
|
+
while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
|
|
702
|
+
const target = up ?? own;
|
|
703
|
+
if (!initialized.has(target)) {
|
|
704
|
+
initialized.add(target);
|
|
705
|
+
members(target, protoMembers);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
const proto = _.prototype;
|
|
709
|
+
for (const k in proto) {
|
|
710
|
+
if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
|
|
711
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
const Parent = params?.Parent ?? Object;
|
|
715
|
+
class Definition extends Parent {}
|
|
716
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
717
|
+
function _(def) {
|
|
718
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
719
|
+
init(inst, def);
|
|
720
|
+
const deferred = inst._zod.deferred;
|
|
721
|
+
if (deferred) {
|
|
722
|
+
for (const fn of deferred) fn();
|
|
723
|
+
inst._zod.deferred = void 0;
|
|
724
|
+
}
|
|
725
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
726
|
+
if (pp) pp(inst);
|
|
727
|
+
return inst;
|
|
728
|
+
}
|
|
729
|
+
Object.defineProperty(_, "init", { value: init });
|
|
730
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
731
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
732
|
+
return inst?._zod?.traits?.has(name);
|
|
733
|
+
} });
|
|
734
|
+
Object.defineProperty(_, "name", { value: name });
|
|
735
|
+
return _;
|
|
736
|
+
}
|
|
737
|
+
var $ZodAsyncError = class extends Error {
|
|
738
|
+
constructor() {
|
|
739
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
var $ZodEncodeError = class extends Error {
|
|
743
|
+
constructor(name) {
|
|
744
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
745
|
+
this.name = "ZodEncodeError";
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
749
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
750
|
+
function config(newConfig) {
|
|
751
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
752
|
+
return globalConfig;
|
|
753
|
+
}
|
|
754
|
+
//#endregion
|
|
755
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
|
|
756
|
+
function _getMessage() {
|
|
757
|
+
const internals = this._zod;
|
|
758
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
759
|
+
return internals.message;
|
|
760
|
+
}
|
|
761
|
+
function _setMessage(value) {
|
|
762
|
+
this._zod.message = value;
|
|
763
|
+
}
|
|
764
|
+
const _messageDesc = {
|
|
765
|
+
get: _getMessage,
|
|
766
|
+
set: _setMessage,
|
|
767
|
+
enumerable: true,
|
|
768
|
+
configurable: true
|
|
769
|
+
};
|
|
770
|
+
const _issuesDesc = {
|
|
771
|
+
value: void 0,
|
|
772
|
+
enumerable: false
|
|
773
|
+
};
|
|
774
|
+
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
775
|
+
const initializer$1 = (inst, def) => {
|
|
776
|
+
inst.name = "$ZodError";
|
|
777
|
+
_issuesDesc.value = def;
|
|
778
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
779
|
+
_issuesDesc.value = void 0;
|
|
780
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
781
|
+
const proto = Object.getPrototypeOf(inst);
|
|
782
|
+
if (!_installedToString.has(proto)) {
|
|
783
|
+
_installedToString.add(proto);
|
|
784
|
+
Object.defineProperty(proto, "toString", {
|
|
785
|
+
configurable: true,
|
|
786
|
+
enumerable: false,
|
|
787
|
+
get() {
|
|
788
|
+
const value = () => this.message;
|
|
789
|
+
Object.defineProperty(this, "toString", {
|
|
790
|
+
value,
|
|
791
|
+
configurable: true,
|
|
792
|
+
writable: true
|
|
793
|
+
});
|
|
794
|
+
return value;
|
|
795
|
+
},
|
|
796
|
+
set(value) {
|
|
797
|
+
Object.defineProperty(this, "toString", {
|
|
798
|
+
value,
|
|
799
|
+
configurable: true,
|
|
800
|
+
writable: true
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
}
|
|
515
805
|
};
|
|
516
806
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
517
|
-
|
|
807
|
+
$constructor("$ZodError", initializer$1, void 0, { Parent: Error });
|
|
808
|
+
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
809
|
+
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
810
|
+
* "__proto__" would hit the setter instead of creating a key. */
|
|
811
|
+
function node(obj, key, make) {
|
|
812
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
813
|
+
if (key === "__proto__") Object.defineProperty(obj, key, {
|
|
814
|
+
value: make(),
|
|
815
|
+
writable: true,
|
|
816
|
+
enumerable: true,
|
|
817
|
+
configurable: true
|
|
818
|
+
});
|
|
819
|
+
else obj[key] = make();
|
|
820
|
+
}
|
|
821
|
+
return obj[key];
|
|
822
|
+
}
|
|
518
823
|
function flattenError(error, mapper = (issue) => issue.message) {
|
|
519
824
|
const fieldErrors = {};
|
|
520
825
|
const formErrors = [];
|
|
521
|
-
for (const sub of error.issues) if (sub.path.length > 0)
|
|
522
|
-
|
|
523
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
524
|
-
} else formErrors.push(mapper(sub));
|
|
826
|
+
for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
827
|
+
else formErrors.push(mapper(sub));
|
|
525
828
|
return {
|
|
526
829
|
formErrors,
|
|
527
830
|
fieldErrors
|
|
@@ -541,12 +844,21 @@ window.__ModuleLoader__.load({
|
|
|
541
844
|
let i = 0;
|
|
542
845
|
while (i < fullpath.length) {
|
|
543
846
|
const el = fullpath[i];
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
847
|
+
const terminal = i === fullpath.length - 1;
|
|
848
|
+
if (el === "_errors") {
|
|
849
|
+
if (terminal) curr._errors.push(mapper(issue));
|
|
850
|
+
i++;
|
|
851
|
+
continue;
|
|
548
852
|
}
|
|
549
|
-
curr
|
|
853
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
|
|
854
|
+
value: { _errors: [] },
|
|
855
|
+
enumerable: true,
|
|
856
|
+
writable: true,
|
|
857
|
+
configurable: true
|
|
858
|
+
});
|
|
859
|
+
const node = curr[el];
|
|
860
|
+
if (terminal) node._errors.push(mapper(issue));
|
|
861
|
+
curr = node;
|
|
550
862
|
i++;
|
|
551
863
|
}
|
|
552
864
|
}
|
|
@@ -556,40 +868,52 @@ window.__ModuleLoader__.load({
|
|
|
556
868
|
return fieldErrors;
|
|
557
869
|
}
|
|
558
870
|
//#endregion
|
|
559
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
871
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
|
|
872
|
+
function finalizeParams(callee, params) {
|
|
873
|
+
return {
|
|
874
|
+
callee: params?.callee ?? callee,
|
|
875
|
+
Err: params?.Err
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
const _parse = (_Err) => {
|
|
879
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
880
|
+
const ctx = _ctx ? {
|
|
881
|
+
..._ctx,
|
|
882
|
+
async: false
|
|
883
|
+
} : { async: false };
|
|
884
|
+
const result = schema._zod.run({
|
|
885
|
+
value,
|
|
886
|
+
issues: []
|
|
887
|
+
}, ctx);
|
|
888
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
889
|
+
if (result.issues.length) {
|
|
890
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
891
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
892
|
+
throw e;
|
|
893
|
+
}
|
|
894
|
+
return result.value;
|
|
895
|
+
};
|
|
896
|
+
return fn;
|
|
576
897
|
};
|
|
577
|
-
const _parseAsync = (_Err) =>
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
898
|
+
const _parseAsync = (_Err) => {
|
|
899
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
900
|
+
const ctx = _ctx ? {
|
|
901
|
+
..._ctx,
|
|
902
|
+
async: true
|
|
903
|
+
} : { async: true };
|
|
904
|
+
let result = schema._zod.run({
|
|
905
|
+
value,
|
|
906
|
+
issues: []
|
|
907
|
+
}, ctx);
|
|
908
|
+
if (result instanceof Promise) result = await result;
|
|
909
|
+
if (result.issues.length) {
|
|
910
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
911
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
912
|
+
throw e;
|
|
913
|
+
}
|
|
914
|
+
return result.value;
|
|
915
|
+
};
|
|
916
|
+
return fn;
|
|
593
917
|
};
|
|
594
918
|
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
595
919
|
const ctx = _ctx ? {
|
|
@@ -601,15 +925,30 @@ window.__ModuleLoader__.load({
|
|
|
601
925
|
issues: []
|
|
602
926
|
}, ctx);
|
|
603
927
|
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
604
|
-
return result.issues.length ? {
|
|
605
|
-
success: false,
|
|
606
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
607
|
-
} : {
|
|
928
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
608
929
|
success: true,
|
|
609
930
|
data: result.value
|
|
610
931
|
};
|
|
611
932
|
};
|
|
612
|
-
|
|
933
|
+
function failure(Err, issues, ctx) {
|
|
934
|
+
let error;
|
|
935
|
+
return {
|
|
936
|
+
success: false,
|
|
937
|
+
get error() {
|
|
938
|
+
if (!error) {
|
|
939
|
+
error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
940
|
+
issues = void 0;
|
|
941
|
+
ctx = void 0;
|
|
942
|
+
}
|
|
943
|
+
return error;
|
|
944
|
+
},
|
|
945
|
+
set error(e) {
|
|
946
|
+
error = e;
|
|
947
|
+
issues = void 0;
|
|
948
|
+
ctx = void 0;
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
}
|
|
613
952
|
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
614
953
|
const ctx = _ctx ? {
|
|
615
954
|
..._ctx,
|
|
@@ -620,34 +959,96 @@ window.__ModuleLoader__.load({
|
|
|
620
959
|
issues: []
|
|
621
960
|
}, ctx);
|
|
622
961
|
if (result instanceof Promise) result = await result;
|
|
623
|
-
return result.issues.length ? {
|
|
624
|
-
success: false,
|
|
625
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
626
|
-
} : {
|
|
962
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
627
963
|
success: true,
|
|
628
964
|
data: result.value
|
|
629
965
|
};
|
|
630
966
|
};
|
|
631
|
-
const
|
|
632
|
-
const
|
|
967
|
+
const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
968
|
+
const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
969
|
+
const validate = ((schema, value, _ctx) => {
|
|
970
|
+
const validator = schema._zod.bag.validator;
|
|
971
|
+
if (validator !== void 0) {
|
|
972
|
+
if (validator(value) !== COMPILE_INVALID) return true;
|
|
973
|
+
if (validator.definite === true && _ctx === void 0) return false;
|
|
974
|
+
}
|
|
975
|
+
return validateFallback(schema, value, _ctx);
|
|
976
|
+
});
|
|
977
|
+
function validateFallback(schema, value, _ctx) {
|
|
633
978
|
const ctx = _ctx ? {
|
|
634
979
|
..._ctx,
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
980
|
+
async: false,
|
|
981
|
+
abortEarly: true
|
|
982
|
+
} : {
|
|
983
|
+
async: false,
|
|
984
|
+
abortEarly: true
|
|
985
|
+
};
|
|
986
|
+
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
987
|
+
let result;
|
|
988
|
+
if (fallbackRun) {
|
|
989
|
+
ctx[COMPILE_FALLBACK] = true;
|
|
990
|
+
result = fallbackRun({
|
|
991
|
+
value,
|
|
992
|
+
issues: []
|
|
993
|
+
}, ctx);
|
|
994
|
+
} else result = schema._zod.run({
|
|
995
|
+
value,
|
|
996
|
+
issues: []
|
|
997
|
+
}, ctx);
|
|
998
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
999
|
+
return result.issues.length === 0;
|
|
1000
|
+
}
|
|
1001
|
+
const validateAsync$1 = async (schema, value, _ctx) => {
|
|
1002
|
+
const ctx = _ctx ? {
|
|
1003
|
+
..._ctx,
|
|
1004
|
+
async: true,
|
|
1005
|
+
abortEarly: true
|
|
1006
|
+
} : {
|
|
1007
|
+
async: true,
|
|
1008
|
+
abortEarly: true
|
|
1009
|
+
};
|
|
1010
|
+
let result = schema._zod.run({
|
|
1011
|
+
value,
|
|
1012
|
+
issues: []
|
|
1013
|
+
}, ctx);
|
|
1014
|
+
if (result instanceof Promise) result = await result;
|
|
1015
|
+
return result.issues.length === 0;
|
|
638
1016
|
};
|
|
639
|
-
const
|
|
640
|
-
|
|
1017
|
+
const _encode = (_Err) => {
|
|
1018
|
+
const parse = _parse(_Err);
|
|
1019
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
1020
|
+
const ctx = _ctx ? {
|
|
1021
|
+
..._ctx,
|
|
1022
|
+
direction: "backward"
|
|
1023
|
+
} : { direction: "backward" };
|
|
1024
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
1025
|
+
};
|
|
1026
|
+
return fn;
|
|
641
1027
|
};
|
|
642
|
-
const
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
}
|
|
647
|
-
return
|
|
1028
|
+
const _decode = (_Err) => {
|
|
1029
|
+
const parse = _parse(_Err);
|
|
1030
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
1031
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
1032
|
+
};
|
|
1033
|
+
return fn;
|
|
648
1034
|
};
|
|
649
|
-
const
|
|
650
|
-
|
|
1035
|
+
const _encodeAsync = (_Err) => {
|
|
1036
|
+
const parseAsync = _parseAsync(_Err);
|
|
1037
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
1038
|
+
const ctx = _ctx ? {
|
|
1039
|
+
..._ctx,
|
|
1040
|
+
direction: "backward"
|
|
1041
|
+
} : { direction: "backward" };
|
|
1042
|
+
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
1043
|
+
};
|
|
1044
|
+
return fn;
|
|
1045
|
+
};
|
|
1046
|
+
const _decodeAsync = (_Err) => {
|
|
1047
|
+
const parseAsync = _parseAsync(_Err);
|
|
1048
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
1049
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
1050
|
+
};
|
|
1051
|
+
return fn;
|
|
651
1052
|
};
|
|
652
1053
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
653
1054
|
const ctx = _ctx ? {
|
|
@@ -670,7 +1071,7 @@ window.__ModuleLoader__.load({
|
|
|
670
1071
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
671
1072
|
};
|
|
672
1073
|
//#endregion
|
|
673
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1074
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
|
|
674
1075
|
/**
|
|
675
1076
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
676
1077
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -678,12 +1079,15 @@ window.__ModuleLoader__.load({
|
|
|
678
1079
|
*/
|
|
679
1080
|
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
680
1081
|
const cuid2 = /^[0-9a-z]+$/;
|
|
681
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{
|
|
1082
|
+
const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
682
1083
|
const xid = /^[0-9a-vA-V]{20}$/;
|
|
683
1084
|
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
684
1085
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
1086
|
+
function nanoidOfLength(length) {
|
|
1087
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
1088
|
+
}
|
|
685
1089
|
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
686
|
-
const duration
|
|
1090
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
687
1091
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
688
1092
|
const 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})$/;
|
|
689
1093
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
@@ -694,54 +1098,63 @@ window.__ModuleLoader__.load({
|
|
|
694
1098
|
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})$`);
|
|
695
1099
|
};
|
|
696
1100
|
/** Practical email validation */
|
|
697
|
-
const email = /^(
|
|
698
|
-
const _emoji$1 = `^(\\p{Extended_Pictographic}
|
|
1101
|
+
const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
1102
|
+
const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
699
1103
|
function emoji() {
|
|
700
1104
|
return new RegExp(_emoji$1, "u");
|
|
701
1105
|
}
|
|
702
1106
|
const 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])$/;
|
|
703
1107
|
const 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}|:))$/;
|
|
704
1108
|
const 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])$/;
|
|
705
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
1109
|
+
const cidrv6 = /^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
706
1110
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
707
|
-
const base64url = /^[A-Za-z0-9_-]
|
|
1111
|
+
const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
|
|
708
1112
|
const httpProtocol = /^https?$/;
|
|
709
1113
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
710
1114
|
const 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])))`;
|
|
711
|
-
|
|
1115
|
+
/** Anchors a pattern source. The interpolation lives here rather than at the call site because
|
|
1116
|
+
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
1117
|
+
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
|
|
1118
|
+
function anchor(source) {
|
|
1119
|
+
return new RegExp(`^${source}$`);
|
|
1120
|
+
}
|
|
1121
|
+
const date = /*@__PURE__*/ anchor(dateSource);
|
|
712
1122
|
function timeSource(args) {
|
|
713
1123
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
714
|
-
return 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+)?)?`;
|
|
1124
|
+
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
715
1125
|
}
|
|
716
|
-
function time
|
|
1126
|
+
function time(args) {
|
|
717
1127
|
return new RegExp(`^${timeSource(args)}$`);
|
|
718
1128
|
}
|
|
719
|
-
function datetime
|
|
720
|
-
const time = timeSource({ precision: args.precision });
|
|
1129
|
+
function datetime(args) {
|
|
721
1130
|
const opts = ["Z"];
|
|
722
|
-
if (args.local) opts.push("");
|
|
723
1131
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
724
|
-
const
|
|
1132
|
+
const qualified = `${timeSource({
|
|
1133
|
+
precision: args.precision,
|
|
1134
|
+
seconds: true
|
|
1135
|
+
})}(?:${opts.join("|")})`;
|
|
1136
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
725
1137
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
726
1138
|
}
|
|
727
|
-
const
|
|
728
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
729
|
-
return new RegExp(`^${regex}$`);
|
|
730
|
-
};
|
|
731
|
-
const integer = /^-?\d+$/;
|
|
1139
|
+
const anyString = /^[\s\S]{0,}$/;
|
|
732
1140
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
733
1141
|
const boolean$1 = /^(?:true|false)$/i;
|
|
734
1142
|
const _undefined$2 = /^undefined$/i;
|
|
735
1143
|
const lowercase = /^[^A-Z]*$/;
|
|
736
1144
|
const uppercase = /^[^a-z]*$/;
|
|
737
1145
|
//#endregion
|
|
738
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1146
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
|
|
739
1147
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
740
1148
|
var _a;
|
|
741
1149
|
inst._zod ?? (inst._zod = {});
|
|
742
1150
|
inst._zod.def = def;
|
|
743
1151
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
744
1152
|
});
|
|
1153
|
+
/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
|
|
1154
|
+
const _whenHasLength = (payload) => {
|
|
1155
|
+
const val = payload.value;
|
|
1156
|
+
return !nullish(val) && val.length !== void 0;
|
|
1157
|
+
};
|
|
745
1158
|
const numericOriginMap = {
|
|
746
1159
|
number: "number",
|
|
747
1160
|
bigint: "bigint",
|
|
@@ -750,18 +1163,10 @@ window.__ModuleLoader__.load({
|
|
|
750
1163
|
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
751
1164
|
$ZodCheck.init(inst, def);
|
|
752
1165
|
const origin = numericOriginMap[typeof def.value];
|
|
753
|
-
inst._zod.onattach.push((inst) => {
|
|
754
|
-
const bag = inst._zod.bag;
|
|
755
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
756
|
-
if (def.value < curr) {
|
|
757
|
-
if (def.inclusive) bag.maximum = def.value;
|
|
758
|
-
else bag.exclusiveMaximum = def.value;
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
1166
|
inst._zod.check = (payload) => {
|
|
762
1167
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
763
1168
|
payload.issues.push({
|
|
764
|
-
origin,
|
|
1169
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
765
1170
|
code: "too_big",
|
|
766
1171
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
767
1172
|
input: payload.value,
|
|
@@ -774,18 +1179,10 @@ window.__ModuleLoader__.load({
|
|
|
774
1179
|
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
775
1180
|
$ZodCheck.init(inst, def);
|
|
776
1181
|
const origin = numericOriginMap[typeof def.value];
|
|
777
|
-
inst._zod.onattach.push((inst) => {
|
|
778
|
-
const bag = inst._zod.bag;
|
|
779
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
780
|
-
if (def.value > curr) {
|
|
781
|
-
if (def.inclusive) bag.minimum = def.value;
|
|
782
|
-
else bag.exclusiveMinimum = def.value;
|
|
783
|
-
}
|
|
784
|
-
});
|
|
785
1182
|
inst._zod.check = (payload) => {
|
|
786
1183
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
787
1184
|
payload.issues.push({
|
|
788
|
-
origin,
|
|
1185
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
789
1186
|
code: "too_small",
|
|
790
1187
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
791
1188
|
input: payload.value,
|
|
@@ -797,13 +1194,9 @@ window.__ModuleLoader__.load({
|
|
|
797
1194
|
});
|
|
798
1195
|
const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
799
1196
|
$ZodCheck.init(inst, def);
|
|
800
|
-
inst._zod.onattach.push((inst) => {
|
|
801
|
-
var _a;
|
|
802
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
803
|
-
});
|
|
804
1197
|
inst._zod.check = (payload) => {
|
|
805
1198
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
806
|
-
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
1199
|
+
if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
807
1200
|
payload.issues.push({
|
|
808
1201
|
origin: typeof payload.value,
|
|
809
1202
|
code: "not_multiple_of",
|
|
@@ -820,13 +1213,6 @@ window.__ModuleLoader__.load({
|
|
|
820
1213
|
const isInt = def.format?.includes("int");
|
|
821
1214
|
const origin = isInt ? "int" : "number";
|
|
822
1215
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
823
|
-
inst._zod.onattach.push((inst) => {
|
|
824
|
-
const bag = inst._zod.bag;
|
|
825
|
-
bag.format = def.format;
|
|
826
|
-
bag.minimum = minimum;
|
|
827
|
-
bag.maximum = maximum;
|
|
828
|
-
if (isInt) bag.pattern = integer;
|
|
829
|
-
});
|
|
830
1216
|
inst._zod.check = (payload) => {
|
|
831
1217
|
const input = payload.value;
|
|
832
1218
|
if (isInt) {
|
|
@@ -888,17 +1274,11 @@ window.__ModuleLoader__.load({
|
|
|
888
1274
|
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
889
1275
|
var _a;
|
|
890
1276
|
$ZodCheck.init(inst, def);
|
|
891
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
892
|
-
const val = payload.value;
|
|
893
|
-
return !nullish(val) && val.length !== void 0;
|
|
894
|
-
});
|
|
895
|
-
inst._zod.onattach.push((inst) => {
|
|
896
|
-
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
897
|
-
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
898
|
-
});
|
|
1277
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
899
1278
|
inst._zod.check = (payload) => {
|
|
900
1279
|
const input = payload.value;
|
|
901
|
-
|
|
1280
|
+
const units = input.length;
|
|
1281
|
+
if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
|
|
902
1282
|
const origin = getLengthableOrigin(input);
|
|
903
1283
|
payload.issues.push({
|
|
904
1284
|
origin,
|
|
@@ -914,17 +1294,11 @@ window.__ModuleLoader__.load({
|
|
|
914
1294
|
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
915
1295
|
var _a;
|
|
916
1296
|
$ZodCheck.init(inst, def);
|
|
917
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
918
|
-
const val = payload.value;
|
|
919
|
-
return !nullish(val) && val.length !== void 0;
|
|
920
|
-
});
|
|
921
|
-
inst._zod.onattach.push((inst) => {
|
|
922
|
-
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
923
|
-
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
924
|
-
});
|
|
1297
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
925
1298
|
inst._zod.check = (payload) => {
|
|
926
1299
|
const input = payload.value;
|
|
927
|
-
|
|
1300
|
+
const units = input.length;
|
|
1301
|
+
if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
|
|
928
1302
|
const origin = getLengthableOrigin(input);
|
|
929
1303
|
payload.issues.push({
|
|
930
1304
|
origin,
|
|
@@ -940,19 +1314,11 @@ window.__ModuleLoader__.load({
|
|
|
940
1314
|
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
941
1315
|
var _a;
|
|
942
1316
|
$ZodCheck.init(inst, def);
|
|
943
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
944
|
-
const val = payload.value;
|
|
945
|
-
return !nullish(val) && val.length !== void 0;
|
|
946
|
-
});
|
|
947
|
-
inst._zod.onattach.push((inst) => {
|
|
948
|
-
const bag = inst._zod.bag;
|
|
949
|
-
bag.minimum = def.length;
|
|
950
|
-
bag.maximum = def.length;
|
|
951
|
-
bag.length = def.length;
|
|
952
|
-
});
|
|
1317
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
953
1318
|
inst._zod.check = (payload) => {
|
|
954
1319
|
const input = payload.value;
|
|
955
|
-
const
|
|
1320
|
+
const units = input.length;
|
|
1321
|
+
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
956
1322
|
if (length === def.length) return;
|
|
957
1323
|
const origin = getLengthableOrigin(input);
|
|
958
1324
|
const tooBig = length > def.length;
|
|
@@ -976,14 +1342,6 @@ window.__ModuleLoader__.load({
|
|
|
976
1342
|
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
977
1343
|
var _a, _b;
|
|
978
1344
|
$ZodCheck.init(inst, def);
|
|
979
|
-
inst._zod.onattach.push((inst) => {
|
|
980
|
-
const bag = inst._zod.bag;
|
|
981
|
-
bag.format = def.format;
|
|
982
|
-
if (def.pattern) {
|
|
983
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
984
|
-
bag.patterns.add(def.pattern);
|
|
985
|
-
}
|
|
986
|
-
});
|
|
987
1345
|
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
988
1346
|
def.pattern.lastIndex = 0;
|
|
989
1347
|
if (def.pattern.test(payload.value)) return;
|
|
@@ -1026,13 +1384,7 @@ window.__ModuleLoader__.load({
|
|
|
1026
1384
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1027
1385
|
$ZodCheck.init(inst, def);
|
|
1028
1386
|
const escapedRegex = escapeRegex(def.includes);
|
|
1029
|
-
|
|
1030
|
-
def.pattern = pattern;
|
|
1031
|
-
inst._zod.onattach.push((inst) => {
|
|
1032
|
-
const bag = inst._zod.bag;
|
|
1033
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1034
|
-
bag.patterns.add(pattern);
|
|
1035
|
-
});
|
|
1387
|
+
def.pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
1036
1388
|
inst._zod.check = (payload) => {
|
|
1037
1389
|
if (payload.value.includes(def.includes, def.position)) return;
|
|
1038
1390
|
payload.issues.push({
|
|
@@ -1050,11 +1402,6 @@ window.__ModuleLoader__.load({
|
|
|
1050
1402
|
$ZodCheck.init(inst, def);
|
|
1051
1403
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1052
1404
|
def.pattern ?? (def.pattern = pattern);
|
|
1053
|
-
inst._zod.onattach.push((inst) => {
|
|
1054
|
-
const bag = inst._zod.bag;
|
|
1055
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1056
|
-
bag.patterns.add(pattern);
|
|
1057
|
-
});
|
|
1058
1405
|
inst._zod.check = (payload) => {
|
|
1059
1406
|
if (payload.value.startsWith(def.prefix)) return;
|
|
1060
1407
|
payload.issues.push({
|
|
@@ -1072,11 +1419,6 @@ window.__ModuleLoader__.load({
|
|
|
1072
1419
|
$ZodCheck.init(inst, def);
|
|
1073
1420
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1074
1421
|
def.pattern ?? (def.pattern = pattern);
|
|
1075
|
-
inst._zod.onattach.push((inst) => {
|
|
1076
|
-
const bag = inst._zod.bag;
|
|
1077
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1078
|
-
bag.patterns.add(pattern);
|
|
1079
|
-
});
|
|
1080
1422
|
inst._zod.check = (payload) => {
|
|
1081
1423
|
if (payload.value.endsWith(def.suffix)) return;
|
|
1082
1424
|
payload.issues.push({
|
|
@@ -1097,17 +1439,21 @@ window.__ModuleLoader__.load({
|
|
|
1097
1439
|
};
|
|
1098
1440
|
});
|
|
1099
1441
|
//#endregion
|
|
1100
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1442
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
|
|
1101
1443
|
var Doc = class {
|
|
1102
|
-
constructor(args = []) {
|
|
1444
|
+
constructor(args = [], closed = {}) {
|
|
1103
1445
|
this.content = [];
|
|
1104
1446
|
this.indent = 0;
|
|
1105
|
-
|
|
1447
|
+
this.args = args;
|
|
1448
|
+
this.closed = closed;
|
|
1106
1449
|
}
|
|
1107
1450
|
indented(fn) {
|
|
1108
1451
|
this.indent += 1;
|
|
1109
|
-
|
|
1110
|
-
|
|
1452
|
+
try {
|
|
1453
|
+
fn(this);
|
|
1454
|
+
} finally {
|
|
1455
|
+
this.indent -= 1;
|
|
1456
|
+
}
|
|
1111
1457
|
}
|
|
1112
1458
|
write(arg) {
|
|
1113
1459
|
if (typeof arg === "function") {
|
|
@@ -1122,28 +1468,27 @@ window.__ModuleLoader__.load({
|
|
|
1122
1468
|
}
|
|
1123
1469
|
compile() {
|
|
1124
1470
|
const F = Function;
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
return new F(...args, lines.join("\n"));
|
|
1471
|
+
const content = this?.content ?? [``];
|
|
1472
|
+
return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
|
|
1128
1473
|
}
|
|
1129
1474
|
};
|
|
1130
1475
|
//#endregion
|
|
1131
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1476
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
|
|
1132
1477
|
const version = {
|
|
1133
1478
|
major: 4,
|
|
1134
|
-
minor:
|
|
1135
|
-
patch:
|
|
1479
|
+
minor: 6,
|
|
1480
|
+
patch: 5
|
|
1136
1481
|
};
|
|
1137
1482
|
//#endregion
|
|
1138
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
1483
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
|
|
1139
1484
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1140
1485
|
var _a;
|
|
1141
1486
|
inst ?? (inst = {});
|
|
1142
1487
|
inst._zod.def = def;
|
|
1143
1488
|
inst._zod.bag = inst._zod.bag || {};
|
|
1144
1489
|
inst._zod.version = version;
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1490
|
+
const defChecks = inst._zod.def.checks;
|
|
1491
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
1147
1492
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1148
1493
|
if (checks.length === 0) {
|
|
1149
1494
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -1152,6 +1497,7 @@ window.__ModuleLoader__.load({
|
|
|
1152
1497
|
});
|
|
1153
1498
|
} else {
|
|
1154
1499
|
const runChecks = (payload, checks, ctx) => {
|
|
1500
|
+
if (payload.memo) return payload;
|
|
1155
1501
|
let isAborted = aborted(payload);
|
|
1156
1502
|
let asyncResult;
|
|
1157
1503
|
for (const ch of checks) {
|
|
@@ -1165,10 +1511,12 @@ window.__ModuleLoader__.load({
|
|
|
1165
1511
|
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1166
1512
|
await _;
|
|
1167
1513
|
if (payload.issues.length === currLen) return;
|
|
1514
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1168
1515
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1169
1516
|
});
|
|
1170
1517
|
else {
|
|
1171
1518
|
if (payload.issues.length === currLen) continue;
|
|
1519
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1172
1520
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1173
1521
|
}
|
|
1174
1522
|
}
|
|
@@ -1212,22 +1560,43 @@ window.__ModuleLoader__.load({
|
|
|
1212
1560
|
return runChecks(result, checks, ctx);
|
|
1213
1561
|
};
|
|
1214
1562
|
}
|
|
1215
|
-
|
|
1563
|
+
}, {
|
|
1564
|
+
get "~standard"() {
|
|
1565
|
+
return hide(this, "~standard", standardProps(this));
|
|
1566
|
+
},
|
|
1567
|
+
set "~standard"(value) {
|
|
1568
|
+
own(this, "~standard", value);
|
|
1569
|
+
}
|
|
1570
|
+
});
|
|
1571
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
1572
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
|
|
1573
|
+
async function validateAsync(inst, value) {
|
|
1574
|
+
const ctx = { async: true };
|
|
1575
|
+
return toStandardResult(await inst._zod.run({
|
|
1576
|
+
value,
|
|
1577
|
+
issues: []
|
|
1578
|
+
}, ctx), ctx);
|
|
1579
|
+
}
|
|
1580
|
+
function standardProps(inst) {
|
|
1581
|
+
return {
|
|
1216
1582
|
validate: (value) => {
|
|
1583
|
+
const ctx = { async: false };
|
|
1217
1584
|
try {
|
|
1218
|
-
const r =
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1585
|
+
const r = inst._zod.run({
|
|
1586
|
+
value,
|
|
1587
|
+
issues: []
|
|
1588
|
+
}, ctx);
|
|
1589
|
+
if (!(r instanceof Promise)) return toStandardResult(r, ctx);
|
|
1590
|
+
} catch (_) {}
|
|
1591
|
+
return validateAsync(inst, value);
|
|
1223
1592
|
},
|
|
1224
1593
|
vendor: "zod",
|
|
1225
1594
|
version: 1
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1228
1597
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1229
1598
|
$ZodType.init(inst, def);
|
|
1230
|
-
inst._zod.pattern =
|
|
1599
|
+
inst._zod.pattern = def.pattern ?? anyString;
|
|
1231
1600
|
inst._zod.parse = (payload, _) => {
|
|
1232
1601
|
if (def.coerce) try {
|
|
1233
1602
|
payload.value = String(payload.value);
|
|
@@ -1271,51 +1640,95 @@ window.__ModuleLoader__.load({
|
|
|
1271
1640
|
def.pattern ?? (def.pattern = email);
|
|
1272
1641
|
$ZodStringFormat.init(inst, def);
|
|
1273
1642
|
});
|
|
1643
|
+
function canParseURL(input) {
|
|
1644
|
+
try {
|
|
1645
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
|
|
1646
|
+
new URL(input);
|
|
1647
|
+
return true;
|
|
1648
|
+
} catch {
|
|
1649
|
+
return false;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
function validateURL(trimmed, def) {
|
|
1653
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) return canParseURL(trimmed) || 2;
|
|
1654
|
+
return parseURLObject(trimmed, def);
|
|
1655
|
+
}
|
|
1656
|
+
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
1657
|
+
function parseURLObject(trimmed, def) {
|
|
1658
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
1659
|
+
try {
|
|
1660
|
+
if (typeof URL !== "undefined") {
|
|
1661
|
+
const URLStatic = URL;
|
|
1662
|
+
if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? 2;
|
|
1663
|
+
}
|
|
1664
|
+
return new URL(trimmed);
|
|
1665
|
+
} catch {
|
|
1666
|
+
return 2;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
1670
|
+
/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
|
|
1671
|
+
function stripTabAndNewline(value) {
|
|
1672
|
+
return value.replace(asciiTabOrNewline, "");
|
|
1673
|
+
}
|
|
1674
|
+
function urlHostnameOk(url, hostname) {
|
|
1675
|
+
hostname.lastIndex = 0;
|
|
1676
|
+
return hostname.test(url.hostname);
|
|
1677
|
+
}
|
|
1678
|
+
function urlProtocolOk(url, protocol) {
|
|
1679
|
+
protocol.lastIndex = 0;
|
|
1680
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
1681
|
+
}
|
|
1274
1682
|
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
1275
1683
|
$ZodStringFormat.init(inst, def);
|
|
1276
1684
|
inst._zod.check = (payload) => {
|
|
1277
1685
|
try {
|
|
1278
1686
|
const trimmed = payload.value.trim();
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
code: "invalid_format",
|
|
1283
|
-
format: "url",
|
|
1284
|
-
note: "Invalid URL format",
|
|
1285
|
-
input: payload.value,
|
|
1286
|
-
inst,
|
|
1287
|
-
continue: !def.abort
|
|
1288
|
-
});
|
|
1289
|
-
return;
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
const url = new URL(trimmed);
|
|
1293
|
-
if (def.hostname) {
|
|
1294
|
-
def.hostname.lastIndex = 0;
|
|
1295
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1687
|
+
const url = validateURL(trimmed, def);
|
|
1688
|
+
if (url === 1) {
|
|
1689
|
+
payload.issues.push({
|
|
1296
1690
|
code: "invalid_format",
|
|
1297
1691
|
format: "url",
|
|
1298
|
-
note: "Invalid
|
|
1299
|
-
pattern: def.hostname.source,
|
|
1692
|
+
note: "Invalid URL format",
|
|
1300
1693
|
input: payload.value,
|
|
1301
1694
|
inst,
|
|
1302
1695
|
continue: !def.abort
|
|
1303
1696
|
});
|
|
1697
|
+
return;
|
|
1304
1698
|
}
|
|
1305
|
-
if (
|
|
1306
|
-
|
|
1307
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1699
|
+
if (url === 2) {
|
|
1700
|
+
payload.issues.push({
|
|
1308
1701
|
code: "invalid_format",
|
|
1309
1702
|
format: "url",
|
|
1310
|
-
note: "Invalid protocol",
|
|
1311
|
-
pattern: def.protocol.source,
|
|
1312
1703
|
input: payload.value,
|
|
1313
1704
|
inst,
|
|
1314
1705
|
continue: !def.abort
|
|
1315
1706
|
});
|
|
1707
|
+
return;
|
|
1316
1708
|
}
|
|
1317
|
-
if (
|
|
1318
|
-
|
|
1709
|
+
if (url === true) {
|
|
1710
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
|
|
1714
|
+
code: "invalid_format",
|
|
1715
|
+
format: "url",
|
|
1716
|
+
note: "Invalid hostname",
|
|
1717
|
+
pattern: def.hostname.source,
|
|
1718
|
+
input: payload.value,
|
|
1719
|
+
inst,
|
|
1720
|
+
continue: !def.abort
|
|
1721
|
+
});
|
|
1722
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
|
|
1723
|
+
code: "invalid_format",
|
|
1724
|
+
format: "url",
|
|
1725
|
+
note: "Invalid protocol",
|
|
1726
|
+
pattern: def.protocol.source,
|
|
1727
|
+
input: payload.value,
|
|
1728
|
+
inst,
|
|
1729
|
+
continue: !def.abort
|
|
1730
|
+
});
|
|
1731
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
1319
1732
|
return;
|
|
1320
1733
|
} catch (_) {
|
|
1321
1734
|
payload.issues.push({
|
|
@@ -1333,7 +1746,8 @@ window.__ModuleLoader__.load({
|
|
|
1333
1746
|
$ZodStringFormat.init(inst, def);
|
|
1334
1747
|
});
|
|
1335
1748
|
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
1336
|
-
def.
|
|
1749
|
+
if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
1750
|
+
def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
|
|
1337
1751
|
$ZodStringFormat.init(inst, def);
|
|
1338
1752
|
});
|
|
1339
1753
|
/**
|
|
@@ -1362,70 +1776,69 @@ window.__ModuleLoader__.load({
|
|
|
1362
1776
|
$ZodStringFormat.init(inst, def);
|
|
1363
1777
|
});
|
|
1364
1778
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1365
|
-
def.pattern ?? (def.pattern = datetime
|
|
1779
|
+
def.pattern ?? (def.pattern = datetime(def));
|
|
1366
1780
|
$ZodStringFormat.init(inst, def);
|
|
1367
1781
|
});
|
|
1368
1782
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1369
|
-
def.pattern ?? (def.pattern = date
|
|
1783
|
+
def.pattern ?? (def.pattern = date);
|
|
1370
1784
|
$ZodStringFormat.init(inst, def);
|
|
1371
1785
|
});
|
|
1372
1786
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1373
|
-
def.pattern ?? (def.pattern = time
|
|
1787
|
+
def.pattern ?? (def.pattern = time(def));
|
|
1374
1788
|
$ZodStringFormat.init(inst, def);
|
|
1375
1789
|
});
|
|
1376
1790
|
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
1377
|
-
def.pattern ?? (def.pattern = duration
|
|
1791
|
+
def.pattern ?? (def.pattern = duration);
|
|
1378
1792
|
$ZodStringFormat.init(inst, def);
|
|
1379
1793
|
});
|
|
1380
1794
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
1381
1795
|
def.pattern ?? (def.pattern = ipv4);
|
|
1382
1796
|
$ZodStringFormat.init(inst, def);
|
|
1383
|
-
inst._zod.bag.format = `ipv4`;
|
|
1384
1797
|
});
|
|
1798
|
+
/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
|
|
1799
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1800
|
+
function isValidIPv6(value) {
|
|
1801
|
+
if (!ipv6Alphabet.test(value)) return false;
|
|
1802
|
+
return canParseURL(`http://[${value}]`);
|
|
1803
|
+
}
|
|
1385
1804
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1386
1805
|
def.pattern ?? (def.pattern = ipv6);
|
|
1387
1806
|
$ZodStringFormat.init(inst, def);
|
|
1388
|
-
inst._zod.bag.format = `ipv6`;
|
|
1389
1807
|
inst._zod.check = (payload) => {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
payload.
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
inst,
|
|
1398
|
-
continue: !def.abort
|
|
1399
|
-
});
|
|
1400
|
-
}
|
|
1808
|
+
if (!isValidIPv6(payload.value)) payload.issues.push({
|
|
1809
|
+
code: "invalid_format",
|
|
1810
|
+
format: "ipv6",
|
|
1811
|
+
input: payload.value,
|
|
1812
|
+
inst,
|
|
1813
|
+
continue: !def.abort
|
|
1814
|
+
});
|
|
1401
1815
|
};
|
|
1402
1816
|
});
|
|
1403
1817
|
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1404
1818
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1405
1819
|
$ZodStringFormat.init(inst, def);
|
|
1406
1820
|
});
|
|
1821
|
+
function isValidCIDRv6(value) {
|
|
1822
|
+
const parts = value.split("/");
|
|
1823
|
+
if (parts.length !== 2) return false;
|
|
1824
|
+
const [address, prefix] = parts;
|
|
1825
|
+
if (!prefix) return false;
|
|
1826
|
+
const prefixNum = Number(prefix);
|
|
1827
|
+
if (`${prefixNum}` !== prefix) return false;
|
|
1828
|
+
if (prefixNum < 0 || prefixNum > 128) return false;
|
|
1829
|
+
return isValidIPv6(address);
|
|
1830
|
+
}
|
|
1407
1831
|
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1408
1832
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1409
1833
|
$ZodStringFormat.init(inst, def);
|
|
1410
1834
|
inst._zod.check = (payload) => {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1419
|
-
new URL(`http://[${address}]`);
|
|
1420
|
-
} catch {
|
|
1421
|
-
payload.issues.push({
|
|
1422
|
-
code: "invalid_format",
|
|
1423
|
-
format: "cidrv6",
|
|
1424
|
-
input: payload.value,
|
|
1425
|
-
inst,
|
|
1426
|
-
continue: !def.abort
|
|
1427
|
-
});
|
|
1428
|
-
}
|
|
1835
|
+
if (!isValidCIDRv6(payload.value)) payload.issues.push({
|
|
1836
|
+
code: "invalid_format",
|
|
1837
|
+
format: "cidrv6",
|
|
1838
|
+
input: payload.value,
|
|
1839
|
+
inst,
|
|
1840
|
+
continue: !def.abort
|
|
1841
|
+
});
|
|
1429
1842
|
};
|
|
1430
1843
|
});
|
|
1431
1844
|
function isValidBase64(data) {
|
|
@@ -1439,10 +1852,10 @@ window.__ModuleLoader__.load({
|
|
|
1439
1852
|
return false;
|
|
1440
1853
|
}
|
|
1441
1854
|
}
|
|
1855
|
+
const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
1442
1856
|
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
1443
|
-
def.pattern ?? (def.pattern =
|
|
1857
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
1444
1858
|
$ZodStringFormat.init(inst, def);
|
|
1445
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
1446
1859
|
inst._zod.check = (payload) => {
|
|
1447
1860
|
if (isValidBase64(payload.value)) return;
|
|
1448
1861
|
payload.issues.push({
|
|
@@ -1454,15 +1867,15 @@ window.__ModuleLoader__.load({
|
|
|
1454
1867
|
});
|
|
1455
1868
|
};
|
|
1456
1869
|
});
|
|
1870
|
+
const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
1457
1871
|
function isValidBase64URL(data) {
|
|
1458
|
-
if (!
|
|
1872
|
+
if (!base64urlCharset.test(data)) return false;
|
|
1459
1873
|
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1460
1874
|
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1461
1875
|
}
|
|
1462
1876
|
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1463
|
-
def.pattern ?? (def.pattern =
|
|
1877
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
1464
1878
|
$ZodStringFormat.init(inst, def);
|
|
1465
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
1466
1879
|
inst._zod.check = (payload) => {
|
|
1467
1880
|
if (isValidBase64URL(payload.value)) return;
|
|
1468
1881
|
payload.issues.push({
|
|
@@ -1508,14 +1921,14 @@ window.__ModuleLoader__.load({
|
|
|
1508
1921
|
});
|
|
1509
1922
|
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
1510
1923
|
$ZodType.init(inst, def);
|
|
1511
|
-
inst._zod.pattern =
|
|
1924
|
+
inst._zod.pattern = number$1;
|
|
1512
1925
|
inst._zod.parse = (payload, _ctx) => {
|
|
1513
1926
|
if (def.coerce) try {
|
|
1514
1927
|
payload.value = Number(payload.value);
|
|
1515
1928
|
} catch (_) {}
|
|
1516
1929
|
const input = payload.value;
|
|
1517
1930
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1518
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ?
|
|
1931
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
|
|
1519
1932
|
payload.issues.push({
|
|
1520
1933
|
expected: "number",
|
|
1521
1934
|
code: "invalid_type",
|
|
@@ -1586,6 +1999,8 @@ window.__ModuleLoader__.load({
|
|
|
1586
1999
|
}
|
|
1587
2000
|
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1588
2001
|
$ZodType.init(inst, def);
|
|
2002
|
+
const memo = globalConfig.memoizer;
|
|
2003
|
+
memo?.attach(inst);
|
|
1589
2004
|
inst._zod.parse = (payload, ctx) => {
|
|
1590
2005
|
const input = payload.value;
|
|
1591
2006
|
if (!Array.isArray(input)) {
|
|
@@ -1597,8 +2012,9 @@ window.__ModuleLoader__.load({
|
|
|
1597
2012
|
});
|
|
1598
2013
|
return payload;
|
|
1599
2014
|
}
|
|
1600
|
-
payload.value = Array(input.length);
|
|
2015
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1601
2016
|
const proms = [];
|
|
2017
|
+
const abortEarly = ctx?.abortEarly;
|
|
1602
2018
|
for (let i = 0; i < input.length; i++) {
|
|
1603
2019
|
const item = input[i];
|
|
1604
2020
|
const result = def.element._zod.run({
|
|
@@ -1606,19 +2022,24 @@ window.__ModuleLoader__.load({
|
|
|
1606
2022
|
issues: []
|
|
1607
2023
|
}, ctx);
|
|
1608
2024
|
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1609
|
-
else
|
|
2025
|
+
else {
|
|
2026
|
+
handleArrayResult(result, payload, i);
|
|
2027
|
+
if (abortEarly && result.issues.length !== 0 && aborted(result)) break;
|
|
2028
|
+
}
|
|
1610
2029
|
}
|
|
1611
2030
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1612
2031
|
return payload;
|
|
1613
2032
|
};
|
|
1614
2033
|
});
|
|
1615
|
-
function handlePropertyResult(result, final, key, input,
|
|
2034
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
1616
2035
|
const isPresent = key in input;
|
|
2036
|
+
const isOptionalOut = optout === "optional";
|
|
2037
|
+
if (!isPresent && isOptionalOut && optin === "optional") return;
|
|
1617
2038
|
if (result.issues.length) {
|
|
1618
|
-
if (
|
|
2039
|
+
if (optin !== void 0 && isOptionalOut && !isPresent) return;
|
|
1619
2040
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1620
2041
|
}
|
|
1621
|
-
if (!isPresent &&
|
|
2042
|
+
if (!isPresent && optin === void 0) {
|
|
1622
2043
|
if (!result.issues.length) final.issues.push({
|
|
1623
2044
|
code: "invalid_type",
|
|
1624
2045
|
expected: "nonoptional",
|
|
@@ -1628,31 +2049,44 @@ window.__ModuleLoader__.load({
|
|
|
1628
2049
|
return;
|
|
1629
2050
|
}
|
|
1630
2051
|
if (result.value === void 0) {
|
|
1631
|
-
if (isPresent) final.value[key] = void 0;
|
|
2052
|
+
if (isPresent || optin === "defaulted" && !isOptionalOut) final.value[key] = void 0;
|
|
1632
2053
|
} else final.value[key] = result.value;
|
|
1633
2054
|
}
|
|
2055
|
+
const NO_SYMBOL_KEYS = [];
|
|
1634
2056
|
function normalizeDef(def) {
|
|
1635
2057
|
const keys = Object.keys(def.shape);
|
|
1636
|
-
|
|
2058
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
2059
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
2060
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
2061
|
+
for (const k of allKeys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
1637
2062
|
const okeys = optionalKeys(def.shape);
|
|
1638
2063
|
return {
|
|
1639
2064
|
...def,
|
|
1640
|
-
|
|
2065
|
+
allKeys,
|
|
2066
|
+
symbolKeys,
|
|
1641
2067
|
keySet: new Set(keys),
|
|
1642
2068
|
numKeys: keys.length,
|
|
1643
2069
|
optionalKeys: new Set(okeys)
|
|
1644
2070
|
};
|
|
1645
2071
|
}
|
|
1646
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
2072
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
1647
2073
|
const unrecognized = [];
|
|
1648
2074
|
const keySet = def.keySet;
|
|
1649
2075
|
const _catchall = def.catchall._zod;
|
|
1650
2076
|
const t = _catchall.def.type;
|
|
1651
|
-
const
|
|
1652
|
-
const
|
|
2077
|
+
const optin = _catchall.optin;
|
|
2078
|
+
const optout = _catchall.optout;
|
|
2079
|
+
let seen = 0;
|
|
1653
2080
|
for (const key in input) {
|
|
1654
|
-
if (
|
|
2081
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2082
|
+
if (aborted(payload, seen)) break;
|
|
2083
|
+
seen = payload.issues.length;
|
|
2084
|
+
}
|
|
1655
2085
|
if (keySet.has(key)) continue;
|
|
2086
|
+
if (key === "__proto__") {
|
|
2087
|
+
if (t === "never") unrecognized.push(key);
|
|
2088
|
+
continue;
|
|
2089
|
+
}
|
|
1656
2090
|
if (t === "never") {
|
|
1657
2091
|
unrecognized.push(key);
|
|
1658
2092
|
continue;
|
|
@@ -1661,14 +2095,15 @@ window.__ModuleLoader__.load({
|
|
|
1661
2095
|
value: input[key],
|
|
1662
2096
|
issues: []
|
|
1663
2097
|
}, ctx);
|
|
1664
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1665
|
-
else handlePropertyResult(r, payload, key, input,
|
|
2098
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
2099
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1666
2100
|
}
|
|
1667
2101
|
if (unrecognized.length) payload.issues.push({
|
|
1668
2102
|
code: "unrecognized_keys",
|
|
1669
2103
|
keys: unrecognized,
|
|
1670
2104
|
input,
|
|
1671
|
-
inst
|
|
2105
|
+
inst,
|
|
2106
|
+
continue: true
|
|
1672
2107
|
});
|
|
1673
2108
|
if (!proms.length) return payload;
|
|
1674
2109
|
return Promise.all(proms).then(() => {
|
|
@@ -1677,34 +2112,41 @@ window.__ModuleLoader__.load({
|
|
|
1677
2112
|
}
|
|
1678
2113
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1679
2114
|
$ZodType.init(inst, def);
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
2115
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
2116
|
+
const sh = desc?.get ? desc.get.raw : def.shape ?? {};
|
|
2117
|
+
if (sh) {
|
|
2118
|
+
const get = () => {
|
|
1683
2119
|
const newSh = { ...sh };
|
|
1684
2120
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
2121
|
+
get.raw = newSh;
|
|
1685
2122
|
return newSh;
|
|
1686
|
-
}
|
|
2123
|
+
};
|
|
2124
|
+
get.raw = sh;
|
|
2125
|
+
Object.defineProperty(def, "shape", { get });
|
|
1687
2126
|
}
|
|
1688
2127
|
const _normalized = cached(() => normalizeDef(def));
|
|
1689
|
-
|
|
1690
|
-
const shape = def.shape;
|
|
2128
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
2129
|
+
const shape = zod.def.shape;
|
|
1691
2130
|
const propValues = {};
|
|
1692
2131
|
for (const key in shape) {
|
|
1693
2132
|
const field = shape[key]._zod;
|
|
1694
2133
|
if (field.values) {
|
|
1695
|
-
propValues
|
|
2134
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
1696
2135
|
for (const v of field.values) propValues[key].add(v);
|
|
2136
|
+
if (field.optin !== void 0) propValues[key].add(void 0);
|
|
1697
2137
|
}
|
|
1698
2138
|
}
|
|
1699
2139
|
return propValues;
|
|
1700
2140
|
});
|
|
1701
|
-
const isObject$
|
|
2141
|
+
const isObject$2 = isObject;
|
|
1702
2142
|
const catchall = def.catchall;
|
|
1703
2143
|
let value;
|
|
2144
|
+
const memo = globalConfig.memoizer;
|
|
2145
|
+
memo?.attach(inst);
|
|
1704
2146
|
inst._zod.parse = (payload, ctx) => {
|
|
1705
2147
|
value ?? (value = _normalized.value);
|
|
1706
2148
|
const input = payload.value;
|
|
1707
|
-
if (!isObject$
|
|
2149
|
+
if (!isObject$2(input)) {
|
|
1708
2150
|
payload.issues.push({
|
|
1709
2151
|
expected: "object",
|
|
1710
2152
|
code: "invalid_type",
|
|
@@ -1713,77 +2155,90 @@ window.__ModuleLoader__.load({
|
|
|
1713
2155
|
});
|
|
1714
2156
|
return payload;
|
|
1715
2157
|
}
|
|
1716
|
-
payload.value = {};
|
|
2158
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1717
2159
|
const proms = [];
|
|
1718
2160
|
const shape = value.shape;
|
|
1719
|
-
|
|
2161
|
+
const abortEarly = ctx?.abortEarly;
|
|
2162
|
+
let seen = payload.issues.length;
|
|
2163
|
+
for (const key of value.allKeys) {
|
|
2164
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2165
|
+
if (aborted(payload, seen)) break;
|
|
2166
|
+
seen = payload.issues.length;
|
|
2167
|
+
}
|
|
2168
|
+
if (key === "__proto__") continue;
|
|
1720
2169
|
const el = shape[key];
|
|
1721
|
-
const
|
|
1722
|
-
const
|
|
2170
|
+
const optin = el._zod.optin;
|
|
2171
|
+
const optout = el._zod.optout;
|
|
1723
2172
|
const r = el._zod.run({
|
|
1724
2173
|
value: input[key],
|
|
1725
2174
|
issues: []
|
|
1726
2175
|
}, ctx);
|
|
1727
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1728
|
-
else handlePropertyResult(r, payload, key, input,
|
|
2176
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
2177
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1729
2178
|
}
|
|
1730
2179
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1731
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2180
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
1732
2181
|
};
|
|
1733
2182
|
});
|
|
1734
2183
|
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
1735
2184
|
$ZodObject.init(inst, def);
|
|
1736
2185
|
const superParse = inst._zod.parse;
|
|
1737
2186
|
const _normalized = cached(() => normalizeDef(def));
|
|
2187
|
+
const memo = globalConfig.memoizer;
|
|
1738
2188
|
const generateFastpass = (shape) => {
|
|
1739
|
-
const doc = new Doc([
|
|
1740
|
-
"shape",
|
|
1741
|
-
"payload",
|
|
1742
|
-
"ctx"
|
|
1743
|
-
]);
|
|
1744
2189
|
const normalized = _normalized.value;
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
2190
|
+
const syms = normalized.symbolKeys;
|
|
2191
|
+
const doc = new Doc(["payload", "ctx"], {
|
|
2192
|
+
shape,
|
|
2193
|
+
inst,
|
|
2194
|
+
memo,
|
|
2195
|
+
syms
|
|
2196
|
+
});
|
|
2197
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2198
|
+
const prefixStr = (id, k) => `
|
|
2199
|
+
let ${id}_ab = false;
|
|
2200
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
2201
|
+
const iss = ${id}.issues[i];
|
|
2202
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
2203
|
+
payload.issues.push(iss);
|
|
2204
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
2205
|
+
}
|
|
2206
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
2207
|
+
payload.value = newResult;
|
|
2208
|
+
return payload;
|
|
2209
|
+
}`;
|
|
1749
2210
|
doc.write(`const input = payload.value;`);
|
|
1750
2211
|
const ids = Object.create(null);
|
|
1751
2212
|
let counter = 0;
|
|
1752
|
-
for (const key of normalized.
|
|
1753
|
-
doc.write(`const newResult = {};`);
|
|
1754
|
-
for (const key of normalized.
|
|
2213
|
+
for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
|
|
2214
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
2215
|
+
for (const key of normalized.allKeys) {
|
|
2216
|
+
if (key === "__proto__") continue;
|
|
1755
2217
|
const id = ids[key];
|
|
1756
|
-
const k = esc(key);
|
|
2218
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
2219
|
+
const isPresent = `${k} in input`;
|
|
1757
2220
|
const schema = shape[key];
|
|
1758
|
-
const
|
|
2221
|
+
const optin = schema?._zod?.optin;
|
|
2222
|
+
const isOptionalIn = optin !== void 0;
|
|
1759
2223
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1760
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1761
|
-
if (isOptionalIn && isOptionalOut)
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
})));
|
|
2224
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
2225
|
+
if (isOptionalIn && isOptionalOut) {
|
|
2226
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
2227
|
+
doc.write(`
|
|
2228
|
+
const ${id}_present = ${isPresent};
|
|
2229
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
2230
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1768
2231
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
if (${k} in input) {
|
|
1773
|
-
newResult[${k}] = undefined;
|
|
2232
|
+
|
|
2233
|
+
if (${assign}) {
|
|
2234
|
+
newResult[${k}] = ${id}.value;
|
|
1774
2235
|
}
|
|
1775
|
-
} else {
|
|
1776
|
-
newResult[${k}] = ${id}.value;
|
|
1777
2236
|
}
|
|
1778
|
-
|
|
2237
|
+
|
|
1779
2238
|
`);
|
|
1780
|
-
else if (!isOptionalIn) doc.write(`
|
|
1781
|
-
const ${id}_present = ${
|
|
1782
|
-
if (${id}.issues.length) {
|
|
1783
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1784
|
-
...iss,
|
|
1785
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1786
|
-
})));
|
|
2239
|
+
} else if (!isOptionalIn) doc.write(`
|
|
2240
|
+
const ${id}_present = ${isPresent};
|
|
2241
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1787
2242
|
}
|
|
1788
2243
|
if (!${id}_present && !${id}.issues.length) {
|
|
1789
2244
|
payload.issues.push({
|
|
@@ -1792,42 +2247,36 @@ window.__ModuleLoader__.load({
|
|
|
1792
2247
|
input: undefined,
|
|
1793
2248
|
path: [${k}]
|
|
1794
2249
|
});
|
|
2250
|
+
if (ctx && ctx.abortEarly) {
|
|
2251
|
+
payload.value = newResult;
|
|
2252
|
+
return payload;
|
|
2253
|
+
}
|
|
1795
2254
|
}
|
|
1796
2255
|
|
|
1797
2256
|
if (${id}_present) {
|
|
1798
|
-
|
|
1799
|
-
newResult[${k}] = undefined;
|
|
1800
|
-
} else {
|
|
1801
|
-
newResult[${k}] = ${id}.value;
|
|
1802
|
-
}
|
|
2257
|
+
newResult[${k}] = ${id}.value;
|
|
1803
2258
|
}
|
|
1804
2259
|
|
|
1805
2260
|
`);
|
|
1806
|
-
else
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
...iss,
|
|
1810
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1811
|
-
})));
|
|
2261
|
+
else {
|
|
2262
|
+
doc.write(`
|
|
2263
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1812
2264
|
}
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
}
|
|
1818
|
-
} else {
|
|
2265
|
+
`);
|
|
2266
|
+
if (optin === "defaulted") doc.write(`newResult[${k}] = ${id}.value;`);
|
|
2267
|
+
else doc.write(`
|
|
2268
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
1819
2269
|
newResult[${k}] = ${id}.value;
|
|
1820
2270
|
}
|
|
1821
|
-
|
|
1822
2271
|
`);
|
|
2272
|
+
}
|
|
1823
2273
|
}
|
|
1824
2274
|
doc.write(`payload.value = newResult;`);
|
|
1825
2275
|
doc.write(`return payload;`);
|
|
1826
|
-
|
|
1827
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2276
|
+
return doc.compile();
|
|
1828
2277
|
};
|
|
1829
2278
|
let fastpass;
|
|
1830
|
-
const isObject$
|
|
2279
|
+
const isObject$1 = isObject;
|
|
1831
2280
|
const jit = !globalConfig.jitless;
|
|
1832
2281
|
const fastEnabled = jit && allowsEval.value;
|
|
1833
2282
|
const catchall = def.catchall;
|
|
@@ -1835,7 +2284,7 @@ window.__ModuleLoader__.load({
|
|
|
1835
2284
|
inst._zod.parse = (payload, ctx) => {
|
|
1836
2285
|
value ?? (value = _normalized.value);
|
|
1837
2286
|
const input = payload.value;
|
|
1838
|
-
if (!isObject$
|
|
2287
|
+
if (!isObject$1(input)) {
|
|
1839
2288
|
payload.issues.push({
|
|
1840
2289
|
expected: "object",
|
|
1841
2290
|
code: "invalid_type",
|
|
@@ -1848,7 +2297,7 @@ window.__ModuleLoader__.load({
|
|
|
1848
2297
|
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
1849
2298
|
payload = fastpass(payload, ctx);
|
|
1850
2299
|
if (!catchall) return payload;
|
|
1851
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
2300
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
1852
2301
|
}
|
|
1853
2302
|
return superParse(payload, ctx);
|
|
1854
2303
|
};
|
|
@@ -1873,14 +2322,14 @@ window.__ModuleLoader__.load({
|
|
|
1873
2322
|
}
|
|
1874
2323
|
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
1875
2324
|
$ZodType.init(inst, def);
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1880
|
-
});
|
|
1881
|
-
|
|
1882
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1883
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
2325
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0);
|
|
2326
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
2327
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2328
|
+
if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2329
|
+
});
|
|
2330
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2331
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
2332
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1884
2333
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1885
2334
|
}
|
|
1886
2335
|
});
|
|
@@ -1942,7 +2391,9 @@ window.__ModuleLoader__.load({
|
|
|
1942
2391
|
...a,
|
|
1943
2392
|
...b
|
|
1944
2393
|
};
|
|
2394
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
|
|
1945
2395
|
for (const key of sharedKeys) {
|
|
2396
|
+
if (key === "__proto__") continue;
|
|
1946
2397
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1947
2398
|
if (!sharedValue.valid) return {
|
|
1948
2399
|
valid: false,
|
|
@@ -1984,26 +2435,39 @@ window.__ModuleLoader__.load({
|
|
|
1984
2435
|
function handleIntersectionResults(result, left, right) {
|
|
1985
2436
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1986
2437
|
let unrecIssue;
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
2438
|
+
const keyIssues = /* @__PURE__ */ new Map();
|
|
2439
|
+
const collect = (iss, side) => {
|
|
2440
|
+
let keys;
|
|
2441
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
2442
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
2443
|
+
keys = iss.keys;
|
|
2444
|
+
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
2445
|
+
const k = String(iss.path[0]);
|
|
2446
|
+
if (!keyIssues.has(k)) keyIssues.set(k, iss);
|
|
2447
|
+
keys = [k];
|
|
2448
|
+
} else return false;
|
|
2449
|
+
for (const k of keys) {
|
|
1990
2450
|
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1991
|
-
unrecKeys.get(k)
|
|
2451
|
+
unrecKeys.get(k)[side] = true;
|
|
1992
2452
|
}
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
}
|
|
1998
|
-
else result.issues.push(iss);
|
|
2453
|
+
return true;
|
|
2454
|
+
};
|
|
2455
|
+
for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
|
|
2456
|
+
for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
|
|
1999
2457
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
2000
|
-
if (bothKeys.length
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2458
|
+
if (bothKeys.length) {
|
|
2459
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
2460
|
+
if (aggregated.length) result.issues.push({
|
|
2461
|
+
...unrecIssue,
|
|
2462
|
+
keys: aggregated
|
|
2463
|
+
});
|
|
2464
|
+
for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
|
|
2465
|
+
}
|
|
2005
2466
|
const merged = mergeValues(left.value, right.value);
|
|
2006
|
-
if (!merged.valid)
|
|
2467
|
+
if (!merged.valid) {
|
|
2468
|
+
if (aborted(result)) return result;
|
|
2469
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2470
|
+
}
|
|
2007
2471
|
result.value = merged.data;
|
|
2008
2472
|
return result;
|
|
2009
2473
|
}
|
|
@@ -2012,7 +2476,10 @@ window.__ModuleLoader__.load({
|
|
|
2012
2476
|
const values = getEnumValues(def.entries);
|
|
2013
2477
|
const valuesSet = new Set(values);
|
|
2014
2478
|
inst._zod.values = valuesSet;
|
|
2015
|
-
inst
|
|
2479
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2480
|
+
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
2481
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2482
|
+
});
|
|
2016
2483
|
inst._zod.parse = (payload, _ctx) => {
|
|
2017
2484
|
const input = payload.value;
|
|
2018
2485
|
if (valuesSet.has(input)) return payload;
|
|
@@ -2027,10 +2494,12 @@ window.__ModuleLoader__.load({
|
|
|
2027
2494
|
});
|
|
2028
2495
|
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
2029
2496
|
$ZodType.init(inst, def);
|
|
2030
|
-
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
2031
2497
|
const values = new Set(def.values);
|
|
2032
2498
|
inst._zod.values = values;
|
|
2033
|
-
inst
|
|
2499
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2500
|
+
const vals = zod.def.values;
|
|
2501
|
+
return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
|
|
2502
|
+
});
|
|
2034
2503
|
inst._zod.parse = (payload, _ctx) => {
|
|
2035
2504
|
const input = payload.value;
|
|
2036
2505
|
if (values.has(input)) return payload;
|
|
@@ -2046,67 +2515,66 @@ window.__ModuleLoader__.load({
|
|
|
2046
2515
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
2047
2516
|
$ZodType.init(inst, def);
|
|
2048
2517
|
inst._zod.optin = "optional";
|
|
2518
|
+
globalConfig.memoizer?.guard(inst);
|
|
2049
2519
|
inst._zod.parse = (payload, ctx) => {
|
|
2050
2520
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2051
2521
|
const _out = def.transform(payload.value, payload);
|
|
2052
2522
|
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
2053
2523
|
payload.value = output;
|
|
2054
|
-
payload.fallback = true;
|
|
2055
2524
|
return payload;
|
|
2056
2525
|
});
|
|
2057
2526
|
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
2058
2527
|
payload.value = _out;
|
|
2059
|
-
payload.fallback = true;
|
|
2060
2528
|
return payload;
|
|
2061
2529
|
};
|
|
2062
2530
|
});
|
|
2063
|
-
function handleOptionalResult(
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
value: void 0
|
|
2067
|
-
};
|
|
2068
|
-
return result;
|
|
2531
|
+
function handleOptionalResult(payload, result) {
|
|
2532
|
+
payload.value = result.issues.length ? void 0 : result.value;
|
|
2533
|
+
return payload;
|
|
2069
2534
|
}
|
|
2070
2535
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2071
2536
|
$ZodType.init(inst, def);
|
|
2072
|
-
inst._zod.optin
|
|
2537
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2073
2538
|
inst._zod.optout = "optional";
|
|
2074
|
-
|
|
2075
|
-
|
|
2539
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2540
|
+
const values = zod.def.innerType._zod.values;
|
|
2541
|
+
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
2076
2542
|
});
|
|
2077
|
-
|
|
2078
|
-
const pattern = def.innerType._zod.pattern;
|
|
2543
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2544
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2079
2545
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2080
2546
|
});
|
|
2081
2547
|
inst._zod.parse = (payload, ctx) => {
|
|
2082
|
-
if (
|
|
2083
|
-
|
|
2084
|
-
const result = def.innerType._zod.run(
|
|
2085
|
-
|
|
2086
|
-
|
|
2548
|
+
if (payload.value === void 0) {
|
|
2549
|
+
if (def.innerType._zod.optin !== "defaulted") return payload;
|
|
2550
|
+
const result = def.innerType._zod.run({
|
|
2551
|
+
value: payload.value,
|
|
2552
|
+
issues: []
|
|
2553
|
+
}, ctx);
|
|
2554
|
+
if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
|
|
2555
|
+
return handleOptionalResult(payload, result);
|
|
2087
2556
|
}
|
|
2088
|
-
if (payload.value === void 0) return payload;
|
|
2089
2557
|
return def.innerType._zod.run(payload, ctx);
|
|
2090
2558
|
};
|
|
2091
2559
|
});
|
|
2092
2560
|
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2093
2561
|
$ZodOptional.init(inst, def);
|
|
2094
|
-
|
|
2095
|
-
|
|
2562
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2563
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
2096
2564
|
inst._zod.parse = (payload, ctx) => {
|
|
2097
2565
|
return def.innerType._zod.run(payload, ctx);
|
|
2098
2566
|
};
|
|
2099
2567
|
});
|
|
2100
2568
|
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
2101
2569
|
$ZodType.init(inst, def);
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
const pattern = def.innerType._zod.pattern;
|
|
2570
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2571
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2572
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2573
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2106
2574
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2107
2575
|
});
|
|
2108
|
-
|
|
2109
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2576
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2577
|
+
return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
|
|
2110
2578
|
});
|
|
2111
2579
|
inst._zod.parse = (payload, ctx) => {
|
|
2112
2580
|
if (payload.value === null) return payload;
|
|
@@ -2115,8 +2583,8 @@ window.__ModuleLoader__.load({
|
|
|
2115
2583
|
});
|
|
2116
2584
|
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
2117
2585
|
$ZodType.init(inst, def);
|
|
2118
|
-
inst._zod.optin = "
|
|
2119
|
-
|
|
2586
|
+
inst._zod.optin = "defaulted";
|
|
2587
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2120
2588
|
inst._zod.parse = (payload, ctx) => {
|
|
2121
2589
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2122
2590
|
if (payload.value === void 0) {
|
|
@@ -2137,8 +2605,8 @@ window.__ModuleLoader__.load({
|
|
|
2137
2605
|
}
|
|
2138
2606
|
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
2139
2607
|
$ZodType.init(inst, def);
|
|
2140
|
-
inst._zod.optin = "
|
|
2141
|
-
|
|
2608
|
+
inst._zod.optin = "defaulted";
|
|
2609
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2142
2610
|
inst._zod.parse = (payload, ctx) => {
|
|
2143
2611
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2144
2612
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
@@ -2147,8 +2615,8 @@ window.__ModuleLoader__.load({
|
|
|
2147
2615
|
});
|
|
2148
2616
|
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2149
2617
|
$ZodType.init(inst, def);
|
|
2150
|
-
|
|
2151
|
-
const v = def.innerType._zod.values;
|
|
2618
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2619
|
+
const v = zod.def.innerType._zod.values;
|
|
2152
2620
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2153
2621
|
});
|
|
2154
2622
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2166,46 +2634,41 @@ window.__ModuleLoader__.load({
|
|
|
2166
2634
|
});
|
|
2167
2635
|
return payload;
|
|
2168
2636
|
}
|
|
2637
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2638
|
+
if (!result.issues.length) {
|
|
2639
|
+
payload.value = result.value;
|
|
2640
|
+
if (result.memo) payload.memo = true;
|
|
2641
|
+
return payload;
|
|
2642
|
+
}
|
|
2643
|
+
payload.value = def.catchValue({
|
|
2644
|
+
...result,
|
|
2645
|
+
value: payload.value,
|
|
2646
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2647
|
+
input: payload.value
|
|
2648
|
+
});
|
|
2649
|
+
return payload;
|
|
2650
|
+
}
|
|
2169
2651
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2170
2652
|
$ZodType.init(inst, def);
|
|
2171
|
-
inst._zod.optin
|
|
2172
|
-
|
|
2173
|
-
|
|
2653
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2654
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2655
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2174
2656
|
inst._zod.parse = (payload, ctx) => {
|
|
2175
2657
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2176
|
-
const result = def.innerType._zod.run(
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2183
|
-
input: payload.value
|
|
2184
|
-
});
|
|
2185
|
-
payload.issues = [];
|
|
2186
|
-
payload.fallback = true;
|
|
2187
|
-
}
|
|
2188
|
-
return payload;
|
|
2189
|
-
});
|
|
2190
|
-
payload.value = result.value;
|
|
2191
|
-
if (result.issues.length) {
|
|
2192
|
-
payload.value = def.catchValue({
|
|
2193
|
-
...payload,
|
|
2194
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2195
|
-
input: payload.value
|
|
2196
|
-
});
|
|
2197
|
-
payload.issues = [];
|
|
2198
|
-
payload.fallback = true;
|
|
2199
|
-
}
|
|
2200
|
-
return payload;
|
|
2658
|
+
const result = def.innerType._zod.run({
|
|
2659
|
+
value: payload.value,
|
|
2660
|
+
issues: []
|
|
2661
|
+
}, ctx);
|
|
2662
|
+
if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
2663
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
2201
2664
|
};
|
|
2202
2665
|
});
|
|
2203
2666
|
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2204
2667
|
$ZodType.init(inst, def);
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2668
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2669
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2670
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2671
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2209
2672
|
inst._zod.parse = (payload, ctx) => {
|
|
2210
2673
|
if (ctx.direction === "backward") {
|
|
2211
2674
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -2218,22 +2681,21 @@ window.__ModuleLoader__.load({
|
|
|
2218
2681
|
};
|
|
2219
2682
|
});
|
|
2220
2683
|
function handlePipeResult(left, next, ctx) {
|
|
2221
|
-
if (left.issues.
|
|
2684
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2222
2685
|
left.aborted = true;
|
|
2223
2686
|
return left;
|
|
2224
2687
|
}
|
|
2225
2688
|
return next._zod.run({
|
|
2226
2689
|
value: left.value,
|
|
2227
|
-
issues: left.issues
|
|
2228
|
-
fallback: left.fallback
|
|
2690
|
+
issues: left.issues
|
|
2229
2691
|
}, ctx);
|
|
2230
2692
|
}
|
|
2231
2693
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2232
2694
|
$ZodType.init(inst, def);
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2695
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2696
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2697
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2698
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2237
2699
|
inst._zod.parse = (payload, ctx) => {
|
|
2238
2700
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2239
2701
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -2242,37 +2704,398 @@ window.__ModuleLoader__.load({
|
|
|
2242
2704
|
};
|
|
2243
2705
|
});
|
|
2244
2706
|
function handleReadonlyResult(payload) {
|
|
2245
|
-
payload.value = Object.freeze(payload.value);
|
|
2707
|
+
if (!payload.memo) payload.value = Object.freeze(payload.value);
|
|
2246
2708
|
return payload;
|
|
2247
2709
|
}
|
|
2248
|
-
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2249
|
-
$ZodCheck.init(inst, def);
|
|
2250
|
-
$ZodType.init(inst, def);
|
|
2251
|
-
inst._zod.parse = (payload, _) => {
|
|
2252
|
-
return payload;
|
|
2710
|
+
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2711
|
+
$ZodCheck.init(inst, def);
|
|
2712
|
+
$ZodType.init(inst, def);
|
|
2713
|
+
inst._zod.parse = (payload, _) => {
|
|
2714
|
+
return payload;
|
|
2715
|
+
};
|
|
2716
|
+
inst._zod.check = (payload) => {
|
|
2717
|
+
const input = payload.value;
|
|
2718
|
+
const r = def.fn(input);
|
|
2719
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2720
|
+
handleRefineResult(r, payload, input, inst);
|
|
2721
|
+
};
|
|
2722
|
+
});
|
|
2723
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
2724
|
+
if (!result) {
|
|
2725
|
+
const _iss = {
|
|
2726
|
+
code: "custom",
|
|
2727
|
+
input,
|
|
2728
|
+
inst,
|
|
2729
|
+
path: [...inst._zod.def.path ?? []],
|
|
2730
|
+
continue: !inst._zod.def.abort
|
|
2731
|
+
};
|
|
2732
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2733
|
+
payload.issues.push(issue(_iss));
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
//#endregion
|
|
2737
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
|
|
2738
|
+
var $ZodCyclicError = class extends Error {
|
|
2739
|
+
constructor() {
|
|
2740
|
+
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
2741
|
+
this.name = "ZodCyclicError";
|
|
2742
|
+
}
|
|
2743
|
+
};
|
|
2744
|
+
/** Keyed off the context object every schema in one parse call already shares. */
|
|
2745
|
+
const STATE = "~memo";
|
|
2746
|
+
const NO_ISSUES = [];
|
|
2747
|
+
function isRef(value) {
|
|
2748
|
+
return value !== null && typeof value === "object";
|
|
2749
|
+
}
|
|
2750
|
+
function cloneIssues(issues) {
|
|
2751
|
+
return issues.map((iss) => iss.path ? {
|
|
2752
|
+
...iss,
|
|
2753
|
+
path: iss.path.slice()
|
|
2754
|
+
} : { ...iss });
|
|
2755
|
+
}
|
|
2756
|
+
const recursive = /*@__PURE__*/ new WeakMap();
|
|
2757
|
+
/** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
|
|
2758
|
+
const NONE = 0;
|
|
2759
|
+
const ASSUMED = 1;
|
|
2760
|
+
const PROVEN = 2;
|
|
2761
|
+
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
2762
|
+
function isRecursive(inst, stack, resolve) {
|
|
2763
|
+
const cached = recursive.get(inst);
|
|
2764
|
+
if (cached !== void 0) return cached ? PROVEN : NONE;
|
|
2765
|
+
if (stack.has(inst)) return PROVEN;
|
|
2766
|
+
stack.add(inst);
|
|
2767
|
+
let result = NONE;
|
|
2768
|
+
const check = (child) => {
|
|
2769
|
+
if (result !== PROVEN && child?._zod) {
|
|
2770
|
+
const answer = isRecursive(child, stack, resolve);
|
|
2771
|
+
if (answer > result) result = answer;
|
|
2772
|
+
}
|
|
2773
|
+
};
|
|
2774
|
+
const shape = (sh, spread) => {
|
|
2775
|
+
let answer = NONE;
|
|
2776
|
+
for (const key of Reflect.ownKeys(sh)) {
|
|
2777
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
2778
|
+
if (spread && !desc.enumerable) continue;
|
|
2779
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
2780
|
+
if (child > answer) answer = child;
|
|
2781
|
+
}
|
|
2782
|
+
return answer;
|
|
2783
|
+
};
|
|
2784
|
+
const merge = (answer) => {
|
|
2785
|
+
if (answer > result) result = answer;
|
|
2786
|
+
};
|
|
2787
|
+
const def = inst._zod.def;
|
|
2788
|
+
switch (def.type) {
|
|
2789
|
+
case "object": {
|
|
2790
|
+
const raw = rawShape(def);
|
|
2791
|
+
merge(raw ? shape(raw, true) : ASSUMED);
|
|
2792
|
+
check(def.catchall);
|
|
2793
|
+
break;
|
|
2794
|
+
}
|
|
2795
|
+
case "array":
|
|
2796
|
+
check(def.element);
|
|
2797
|
+
break;
|
|
2798
|
+
case "tuple":
|
|
2799
|
+
for (const el of def.items) check(el);
|
|
2800
|
+
check(def.rest);
|
|
2801
|
+
break;
|
|
2802
|
+
case "record":
|
|
2803
|
+
case "map":
|
|
2804
|
+
check(def.keyType);
|
|
2805
|
+
check(def.valueType);
|
|
2806
|
+
break;
|
|
2807
|
+
case "set":
|
|
2808
|
+
check(def.valueType);
|
|
2809
|
+
break;
|
|
2810
|
+
case "union":
|
|
2811
|
+
for (const el of def.options) check(el);
|
|
2812
|
+
break;
|
|
2813
|
+
case "intersection":
|
|
2814
|
+
check(def.left);
|
|
2815
|
+
check(def.right);
|
|
2816
|
+
break;
|
|
2817
|
+
case "optional":
|
|
2818
|
+
case "nullable":
|
|
2819
|
+
case "default":
|
|
2820
|
+
case "prefault":
|
|
2821
|
+
case "catch":
|
|
2822
|
+
case "readonly":
|
|
2823
|
+
case "nonoptional":
|
|
2824
|
+
case "promise":
|
|
2825
|
+
case "success":
|
|
2826
|
+
check(def.innerType);
|
|
2827
|
+
break;
|
|
2828
|
+
case "pipe":
|
|
2829
|
+
check(def.in);
|
|
2830
|
+
check(def.out);
|
|
2831
|
+
break;
|
|
2832
|
+
case "function":
|
|
2833
|
+
check(def.input);
|
|
2834
|
+
check(def.output);
|
|
2835
|
+
break;
|
|
2836
|
+
case "lazy": {
|
|
2837
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
|
|
2838
|
+
merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
2839
|
+
break;
|
|
2840
|
+
}
|
|
2841
|
+
case "template_literal":
|
|
2842
|
+
case "string":
|
|
2843
|
+
case "number":
|
|
2844
|
+
case "int":
|
|
2845
|
+
case "boolean":
|
|
2846
|
+
case "bigint":
|
|
2847
|
+
case "symbol":
|
|
2848
|
+
case "undefined":
|
|
2849
|
+
case "null":
|
|
2850
|
+
case "void":
|
|
2851
|
+
case "never":
|
|
2852
|
+
case "any":
|
|
2853
|
+
case "unknown":
|
|
2854
|
+
case "date":
|
|
2855
|
+
case "nan":
|
|
2856
|
+
case "enum":
|
|
2857
|
+
case "literal":
|
|
2858
|
+
case "file":
|
|
2859
|
+
case "transform":
|
|
2860
|
+
case "custom": break;
|
|
2861
|
+
default: for (const key in def) {
|
|
2862
|
+
const desc = Object.getOwnPropertyDescriptor(def, key);
|
|
2863
|
+
if (!desc || desc.get) continue;
|
|
2864
|
+
const value = desc.value;
|
|
2865
|
+
if (!value || typeof value !== "object") continue;
|
|
2866
|
+
if (value._zod) check(value);
|
|
2867
|
+
else if (Array.isArray(value)) for (const el of value) check(el);
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
stack.delete(inst);
|
|
2871
|
+
return settle(inst, result);
|
|
2872
|
+
}
|
|
2873
|
+
/** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
|
|
2874
|
+
function settle(inst, answer) {
|
|
2875
|
+
if (answer !== ASSUMED) recursive.set(inst, answer === PROVEN);
|
|
2876
|
+
return answer;
|
|
2877
|
+
}
|
|
2878
|
+
function bucketFor(state, inst) {
|
|
2879
|
+
let bucket = state.buckets.get(inst);
|
|
2880
|
+
if (!bucket) {
|
|
2881
|
+
bucket = /* @__PURE__ */ new WeakMap();
|
|
2882
|
+
state.buckets.set(inst, bucket);
|
|
2883
|
+
}
|
|
2884
|
+
return bucket;
|
|
2885
|
+
}
|
|
2886
|
+
let handoff;
|
|
2887
|
+
const open = [];
|
|
2888
|
+
const memo = {
|
|
2889
|
+
alloc(_inst, payload, empty) {
|
|
2890
|
+
const bucket = handoff;
|
|
2891
|
+
if (!bucket) return empty;
|
|
2892
|
+
handoff = void 0;
|
|
2893
|
+
const entry = {
|
|
2894
|
+
value: empty,
|
|
2895
|
+
issues: null
|
|
2896
|
+
};
|
|
2897
|
+
bucket.set(payload.value, entry);
|
|
2898
|
+
open.push(entry);
|
|
2899
|
+
return empty;
|
|
2900
|
+
},
|
|
2901
|
+
guard(inst) {
|
|
2902
|
+
var _a;
|
|
2903
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2904
|
+
inst._zod.deferred.push(() => {
|
|
2905
|
+
const base = inst._zod.parse;
|
|
2906
|
+
const wrapped = (payload, ctx) => {
|
|
2907
|
+
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
|
|
2908
|
+
return base(payload, ctx);
|
|
2909
|
+
};
|
|
2910
|
+
inst._zod.parse = wrapped;
|
|
2911
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2912
|
+
});
|
|
2913
|
+
},
|
|
2914
|
+
attach(inst) {
|
|
2915
|
+
var _a;
|
|
2916
|
+
let isRecursiveInst;
|
|
2917
|
+
let rechecked = false;
|
|
2918
|
+
let lastCtx;
|
|
2919
|
+
let lastBucket;
|
|
2920
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2921
|
+
inst._zod.deferred.push(() => {
|
|
2922
|
+
const base = inst._zod.parse;
|
|
2923
|
+
const wrapped = (payload, ctx) => {
|
|
2924
|
+
if (isRecursiveInst === void 0) {
|
|
2925
|
+
const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
|
|
2926
|
+
if (walked === NONE) {
|
|
2927
|
+
inst._zod.parse = base;
|
|
2928
|
+
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
2929
|
+
return base(payload, ctx);
|
|
2930
|
+
}
|
|
2931
|
+
if (walked === PROVEN || rechecked) isRecursiveInst = true;
|
|
2932
|
+
else rechecked = true;
|
|
2933
|
+
}
|
|
2934
|
+
const input = payload.value;
|
|
2935
|
+
if (!isRef(input)) return base(payload, ctx);
|
|
2936
|
+
let state = ctx[STATE];
|
|
2937
|
+
if (!state) {
|
|
2938
|
+
state = {
|
|
2939
|
+
buckets: /* @__PURE__ */ new WeakMap(),
|
|
2940
|
+
backEdges: void 0
|
|
2941
|
+
};
|
|
2942
|
+
ctx[STATE] = state;
|
|
2943
|
+
}
|
|
2944
|
+
let bucket;
|
|
2945
|
+
if (lastCtx === ctx) bucket = lastBucket;
|
|
2946
|
+
else {
|
|
2947
|
+
bucket = bucketFor(state, inst);
|
|
2948
|
+
lastCtx = ctx;
|
|
2949
|
+
lastBucket = bucket;
|
|
2950
|
+
}
|
|
2951
|
+
const hit = bucket.get(input);
|
|
2952
|
+
if (hit) {
|
|
2953
|
+
payload.value = hit.value;
|
|
2954
|
+
if (hit.issues) {
|
|
2955
|
+
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
2956
|
+
} else {
|
|
2957
|
+
payload.memo = true;
|
|
2958
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
|
|
2959
|
+
state.backEdges.add(hit.value);
|
|
2960
|
+
}
|
|
2961
|
+
return payload;
|
|
2962
|
+
}
|
|
2963
|
+
handoff = bucket;
|
|
2964
|
+
const depth = open.length;
|
|
2965
|
+
const result = base(payload, ctx);
|
|
2966
|
+
handoff = void 0;
|
|
2967
|
+
const entry = open.length > depth ? open.pop() : void 0;
|
|
2968
|
+
if (result instanceof Promise) return result.then((r) => {
|
|
2969
|
+
if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
2970
|
+
return r;
|
|
2971
|
+
});
|
|
2972
|
+
if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
2973
|
+
return result;
|
|
2974
|
+
};
|
|
2975
|
+
inst._zod.parse = wrapped;
|
|
2976
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2977
|
+
});
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
|
|
2981
|
+
function memoizer() {
|
|
2982
|
+
return memo;
|
|
2983
|
+
}
|
|
2984
|
+
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
2985
|
+
function isBackEdge(ctx, value) {
|
|
2986
|
+
const backEdges = ctx[STATE]?.backEdges;
|
|
2987
|
+
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
2988
|
+
}
|
|
2989
|
+
//#endregion
|
|
2990
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
|
|
2991
|
+
const error = () => {
|
|
2992
|
+
const Sizable = {
|
|
2993
|
+
string: {
|
|
2994
|
+
unit: "characters",
|
|
2995
|
+
verb: "to have"
|
|
2996
|
+
},
|
|
2997
|
+
file: {
|
|
2998
|
+
unit: "bytes",
|
|
2999
|
+
verb: "to have"
|
|
3000
|
+
},
|
|
3001
|
+
array: {
|
|
3002
|
+
unit: "items",
|
|
3003
|
+
verb: "to have"
|
|
3004
|
+
},
|
|
3005
|
+
set: {
|
|
3006
|
+
unit: "items",
|
|
3007
|
+
verb: "to have"
|
|
3008
|
+
},
|
|
3009
|
+
map: {
|
|
3010
|
+
unit: "entries",
|
|
3011
|
+
verb: "to have"
|
|
3012
|
+
}
|
|
2253
3013
|
};
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
3014
|
+
function getSizing(origin) {
|
|
3015
|
+
return Sizable[origin] ?? null;
|
|
3016
|
+
}
|
|
3017
|
+
const FormatDictionary = {
|
|
3018
|
+
regex: "input",
|
|
3019
|
+
email: "email address",
|
|
3020
|
+
url: "URL",
|
|
3021
|
+
emoji: "emoji",
|
|
3022
|
+
uuid: "UUID",
|
|
3023
|
+
uuidv4: "UUIDv4",
|
|
3024
|
+
uuidv6: "UUIDv6",
|
|
3025
|
+
nanoid: "nanoid",
|
|
3026
|
+
guid: "GUID",
|
|
3027
|
+
cuid: "cuid",
|
|
3028
|
+
cuid2: "cuid2",
|
|
3029
|
+
ulid: "ULID",
|
|
3030
|
+
xid: "XID",
|
|
3031
|
+
ksuid: "KSUID",
|
|
3032
|
+
datetime: "ISO datetime",
|
|
3033
|
+
date: "ISO date",
|
|
3034
|
+
time: "ISO time",
|
|
3035
|
+
duration: "ISO duration",
|
|
3036
|
+
ipv4: "IPv4 address",
|
|
3037
|
+
ipv6: "IPv6 address",
|
|
3038
|
+
mac: "MAC address",
|
|
3039
|
+
cidrv4: "IPv4 range",
|
|
3040
|
+
cidrv6: "IPv6 range",
|
|
3041
|
+
base64: "base64-encoded string",
|
|
3042
|
+
base64url: "base64url-encoded string",
|
|
3043
|
+
json_string: "JSON string",
|
|
3044
|
+
e164: "E.164 number",
|
|
3045
|
+
currency_code: "currency code",
|
|
3046
|
+
credit_card: "credit card number",
|
|
3047
|
+
iban: "IBAN",
|
|
3048
|
+
jwt: "JWT",
|
|
3049
|
+
template_literal: "input"
|
|
2259
3050
|
};
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
code: "custom",
|
|
2265
|
-
input,
|
|
2266
|
-
inst,
|
|
2267
|
-
path: [...inst._zod.def.path ?? []],
|
|
2268
|
-
continue: !inst._zod.def.abort
|
|
2269
|
-
};
|
|
2270
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2271
|
-
payload.issues.push(issue(_iss));
|
|
3051
|
+
const TypeDictionary = { nan: "NaN" };
|
|
3052
|
+
function getTypeName(type, input) {
|
|
3053
|
+
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
|
|
3054
|
+
return TypeDictionary[type] ?? type;
|
|
2272
3055
|
}
|
|
3056
|
+
return (issue) => {
|
|
3057
|
+
switch (issue.code) {
|
|
3058
|
+
case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
|
|
3059
|
+
case "invalid_value":
|
|
3060
|
+
if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
3061
|
+
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
3062
|
+
case "too_big": {
|
|
3063
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
3064
|
+
const sizing = getSizing(issue.origin);
|
|
3065
|
+
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
3066
|
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
3067
|
+
}
|
|
3068
|
+
case "too_small": {
|
|
3069
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
3070
|
+
const sizing = getSizing(issue.origin);
|
|
3071
|
+
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
3072
|
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
3073
|
+
}
|
|
3074
|
+
case "invalid_format": {
|
|
3075
|
+
const _issue = issue;
|
|
3076
|
+
if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
|
|
3077
|
+
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
|
3078
|
+
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
|
3079
|
+
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
3080
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
3081
|
+
}
|
|
3082
|
+
case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
3083
|
+
case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
3084
|
+
case "invalid_key": return `Invalid key in ${issue.origin}`;
|
|
3085
|
+
case "invalid_union":
|
|
3086
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
|
|
3087
|
+
if (issue.inclusive === false) return "Invalid input: more than one option matched";
|
|
3088
|
+
return "Invalid input";
|
|
3089
|
+
case "invalid_element": return `Invalid value in ${issue.origin}`;
|
|
3090
|
+
default: return `Invalid input`;
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3093
|
+
};
|
|
3094
|
+
function en_default() {
|
|
3095
|
+
return { localeError: error() };
|
|
2273
3096
|
}
|
|
2274
3097
|
//#endregion
|
|
2275
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3098
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.js
|
|
2276
3099
|
var _a;
|
|
2277
3100
|
var $ZodRegistry = class {
|
|
2278
3101
|
constructor() {
|
|
@@ -2319,13 +3142,17 @@ window.__ModuleLoader__.load({
|
|
|
2319
3142
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2320
3143
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2321
3144
|
//#endregion
|
|
2322
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3145
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
|
|
3146
|
+
function snapshotChecks(def) {
|
|
3147
|
+
if (def.checks) def.checks = [...def.checks];
|
|
3148
|
+
return def;
|
|
3149
|
+
}
|
|
2323
3150
|
// @__NO_SIDE_EFFECTS__
|
|
2324
3151
|
function _string(Class, params) {
|
|
2325
|
-
return new Class({
|
|
3152
|
+
return new Class(snapshotChecks({
|
|
2326
3153
|
type: "string",
|
|
2327
3154
|
...normalizeParams(params)
|
|
2328
|
-
});
|
|
3155
|
+
}));
|
|
2329
3156
|
}
|
|
2330
3157
|
// @__NO_SIDE_EFFECTS__
|
|
2331
3158
|
function _email(Class, params) {
|
|
@@ -2597,11 +3424,11 @@ window.__ModuleLoader__.load({
|
|
|
2597
3424
|
}
|
|
2598
3425
|
// @__NO_SIDE_EFFECTS__
|
|
2599
3426
|
function _number(Class, params) {
|
|
2600
|
-
return new Class({
|
|
3427
|
+
return new Class(snapshotChecks({
|
|
2601
3428
|
type: "number",
|
|
2602
3429
|
checks: [],
|
|
2603
3430
|
...normalizeParams(params)
|
|
2604
|
-
});
|
|
3431
|
+
}));
|
|
2605
3432
|
}
|
|
2606
3433
|
// @__NO_SIDE_EFFECTS__
|
|
2607
3434
|
function _int(Class, params) {
|
|
@@ -2811,7 +3638,7 @@ window.__ModuleLoader__.load({
|
|
|
2811
3638
|
const _issue = issue$2;
|
|
2812
3639
|
if (_issue.fatal) _issue.continue = false;
|
|
2813
3640
|
_issue.code ?? (_issue.code = "custom");
|
|
2814
|
-
|
|
3641
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
2815
3642
|
_issue.inst ?? (_issue.inst = ch);
|
|
2816
3643
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2817
3644
|
payload.issues.push(issue(_issue));
|
|
@@ -2831,7 +3658,11 @@ window.__ModuleLoader__.load({
|
|
|
2831
3658
|
return ch;
|
|
2832
3659
|
}
|
|
2833
3660
|
//#endregion
|
|
2834
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3661
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
|
|
3662
|
+
function assignProps(target, ...sources) {
|
|
3663
|
+
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3664
|
+
return target;
|
|
3665
|
+
}
|
|
2835
3666
|
function initializeContext(params) {
|
|
2836
3667
|
let target = params?.target ?? "draft-2020-12";
|
|
2837
3668
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -2845,12 +3676,32 @@ window.__ModuleLoader__.load({
|
|
|
2845
3676
|
io: params?.io ?? "output",
|
|
2846
3677
|
counter: 0,
|
|
2847
3678
|
seen: /* @__PURE__ */ new Map(),
|
|
3679
|
+
sharedDefsExtractedFor: void 0,
|
|
3680
|
+
sharedEmitDoneFor: void 0,
|
|
2848
3681
|
cycles: params?.cycles ?? "ref",
|
|
2849
3682
|
reused: params?.reused ?? "inline",
|
|
3683
|
+
intersections: [],
|
|
3684
|
+
deferred: [],
|
|
2850
3685
|
external: params?.external ?? void 0
|
|
2851
3686
|
};
|
|
2852
3687
|
}
|
|
2853
|
-
|
|
3688
|
+
/**
|
|
3689
|
+
* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
|
|
3690
|
+
* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
|
|
3691
|
+
* custom JSON Schema was written into `json`, in which case the caller must not write its own.
|
|
3692
|
+
*/
|
|
3693
|
+
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
3694
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
|
|
3695
|
+
zodSchema: schema,
|
|
3696
|
+
path: params.path,
|
|
3697
|
+
message
|
|
3698
|
+
}) : ctx.unrepresentable;
|
|
3699
|
+
if (result === "any") return false;
|
|
3700
|
+
if (result === void 0 || result === "throw") throw new Error(message);
|
|
3701
|
+
Object.assign(json, result);
|
|
3702
|
+
return true;
|
|
3703
|
+
}
|
|
3704
|
+
function processSchema(schema, ctx, _params = {
|
|
2854
3705
|
path: [],
|
|
2855
3706
|
schemaPath: []
|
|
2856
3707
|
}) {
|
|
@@ -2869,6 +3720,8 @@ window.__ModuleLoader__.load({
|
|
|
2869
3720
|
path: _params.path
|
|
2870
3721
|
};
|
|
2871
3722
|
ctx.seen.set(schema, result);
|
|
3723
|
+
ctx.sharedDefsExtractedFor = void 0;
|
|
3724
|
+
ctx.sharedEmitDoneFor = void 0;
|
|
2872
3725
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2873
3726
|
if (overrideSchema) result.schema = overrideSchema;
|
|
2874
3727
|
else {
|
|
@@ -2887,12 +3740,12 @@ window.__ModuleLoader__.load({
|
|
|
2887
3740
|
const parent = schema._zod.parent;
|
|
2888
3741
|
if (parent) {
|
|
2889
3742
|
if (!result.ref) result.ref = parent;
|
|
2890
|
-
|
|
3743
|
+
processSchema(parent, ctx, params);
|
|
2891
3744
|
ctx.seen.get(parent).isParent = true;
|
|
2892
3745
|
}
|
|
2893
3746
|
}
|
|
2894
3747
|
const meta = ctx.metadataRegistry.get(schema);
|
|
2895
|
-
if (meta)
|
|
3748
|
+
if (meta) assignProps(result.schema, meta);
|
|
2896
3749
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
2897
3750
|
delete result.schema.examples;
|
|
2898
3751
|
delete result.schema.default;
|
|
@@ -2901,9 +3754,13 @@ window.__ModuleLoader__.load({
|
|
|
2901
3754
|
delete result.schema._prefault;
|
|
2902
3755
|
return ctx.seen.get(schema).schema;
|
|
2903
3756
|
}
|
|
3757
|
+
function encodeJSONPointerSegment(segment) {
|
|
3758
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3759
|
+
}
|
|
2904
3760
|
function extractDefs(ctx, schema) {
|
|
2905
3761
|
const root = ctx.seen.get(schema);
|
|
2906
3762
|
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3763
|
+
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
|
|
2907
3764
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
2908
3765
|
for (const entry of ctx.seen.entries()) {
|
|
2909
3766
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -2923,15 +3780,16 @@ window.__ModuleLoader__.load({
|
|
|
2923
3780
|
entry[1].defId = id;
|
|
2924
3781
|
return {
|
|
2925
3782
|
defId: id,
|
|
2926
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
3783
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
|
|
2927
3784
|
};
|
|
2928
3785
|
}
|
|
2929
|
-
|
|
2930
|
-
const defUriPrefix =
|
|
3786
|
+
const uriPrefix = `#`;
|
|
3787
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
3788
|
+
if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
|
|
2931
3789
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
2932
3790
|
return {
|
|
2933
3791
|
defId,
|
|
2934
|
-
ref: defUriPrefix + defId
|
|
3792
|
+
ref: defUriPrefix + encodeJSONPointerSegment(defId)
|
|
2935
3793
|
};
|
|
2936
3794
|
};
|
|
2937
3795
|
const extractToDef = (entry) => {
|
|
@@ -2972,12 +3830,114 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2972
3830
|
continue;
|
|
2973
3831
|
}
|
|
2974
3832
|
if (seen.count > 1) {
|
|
2975
|
-
if (ctx.reused === "ref")
|
|
2976
|
-
|
|
2977
|
-
|
|
3833
|
+
if (ctx.reused === "ref") extractToDef(entry);
|
|
3834
|
+
}
|
|
3835
|
+
}
|
|
3836
|
+
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
3837
|
+
}
|
|
3838
|
+
/** Rewrites `anyOf: [{type: "a"}, {type: "b"}]` to `type: ["a", "b"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so "exactly one" and "at least one" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string. */
|
|
3839
|
+
function compactTypeUnion(schema) {
|
|
3840
|
+
const options = schema.anyOf;
|
|
3841
|
+
if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
|
|
3842
|
+
const types = [];
|
|
3843
|
+
for (const option of options) {
|
|
3844
|
+
if (!option || typeof option !== "object") return;
|
|
3845
|
+
compactTypeUnion(option);
|
|
3846
|
+
const keys = Object.keys(option);
|
|
3847
|
+
if (keys.length !== 1 || keys[0] !== "type") return;
|
|
3848
|
+
const type = option.type;
|
|
3849
|
+
for (const member of Array.isArray(type) ? type : [type]) {
|
|
3850
|
+
if (typeof member !== "string") return;
|
|
3851
|
+
if (!types.includes(member)) types.push(member);
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
delete schema.anyOf;
|
|
3855
|
+
schema.type = types.length === 1 ? types[0] : types;
|
|
3856
|
+
}
|
|
3857
|
+
/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
|
|
3858
|
+
* an annotation like `description` — makes a member unfoldable, so a constraint this does not
|
|
3859
|
+
* understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
|
|
3860
|
+
const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
|
|
3861
|
+
"type",
|
|
3862
|
+
"properties",
|
|
3863
|
+
"required",
|
|
3864
|
+
"additionalProperties"
|
|
3865
|
+
]);
|
|
3866
|
+
const UNION_KEYS = ["oneOf", "anyOf"];
|
|
3867
|
+
/** A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing. */
|
|
3868
|
+
function undeclaredConstraint(member) {
|
|
3869
|
+
const extra = member.additionalProperties;
|
|
3870
|
+
if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
|
|
3871
|
+
return Object.keys(extra).length ? extra : null;
|
|
3872
|
+
}
|
|
3873
|
+
/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
|
|
3874
|
+
function foldObjects(members) {
|
|
3875
|
+
const objects = [];
|
|
3876
|
+
for (const member of members) {
|
|
3877
|
+
if (typeof member !== "object" || member.type !== "object") return null;
|
|
3878
|
+
for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
|
|
3879
|
+
objects.push(member);
|
|
3880
|
+
}
|
|
3881
|
+
const properties = {};
|
|
3882
|
+
const required = /* @__PURE__ */ new Set();
|
|
3883
|
+
for (const object of objects) {
|
|
3884
|
+
for (const key in object.properties) {
|
|
3885
|
+
if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
|
|
3886
|
+
const parts = [];
|
|
3887
|
+
for (const other of objects) {
|
|
3888
|
+
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
3889
|
+
if (part === null || part === void 0) continue;
|
|
3890
|
+
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
|
|
2978
3891
|
}
|
|
3892
|
+
assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
|
|
2979
3893
|
}
|
|
3894
|
+
for (const key of object.required ?? []) required.add(key);
|
|
2980
3895
|
}
|
|
3896
|
+
const folded = {
|
|
3897
|
+
type: "object",
|
|
3898
|
+
properties
|
|
3899
|
+
};
|
|
3900
|
+
if (required.size) folded.required = [...required];
|
|
3901
|
+
if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
|
|
3902
|
+
else {
|
|
3903
|
+
const constraints = [];
|
|
3904
|
+
for (const object of objects) {
|
|
3905
|
+
const constraint = undeclaredConstraint(object);
|
|
3906
|
+
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
|
|
3907
|
+
}
|
|
3908
|
+
if (constraints.length === 1) folded.additionalProperties = constraints[0];
|
|
3909
|
+
else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
|
|
3910
|
+
}
|
|
3911
|
+
return folded;
|
|
3912
|
+
}
|
|
3913
|
+
/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
|
|
3914
|
+
* closed object members reject each other's keys and the schema validates nothing. Zod's parser
|
|
3915
|
+
* pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
|
|
3916
|
+
* *every* side rejects it — so the emitted schema has to pool them too, and folding the members
|
|
3917
|
+
* into one object is the encoding that says so on every target.
|
|
3918
|
+
*
|
|
3919
|
+
* This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
|
|
3920
|
+
* machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
|
|
3921
|
+
* keeps its reference and its own closedness rather than being inlined as a stale copy. */
|
|
3922
|
+
function foldIntersection(json) {
|
|
3923
|
+
const allOf = json.allOf;
|
|
3924
|
+
if (!Array.isArray(allOf) || allOf.length < 2) return;
|
|
3925
|
+
for (const key of FOLDABLE_KEYS) if (key in json) return;
|
|
3926
|
+
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
3927
|
+
let folded = null;
|
|
3928
|
+
if (!unions.length) folded = foldObjects(allOf);
|
|
3929
|
+
else {
|
|
3930
|
+
const union = unions[0];
|
|
3931
|
+
const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
|
|
3932
|
+
if (Object.keys(union).length !== 1) return;
|
|
3933
|
+
const rest = allOf.filter((m) => m !== union);
|
|
3934
|
+
const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
3935
|
+
if (branches.some((b) => !b)) return;
|
|
3936
|
+
folded = { [keyword]: branches };
|
|
3937
|
+
}
|
|
3938
|
+
if (!folded) return;
|
|
3939
|
+
delete json.allOf;
|
|
3940
|
+
assignProps(json, folded);
|
|
2981
3941
|
}
|
|
2982
3942
|
function finalize$1(ctx, schema) {
|
|
2983
3943
|
const root = ctx.seen.get(schema);
|
|
@@ -2996,8 +3956,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2996
3956
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
2997
3957
|
schema.allOf = schema.allOf ?? [];
|
|
2998
3958
|
schema.allOf.push(refSchema);
|
|
2999
|
-
} else
|
|
3000
|
-
|
|
3959
|
+
} else assignProps(schema, refSchema);
|
|
3960
|
+
assignProps(schema, _cached);
|
|
3001
3961
|
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
3002
3962
|
if (key === "$ref" || key === "allOf") continue;
|
|
3003
3963
|
if (!(key in _cached)) delete schema[key];
|
|
@@ -3025,7 +3985,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3025
3985
|
path: seen.path ?? []
|
|
3026
3986
|
});
|
|
3027
3987
|
};
|
|
3028
|
-
|
|
3988
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
3989
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
3990
|
+
if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
3991
|
+
for (const rewrite of ctx.deferred) rewrite();
|
|
3992
|
+
if (ctx.intersections.length) {
|
|
3993
|
+
const carriers = /* @__PURE__ */ new Map();
|
|
3994
|
+
for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
|
|
3995
|
+
const allOf = json?.allOf;
|
|
3996
|
+
if (!Array.isArray(allOf)) continue;
|
|
3997
|
+
const existing = carriers.get(allOf);
|
|
3998
|
+
if (existing) existing.push(json);
|
|
3999
|
+
else carriers.set(allOf, [json]);
|
|
4000
|
+
}
|
|
4001
|
+
for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
|
|
4002
|
+
}
|
|
4003
|
+
}
|
|
3029
4004
|
const result = {};
|
|
3030
4005
|
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
3031
4006
|
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -3036,17 +4011,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3036
4011
|
if (!id) throw new Error("Schema is missing an `id` property");
|
|
3037
4012
|
result.$id = ctx.external.uri(id);
|
|
3038
4013
|
}
|
|
3039
|
-
|
|
4014
|
+
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
3040
4015
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
3041
4016
|
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
3042
4017
|
const defs = ctx.external?.defs ?? {};
|
|
3043
|
-
for (const entry of ctx.seen.entries()) {
|
|
4018
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
|
|
3044
4019
|
const seen = entry[1];
|
|
3045
4020
|
if (seen.def && seen.defId) {
|
|
3046
4021
|
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
3047
|
-
defs
|
|
4022
|
+
assignProp(defs, seen.defId, seen.def);
|
|
3048
4023
|
}
|
|
3049
4024
|
}
|
|
4025
|
+
if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
|
|
3050
4026
|
if (ctx.external) {} else if (Object.keys(defs).length > 0) {
|
|
3051
4027
|
if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
3052
4028
|
else result.definitions = defs;
|
|
@@ -3078,7 +4054,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3078
4054
|
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
3079
4055
|
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
3080
4056
|
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
3081
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
|
|
4057
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") return isTransforming(def.innerType, ctx);
|
|
3082
4058
|
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
3083
4059
|
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3084
4060
|
if (def.type === "pipe") {
|
|
@@ -3109,7 +4085,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3109
4085
|
...params,
|
|
3110
4086
|
processors
|
|
3111
4087
|
});
|
|
3112
|
-
|
|
4088
|
+
processSchema(schema, ctx);
|
|
3113
4089
|
extractDefs(ctx, schema);
|
|
3114
4090
|
return finalize$1(ctx, schema);
|
|
3115
4091
|
};
|
|
@@ -3121,12 +4097,84 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3121
4097
|
io,
|
|
3122
4098
|
processors
|
|
3123
4099
|
});
|
|
3124
|
-
|
|
4100
|
+
processSchema(schema, ctx);
|
|
3125
4101
|
extractDefs(ctx, schema);
|
|
3126
4102
|
return finalize$1(ctx, schema);
|
|
3127
4103
|
};
|
|
3128
4104
|
//#endregion
|
|
3129
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
4105
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
|
|
4106
|
+
const narrowMin = (agg, key, value) => {
|
|
4107
|
+
if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
|
|
4108
|
+
};
|
|
4109
|
+
const narrowMax = (agg, key, value) => {
|
|
4110
|
+
if (agg[key] === void 0 || value < agg[key]) agg[key] = value;
|
|
4111
|
+
};
|
|
4112
|
+
const narrowBoth = (agg, value) => {
|
|
4113
|
+
narrowMin(agg, "minimum", value);
|
|
4114
|
+
narrowMax(agg, "maximum", value);
|
|
4115
|
+
};
|
|
4116
|
+
const addDivisor = (agg, value) => {
|
|
4117
|
+
agg.multipleOf ?? (agg.multipleOf = []);
|
|
4118
|
+
if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
|
|
4119
|
+
};
|
|
4120
|
+
const addPattern = (agg, pattern) => {
|
|
4121
|
+
agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
|
|
4122
|
+
agg.patterns.add(pattern);
|
|
4123
|
+
};
|
|
4124
|
+
const intersectMime = (agg, mime) => {
|
|
4125
|
+
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
|
|
4126
|
+
};
|
|
4127
|
+
const setFormat = (agg, format) => {
|
|
4128
|
+
agg.format = format;
|
|
4129
|
+
if (format.includes("int")) agg.isInt = true;
|
|
4130
|
+
};
|
|
4131
|
+
const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
|
|
4132
|
+
const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
|
|
4133
|
+
const formatContributor = (ranges) => (agg, def) => {
|
|
4134
|
+
setFormat(agg, def.format);
|
|
4135
|
+
const [minimum, maximum] = ranges[def.format];
|
|
4136
|
+
narrowMin(agg, "minimum", minimum);
|
|
4137
|
+
narrowMax(agg, "maximum", maximum);
|
|
4138
|
+
};
|
|
4139
|
+
const contributors = {
|
|
4140
|
+
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
|
|
4141
|
+
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
|
|
4142
|
+
multiple_of: (agg, def) => addDivisor(agg, def.value),
|
|
4143
|
+
number_format: formatContributor(NUMBER_FORMAT_RANGES),
|
|
4144
|
+
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
|
|
4145
|
+
min_length: minContributor,
|
|
4146
|
+
max_length: maxContributor,
|
|
4147
|
+
length_equals: (agg, def) => narrowBoth(agg, def.length),
|
|
4148
|
+
min_size: minContributor,
|
|
4149
|
+
max_size: maxContributor,
|
|
4150
|
+
size_equals: (agg, def) => narrowBoth(agg, def.size),
|
|
4151
|
+
string_format: (agg, def) => {
|
|
4152
|
+
setFormat(agg, def.format);
|
|
4153
|
+
if (def.pattern) addPattern(agg, def.pattern);
|
|
4154
|
+
if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
|
|
4155
|
+
if (def.local || def.precision === -1) agg.laxFormat = true;
|
|
4156
|
+
},
|
|
4157
|
+
mime_type: (agg, def) => intersectMime(agg, def.mime)
|
|
4158
|
+
};
|
|
4159
|
+
function aggregateChecks(schema) {
|
|
4160
|
+
const agg = {};
|
|
4161
|
+
const def = schema._zod.def;
|
|
4162
|
+
const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
4163
|
+
for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
4164
|
+
const bag = schema._zod.bag;
|
|
4165
|
+
if (bag.minimum !== void 0) narrowMin(agg, "minimum", bag.minimum);
|
|
4166
|
+
if (bag.exclusiveMinimum !== void 0) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
|
|
4167
|
+
if (bag.maximum !== void 0) narrowMax(agg, "maximum", bag.maximum);
|
|
4168
|
+
if (bag.exclusiveMaximum !== void 0) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
|
|
4169
|
+
if (bag.multipleOf !== void 0) addDivisor(agg, bag.multipleOf);
|
|
4170
|
+
if (bag.format !== void 0) {
|
|
4171
|
+
agg.format ?? (agg.format = bag.format);
|
|
4172
|
+
if (bag.format.includes("int")) agg.isInt = true;
|
|
4173
|
+
}
|
|
4174
|
+
if (bag.mime) intersectMime(agg, bag.mime);
|
|
4175
|
+
for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
|
|
4176
|
+
return agg;
|
|
4177
|
+
}
|
|
3130
4178
|
const formatMap = {
|
|
3131
4179
|
guid: "uuid",
|
|
3132
4180
|
url: "uri",
|
|
@@ -3134,32 +4182,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3134
4182
|
json_string: "json-string",
|
|
3135
4183
|
regex: ""
|
|
3136
4184
|
};
|
|
4185
|
+
const exactPatterns = /* @__PURE__ */ new Map([[base64Charset, base64], [base64urlCharset, base64url]]);
|
|
4186
|
+
const exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
3137
4187
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3138
4188
|
const json = _json;
|
|
3139
4189
|
json.type = "string";
|
|
3140
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema
|
|
4190
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
3141
4191
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
3142
4192
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3143
4193
|
if (format) {
|
|
3144
4194
|
json.format = formatMap[format] ?? format;
|
|
3145
4195
|
if (json.format === "") delete json.format;
|
|
3146
|
-
if (format === "time") delete json.format;
|
|
4196
|
+
if (format === "time" || laxFormat) delete json.format;
|
|
3147
4197
|
}
|
|
3148
4198
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3149
4199
|
if (patterns && patterns.size > 0) {
|
|
3150
|
-
const
|
|
3151
|
-
if (
|
|
3152
|
-
else if (
|
|
4200
|
+
const patternList = [...patterns].map(exactPattern);
|
|
4201
|
+
if (patternList.length === 1) json.pattern = patternList[0].source;
|
|
4202
|
+
else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
|
|
3153
4203
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3154
4204
|
pattern: regex.source
|
|
3155
4205
|
}))];
|
|
3156
4206
|
}
|
|
3157
4207
|
};
|
|
3158
|
-
const numberProcessor = (schema, ctx, _json,
|
|
4208
|
+
const numberProcessor = (schema, ctx, _json, params) => {
|
|
3159
4209
|
const json = _json;
|
|
3160
|
-
const { minimum, maximum,
|
|
3161
|
-
|
|
3162
|
-
else json.type = "number";
|
|
4210
|
+
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
4211
|
+
json.type = isInt ? "integer" : "number";
|
|
3163
4212
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
3164
4213
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
3165
4214
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
@@ -3175,13 +4224,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3175
4224
|
json.exclusiveMaximum = true;
|
|
3176
4225
|
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3177
4226
|
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
3178
|
-
if (
|
|
4227
|
+
if (multipleOf) {
|
|
4228
|
+
const divisors = /* @__PURE__ */ new Set();
|
|
4229
|
+
for (const divisor of multipleOf) if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
|
|
4230
|
+
else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
4231
|
+
const [first, ...rest] = divisors;
|
|
4232
|
+
if (first !== void 0) json.multipleOf = first;
|
|
4233
|
+
if (rest.length) json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
4234
|
+
}
|
|
3179
4235
|
};
|
|
3180
4236
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3181
4237
|
json.type = "boolean";
|
|
3182
4238
|
};
|
|
3183
|
-
const undefinedProcessor = (
|
|
3184
|
-
|
|
4239
|
+
const undefinedProcessor = (schema, ctx, json, params) => {
|
|
4240
|
+
handleUnrepresentable(schema, ctx, json, params, "Undefined cannot be represented in JSON Schema");
|
|
3185
4241
|
};
|
|
3186
4242
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3187
4243
|
json.not = {};
|
|
@@ -3189,18 +4245,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3189
4245
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3190
4246
|
const def = schema._zod.def;
|
|
3191
4247
|
const values = getEnumValues(def.entries);
|
|
4248
|
+
if (values.length === 0) {
|
|
4249
|
+
json.not = {};
|
|
4250
|
+
return;
|
|
4251
|
+
}
|
|
3192
4252
|
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
3193
4253
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3194
4254
|
json.enum = values;
|
|
3195
4255
|
};
|
|
3196
|
-
const literalProcessor = (schema, ctx, json,
|
|
4256
|
+
const literalProcessor = (schema, ctx, json, params) => {
|
|
3197
4257
|
const def = schema._zod.def;
|
|
4258
|
+
if (def.values.length === 0) {
|
|
4259
|
+
json.not = {};
|
|
4260
|
+
return;
|
|
4261
|
+
}
|
|
3198
4262
|
const vals = [];
|
|
3199
4263
|
for (const val of def.values) if (val === void 0) {
|
|
3200
|
-
if (ctx
|
|
4264
|
+
if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema")) return;
|
|
3201
4265
|
} else if (typeof val === "bigint") {
|
|
3202
|
-
if (ctx
|
|
3203
|
-
|
|
4266
|
+
if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema")) return;
|
|
4267
|
+
vals.push(Number(val));
|
|
3204
4268
|
} else vals.push(val);
|
|
3205
4269
|
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
3206
4270
|
const val = vals[0];
|
|
@@ -3215,49 +4279,55 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3215
4279
|
json.enum = vals;
|
|
3216
4280
|
}
|
|
3217
4281
|
};
|
|
3218
|
-
const customProcessor = (
|
|
3219
|
-
|
|
4282
|
+
const customProcessor = (schema, ctx, json, params) => {
|
|
4283
|
+
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
|
|
3220
4284
|
};
|
|
3221
|
-
const transformProcessor = (
|
|
3222
|
-
|
|
4285
|
+
const transformProcessor = (schema, ctx, json, params) => {
|
|
4286
|
+
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
|
|
3223
4287
|
};
|
|
3224
4288
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3225
4289
|
const json = _json;
|
|
3226
4290
|
const def = schema._zod.def;
|
|
3227
|
-
const { minimum, maximum } = schema
|
|
4291
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
3228
4292
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
3229
4293
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3230
4294
|
json.type = "array";
|
|
3231
|
-
json.items =
|
|
4295
|
+
json.items = processSchema(def.element, ctx, {
|
|
3232
4296
|
...params,
|
|
3233
4297
|
path: [...params.path, "items"]
|
|
3234
4298
|
});
|
|
3235
4299
|
};
|
|
4300
|
+
function inputOptin(schema) {
|
|
4301
|
+
const def = schema._zod.def;
|
|
4302
|
+
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
|
|
4303
|
+
if (def.type === "catch") return inputOptin(def.innerType);
|
|
4304
|
+
return schema._zod.optin;
|
|
4305
|
+
}
|
|
3236
4306
|
const objectProcessor = (schema, ctx, _json, params) => {
|
|
3237
4307
|
const json = _json;
|
|
3238
4308
|
const def = schema._zod.def;
|
|
4309
|
+
const shape = def.shape;
|
|
4310
|
+
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
3239
4311
|
json.type = "object";
|
|
3240
4312
|
json.properties = {};
|
|
3241
|
-
const shape
|
|
3242
|
-
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
4313
|
+
for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
|
|
3243
4314
|
...params,
|
|
3244
4315
|
path: [
|
|
3245
4316
|
...params.path,
|
|
3246
4317
|
"properties",
|
|
3247
4318
|
key
|
|
3248
4319
|
]
|
|
3249
|
-
});
|
|
3250
|
-
const allKeys = new Set(Object.keys(shape));
|
|
3251
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3252
|
-
const v = def.shape[key]._zod;
|
|
3253
|
-
if (ctx.io === "input") return v.optin === void 0;
|
|
3254
|
-
else return v.optout === void 0;
|
|
3255
4320
|
}));
|
|
3256
|
-
|
|
4321
|
+
const requiredKeys = [];
|
|
4322
|
+
for (const key of Object.keys(shape)) {
|
|
4323
|
+
const field = def.shape[key];
|
|
4324
|
+
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
|
|
4325
|
+
}
|
|
4326
|
+
if (requiredKeys.length > 0) json.required = requiredKeys;
|
|
3257
4327
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
3258
4328
|
else if (!def.catchall) {
|
|
3259
4329
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
3260
|
-
} else if (def.catchall) json.additionalProperties =
|
|
4330
|
+
} else if (def.catchall) json.additionalProperties = processSchema(def.catchall, ctx, {
|
|
3261
4331
|
...params,
|
|
3262
4332
|
path: [...params.path, "additionalProperties"]
|
|
3263
4333
|
});
|
|
@@ -3265,7 +4335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3265
4335
|
const unionProcessor = (schema, ctx, json, params) => {
|
|
3266
4336
|
const def = schema._zod.def;
|
|
3267
4337
|
const isExclusive = def.inclusive === false;
|
|
3268
|
-
const options = def.options.map((x, i) =>
|
|
4338
|
+
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
3269
4339
|
...params,
|
|
3270
4340
|
path: [
|
|
3271
4341
|
...params.path,
|
|
@@ -3278,7 +4348,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3278
4348
|
};
|
|
3279
4349
|
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
3280
4350
|
const def = schema._zod.def;
|
|
3281
|
-
const a =
|
|
4351
|
+
const a = processSchema(def.left, ctx, {
|
|
3282
4352
|
...params,
|
|
3283
4353
|
path: [
|
|
3284
4354
|
...params.path,
|
|
@@ -3286,7 +4356,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3286
4356
|
0
|
|
3287
4357
|
]
|
|
3288
4358
|
});
|
|
3289
|
-
const b =
|
|
4359
|
+
const b = processSchema(def.right, ctx, {
|
|
3290
4360
|
...params,
|
|
3291
4361
|
path: [
|
|
3292
4362
|
...params.path,
|
|
@@ -3295,11 +4365,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3295
4365
|
]
|
|
3296
4366
|
});
|
|
3297
4367
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3298
|
-
|
|
4368
|
+
const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
4369
|
+
json.allOf = allOf;
|
|
4370
|
+
ctx.intersections.push(allOf);
|
|
3299
4371
|
};
|
|
3300
4372
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
3301
4373
|
const def = schema._zod.def;
|
|
3302
|
-
const inner =
|
|
4374
|
+
const inner = processSchema(def.innerType, ctx, params);
|
|
3303
4375
|
const seen = ctx.seen.get(schema);
|
|
3304
4376
|
if (ctx.target === "openapi-3.0") {
|
|
3305
4377
|
seen.ref = def.innerType;
|
|
@@ -3308,34 +4380,53 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3308
4380
|
};
|
|
3309
4381
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
3310
4382
|
const def = schema._zod.def;
|
|
3311
|
-
|
|
4383
|
+
processSchema(def.innerType, ctx, params);
|
|
3312
4384
|
const seen = ctx.seen.get(schema);
|
|
3313
4385
|
seen.ref = def.innerType;
|
|
3314
4386
|
};
|
|
4387
|
+
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
|
|
4388
|
+
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
|
|
4389
|
+
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
|
|
4390
|
+
const UNREPRESENTABLE_DEFAULT = Symbol();
|
|
4391
|
+
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
4392
|
+
let unrepresentable = false;
|
|
4393
|
+
const serialized = JSON.stringify(value, (_, val) => {
|
|
4394
|
+
if (typeof val !== "bigint") return val;
|
|
4395
|
+
unrepresentable = true;
|
|
4396
|
+
return null;
|
|
4397
|
+
});
|
|
4398
|
+
if (!unrepresentable) return JSON.parse(serialized);
|
|
4399
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
4400
|
+
return UNREPRESENTABLE_DEFAULT;
|
|
4401
|
+
}
|
|
3315
4402
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
3316
4403
|
const def = schema._zod.def;
|
|
3317
|
-
|
|
4404
|
+
processSchema(def.innerType, ctx, params);
|
|
3318
4405
|
const seen = ctx.seen.get(schema);
|
|
3319
4406
|
seen.ref = def.innerType;
|
|
3320
|
-
|
|
4407
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4408
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
|
|
3321
4409
|
};
|
|
3322
4410
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
3323
4411
|
const def = schema._zod.def;
|
|
3324
|
-
|
|
4412
|
+
processSchema(def.innerType, ctx, params);
|
|
3325
4413
|
const seen = ctx.seen.get(schema);
|
|
3326
4414
|
seen.ref = def.innerType;
|
|
3327
|
-
if (ctx.io
|
|
4415
|
+
if (ctx.io !== "input") return;
|
|
4416
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4417
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
|
|
3328
4418
|
};
|
|
3329
4419
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
3330
4420
|
const def = schema._zod.def;
|
|
3331
|
-
|
|
4421
|
+
processSchema(def.innerType, ctx, params);
|
|
3332
4422
|
const seen = ctx.seen.get(schema);
|
|
3333
4423
|
seen.ref = def.innerType;
|
|
3334
4424
|
let catchValue;
|
|
3335
4425
|
try {
|
|
3336
4426
|
catchValue = def.catchValue(void 0);
|
|
3337
4427
|
} catch {
|
|
3338
|
-
|
|
4428
|
+
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
|
|
4429
|
+
return;
|
|
3339
4430
|
}
|
|
3340
4431
|
json.default = catchValue;
|
|
3341
4432
|
};
|
|
@@ -3343,77 +4434,75 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3343
4434
|
const def = schema._zod.def;
|
|
3344
4435
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
3345
4436
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
3346
|
-
|
|
4437
|
+
processSchema(innerType, ctx, params);
|
|
3347
4438
|
const seen = ctx.seen.get(schema);
|
|
3348
4439
|
seen.ref = innerType;
|
|
3349
4440
|
};
|
|
3350
4441
|
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
3351
4442
|
const def = schema._zod.def;
|
|
3352
|
-
|
|
4443
|
+
processSchema(def.innerType, ctx, params);
|
|
3353
4444
|
const seen = ctx.seen.get(schema);
|
|
3354
4445
|
seen.ref = def.innerType;
|
|
3355
4446
|
json.readOnly = true;
|
|
3356
4447
|
};
|
|
3357
4448
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
3358
4449
|
const def = schema._zod.def;
|
|
3359
|
-
|
|
4450
|
+
processSchema(def.innerType, ctx, params);
|
|
3360
4451
|
const seen = ctx.seen.get(schema);
|
|
3361
4452
|
seen.ref = def.innerType;
|
|
3362
4453
|
};
|
|
3363
4454
|
//#endregion
|
|
3364
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3365
|
-
const
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
$ZodISODuration.init(inst, def);
|
|
3388
|
-
ZodStringFormat.init(inst, def);
|
|
3389
|
-
});
|
|
3390
|
-
function duration(params) {
|
|
3391
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
4455
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.js
|
|
4456
|
+
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4457
|
+
function _lazyMethod(proto, key, make) {
|
|
4458
|
+
Object.defineProperty(proto, key, {
|
|
4459
|
+
configurable: true,
|
|
4460
|
+
enumerable: false,
|
|
4461
|
+
get() {
|
|
4462
|
+
const value = make(this);
|
|
4463
|
+
Object.defineProperty(this, key, {
|
|
4464
|
+
value,
|
|
4465
|
+
configurable: true,
|
|
4466
|
+
writable: true
|
|
4467
|
+
});
|
|
4468
|
+
return value;
|
|
4469
|
+
},
|
|
4470
|
+
set(value) {
|
|
4471
|
+
Object.defineProperty(this, key, {
|
|
4472
|
+
value,
|
|
4473
|
+
configurable: true,
|
|
4474
|
+
writable: true
|
|
4475
|
+
});
|
|
4476
|
+
}
|
|
4477
|
+
});
|
|
3392
4478
|
}
|
|
3393
|
-
//#endregion
|
|
3394
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
3395
4479
|
const initializer = (inst, issues) => {
|
|
3396
4480
|
$ZodError.init(inst, issues);
|
|
3397
4481
|
inst.name = "ZodError";
|
|
3398
|
-
Object.
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
4482
|
+
const proto = Object.getPrototypeOf(inst);
|
|
4483
|
+
if (_installedErrorProtos.has(proto)) return;
|
|
4484
|
+
_installedErrorProtos.add(proto);
|
|
4485
|
+
_lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
|
|
4486
|
+
_lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
|
|
4487
|
+
_lazyMethod(proto, "addIssue", (self) => (issue) => {
|
|
4488
|
+
self.issues.push(issue);
|
|
4489
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4490
|
+
});
|
|
4491
|
+
_lazyMethod(proto, "addIssues", (self) => (issues) => {
|
|
4492
|
+
self.issues.push(...issues);
|
|
4493
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4494
|
+
});
|
|
4495
|
+
Object.defineProperty(proto, "isEmpty", {
|
|
4496
|
+
configurable: true,
|
|
4497
|
+
enumerable: false,
|
|
4498
|
+
get() {
|
|
4499
|
+
return this.issues.length === 0;
|
|
4500
|
+
}
|
|
3412
4501
|
});
|
|
3413
4502
|
};
|
|
3414
|
-
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
4503
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
3415
4504
|
//#endregion
|
|
3416
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
4505
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
|
|
3417
4506
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
3418
4507
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3419
4508
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -3427,255 +4516,320 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3427
4516
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3428
4517
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3429
4518
|
//#endregion
|
|
3430
|
-
//#region ../../node_modules/.pnpm/zod@4.
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
if (!
|
|
3436
|
-
installed = /* @__PURE__ */ new Set();
|
|
3437
|
-
_installedGroups.set(proto, installed);
|
|
3438
|
-
}
|
|
3439
|
-
if (installed.has(group)) return;
|
|
3440
|
-
installed.add(group);
|
|
3441
|
-
for (const key in methods) {
|
|
3442
|
-
const fn = methods[key];
|
|
3443
|
-
Object.defineProperty(proto, key, {
|
|
3444
|
-
configurable: true,
|
|
3445
|
-
enumerable: false,
|
|
3446
|
-
get() {
|
|
3447
|
-
const bound = fn.bind(this);
|
|
3448
|
-
Object.defineProperty(this, key, {
|
|
3449
|
-
configurable: true,
|
|
3450
|
-
writable: true,
|
|
3451
|
-
enumerable: true,
|
|
3452
|
-
value: bound
|
|
3453
|
-
});
|
|
3454
|
-
return bound;
|
|
3455
|
-
},
|
|
3456
|
-
set(v) {
|
|
3457
|
-
Object.defineProperty(this, key, {
|
|
3458
|
-
configurable: true,
|
|
3459
|
-
writable: true,
|
|
3460
|
-
enumerable: true,
|
|
3461
|
-
value: v
|
|
3462
|
-
});
|
|
3463
|
-
}
|
|
3464
|
-
});
|
|
3465
|
-
}
|
|
4519
|
+
//#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
|
|
4520
|
+
function _ensureDefaultLocale() {
|
|
4521
|
+
if (!globalConfig.localeError) config(en_default());
|
|
4522
|
+
}
|
|
4523
|
+
function _ensureDefaultMemoizer() {
|
|
4524
|
+
if (!globalConfig.memoizer) config({ memoizer: memoizer() });
|
|
3466
4525
|
}
|
|
3467
4526
|
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
4527
|
+
_ensureDefaultLocale();
|
|
3468
4528
|
$ZodType.init(inst, def);
|
|
3469
|
-
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3470
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3471
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3472
|
-
} });
|
|
3473
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3474
4529
|
inst.def = def;
|
|
3475
4530
|
inst.type = def.type;
|
|
3476
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
3477
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3478
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3479
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3480
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3481
|
-
inst.spa = inst.safeParseAsync;
|
|
3482
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
3483
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
3484
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3485
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3486
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3487
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3488
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3489
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3490
|
-
_installLazyMethods(inst, "ZodType", {
|
|
3491
|
-
check(...chks) {
|
|
3492
|
-
const def = this.def;
|
|
3493
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3494
|
-
check: ch,
|
|
3495
|
-
def: { check: "custom" },
|
|
3496
|
-
onattach: []
|
|
3497
|
-
} } : ch)] }), { parent: true });
|
|
3498
|
-
},
|
|
3499
|
-
with(...chks) {
|
|
3500
|
-
return this.check(...chks);
|
|
3501
|
-
},
|
|
3502
|
-
clone(def, params) {
|
|
3503
|
-
return clone(this, def, params);
|
|
3504
|
-
},
|
|
3505
|
-
brand() {
|
|
3506
|
-
return this;
|
|
3507
|
-
},
|
|
3508
|
-
register(reg, meta) {
|
|
3509
|
-
reg.add(this, meta);
|
|
3510
|
-
return this;
|
|
3511
|
-
},
|
|
3512
|
-
refine(check, params) {
|
|
3513
|
-
return this.check(refine(check, params));
|
|
3514
|
-
},
|
|
3515
|
-
superRefine(refinement, params) {
|
|
3516
|
-
return this.check(superRefine(refinement, params));
|
|
3517
|
-
},
|
|
3518
|
-
overwrite(fn) {
|
|
3519
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
3520
|
-
},
|
|
3521
|
-
optional() {
|
|
3522
|
-
return optional(this);
|
|
3523
|
-
},
|
|
3524
|
-
exactOptional() {
|
|
3525
|
-
return exactOptional(this);
|
|
3526
|
-
},
|
|
3527
|
-
nullable() {
|
|
3528
|
-
return nullable(this);
|
|
3529
|
-
},
|
|
3530
|
-
nullish() {
|
|
3531
|
-
return optional(nullable(this));
|
|
3532
|
-
},
|
|
3533
|
-
nonoptional(params) {
|
|
3534
|
-
return nonoptional(this, params);
|
|
3535
|
-
},
|
|
3536
|
-
array() {
|
|
3537
|
-
return array(this);
|
|
3538
|
-
},
|
|
3539
|
-
or(arg) {
|
|
3540
|
-
return union([this, arg]);
|
|
3541
|
-
},
|
|
3542
|
-
and(arg) {
|
|
3543
|
-
return intersection(this, arg);
|
|
3544
|
-
},
|
|
3545
|
-
transform(tx) {
|
|
3546
|
-
return pipe(this, transform(tx));
|
|
3547
|
-
},
|
|
3548
|
-
default(d) {
|
|
3549
|
-
return _default(this, d);
|
|
3550
|
-
},
|
|
3551
|
-
prefault(d) {
|
|
3552
|
-
return prefault(this, d);
|
|
3553
|
-
},
|
|
3554
|
-
catch(params) {
|
|
3555
|
-
return _catch(this, params);
|
|
3556
|
-
},
|
|
3557
|
-
pipe(target) {
|
|
3558
|
-
return pipe(this, target);
|
|
3559
|
-
},
|
|
3560
|
-
readonly() {
|
|
3561
|
-
return readonly(this);
|
|
3562
|
-
},
|
|
3563
|
-
describe(description) {
|
|
3564
|
-
const cl = this.clone();
|
|
3565
|
-
globalRegistry.add(cl, { description });
|
|
3566
|
-
return cl;
|
|
3567
|
-
},
|
|
3568
|
-
meta(...args) {
|
|
3569
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
3570
|
-
const cl = this.clone();
|
|
3571
|
-
globalRegistry.add(cl, args[0]);
|
|
3572
|
-
return cl;
|
|
3573
|
-
},
|
|
3574
|
-
isOptional() {
|
|
3575
|
-
return this.safeParse(void 0).success;
|
|
3576
|
-
},
|
|
3577
|
-
isNullable() {
|
|
3578
|
-
return this.safeParse(null).success;
|
|
3579
|
-
},
|
|
3580
|
-
apply(fn) {
|
|
3581
|
-
return fn(this);
|
|
3582
|
-
}
|
|
3583
|
-
});
|
|
3584
|
-
Object.defineProperty(inst, "description", {
|
|
3585
|
-
get() {
|
|
3586
|
-
return globalRegistry.get(inst)?.description;
|
|
3587
|
-
},
|
|
3588
|
-
configurable: true
|
|
3589
|
-
});
|
|
3590
4531
|
return inst;
|
|
4532
|
+
}, {
|
|
4533
|
+
check(...chks) {
|
|
4534
|
+
const def = this.def;
|
|
4535
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
4536
|
+
check: ch,
|
|
4537
|
+
def: { check: "custom" },
|
|
4538
|
+
onattach: []
|
|
4539
|
+
} } : ch)] }), { parent: true });
|
|
4540
|
+
},
|
|
4541
|
+
with(...chks) {
|
|
4542
|
+
return this.check(...chks);
|
|
4543
|
+
},
|
|
4544
|
+
clone(def, params) {
|
|
4545
|
+
return clone(this, def, params);
|
|
4546
|
+
},
|
|
4547
|
+
brand() {
|
|
4548
|
+
return this;
|
|
4549
|
+
},
|
|
4550
|
+
register(reg, meta) {
|
|
4551
|
+
reg.add(this, meta);
|
|
4552
|
+
return this;
|
|
4553
|
+
},
|
|
4554
|
+
refine(check, params) {
|
|
4555
|
+
return this.check(refine(check, params));
|
|
4556
|
+
},
|
|
4557
|
+
superRefine(refinement, params) {
|
|
4558
|
+
return this.check(superRefine(refinement, params));
|
|
4559
|
+
},
|
|
4560
|
+
overwrite(fn) {
|
|
4561
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
4562
|
+
},
|
|
4563
|
+
optional() {
|
|
4564
|
+
return optional(this);
|
|
4565
|
+
},
|
|
4566
|
+
exactOptional() {
|
|
4567
|
+
return exactOptional(this);
|
|
4568
|
+
},
|
|
4569
|
+
nullable() {
|
|
4570
|
+
return nullable(this);
|
|
4571
|
+
},
|
|
4572
|
+
nullish() {
|
|
4573
|
+
return optional(nullable(this));
|
|
4574
|
+
},
|
|
4575
|
+
nonoptional(params) {
|
|
4576
|
+
return nonoptional(this, params);
|
|
4577
|
+
},
|
|
4578
|
+
array() {
|
|
4579
|
+
return array(this);
|
|
4580
|
+
},
|
|
4581
|
+
or(arg) {
|
|
4582
|
+
return union([this, arg]);
|
|
4583
|
+
},
|
|
4584
|
+
and(arg) {
|
|
4585
|
+
return intersection(this, arg);
|
|
4586
|
+
},
|
|
4587
|
+
transform(tx) {
|
|
4588
|
+
return pipe(this, transform(tx));
|
|
4589
|
+
},
|
|
4590
|
+
default(d) {
|
|
4591
|
+
return _default(this, d);
|
|
4592
|
+
},
|
|
4593
|
+
prefault(d) {
|
|
4594
|
+
return prefault(this, d);
|
|
4595
|
+
},
|
|
4596
|
+
catch(params) {
|
|
4597
|
+
return _catch(this, params);
|
|
4598
|
+
},
|
|
4599
|
+
pipe(target) {
|
|
4600
|
+
return pipe(this, target);
|
|
4601
|
+
},
|
|
4602
|
+
readonly() {
|
|
4603
|
+
return readonly(this);
|
|
4604
|
+
},
|
|
4605
|
+
describe(description) {
|
|
4606
|
+
const cl = this.clone();
|
|
4607
|
+
globalRegistry.add(cl, { description });
|
|
4608
|
+
return cl;
|
|
4609
|
+
},
|
|
4610
|
+
meta(...args) {
|
|
4611
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
4612
|
+
const cl = this.clone();
|
|
4613
|
+
globalRegistry.add(cl, args[0]);
|
|
4614
|
+
return cl;
|
|
4615
|
+
},
|
|
4616
|
+
isOptional() {
|
|
4617
|
+
return this.safeParse(void 0).success;
|
|
4618
|
+
},
|
|
4619
|
+
isNullable() {
|
|
4620
|
+
return this.safeParse(null).success;
|
|
4621
|
+
},
|
|
4622
|
+
apply(fn, ...args) {
|
|
4623
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
4624
|
+
},
|
|
4625
|
+
get "~standard"() {
|
|
4626
|
+
return hide(this, "~standard", {
|
|
4627
|
+
...standardProps(this),
|
|
4628
|
+
jsonSchema: {
|
|
4629
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
4630
|
+
output: createStandardJSONSchemaMethod(this, "output")
|
|
4631
|
+
}
|
|
4632
|
+
});
|
|
4633
|
+
},
|
|
4634
|
+
set "~standard"(value) {
|
|
4635
|
+
own(this, "~standard", value);
|
|
4636
|
+
},
|
|
4637
|
+
parse: function _parse(data, params) {
|
|
4638
|
+
return parse(this, data, params, { callee: _parse });
|
|
4639
|
+
},
|
|
4640
|
+
parseAsync: async function _parseAsync(data, params) {
|
|
4641
|
+
return await parseAsync(this, data, params, { callee: _parseAsync });
|
|
4642
|
+
},
|
|
4643
|
+
safeParse(data, params) {
|
|
4644
|
+
return safeParse(this, data, params);
|
|
4645
|
+
},
|
|
4646
|
+
async safeParseAsync(data, params) {
|
|
4647
|
+
return safeParseAsync(this, data, params);
|
|
4648
|
+
},
|
|
4649
|
+
get spa() {
|
|
4650
|
+
return this?.safeParseAsync;
|
|
4651
|
+
},
|
|
4652
|
+
set spa(value) {
|
|
4653
|
+
own(this, "spa", value);
|
|
4654
|
+
},
|
|
4655
|
+
validate(data, params) {
|
|
4656
|
+
return validate(this, data, params);
|
|
4657
|
+
},
|
|
4658
|
+
validateAsync(data, params) {
|
|
4659
|
+
return validateAsync$1(this, data, params);
|
|
4660
|
+
},
|
|
4661
|
+
encode: function _encode(data, params) {
|
|
4662
|
+
return encode(this, data, params, { callee: _encode });
|
|
4663
|
+
},
|
|
4664
|
+
decode: function _decode(data, params) {
|
|
4665
|
+
return decode(this, data, params, { callee: _decode });
|
|
4666
|
+
},
|
|
4667
|
+
encodeAsync: async function _encodeAsync(data, params) {
|
|
4668
|
+
return await encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
4669
|
+
},
|
|
4670
|
+
decodeAsync: async function _decodeAsync(data, params) {
|
|
4671
|
+
return await decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
4672
|
+
},
|
|
4673
|
+
safeEncode(data, params) {
|
|
4674
|
+
return safeEncode(this, data, params);
|
|
4675
|
+
},
|
|
4676
|
+
safeDecode(data, params) {
|
|
4677
|
+
return safeDecode(this, data, params);
|
|
4678
|
+
},
|
|
4679
|
+
async safeEncodeAsync(data, params) {
|
|
4680
|
+
return safeEncodeAsync(this, data, params);
|
|
4681
|
+
},
|
|
4682
|
+
async safeDecodeAsync(data, params) {
|
|
4683
|
+
return safeDecodeAsync(this, data, params);
|
|
4684
|
+
},
|
|
4685
|
+
toJSONSchema(params) {
|
|
4686
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
4687
|
+
},
|
|
4688
|
+
get description() {
|
|
4689
|
+
return globalRegistry.get(this)?.description;
|
|
4690
|
+
},
|
|
4691
|
+
get _def() {
|
|
4692
|
+
return this._zod.def;
|
|
4693
|
+
}
|
|
3591
4694
|
});
|
|
3592
4695
|
/** @internal */
|
|
3593
4696
|
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
3594
4697
|
$ZodString.init(inst, def);
|
|
3595
4698
|
ZodType.init(inst, def);
|
|
3596
4699
|
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
});
|
|
4700
|
+
}, /*@__PURE__*/ derived({
|
|
4701
|
+
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
4702
|
+
minLength: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
4703
|
+
maxLength: (inst) => aggregateChecks(inst).maximum ?? null
|
|
4704
|
+
}, {
|
|
4705
|
+
regex(...args) {
|
|
4706
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
4707
|
+
},
|
|
4708
|
+
includes(...args) {
|
|
4709
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
4710
|
+
},
|
|
4711
|
+
startsWith(...args) {
|
|
4712
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
4713
|
+
},
|
|
4714
|
+
endsWith(...args) {
|
|
4715
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
4716
|
+
},
|
|
4717
|
+
min(...args) {
|
|
4718
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
4719
|
+
},
|
|
4720
|
+
max(...args) {
|
|
4721
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
4722
|
+
},
|
|
4723
|
+
length(...args) {
|
|
4724
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
4725
|
+
},
|
|
4726
|
+
nonempty(...args) {
|
|
4727
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
4728
|
+
},
|
|
4729
|
+
lowercase(params) {
|
|
4730
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
4731
|
+
},
|
|
4732
|
+
uppercase(params) {
|
|
4733
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
4734
|
+
},
|
|
4735
|
+
trim() {
|
|
4736
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
4737
|
+
},
|
|
4738
|
+
normalize(...args) {
|
|
4739
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
4740
|
+
},
|
|
4741
|
+
toLowerCase() {
|
|
4742
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
4743
|
+
},
|
|
4744
|
+
toUpperCase() {
|
|
4745
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
4746
|
+
},
|
|
4747
|
+
slugify() {
|
|
4748
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
4749
|
+
}
|
|
4750
|
+
}));
|
|
3649
4751
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
3650
4752
|
$ZodString.init(inst, def);
|
|
3651
4753
|
_ZodString.init(inst, def);
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
4754
|
+
}, {
|
|
4755
|
+
email(params) {
|
|
4756
|
+
return this.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
4757
|
+
},
|
|
4758
|
+
url(params) {
|
|
4759
|
+
return this.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
4760
|
+
},
|
|
4761
|
+
jwt(params) {
|
|
4762
|
+
return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
4763
|
+
},
|
|
4764
|
+
emoji(params) {
|
|
4765
|
+
return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
4766
|
+
},
|
|
4767
|
+
guid(params) {
|
|
4768
|
+
return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
4769
|
+
},
|
|
4770
|
+
uuid(params) {
|
|
4771
|
+
return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
4772
|
+
},
|
|
4773
|
+
uuidv4(params) {
|
|
4774
|
+
return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
4775
|
+
},
|
|
4776
|
+
uuidv6(params) {
|
|
4777
|
+
return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
4778
|
+
},
|
|
4779
|
+
uuidv7(params) {
|
|
4780
|
+
return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
4781
|
+
},
|
|
4782
|
+
nanoid(params) {
|
|
4783
|
+
return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
4784
|
+
},
|
|
4785
|
+
cuid(params) {
|
|
4786
|
+
return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
4787
|
+
},
|
|
4788
|
+
cuid2(params) {
|
|
4789
|
+
return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
4790
|
+
},
|
|
4791
|
+
ulid(params) {
|
|
4792
|
+
return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
4793
|
+
},
|
|
4794
|
+
base64(params) {
|
|
4795
|
+
return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
4796
|
+
},
|
|
4797
|
+
base64url(params) {
|
|
4798
|
+
return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
4799
|
+
},
|
|
4800
|
+
xid(params) {
|
|
4801
|
+
return this.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
4802
|
+
},
|
|
4803
|
+
ksuid(params) {
|
|
4804
|
+
return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
4805
|
+
},
|
|
4806
|
+
ipv4(params) {
|
|
4807
|
+
return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
4808
|
+
},
|
|
4809
|
+
ipv6(params) {
|
|
4810
|
+
return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
4811
|
+
},
|
|
4812
|
+
cidrv4(params) {
|
|
4813
|
+
return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
4814
|
+
},
|
|
4815
|
+
cidrv6(params) {
|
|
4816
|
+
return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
4817
|
+
},
|
|
4818
|
+
e164(params) {
|
|
4819
|
+
return this.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
4820
|
+
},
|
|
4821
|
+
datetime(params) {
|
|
4822
|
+
return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
|
|
4823
|
+
},
|
|
4824
|
+
date(params) {
|
|
4825
|
+
return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
|
|
4826
|
+
},
|
|
4827
|
+
time(params) {
|
|
4828
|
+
return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
|
|
4829
|
+
},
|
|
4830
|
+
duration(params) {
|
|
4831
|
+
return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
|
|
4832
|
+
}
|
|
3679
4833
|
});
|
|
3680
4834
|
function string(params) {
|
|
3681
4835
|
return /* @__PURE__ */ _string(ZodString, params);
|
|
@@ -3684,6 +4838,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3684
4838
|
$ZodStringFormat.init(inst, def);
|
|
3685
4839
|
_ZodString.init(inst, def);
|
|
3686
4840
|
});
|
|
4841
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
4842
|
+
$ZodISODateTime.init(inst, def);
|
|
4843
|
+
ZodStringFormat.init(inst, def);
|
|
4844
|
+
});
|
|
4845
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
4846
|
+
$ZodISODate.init(inst, def);
|
|
4847
|
+
ZodStringFormat.init(inst, def);
|
|
4848
|
+
});
|
|
4849
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
4850
|
+
$ZodISOTime.init(inst, def);
|
|
4851
|
+
ZodStringFormat.init(inst, def);
|
|
4852
|
+
});
|
|
4853
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
4854
|
+
$ZodISODuration.init(inst, def);
|
|
4855
|
+
ZodStringFormat.init(inst, def);
|
|
4856
|
+
});
|
|
3687
4857
|
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
3688
4858
|
$ZodEmail.init(inst, def);
|
|
3689
4859
|
ZodStringFormat.init(inst, def);
|
|
@@ -3769,60 +4939,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3769
4939
|
$ZodNumber.init(inst, def);
|
|
3770
4940
|
ZodType.init(inst, def);
|
|
3771
4941
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3772
|
-
_installLazyMethods(inst, "ZodNumber", {
|
|
3773
|
-
gt(value, params) {
|
|
3774
|
-
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
3775
|
-
},
|
|
3776
|
-
gte(value, params) {
|
|
3777
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3778
|
-
},
|
|
3779
|
-
min(value, params) {
|
|
3780
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3781
|
-
},
|
|
3782
|
-
lt(value, params) {
|
|
3783
|
-
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
3784
|
-
},
|
|
3785
|
-
lte(value, params) {
|
|
3786
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3787
|
-
},
|
|
3788
|
-
max(value, params) {
|
|
3789
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3790
|
-
},
|
|
3791
|
-
int(params) {
|
|
3792
|
-
return this.check(int(params));
|
|
3793
|
-
},
|
|
3794
|
-
safe(params) {
|
|
3795
|
-
return this.check(int(params));
|
|
3796
|
-
},
|
|
3797
|
-
positive(params) {
|
|
3798
|
-
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
3799
|
-
},
|
|
3800
|
-
nonnegative(params) {
|
|
3801
|
-
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
3802
|
-
},
|
|
3803
|
-
negative(params) {
|
|
3804
|
-
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
3805
|
-
},
|
|
3806
|
-
nonpositive(params) {
|
|
3807
|
-
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
3808
|
-
},
|
|
3809
|
-
multipleOf(value, params) {
|
|
3810
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3811
|
-
},
|
|
3812
|
-
step(value, params) {
|
|
3813
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3814
|
-
},
|
|
3815
|
-
finite() {
|
|
3816
|
-
return this;
|
|
3817
|
-
}
|
|
3818
|
-
});
|
|
3819
|
-
const bag = inst._zod.bag;
|
|
3820
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3821
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3822
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
3823
4942
|
inst.isFinite = true;
|
|
3824
|
-
|
|
3825
|
-
|
|
4943
|
+
}, /*@__PURE__*/ derived({
|
|
4944
|
+
minValue: (inst) => {
|
|
4945
|
+
const { minimum, exclusiveMinimum } = aggregateChecks(inst);
|
|
4946
|
+
return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
|
|
4947
|
+
},
|
|
4948
|
+
maxValue: (inst) => {
|
|
4949
|
+
const { maximum, exclusiveMaximum } = aggregateChecks(inst);
|
|
4950
|
+
return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
|
|
4951
|
+
},
|
|
4952
|
+
isInt: (inst) => {
|
|
4953
|
+
const { isInt, multipleOf } = aggregateChecks(inst);
|
|
4954
|
+
return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
|
|
4955
|
+
},
|
|
4956
|
+
format: (inst) => aggregateChecks(inst).format ?? null
|
|
4957
|
+
}, {
|
|
4958
|
+
gt(value, params) {
|
|
4959
|
+
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
4960
|
+
},
|
|
4961
|
+
gte(value, params) {
|
|
4962
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4963
|
+
},
|
|
4964
|
+
min(value, params) {
|
|
4965
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4966
|
+
},
|
|
4967
|
+
lt(value, params) {
|
|
4968
|
+
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
4969
|
+
},
|
|
4970
|
+
lte(value, params) {
|
|
4971
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4972
|
+
},
|
|
4973
|
+
max(value, params) {
|
|
4974
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4975
|
+
},
|
|
4976
|
+
int(params) {
|
|
4977
|
+
return this.check(int(params));
|
|
4978
|
+
},
|
|
4979
|
+
safe(params) {
|
|
4980
|
+
return this.check(int(params));
|
|
4981
|
+
},
|
|
4982
|
+
positive(params) {
|
|
4983
|
+
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
4984
|
+
},
|
|
4985
|
+
nonnegative(params) {
|
|
4986
|
+
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
4987
|
+
},
|
|
4988
|
+
negative(params) {
|
|
4989
|
+
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
4990
|
+
},
|
|
4991
|
+
nonpositive(params) {
|
|
4992
|
+
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
4993
|
+
},
|
|
4994
|
+
multipleOf(value, params) {
|
|
4995
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4996
|
+
},
|
|
4997
|
+
step(value, params) {
|
|
4998
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4999
|
+
},
|
|
5000
|
+
finite() {
|
|
5001
|
+
return this;
|
|
5002
|
+
}
|
|
5003
|
+
}));
|
|
3826
5004
|
function number(params) {
|
|
3827
5005
|
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
3828
5006
|
}
|
|
@@ -3866,94 +5044,80 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3866
5044
|
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3867
5045
|
}
|
|
3868
5046
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
5047
|
+
_ensureDefaultMemoizer();
|
|
3869
5048
|
$ZodArray.init(inst, def);
|
|
3870
5049
|
ZodType.init(inst, def);
|
|
3871
5050
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3872
5051
|
inst.element = def.element;
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
});
|
|
5052
|
+
}, {
|
|
5053
|
+
min(n, params) {
|
|
5054
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
5055
|
+
},
|
|
5056
|
+
nonempty(params) {
|
|
5057
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
5058
|
+
},
|
|
5059
|
+
max(n, params) {
|
|
5060
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
5061
|
+
},
|
|
5062
|
+
length(n, params) {
|
|
5063
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
5064
|
+
},
|
|
5065
|
+
unwrap() {
|
|
5066
|
+
return this.element;
|
|
5067
|
+
}
|
|
3890
5068
|
});
|
|
3891
5069
|
function array(element, params) {
|
|
3892
5070
|
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
3893
5071
|
}
|
|
3894
5072
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
5073
|
+
_ensureDefaultMemoizer();
|
|
3895
5074
|
$ZodObjectJIT.init(inst, def);
|
|
3896
5075
|
ZodType.init(inst, def);
|
|
3897
5076
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
}
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
}
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
}
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
return merge(this, other);
|
|
3943
|
-
},
|
|
3944
|
-
pick(mask) {
|
|
3945
|
-
return pick(this, mask);
|
|
3946
|
-
},
|
|
3947
|
-
omit(mask) {
|
|
3948
|
-
return omit(this, mask);
|
|
3949
|
-
},
|
|
3950
|
-
partial(...args) {
|
|
3951
|
-
return partial(ZodOptional, this, args[0]);
|
|
3952
|
-
},
|
|
3953
|
-
required(...args) {
|
|
3954
|
-
return required(ZodNonOptional, this, args[0]);
|
|
3955
|
-
}
|
|
3956
|
-
});
|
|
5077
|
+
installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
5078
|
+
}, {
|
|
5079
|
+
keyof() {
|
|
5080
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
5081
|
+
},
|
|
5082
|
+
catchall(catchall) {
|
|
5083
|
+
return this.clone(mergeDefs(this._zod.def, { catchall }));
|
|
5084
|
+
},
|
|
5085
|
+
passthrough() {
|
|
5086
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
5087
|
+
},
|
|
5088
|
+
loose() {
|
|
5089
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
5090
|
+
},
|
|
5091
|
+
strict() {
|
|
5092
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
|
|
5093
|
+
},
|
|
5094
|
+
strip() {
|
|
5095
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: void 0 }));
|
|
5096
|
+
},
|
|
5097
|
+
extend(incoming) {
|
|
5098
|
+
return extend(this, incoming);
|
|
5099
|
+
},
|
|
5100
|
+
safeExtend(incoming) {
|
|
5101
|
+
return safeExtend(this, incoming);
|
|
5102
|
+
},
|
|
5103
|
+
merge(other) {
|
|
5104
|
+
return merge(this, other);
|
|
5105
|
+
},
|
|
5106
|
+
pick(mask) {
|
|
5107
|
+
return pick(this, mask);
|
|
5108
|
+
},
|
|
5109
|
+
omit(mask) {
|
|
5110
|
+
return omit(this, mask);
|
|
5111
|
+
},
|
|
5112
|
+
partial(...args) {
|
|
5113
|
+
return partial(ZodOptional, this, args[0]);
|
|
5114
|
+
},
|
|
5115
|
+
exactPartial(...args) {
|
|
5116
|
+
return partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
5117
|
+
},
|
|
5118
|
+
required(...args) {
|
|
5119
|
+
return required(ZodNonOptional, this, args[0]);
|
|
5120
|
+
}
|
|
3957
5121
|
});
|
|
3958
5122
|
function object(shape, params) {
|
|
3959
5123
|
const def = {
|
|
@@ -3993,7 +5157,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3993
5157
|
ZodType.init(inst, def);
|
|
3994
5158
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
3995
5159
|
inst.enum = def.entries;
|
|
3996
|
-
inst.options =
|
|
5160
|
+
inst.options = [...inst._zod.values];
|
|
3997
5161
|
const keys = new Set(Object.keys(def.entries));
|
|
3998
5162
|
inst.extract = (values, params) => {
|
|
3999
5163
|
const newEntries = {};
|
|
@@ -4044,6 +5208,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4044
5208
|
});
|
|
4045
5209
|
}
|
|
4046
5210
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
5211
|
+
_ensureDefaultMemoizer();
|
|
4047
5212
|
$ZodTransform.init(inst, def);
|
|
4048
5213
|
ZodType.init(inst, def);
|
|
4049
5214
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -4055,7 +5220,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4055
5220
|
const _issue = issue$1;
|
|
4056
5221
|
if (_issue.fatal) _issue.continue = false;
|
|
4057
5222
|
_issue.code ?? (_issue.code = "custom");
|
|
4058
|
-
|
|
5223
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
4059
5224
|
_issue.inst ?? (_issue.inst = inst);
|
|
4060
5225
|
payload.issues.push(issue(_issue));
|
|
4061
5226
|
}
|
|
@@ -4063,11 +5228,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4063
5228
|
const output = def.transform(payload.value, payload);
|
|
4064
5229
|
if (output instanceof Promise) return output.then((output) => {
|
|
4065
5230
|
payload.value = output;
|
|
4066
|
-
payload.fallback = true;
|
|
4067
5231
|
return payload;
|
|
4068
5232
|
});
|
|
4069
5233
|
payload.value = output;
|
|
4070
|
-
payload.fallback = true;
|
|
4071
5234
|
return payload;
|
|
4072
5235
|
};
|
|
4073
5236
|
});
|
|
@@ -4168,7 +5331,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4168
5331
|
return new ZodCatch({
|
|
4169
5332
|
type: "catch",
|
|
4170
5333
|
innerType,
|
|
4171
|
-
catchValue: typeof catchValue === "function" ? catchValue : ()
|
|
5334
|
+
catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
|
|
4172
5335
|
});
|
|
4173
5336
|
}
|
|
4174
5337
|
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
@@ -5809,7 +6972,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5809
6972
|
}
|
|
5810
6973
|
var produce = new Immer2().produce;
|
|
5811
6974
|
//#endregion
|
|
5812
|
-
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-store@0.
|
|
6975
|
+
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-store@0.2.0-rc.2_@deepseek-ai+cordis@4.0.4/node_modules/@deepseek-ai/dsh-client-store/lib/index.js
|
|
5813
6976
|
/**
|
|
5814
6977
|
* React-free snapshot store engine (zustand vanilla + immer + subscribeWithSelector +
|
|
5815
6978
|
* rafFlush middleware + opt-in persist + dev freeze) plus the declarative
|
|
@@ -6110,56 +7273,56 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6110
7273
|
document.head.appendChild(tag);
|
|
6111
7274
|
}
|
|
6112
7275
|
var ContentPane_module_css_default = {
|
|
6113
|
-
"segButton": "_7W9u0W_segButton",
|
|
6114
|
-
"back": "_7W9u0W_back",
|
|
6115
|
-
"actionSpinning": "_7W9u0W_actionSpinning",
|
|
6116
|
-
"notice": "_7W9u0W_notice",
|
|
6117
|
-
"contentSearchInput": "_7W9u0W_contentSearchInput",
|
|
6118
|
-
"toggle": "_7W9u0W_toggle",
|
|
6119
|
-
"previewScroll": "_7W9u0W_previewScroll",
|
|
6120
7276
|
"seg": "_7W9u0W_seg",
|
|
6121
|
-
"pane-spin": "_7W9u0W_pane-spin",
|
|
6122
|
-
"searchCount": "_7W9u0W_searchCount",
|
|
6123
|
-
"segActive": "_7W9u0W_segActive",
|
|
6124
|
-
"image": "_7W9u0W_image",
|
|
6125
7277
|
"placeholder": "_7W9u0W_placeholder",
|
|
6126
|
-
"
|
|
6127
|
-
"
|
|
6128
|
-
"
|
|
6129
|
-
"
|
|
6130
|
-
"
|
|
6131
|
-
"
|
|
6132
|
-
"markedLine": "_7W9u0W_markedLine",
|
|
6133
|
-
"structuredBody": "_7W9u0W_structuredBody",
|
|
6134
|
-
"htmlToggleActive": "_7W9u0W_htmlToggleActive",
|
|
7278
|
+
"titleActions": "_7W9u0W_titleActions",
|
|
7279
|
+
"contentSearchInput": "_7W9u0W_contentSearchInput",
|
|
7280
|
+
"titleBar": "_7W9u0W_titleBar",
|
|
7281
|
+
"segActive": "_7W9u0W_segActive",
|
|
7282
|
+
"contentSearch": "_7W9u0W_contentSearch",
|
|
7283
|
+
"htmlFrameWrap": "_7W9u0W_htmlFrameWrap",
|
|
6135
7284
|
"scriptConfirm": "_7W9u0W_scriptConfirm",
|
|
7285
|
+
"imageScroll": "_7W9u0W_imageScroll",
|
|
7286
|
+
"back": "_7W9u0W_back",
|
|
7287
|
+
"viewButton": "_7W9u0W_viewButton",
|
|
6136
7288
|
"action": "_7W9u0W_action",
|
|
6137
|
-
"
|
|
7289
|
+
"htmlToggleActive": "_7W9u0W_htmlToggleActive",
|
|
6138
7290
|
"titleRow": "_7W9u0W_titleRow",
|
|
6139
7291
|
"pathRow": "_7W9u0W_pathRow",
|
|
6140
|
-
"
|
|
6141
|
-
"
|
|
6142
|
-
"
|
|
6143
|
-
"diffScroll": "_7W9u0W_diffScroll",
|
|
6144
|
-
"title": "_7W9u0W_title",
|
|
6145
|
-
"titleActions": "_7W9u0W_titleActions",
|
|
7292
|
+
"markedLine": "_7W9u0W_markedLine",
|
|
7293
|
+
"htmlRender": "_7W9u0W_htmlRender",
|
|
7294
|
+
"toggle": "_7W9u0W_toggle",
|
|
6146
7295
|
"pathLine": "_7W9u0W_pathLine",
|
|
6147
|
-
"
|
|
6148
|
-
"
|
|
6149
|
-
"
|
|
6150
|
-
"
|
|
7296
|
+
"body": "_7W9u0W_body",
|
|
7297
|
+
"actionSpinning": "_7W9u0W_actionSpinning",
|
|
7298
|
+
"image": "_7W9u0W_image",
|
|
7299
|
+
"markedPre": "_7W9u0W_markedPre",
|
|
7300
|
+
"htmlFrameExit": "_7W9u0W_htmlFrameExit",
|
|
7301
|
+
"previewScroll": "_7W9u0W_previewScroll",
|
|
7302
|
+
"notice": "_7W9u0W_notice",
|
|
7303
|
+
"scriptConfirmRun": "_7W9u0W_scriptConfirmRun",
|
|
7304
|
+
"bodyEmbedded": "_7W9u0W_bodyEmbedded",
|
|
7305
|
+
"split": "_7W9u0W_split",
|
|
7306
|
+
"structuredBanner": "_7W9u0W_structuredBanner",
|
|
7307
|
+
"langTag": "_7W9u0W_langTag",
|
|
7308
|
+
"structuredBody": "_7W9u0W_structuredBody",
|
|
7309
|
+
"stepButton": "_7W9u0W_stepButton",
|
|
6151
7310
|
"headerEmbedded": "_7W9u0W_headerEmbedded",
|
|
6152
|
-
"
|
|
6153
|
-
"
|
|
7311
|
+
"markedLineHit": "_7W9u0W_markedLineHit",
|
|
7312
|
+
"structuredInfo": "_7W9u0W_structuredInfo",
|
|
7313
|
+
"title": "_7W9u0W_title",
|
|
6154
7314
|
"contentMatch": "_7W9u0W_contentMatch",
|
|
7315
|
+
"viewActive": "_7W9u0W_viewActive",
|
|
7316
|
+
"structured": "_7W9u0W_structured",
|
|
7317
|
+
"htmlToggle": "_7W9u0W_htmlToggle",
|
|
6155
7318
|
"root": "_7W9u0W_root",
|
|
6156
|
-
"
|
|
6157
|
-
"
|
|
6158
|
-
"
|
|
6159
|
-
"
|
|
6160
|
-
"
|
|
6161
|
-
"
|
|
6162
|
-
"
|
|
7319
|
+
"segButton": "_7W9u0W_segButton",
|
|
7320
|
+
"pane-spin": "_7W9u0W_pane-spin",
|
|
7321
|
+
"viewControls": "_7W9u0W_viewControls",
|
|
7322
|
+
"diffScroll": "_7W9u0W_diffScroll",
|
|
7323
|
+
"htmlToggleBtn": "_7W9u0W_htmlToggleBtn",
|
|
7324
|
+
"scriptConfirmCancel": "_7W9u0W_scriptConfirmCancel",
|
|
7325
|
+
"searchCount": "_7W9u0W_searchCount"
|
|
6163
7326
|
};
|
|
6164
7327
|
//#endregion
|
|
6165
7328
|
//#region ../ui-content-preview/src/client/ContentPane.tsx
|
|
@@ -6869,32 +8032,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6869
8032
|
document.head.appendChild(tag);
|
|
6870
8033
|
}
|
|
6871
8034
|
var FilePreviewTab_module_css_default = {
|
|
6872
|
-
"
|
|
8035
|
+
"detailSep": "CLUbeW_detailSep",
|
|
8036
|
+
"detailName": "CLUbeW_detailName",
|
|
8037
|
+
"stepLabel": "CLUbeW_stepLabel",
|
|
8038
|
+
"rowOutside": "CLUbeW_rowOutside",
|
|
8039
|
+
"detail": "CLUbeW_detail",
|
|
8040
|
+
"rowDir": "CLUbeW_rowDir",
|
|
8041
|
+
"rowSelected": "CLUbeW_rowSelected",
|
|
8042
|
+
"tool": "CLUbeW_tool",
|
|
6873
8043
|
"search": "CLUbeW_search",
|
|
8044
|
+
"row": "CLUbeW_row",
|
|
6874
8045
|
"diffWrap": "CLUbeW_diffWrap",
|
|
6875
|
-
"
|
|
8046
|
+
"root": "CLUbeW_root",
|
|
6876
8047
|
"detailHeader": "CLUbeW_detailHeader",
|
|
6877
|
-
"
|
|
8048
|
+
"rowName": "CLUbeW_rowName",
|
|
8049
|
+
"match": "CLUbeW_match",
|
|
6878
8050
|
"detailSegWrap": "CLUbeW_detailSegWrap",
|
|
6879
|
-
"split": "CLUbeW_split",
|
|
6880
|
-
"stepLabel": "CLUbeW_stepLabel",
|
|
6881
|
-
"rowSelected": "CLUbeW_rowSelected",
|
|
6882
|
-
"row": "CLUbeW_row",
|
|
6883
|
-
"detailName": "CLUbeW_detailName",
|
|
6884
|
-
"rowDir": "CLUbeW_rowDir",
|
|
6885
8051
|
"detailPath": "CLUbeW_detailPath",
|
|
6886
|
-
"
|
|
8052
|
+
"rowStep": "CLUbeW_rowStep",
|
|
8053
|
+
"list": "CLUbeW_list",
|
|
6887
8054
|
"filterRow": "CLUbeW_filterRow",
|
|
6888
|
-
"
|
|
6889
|
-
"
|
|
6890
|
-
"
|
|
8055
|
+
"detailActions": "CLUbeW_detailActions",
|
|
8056
|
+
"detailSeg": "CLUbeW_detailSeg",
|
|
8057
|
+
"split": "CLUbeW_split",
|
|
6891
8058
|
"stepper": "CLUbeW_stepper",
|
|
6892
|
-
"list": "CLUbeW_list",
|
|
6893
|
-
"rowStep": "CLUbeW_rowStep",
|
|
6894
|
-
"rowOutside": "CLUbeW_rowOutside",
|
|
6895
8059
|
"stepButton": "CLUbeW_stepButton",
|
|
6896
|
-
"
|
|
6897
|
-
"detailSep": "CLUbeW_detailSep"
|
|
8060
|
+
"empty": "CLUbeW_empty"
|
|
6898
8061
|
};
|
|
6899
8062
|
//#endregion
|
|
6900
8063
|
//#region src/client/DiffHistory.tsx
|
|
@@ -7645,18 +8808,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7645
8808
|
document.head.appendChild(tag);
|
|
7646
8809
|
}
|
|
7647
8810
|
var TurnFileRow_module_css_default = {
|
|
7648
|
-
"card": "K-gCSG_card",
|
|
7649
|
-
"summary": "K-gCSG_summary",
|
|
7650
|
-
"list": "K-gCSG_list",
|
|
7651
|
-
"stats": "K-gCSG_stats",
|
|
7652
8811
|
"chevron": "K-gCSG_chevron",
|
|
7653
|
-
"added": "K-gCSG_added",
|
|
7654
8812
|
"removed": "K-gCSG_removed",
|
|
8813
|
+
"list": "K-gCSG_list",
|
|
8814
|
+
"summaryText": "K-gCSG_summaryText",
|
|
7655
8815
|
"file": "K-gCSG_file",
|
|
7656
|
-
"
|
|
7657
|
-
"name": "K-gCSG_name",
|
|
8816
|
+
"summary": "K-gCSG_summary",
|
|
7658
8817
|
"fileIcon": "K-gCSG_fileIcon",
|
|
7659
|
-
"
|
|
8818
|
+
"name": "K-gCSG_name",
|
|
8819
|
+
"dir": "K-gCSG_dir",
|
|
8820
|
+
"stats": "K-gCSG_stats",
|
|
8821
|
+
"added": "K-gCSG_added",
|
|
8822
|
+
"card": "K-gCSG_card"
|
|
7660
8823
|
};
|
|
7661
8824
|
//#endregion
|
|
7662
8825
|
//#region src/client/TurnFileRow.tsx
|