dsh-run2skill 0.4.0 → 0.5.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +13 -7
- package/README.md +13 -7
- package/lib/client.js +2065 -984
- package/lib/{contract-W_T3v8Fv.js → contract-vZz7H2_H.js} +2 -2
- package/lib/index.d.ts +47 -33
- package/lib/index.js +186 -71
- package/lib/typert.host.js +1 -1
- package/lib/typert.remote-client.js +1 -1
- package/package.json +50 -25
package/lib/client.js
CHANGED
|
@@ -6,70 +6,14 @@ window.__ModuleLoader__.load({
|
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
9
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
10
|
-
var _a$1;
|
|
11
|
-
function $constructor(name, initializer, params) {
|
|
12
|
-
function init(inst, def) {
|
|
13
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
14
|
-
value: {
|
|
15
|
-
def,
|
|
16
|
-
constr: _,
|
|
17
|
-
traits: /* @__PURE__ */ new Set()
|
|
18
|
-
},
|
|
19
|
-
enumerable: false
|
|
20
|
-
});
|
|
21
|
-
if (inst._zod.traits.has(name)) return;
|
|
22
|
-
inst._zod.traits.add(name);
|
|
23
|
-
initializer(inst, def);
|
|
24
|
-
const proto = _.prototype;
|
|
25
|
-
const keys = Object.keys(proto);
|
|
26
|
-
for (let i = 0; i < keys.length; i++) {
|
|
27
|
-
const k = keys[i];
|
|
28
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const Parent = params?.Parent ?? Object;
|
|
32
|
-
class Definition extends Parent {}
|
|
33
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
34
|
-
function _(def) {
|
|
35
|
-
var _a;
|
|
36
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
37
|
-
init(inst, def);
|
|
38
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
39
|
-
for (const fn of inst._zod.deferred) fn();
|
|
40
|
-
return inst;
|
|
41
|
-
}
|
|
42
|
-
Object.defineProperty(_, "init", { value: init });
|
|
43
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
44
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
45
|
-
return inst?._zod?.traits?.has(name);
|
|
46
|
-
} });
|
|
47
|
-
Object.defineProperty(_, "name", { value: name });
|
|
48
|
-
return _;
|
|
49
|
-
}
|
|
50
|
-
var $ZodAsyncError = class extends Error {
|
|
51
|
-
constructor() {
|
|
52
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var $ZodEncodeError = class extends Error {
|
|
56
|
-
constructor(name) {
|
|
57
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
58
|
-
this.name = "ZodEncodeError";
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
62
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
63
|
-
function config(newConfig) {
|
|
64
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
65
|
-
return globalConfig;
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
9
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/util.js
|
|
69
10
|
function getEnumValues(entries) {
|
|
70
11
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
71
12
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
72
13
|
}
|
|
14
|
+
function joinValues(array, separator = "|") {
|
|
15
|
+
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
16
|
+
}
|
|
73
17
|
function jsonStringifyReplacer(_, value) {
|
|
74
18
|
if (typeof value === "bigint") return value.toString();
|
|
75
19
|
return value;
|
|
@@ -94,7 +38,7 @@ window.__ModuleLoader__.load({
|
|
|
94
38
|
function floatSafeRemainder(val, step) {
|
|
95
39
|
const ratio = val / step;
|
|
96
40
|
const roundedRatio = Math.round(ratio);
|
|
97
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
41
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
98
42
|
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
99
43
|
return ratio - roundedRatio;
|
|
100
44
|
}
|
|
@@ -197,18 +141,23 @@ window.__ModuleLoader__.load({
|
|
|
197
141
|
};
|
|
198
142
|
return params;
|
|
199
143
|
}
|
|
144
|
+
function stringifyPrimitive(value) {
|
|
145
|
+
if (typeof value === "bigint") return value.toString() + "n";
|
|
146
|
+
if (typeof value === "string") return `"${value}"`;
|
|
147
|
+
return `${value}`;
|
|
148
|
+
}
|
|
200
149
|
function optionalKeys(shape) {
|
|
201
150
|
return Object.keys(shape).filter((k) => {
|
|
202
|
-
return shape[k]._zod.optin
|
|
151
|
+
return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
|
|
203
152
|
});
|
|
204
153
|
}
|
|
205
|
-
const NUMBER_FORMAT_RANGES = {
|
|
154
|
+
const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
206
155
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
207
156
|
int32: [-2147483648, 2147483647],
|
|
208
157
|
uint32: [0, 4294967295],
|
|
209
158
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
210
159
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
211
|
-
};
|
|
160
|
+
}))();
|
|
212
161
|
function pick(schema, mask) {
|
|
213
162
|
const currDef = schema._zod.def;
|
|
214
163
|
const checks = currDef.checks;
|
|
@@ -216,10 +165,10 @@ window.__ModuleLoader__.load({
|
|
|
216
165
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
217
166
|
get shape() {
|
|
218
167
|
const newShape = {};
|
|
219
|
-
for (const key
|
|
220
|
-
if (!(
|
|
168
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
169
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
221
170
|
if (!mask[key]) continue;
|
|
222
|
-
newShape
|
|
171
|
+
assignProp(newShape, key, currDef.shape[key]);
|
|
223
172
|
}
|
|
224
173
|
assignProp(this, "shape", newShape);
|
|
225
174
|
return newShape;
|
|
@@ -234,8 +183,8 @@ window.__ModuleLoader__.load({
|
|
|
234
183
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
235
184
|
get shape() {
|
|
236
185
|
const newShape = { ...schema._zod.def.shape };
|
|
237
|
-
for (const key
|
|
238
|
-
if (!(
|
|
186
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
187
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
239
188
|
if (!mask[key]) continue;
|
|
240
189
|
delete newShape[key];
|
|
241
190
|
}
|
|
@@ -250,7 +199,7 @@ window.__ModuleLoader__.load({
|
|
|
250
199
|
const checks = schema._zod.def.checks;
|
|
251
200
|
if (checks && checks.length > 0) {
|
|
252
201
|
const existingShape = schema._zod.def.shape;
|
|
253
|
-
for (const key
|
|
202
|
+
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.");
|
|
254
203
|
}
|
|
255
204
|
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
256
205
|
const _shape = {
|
|
@@ -273,6 +222,7 @@ window.__ModuleLoader__.load({
|
|
|
273
222
|
} }));
|
|
274
223
|
}
|
|
275
224
|
function merge(a, b) {
|
|
225
|
+
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
276
226
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
277
227
|
return clone(a, mergeDefs(a._zod.def, {
|
|
278
228
|
get shape() {
|
|
@@ -289,22 +239,22 @@ window.__ModuleLoader__.load({
|
|
|
289
239
|
checks: b._zod.def.checks ?? []
|
|
290
240
|
}));
|
|
291
241
|
}
|
|
292
|
-
function partial(Class, schema, mask) {
|
|
242
|
+
function partial(Class, schema, mask, name = "partial") {
|
|
293
243
|
const checks = schema._zod.def.checks;
|
|
294
|
-
if (checks && checks.length > 0) throw new Error(
|
|
244
|
+
if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
295
245
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
296
246
|
get shape() {
|
|
297
247
|
const oldShape = schema._zod.def.shape;
|
|
298
248
|
const shape = { ...oldShape };
|
|
299
|
-
if (mask) for (const key
|
|
300
|
-
if (!(key
|
|
249
|
+
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
250
|
+
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
301
251
|
if (!mask[key]) continue;
|
|
302
252
|
shape[key] = Class ? new Class({
|
|
303
253
|
type: "optional",
|
|
304
254
|
innerType: oldShape[key]
|
|
305
255
|
}) : oldShape[key];
|
|
306
256
|
}
|
|
307
|
-
else for (const key
|
|
257
|
+
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
|
|
308
258
|
type: "optional",
|
|
309
259
|
innerType: oldShape[key]
|
|
310
260
|
}) : oldShape[key];
|
|
@@ -318,15 +268,15 @@ window.__ModuleLoader__.load({
|
|
|
318
268
|
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
319
269
|
const oldShape = schema._zod.def.shape;
|
|
320
270
|
const shape = { ...oldShape };
|
|
321
|
-
if (mask) for (const key
|
|
322
|
-
if (!(key
|
|
271
|
+
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
272
|
+
if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
323
273
|
if (!mask[key]) continue;
|
|
324
274
|
shape[key] = new Class({
|
|
325
275
|
type: "nonoptional",
|
|
326
276
|
innerType: oldShape[key]
|
|
327
277
|
});
|
|
328
278
|
}
|
|
329
|
-
else for (const key
|
|
279
|
+
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
|
|
330
280
|
type: "nonoptional",
|
|
331
281
|
innerType: oldShape[key]
|
|
332
282
|
});
|
|
@@ -355,19 +305,54 @@ window.__ModuleLoader__.load({
|
|
|
355
305
|
function unwrapMessage(message) {
|
|
356
306
|
return typeof message === "string" ? message : message?.message;
|
|
357
307
|
}
|
|
308
|
+
function attachSchema(issues, start, inst) {
|
|
309
|
+
var _a;
|
|
310
|
+
for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
|
|
311
|
+
}
|
|
358
312
|
function finalizeIssue(iss, ctx, config) {
|
|
359
|
-
|
|
360
|
-
const
|
|
313
|
+
var _a;
|
|
314
|
+
const traits = iss.inst?._zod?.traits;
|
|
315
|
+
if (traits?.has("$ZodType")) {
|
|
316
|
+
if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
|
|
317
|
+
else iss.schema = iss.inst;
|
|
318
|
+
}
|
|
319
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
320
|
+
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";
|
|
321
|
+
const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
|
|
361
322
|
rest.path ?? (rest.path = []);
|
|
362
323
|
rest.message = message;
|
|
363
324
|
if (ctx?.reportInput) rest.input = _input;
|
|
364
325
|
return rest;
|
|
365
326
|
}
|
|
327
|
+
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
328
|
+
function codePointLength(str) {
|
|
329
|
+
const units = str.length;
|
|
330
|
+
if (!highSurrogate.test(str)) return units;
|
|
331
|
+
let count = units;
|
|
332
|
+
for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
333
|
+
count--;
|
|
334
|
+
i++;
|
|
335
|
+
}
|
|
336
|
+
return count;
|
|
337
|
+
}
|
|
366
338
|
function getLengthableOrigin(input) {
|
|
367
339
|
if (Array.isArray(input)) return "array";
|
|
368
340
|
if (typeof input === "string") return "string";
|
|
369
341
|
return "unknown";
|
|
370
342
|
}
|
|
343
|
+
function parsedType(data) {
|
|
344
|
+
const t = typeof data;
|
|
345
|
+
switch (t) {
|
|
346
|
+
case "number": return Number.isNaN(data) ? "nan" : "number";
|
|
347
|
+
case "object": {
|
|
348
|
+
if (data === null) return "null";
|
|
349
|
+
if (Array.isArray(data)) return "array";
|
|
350
|
+
const obj = data;
|
|
351
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return t;
|
|
355
|
+
}
|
|
371
356
|
function issue(...args) {
|
|
372
357
|
const [iss, input, inst] = args;
|
|
373
358
|
if (typeof iss === "string") return {
|
|
@@ -378,33 +363,330 @@ window.__ModuleLoader__.load({
|
|
|
378
363
|
};
|
|
379
364
|
return { ...iss };
|
|
380
365
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
366
|
+
/**
|
|
367
|
+
* 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.
|
|
368
|
+
*
|
|
369
|
+
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
370
|
+
*/
|
|
371
|
+
function members(proto, table) {
|
|
372
|
+
for (const key in table) {
|
|
373
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
374
|
+
if (desc.get) Object.defineProperty(proto, key, {
|
|
375
|
+
...desc,
|
|
376
|
+
enumerable: false
|
|
377
|
+
});
|
|
378
|
+
else defineBound(proto, key, desc.value);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
382
|
+
function own(inst, key, value, enumerable = true) {
|
|
383
|
+
Object.defineProperty(inst, key, {
|
|
384
|
+
configurable: true,
|
|
385
|
+
writable: true,
|
|
386
|
+
enumerable,
|
|
387
|
+
value
|
|
388
388
|
});
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
return value;
|
|
390
|
+
}
|
|
391
|
+
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
392
|
+
function hide(inst, key, value) {
|
|
393
|
+
return own(inst, key, value, false);
|
|
394
|
+
}
|
|
395
|
+
function defineBound(proto, key, fn) {
|
|
396
|
+
Object.defineProperty(proto, key, {
|
|
397
|
+
configurable: true,
|
|
398
|
+
get() {
|
|
399
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
400
|
+
},
|
|
401
|
+
set(value) {
|
|
402
|
+
own(this, key, value);
|
|
403
|
+
}
|
|
392
404
|
});
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
405
|
+
}
|
|
406
|
+
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
407
|
+
function claim(inst, sentinel) {
|
|
408
|
+
const proto = Object.getPrototypeOf(inst);
|
|
409
|
+
return sentinel in proto ? void 0 : proto;
|
|
410
|
+
}
|
|
411
|
+
let installing;
|
|
412
|
+
let broke = false;
|
|
413
|
+
const breaker = {
|
|
414
|
+
configurable: true,
|
|
415
|
+
get() {
|
|
416
|
+
broke = true;
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
421
|
+
* constructor, computed from the internals object itself and cached there on
|
|
422
|
+
* first read. One accessor per constructor rather than one per instance.
|
|
423
|
+
*/
|
|
424
|
+
function defineLazyInternal(inst, key, compute) {
|
|
425
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
426
|
+
if (key in proto && installing !== inst._zod) {
|
|
427
|
+
installing = void 0;
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
installing = inst._zod;
|
|
431
|
+
Object.defineProperty(proto, key, {
|
|
432
|
+
configurable: true,
|
|
433
|
+
get() {
|
|
434
|
+
Object.defineProperty(this, key, breaker);
|
|
435
|
+
const outer = broke;
|
|
436
|
+
broke = false;
|
|
437
|
+
try {
|
|
438
|
+
const value = compute(this);
|
|
439
|
+
if (broke) delete this[key];
|
|
440
|
+
else Object.defineProperty(this, key, {
|
|
441
|
+
configurable: true,
|
|
442
|
+
writable: true,
|
|
443
|
+
value
|
|
444
|
+
});
|
|
445
|
+
broke = broke || outer;
|
|
446
|
+
return value;
|
|
447
|
+
} catch (err) {
|
|
448
|
+
delete this[key];
|
|
449
|
+
broke = broke || outer;
|
|
450
|
+
throw err;
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
set(value) {
|
|
454
|
+
Object.defineProperty(this, key, {
|
|
455
|
+
configurable: true,
|
|
456
|
+
writable: true,
|
|
457
|
+
value
|
|
458
|
+
});
|
|
459
|
+
}
|
|
397
460
|
});
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
464
|
+
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
465
|
+
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
466
|
+
*/
|
|
467
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
468
|
+
const proto = claim(inst, key);
|
|
469
|
+
if (!proto) return;
|
|
470
|
+
Object.defineProperty(proto, key, {
|
|
471
|
+
configurable: true,
|
|
472
|
+
get() {
|
|
473
|
+
const desc = {
|
|
474
|
+
configurable: true,
|
|
475
|
+
writable: true,
|
|
476
|
+
enumerable,
|
|
477
|
+
value: void 0
|
|
478
|
+
};
|
|
479
|
+
Object.defineProperty(this, key, desc);
|
|
480
|
+
desc.value = make(this);
|
|
481
|
+
Object.defineProperty(this, key, desc);
|
|
482
|
+
return desc.value;
|
|
483
|
+
},
|
|
484
|
+
set(value) {
|
|
485
|
+
Object.defineProperty(this, key, {
|
|
486
|
+
configurable: true,
|
|
487
|
+
writable: true,
|
|
488
|
+
enumerable,
|
|
489
|
+
value
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
/** 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. */
|
|
495
|
+
const CONSTANT_CATCH = "~constantCatch";
|
|
496
|
+
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
497
|
+
function constantCatch(value) {
|
|
498
|
+
const fn = () => value;
|
|
499
|
+
fn[CONSTANT_CATCH] = true;
|
|
500
|
+
return fn;
|
|
501
|
+
}
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/core.js
|
|
504
|
+
var _a$1;
|
|
505
|
+
const _zodDesc$1 = {
|
|
506
|
+
value: void 0,
|
|
507
|
+
enumerable: false
|
|
508
|
+
};
|
|
509
|
+
let _E = "captureStackTrace" in Error ? Error : null;
|
|
510
|
+
function newError(Definition) {
|
|
511
|
+
const E = _E;
|
|
512
|
+
if (E) {
|
|
513
|
+
const saved = E.stackTraceLimit;
|
|
514
|
+
if (typeof saved === "number") {
|
|
515
|
+
try {
|
|
516
|
+
E.stackTraceLimit = 0;
|
|
517
|
+
} catch {
|
|
518
|
+
_E = null;
|
|
519
|
+
return new Definition();
|
|
520
|
+
}
|
|
521
|
+
try {
|
|
522
|
+
return new Definition();
|
|
523
|
+
} finally {
|
|
524
|
+
E.stackTraceLimit = saved;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return new Definition();
|
|
529
|
+
}
|
|
530
|
+
function $constructor(name, initializer, proto, params) {
|
|
531
|
+
const zodProto = {};
|
|
532
|
+
function Internals(def) {
|
|
533
|
+
this.def = def;
|
|
534
|
+
this.constr = _;
|
|
535
|
+
this.traits = /* @__PURE__ */ new Set();
|
|
536
|
+
}
|
|
537
|
+
Internals.prototype = zodProto;
|
|
538
|
+
const protoMembers = proto;
|
|
539
|
+
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
540
|
+
function init(inst, def) {
|
|
541
|
+
if (!inst._zod) {
|
|
542
|
+
_zodDesc$1.value = new Internals(def);
|
|
543
|
+
try {
|
|
544
|
+
Object.defineProperty(inst, "_zod", _zodDesc$1);
|
|
545
|
+
} finally {
|
|
546
|
+
_zodDesc$1.value = void 0;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
if (inst._zod.traits.has(name)) return;
|
|
550
|
+
inst._zod.traits.add(name);
|
|
551
|
+
initializer(inst, def);
|
|
552
|
+
if (initialized) {
|
|
553
|
+
const own = Object.getPrototypeOf(inst);
|
|
554
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
555
|
+
let up = own;
|
|
556
|
+
while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
|
|
557
|
+
const target = up ?? own;
|
|
558
|
+
if (!initialized.has(target)) {
|
|
559
|
+
initialized.add(target);
|
|
560
|
+
members(target, protoMembers);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
const proto = _.prototype;
|
|
564
|
+
for (const k in proto) {
|
|
565
|
+
if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
|
|
566
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
const Parent = params?.Parent ?? Object;
|
|
570
|
+
class Definition extends Parent {}
|
|
571
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
572
|
+
function _(def) {
|
|
573
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
574
|
+
init(inst, def);
|
|
575
|
+
const deferred = inst._zod.deferred;
|
|
576
|
+
if (deferred) {
|
|
577
|
+
for (const fn of deferred) fn();
|
|
578
|
+
inst._zod.deferred = void 0;
|
|
579
|
+
}
|
|
580
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
581
|
+
if (pp) pp(inst);
|
|
582
|
+
return inst;
|
|
583
|
+
}
|
|
584
|
+
Object.defineProperty(_, "init", { value: init });
|
|
585
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
586
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
587
|
+
return inst?._zod?.traits?.has(name);
|
|
588
|
+
} });
|
|
589
|
+
Object.defineProperty(_, "name", { value: name });
|
|
590
|
+
return _;
|
|
591
|
+
}
|
|
592
|
+
var $ZodAsyncError = class extends Error {
|
|
593
|
+
constructor() {
|
|
594
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
var $ZodEncodeError = class extends Error {
|
|
598
|
+
constructor(name) {
|
|
599
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
600
|
+
this.name = "ZodEncodeError";
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
604
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
605
|
+
function config(newConfig) {
|
|
606
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
607
|
+
return globalConfig;
|
|
608
|
+
}
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/errors.js
|
|
611
|
+
function _getMessage() {
|
|
612
|
+
const internals = this._zod;
|
|
613
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
614
|
+
return internals.message;
|
|
615
|
+
}
|
|
616
|
+
function _setMessage(value) {
|
|
617
|
+
this._zod.message = value;
|
|
618
|
+
}
|
|
619
|
+
const _messageDesc = {
|
|
620
|
+
get: _getMessage,
|
|
621
|
+
set: _setMessage,
|
|
622
|
+
enumerable: true,
|
|
623
|
+
configurable: true
|
|
624
|
+
};
|
|
625
|
+
const _zodDesc = {
|
|
626
|
+
value: void 0,
|
|
627
|
+
enumerable: false
|
|
628
|
+
};
|
|
629
|
+
const _issuesDesc = {
|
|
630
|
+
value: void 0,
|
|
631
|
+
enumerable: false
|
|
632
|
+
};
|
|
633
|
+
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
634
|
+
const initializer$1 = (inst, def) => {
|
|
635
|
+
inst.name = "$ZodError";
|
|
636
|
+
_zodDesc.value = inst._zod;
|
|
637
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
638
|
+
_issuesDesc.value = def;
|
|
639
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
640
|
+
_zodDesc.value = void 0;
|
|
641
|
+
_issuesDesc.value = void 0;
|
|
642
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
643
|
+
const proto = Object.getPrototypeOf(inst);
|
|
644
|
+
if (!_installedToString.has(proto)) {
|
|
645
|
+
_installedToString.add(proto);
|
|
646
|
+
Object.defineProperty(proto, "toString", {
|
|
647
|
+
configurable: true,
|
|
648
|
+
enumerable: false,
|
|
649
|
+
get() {
|
|
650
|
+
const value = () => this.message;
|
|
651
|
+
Object.defineProperty(this, "toString", {
|
|
652
|
+
value,
|
|
653
|
+
configurable: true,
|
|
654
|
+
writable: true
|
|
655
|
+
});
|
|
656
|
+
return value;
|
|
657
|
+
},
|
|
658
|
+
set(value) {
|
|
659
|
+
Object.defineProperty(this, "toString", {
|
|
660
|
+
value,
|
|
661
|
+
configurable: true,
|
|
662
|
+
writable: true
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
}
|
|
398
667
|
};
|
|
399
668
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
400
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
669
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
|
|
670
|
+
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
671
|
+
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
672
|
+
* "__proto__" would hit the setter instead of creating a key. */
|
|
673
|
+
function node(obj, key, make) {
|
|
674
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
675
|
+
if (key === "__proto__") Object.defineProperty(obj, key, {
|
|
676
|
+
value: make(),
|
|
677
|
+
writable: true,
|
|
678
|
+
enumerable: true,
|
|
679
|
+
configurable: true
|
|
680
|
+
});
|
|
681
|
+
else obj[key] = make();
|
|
682
|
+
}
|
|
683
|
+
return obj[key];
|
|
684
|
+
}
|
|
401
685
|
function flattenError(error, mapper = (issue) => issue.message) {
|
|
402
686
|
const fieldErrors = {};
|
|
403
687
|
const formErrors = [];
|
|
404
|
-
for (const sub of error.issues) if (sub.path.length > 0)
|
|
405
|
-
|
|
406
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
407
|
-
} else formErrors.push(mapper(sub));
|
|
688
|
+
for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
689
|
+
else formErrors.push(mapper(sub));
|
|
408
690
|
return {
|
|
409
691
|
formErrors,
|
|
410
692
|
fieldErrors
|
|
@@ -424,12 +706,21 @@ window.__ModuleLoader__.load({
|
|
|
424
706
|
let i = 0;
|
|
425
707
|
while (i < fullpath.length) {
|
|
426
708
|
const el = fullpath[i];
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
709
|
+
const terminal = i === fullpath.length - 1;
|
|
710
|
+
if (el === "_errors") {
|
|
711
|
+
if (terminal) curr._errors.push(mapper(issue));
|
|
712
|
+
i++;
|
|
713
|
+
continue;
|
|
431
714
|
}
|
|
432
|
-
curr
|
|
715
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
|
|
716
|
+
value: { _errors: [] },
|
|
717
|
+
enumerable: true,
|
|
718
|
+
writable: true,
|
|
719
|
+
configurable: true
|
|
720
|
+
});
|
|
721
|
+
const node = curr[el];
|
|
722
|
+
if (terminal) node._errors.push(mapper(issue));
|
|
723
|
+
curr = node;
|
|
433
724
|
i++;
|
|
434
725
|
}
|
|
435
726
|
}
|
|
@@ -439,40 +730,52 @@ window.__ModuleLoader__.load({
|
|
|
439
730
|
return fieldErrors;
|
|
440
731
|
}
|
|
441
732
|
//#endregion
|
|
442
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
733
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/parse.js
|
|
734
|
+
function finalizeParams(callee, params) {
|
|
735
|
+
return {
|
|
736
|
+
callee: params?.callee ?? callee,
|
|
737
|
+
Err: params?.Err
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
const _parse = (_Err) => {
|
|
741
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
742
|
+
const ctx = _ctx ? {
|
|
743
|
+
..._ctx,
|
|
744
|
+
async: false
|
|
745
|
+
} : { async: false };
|
|
746
|
+
const result = schema._zod.run({
|
|
747
|
+
value,
|
|
748
|
+
issues: []
|
|
749
|
+
}, ctx);
|
|
750
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
751
|
+
if (result.issues.length) {
|
|
752
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
753
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
754
|
+
throw e;
|
|
755
|
+
}
|
|
756
|
+
return result.value;
|
|
757
|
+
};
|
|
758
|
+
return fn;
|
|
459
759
|
};
|
|
460
|
-
const _parseAsync = (_Err) =>
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
760
|
+
const _parseAsync = (_Err) => {
|
|
761
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
762
|
+
const ctx = _ctx ? {
|
|
763
|
+
..._ctx,
|
|
764
|
+
async: true
|
|
765
|
+
} : { async: true };
|
|
766
|
+
let result = schema._zod.run({
|
|
767
|
+
value,
|
|
768
|
+
issues: []
|
|
769
|
+
}, ctx);
|
|
770
|
+
if (result instanceof Promise) result = await result;
|
|
771
|
+
if (result.issues.length) {
|
|
772
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
773
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
774
|
+
throw e;
|
|
775
|
+
}
|
|
776
|
+
return result.value;
|
|
777
|
+
};
|
|
778
|
+
return fn;
|
|
476
779
|
};
|
|
477
780
|
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
478
781
|
const ctx = _ctx ? {
|
|
@@ -512,25 +815,41 @@ window.__ModuleLoader__.load({
|
|
|
512
815
|
};
|
|
513
816
|
};
|
|
514
817
|
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
515
|
-
const _encode = (_Err) =>
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
818
|
+
const _encode = (_Err) => {
|
|
819
|
+
const parse = _parse(_Err);
|
|
820
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
821
|
+
const ctx = _ctx ? {
|
|
822
|
+
..._ctx,
|
|
823
|
+
direction: "backward"
|
|
824
|
+
} : { direction: "backward" };
|
|
825
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
826
|
+
};
|
|
827
|
+
return fn;
|
|
521
828
|
};
|
|
522
|
-
const _decode = (_Err) =>
|
|
523
|
-
|
|
829
|
+
const _decode = (_Err) => {
|
|
830
|
+
const parse = _parse(_Err);
|
|
831
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
832
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
833
|
+
};
|
|
834
|
+
return fn;
|
|
524
835
|
};
|
|
525
|
-
const _encodeAsync = (_Err) =>
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
836
|
+
const _encodeAsync = (_Err) => {
|
|
837
|
+
const parseAsync = _parseAsync(_Err);
|
|
838
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
839
|
+
const ctx = _ctx ? {
|
|
840
|
+
..._ctx,
|
|
841
|
+
direction: "backward"
|
|
842
|
+
} : { direction: "backward" };
|
|
843
|
+
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
844
|
+
};
|
|
845
|
+
return fn;
|
|
531
846
|
};
|
|
532
|
-
const _decodeAsync = (_Err) =>
|
|
533
|
-
|
|
847
|
+
const _decodeAsync = (_Err) => {
|
|
848
|
+
const parseAsync = _parseAsync(_Err);
|
|
849
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
850
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
851
|
+
};
|
|
852
|
+
return fn;
|
|
534
853
|
};
|
|
535
854
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
536
855
|
const ctx = _ctx ? {
|
|
@@ -553,7 +872,7 @@ window.__ModuleLoader__.load({
|
|
|
553
872
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
554
873
|
};
|
|
555
874
|
//#endregion
|
|
556
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
875
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/regexes.js
|
|
557
876
|
/**
|
|
558
877
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
559
878
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -561,12 +880,15 @@ window.__ModuleLoader__.load({
|
|
|
561
880
|
*/
|
|
562
881
|
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
563
882
|
const cuid2 = /^[0-9a-z]+$/;
|
|
564
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{
|
|
883
|
+
const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
565
884
|
const xid = /^[0-9a-vA-V]{20}$/;
|
|
566
885
|
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
567
886
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
887
|
+
function nanoidOfLength(length) {
|
|
888
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
889
|
+
}
|
|
568
890
|
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
569
|
-
const duration
|
|
891
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
570
892
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
571
893
|
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})$/;
|
|
572
894
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
@@ -578,33 +900,41 @@ window.__ModuleLoader__.load({
|
|
|
578
900
|
};
|
|
579
901
|
/** Practical email validation */
|
|
580
902
|
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
581
|
-
const _emoji$1 = `^
|
|
903
|
+
const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
582
904
|
function emoji() {
|
|
583
905
|
return new RegExp(_emoji$1, "u");
|
|
584
906
|
}
|
|
585
907
|
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])$/;
|
|
586
908
|
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}|:))$/;
|
|
587
909
|
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])$/;
|
|
588
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
910
|
+
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])$/;
|
|
589
911
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
590
912
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
591
913
|
const httpProtocol = /^https?$/;
|
|
592
914
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
593
915
|
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])))`;
|
|
594
|
-
|
|
916
|
+
/** Anchors a pattern source. The interpolation lives here rather than at the call site because
|
|
917
|
+
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
918
|
+
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
|
|
919
|
+
function anchor(source) {
|
|
920
|
+
return new RegExp(`^${source}$`);
|
|
921
|
+
}
|
|
922
|
+
const date = /*@__PURE__*/ anchor(dateSource);
|
|
595
923
|
function timeSource(args) {
|
|
596
924
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
597
|
-
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+)?)?`;
|
|
925
|
+
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+)?)?`;
|
|
598
926
|
}
|
|
599
|
-
function time
|
|
927
|
+
function time(args) {
|
|
600
928
|
return new RegExp(`^${timeSource(args)}$`);
|
|
601
929
|
}
|
|
602
|
-
function datetime
|
|
603
|
-
const time = timeSource({ precision: args.precision });
|
|
930
|
+
function datetime(args) {
|
|
604
931
|
const opts = ["Z"];
|
|
605
|
-
if (args.local) opts.push("");
|
|
606
932
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
607
|
-
const
|
|
933
|
+
const qualified = `${timeSource({
|
|
934
|
+
precision: args.precision,
|
|
935
|
+
seconds: true
|
|
936
|
+
})}(?:${opts.join("|")})`;
|
|
937
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
608
938
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
609
939
|
}
|
|
610
940
|
const string$1 = (params) => {
|
|
@@ -618,13 +948,18 @@ window.__ModuleLoader__.load({
|
|
|
618
948
|
const lowercase = /^[^A-Z]*$/;
|
|
619
949
|
const uppercase = /^[^a-z]*$/;
|
|
620
950
|
//#endregion
|
|
621
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
951
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/checks.js
|
|
622
952
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
623
953
|
var _a;
|
|
624
954
|
inst._zod ?? (inst._zod = {});
|
|
625
955
|
inst._zod.def = def;
|
|
626
956
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
627
957
|
});
|
|
958
|
+
/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
|
|
959
|
+
const _whenHasLength = (payload) => {
|
|
960
|
+
const val = payload.value;
|
|
961
|
+
return !nullish(val) && val.length !== void 0;
|
|
962
|
+
};
|
|
628
963
|
const numericOriginMap = {
|
|
629
964
|
number: "number",
|
|
630
965
|
bigint: "bigint",
|
|
@@ -644,7 +979,7 @@ window.__ModuleLoader__.load({
|
|
|
644
979
|
inst._zod.check = (payload) => {
|
|
645
980
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
646
981
|
payload.issues.push({
|
|
647
|
-
origin,
|
|
982
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
648
983
|
code: "too_big",
|
|
649
984
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
650
985
|
input: payload.value,
|
|
@@ -668,7 +1003,7 @@ window.__ModuleLoader__.load({
|
|
|
668
1003
|
inst._zod.check = (payload) => {
|
|
669
1004
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
670
1005
|
payload.issues.push({
|
|
671
|
-
origin,
|
|
1006
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
672
1007
|
code: "too_small",
|
|
673
1008
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
674
1009
|
input: payload.value,
|
|
@@ -686,7 +1021,7 @@ window.__ModuleLoader__.load({
|
|
|
686
1021
|
});
|
|
687
1022
|
inst._zod.check = (payload) => {
|
|
688
1023
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
689
|
-
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
1024
|
+
if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
690
1025
|
payload.issues.push({
|
|
691
1026
|
origin: typeof payload.value,
|
|
692
1027
|
code: "not_multiple_of",
|
|
@@ -771,17 +1106,15 @@ window.__ModuleLoader__.load({
|
|
|
771
1106
|
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
772
1107
|
var _a;
|
|
773
1108
|
$ZodCheck.init(inst, def);
|
|
774
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
775
|
-
const val = payload.value;
|
|
776
|
-
return !nullish(val) && val.length !== void 0;
|
|
777
|
-
});
|
|
1109
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
778
1110
|
inst._zod.onattach.push((inst) => {
|
|
779
1111
|
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
780
1112
|
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
781
1113
|
});
|
|
782
1114
|
inst._zod.check = (payload) => {
|
|
783
1115
|
const input = payload.value;
|
|
784
|
-
|
|
1116
|
+
const units = input.length;
|
|
1117
|
+
if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
|
|
785
1118
|
const origin = getLengthableOrigin(input);
|
|
786
1119
|
payload.issues.push({
|
|
787
1120
|
origin,
|
|
@@ -797,17 +1130,15 @@ window.__ModuleLoader__.load({
|
|
|
797
1130
|
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
798
1131
|
var _a;
|
|
799
1132
|
$ZodCheck.init(inst, def);
|
|
800
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
801
|
-
const val = payload.value;
|
|
802
|
-
return !nullish(val) && val.length !== void 0;
|
|
803
|
-
});
|
|
1133
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
804
1134
|
inst._zod.onattach.push((inst) => {
|
|
805
1135
|
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
806
1136
|
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
807
1137
|
});
|
|
808
1138
|
inst._zod.check = (payload) => {
|
|
809
1139
|
const input = payload.value;
|
|
810
|
-
|
|
1140
|
+
const units = input.length;
|
|
1141
|
+
if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
|
|
811
1142
|
const origin = getLengthableOrigin(input);
|
|
812
1143
|
payload.issues.push({
|
|
813
1144
|
origin,
|
|
@@ -823,10 +1154,7 @@ window.__ModuleLoader__.load({
|
|
|
823
1154
|
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
824
1155
|
var _a;
|
|
825
1156
|
$ZodCheck.init(inst, def);
|
|
826
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
827
|
-
const val = payload.value;
|
|
828
|
-
return !nullish(val) && val.length !== void 0;
|
|
829
|
-
});
|
|
1157
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
830
1158
|
inst._zod.onattach.push((inst) => {
|
|
831
1159
|
const bag = inst._zod.bag;
|
|
832
1160
|
bag.minimum = def.length;
|
|
@@ -835,7 +1163,8 @@ window.__ModuleLoader__.load({
|
|
|
835
1163
|
});
|
|
836
1164
|
inst._zod.check = (payload) => {
|
|
837
1165
|
const input = payload.value;
|
|
838
|
-
const
|
|
1166
|
+
const units = input.length;
|
|
1167
|
+
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
839
1168
|
if (length === def.length) return;
|
|
840
1169
|
const origin = getLengthableOrigin(input);
|
|
841
1170
|
const tooBig = length > def.length;
|
|
@@ -909,7 +1238,7 @@ window.__ModuleLoader__.load({
|
|
|
909
1238
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
910
1239
|
$ZodCheck.init(inst, def);
|
|
911
1240
|
const escapedRegex = escapeRegex(def.includes);
|
|
912
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
1241
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
913
1242
|
def.pattern = pattern;
|
|
914
1243
|
inst._zod.onattach.push((inst) => {
|
|
915
1244
|
const bag = inst._zod.bag;
|
|
@@ -980,12 +1309,13 @@ window.__ModuleLoader__.load({
|
|
|
980
1309
|
};
|
|
981
1310
|
});
|
|
982
1311
|
//#endregion
|
|
983
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
1312
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/doc.js
|
|
984
1313
|
var Doc = class {
|
|
985
|
-
constructor(args = []) {
|
|
1314
|
+
constructor(args = [], closed = {}) {
|
|
986
1315
|
this.content = [];
|
|
987
1316
|
this.indent = 0;
|
|
988
|
-
|
|
1317
|
+
this.args = args;
|
|
1318
|
+
this.closed = closed;
|
|
989
1319
|
}
|
|
990
1320
|
indented(fn) {
|
|
991
1321
|
this.indent += 1;
|
|
@@ -1005,28 +1335,27 @@ window.__ModuleLoader__.load({
|
|
|
1005
1335
|
}
|
|
1006
1336
|
compile() {
|
|
1007
1337
|
const F = Function;
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
return new F(...args, lines.join("\n"));
|
|
1338
|
+
const content = this?.content ?? [``];
|
|
1339
|
+
return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
|
|
1011
1340
|
}
|
|
1012
1341
|
};
|
|
1013
1342
|
//#endregion
|
|
1014
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
1343
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/versions.js
|
|
1015
1344
|
const version = {
|
|
1016
1345
|
major: 4,
|
|
1017
|
-
minor:
|
|
1018
|
-
patch:
|
|
1346
|
+
minor: 5,
|
|
1347
|
+
patch: 4
|
|
1019
1348
|
};
|
|
1020
1349
|
//#endregion
|
|
1021
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
1350
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/schemas.js
|
|
1022
1351
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1023
1352
|
var _a;
|
|
1024
1353
|
inst ?? (inst = {});
|
|
1025
1354
|
inst._zod.def = def;
|
|
1026
1355
|
inst._zod.bag = inst._zod.bag || {};
|
|
1027
1356
|
inst._zod.version = version;
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1357
|
+
const defChecks = inst._zod.def.checks;
|
|
1358
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
1030
1359
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1031
1360
|
if (checks.length === 0) {
|
|
1032
1361
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -1035,6 +1364,7 @@ window.__ModuleLoader__.load({
|
|
|
1035
1364
|
});
|
|
1036
1365
|
} else {
|
|
1037
1366
|
const runChecks = (payload, checks, ctx) => {
|
|
1367
|
+
if (payload.memo) return payload;
|
|
1038
1368
|
let isAborted = aborted(payload);
|
|
1039
1369
|
let asyncResult;
|
|
1040
1370
|
for (const ch of checks) {
|
|
@@ -1048,10 +1378,12 @@ window.__ModuleLoader__.load({
|
|
|
1048
1378
|
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1049
1379
|
await _;
|
|
1050
1380
|
if (payload.issues.length === currLen) return;
|
|
1381
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1051
1382
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1052
1383
|
});
|
|
1053
1384
|
else {
|
|
1054
1385
|
if (payload.issues.length === currLen) continue;
|
|
1386
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1055
1387
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1056
1388
|
}
|
|
1057
1389
|
}
|
|
@@ -1095,19 +1427,29 @@ window.__ModuleLoader__.load({
|
|
|
1095
1427
|
return runChecks(result, checks, ctx);
|
|
1096
1428
|
};
|
|
1097
1429
|
}
|
|
1098
|
-
|
|
1430
|
+
}, {
|
|
1431
|
+
get "~standard"() {
|
|
1432
|
+
return hide(this, "~standard", standardProps(this));
|
|
1433
|
+
},
|
|
1434
|
+
set "~standard"(value) {
|
|
1435
|
+
own(this, "~standard", value);
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
1439
|
+
const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1440
|
+
function standardProps(inst) {
|
|
1441
|
+
return {
|
|
1099
1442
|
validate: (value) => {
|
|
1100
1443
|
try {
|
|
1101
|
-
|
|
1102
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1444
|
+
return toStandardResult(safeParse$1(inst, value));
|
|
1103
1445
|
} catch (_) {
|
|
1104
|
-
return safeParseAsync$1(inst, value).then(
|
|
1446
|
+
return safeParseAsync$1(inst, value).then(toStandardResult);
|
|
1105
1447
|
}
|
|
1106
1448
|
},
|
|
1107
1449
|
vendor: "zod",
|
|
1108
1450
|
version: 1
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1111
1453
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1112
1454
|
$ZodType.init(inst, def);
|
|
1113
1455
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
@@ -1154,51 +1496,74 @@ window.__ModuleLoader__.load({
|
|
|
1154
1496
|
def.pattern ?? (def.pattern = email);
|
|
1155
1497
|
$ZodStringFormat.init(inst, def);
|
|
1156
1498
|
});
|
|
1499
|
+
/** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
|
|
1500
|
+
function parseURLObject(trimmed, def) {
|
|
1501
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
1502
|
+
try {
|
|
1503
|
+
return new URL(trimmed);
|
|
1504
|
+
} catch {
|
|
1505
|
+
return 2;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
1509
|
+
/** 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. */
|
|
1510
|
+
function stripTabAndNewline(value) {
|
|
1511
|
+
return value.replace(asciiTabOrNewline, "");
|
|
1512
|
+
}
|
|
1513
|
+
function urlHostnameOk(url, hostname) {
|
|
1514
|
+
hostname.lastIndex = 0;
|
|
1515
|
+
return hostname.test(url.hostname);
|
|
1516
|
+
}
|
|
1517
|
+
function urlProtocolOk(url, protocol) {
|
|
1518
|
+
protocol.lastIndex = 0;
|
|
1519
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
1520
|
+
}
|
|
1157
1521
|
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
1158
1522
|
$ZodStringFormat.init(inst, def);
|
|
1159
1523
|
inst._zod.check = (payload) => {
|
|
1160
1524
|
try {
|
|
1161
1525
|
const trimmed = payload.value.trim();
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
code: "invalid_format",
|
|
1166
|
-
format: "url",
|
|
1167
|
-
note: "Invalid URL format",
|
|
1168
|
-
input: payload.value,
|
|
1169
|
-
inst,
|
|
1170
|
-
continue: !def.abort
|
|
1171
|
-
});
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
const url = new URL(trimmed);
|
|
1176
|
-
if (def.hostname) {
|
|
1177
|
-
def.hostname.lastIndex = 0;
|
|
1178
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1526
|
+
const url = parseURLObject(trimmed, def);
|
|
1527
|
+
if (url === 1) {
|
|
1528
|
+
payload.issues.push({
|
|
1179
1529
|
code: "invalid_format",
|
|
1180
1530
|
format: "url",
|
|
1181
|
-
note: "Invalid
|
|
1182
|
-
pattern: def.hostname.source,
|
|
1531
|
+
note: "Invalid URL format",
|
|
1183
1532
|
input: payload.value,
|
|
1184
1533
|
inst,
|
|
1185
1534
|
continue: !def.abort
|
|
1186
1535
|
});
|
|
1536
|
+
return;
|
|
1187
1537
|
}
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
1190
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1538
|
+
if (url === 2) {
|
|
1539
|
+
payload.issues.push({
|
|
1191
1540
|
code: "invalid_format",
|
|
1192
1541
|
format: "url",
|
|
1193
|
-
note: "Invalid protocol",
|
|
1194
|
-
pattern: def.protocol.source,
|
|
1195
1542
|
input: payload.value,
|
|
1196
1543
|
inst,
|
|
1197
1544
|
continue: !def.abort
|
|
1198
1545
|
});
|
|
1546
|
+
return;
|
|
1199
1547
|
}
|
|
1200
|
-
if (def.
|
|
1201
|
-
|
|
1548
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
|
|
1549
|
+
code: "invalid_format",
|
|
1550
|
+
format: "url",
|
|
1551
|
+
note: "Invalid hostname",
|
|
1552
|
+
pattern: def.hostname.source,
|
|
1553
|
+
input: payload.value,
|
|
1554
|
+
inst,
|
|
1555
|
+
continue: !def.abort
|
|
1556
|
+
});
|
|
1557
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
|
|
1558
|
+
code: "invalid_format",
|
|
1559
|
+
format: "url",
|
|
1560
|
+
note: "Invalid protocol",
|
|
1561
|
+
pattern: def.protocol.source,
|
|
1562
|
+
input: payload.value,
|
|
1563
|
+
inst,
|
|
1564
|
+
continue: !def.abort
|
|
1565
|
+
});
|
|
1566
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
1202
1567
|
return;
|
|
1203
1568
|
} catch (_) {
|
|
1204
1569
|
payload.issues.push({
|
|
@@ -1216,7 +1581,8 @@ window.__ModuleLoader__.load({
|
|
|
1216
1581
|
$ZodStringFormat.init(inst, def);
|
|
1217
1582
|
});
|
|
1218
1583
|
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
1219
|
-
def.
|
|
1584
|
+
if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
1585
|
+
def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
|
|
1220
1586
|
$ZodStringFormat.init(inst, def);
|
|
1221
1587
|
});
|
|
1222
1588
|
/**
|
|
@@ -1245,19 +1611,25 @@ window.__ModuleLoader__.load({
|
|
|
1245
1611
|
$ZodStringFormat.init(inst, def);
|
|
1246
1612
|
});
|
|
1247
1613
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1248
|
-
def.pattern ?? (def.pattern = datetime
|
|
1614
|
+
def.pattern ?? (def.pattern = datetime(def));
|
|
1249
1615
|
$ZodStringFormat.init(inst, def);
|
|
1616
|
+
if (def.local || def.precision === -1) {
|
|
1617
|
+
inst._zod.bag.laxFormat = true;
|
|
1618
|
+
inst._zod.onattach.push((s) => {
|
|
1619
|
+
s._zod.bag.laxFormat = true;
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1250
1622
|
});
|
|
1251
1623
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1252
|
-
def.pattern ?? (def.pattern = date
|
|
1624
|
+
def.pattern ?? (def.pattern = date);
|
|
1253
1625
|
$ZodStringFormat.init(inst, def);
|
|
1254
1626
|
});
|
|
1255
1627
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1256
|
-
def.pattern ?? (def.pattern = time
|
|
1628
|
+
def.pattern ?? (def.pattern = time(def));
|
|
1257
1629
|
$ZodStringFormat.init(inst, def);
|
|
1258
1630
|
});
|
|
1259
1631
|
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
1260
|
-
def.pattern ?? (def.pattern = duration
|
|
1632
|
+
def.pattern ?? (def.pattern = duration);
|
|
1261
1633
|
$ZodStringFormat.init(inst, def);
|
|
1262
1634
|
});
|
|
1263
1635
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
@@ -1265,50 +1637,56 @@ window.__ModuleLoader__.load({
|
|
|
1265
1637
|
$ZodStringFormat.init(inst, def);
|
|
1266
1638
|
inst._zod.bag.format = `ipv4`;
|
|
1267
1639
|
});
|
|
1640
|
+
/** 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`. */
|
|
1641
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1642
|
+
function isValidIPv6(value) {
|
|
1643
|
+
if (!ipv6Alphabet.test(value)) return false;
|
|
1644
|
+
try {
|
|
1645
|
+
new URL(`http://[${value}]`);
|
|
1646
|
+
return true;
|
|
1647
|
+
} catch {
|
|
1648
|
+
return false;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1268
1651
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1269
1652
|
def.pattern ?? (def.pattern = ipv6);
|
|
1270
1653
|
$ZodStringFormat.init(inst, def);
|
|
1271
1654
|
inst._zod.bag.format = `ipv6`;
|
|
1272
1655
|
inst._zod.check = (payload) => {
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
payload.
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
inst,
|
|
1281
|
-
continue: !def.abort
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1656
|
+
if (!isValidIPv6(payload.value)) payload.issues.push({
|
|
1657
|
+
code: "invalid_format",
|
|
1658
|
+
format: "ipv6",
|
|
1659
|
+
input: payload.value,
|
|
1660
|
+
inst,
|
|
1661
|
+
continue: !def.abort
|
|
1662
|
+
});
|
|
1284
1663
|
};
|
|
1285
1664
|
});
|
|
1286
1665
|
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1287
1666
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1288
1667
|
$ZodStringFormat.init(inst, def);
|
|
1289
1668
|
});
|
|
1669
|
+
function isValidCIDRv6(value) {
|
|
1670
|
+
const parts = value.split("/");
|
|
1671
|
+
if (parts.length !== 2) return false;
|
|
1672
|
+
const [address, prefix] = parts;
|
|
1673
|
+
if (!prefix) return false;
|
|
1674
|
+
const prefixNum = Number(prefix);
|
|
1675
|
+
if (`${prefixNum}` !== prefix) return false;
|
|
1676
|
+
if (prefixNum < 0 || prefixNum > 128) return false;
|
|
1677
|
+
return isValidIPv6(address);
|
|
1678
|
+
}
|
|
1290
1679
|
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1291
1680
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1292
1681
|
$ZodStringFormat.init(inst, def);
|
|
1293
1682
|
inst._zod.check = (payload) => {
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1302
|
-
new URL(`http://[${address}]`);
|
|
1303
|
-
} catch {
|
|
1304
|
-
payload.issues.push({
|
|
1305
|
-
code: "invalid_format",
|
|
1306
|
-
format: "cidrv6",
|
|
1307
|
-
input: payload.value,
|
|
1308
|
-
inst,
|
|
1309
|
-
continue: !def.abort
|
|
1310
|
-
});
|
|
1311
|
-
}
|
|
1683
|
+
if (!isValidCIDRv6(payload.value)) payload.issues.push({
|
|
1684
|
+
code: "invalid_format",
|
|
1685
|
+
format: "cidrv6",
|
|
1686
|
+
input: payload.value,
|
|
1687
|
+
inst,
|
|
1688
|
+
continue: !def.abort
|
|
1689
|
+
});
|
|
1312
1690
|
};
|
|
1313
1691
|
});
|
|
1314
1692
|
function isValidBase64(data) {
|
|
@@ -1398,7 +1776,7 @@ window.__ModuleLoader__.load({
|
|
|
1398
1776
|
} catch (_) {}
|
|
1399
1777
|
const input = payload.value;
|
|
1400
1778
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1401
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ?
|
|
1779
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
|
|
1402
1780
|
payload.issues.push({
|
|
1403
1781
|
expected: "number",
|
|
1404
1782
|
code: "invalid_type",
|
|
@@ -1469,6 +1847,8 @@ window.__ModuleLoader__.load({
|
|
|
1469
1847
|
}
|
|
1470
1848
|
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1471
1849
|
$ZodType.init(inst, def);
|
|
1850
|
+
const memo = globalConfig.memoizer;
|
|
1851
|
+
memo?.attach(inst);
|
|
1472
1852
|
inst._zod.parse = (payload, ctx) => {
|
|
1473
1853
|
const input = payload.value;
|
|
1474
1854
|
if (!Array.isArray(input)) {
|
|
@@ -1480,7 +1860,7 @@ window.__ModuleLoader__.load({
|
|
|
1480
1860
|
});
|
|
1481
1861
|
return payload;
|
|
1482
1862
|
}
|
|
1483
|
-
payload.value = Array(input.length);
|
|
1863
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1484
1864
|
const proms = [];
|
|
1485
1865
|
for (let i = 0; i < input.length; i++) {
|
|
1486
1866
|
const item = input[i];
|
|
@@ -1495,13 +1875,15 @@ window.__ModuleLoader__.load({
|
|
|
1495
1875
|
return payload;
|
|
1496
1876
|
};
|
|
1497
1877
|
});
|
|
1498
|
-
function handlePropertyResult(result, final, key, input,
|
|
1878
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
1499
1879
|
const isPresent = key in input;
|
|
1880
|
+
const isOptionalOut = optout === "optional";
|
|
1881
|
+
if (!isPresent && isOptionalOut && optin === "optional") return;
|
|
1500
1882
|
if (result.issues.length) {
|
|
1501
|
-
if (
|
|
1883
|
+
if (optin !== void 0 && isOptionalOut && !isPresent) return;
|
|
1502
1884
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1503
1885
|
}
|
|
1504
|
-
if (!isPresent &&
|
|
1886
|
+
if (!isPresent && optin === void 0) {
|
|
1505
1887
|
if (!result.issues.length) final.issues.push({
|
|
1506
1888
|
code: "invalid_type",
|
|
1507
1889
|
expected: "nonoptional",
|
|
@@ -1514,13 +1896,18 @@ window.__ModuleLoader__.load({
|
|
|
1514
1896
|
if (isPresent) final.value[key] = void 0;
|
|
1515
1897
|
} else final.value[key] = result.value;
|
|
1516
1898
|
}
|
|
1899
|
+
const NO_SYMBOL_KEYS = [];
|
|
1517
1900
|
function normalizeDef(def) {
|
|
1518
1901
|
const keys = Object.keys(def.shape);
|
|
1519
|
-
|
|
1902
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
1903
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
1904
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
1905
|
+
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`);
|
|
1520
1906
|
const okeys = optionalKeys(def.shape);
|
|
1521
1907
|
return {
|
|
1522
1908
|
...def,
|
|
1523
|
-
|
|
1909
|
+
allKeys,
|
|
1910
|
+
symbolKeys,
|
|
1524
1911
|
keySet: new Set(keys),
|
|
1525
1912
|
numKeys: keys.length,
|
|
1526
1913
|
optionalKeys: new Set(okeys)
|
|
@@ -1531,11 +1918,14 @@ window.__ModuleLoader__.load({
|
|
|
1531
1918
|
const keySet = def.keySet;
|
|
1532
1919
|
const _catchall = def.catchall._zod;
|
|
1533
1920
|
const t = _catchall.def.type;
|
|
1534
|
-
const
|
|
1535
|
-
const
|
|
1921
|
+
const optin = _catchall.optin;
|
|
1922
|
+
const optout = _catchall.optout;
|
|
1536
1923
|
for (const key in input) {
|
|
1537
|
-
if (key === "__proto__") continue;
|
|
1538
1924
|
if (keySet.has(key)) continue;
|
|
1925
|
+
if (key === "__proto__") {
|
|
1926
|
+
if (t === "never") unrecognized.push(key);
|
|
1927
|
+
continue;
|
|
1928
|
+
}
|
|
1539
1929
|
if (t === "never") {
|
|
1540
1930
|
unrecognized.push(key);
|
|
1541
1931
|
continue;
|
|
@@ -1544,39 +1934,44 @@ window.__ModuleLoader__.load({
|
|
|
1544
1934
|
value: input[key],
|
|
1545
1935
|
issues: []
|
|
1546
1936
|
}, ctx);
|
|
1547
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1548
|
-
else handlePropertyResult(r, payload, key, input,
|
|
1937
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
1938
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1549
1939
|
}
|
|
1550
1940
|
if (unrecognized.length) payload.issues.push({
|
|
1551
1941
|
code: "unrecognized_keys",
|
|
1552
1942
|
keys: unrecognized,
|
|
1553
1943
|
input,
|
|
1554
|
-
inst
|
|
1944
|
+
inst,
|
|
1945
|
+
continue: true
|
|
1555
1946
|
});
|
|
1556
1947
|
if (!proms.length) return payload;
|
|
1557
1948
|
return Promise.all(proms).then(() => {
|
|
1558
1949
|
return payload;
|
|
1559
1950
|
});
|
|
1560
1951
|
}
|
|
1952
|
+
const propShapes = /* @__PURE__ */ new WeakMap();
|
|
1561
1953
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1562
1954
|
$ZodType.init(inst, def);
|
|
1563
1955
|
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
1564
1956
|
const sh = def.shape;
|
|
1957
|
+
propShapes.set(def, sh);
|
|
1565
1958
|
Object.defineProperty(def, "shape", { get: () => {
|
|
1566
1959
|
const newSh = { ...sh };
|
|
1567
1960
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
1961
|
+
propShapes.set(def, newSh);
|
|
1568
1962
|
return newSh;
|
|
1569
1963
|
} });
|
|
1570
1964
|
}
|
|
1571
1965
|
const _normalized = cached(() => normalizeDef(def));
|
|
1572
|
-
|
|
1573
|
-
const shape = def.shape;
|
|
1966
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
1967
|
+
const shape = zod.def.shape;
|
|
1574
1968
|
const propValues = {};
|
|
1575
1969
|
for (const key in shape) {
|
|
1576
1970
|
const field = shape[key]._zod;
|
|
1577
1971
|
if (field.values) {
|
|
1578
|
-
propValues
|
|
1972
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
1579
1973
|
for (const v of field.values) propValues[key].add(v);
|
|
1974
|
+
if (field.optin !== void 0) propValues[key].add(void 0);
|
|
1580
1975
|
}
|
|
1581
1976
|
}
|
|
1582
1977
|
return propValues;
|
|
@@ -1584,6 +1979,8 @@ window.__ModuleLoader__.load({
|
|
|
1584
1979
|
const isObject$1 = isObject;
|
|
1585
1980
|
const catchall = def.catchall;
|
|
1586
1981
|
let value;
|
|
1982
|
+
const memo = globalConfig.memoizer;
|
|
1983
|
+
memo?.attach(inst);
|
|
1587
1984
|
inst._zod.parse = (payload, ctx) => {
|
|
1588
1985
|
value ?? (value = _normalized.value);
|
|
1589
1986
|
const input = payload.value;
|
|
@@ -1596,19 +1993,20 @@ window.__ModuleLoader__.load({
|
|
|
1596
1993
|
});
|
|
1597
1994
|
return payload;
|
|
1598
1995
|
}
|
|
1599
|
-
payload.value = {};
|
|
1996
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1600
1997
|
const proms = [];
|
|
1601
1998
|
const shape = value.shape;
|
|
1602
|
-
for (const key of value.
|
|
1999
|
+
for (const key of value.allKeys) {
|
|
2000
|
+
if (key === "__proto__") continue;
|
|
1603
2001
|
const el = shape[key];
|
|
1604
|
-
const
|
|
1605
|
-
const
|
|
2002
|
+
const optin = el._zod.optin;
|
|
2003
|
+
const optout = el._zod.optout;
|
|
1606
2004
|
const r = el._zod.run({
|
|
1607
2005
|
value: input[key],
|
|
1608
2006
|
issues: []
|
|
1609
2007
|
}, ctx);
|
|
1610
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1611
|
-
else handlePropertyResult(r, payload, key, input,
|
|
2008
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
2009
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1612
2010
|
}
|
|
1613
2011
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1614
2012
|
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
@@ -1618,55 +2016,55 @@ window.__ModuleLoader__.load({
|
|
|
1618
2016
|
$ZodObject.init(inst, def);
|
|
1619
2017
|
const superParse = inst._zod.parse;
|
|
1620
2018
|
const _normalized = cached(() => normalizeDef(def));
|
|
2019
|
+
const memo = globalConfig.memoizer;
|
|
1621
2020
|
const generateFastpass = (shape) => {
|
|
1622
|
-
const doc = new Doc([
|
|
1623
|
-
"shape",
|
|
1624
|
-
"payload",
|
|
1625
|
-
"ctx"
|
|
1626
|
-
]);
|
|
1627
2021
|
const normalized = _normalized.value;
|
|
1628
|
-
const
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
2022
|
+
const syms = normalized.symbolKeys;
|
|
2023
|
+
const doc = new Doc(["payload", "ctx"], {
|
|
2024
|
+
shape,
|
|
2025
|
+
inst,
|
|
2026
|
+
memo,
|
|
2027
|
+
syms
|
|
2028
|
+
});
|
|
2029
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2030
|
+
const prefixStr = (id, k) => `
|
|
2031
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
2032
|
+
const iss = ${id}.issues[i];
|
|
2033
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
2034
|
+
payload.issues.push(iss);
|
|
2035
|
+
}`;
|
|
1632
2036
|
doc.write(`const input = payload.value;`);
|
|
1633
2037
|
const ids = Object.create(null);
|
|
1634
2038
|
let counter = 0;
|
|
1635
|
-
for (const key of normalized.
|
|
1636
|
-
doc.write(`const newResult = {};`);
|
|
1637
|
-
for (const key of normalized.
|
|
2039
|
+
for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
|
|
2040
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
2041
|
+
for (const key of normalized.allKeys) {
|
|
2042
|
+
if (key === "__proto__") continue;
|
|
1638
2043
|
const id = ids[key];
|
|
1639
|
-
const k = esc(key);
|
|
2044
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
2045
|
+
const isPresent = `${k} in input`;
|
|
1640
2046
|
const schema = shape[key];
|
|
1641
|
-
const
|
|
2047
|
+
const optin = schema?._zod?.optin;
|
|
2048
|
+
const isOptionalIn = optin !== void 0;
|
|
1642
2049
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1643
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1644
|
-
if (isOptionalIn && isOptionalOut)
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
})));
|
|
2050
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
2051
|
+
if (isOptionalIn && isOptionalOut) {
|
|
2052
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
2053
|
+
doc.write(`
|
|
2054
|
+
const ${id}_present = ${isPresent};
|
|
2055
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
2056
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1651
2057
|
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
if (${k} in input) {
|
|
1656
|
-
newResult[${k}] = undefined;
|
|
2058
|
+
|
|
2059
|
+
if (${assign}) {
|
|
2060
|
+
newResult[${k}] = ${id}.value;
|
|
1657
2061
|
}
|
|
1658
|
-
} else {
|
|
1659
|
-
newResult[${k}] = ${id}.value;
|
|
1660
2062
|
}
|
|
1661
|
-
|
|
2063
|
+
|
|
1662
2064
|
`);
|
|
1663
|
-
else if (!isOptionalIn) doc.write(`
|
|
1664
|
-
const ${id}_present = ${
|
|
1665
|
-
if (${id}.issues.length) {
|
|
1666
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1667
|
-
...iss,
|
|
1668
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1669
|
-
})));
|
|
2065
|
+
} else if (!isOptionalIn) doc.write(`
|
|
2066
|
+
const ${id}_present = ${isPresent};
|
|
2067
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1670
2068
|
}
|
|
1671
2069
|
if (!${id}_present && !${id}.issues.length) {
|
|
1672
2070
|
payload.issues.push({
|
|
@@ -1678,36 +2076,27 @@ window.__ModuleLoader__.load({
|
|
|
1678
2076
|
}
|
|
1679
2077
|
|
|
1680
2078
|
if (${id}_present) {
|
|
1681
|
-
|
|
1682
|
-
newResult[${k}] = undefined;
|
|
1683
|
-
} else {
|
|
1684
|
-
newResult[${k}] = ${id}.value;
|
|
1685
|
-
}
|
|
2079
|
+
newResult[${k}] = ${id}.value;
|
|
1686
2080
|
}
|
|
1687
2081
|
|
|
1688
2082
|
`);
|
|
1689
2083
|
else doc.write(`
|
|
1690
|
-
if (${id}.issues.length) {
|
|
1691
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1692
|
-
...iss,
|
|
1693
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1694
|
-
})));
|
|
2084
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1695
2085
|
}
|
|
1696
2086
|
|
|
1697
2087
|
if (${id}.value === undefined) {
|
|
1698
|
-
if (${
|
|
2088
|
+
if (${isPresent}) {
|
|
1699
2089
|
newResult[${k}] = undefined;
|
|
1700
2090
|
}
|
|
1701
2091
|
} else {
|
|
1702
2092
|
newResult[${k}] = ${id}.value;
|
|
1703
2093
|
}
|
|
1704
|
-
|
|
2094
|
+
|
|
1705
2095
|
`);
|
|
1706
2096
|
}
|
|
1707
2097
|
doc.write(`payload.value = newResult;`);
|
|
1708
2098
|
doc.write(`return payload;`);
|
|
1709
|
-
|
|
1710
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2099
|
+
return doc.compile();
|
|
1711
2100
|
};
|
|
1712
2101
|
let fastpass;
|
|
1713
2102
|
const isObject$2 = isObject;
|
|
@@ -1756,14 +2145,14 @@ window.__ModuleLoader__.load({
|
|
|
1756
2145
|
}
|
|
1757
2146
|
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
1758
2147
|
$ZodType.init(inst, def);
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1763
|
-
});
|
|
1764
|
-
|
|
1765
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1766
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
2148
|
+
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);
|
|
2149
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
2150
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2151
|
+
if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2152
|
+
});
|
|
2153
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2154
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
2155
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1767
2156
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1768
2157
|
}
|
|
1769
2158
|
});
|
|
@@ -1795,18 +2184,22 @@ window.__ModuleLoader__.load({
|
|
|
1795
2184
|
def.inclusive = false;
|
|
1796
2185
|
$ZodUnion.init(inst, def);
|
|
1797
2186
|
const _super = inst._zod.parse;
|
|
1798
|
-
|
|
2187
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
1799
2188
|
const propValues = {};
|
|
1800
|
-
for (const option of def.options) {
|
|
2189
|
+
for (const option of zod.def.options) {
|
|
1801
2190
|
const pv = option._zod.propValues;
|
|
1802
|
-
if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
2191
|
+
if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
1803
2192
|
for (const [k, v] of Object.entries(pv)) {
|
|
1804
|
-
if (!propValues
|
|
2193
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
|
|
1805
2194
|
for (const val of v) propValues[k].add(val);
|
|
1806
2195
|
}
|
|
1807
2196
|
}
|
|
1808
2197
|
return propValues;
|
|
1809
2198
|
});
|
|
2199
|
+
def.options.forEach((option, i) => {
|
|
2200
|
+
const propShape = propShapes.get(option._zod.def);
|
|
2201
|
+
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
2202
|
+
});
|
|
1810
2203
|
const disc = cached(() => {
|
|
1811
2204
|
const opts = def.options;
|
|
1812
2205
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1881,7 +2274,9 @@ window.__ModuleLoader__.load({
|
|
|
1881
2274
|
...a,
|
|
1882
2275
|
...b
|
|
1883
2276
|
};
|
|
2277
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
|
|
1884
2278
|
for (const key of sharedKeys) {
|
|
2279
|
+
if (key === "__proto__") continue;
|
|
1885
2280
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1886
2281
|
if (!sharedValue.valid) return {
|
|
1887
2282
|
valid: false,
|
|
@@ -1923,31 +2318,46 @@ window.__ModuleLoader__.load({
|
|
|
1923
2318
|
function handleIntersectionResults(result, left, right) {
|
|
1924
2319
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1925
2320
|
let unrecIssue;
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2321
|
+
const keyIssues = /* @__PURE__ */ new Map();
|
|
2322
|
+
const collect = (iss, side) => {
|
|
2323
|
+
let keys;
|
|
2324
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
2325
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
2326
|
+
keys = iss.keys;
|
|
2327
|
+
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
2328
|
+
const k = String(iss.path[0]);
|
|
2329
|
+
if (!keyIssues.has(k)) keyIssues.set(k, iss);
|
|
2330
|
+
keys = [k];
|
|
2331
|
+
} else return false;
|
|
2332
|
+
for (const k of keys) {
|
|
1929
2333
|
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1930
|
-
unrecKeys.get(k)
|
|
2334
|
+
unrecKeys.get(k)[side] = true;
|
|
1931
2335
|
}
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
}
|
|
1937
|
-
else result.issues.push(iss);
|
|
2336
|
+
return true;
|
|
2337
|
+
};
|
|
2338
|
+
for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
|
|
2339
|
+
for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
|
|
1938
2340
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1939
|
-
if (bothKeys.length
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
2341
|
+
if (bothKeys.length) {
|
|
2342
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
2343
|
+
if (aggregated.length) result.issues.push({
|
|
2344
|
+
...unrecIssue,
|
|
2345
|
+
keys: aggregated
|
|
2346
|
+
});
|
|
2347
|
+
for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
|
|
2348
|
+
}
|
|
1944
2349
|
const merged = mergeValues(left.value, right.value);
|
|
1945
|
-
if (!merged.valid)
|
|
2350
|
+
if (!merged.valid) {
|
|
2351
|
+
if (aborted(result)) return result;
|
|
2352
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2353
|
+
}
|
|
1946
2354
|
result.value = merged.data;
|
|
1947
2355
|
return result;
|
|
1948
2356
|
}
|
|
1949
2357
|
const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
1950
2358
|
$ZodType.init(inst, def);
|
|
2359
|
+
const memo = globalConfig.memoizer;
|
|
2360
|
+
memo?.attach(inst);
|
|
1951
2361
|
inst._zod.parse = (payload, ctx) => {
|
|
1952
2362
|
const input = payload.value;
|
|
1953
2363
|
if (!isPlainObject(input)) {
|
|
@@ -1961,11 +2371,12 @@ window.__ModuleLoader__.load({
|
|
|
1961
2371
|
}
|
|
1962
2372
|
const proms = [];
|
|
1963
2373
|
const values = def.keyType._zod.values;
|
|
1964
|
-
if (values) {
|
|
1965
|
-
payload.value = {};
|
|
2374
|
+
if (values && !def.partial) {
|
|
2375
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1966
2376
|
const recordKeys = /* @__PURE__ */ new Set();
|
|
1967
2377
|
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1968
2378
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
2379
|
+
if (key === "__proto__") continue;
|
|
1969
2380
|
const keyResult = def.keyType._zod.run({
|
|
1970
2381
|
value: key,
|
|
1971
2382
|
issues: []
|
|
@@ -1983,6 +2394,7 @@ window.__ModuleLoader__.load({
|
|
|
1983
2394
|
continue;
|
|
1984
2395
|
}
|
|
1985
2396
|
const outKey = keyResult.value;
|
|
2397
|
+
if (outKey === "__proto__") continue;
|
|
1986
2398
|
const result = def.valueType._zod.run({
|
|
1987
2399
|
value: input[key],
|
|
1988
2400
|
issues: []
|
|
@@ -1998,17 +2410,24 @@ window.__ModuleLoader__.load({
|
|
|
1998
2410
|
}
|
|
1999
2411
|
let unrecognized;
|
|
2000
2412
|
for (const key in input) if (!recordKeys.has(key)) {
|
|
2001
|
-
|
|
2002
|
-
|
|
2413
|
+
if (def.mode === "loose") {
|
|
2414
|
+
if (key === "__proto__") continue;
|
|
2415
|
+
payload.value[key] = input[key];
|
|
2416
|
+
} else {
|
|
2417
|
+
unrecognized = unrecognized ?? [];
|
|
2418
|
+
unrecognized.push(key);
|
|
2419
|
+
}
|
|
2003
2420
|
}
|
|
2004
2421
|
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
2005
2422
|
code: "unrecognized_keys",
|
|
2006
2423
|
input,
|
|
2007
2424
|
inst,
|
|
2008
|
-
keys: unrecognized
|
|
2425
|
+
keys: unrecognized,
|
|
2426
|
+
continue: true
|
|
2009
2427
|
});
|
|
2010
2428
|
} else {
|
|
2011
|
-
payload.value = {};
|
|
2429
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
2430
|
+
let unrecognized;
|
|
2012
2431
|
for (const key of Reflect.ownKeys(input)) {
|
|
2013
2432
|
if (key === "__proto__") continue;
|
|
2014
2433
|
if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
|
|
@@ -2027,7 +2446,10 @@ window.__ModuleLoader__.load({
|
|
|
2027
2446
|
}
|
|
2028
2447
|
if (keyResult.issues.length) {
|
|
2029
2448
|
if (def.mode === "loose") payload.value[key] = input[key];
|
|
2030
|
-
else
|
|
2449
|
+
else if (values) {
|
|
2450
|
+
unrecognized = unrecognized ?? [];
|
|
2451
|
+
unrecognized.push(key);
|
|
2452
|
+
} else payload.issues.push({
|
|
2031
2453
|
code: "invalid_key",
|
|
2032
2454
|
origin: "record",
|
|
2033
2455
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
@@ -2037,19 +2459,28 @@ window.__ModuleLoader__.load({
|
|
|
2037
2459
|
});
|
|
2038
2460
|
continue;
|
|
2039
2461
|
}
|
|
2462
|
+
const outKey = keyResult.value;
|
|
2463
|
+
if (outKey === "__proto__") continue;
|
|
2040
2464
|
const result = def.valueType._zod.run({
|
|
2041
2465
|
value: input[key],
|
|
2042
2466
|
issues: []
|
|
2043
2467
|
}, ctx);
|
|
2044
2468
|
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
2045
2469
|
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2046
|
-
payload.value[
|
|
2470
|
+
payload.value[outKey] = result.value;
|
|
2047
2471
|
}));
|
|
2048
2472
|
else {
|
|
2049
2473
|
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2050
|
-
payload.value[
|
|
2474
|
+
payload.value[outKey] = result.value;
|
|
2051
2475
|
}
|
|
2052
2476
|
}
|
|
2477
|
+
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
2478
|
+
code: "unrecognized_keys",
|
|
2479
|
+
input,
|
|
2480
|
+
inst,
|
|
2481
|
+
keys: unrecognized,
|
|
2482
|
+
continue: true
|
|
2483
|
+
});
|
|
2053
2484
|
}
|
|
2054
2485
|
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
2055
2486
|
return payload;
|
|
@@ -2060,7 +2491,8 @@ window.__ModuleLoader__.load({
|
|
|
2060
2491
|
const values = getEnumValues(def.entries);
|
|
2061
2492
|
const valuesSet = new Set(values);
|
|
2062
2493
|
inst._zod.values = valuesSet;
|
|
2063
|
-
|
|
2494
|
+
const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
|
|
2495
|
+
inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2064
2496
|
inst._zod.parse = (payload, _ctx) => {
|
|
2065
2497
|
const input = payload.value;
|
|
2066
2498
|
if (valuesSet.has(input)) return payload;
|
|
@@ -2075,10 +2507,9 @@ window.__ModuleLoader__.load({
|
|
|
2075
2507
|
});
|
|
2076
2508
|
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
2077
2509
|
$ZodType.init(inst, def);
|
|
2078
|
-
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
2079
2510
|
const values = new Set(def.values);
|
|
2080
2511
|
inst._zod.values = values;
|
|
2081
|
-
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
2512
|
+
inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
|
|
2082
2513
|
inst._zod.parse = (payload, _ctx) => {
|
|
2083
2514
|
const input = payload.value;
|
|
2084
2515
|
if (values.has(input)) return payload;
|
|
@@ -2094,67 +2525,66 @@ window.__ModuleLoader__.load({
|
|
|
2094
2525
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
2095
2526
|
$ZodType.init(inst, def);
|
|
2096
2527
|
inst._zod.optin = "optional";
|
|
2528
|
+
globalConfig.memoizer?.guard(inst);
|
|
2097
2529
|
inst._zod.parse = (payload, ctx) => {
|
|
2098
2530
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2099
2531
|
const _out = def.transform(payload.value, payload);
|
|
2100
2532
|
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
2101
2533
|
payload.value = output;
|
|
2102
|
-
payload.fallback = true;
|
|
2103
2534
|
return payload;
|
|
2104
2535
|
});
|
|
2105
2536
|
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
2106
2537
|
payload.value = _out;
|
|
2107
|
-
payload.fallback = true;
|
|
2108
2538
|
return payload;
|
|
2109
2539
|
};
|
|
2110
2540
|
});
|
|
2111
|
-
function handleOptionalResult(
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
value: void 0
|
|
2115
|
-
};
|
|
2116
|
-
return result;
|
|
2541
|
+
function handleOptionalResult(payload, result) {
|
|
2542
|
+
payload.value = result.issues.length ? void 0 : result.value;
|
|
2543
|
+
return payload;
|
|
2117
2544
|
}
|
|
2118
2545
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2119
2546
|
$ZodType.init(inst, def);
|
|
2120
|
-
inst._zod.optin
|
|
2547
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2121
2548
|
inst._zod.optout = "optional";
|
|
2122
|
-
|
|
2123
|
-
|
|
2549
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2550
|
+
const values = zod.def.innerType._zod.values;
|
|
2551
|
+
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
2124
2552
|
});
|
|
2125
|
-
|
|
2126
|
-
const pattern = def.innerType._zod.pattern;
|
|
2553
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2554
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2127
2555
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2128
2556
|
});
|
|
2129
2557
|
inst._zod.parse = (payload, ctx) => {
|
|
2130
|
-
if (
|
|
2131
|
-
|
|
2132
|
-
const result = def.innerType._zod.run(
|
|
2133
|
-
|
|
2134
|
-
|
|
2558
|
+
if (payload.value === void 0) {
|
|
2559
|
+
if (def.innerType._zod.optin !== "defaulted") return payload;
|
|
2560
|
+
const result = def.innerType._zod.run({
|
|
2561
|
+
value: payload.value,
|
|
2562
|
+
issues: []
|
|
2563
|
+
}, ctx);
|
|
2564
|
+
if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
|
|
2565
|
+
return handleOptionalResult(payload, result);
|
|
2135
2566
|
}
|
|
2136
|
-
if (payload.value === void 0) return payload;
|
|
2137
2567
|
return def.innerType._zod.run(payload, ctx);
|
|
2138
2568
|
};
|
|
2139
2569
|
});
|
|
2140
2570
|
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2141
2571
|
$ZodOptional.init(inst, def);
|
|
2142
|
-
|
|
2143
|
-
|
|
2572
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2573
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
2144
2574
|
inst._zod.parse = (payload, ctx) => {
|
|
2145
2575
|
return def.innerType._zod.run(payload, ctx);
|
|
2146
2576
|
};
|
|
2147
2577
|
});
|
|
2148
2578
|
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
2149
2579
|
$ZodType.init(inst, def);
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
const pattern = def.innerType._zod.pattern;
|
|
2580
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2581
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2582
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2583
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2154
2584
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2155
2585
|
});
|
|
2156
|
-
|
|
2157
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2586
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2587
|
+
return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
|
|
2158
2588
|
});
|
|
2159
2589
|
inst._zod.parse = (payload, ctx) => {
|
|
2160
2590
|
if (payload.value === null) return payload;
|
|
@@ -2163,8 +2593,8 @@ window.__ModuleLoader__.load({
|
|
|
2163
2593
|
});
|
|
2164
2594
|
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
2165
2595
|
$ZodType.init(inst, def);
|
|
2166
|
-
inst._zod.optin = "
|
|
2167
|
-
|
|
2596
|
+
inst._zod.optin = "defaulted";
|
|
2597
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2168
2598
|
inst._zod.parse = (payload, ctx) => {
|
|
2169
2599
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2170
2600
|
if (payload.value === void 0) {
|
|
@@ -2185,8 +2615,8 @@ window.__ModuleLoader__.load({
|
|
|
2185
2615
|
}
|
|
2186
2616
|
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
2187
2617
|
$ZodType.init(inst, def);
|
|
2188
|
-
inst._zod.optin = "
|
|
2189
|
-
|
|
2618
|
+
inst._zod.optin = "defaulted";
|
|
2619
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2190
2620
|
inst._zod.parse = (payload, ctx) => {
|
|
2191
2621
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2192
2622
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
@@ -2195,8 +2625,8 @@ window.__ModuleLoader__.load({
|
|
|
2195
2625
|
});
|
|
2196
2626
|
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2197
2627
|
$ZodType.init(inst, def);
|
|
2198
|
-
|
|
2199
|
-
const v = def.innerType._zod.values;
|
|
2628
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2629
|
+
const v = zod.def.innerType._zod.values;
|
|
2200
2630
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2201
2631
|
});
|
|
2202
2632
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2214,46 +2644,41 @@ window.__ModuleLoader__.load({
|
|
|
2214
2644
|
});
|
|
2215
2645
|
return payload;
|
|
2216
2646
|
}
|
|
2647
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2648
|
+
if (!result.issues.length) {
|
|
2649
|
+
payload.value = result.value;
|
|
2650
|
+
if (result.memo) payload.memo = true;
|
|
2651
|
+
return payload;
|
|
2652
|
+
}
|
|
2653
|
+
payload.value = def.catchValue({
|
|
2654
|
+
...result,
|
|
2655
|
+
value: payload.value,
|
|
2656
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2657
|
+
input: payload.value
|
|
2658
|
+
});
|
|
2659
|
+
return payload;
|
|
2660
|
+
}
|
|
2217
2661
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2218
2662
|
$ZodType.init(inst, def);
|
|
2219
|
-
inst._zod.optin
|
|
2220
|
-
|
|
2221
|
-
|
|
2663
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2664
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2665
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2222
2666
|
inst._zod.parse = (payload, ctx) => {
|
|
2223
2667
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2224
|
-
const result = def.innerType._zod.run(
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2231
|
-
input: payload.value
|
|
2232
|
-
});
|
|
2233
|
-
payload.issues = [];
|
|
2234
|
-
payload.fallback = true;
|
|
2235
|
-
}
|
|
2236
|
-
return payload;
|
|
2237
|
-
});
|
|
2238
|
-
payload.value = result.value;
|
|
2239
|
-
if (result.issues.length) {
|
|
2240
|
-
payload.value = def.catchValue({
|
|
2241
|
-
...payload,
|
|
2242
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2243
|
-
input: payload.value
|
|
2244
|
-
});
|
|
2245
|
-
payload.issues = [];
|
|
2246
|
-
payload.fallback = true;
|
|
2247
|
-
}
|
|
2248
|
-
return payload;
|
|
2668
|
+
const result = def.innerType._zod.run({
|
|
2669
|
+
value: payload.value,
|
|
2670
|
+
issues: []
|
|
2671
|
+
}, ctx);
|
|
2672
|
+
if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
2673
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
2249
2674
|
};
|
|
2250
2675
|
});
|
|
2251
2676
|
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2252
2677
|
$ZodType.init(inst, def);
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2678
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2679
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2680
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2681
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2257
2682
|
inst._zod.parse = (payload, ctx) => {
|
|
2258
2683
|
if (ctx.direction === "backward") {
|
|
2259
2684
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -2266,22 +2691,21 @@ window.__ModuleLoader__.load({
|
|
|
2266
2691
|
};
|
|
2267
2692
|
});
|
|
2268
2693
|
function handlePipeResult(left, next, ctx) {
|
|
2269
|
-
if (left.issues.
|
|
2694
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2270
2695
|
left.aborted = true;
|
|
2271
2696
|
return left;
|
|
2272
2697
|
}
|
|
2273
2698
|
return next._zod.run({
|
|
2274
2699
|
value: left.value,
|
|
2275
|
-
issues: left.issues
|
|
2276
|
-
fallback: left.fallback
|
|
2700
|
+
issues: left.issues
|
|
2277
2701
|
}, ctx);
|
|
2278
2702
|
}
|
|
2279
2703
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2280
2704
|
$ZodType.init(inst, def);
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2705
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2706
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2707
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2708
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2285
2709
|
inst._zod.parse = (payload, ctx) => {
|
|
2286
2710
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2287
2711
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -2290,7 +2714,7 @@ window.__ModuleLoader__.load({
|
|
|
2290
2714
|
};
|
|
2291
2715
|
});
|
|
2292
2716
|
function handleReadonlyResult(payload) {
|
|
2293
|
-
payload.value = Object.freeze(payload.value);
|
|
2717
|
+
if (!payload.memo) payload.value = Object.freeze(payload.value);
|
|
2294
2718
|
return payload;
|
|
2295
2719
|
}
|
|
2296
2720
|
const $ZodLazy = /*@__PURE__*/ $constructor("$ZodLazy", (inst, def) => {
|
|
@@ -2300,10 +2724,10 @@ window.__ModuleLoader__.load({
|
|
|
2300
2724
|
if (!d._cachedInner) d._cachedInner = def.getter();
|
|
2301
2725
|
return d._cachedInner;
|
|
2302
2726
|
});
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2727
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
|
|
2728
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
|
|
2729
|
+
defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? void 0);
|
|
2730
|
+
defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? void 0);
|
|
2307
2731
|
inst._zod.parse = (payload, ctx) => {
|
|
2308
2732
|
return inst._zod.innerType._zod.run(payload, ctx);
|
|
2309
2733
|
};
|
|
@@ -2314,28 +2738,353 @@ window.__ModuleLoader__.load({
|
|
|
2314
2738
|
inst._zod.parse = (payload, _) => {
|
|
2315
2739
|
return payload;
|
|
2316
2740
|
};
|
|
2317
|
-
inst._zod.check = (payload) => {
|
|
2318
|
-
const input = payload.value;
|
|
2319
|
-
const r = def.fn(input);
|
|
2320
|
-
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2321
|
-
handleRefineResult(r, payload, input, inst);
|
|
2741
|
+
inst._zod.check = (payload) => {
|
|
2742
|
+
const input = payload.value;
|
|
2743
|
+
const r = def.fn(input);
|
|
2744
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2745
|
+
handleRefineResult(r, payload, input, inst);
|
|
2746
|
+
};
|
|
2747
|
+
});
|
|
2748
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
2749
|
+
if (!result) {
|
|
2750
|
+
const _iss = {
|
|
2751
|
+
code: "custom",
|
|
2752
|
+
input,
|
|
2753
|
+
inst,
|
|
2754
|
+
path: [...inst._zod.def.path ?? []],
|
|
2755
|
+
continue: !inst._zod.def.abort
|
|
2756
|
+
};
|
|
2757
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2758
|
+
payload.issues.push(issue(_iss));
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
//#endregion
|
|
2762
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/memoizer.js
|
|
2763
|
+
var $ZodCyclicError = class extends Error {
|
|
2764
|
+
constructor() {
|
|
2765
|
+
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
2766
|
+
this.name = "ZodCyclicError";
|
|
2767
|
+
}
|
|
2768
|
+
};
|
|
2769
|
+
/** Keyed off the context object every schema in one parse call already shares. */
|
|
2770
|
+
const STATE = "~memo";
|
|
2771
|
+
const NO_ISSUES = [];
|
|
2772
|
+
function cloneIssues(issues) {
|
|
2773
|
+
return issues.map((iss) => iss.path ? {
|
|
2774
|
+
...iss,
|
|
2775
|
+
path: iss.path.slice()
|
|
2776
|
+
} : { ...iss });
|
|
2777
|
+
}
|
|
2778
|
+
const recursive = /*@__PURE__*/ new WeakMap();
|
|
2779
|
+
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
2780
|
+
function isRecursive(inst, stack) {
|
|
2781
|
+
const cached = recursive.get(inst);
|
|
2782
|
+
if (cached !== void 0) return cached;
|
|
2783
|
+
if (stack.has(inst)) return true;
|
|
2784
|
+
stack.add(inst);
|
|
2785
|
+
let result = false;
|
|
2786
|
+
const check = (child) => {
|
|
2787
|
+
if (!result && child?._zod && isRecursive(child, stack)) result = true;
|
|
2788
|
+
};
|
|
2789
|
+
const def = inst._zod.def;
|
|
2790
|
+
switch (def.type) {
|
|
2791
|
+
case "object":
|
|
2792
|
+
for (const key of Reflect.ownKeys(def.shape)) check(def.shape[key]);
|
|
2793
|
+
check(def.catchall);
|
|
2794
|
+
break;
|
|
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
|
+
check(inst._zod.innerType);
|
|
2838
|
+
break;
|
|
2839
|
+
case "template_literal":
|
|
2840
|
+
case "string":
|
|
2841
|
+
case "number":
|
|
2842
|
+
case "int":
|
|
2843
|
+
case "boolean":
|
|
2844
|
+
case "bigint":
|
|
2845
|
+
case "symbol":
|
|
2846
|
+
case "undefined":
|
|
2847
|
+
case "null":
|
|
2848
|
+
case "void":
|
|
2849
|
+
case "never":
|
|
2850
|
+
case "any":
|
|
2851
|
+
case "unknown":
|
|
2852
|
+
case "date":
|
|
2853
|
+
case "nan":
|
|
2854
|
+
case "enum":
|
|
2855
|
+
case "literal":
|
|
2856
|
+
case "file":
|
|
2857
|
+
case "transform":
|
|
2858
|
+
case "custom": break;
|
|
2859
|
+
default: for (const key in def) {
|
|
2860
|
+
const desc = Object.getOwnPropertyDescriptor(def, key);
|
|
2861
|
+
if (!desc || desc.get) continue;
|
|
2862
|
+
const value = desc.value;
|
|
2863
|
+
if (!value || typeof value !== "object") continue;
|
|
2864
|
+
if (value._zod) check(value);
|
|
2865
|
+
else if (Array.isArray(value)) for (const el of value) check(el);
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
stack.delete(inst);
|
|
2869
|
+
recursive.set(inst, result);
|
|
2870
|
+
return result;
|
|
2871
|
+
}
|
|
2872
|
+
function bucketFor(state, inst) {
|
|
2873
|
+
let bucket = state.buckets.get(inst);
|
|
2874
|
+
if (!bucket) {
|
|
2875
|
+
bucket = /* @__PURE__ */ new Map();
|
|
2876
|
+
state.buckets.set(inst, bucket);
|
|
2877
|
+
}
|
|
2878
|
+
return bucket;
|
|
2879
|
+
}
|
|
2880
|
+
let handoff;
|
|
2881
|
+
const open = [];
|
|
2882
|
+
const memo = {
|
|
2883
|
+
alloc(_inst, payload, empty) {
|
|
2884
|
+
const bucket = handoff;
|
|
2885
|
+
if (!bucket) return empty;
|
|
2886
|
+
handoff = void 0;
|
|
2887
|
+
const entry = {
|
|
2888
|
+
value: empty,
|
|
2889
|
+
issues: null
|
|
2890
|
+
};
|
|
2891
|
+
bucket.set(payload.value, entry);
|
|
2892
|
+
open.push(entry);
|
|
2893
|
+
return empty;
|
|
2894
|
+
},
|
|
2895
|
+
guard(inst) {
|
|
2896
|
+
var _a;
|
|
2897
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2898
|
+
inst._zod.deferred.push(() => {
|
|
2899
|
+
const base = inst._zod.parse;
|
|
2900
|
+
const wrapped = (payload, ctx) => {
|
|
2901
|
+
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
|
|
2902
|
+
return base(payload, ctx);
|
|
2903
|
+
};
|
|
2904
|
+
inst._zod.parse = wrapped;
|
|
2905
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2906
|
+
});
|
|
2907
|
+
},
|
|
2908
|
+
attach(inst) {
|
|
2909
|
+
var _a;
|
|
2910
|
+
let isRecursiveInst;
|
|
2911
|
+
let lastCtx;
|
|
2912
|
+
let lastBucket;
|
|
2913
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2914
|
+
inst._zod.deferred.push(() => {
|
|
2915
|
+
const base = inst._zod.parse;
|
|
2916
|
+
const wrapped = (payload, ctx) => {
|
|
2917
|
+
if (isRecursiveInst === void 0) {
|
|
2918
|
+
isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
|
|
2919
|
+
if (!isRecursiveInst) {
|
|
2920
|
+
inst._zod.parse = base;
|
|
2921
|
+
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
2922
|
+
return base(payload, ctx);
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
const input = payload.value;
|
|
2926
|
+
if (input === null || typeof input !== "object") return base(payload, ctx);
|
|
2927
|
+
let state = ctx[STATE];
|
|
2928
|
+
if (!state) {
|
|
2929
|
+
state = {
|
|
2930
|
+
buckets: /* @__PURE__ */ new Map(),
|
|
2931
|
+
backEdges: void 0
|
|
2932
|
+
};
|
|
2933
|
+
ctx[STATE] = state;
|
|
2934
|
+
}
|
|
2935
|
+
let bucket;
|
|
2936
|
+
if (lastCtx === ctx) bucket = lastBucket;
|
|
2937
|
+
else {
|
|
2938
|
+
bucket = bucketFor(state, inst);
|
|
2939
|
+
lastCtx = ctx;
|
|
2940
|
+
lastBucket = bucket;
|
|
2941
|
+
}
|
|
2942
|
+
const hit = bucket.get(input);
|
|
2943
|
+
if (hit) {
|
|
2944
|
+
payload.value = hit.value;
|
|
2945
|
+
if (hit.issues) {
|
|
2946
|
+
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
2947
|
+
} else {
|
|
2948
|
+
payload.memo = true;
|
|
2949
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
|
|
2950
|
+
state.backEdges.add(hit.value);
|
|
2951
|
+
}
|
|
2952
|
+
return payload;
|
|
2953
|
+
}
|
|
2954
|
+
handoff = bucket;
|
|
2955
|
+
const depth = open.length;
|
|
2956
|
+
const result = base(payload, ctx);
|
|
2957
|
+
handoff = void 0;
|
|
2958
|
+
const entry = open.length > depth ? open.pop() : void 0;
|
|
2959
|
+
if (result instanceof Promise) return result.then((r) => {
|
|
2960
|
+
if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
2961
|
+
return r;
|
|
2962
|
+
});
|
|
2963
|
+
if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
2964
|
+
return result;
|
|
2965
|
+
};
|
|
2966
|
+
inst._zod.parse = wrapped;
|
|
2967
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
};
|
|
2971
|
+
/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
|
|
2972
|
+
function memoizer() {
|
|
2973
|
+
return memo;
|
|
2974
|
+
}
|
|
2975
|
+
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
2976
|
+
function isBackEdge(ctx, value) {
|
|
2977
|
+
const backEdges = ctx[STATE]?.backEdges;
|
|
2978
|
+
return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
|
|
2979
|
+
}
|
|
2980
|
+
//#endregion
|
|
2981
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/en.js
|
|
2982
|
+
const error = () => {
|
|
2983
|
+
const Sizable = {
|
|
2984
|
+
string: {
|
|
2985
|
+
unit: "characters",
|
|
2986
|
+
verb: "to have"
|
|
2987
|
+
},
|
|
2988
|
+
file: {
|
|
2989
|
+
unit: "bytes",
|
|
2990
|
+
verb: "to have"
|
|
2991
|
+
},
|
|
2992
|
+
array: {
|
|
2993
|
+
unit: "items",
|
|
2994
|
+
verb: "to have"
|
|
2995
|
+
},
|
|
2996
|
+
set: {
|
|
2997
|
+
unit: "items",
|
|
2998
|
+
verb: "to have"
|
|
2999
|
+
},
|
|
3000
|
+
map: {
|
|
3001
|
+
unit: "entries",
|
|
3002
|
+
verb: "to have"
|
|
3003
|
+
}
|
|
3004
|
+
};
|
|
3005
|
+
function getSizing(origin) {
|
|
3006
|
+
return Sizable[origin] ?? null;
|
|
3007
|
+
}
|
|
3008
|
+
const FormatDictionary = {
|
|
3009
|
+
regex: "input",
|
|
3010
|
+
email: "email address",
|
|
3011
|
+
url: "URL",
|
|
3012
|
+
emoji: "emoji",
|
|
3013
|
+
uuid: "UUID",
|
|
3014
|
+
uuidv4: "UUIDv4",
|
|
3015
|
+
uuidv6: "UUIDv6",
|
|
3016
|
+
nanoid: "nanoid",
|
|
3017
|
+
guid: "GUID",
|
|
3018
|
+
cuid: "cuid",
|
|
3019
|
+
cuid2: "cuid2",
|
|
3020
|
+
ulid: "ULID",
|
|
3021
|
+
xid: "XID",
|
|
3022
|
+
ksuid: "KSUID",
|
|
3023
|
+
datetime: "ISO datetime",
|
|
3024
|
+
date: "ISO date",
|
|
3025
|
+
time: "ISO time",
|
|
3026
|
+
duration: "ISO duration",
|
|
3027
|
+
ipv4: "IPv4 address",
|
|
3028
|
+
ipv6: "IPv6 address",
|
|
3029
|
+
mac: "MAC address",
|
|
3030
|
+
cidrv4: "IPv4 range",
|
|
3031
|
+
cidrv6: "IPv6 range",
|
|
3032
|
+
base64: "base64-encoded string",
|
|
3033
|
+
base64url: "base64url-encoded string",
|
|
3034
|
+
json_string: "JSON string",
|
|
3035
|
+
e164: "E.164 number",
|
|
3036
|
+
credit_card: "credit card number",
|
|
3037
|
+
jwt: "JWT",
|
|
3038
|
+
template_literal: "input"
|
|
2322
3039
|
};
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
code: "custom",
|
|
2328
|
-
input,
|
|
2329
|
-
inst,
|
|
2330
|
-
path: [...inst._zod.def.path ?? []],
|
|
2331
|
-
continue: !inst._zod.def.abort
|
|
2332
|
-
};
|
|
2333
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2334
|
-
payload.issues.push(issue(_iss));
|
|
3040
|
+
const TypeDictionary = { nan: "NaN" };
|
|
3041
|
+
function getTypeName(type, input) {
|
|
3042
|
+
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
|
|
3043
|
+
return TypeDictionary[type] ?? type;
|
|
2335
3044
|
}
|
|
3045
|
+
return (issue) => {
|
|
3046
|
+
switch (issue.code) {
|
|
3047
|
+
case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
|
|
3048
|
+
case "invalid_value":
|
|
3049
|
+
if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
3050
|
+
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
3051
|
+
case "too_big": {
|
|
3052
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
3053
|
+
const sizing = getSizing(issue.origin);
|
|
3054
|
+
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
3055
|
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
3056
|
+
}
|
|
3057
|
+
case "too_small": {
|
|
3058
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
3059
|
+
const sizing = getSizing(issue.origin);
|
|
3060
|
+
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
3061
|
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
3062
|
+
}
|
|
3063
|
+
case "invalid_format": {
|
|
3064
|
+
const _issue = issue;
|
|
3065
|
+
if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
|
|
3066
|
+
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
|
3067
|
+
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
|
3068
|
+
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
3069
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
3070
|
+
}
|
|
3071
|
+
case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
3072
|
+
case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
3073
|
+
case "invalid_key": return `Invalid key in ${issue.origin}`;
|
|
3074
|
+
case "invalid_union":
|
|
3075
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
|
|
3076
|
+
if (issue.inclusive === false) return "Invalid input: more than one option matched";
|
|
3077
|
+
return "Invalid input";
|
|
3078
|
+
case "invalid_element": return `Invalid value in ${issue.origin}`;
|
|
3079
|
+
default: return `Invalid input`;
|
|
3080
|
+
}
|
|
3081
|
+
};
|
|
3082
|
+
};
|
|
3083
|
+
function en_default() {
|
|
3084
|
+
return { localeError: error() };
|
|
2336
3085
|
}
|
|
2337
3086
|
//#endregion
|
|
2338
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
3087
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/registries.js
|
|
2339
3088
|
var _a;
|
|
2340
3089
|
var $ZodRegistry = class {
|
|
2341
3090
|
constructor() {
|
|
@@ -2382,7 +3131,7 @@ window.__ModuleLoader__.load({
|
|
|
2382
3131
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2383
3132
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2384
3133
|
//#endregion
|
|
2385
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
3134
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/api.js
|
|
2386
3135
|
// @__NO_SIDE_EFFECTS__
|
|
2387
3136
|
function _string(Class, params) {
|
|
2388
3137
|
return new Class({
|
|
@@ -2874,7 +3623,7 @@ window.__ModuleLoader__.load({
|
|
|
2874
3623
|
const _issue = issue$2;
|
|
2875
3624
|
if (_issue.fatal) _issue.continue = false;
|
|
2876
3625
|
_issue.code ?? (_issue.code = "custom");
|
|
2877
|
-
|
|
3626
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
2878
3627
|
_issue.inst ?? (_issue.inst = ch);
|
|
2879
3628
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2880
3629
|
payload.issues.push(issue(_issue));
|
|
@@ -2894,7 +3643,11 @@ window.__ModuleLoader__.load({
|
|
|
2894
3643
|
return ch;
|
|
2895
3644
|
}
|
|
2896
3645
|
//#endregion
|
|
2897
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
3646
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
|
|
3647
|
+
function assignProps(target, ...sources) {
|
|
3648
|
+
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
3649
|
+
return target;
|
|
3650
|
+
}
|
|
2898
3651
|
function initializeContext(params) {
|
|
2899
3652
|
let target = params?.target ?? "draft-2020-12";
|
|
2900
3653
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -2908,11 +3661,31 @@ window.__ModuleLoader__.load({
|
|
|
2908
3661
|
io: params?.io ?? "output",
|
|
2909
3662
|
counter: 0,
|
|
2910
3663
|
seen: /* @__PURE__ */ new Map(),
|
|
3664
|
+
sharedDefsExtractedFor: void 0,
|
|
3665
|
+
sharedEmitDoneFor: void 0,
|
|
2911
3666
|
cycles: params?.cycles ?? "ref",
|
|
2912
3667
|
reused: params?.reused ?? "inline",
|
|
3668
|
+
intersections: [],
|
|
3669
|
+
deferred: [],
|
|
2913
3670
|
external: params?.external ?? void 0
|
|
2914
3671
|
};
|
|
2915
3672
|
}
|
|
3673
|
+
/**
|
|
3674
|
+
* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
|
|
3675
|
+
* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
|
|
3676
|
+
* custom JSON Schema was written into `json`, in which case the caller must not write its own.
|
|
3677
|
+
*/
|
|
3678
|
+
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
3679
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
|
|
3680
|
+
zodSchema: schema,
|
|
3681
|
+
path: params.path,
|
|
3682
|
+
message
|
|
3683
|
+
}) : ctx.unrepresentable;
|
|
3684
|
+
if (result === "any") return false;
|
|
3685
|
+
if (result === void 0 || result === "throw") throw new Error(message);
|
|
3686
|
+
Object.assign(json, result);
|
|
3687
|
+
return true;
|
|
3688
|
+
}
|
|
2916
3689
|
function process(schema, ctx, _params = {
|
|
2917
3690
|
path: [],
|
|
2918
3691
|
schemaPath: []
|
|
@@ -2932,6 +3705,8 @@ window.__ModuleLoader__.load({
|
|
|
2932
3705
|
path: _params.path
|
|
2933
3706
|
};
|
|
2934
3707
|
ctx.seen.set(schema, result);
|
|
3708
|
+
ctx.sharedDefsExtractedFor = void 0;
|
|
3709
|
+
ctx.sharedEmitDoneFor = void 0;
|
|
2935
3710
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2936
3711
|
if (overrideSchema) result.schema = overrideSchema;
|
|
2937
3712
|
else {
|
|
@@ -2955,7 +3730,7 @@ window.__ModuleLoader__.load({
|
|
|
2955
3730
|
}
|
|
2956
3731
|
}
|
|
2957
3732
|
const meta = ctx.metadataRegistry.get(schema);
|
|
2958
|
-
if (meta)
|
|
3733
|
+
if (meta) assignProps(result.schema, meta);
|
|
2959
3734
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
2960
3735
|
delete result.schema.examples;
|
|
2961
3736
|
delete result.schema.default;
|
|
@@ -2964,9 +3739,13 @@ window.__ModuleLoader__.load({
|
|
|
2964
3739
|
delete result.schema._prefault;
|
|
2965
3740
|
return ctx.seen.get(schema).schema;
|
|
2966
3741
|
}
|
|
3742
|
+
function encodeJSONPointerSegment(segment) {
|
|
3743
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3744
|
+
}
|
|
2967
3745
|
function extractDefs(ctx, schema) {
|
|
2968
3746
|
const root = ctx.seen.get(schema);
|
|
2969
3747
|
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3748
|
+
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
|
|
2970
3749
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
2971
3750
|
for (const entry of ctx.seen.entries()) {
|
|
2972
3751
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -2986,15 +3765,16 @@ window.__ModuleLoader__.load({
|
|
|
2986
3765
|
entry[1].defId = id;
|
|
2987
3766
|
return {
|
|
2988
3767
|
defId: id,
|
|
2989
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
3768
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
|
|
2990
3769
|
};
|
|
2991
3770
|
}
|
|
2992
|
-
|
|
2993
|
-
const defUriPrefix =
|
|
3771
|
+
const uriPrefix = `#`;
|
|
3772
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
3773
|
+
if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
|
|
2994
3774
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
2995
3775
|
return {
|
|
2996
3776
|
defId,
|
|
2997
|
-
ref: defUriPrefix + defId
|
|
3777
|
+
ref: defUriPrefix + encodeJSONPointerSegment(defId)
|
|
2998
3778
|
};
|
|
2999
3779
|
};
|
|
3000
3780
|
const extractToDef = (entry) => {
|
|
@@ -3041,6 +3821,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3041
3821
|
}
|
|
3042
3822
|
}
|
|
3043
3823
|
}
|
|
3824
|
+
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
3825
|
+
}
|
|
3826
|
+
/** 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. */
|
|
3827
|
+
function compactTypeUnion(schema) {
|
|
3828
|
+
const options = schema.anyOf;
|
|
3829
|
+
if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
|
|
3830
|
+
const types = [];
|
|
3831
|
+
for (const option of options) {
|
|
3832
|
+
if (!option || typeof option !== "object") return;
|
|
3833
|
+
compactTypeUnion(option);
|
|
3834
|
+
const keys = Object.keys(option);
|
|
3835
|
+
if (keys.length !== 1 || keys[0] !== "type") return;
|
|
3836
|
+
const type = option.type;
|
|
3837
|
+
for (const member of Array.isArray(type) ? type : [type]) {
|
|
3838
|
+
if (typeof member !== "string") return;
|
|
3839
|
+
if (!types.includes(member)) types.push(member);
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
delete schema.anyOf;
|
|
3843
|
+
schema.type = types.length === 1 ? types[0] : types;
|
|
3844
|
+
}
|
|
3845
|
+
/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
|
|
3846
|
+
* an annotation like `description` — makes a member unfoldable, so a constraint this does not
|
|
3847
|
+
* understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
|
|
3848
|
+
const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
|
|
3849
|
+
"type",
|
|
3850
|
+
"properties",
|
|
3851
|
+
"required",
|
|
3852
|
+
"additionalProperties"
|
|
3853
|
+
]);
|
|
3854
|
+
const UNION_KEYS = ["oneOf", "anyOf"];
|
|
3855
|
+
/** 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. */
|
|
3856
|
+
function undeclaredConstraint(member) {
|
|
3857
|
+
const extra = member.additionalProperties;
|
|
3858
|
+
if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
|
|
3859
|
+
return Object.keys(extra).length ? extra : null;
|
|
3860
|
+
}
|
|
3861
|
+
/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
|
|
3862
|
+
function foldObjects(members) {
|
|
3863
|
+
const objects = [];
|
|
3864
|
+
for (const member of members) {
|
|
3865
|
+
if (typeof member !== "object" || member.type !== "object") return null;
|
|
3866
|
+
for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
|
|
3867
|
+
objects.push(member);
|
|
3868
|
+
}
|
|
3869
|
+
const properties = {};
|
|
3870
|
+
const required = /* @__PURE__ */ new Set();
|
|
3871
|
+
for (const object of objects) {
|
|
3872
|
+
for (const key in object.properties) {
|
|
3873
|
+
if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
|
|
3874
|
+
const parts = [];
|
|
3875
|
+
for (const other of objects) {
|
|
3876
|
+
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
3877
|
+
if (part === null || part === void 0) continue;
|
|
3878
|
+
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
|
|
3879
|
+
}
|
|
3880
|
+
assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
|
|
3881
|
+
}
|
|
3882
|
+
for (const key of object.required ?? []) required.add(key);
|
|
3883
|
+
}
|
|
3884
|
+
const folded = {
|
|
3885
|
+
type: "object",
|
|
3886
|
+
properties
|
|
3887
|
+
};
|
|
3888
|
+
if (required.size) folded.required = [...required];
|
|
3889
|
+
if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
|
|
3890
|
+
else {
|
|
3891
|
+
const constraints = [];
|
|
3892
|
+
for (const object of objects) {
|
|
3893
|
+
const constraint = undeclaredConstraint(object);
|
|
3894
|
+
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
|
|
3895
|
+
}
|
|
3896
|
+
if (constraints.length === 1) folded.additionalProperties = constraints[0];
|
|
3897
|
+
else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
|
|
3898
|
+
}
|
|
3899
|
+
return folded;
|
|
3900
|
+
}
|
|
3901
|
+
/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
|
|
3902
|
+
* closed object members reject each other's keys and the schema validates nothing. Zod's parser
|
|
3903
|
+
* pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
|
|
3904
|
+
* *every* side rejects it — so the emitted schema has to pool them too, and folding the members
|
|
3905
|
+
* into one object is the encoding that says so on every target.
|
|
3906
|
+
*
|
|
3907
|
+
* This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
|
|
3908
|
+
* machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
|
|
3909
|
+
* keeps its reference and its own closedness rather than being inlined as a stale copy. */
|
|
3910
|
+
function foldIntersection(json) {
|
|
3911
|
+
const allOf = json.allOf;
|
|
3912
|
+
if (!Array.isArray(allOf) || allOf.length < 2) return;
|
|
3913
|
+
for (const key of FOLDABLE_KEYS) if (key in json) return;
|
|
3914
|
+
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
3915
|
+
let folded = null;
|
|
3916
|
+
if (!unions.length) folded = foldObjects(allOf);
|
|
3917
|
+
else {
|
|
3918
|
+
const union = unions[0];
|
|
3919
|
+
const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
|
|
3920
|
+
if (Object.keys(union).length !== 1) return;
|
|
3921
|
+
const rest = allOf.filter((m) => m !== union);
|
|
3922
|
+
const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
3923
|
+
if (branches.some((b) => !b)) return;
|
|
3924
|
+
folded = { [keyword]: branches };
|
|
3925
|
+
}
|
|
3926
|
+
if (!folded) return;
|
|
3927
|
+
delete json.allOf;
|
|
3928
|
+
assignProps(json, folded);
|
|
3044
3929
|
}
|
|
3045
3930
|
function finalize(ctx, schema) {
|
|
3046
3931
|
const root = ctx.seen.get(schema);
|
|
@@ -3059,8 +3944,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3059
3944
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
3060
3945
|
schema.allOf = schema.allOf ?? [];
|
|
3061
3946
|
schema.allOf.push(refSchema);
|
|
3062
|
-
} else
|
|
3063
|
-
|
|
3947
|
+
} else assignProps(schema, refSchema);
|
|
3948
|
+
assignProps(schema, _cached);
|
|
3064
3949
|
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
3065
3950
|
if (key === "$ref" || key === "allOf") continue;
|
|
3066
3951
|
if (!(key in _cached)) delete schema[key];
|
|
@@ -3088,7 +3973,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3088
3973
|
path: seen.path ?? []
|
|
3089
3974
|
});
|
|
3090
3975
|
};
|
|
3091
|
-
|
|
3976
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
3977
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
3978
|
+
if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
3979
|
+
for (const rewrite of ctx.deferred) rewrite();
|
|
3980
|
+
if (ctx.intersections.length) {
|
|
3981
|
+
const carriers = /* @__PURE__ */ new Map();
|
|
3982
|
+
for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
|
|
3983
|
+
const allOf = json?.allOf;
|
|
3984
|
+
if (!Array.isArray(allOf)) continue;
|
|
3985
|
+
const existing = carriers.get(allOf);
|
|
3986
|
+
if (existing) existing.push(json);
|
|
3987
|
+
else carriers.set(allOf, [json]);
|
|
3988
|
+
}
|
|
3989
|
+
for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3092
3992
|
const result = {};
|
|
3093
3993
|
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
3094
3994
|
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -3099,17 +3999,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3099
3999
|
if (!id) throw new Error("Schema is missing an `id` property");
|
|
3100
4000
|
result.$id = ctx.external.uri(id);
|
|
3101
4001
|
}
|
|
3102
|
-
|
|
4002
|
+
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
3103
4003
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
3104
4004
|
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
3105
4005
|
const defs = ctx.external?.defs ?? {};
|
|
3106
|
-
for (const entry of ctx.seen.entries()) {
|
|
4006
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
|
|
3107
4007
|
const seen = entry[1];
|
|
3108
4008
|
if (seen.def && seen.defId) {
|
|
3109
4009
|
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
3110
|
-
defs
|
|
4010
|
+
assignProp(defs, seen.defId, seen.def);
|
|
3111
4011
|
}
|
|
3112
4012
|
}
|
|
4013
|
+
if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
|
|
3113
4014
|
if (ctx.external) {} else if (Object.keys(defs).length > 0) {
|
|
3114
4015
|
if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
3115
4016
|
else result.definitions = defs;
|
|
@@ -3141,7 +4042,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3141
4042
|
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
3142
4043
|
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
3143
4044
|
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
3144
|
-
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);
|
|
4045
|
+
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);
|
|
3145
4046
|
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
3146
4047
|
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3147
4048
|
if (def.type === "pipe") {
|
|
@@ -3189,7 +4090,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3189
4090
|
return finalize(ctx, schema);
|
|
3190
4091
|
};
|
|
3191
4092
|
//#endregion
|
|
3192
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
4093
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema-processors.js
|
|
3193
4094
|
const formatMap = {
|
|
3194
4095
|
guid: "uuid",
|
|
3195
4096
|
url: "uri",
|
|
@@ -3200,25 +4101,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3200
4101
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3201
4102
|
const json = _json;
|
|
3202
4103
|
json.type = "string";
|
|
3203
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
4104
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
|
|
3204
4105
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
3205
4106
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3206
4107
|
if (format) {
|
|
3207
4108
|
json.format = formatMap[format] ?? format;
|
|
3208
4109
|
if (json.format === "") delete json.format;
|
|
3209
|
-
if (format === "time") delete json.format;
|
|
4110
|
+
if (format === "time" || laxFormat) delete json.format;
|
|
3210
4111
|
}
|
|
3211
4112
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3212
4113
|
if (patterns && patterns.size > 0) {
|
|
3213
|
-
const
|
|
3214
|
-
if (
|
|
3215
|
-
else if (
|
|
4114
|
+
const patternList = [...patterns];
|
|
4115
|
+
if (patternList.length === 1) json.pattern = patternList[0].source;
|
|
4116
|
+
else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
|
|
3216
4117
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3217
4118
|
pattern: regex.source
|
|
3218
4119
|
}))];
|
|
3219
4120
|
}
|
|
3220
4121
|
};
|
|
3221
|
-
const numberProcessor = (schema, ctx, _json,
|
|
4122
|
+
const numberProcessor = (schema, ctx, _json, params) => {
|
|
3222
4123
|
const json = _json;
|
|
3223
4124
|
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
3224
4125
|
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
@@ -3238,7 +4139,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3238
4139
|
json.exclusiveMaximum = true;
|
|
3239
4140
|
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3240
4141
|
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
3241
|
-
if (typeof multipleOf === "number")
|
|
4142
|
+
if (typeof multipleOf === "number") {
|
|
4143
|
+
if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
|
|
4144
|
+
else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
|
|
4145
|
+
}
|
|
3242
4146
|
};
|
|
3243
4147
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3244
4148
|
json.type = "boolean";
|
|
@@ -3256,18 +4160,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3256
4160
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3257
4161
|
const def = schema._zod.def;
|
|
3258
4162
|
const values = getEnumValues(def.entries);
|
|
4163
|
+
if (values.length === 0) {
|
|
4164
|
+
json.not = {};
|
|
4165
|
+
return;
|
|
4166
|
+
}
|
|
3259
4167
|
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
3260
4168
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3261
4169
|
json.enum = values;
|
|
3262
4170
|
};
|
|
3263
|
-
const literalProcessor = (schema, ctx, json,
|
|
4171
|
+
const literalProcessor = (schema, ctx, json, params) => {
|
|
3264
4172
|
const def = schema._zod.def;
|
|
4173
|
+
if (def.values.length === 0) {
|
|
4174
|
+
json.not = {};
|
|
4175
|
+
return;
|
|
4176
|
+
}
|
|
3265
4177
|
const vals = [];
|
|
3266
4178
|
for (const val of def.values) if (val === void 0) {
|
|
3267
|
-
if (ctx
|
|
4179
|
+
if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema")) return;
|
|
3268
4180
|
} else if (typeof val === "bigint") {
|
|
3269
|
-
if (ctx
|
|
3270
|
-
|
|
4181
|
+
if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema")) return;
|
|
4182
|
+
vals.push(Number(val));
|
|
3271
4183
|
} else vals.push(val);
|
|
3272
4184
|
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
3273
4185
|
const val = vals[0];
|
|
@@ -3282,11 +4194,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3282
4194
|
json.enum = vals;
|
|
3283
4195
|
}
|
|
3284
4196
|
};
|
|
3285
|
-
const customProcessor = (
|
|
3286
|
-
|
|
4197
|
+
const customProcessor = (schema, ctx, json, params) => {
|
|
4198
|
+
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
|
|
3287
4199
|
};
|
|
3288
|
-
const transformProcessor = (
|
|
3289
|
-
|
|
4200
|
+
const transformProcessor = (schema, ctx, json, params) => {
|
|
4201
|
+
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
|
|
3290
4202
|
};
|
|
3291
4203
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3292
4204
|
const json = _json;
|
|
@@ -3300,25 +4212,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3300
4212
|
path: [...params.path, "items"]
|
|
3301
4213
|
});
|
|
3302
4214
|
};
|
|
4215
|
+
function inputOptin(schema) {
|
|
4216
|
+
const def = schema._zod.def;
|
|
4217
|
+
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
|
|
4218
|
+
if (def.type === "catch") return inputOptin(def.innerType);
|
|
4219
|
+
return schema._zod.optin;
|
|
4220
|
+
}
|
|
3303
4221
|
const objectProcessor = (schema, ctx, _json, params) => {
|
|
3304
4222
|
const json = _json;
|
|
3305
4223
|
const def = schema._zod.def;
|
|
4224
|
+
const shape = def.shape;
|
|
4225
|
+
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
3306
4226
|
json.type = "object";
|
|
3307
4227
|
json.properties = {};
|
|
3308
|
-
const shape
|
|
3309
|
-
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
4228
|
+
for (const key in shape) assignProp(json.properties, key, process(shape[key], ctx, {
|
|
3310
4229
|
...params,
|
|
3311
4230
|
path: [
|
|
3312
4231
|
...params.path,
|
|
3313
4232
|
"properties",
|
|
3314
4233
|
key
|
|
3315
4234
|
]
|
|
3316
|
-
});
|
|
4235
|
+
}));
|
|
3317
4236
|
const allKeys = new Set(Object.keys(shape));
|
|
3318
4237
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3319
|
-
const
|
|
3320
|
-
if (ctx.io === "input") return
|
|
3321
|
-
else return
|
|
4238
|
+
const field = def.shape[key];
|
|
4239
|
+
if (ctx.io === "input") return inputOptin(field) === void 0;
|
|
4240
|
+
else return field._zod.optout === void 0;
|
|
3322
4241
|
}));
|
|
3323
4242
|
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
3324
4243
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
@@ -3362,8 +4281,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3362
4281
|
]
|
|
3363
4282
|
});
|
|
3364
4283
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3365
|
-
|
|
4284
|
+
const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
4285
|
+
json.allOf = allOf;
|
|
4286
|
+
ctx.intersections.push(allOf);
|
|
3366
4287
|
};
|
|
4288
|
+
/** JSON object keys are always strings, so a numeric record key schema is re-expressed over the
|
|
4289
|
+
* numeric-string form the record parser matches. Deferred to `finalize`, after the flatten: a key
|
|
4290
|
+
* behind a wrapper only carries its own `type` before then, and a union key only has its branches.
|
|
4291
|
+
*
|
|
4292
|
+
* A numeric bound cannot apply to a property name, so `minimum` and its siblings are dropped rather
|
|
4293
|
+
* than carried over: keeping them beside `type: "string"` reproduces the match-nothing schema this
|
|
4294
|
+
* exists to fix. A key that carries one therefore emits wider than the record parses — `z.record(z.number().min(5), V)`
|
|
4295
|
+
* accepts `"3"` — which is the deliberate trade, since throwing on it would reject an ordinary schema
|
|
4296
|
+
* outright. */
|
|
4297
|
+
function stringifyKeyNames(bySchema, json, visited) {
|
|
4298
|
+
if (json.$ref) {
|
|
4299
|
+
if (visited.has(json)) return json;
|
|
4300
|
+
visited.add(json);
|
|
4301
|
+
const def = bySchema.get(json)?.def;
|
|
4302
|
+
if (!def) return json;
|
|
4303
|
+
const inlined = stringifyKeyNames(bySchema, def, visited);
|
|
4304
|
+
return inlined === def ? json : inlined;
|
|
4305
|
+
}
|
|
4306
|
+
for (const keyword of ["anyOf", "oneOf"]) {
|
|
4307
|
+
const branches = json[keyword];
|
|
4308
|
+
if (!Array.isArray(branches)) continue;
|
|
4309
|
+
const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
|
|
4310
|
+
if (mapped.some((branch, i) => branch !== branches[i])) json = {
|
|
4311
|
+
...json,
|
|
4312
|
+
[keyword]: mapped
|
|
4313
|
+
};
|
|
4314
|
+
}
|
|
4315
|
+
const types = Array.isArray(json.type) ? json.type : [json.type];
|
|
4316
|
+
const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
|
|
4317
|
+
const values = json.enum ?? (json.const !== void 0 ? [json.const] : void 0);
|
|
4318
|
+
if (!numericType && !values?.some((v) => typeof v === "number")) return json;
|
|
4319
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;
|
|
4320
|
+
if (rest.enum) rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
|
|
4321
|
+
else if (typeof rest.const === "number") rest.const = String(rest.const);
|
|
4322
|
+
if (!numericType) return rest;
|
|
4323
|
+
rest.type = "string";
|
|
4324
|
+
if (!values) rest.pattern = (types.includes("number") ? number$1 : integer).source;
|
|
4325
|
+
return rest;
|
|
4326
|
+
}
|
|
4327
|
+
/** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
|
|
4328
|
+
const pendingRecords = /* @__PURE__ */ new WeakMap();
|
|
4329
|
+
function rewriteKeyNames(ctx) {
|
|
4330
|
+
const bySchema = /* @__PURE__ */ new Map();
|
|
4331
|
+
for (const entry of ctx.seen.values()) if (entry.def && !bySchema.has(entry.schema)) bySchema.set(entry.schema, entry);
|
|
4332
|
+
const rewrites = /* @__PURE__ */ new Map();
|
|
4333
|
+
for (const record of pendingRecords.get(ctx) ?? []) {
|
|
4334
|
+
const seen = ctx.seen.get(record);
|
|
4335
|
+
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
4336
|
+
if (!names || names === true || rewrites.has(names)) continue;
|
|
4337
|
+
const rewritten = stringifyKeyNames(bySchema, names, /* @__PURE__ */ new Set());
|
|
4338
|
+
if (rewritten !== names) rewrites.set(names, rewritten);
|
|
4339
|
+
}
|
|
4340
|
+
if (!rewrites.size) return;
|
|
4341
|
+
for (const entry of ctx.seen.values()) for (const carrier of [entry.schema, entry.def]) {
|
|
4342
|
+
const rewritten = carrier && rewrites.get(carrier.propertyNames);
|
|
4343
|
+
if (rewritten) carrier.propertyNames = rewritten;
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
3367
4346
|
const recordProcessor = (schema, ctx, _json, params) => {
|
|
3368
4347
|
const json = _json;
|
|
3369
4348
|
const def = schema._zod.def;
|
|
@@ -3380,21 +4359,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3380
4359
|
]
|
|
3381
4360
|
});
|
|
3382
4361
|
json.patternProperties = {};
|
|
3383
|
-
for (const pattern of patterns) json.patternProperties
|
|
4362
|
+
for (const pattern of patterns) assignProp(json.patternProperties, pattern.source, valueSchema);
|
|
3384
4363
|
} else {
|
|
3385
|
-
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12")
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
4364
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
4365
|
+
json.propertyNames = process(def.keyType, ctx, {
|
|
4366
|
+
...params,
|
|
4367
|
+
path: [...params.path, "propertyNames"]
|
|
4368
|
+
});
|
|
4369
|
+
let pending = pendingRecords.get(ctx);
|
|
4370
|
+
if (!pending) {
|
|
4371
|
+
pending = [];
|
|
4372
|
+
pendingRecords.set(ctx, pending);
|
|
4373
|
+
ctx.deferred.push(() => rewriteKeyNames(ctx));
|
|
4374
|
+
}
|
|
4375
|
+
pending.push(schema);
|
|
4376
|
+
}
|
|
3389
4377
|
json.additionalProperties = process(def.valueType, ctx, {
|
|
3390
4378
|
...params,
|
|
3391
4379
|
path: [...params.path, "additionalProperties"]
|
|
3392
4380
|
});
|
|
3393
4381
|
}
|
|
3394
4382
|
const keyValues = keyType._zod.values;
|
|
3395
|
-
|
|
4383
|
+
const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== void 0;
|
|
4384
|
+
if (keyValues && !def.partial && !omittableOnInput) {
|
|
3396
4385
|
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
3397
|
-
if (validKeyValues.length > 0) json.required = validKeyValues;
|
|
4386
|
+
if (validKeyValues.length > 0) json.required = validKeyValues.map(String);
|
|
3398
4387
|
}
|
|
3399
4388
|
};
|
|
3400
4389
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
@@ -3412,19 +4401,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3412
4401
|
const seen = ctx.seen.get(schema);
|
|
3413
4402
|
seen.ref = def.innerType;
|
|
3414
4403
|
};
|
|
4404
|
+
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
|
|
4405
|
+
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
|
|
4406
|
+
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
|
|
4407
|
+
const UNREPRESENTABLE_DEFAULT = Symbol();
|
|
4408
|
+
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
4409
|
+
let unrepresentable = false;
|
|
4410
|
+
const serialized = JSON.stringify(value, (_, val) => {
|
|
4411
|
+
if (typeof val !== "bigint") return val;
|
|
4412
|
+
unrepresentable = true;
|
|
4413
|
+
return null;
|
|
4414
|
+
});
|
|
4415
|
+
if (!unrepresentable) return JSON.parse(serialized);
|
|
4416
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
4417
|
+
return UNREPRESENTABLE_DEFAULT;
|
|
4418
|
+
}
|
|
3415
4419
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
3416
4420
|
const def = schema._zod.def;
|
|
3417
4421
|
process(def.innerType, ctx, params);
|
|
3418
4422
|
const seen = ctx.seen.get(schema);
|
|
3419
4423
|
seen.ref = def.innerType;
|
|
3420
|
-
|
|
4424
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4425
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
|
|
3421
4426
|
};
|
|
3422
4427
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
3423
4428
|
const def = schema._zod.def;
|
|
3424
4429
|
process(def.innerType, ctx, params);
|
|
3425
4430
|
const seen = ctx.seen.get(schema);
|
|
3426
4431
|
seen.ref = def.innerType;
|
|
3427
|
-
if (ctx.io
|
|
4432
|
+
if (ctx.io !== "input") return;
|
|
4433
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4434
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
|
|
3428
4435
|
};
|
|
3429
4436
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
3430
4437
|
const def = schema._zod.def;
|
|
@@ -3435,7 +4442,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3435
4442
|
try {
|
|
3436
4443
|
catchValue = def.catchValue(void 0);
|
|
3437
4444
|
} catch {
|
|
3438
|
-
|
|
4445
|
+
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
|
|
4446
|
+
return;
|
|
3439
4447
|
}
|
|
3440
4448
|
json.default = catchValue;
|
|
3441
4449
|
};
|
|
@@ -3467,59 +4475,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3467
4475
|
seen.ref = innerType;
|
|
3468
4476
|
};
|
|
3469
4477
|
//#endregion
|
|
3470
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
3471
|
-
const
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
$ZodISODuration.init(inst, def);
|
|
3494
|
-
ZodStringFormat.init(inst, def);
|
|
3495
|
-
});
|
|
3496
|
-
function duration(params) {
|
|
3497
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
4478
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/errors.js
|
|
4479
|
+
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4480
|
+
function _lazyMethod(proto, key, make) {
|
|
4481
|
+
Object.defineProperty(proto, key, {
|
|
4482
|
+
configurable: true,
|
|
4483
|
+
enumerable: false,
|
|
4484
|
+
get() {
|
|
4485
|
+
const value = make(this);
|
|
4486
|
+
Object.defineProperty(this, key, {
|
|
4487
|
+
value,
|
|
4488
|
+
configurable: true,
|
|
4489
|
+
writable: true
|
|
4490
|
+
});
|
|
4491
|
+
return value;
|
|
4492
|
+
},
|
|
4493
|
+
set(value) {
|
|
4494
|
+
Object.defineProperty(this, key, {
|
|
4495
|
+
value,
|
|
4496
|
+
configurable: true,
|
|
4497
|
+
writable: true
|
|
4498
|
+
});
|
|
4499
|
+
}
|
|
4500
|
+
});
|
|
3498
4501
|
}
|
|
3499
|
-
//#endregion
|
|
3500
|
-
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
3501
4502
|
const initializer = (inst, issues) => {
|
|
3502
4503
|
$ZodError.init(inst, issues);
|
|
3503
4504
|
inst.name = "ZodError";
|
|
3504
|
-
Object.
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
4505
|
+
const proto = Object.getPrototypeOf(inst);
|
|
4506
|
+
if (_installedErrorProtos.has(proto)) return;
|
|
4507
|
+
_installedErrorProtos.add(proto);
|
|
4508
|
+
_lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
|
|
4509
|
+
_lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
|
|
4510
|
+
_lazyMethod(proto, "addIssue", (self) => (issue) => {
|
|
4511
|
+
self.issues.push(issue);
|
|
4512
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4513
|
+
});
|
|
4514
|
+
_lazyMethod(proto, "addIssues", (self) => (issues) => {
|
|
4515
|
+
self.issues.push(...issues);
|
|
4516
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4517
|
+
});
|
|
4518
|
+
Object.defineProperty(proto, "isEmpty", {
|
|
4519
|
+
configurable: true,
|
|
4520
|
+
enumerable: false,
|
|
4521
|
+
get() {
|
|
4522
|
+
return this.issues.length === 0;
|
|
4523
|
+
}
|
|
3518
4524
|
});
|
|
3519
4525
|
};
|
|
3520
|
-
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
4526
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
3521
4527
|
//#endregion
|
|
3522
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
4528
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/parse.js
|
|
3523
4529
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
3524
4530
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3525
4531
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -3533,167 +4539,175 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3533
4539
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3534
4540
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3535
4541
|
//#endregion
|
|
3536
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
if (!
|
|
3542
|
-
installed = /* @__PURE__ */ new Set();
|
|
3543
|
-
_installedGroups.set(proto, installed);
|
|
3544
|
-
}
|
|
3545
|
-
if (installed.has(group)) return;
|
|
3546
|
-
installed.add(group);
|
|
3547
|
-
for (const key in methods) {
|
|
3548
|
-
const fn = methods[key];
|
|
3549
|
-
Object.defineProperty(proto, key, {
|
|
3550
|
-
configurable: true,
|
|
3551
|
-
enumerable: false,
|
|
3552
|
-
get() {
|
|
3553
|
-
const bound = fn.bind(this);
|
|
3554
|
-
Object.defineProperty(this, key, {
|
|
3555
|
-
configurable: true,
|
|
3556
|
-
writable: true,
|
|
3557
|
-
enumerable: true,
|
|
3558
|
-
value: bound
|
|
3559
|
-
});
|
|
3560
|
-
return bound;
|
|
3561
|
-
},
|
|
3562
|
-
set(v) {
|
|
3563
|
-
Object.defineProperty(this, key, {
|
|
3564
|
-
configurable: true,
|
|
3565
|
-
writable: true,
|
|
3566
|
-
enumerable: true,
|
|
3567
|
-
value: v
|
|
3568
|
-
});
|
|
3569
|
-
}
|
|
3570
|
-
});
|
|
3571
|
-
}
|
|
4542
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js
|
|
4543
|
+
function _ensureDefaultLocale() {
|
|
4544
|
+
if (!globalConfig.localeError) config(en_default());
|
|
4545
|
+
}
|
|
4546
|
+
function _ensureDefaultMemoizer() {
|
|
4547
|
+
if (!globalConfig.memoizer) config({ memoizer: memoizer() });
|
|
3572
4548
|
}
|
|
3573
4549
|
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
4550
|
+
_ensureDefaultLocale();
|
|
3574
4551
|
$ZodType.init(inst, def);
|
|
3575
|
-
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3576
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3577
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3578
|
-
} });
|
|
3579
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3580
4552
|
inst.def = def;
|
|
3581
4553
|
inst.type = def.type;
|
|
3582
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
3583
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3584
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3585
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3586
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3587
|
-
inst.spa = inst.safeParseAsync;
|
|
3588
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
3589
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
3590
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3591
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3592
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3593
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3594
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3595
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3596
|
-
_installLazyMethods(inst, "ZodType", {
|
|
3597
|
-
check(...chks) {
|
|
3598
|
-
const def = this.def;
|
|
3599
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3600
|
-
check: ch,
|
|
3601
|
-
def: { check: "custom" },
|
|
3602
|
-
onattach: []
|
|
3603
|
-
} } : ch)] }), { parent: true });
|
|
3604
|
-
},
|
|
3605
|
-
with(...chks) {
|
|
3606
|
-
return this.check(...chks);
|
|
3607
|
-
},
|
|
3608
|
-
clone(def, params) {
|
|
3609
|
-
return clone(this, def, params);
|
|
3610
|
-
},
|
|
3611
|
-
brand() {
|
|
3612
|
-
return this;
|
|
3613
|
-
},
|
|
3614
|
-
register(reg, meta) {
|
|
3615
|
-
reg.add(this, meta);
|
|
3616
|
-
return this;
|
|
3617
|
-
},
|
|
3618
|
-
refine(check, params) {
|
|
3619
|
-
return this.check(refine(check, params));
|
|
3620
|
-
},
|
|
3621
|
-
superRefine(refinement, params) {
|
|
3622
|
-
return this.check(superRefine(refinement, params));
|
|
3623
|
-
},
|
|
3624
|
-
overwrite(fn) {
|
|
3625
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
3626
|
-
},
|
|
3627
|
-
optional() {
|
|
3628
|
-
return optional(this);
|
|
3629
|
-
},
|
|
3630
|
-
exactOptional() {
|
|
3631
|
-
return exactOptional(this);
|
|
3632
|
-
},
|
|
3633
|
-
nullable() {
|
|
3634
|
-
return nullable(this);
|
|
3635
|
-
},
|
|
3636
|
-
nullish() {
|
|
3637
|
-
return optional(nullable(this));
|
|
3638
|
-
},
|
|
3639
|
-
nonoptional(params) {
|
|
3640
|
-
return nonoptional(this, params);
|
|
3641
|
-
},
|
|
3642
|
-
array() {
|
|
3643
|
-
return array(this);
|
|
3644
|
-
},
|
|
3645
|
-
or(arg) {
|
|
3646
|
-
return union([this, arg]);
|
|
3647
|
-
},
|
|
3648
|
-
and(arg) {
|
|
3649
|
-
return intersection(this, arg);
|
|
3650
|
-
},
|
|
3651
|
-
transform(tx) {
|
|
3652
|
-
return pipe(this, transform(tx));
|
|
3653
|
-
},
|
|
3654
|
-
default(d) {
|
|
3655
|
-
return _default(this, d);
|
|
3656
|
-
},
|
|
3657
|
-
prefault(d) {
|
|
3658
|
-
return prefault(this, d);
|
|
3659
|
-
},
|
|
3660
|
-
catch(params) {
|
|
3661
|
-
return _catch(this, params);
|
|
3662
|
-
},
|
|
3663
|
-
pipe(target) {
|
|
3664
|
-
return pipe(this, target);
|
|
3665
|
-
},
|
|
3666
|
-
readonly() {
|
|
3667
|
-
return readonly(this);
|
|
3668
|
-
},
|
|
3669
|
-
describe(description) {
|
|
3670
|
-
const cl = this.clone();
|
|
3671
|
-
globalRegistry.add(cl, { description });
|
|
3672
|
-
return cl;
|
|
3673
|
-
},
|
|
3674
|
-
meta(...args) {
|
|
3675
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
3676
|
-
const cl = this.clone();
|
|
3677
|
-
globalRegistry.add(cl, args[0]);
|
|
3678
|
-
return cl;
|
|
3679
|
-
},
|
|
3680
|
-
isOptional() {
|
|
3681
|
-
return this.safeParse(void 0).success;
|
|
3682
|
-
},
|
|
3683
|
-
isNullable() {
|
|
3684
|
-
return this.safeParse(null).success;
|
|
3685
|
-
},
|
|
3686
|
-
apply(fn) {
|
|
3687
|
-
return fn(this);
|
|
3688
|
-
}
|
|
3689
|
-
});
|
|
3690
|
-
Object.defineProperty(inst, "description", {
|
|
3691
|
-
get() {
|
|
3692
|
-
return globalRegistry.get(inst)?.description;
|
|
3693
|
-
},
|
|
3694
|
-
configurable: true
|
|
3695
|
-
});
|
|
3696
4554
|
return inst;
|
|
4555
|
+
}, {
|
|
4556
|
+
check(...chks) {
|
|
4557
|
+
const def = this.def;
|
|
4558
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
4559
|
+
check: ch,
|
|
4560
|
+
def: { check: "custom" },
|
|
4561
|
+
onattach: []
|
|
4562
|
+
} } : ch)] }), { parent: true });
|
|
4563
|
+
},
|
|
4564
|
+
with(...chks) {
|
|
4565
|
+
return this.check(...chks);
|
|
4566
|
+
},
|
|
4567
|
+
clone(def, params) {
|
|
4568
|
+
return clone(this, def, params);
|
|
4569
|
+
},
|
|
4570
|
+
brand() {
|
|
4571
|
+
return this;
|
|
4572
|
+
},
|
|
4573
|
+
register(reg, meta) {
|
|
4574
|
+
reg.add(this, meta);
|
|
4575
|
+
return this;
|
|
4576
|
+
},
|
|
4577
|
+
refine(check, params) {
|
|
4578
|
+
return this.check(refine(check, params));
|
|
4579
|
+
},
|
|
4580
|
+
superRefine(refinement, params) {
|
|
4581
|
+
return this.check(superRefine(refinement, params));
|
|
4582
|
+
},
|
|
4583
|
+
overwrite(fn) {
|
|
4584
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
4585
|
+
},
|
|
4586
|
+
optional() {
|
|
4587
|
+
return optional(this);
|
|
4588
|
+
},
|
|
4589
|
+
exactOptional() {
|
|
4590
|
+
return exactOptional(this);
|
|
4591
|
+
},
|
|
4592
|
+
nullable() {
|
|
4593
|
+
return nullable(this);
|
|
4594
|
+
},
|
|
4595
|
+
nullish() {
|
|
4596
|
+
return optional(nullable(this));
|
|
4597
|
+
},
|
|
4598
|
+
nonoptional(params) {
|
|
4599
|
+
return nonoptional(this, params);
|
|
4600
|
+
},
|
|
4601
|
+
array() {
|
|
4602
|
+
return array(this);
|
|
4603
|
+
},
|
|
4604
|
+
or(arg) {
|
|
4605
|
+
return union([this, arg]);
|
|
4606
|
+
},
|
|
4607
|
+
and(arg) {
|
|
4608
|
+
return intersection(this, arg);
|
|
4609
|
+
},
|
|
4610
|
+
transform(tx) {
|
|
4611
|
+
return pipe(this, transform(tx));
|
|
4612
|
+
},
|
|
4613
|
+
default(d) {
|
|
4614
|
+
return _default(this, d);
|
|
4615
|
+
},
|
|
4616
|
+
prefault(d) {
|
|
4617
|
+
return prefault(this, d);
|
|
4618
|
+
},
|
|
4619
|
+
catch(params) {
|
|
4620
|
+
return _catch(this, params);
|
|
4621
|
+
},
|
|
4622
|
+
pipe(target) {
|
|
4623
|
+
return pipe(this, target);
|
|
4624
|
+
},
|
|
4625
|
+
readonly() {
|
|
4626
|
+
return readonly(this);
|
|
4627
|
+
},
|
|
4628
|
+
describe(description) {
|
|
4629
|
+
const cl = this.clone();
|
|
4630
|
+
globalRegistry.add(cl, { description });
|
|
4631
|
+
return cl;
|
|
4632
|
+
},
|
|
4633
|
+
meta(...args) {
|
|
4634
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
4635
|
+
const cl = this.clone();
|
|
4636
|
+
globalRegistry.add(cl, args[0]);
|
|
4637
|
+
return cl;
|
|
4638
|
+
},
|
|
4639
|
+
isOptional() {
|
|
4640
|
+
return this.safeParse(void 0).success;
|
|
4641
|
+
},
|
|
4642
|
+
isNullable() {
|
|
4643
|
+
return this.safeParse(null).success;
|
|
4644
|
+
},
|
|
4645
|
+
apply(fn, ...args) {
|
|
4646
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
4647
|
+
},
|
|
4648
|
+
get "~standard"() {
|
|
4649
|
+
return hide(this, "~standard", {
|
|
4650
|
+
...standardProps(this),
|
|
4651
|
+
jsonSchema: {
|
|
4652
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
4653
|
+
output: createStandardJSONSchemaMethod(this, "output")
|
|
4654
|
+
}
|
|
4655
|
+
});
|
|
4656
|
+
},
|
|
4657
|
+
set "~standard"(value) {
|
|
4658
|
+
own(this, "~standard", value);
|
|
4659
|
+
},
|
|
4660
|
+
parse: function _parse(data, params) {
|
|
4661
|
+
return parse(this, data, params, { callee: _parse });
|
|
4662
|
+
},
|
|
4663
|
+
parseAsync: async function _parseAsync(data, params) {
|
|
4664
|
+
return await parseAsync(this, data, params, { callee: _parseAsync });
|
|
4665
|
+
},
|
|
4666
|
+
safeParse(data, params) {
|
|
4667
|
+
return safeParse(this, data, params);
|
|
4668
|
+
},
|
|
4669
|
+
async safeParseAsync(data, params) {
|
|
4670
|
+
return safeParseAsync(this, data, params);
|
|
4671
|
+
},
|
|
4672
|
+
get spa() {
|
|
4673
|
+
return this?.safeParseAsync;
|
|
4674
|
+
},
|
|
4675
|
+
set spa(value) {
|
|
4676
|
+
own(this, "spa", value);
|
|
4677
|
+
},
|
|
4678
|
+
encode: function _encode(data, params) {
|
|
4679
|
+
return encode(this, data, params, { callee: _encode });
|
|
4680
|
+
},
|
|
4681
|
+
decode: function _decode(data, params) {
|
|
4682
|
+
return decode(this, data, params, { callee: _decode });
|
|
4683
|
+
},
|
|
4684
|
+
encodeAsync: async function _encodeAsync(data, params) {
|
|
4685
|
+
return await encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
4686
|
+
},
|
|
4687
|
+
decodeAsync: async function _decodeAsync(data, params) {
|
|
4688
|
+
return await decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
4689
|
+
},
|
|
4690
|
+
safeEncode(data, params) {
|
|
4691
|
+
return safeEncode(this, data, params);
|
|
4692
|
+
},
|
|
4693
|
+
safeDecode(data, params) {
|
|
4694
|
+
return safeDecode(this, data, params);
|
|
4695
|
+
},
|
|
4696
|
+
async safeEncodeAsync(data, params) {
|
|
4697
|
+
return safeEncodeAsync(this, data, params);
|
|
4698
|
+
},
|
|
4699
|
+
async safeDecodeAsync(data, params) {
|
|
4700
|
+
return safeDecodeAsync(this, data, params);
|
|
4701
|
+
},
|
|
4702
|
+
toJSONSchema(params) {
|
|
4703
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
4704
|
+
},
|
|
4705
|
+
get description() {
|
|
4706
|
+
return globalRegistry.get(this)?.description;
|
|
4707
|
+
},
|
|
4708
|
+
get _def() {
|
|
4709
|
+
return this._zod.def;
|
|
4710
|
+
}
|
|
3697
4711
|
});
|
|
3698
4712
|
/** @internal */
|
|
3699
4713
|
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
@@ -3704,84 +4718,135 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3704
4718
|
inst.format = bag.format ?? null;
|
|
3705
4719
|
inst.minLength = bag.minimum ?? null;
|
|
3706
4720
|
inst.maxLength = bag.maximum ?? null;
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
});
|
|
4721
|
+
}, {
|
|
4722
|
+
regex(...args) {
|
|
4723
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
4724
|
+
},
|
|
4725
|
+
includes(...args) {
|
|
4726
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
4727
|
+
},
|
|
4728
|
+
startsWith(...args) {
|
|
4729
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
4730
|
+
},
|
|
4731
|
+
endsWith(...args) {
|
|
4732
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
4733
|
+
},
|
|
4734
|
+
min(...args) {
|
|
4735
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
4736
|
+
},
|
|
4737
|
+
max(...args) {
|
|
4738
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
4739
|
+
},
|
|
4740
|
+
length(...args) {
|
|
4741
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
4742
|
+
},
|
|
4743
|
+
nonempty(...args) {
|
|
4744
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
4745
|
+
},
|
|
4746
|
+
lowercase(params) {
|
|
4747
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
4748
|
+
},
|
|
4749
|
+
uppercase(params) {
|
|
4750
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
4751
|
+
},
|
|
4752
|
+
trim() {
|
|
4753
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
4754
|
+
},
|
|
4755
|
+
normalize(...args) {
|
|
4756
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
4757
|
+
},
|
|
4758
|
+
toLowerCase() {
|
|
4759
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
4760
|
+
},
|
|
4761
|
+
toUpperCase() {
|
|
4762
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
4763
|
+
},
|
|
4764
|
+
slugify() {
|
|
4765
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
4766
|
+
}
|
|
3754
4767
|
});
|
|
3755
4768
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
3756
4769
|
$ZodString.init(inst, def);
|
|
3757
4770
|
_ZodString.init(inst, def);
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
4771
|
+
}, {
|
|
4772
|
+
email(params) {
|
|
4773
|
+
return this.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
4774
|
+
},
|
|
4775
|
+
url(params) {
|
|
4776
|
+
return this.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
4777
|
+
},
|
|
4778
|
+
jwt(params) {
|
|
4779
|
+
return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
4780
|
+
},
|
|
4781
|
+
emoji(params) {
|
|
4782
|
+
return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
4783
|
+
},
|
|
4784
|
+
guid(params) {
|
|
4785
|
+
return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
4786
|
+
},
|
|
4787
|
+
uuid(params) {
|
|
4788
|
+
return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
4789
|
+
},
|
|
4790
|
+
uuidv4(params) {
|
|
4791
|
+
return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
4792
|
+
},
|
|
4793
|
+
uuidv6(params) {
|
|
4794
|
+
return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
4795
|
+
},
|
|
4796
|
+
uuidv7(params) {
|
|
4797
|
+
return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
4798
|
+
},
|
|
4799
|
+
nanoid(params) {
|
|
4800
|
+
return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
4801
|
+
},
|
|
4802
|
+
cuid(params) {
|
|
4803
|
+
return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
4804
|
+
},
|
|
4805
|
+
cuid2(params) {
|
|
4806
|
+
return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
4807
|
+
},
|
|
4808
|
+
ulid(params) {
|
|
4809
|
+
return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
4810
|
+
},
|
|
4811
|
+
base64(params) {
|
|
4812
|
+
return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
4813
|
+
},
|
|
4814
|
+
base64url(params) {
|
|
4815
|
+
return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
4816
|
+
},
|
|
4817
|
+
xid(params) {
|
|
4818
|
+
return this.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
4819
|
+
},
|
|
4820
|
+
ksuid(params) {
|
|
4821
|
+
return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
4822
|
+
},
|
|
4823
|
+
ipv4(params) {
|
|
4824
|
+
return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
4825
|
+
},
|
|
4826
|
+
ipv6(params) {
|
|
4827
|
+
return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
4828
|
+
},
|
|
4829
|
+
cidrv4(params) {
|
|
4830
|
+
return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
4831
|
+
},
|
|
4832
|
+
cidrv6(params) {
|
|
4833
|
+
return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
4834
|
+
},
|
|
4835
|
+
e164(params) {
|
|
4836
|
+
return this.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
4837
|
+
},
|
|
4838
|
+
datetime(params) {
|
|
4839
|
+
return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
|
|
4840
|
+
},
|
|
4841
|
+
date(params) {
|
|
4842
|
+
return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
|
|
4843
|
+
},
|
|
4844
|
+
time(params) {
|
|
4845
|
+
return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
|
|
4846
|
+
},
|
|
4847
|
+
duration(params) {
|
|
4848
|
+
return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
|
|
4849
|
+
}
|
|
3785
4850
|
});
|
|
3786
4851
|
function string(params) {
|
|
3787
4852
|
return /* @__PURE__ */ _string(ZodString, params);
|
|
@@ -3790,6 +4855,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3790
4855
|
$ZodStringFormat.init(inst, def);
|
|
3791
4856
|
_ZodString.init(inst, def);
|
|
3792
4857
|
});
|
|
4858
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
4859
|
+
$ZodISODateTime.init(inst, def);
|
|
4860
|
+
ZodStringFormat.init(inst, def);
|
|
4861
|
+
});
|
|
4862
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
4863
|
+
$ZodISODate.init(inst, def);
|
|
4864
|
+
ZodStringFormat.init(inst, def);
|
|
4865
|
+
});
|
|
4866
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
4867
|
+
$ZodISOTime.init(inst, def);
|
|
4868
|
+
ZodStringFormat.init(inst, def);
|
|
4869
|
+
});
|
|
4870
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
4871
|
+
$ZodISODuration.init(inst, def);
|
|
4872
|
+
ZodStringFormat.init(inst, def);
|
|
4873
|
+
});
|
|
3793
4874
|
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
3794
4875
|
$ZodEmail.init(inst, def);
|
|
3795
4876
|
ZodStringFormat.init(inst, def);
|
|
@@ -3875,59 +4956,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3875
4956
|
$ZodNumber.init(inst, def);
|
|
3876
4957
|
ZodType.init(inst, def);
|
|
3877
4958
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3878
|
-
_installLazyMethods(inst, "ZodNumber", {
|
|
3879
|
-
gt(value, params) {
|
|
3880
|
-
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
3881
|
-
},
|
|
3882
|
-
gte(value, params) {
|
|
3883
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3884
|
-
},
|
|
3885
|
-
min(value, params) {
|
|
3886
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3887
|
-
},
|
|
3888
|
-
lt(value, params) {
|
|
3889
|
-
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
3890
|
-
},
|
|
3891
|
-
lte(value, params) {
|
|
3892
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3893
|
-
},
|
|
3894
|
-
max(value, params) {
|
|
3895
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3896
|
-
},
|
|
3897
|
-
int(params) {
|
|
3898
|
-
return this.check(int(params));
|
|
3899
|
-
},
|
|
3900
|
-
safe(params) {
|
|
3901
|
-
return this.check(int(params));
|
|
3902
|
-
},
|
|
3903
|
-
positive(params) {
|
|
3904
|
-
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
3905
|
-
},
|
|
3906
|
-
nonnegative(params) {
|
|
3907
|
-
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
3908
|
-
},
|
|
3909
|
-
negative(params) {
|
|
3910
|
-
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
3911
|
-
},
|
|
3912
|
-
nonpositive(params) {
|
|
3913
|
-
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
3914
|
-
},
|
|
3915
|
-
multipleOf(value, params) {
|
|
3916
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3917
|
-
},
|
|
3918
|
-
step(value, params) {
|
|
3919
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3920
|
-
},
|
|
3921
|
-
finite() {
|
|
3922
|
-
return this;
|
|
3923
|
-
}
|
|
3924
|
-
});
|
|
3925
4959
|
const bag = inst._zod.bag;
|
|
3926
4960
|
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3927
4961
|
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3928
4962
|
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
3929
4963
|
inst.isFinite = true;
|
|
3930
4964
|
inst.format = bag.format ?? null;
|
|
4965
|
+
}, {
|
|
4966
|
+
gt(value, params) {
|
|
4967
|
+
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
4968
|
+
},
|
|
4969
|
+
gte(value, params) {
|
|
4970
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4971
|
+
},
|
|
4972
|
+
min(value, params) {
|
|
4973
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
4974
|
+
},
|
|
4975
|
+
lt(value, params) {
|
|
4976
|
+
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
4977
|
+
},
|
|
4978
|
+
lte(value, params) {
|
|
4979
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4980
|
+
},
|
|
4981
|
+
max(value, params) {
|
|
4982
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
4983
|
+
},
|
|
4984
|
+
int(params) {
|
|
4985
|
+
return this.check(int(params));
|
|
4986
|
+
},
|
|
4987
|
+
safe(params) {
|
|
4988
|
+
return this.check(int(params));
|
|
4989
|
+
},
|
|
4990
|
+
positive(params) {
|
|
4991
|
+
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
4992
|
+
},
|
|
4993
|
+
nonnegative(params) {
|
|
4994
|
+
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
4995
|
+
},
|
|
4996
|
+
negative(params) {
|
|
4997
|
+
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
4998
|
+
},
|
|
4999
|
+
nonpositive(params) {
|
|
5000
|
+
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
5001
|
+
},
|
|
5002
|
+
multipleOf(value, params) {
|
|
5003
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
5004
|
+
},
|
|
5005
|
+
step(value, params) {
|
|
5006
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
5007
|
+
},
|
|
5008
|
+
finite() {
|
|
5009
|
+
return this;
|
|
5010
|
+
}
|
|
3931
5011
|
});
|
|
3932
5012
|
function number(params) {
|
|
3933
5013
|
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
@@ -3972,94 +5052,95 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3972
5052
|
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3973
5053
|
}
|
|
3974
5054
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
5055
|
+
_ensureDefaultMemoizer();
|
|
3975
5056
|
$ZodArray.init(inst, def);
|
|
3976
5057
|
ZodType.init(inst, def);
|
|
3977
5058
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3978
5059
|
inst.element = def.element;
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
});
|
|
5060
|
+
}, {
|
|
5061
|
+
min(n, params) {
|
|
5062
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
5063
|
+
},
|
|
5064
|
+
nonempty(params) {
|
|
5065
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
5066
|
+
},
|
|
5067
|
+
max(n, params) {
|
|
5068
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
5069
|
+
},
|
|
5070
|
+
length(n, params) {
|
|
5071
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
5072
|
+
},
|
|
5073
|
+
unwrap() {
|
|
5074
|
+
return this.element;
|
|
5075
|
+
}
|
|
3996
5076
|
});
|
|
3997
5077
|
function array(element, params) {
|
|
3998
5078
|
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
3999
5079
|
}
|
|
4000
5080
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
5081
|
+
_ensureDefaultMemoizer();
|
|
4001
5082
|
$ZodObjectJIT.init(inst, def);
|
|
4002
5083
|
ZodType.init(inst, def);
|
|
4003
5084
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
}
|
|
5085
|
+
installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
5086
|
+
}, {
|
|
5087
|
+
keyof() {
|
|
5088
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
5089
|
+
},
|
|
5090
|
+
catchall(catchall) {
|
|
5091
|
+
return this.clone({
|
|
5092
|
+
...this._zod.def,
|
|
5093
|
+
catchall
|
|
5094
|
+
});
|
|
5095
|
+
},
|
|
5096
|
+
passthrough() {
|
|
5097
|
+
return this.clone({
|
|
5098
|
+
...this._zod.def,
|
|
5099
|
+
catchall: unknown()
|
|
5100
|
+
});
|
|
5101
|
+
},
|
|
5102
|
+
loose() {
|
|
5103
|
+
return this.clone({
|
|
5104
|
+
...this._zod.def,
|
|
5105
|
+
catchall: unknown()
|
|
5106
|
+
});
|
|
5107
|
+
},
|
|
5108
|
+
strict() {
|
|
5109
|
+
return this.clone({
|
|
5110
|
+
...this._zod.def,
|
|
5111
|
+
catchall: never()
|
|
5112
|
+
});
|
|
5113
|
+
},
|
|
5114
|
+
strip() {
|
|
5115
|
+
return this.clone({
|
|
5116
|
+
...this._zod.def,
|
|
5117
|
+
catchall: void 0
|
|
5118
|
+
});
|
|
5119
|
+
},
|
|
5120
|
+
extend(incoming) {
|
|
5121
|
+
return extend(this, incoming);
|
|
5122
|
+
},
|
|
5123
|
+
safeExtend(incoming) {
|
|
5124
|
+
return safeExtend(this, incoming);
|
|
5125
|
+
},
|
|
5126
|
+
merge(other) {
|
|
5127
|
+
return merge(this, other);
|
|
5128
|
+
},
|
|
5129
|
+
pick(mask) {
|
|
5130
|
+
return pick(this, mask);
|
|
5131
|
+
},
|
|
5132
|
+
omit(mask) {
|
|
5133
|
+
return omit(this, mask);
|
|
5134
|
+
},
|
|
5135
|
+
partial(...args) {
|
|
5136
|
+
return partial(ZodOptional, this, args[0]);
|
|
5137
|
+
},
|
|
5138
|
+
exactPartial(...args) {
|
|
5139
|
+
return partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
5140
|
+
},
|
|
5141
|
+
required(...args) {
|
|
5142
|
+
return required(ZodNonOptional, this, args[0]);
|
|
5143
|
+
}
|
|
4063
5144
|
});
|
|
4064
5145
|
function object(shape, params) {
|
|
4065
5146
|
const def = {
|
|
@@ -4107,6 +5188,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4107
5188
|
});
|
|
4108
5189
|
}
|
|
4109
5190
|
const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
|
|
5191
|
+
_ensureDefaultMemoizer();
|
|
4110
5192
|
$ZodRecord.init(inst, def);
|
|
4111
5193
|
ZodType.init(inst, def);
|
|
4112
5194
|
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
@@ -4183,6 +5265,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4183
5265
|
});
|
|
4184
5266
|
}
|
|
4185
5267
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
5268
|
+
_ensureDefaultMemoizer();
|
|
4186
5269
|
$ZodTransform.init(inst, def);
|
|
4187
5270
|
ZodType.init(inst, def);
|
|
4188
5271
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -4194,7 +5277,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4194
5277
|
const _issue = issue$1;
|
|
4195
5278
|
if (_issue.fatal) _issue.continue = false;
|
|
4196
5279
|
_issue.code ?? (_issue.code = "custom");
|
|
4197
|
-
|
|
5280
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
4198
5281
|
_issue.inst ?? (_issue.inst = inst);
|
|
4199
5282
|
payload.issues.push(issue(_issue));
|
|
4200
5283
|
}
|
|
@@ -4202,11 +5285,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4202
5285
|
const output = def.transform(payload.value, payload);
|
|
4203
5286
|
if (output instanceof Promise) return output.then((output) => {
|
|
4204
5287
|
payload.value = output;
|
|
4205
|
-
payload.fallback = true;
|
|
4206
5288
|
return payload;
|
|
4207
5289
|
});
|
|
4208
5290
|
payload.value = output;
|
|
4209
|
-
payload.fallback = true;
|
|
4210
5291
|
return payload;
|
|
4211
5292
|
};
|
|
4212
5293
|
});
|
|
@@ -4307,7 +5388,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4307
5388
|
return new ZodCatch({
|
|
4308
5389
|
type: "catch",
|
|
4309
5390
|
innerType,
|
|
4310
|
-
catchValue: typeof catchValue === "function" ? catchValue : ()
|
|
5391
|
+
catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
|
|
4311
5392
|
});
|
|
4312
5393
|
}
|
|
4313
5394
|
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
@@ -4440,14 +5521,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4440
5521
|
codec: {
|
|
4441
5522
|
mode: "strict",
|
|
4442
5523
|
typeSymbol: method === "query" ? "Run2skillQueryRequest" : "Run2skillCommandRequest",
|
|
4443
|
-
|
|
5524
|
+
create: () => requestSchema
|
|
4444
5525
|
}
|
|
4445
5526
|
}],
|
|
4446
5527
|
cancellation: { parameter: "signal" },
|
|
4447
5528
|
result: {
|
|
4448
5529
|
mode: "strict",
|
|
4449
5530
|
typeSymbol: "Run2skillRpcResult",
|
|
4450
|
-
|
|
5531
|
+
create: () => rpcResult
|
|
4451
5532
|
}
|
|
4452
5533
|
};
|
|
4453
5534
|
return Object.freeze(value);
|
|
@@ -4547,50 +5628,50 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4547
5628
|
}
|
|
4548
5629
|
//#endregion
|
|
4549
5630
|
//#region \0run2skill-css:run2skill-settings-page.module.css.mjs
|
|
4550
|
-
const css = ".
|
|
5631
|
+
const css = ".run2skill_page_7hKdxq{width:min(100%,1040px);color:var(--dsw-alias-label-primary);gap:24px;padding:16px 0 48px;display:grid}.run2skill_intro_7hKdxq,.run2skill_muted_7hKdxq{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:1.5}.run2skill_section_7hKdxq{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);box-shadow:0 1px 2px var(--dsw-alias-border-l1);border-radius:16px;overflow:hidden}.run2skill_sectionHeader_7hKdxq{box-sizing:border-box;height:auto;min-height:56px;padding:14px 20px}.run2skill_sectionTitle_7hKdxq{font-size:15px}.run2skill_sectionBody_7hKdxq{gap:18px;padding:12px 24px 24px 56px;display:grid;container-type:inline-size}.run2skill_attentionGroup_7hKdxq{gap:16px;min-width:0;display:grid}.run2skill_empty_7hKdxq{min-height:56px;color:var(--dsw-alias-label-secondary);place-items:center;margin:0;font-size:13px;display:grid}.run2skill_toolbar_7hKdxq,.run2skill_actions_7hKdxq,.run2skill_modeGroup_7hKdxq{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.run2skill_learningStatusRow_7hKdxq{justify-content:space-between;align-items:center;gap:16px;min-width:0;display:flex}.run2skill_learningStatusRow_7hKdxq>:first-child{overflow-wrap:anywhere;min-width:0}@container (width<=30rem){.run2skill_learningStatusRow_7hKdxq{flex-direction:column;align-items:stretch}.run2skill_learningStatusRow_7hKdxq .run2skill_actions_7hKdxq{flex-direction:column;align-items:stretch;width:100%}.run2skill_learningStatusRow_7hKdxq .run2skill_actions_7hKdxq>*{box-sizing:border-box;white-space:normal;overflow-wrap:anywhere;flex:none;width:100%;min-width:0;max-width:100%;height:auto}}.run2skill_attentionList_7hKdxq,.run2skill_proposalList_7hKdxq,.run2skill_activityList_7hKdxq{gap:8px;margin:0;padding:0;list-style:none;display:grid}.run2skill_activityItem_7hKdxq{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;display:flex}.run2skill_activitySummary_7hKdxq{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.run2skill_proposalToolbar_7hKdxq{grid-template-columns:minmax(12rem,1fr) auto;align-items:center;gap:8px;display:grid}.run2skill_proposalToolbar_7hKdxq>:first-child{width:100%}.run2skill_proposalToolbarCompact_7hKdxq{justify-content:flex-end;display:flex}.run2skill_proposalToolbarCompact_7hKdxq>:first-child{width:auto}.run2skill_proposalLayout_7hKdxq{grid-template-columns:1fr;gap:12px;display:grid}.run2skill_proposalListButton_7hKdxq{text-align:start;white-space:normal;overflow-wrap:anywhere;border-radius:10px;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:2px;width:100%;height:auto;min-height:48px;padding:8px 12px}.run2skill_proposalListButton_7hKdxq[aria-current=true]{border-color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary);box-shadow:inset 3px 0 var(--dsw-alias-brand-primary)}.run2skill_proposalName_7hKdxq{max-width:100%;font-size:14px;font-weight:600;line-height:20px}.run2skill_proposalMeta_7hKdxq{max-width:100%;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.run2skill_detail_7hKdxq{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;min-width:0;max-height:640px;padding:18px;overflow:auto}.run2skill_detail_7hKdxq>:first-child{margin-top:0}.run2skill_detailFacts_7hKdxq{grid-template-columns:minmax(6rem,max-content) minmax(0,1fr);gap:8px 16px;margin:0 0 20px;display:grid}.run2skill_detailFacts_7hKdxq dt{color:var(--dsw-alias-label-secondary);font-size:13px}.run2skill_detailFacts_7hKdxq dd{overflow-wrap:anywhere;min-width:0;margin:0}.run2skill_detail_7hKdxq pre{white-space:pre-wrap;unicode-bidi:isolate;overflow:auto}.run2skill_technicalDetails_7hKdxq{border:1px solid var(--dsw-alias-border-l2);border-radius:8px;margin:16px 0;padding:10px 12px}.run2skill_technicalDetails_7hKdxq summary{cursor:pointer;color:var(--dsw-alias-label-secondary);font-size:13px}.run2skill_technicalDetails_7hKdxq[open] summary{margin-bottom:12px}.run2skill_status_7hKdxq{min-height:20px;margin:0;font-size:13px}.run2skill_revisionBox_7hKdxq{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:12px;gap:8px;margin:18px 0;padding:14px;display:grid}.run2skill_revisionBox_7hKdxq label{font-size:14px;font-weight:600}.run2skill_revisionBox_7hKdxq textarea{box-sizing:border-box;resize:vertical;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);width:100%;min-height:84px;color:var(--dsw-alias-label-primary);font:inherit;border-radius:10px;padding:10px 12px;line-height:1.5}.run2skill_revisionBox_7hKdxq textarea:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.run2skill_revisionBox_7hKdxq textarea:disabled{cursor:not-allowed;opacity:.65}.run2skill_revisionBox_7hKdxq>:last-child{justify-self:start}.run2skill_danger_7hKdxq{color:var(--dsw-alias-state-error-primary)}.run2skill_backdrop_7hKdxq,.run2skill_rejectOverlay_7hKdxq{background:var(--dsw-alias-bg-mask-1);position:fixed;inset:0}.run2skill_backdrop_7hKdxq{z-index:999}.run2skill_rejectOverlay_7hKdxq{z-index:1001;place-items:center;padding:16px;display:grid}.run2skill_legacyDialog_7hKdxq{z-index:1000;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:0 16px 48px var(--dsw-alias-bg-mask-1);border-radius:16px;grid-template-columns:minmax(16rem,24rem) minmax(0,1fr);gap:16px;padding:16px;display:grid;position:fixed;inset:5vh 5vw;overflow:hidden}.run2skill_blocked_7hKdxq{pointer-events:none;display:contents}.run2skill_queue_7hKdxq,.run2skill_legacyDetail_7hKdxq{min-width:0;overflow:auto}.run2skill_legacyHeader_7hKdxq{justify-content:space-between;align-items:center;gap:8px;display:flex}.run2skill_legacyList_7hKdxq{margin:0;padding:0;list-style:none}.run2skill_rejectCard_7hKdxq{background:var(--dsw-alias-bg-layer-1);border-radius:16px;max-width:32rem;padding:16px}.run2skill_textBlock_7hKdxq{white-space:pre-wrap;overflow-wrap:anywhere;unicode-bidi:isolate;overflow:auto}.run2skill_previewFacts_7hKdxq{grid-template-columns:max-content 1fr;gap:6px 12px;display:grid}.run2skill_previewFacts_7hKdxq dt,.run2skill_previewFacts_7hKdxq dd{margin:0}@container (width>=760px){.run2skill_proposalLayout_7hKdxq{grid-template-columns:minmax(240px,.8fr) minmax(0,1.6fr);gap:20px}}@container (width<=420px){.run2skill_proposalToolbar_7hKdxq,.run2skill_detailFacts_7hKdxq{grid-template-columns:1fr}.run2skill_proposalToolbar_7hKdxq>:last-child{justify-self:start}.run2skill_detailFacts_7hKdxq dt:not(:first-child){margin-top:8px}}@media (width<=720px){.run2skill_sectionBody_7hKdxq{padding:8px 18px 20px}.run2skill_activityItem_7hKdxq{flex-direction:column;align-items:flex-start}}";
|
|
4551
5632
|
if (typeof document !== "undefined") upsertRun2skillStyle(css);
|
|
4552
5633
|
var _run2skill_css_run2skill_settings_page_module_css_default = {
|
|
4553
|
-
"
|
|
4554
|
-
"
|
|
4555
|
-
"
|
|
4556
|
-
"
|
|
4557
|
-
"
|
|
4558
|
-
"rejectOverlay": "
|
|
4559
|
-
"
|
|
4560
|
-
"
|
|
4561
|
-
"
|
|
4562
|
-
"revisionBox": "
|
|
4563
|
-
"
|
|
4564
|
-
"
|
|
4565
|
-
"
|
|
4566
|
-
"
|
|
4567
|
-
"
|
|
4568
|
-
"
|
|
4569
|
-
"
|
|
4570
|
-
"
|
|
4571
|
-
"
|
|
4572
|
-
"
|
|
4573
|
-
"
|
|
4574
|
-
"
|
|
4575
|
-
"
|
|
4576
|
-
"
|
|
4577
|
-
"
|
|
4578
|
-
"
|
|
4579
|
-
"
|
|
4580
|
-
"
|
|
4581
|
-
"
|
|
4582
|
-
"
|
|
4583
|
-
"
|
|
4584
|
-
"
|
|
4585
|
-
"
|
|
4586
|
-
"
|
|
4587
|
-
"
|
|
4588
|
-
"
|
|
4589
|
-
"
|
|
4590
|
-
"
|
|
4591
|
-
"
|
|
4592
|
-
"
|
|
4593
|
-
"
|
|
5634
|
+
"intro": "run2skill_intro_7hKdxq",
|
|
5635
|
+
"sectionTitle": "run2skill_sectionTitle_7hKdxq",
|
|
5636
|
+
"page": "run2skill_page_7hKdxq",
|
|
5637
|
+
"proposalToolbarCompact": "run2skill_proposalToolbarCompact_7hKdxq",
|
|
5638
|
+
"toolbar": "run2skill_toolbar_7hKdxq",
|
|
5639
|
+
"rejectOverlay": "run2skill_rejectOverlay_7hKdxq",
|
|
5640
|
+
"previewFacts": "run2skill_previewFacts_7hKdxq",
|
|
5641
|
+
"empty": "run2skill_empty_7hKdxq",
|
|
5642
|
+
"technicalDetails": "run2skill_technicalDetails_7hKdxq",
|
|
5643
|
+
"revisionBox": "run2skill_revisionBox_7hKdxq",
|
|
5644
|
+
"danger": "run2skill_danger_7hKdxq",
|
|
5645
|
+
"rejectCard": "run2skill_rejectCard_7hKdxq",
|
|
5646
|
+
"learningStatusRow": "run2skill_learningStatusRow_7hKdxq",
|
|
5647
|
+
"detail": "run2skill_detail_7hKdxq",
|
|
5648
|
+
"legacyList": "run2skill_legacyList_7hKdxq",
|
|
5649
|
+
"section": "run2skill_section_7hKdxq",
|
|
5650
|
+
"proposalList": "run2skill_proposalList_7hKdxq",
|
|
5651
|
+
"activitySummary": "run2skill_activitySummary_7hKdxq",
|
|
5652
|
+
"proposalListButton": "run2skill_proposalListButton_7hKdxq",
|
|
5653
|
+
"actions": "run2skill_actions_7hKdxq",
|
|
5654
|
+
"sectionBody": "run2skill_sectionBody_7hKdxq",
|
|
5655
|
+
"modeGroup": "run2skill_modeGroup_7hKdxq",
|
|
5656
|
+
"proposalName": "run2skill_proposalName_7hKdxq",
|
|
5657
|
+
"status": "run2skill_status_7hKdxq",
|
|
5658
|
+
"legacyDialog": "run2skill_legacyDialog_7hKdxq",
|
|
5659
|
+
"detailFacts": "run2skill_detailFacts_7hKdxq",
|
|
5660
|
+
"attentionGroup": "run2skill_attentionGroup_7hKdxq",
|
|
5661
|
+
"blocked": "run2skill_blocked_7hKdxq",
|
|
5662
|
+
"legacyHeader": "run2skill_legacyHeader_7hKdxq",
|
|
5663
|
+
"legacyDetail": "run2skill_legacyDetail_7hKdxq",
|
|
5664
|
+
"sectionHeader": "run2skill_sectionHeader_7hKdxq",
|
|
5665
|
+
"proposalLayout": "run2skill_proposalLayout_7hKdxq",
|
|
5666
|
+
"proposalMeta": "run2skill_proposalMeta_7hKdxq",
|
|
5667
|
+
"backdrop": "run2skill_backdrop_7hKdxq",
|
|
5668
|
+
"textBlock": "run2skill_textBlock_7hKdxq",
|
|
5669
|
+
"muted": "run2skill_muted_7hKdxq",
|
|
5670
|
+
"queue": "run2skill_queue_7hKdxq",
|
|
5671
|
+
"proposalToolbar": "run2skill_proposalToolbar_7hKdxq",
|
|
5672
|
+
"attentionList": "run2skill_attentionList_7hKdxq",
|
|
5673
|
+
"activityList": "run2skill_activityList_7hKdxq",
|
|
5674
|
+
"activityItem": "run2skill_activityItem_7hKdxq"
|
|
4594
5675
|
};
|
|
4595
5676
|
//#endregion
|
|
4596
5677
|
//#region src/client/purge-settings.ts
|
|
@@ -5111,7 +6192,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5111
6192
|
}
|
|
5112
6193
|
}, "取消清理"), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
5113
6194
|
variant: "primary",
|
|
5114
|
-
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
6195
|
+
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutlineMedium),
|
|
5115
6196
|
disabled: props.state.mutationPending,
|
|
5116
6197
|
onClick: () => {
|
|
5117
6198
|
props.controller.confirm();
|
|
@@ -5154,7 +6235,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5154
6235
|
const disabled = state.previewPending || state.mutationPending || active !== void 0 || activeReceipt !== void 0;
|
|
5155
6236
|
return (0, react.createElement)("section", { "aria-labelledby": "run2skill-purge-heading" }, (0, react.createElement)("h3", { id: "run2skill-purge-heading" }, "缓存清理"), (0, react.createElement)("p", null, "清理 Run2Skill 自己产生的中间缓存数据"), (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.actions }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
5156
6237
|
variant: "outline",
|
|
5157
|
-
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
6238
|
+
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutlineMedium),
|
|
5158
6239
|
disabled,
|
|
5159
6240
|
onClick: (event) => {
|
|
5160
6241
|
restoreRef.current = event.currentTarget;
|
|
@@ -5165,7 +6246,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5165
6246
|
"aria-label": "当前数据清理状态"
|
|
5166
6247
|
}, (0, react.createElement)("p", null, phaseCopy[activePhase]), (0, react.createElement)("p", null, `已删除 ${String(active?.deletedWorkItems ?? activeReceipt?.deletedWorkItems ?? 0)} 条待处理数据和 ${String(active?.deletedLineages ?? activeReceipt?.deletedLineages ?? 0)} 条 Skill 关联记录。`), active?.lastError === void 0 ? null : (0, react.createElement)(react.Fragment, null, (0, react.createElement)("p", { role: "alert" }, `清理失败:${active.lastError.code}`), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
5167
6248
|
variant: "outline",
|
|
5168
|
-
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
6249
|
+
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineMedium),
|
|
5169
6250
|
disabled: state.mutationPending,
|
|
5170
6251
|
onClick: () => {
|
|
5171
6252
|
props.controller.retry();
|
|
@@ -5211,9 +6292,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5211
6292
|
this.#error = void 0;
|
|
5212
6293
|
this.#publish();
|
|
5213
6294
|
try {
|
|
5214
|
-
await this.scope.set("automaticLearning", value);
|
|
6295
|
+
const accepted = await this.scope.set("automaticLearning", value);
|
|
5215
6296
|
const after = this.scope.getSnapshot();
|
|
5216
|
-
this.#error = after.status === "ready" && after.value?.automaticLearning === value ? void 0 : "SETTINGS_CHANGED";
|
|
6297
|
+
this.#error = accepted !== false && after.status === "ready" && after.value?.automaticLearning === value ? void 0 : "SETTINGS_CHANGED";
|
|
5217
6298
|
} catch {
|
|
5218
6299
|
this.#error = "SETTINGS_CHANGED";
|
|
5219
6300
|
} finally {
|
|
@@ -5265,7 +6346,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5265
6346
|
}
|
|
5266
6347
|
async function applyAutomaticLearningSettingsClientRemote(context) {
|
|
5267
6348
|
const mounted = await createRun2skillRemoteCaller(context.remote);
|
|
5268
|
-
const controller = new AutomaticLearningSettingsController(context.
|
|
6349
|
+
const controller = new AutomaticLearningSettingsController(context.configForms.get("run2skill"));
|
|
5269
6350
|
const callPurge = mounted.call;
|
|
5270
6351
|
const purgeController = new PurgeSettingsController(callPurge, () => {
|
|
5271
6352
|
return context.workspaces.list.getSnapshot().recentWorkspaceId;
|
|
@@ -5275,9 +6356,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5275
6356
|
controller.dispose();
|
|
5276
6357
|
purgeController.dispose();
|
|
5277
6358
|
}, "run2skill: settings and purge");
|
|
5278
|
-
context.slots.inject("
|
|
5279
|
-
name: "
|
|
5280
|
-
|
|
6359
|
+
context.slots.inject("plugins.item", () => context.slots.register({
|
|
6360
|
+
name: "plugins.item",
|
|
6361
|
+
id: "run2skill",
|
|
5281
6362
|
inject: () => ({
|
|
5282
6363
|
controller,
|
|
5283
6364
|
purgeController
|
|
@@ -6697,7 +7778,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6697
7778
|
setState({ phase: "LOADING" });
|
|
6698
7779
|
setRefreshGeneration((value) => value + 1);
|
|
6699
7780
|
}
|
|
6700
|
-
}, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
7781
|
+
}, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineMedium)))));
|
|
6701
7782
|
}
|
|
6702
7783
|
const recentSkillActivityResultSchema = object({
|
|
6703
7784
|
ok: literal(true),
|
|
@@ -7045,7 +8126,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7045
8126
|
if (toast === void 0) return null;
|
|
7046
8127
|
return (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
|
|
7047
8128
|
key: toast.sequence,
|
|
7048
|
-
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
8129
|
+
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineMedium),
|
|
7049
8130
|
text: `Run2Skill 有 ${String(toast.count)} 项需要处理,请前往设置 → 插件 → Run2Skill`,
|
|
7050
8131
|
onDone: () => {
|
|
7051
8132
|
setToast(void 0);
|
|
@@ -7140,7 +8221,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7140
8221
|
}) : null, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
7141
8222
|
variant: "outline",
|
|
7142
8223
|
size: "sm",
|
|
7143
|
-
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
8224
|
+
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineMedium),
|
|
7144
8225
|
onClick: () => {
|
|
7145
8226
|
controller.open();
|
|
7146
8227
|
}
|
|
@@ -7288,7 +8369,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7288
8369
|
}, (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.toolbar }, (0, react.createElement)("strong", null, `自动沉淀未继续 · ${String(learningActions.size)} 项`), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
7289
8370
|
variant: "outline",
|
|
7290
8371
|
size: "sm",
|
|
7291
|
-
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
8372
|
+
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineMedium),
|
|
7292
8373
|
disabled: !props.active || pending !== void 0,
|
|
7293
8374
|
onClick: () => {
|
|
7294
8375
|
setRefreshGeneration((value) => value + 1);
|
|
@@ -7552,7 +8633,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7552
8633
|
ref: hostTab.ref,
|
|
7553
8634
|
className: _run2skill_css_run2skill_settings_page_module_css_default.page,
|
|
7554
8635
|
"data-run2skill-settings-page": true
|
|
7555
|
-
}, (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.intro }, "Run2Skill 在后台自动沉淀经验;这里展示当前状态、需要处理的事项和持久设置。"), props.callLearningStatus === void 0 ? null : disclosure("status", "整理状态", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
8636
|
+
}, (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.intro }, "Run2Skill 在后台自动沉淀经验;这里展示当前状态、需要处理的事项和持久设置。"), props.callLearningStatus === void 0 ? null : disclosure("status", "整理状态", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconSparkleMedium), (0, react.createElement)(LearningStatusSection, {
|
|
7556
8637
|
key: JSON.stringify([
|
|
7557
8638
|
sessionId ?? null,
|
|
7558
8639
|
workspaceId ?? null,
|
|
@@ -7564,7 +8645,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7564
8645
|
scopeGeneration,
|
|
7565
8646
|
active: hostTab.visible && open.has("status") && !purgeDataChanging,
|
|
7566
8647
|
call: props.callLearningStatus
|
|
7567
|
-
})), disclosure("attention", "需要处理", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
8648
|
+
})), disclosure("attention", "需要处理", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineMedium), (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.sectionBody }, (0, react.createElement)(AttentionSettingsSummary, {
|
|
7568
8649
|
active: hostTab.visible && open.has("attention"),
|
|
7569
8650
|
...sessionId === void 0 ? {} : { sessionId },
|
|
7570
8651
|
...workspaceId === void 0 ? {} : { workspaceId },
|
|
@@ -7593,7 +8674,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7593
8674
|
setAttentionRefresh((value) => value + 1);
|
|
7594
8675
|
},
|
|
7595
8676
|
scopeGeneration
|
|
7596
|
-
}), attentionEmpty ? (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.empty }, "暂无") : null)), disclosure("activity", "最近活动", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
8677
|
+
}), attentionEmpty ? (0, react.createElement)("p", { className: _run2skill_css_run2skill_settings_page_module_css_default.empty }, "暂无") : null)), disclosure("activity", "最近活动", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconSparkleMedium), (0, react.createElement)(RecentSkillActivitySection, {
|
|
7597
8678
|
key: JSON.stringify([
|
|
7598
8679
|
workspaceId ?? null,
|
|
7599
8680
|
scopeGeneration,
|
|
@@ -7605,7 +8686,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7605
8686
|
active: hostTab.visible && open.has("activity") && !purgeDataChanging,
|
|
7606
8687
|
scopeGeneration,
|
|
7607
8688
|
hostDataEpoch: purgeState.hostDataEpoch
|
|
7608
|
-
}), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, "最近 7 天")), disclosure("automatic", "自动学习", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.
|
|
8689
|
+
}), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Pill, null, "最近 7 天")), disclosure("automatic", "自动学习", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconSettingsOutlineMedium), (0, react.createElement)(AutomaticLearningSection, { controller: props.controller })), disclosure("purge", "缓存清理", (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutlineMedium), (0, react.createElement)("div", { className: _run2skill_css_run2skill_settings_page_module_css_default.sectionBody }, (0, react.createElement)(PurgeSettingsSection, {
|
|
7609
8690
|
controller: props.purgeController,
|
|
7610
8691
|
active: hostTab.visible && open.has("purge"),
|
|
7611
8692
|
onCompleted: () => {
|
|
@@ -7622,7 +8703,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7622
8703
|
}
|
|
7623
8704
|
async function applyRun2skillClient(context) {
|
|
7624
8705
|
const mounted = await createRun2skillRemoteCaller(context.remote);
|
|
7625
|
-
const controller = new AutomaticLearningSettingsController(context.
|
|
8706
|
+
const controller = new AutomaticLearningSettingsController(context.configForms.get("run2skill"));
|
|
7626
8707
|
const callReview = mounted.call;
|
|
7627
8708
|
const callAttention = async (payload, signal) => await mounted.call("attention", payload, signal);
|
|
7628
8709
|
const callActivity = async (payload, signal) => await mounted.call("recent-activity/list", payload, signal);
|
|
@@ -7834,7 +8915,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7834
8915
|
"workspaces",
|
|
7835
8916
|
"sessions",
|
|
7836
8917
|
"remote",
|
|
7837
|
-
"
|
|
8918
|
+
"configForms"
|
|
7838
8919
|
];
|
|
7839
8920
|
async function apply(context) {
|
|
7840
8921
|
return await applyRun2skillClient(context);
|