sculpted 0.3.3 → 0.3.5
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/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{patcher-nj9VhRT-.mjs → patcher-q1Cc_E8H.mjs} +2 -2
- package/dist/{runtime-Cpxddehp.d.mts → runtime-BA5TGbfx.d.mts} +1 -1
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +4669 -178
- package/dist/{sourceSyntax-DKIh-VKA.d.mts → sourceSyntax-CLM3knfR.d.mts} +1 -1
- package/dist/tsrx.d.mts +1 -1
- package/dist/{types-0a4hNfAF.d.mts → types-1F2MUOXh.d.mts} +2 -1
- package/dist/ui.d.mts +2 -2
- package/dist/ui.mjs +3777 -2070
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +61 -2
- package/docs/vite-plugin.md +11 -2
- package/examples/vite-preact-pandacss/package.json +1 -1
- package/examples/vite-preact-pandacss/postcss.config.cjs +2 -2
- package/examples/vite-preact-pandacss/src/index.css +6 -1
- package/examples/vite-preact-pandacss/vite.config.ts +5 -5
- package/examples/vite-react-pandacss/package.json +1 -1
- package/examples/vite-react-pandacss/src/index.css +6 -1
- package/package.json +18 -18
package/dist/runtime.mjs
CHANGED
|
@@ -1,25 +1,4493 @@
|
|
|
1
1
|
import { _ as markerClassForEditId, g as editIdsFromMarkerClassList, r as DEFAULT_EDIT_ID_ATTRIBUTE } from "./protocol-D5heR2QM.mjs";
|
|
2
|
-
|
|
2
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
3
|
+
var _a$1;
|
|
4
|
+
function $constructor(name, initializer, params) {
|
|
5
|
+
function init(inst, def) {
|
|
6
|
+
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
7
|
+
value: {
|
|
8
|
+
def,
|
|
9
|
+
constr: _,
|
|
10
|
+
traits: /* @__PURE__ */ new Set()
|
|
11
|
+
},
|
|
12
|
+
enumerable: false
|
|
13
|
+
});
|
|
14
|
+
if (inst._zod.traits.has(name)) return;
|
|
15
|
+
inst._zod.traits.add(name);
|
|
16
|
+
initializer(inst, def);
|
|
17
|
+
const proto = _.prototype;
|
|
18
|
+
const keys = Object.keys(proto);
|
|
19
|
+
for (let i = 0; i < keys.length; i++) {
|
|
20
|
+
const k = keys[i];
|
|
21
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const Parent = params?.Parent ?? Object;
|
|
25
|
+
class Definition extends Parent {}
|
|
26
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
27
|
+
function _(def) {
|
|
28
|
+
var _a;
|
|
29
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
30
|
+
init(inst, def);
|
|
31
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
32
|
+
for (const fn of inst._zod.deferred) fn();
|
|
33
|
+
return inst;
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(_, "init", { value: init });
|
|
36
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
37
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
38
|
+
return inst?._zod?.traits?.has(name);
|
|
39
|
+
} });
|
|
40
|
+
Object.defineProperty(_, "name", { value: name });
|
|
41
|
+
return _;
|
|
42
|
+
}
|
|
43
|
+
var $ZodAsyncError = class extends Error {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var $ZodEncodeError = class extends Error {
|
|
49
|
+
constructor(name) {
|
|
50
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
51
|
+
this.name = "ZodEncodeError";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
55
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
56
|
+
function config(newConfig) {
|
|
57
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
58
|
+
return globalConfig;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
62
|
+
function getEnumValues(entries) {
|
|
63
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
64
|
+
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
65
|
+
}
|
|
66
|
+
function jsonStringifyReplacer(_, value) {
|
|
67
|
+
if (typeof value === "bigint") return value.toString();
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
function cached(getter) {
|
|
71
|
+
return { get value() {
|
|
72
|
+
{
|
|
73
|
+
const value = getter();
|
|
74
|
+
Object.defineProperty(this, "value", { value });
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
throw new Error("cached value already set");
|
|
78
|
+
} };
|
|
79
|
+
}
|
|
80
|
+
function nullish(input) {
|
|
81
|
+
return input === null || input === void 0;
|
|
82
|
+
}
|
|
83
|
+
function cleanRegex(source) {
|
|
84
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
85
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
86
|
+
return source.slice(start, end);
|
|
87
|
+
}
|
|
88
|
+
function floatSafeRemainder(val, step) {
|
|
89
|
+
const ratio = val / step;
|
|
90
|
+
const roundedRatio = Math.round(ratio);
|
|
91
|
+
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
92
|
+
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
93
|
+
return ratio - roundedRatio;
|
|
94
|
+
}
|
|
95
|
+
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
96
|
+
function defineLazy(object, key, getter) {
|
|
97
|
+
let value = void 0;
|
|
98
|
+
Object.defineProperty(object, key, {
|
|
99
|
+
get() {
|
|
100
|
+
if (value === EVALUATING) return;
|
|
101
|
+
if (value === void 0) {
|
|
102
|
+
value = EVALUATING;
|
|
103
|
+
value = getter();
|
|
104
|
+
}
|
|
105
|
+
return value;
|
|
106
|
+
},
|
|
107
|
+
set(v) {
|
|
108
|
+
Object.defineProperty(object, key, { value: v });
|
|
109
|
+
},
|
|
110
|
+
configurable: true
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function assignProp(target, prop, value) {
|
|
114
|
+
Object.defineProperty(target, prop, {
|
|
115
|
+
value,
|
|
116
|
+
writable: true,
|
|
117
|
+
enumerable: true,
|
|
118
|
+
configurable: true
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function mergeDefs(...defs) {
|
|
122
|
+
const mergedDescriptors = {};
|
|
123
|
+
for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
|
|
124
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
125
|
+
}
|
|
126
|
+
function esc(str) {
|
|
127
|
+
return JSON.stringify(str);
|
|
128
|
+
}
|
|
129
|
+
function slugify(input) {
|
|
130
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
131
|
+
}
|
|
132
|
+
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
133
|
+
function isObject(data) {
|
|
134
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
135
|
+
}
|
|
136
|
+
const allowsEval = /* @__PURE__*/ cached(() => {
|
|
137
|
+
if (globalConfig.jitless) return false;
|
|
138
|
+
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
|
|
139
|
+
try {
|
|
140
|
+
new Function("");
|
|
141
|
+
return true;
|
|
142
|
+
} catch (_) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
function isPlainObject(o) {
|
|
147
|
+
if (isObject(o) === false) return false;
|
|
148
|
+
const ctor = o.constructor;
|
|
149
|
+
if (ctor === void 0) return true;
|
|
150
|
+
if (typeof ctor !== "function") return true;
|
|
151
|
+
const prot = ctor.prototype;
|
|
152
|
+
if (isObject(prot) === false) return false;
|
|
153
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
function shallowClone(o) {
|
|
157
|
+
if (isPlainObject(o)) return { ...o };
|
|
158
|
+
if (Array.isArray(o)) return [...o];
|
|
159
|
+
if (o instanceof Map) return new Map(o);
|
|
160
|
+
if (o instanceof Set) return new Set(o);
|
|
161
|
+
return o;
|
|
162
|
+
}
|
|
163
|
+
const propertyKeyTypes = /* @__PURE__*/ new Set([
|
|
164
|
+
"string",
|
|
165
|
+
"number",
|
|
166
|
+
"symbol"
|
|
167
|
+
]);
|
|
168
|
+
function escapeRegex(str) {
|
|
169
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
170
|
+
}
|
|
171
|
+
function clone(inst, def, params) {
|
|
172
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
173
|
+
if (!def || params?.parent) cl._zod.parent = inst;
|
|
174
|
+
return cl;
|
|
175
|
+
}
|
|
176
|
+
function normalizeParams(_params) {
|
|
177
|
+
const params = _params;
|
|
178
|
+
if (!params) return {};
|
|
179
|
+
if (typeof params === "string") return { error: () => params };
|
|
180
|
+
if (params?.message !== void 0) {
|
|
181
|
+
if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
182
|
+
params.error = params.message;
|
|
183
|
+
}
|
|
184
|
+
delete params.message;
|
|
185
|
+
if (typeof params.error === "string") return {
|
|
186
|
+
...params,
|
|
187
|
+
error: () => params.error
|
|
188
|
+
};
|
|
189
|
+
return params;
|
|
190
|
+
}
|
|
191
|
+
function optionalKeys(shape) {
|
|
192
|
+
return Object.keys(shape).filter((k) => {
|
|
193
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const NUMBER_FORMAT_RANGES = {
|
|
197
|
+
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
198
|
+
int32: [-2147483648, 2147483647],
|
|
199
|
+
uint32: [0, 4294967295],
|
|
200
|
+
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
201
|
+
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
202
|
+
};
|
|
203
|
+
function pick(schema, mask) {
|
|
204
|
+
const currDef = schema._zod.def;
|
|
205
|
+
const checks = currDef.checks;
|
|
206
|
+
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
207
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
208
|
+
get shape() {
|
|
209
|
+
const newShape = {};
|
|
210
|
+
for (const key in mask) {
|
|
211
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
212
|
+
if (!mask[key]) continue;
|
|
213
|
+
newShape[key] = currDef.shape[key];
|
|
214
|
+
}
|
|
215
|
+
assignProp(this, "shape", newShape);
|
|
216
|
+
return newShape;
|
|
217
|
+
},
|
|
218
|
+
checks: []
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
function omit(schema, mask) {
|
|
222
|
+
const currDef = schema._zod.def;
|
|
223
|
+
const checks = currDef.checks;
|
|
224
|
+
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
225
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
226
|
+
get shape() {
|
|
227
|
+
const newShape = { ...schema._zod.def.shape };
|
|
228
|
+
for (const key in mask) {
|
|
229
|
+
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
230
|
+
if (!mask[key]) continue;
|
|
231
|
+
delete newShape[key];
|
|
232
|
+
}
|
|
233
|
+
assignProp(this, "shape", newShape);
|
|
234
|
+
return newShape;
|
|
235
|
+
},
|
|
236
|
+
checks: []
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
function extend(schema, shape) {
|
|
240
|
+
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
241
|
+
const checks = schema._zod.def.checks;
|
|
242
|
+
if (checks && checks.length > 0) {
|
|
243
|
+
const existingShape = schema._zod.def.shape;
|
|
244
|
+
for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
245
|
+
}
|
|
246
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
247
|
+
const _shape = {
|
|
248
|
+
...schema._zod.def.shape,
|
|
249
|
+
...shape
|
|
250
|
+
};
|
|
251
|
+
assignProp(this, "shape", _shape);
|
|
252
|
+
return _shape;
|
|
253
|
+
} }));
|
|
254
|
+
}
|
|
255
|
+
function safeExtend(schema, shape) {
|
|
256
|
+
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
257
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
258
|
+
const _shape = {
|
|
259
|
+
...schema._zod.def.shape,
|
|
260
|
+
...shape
|
|
261
|
+
};
|
|
262
|
+
assignProp(this, "shape", _shape);
|
|
263
|
+
return _shape;
|
|
264
|
+
} }));
|
|
265
|
+
}
|
|
266
|
+
function merge(a, b) {
|
|
267
|
+
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
268
|
+
return clone(a, mergeDefs(a._zod.def, {
|
|
269
|
+
get shape() {
|
|
270
|
+
const _shape = {
|
|
271
|
+
...a._zod.def.shape,
|
|
272
|
+
...b._zod.def.shape
|
|
273
|
+
};
|
|
274
|
+
assignProp(this, "shape", _shape);
|
|
275
|
+
return _shape;
|
|
276
|
+
},
|
|
277
|
+
get catchall() {
|
|
278
|
+
return b._zod.def.catchall;
|
|
279
|
+
},
|
|
280
|
+
checks: b._zod.def.checks ?? []
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
283
|
+
function partial(Class, schema, mask) {
|
|
284
|
+
const checks = schema._zod.def.checks;
|
|
285
|
+
if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
286
|
+
return clone(schema, mergeDefs(schema._zod.def, {
|
|
287
|
+
get shape() {
|
|
288
|
+
const oldShape = schema._zod.def.shape;
|
|
289
|
+
const shape = { ...oldShape };
|
|
290
|
+
if (mask) for (const key in mask) {
|
|
291
|
+
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
292
|
+
if (!mask[key]) continue;
|
|
293
|
+
shape[key] = Class ? new Class({
|
|
294
|
+
type: "optional",
|
|
295
|
+
innerType: oldShape[key]
|
|
296
|
+
}) : oldShape[key];
|
|
297
|
+
}
|
|
298
|
+
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
299
|
+
type: "optional",
|
|
300
|
+
innerType: oldShape[key]
|
|
301
|
+
}) : oldShape[key];
|
|
302
|
+
assignProp(this, "shape", shape);
|
|
303
|
+
return shape;
|
|
304
|
+
},
|
|
305
|
+
checks: []
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
function required(Class, schema, mask) {
|
|
309
|
+
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
310
|
+
const oldShape = schema._zod.def.shape;
|
|
311
|
+
const shape = { ...oldShape };
|
|
312
|
+
if (mask) for (const key in mask) {
|
|
313
|
+
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
314
|
+
if (!mask[key]) continue;
|
|
315
|
+
shape[key] = new Class({
|
|
316
|
+
type: "nonoptional",
|
|
317
|
+
innerType: oldShape[key]
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
else for (const key in oldShape) shape[key] = new Class({
|
|
321
|
+
type: "nonoptional",
|
|
322
|
+
innerType: oldShape[key]
|
|
323
|
+
});
|
|
324
|
+
assignProp(this, "shape", shape);
|
|
325
|
+
return shape;
|
|
326
|
+
} }));
|
|
327
|
+
}
|
|
328
|
+
function aborted(x, startIndex = 0) {
|
|
329
|
+
if (x.aborted === true) return true;
|
|
330
|
+
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
function explicitlyAborted(x, startIndex = 0) {
|
|
334
|
+
if (x.aborted === true) return true;
|
|
335
|
+
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true;
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
function prefixIssues(path, issues) {
|
|
339
|
+
return issues.map((iss) => {
|
|
340
|
+
var _a;
|
|
341
|
+
(_a = iss).path ?? (_a.path = []);
|
|
342
|
+
iss.path.unshift(path);
|
|
343
|
+
return iss;
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
function unwrapMessage(message) {
|
|
347
|
+
return typeof message === "string" ? message : message?.message;
|
|
348
|
+
}
|
|
349
|
+
function finalizeIssue(iss, ctx, config) {
|
|
350
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
351
|
+
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
352
|
+
rest.path ?? (rest.path = []);
|
|
353
|
+
rest.message = message;
|
|
354
|
+
if (ctx?.reportInput) rest.input = _input;
|
|
355
|
+
return rest;
|
|
356
|
+
}
|
|
357
|
+
function getLengthableOrigin(input) {
|
|
358
|
+
if (Array.isArray(input)) return "array";
|
|
359
|
+
if (typeof input === "string") return "string";
|
|
360
|
+
return "unknown";
|
|
361
|
+
}
|
|
362
|
+
function issue(...args) {
|
|
363
|
+
const [iss, input, inst] = args;
|
|
364
|
+
if (typeof iss === "string") return {
|
|
365
|
+
message: iss,
|
|
366
|
+
code: "custom",
|
|
367
|
+
input,
|
|
368
|
+
inst
|
|
369
|
+
};
|
|
370
|
+
return { ...iss };
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
|
|
374
|
+
const initializer$1 = (inst, def) => {
|
|
375
|
+
inst.name = "$ZodError";
|
|
376
|
+
Object.defineProperty(inst, "_zod", {
|
|
377
|
+
value: inst._zod,
|
|
378
|
+
enumerable: false
|
|
379
|
+
});
|
|
380
|
+
Object.defineProperty(inst, "issues", {
|
|
381
|
+
value: def,
|
|
382
|
+
enumerable: false
|
|
383
|
+
});
|
|
384
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
385
|
+
Object.defineProperty(inst, "toString", {
|
|
386
|
+
value: () => inst.message,
|
|
387
|
+
enumerable: false
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
391
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
392
|
+
function flattenError(error, mapper = (issue) => issue.message) {
|
|
393
|
+
const fieldErrors = {};
|
|
394
|
+
const formErrors = [];
|
|
395
|
+
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
396
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
397
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
398
|
+
} else formErrors.push(mapper(sub));
|
|
399
|
+
return {
|
|
400
|
+
formErrors,
|
|
401
|
+
fieldErrors
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function formatError(error, mapper = (issue) => issue.message) {
|
|
405
|
+
const fieldErrors = { _errors: [] };
|
|
406
|
+
const processError = (error, path = []) => {
|
|
407
|
+
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
408
|
+
else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
409
|
+
else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
410
|
+
else {
|
|
411
|
+
const fullpath = [...path, ...issue.path];
|
|
412
|
+
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
413
|
+
else {
|
|
414
|
+
let curr = fieldErrors;
|
|
415
|
+
let i = 0;
|
|
416
|
+
while (i < fullpath.length) {
|
|
417
|
+
const el = fullpath[i];
|
|
418
|
+
if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
419
|
+
else {
|
|
420
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
421
|
+
curr[el]._errors.push(mapper(issue));
|
|
422
|
+
}
|
|
423
|
+
curr = curr[el];
|
|
424
|
+
i++;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
processError(error);
|
|
430
|
+
return fieldErrors;
|
|
431
|
+
}
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
|
|
434
|
+
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
435
|
+
const ctx = _ctx ? {
|
|
436
|
+
..._ctx,
|
|
437
|
+
async: false
|
|
438
|
+
} : { async: false };
|
|
439
|
+
const result = schema._zod.run({
|
|
440
|
+
value,
|
|
441
|
+
issues: []
|
|
442
|
+
}, ctx);
|
|
443
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
444
|
+
if (result.issues.length) {
|
|
445
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
446
|
+
captureStackTrace(e, _params?.callee);
|
|
447
|
+
throw e;
|
|
448
|
+
}
|
|
449
|
+
return result.value;
|
|
450
|
+
};
|
|
451
|
+
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
452
|
+
const ctx = _ctx ? {
|
|
453
|
+
..._ctx,
|
|
454
|
+
async: true
|
|
455
|
+
} : { async: true };
|
|
456
|
+
let result = schema._zod.run({
|
|
457
|
+
value,
|
|
458
|
+
issues: []
|
|
459
|
+
}, ctx);
|
|
460
|
+
if (result instanceof Promise) result = await result;
|
|
461
|
+
if (result.issues.length) {
|
|
462
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
463
|
+
captureStackTrace(e, params?.callee);
|
|
464
|
+
throw e;
|
|
465
|
+
}
|
|
466
|
+
return result.value;
|
|
467
|
+
};
|
|
468
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
469
|
+
const ctx = _ctx ? {
|
|
470
|
+
..._ctx,
|
|
471
|
+
async: false
|
|
472
|
+
} : { async: false };
|
|
473
|
+
const result = schema._zod.run({
|
|
474
|
+
value,
|
|
475
|
+
issues: []
|
|
476
|
+
}, ctx);
|
|
477
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
478
|
+
return result.issues.length ? {
|
|
479
|
+
success: false,
|
|
480
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
481
|
+
} : {
|
|
482
|
+
success: true,
|
|
483
|
+
data: result.value
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
487
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
488
|
+
const ctx = _ctx ? {
|
|
489
|
+
..._ctx,
|
|
490
|
+
async: true
|
|
491
|
+
} : { async: true };
|
|
492
|
+
let result = schema._zod.run({
|
|
493
|
+
value,
|
|
494
|
+
issues: []
|
|
495
|
+
}, ctx);
|
|
496
|
+
if (result instanceof Promise) result = await result;
|
|
497
|
+
return result.issues.length ? {
|
|
498
|
+
success: false,
|
|
499
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
500
|
+
} : {
|
|
501
|
+
success: true,
|
|
502
|
+
data: result.value
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
506
|
+
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
507
|
+
const ctx = _ctx ? {
|
|
508
|
+
..._ctx,
|
|
509
|
+
direction: "backward"
|
|
510
|
+
} : { direction: "backward" };
|
|
511
|
+
return _parse(_Err)(schema, value, ctx);
|
|
512
|
+
};
|
|
513
|
+
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
514
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
515
|
+
};
|
|
516
|
+
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
517
|
+
const ctx = _ctx ? {
|
|
518
|
+
..._ctx,
|
|
519
|
+
direction: "backward"
|
|
520
|
+
} : { direction: "backward" };
|
|
521
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
522
|
+
};
|
|
523
|
+
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
524
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
525
|
+
};
|
|
526
|
+
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
527
|
+
const ctx = _ctx ? {
|
|
528
|
+
..._ctx,
|
|
529
|
+
direction: "backward"
|
|
530
|
+
} : { direction: "backward" };
|
|
531
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
532
|
+
};
|
|
533
|
+
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
534
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
535
|
+
};
|
|
536
|
+
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
537
|
+
const ctx = _ctx ? {
|
|
538
|
+
..._ctx,
|
|
539
|
+
direction: "backward"
|
|
540
|
+
} : { direction: "backward" };
|
|
541
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
542
|
+
};
|
|
543
|
+
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
544
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
545
|
+
};
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
|
|
548
|
+
/**
|
|
549
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
550
|
+
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
551
|
+
* See https://github.com/paralleldrive/cuid.
|
|
552
|
+
*/
|
|
553
|
+
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
554
|
+
const cuid2 = /^[0-9a-z]+$/;
|
|
555
|
+
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
556
|
+
const xid = /^[0-9a-vA-V]{20}$/;
|
|
557
|
+
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
558
|
+
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
559
|
+
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
560
|
+
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
561
|
+
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
562
|
+
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})$/;
|
|
563
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
564
|
+
*
|
|
565
|
+
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
566
|
+
const uuid = (version) => {
|
|
567
|
+
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
568
|
+
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
569
|
+
};
|
|
570
|
+
/** Practical email validation */
|
|
571
|
+
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
572
|
+
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
573
|
+
function emoji() {
|
|
574
|
+
return new RegExp(_emoji$1, "u");
|
|
575
|
+
}
|
|
576
|
+
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])$/;
|
|
577
|
+
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}|:))$/;
|
|
578
|
+
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])$/;
|
|
579
|
+
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
580
|
+
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
581
|
+
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
582
|
+
const httpProtocol = /^https?$/;
|
|
583
|
+
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
584
|
+
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])))`;
|
|
585
|
+
const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
586
|
+
function timeSource(args) {
|
|
587
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
588
|
+
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+)?)?`;
|
|
589
|
+
}
|
|
590
|
+
function time$1(args) {
|
|
591
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
592
|
+
}
|
|
593
|
+
function datetime$1(args) {
|
|
594
|
+
const time = timeSource({ precision: args.precision });
|
|
595
|
+
const opts = ["Z"];
|
|
596
|
+
if (args.local) opts.push("");
|
|
597
|
+
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
598
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
599
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
600
|
+
}
|
|
601
|
+
const string$1 = (params) => {
|
|
602
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
603
|
+
return new RegExp(`^${regex}$`);
|
|
604
|
+
};
|
|
605
|
+
const integer = /^-?\d+$/;
|
|
606
|
+
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
607
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
608
|
+
const _null$2 = /^null$/i;
|
|
609
|
+
const _undefined$2 = /^undefined$/i;
|
|
610
|
+
const lowercase = /^[^A-Z]*$/;
|
|
611
|
+
const uppercase = /^[^a-z]*$/;
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
|
|
614
|
+
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
615
|
+
var _a;
|
|
616
|
+
inst._zod ?? (inst._zod = {});
|
|
617
|
+
inst._zod.def = def;
|
|
618
|
+
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
619
|
+
});
|
|
620
|
+
const numericOriginMap = {
|
|
621
|
+
number: "number",
|
|
622
|
+
bigint: "bigint",
|
|
623
|
+
object: "date"
|
|
624
|
+
};
|
|
625
|
+
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
626
|
+
$ZodCheck.init(inst, def);
|
|
627
|
+
const origin = numericOriginMap[typeof def.value];
|
|
628
|
+
inst._zod.onattach.push((inst) => {
|
|
629
|
+
const bag = inst._zod.bag;
|
|
630
|
+
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
631
|
+
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
632
|
+
else bag.exclusiveMaximum = def.value;
|
|
633
|
+
});
|
|
634
|
+
inst._zod.check = (payload) => {
|
|
635
|
+
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
636
|
+
payload.issues.push({
|
|
637
|
+
origin,
|
|
638
|
+
code: "too_big",
|
|
639
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
640
|
+
input: payload.value,
|
|
641
|
+
inclusive: def.inclusive,
|
|
642
|
+
inst,
|
|
643
|
+
continue: !def.abort
|
|
644
|
+
});
|
|
645
|
+
};
|
|
646
|
+
});
|
|
647
|
+
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
648
|
+
$ZodCheck.init(inst, def);
|
|
649
|
+
const origin = numericOriginMap[typeof def.value];
|
|
650
|
+
inst._zod.onattach.push((inst) => {
|
|
651
|
+
const bag = inst._zod.bag;
|
|
652
|
+
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
653
|
+
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
654
|
+
else bag.exclusiveMinimum = def.value;
|
|
655
|
+
});
|
|
656
|
+
inst._zod.check = (payload) => {
|
|
657
|
+
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
658
|
+
payload.issues.push({
|
|
659
|
+
origin,
|
|
660
|
+
code: "too_small",
|
|
661
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
662
|
+
input: payload.value,
|
|
663
|
+
inclusive: def.inclusive,
|
|
664
|
+
inst,
|
|
665
|
+
continue: !def.abort
|
|
666
|
+
});
|
|
667
|
+
};
|
|
668
|
+
});
|
|
669
|
+
const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
670
|
+
$ZodCheck.init(inst, def);
|
|
671
|
+
inst._zod.onattach.push((inst) => {
|
|
672
|
+
var _a;
|
|
673
|
+
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
674
|
+
});
|
|
675
|
+
inst._zod.check = (payload) => {
|
|
676
|
+
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
677
|
+
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
678
|
+
payload.issues.push({
|
|
679
|
+
origin: typeof payload.value,
|
|
680
|
+
code: "not_multiple_of",
|
|
681
|
+
divisor: def.value,
|
|
682
|
+
input: payload.value,
|
|
683
|
+
inst,
|
|
684
|
+
continue: !def.abort
|
|
685
|
+
});
|
|
686
|
+
};
|
|
687
|
+
});
|
|
688
|
+
const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
689
|
+
$ZodCheck.init(inst, def);
|
|
690
|
+
def.format = def.format || "float64";
|
|
691
|
+
const isInt = def.format?.includes("int");
|
|
692
|
+
const origin = isInt ? "int" : "number";
|
|
693
|
+
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
694
|
+
inst._zod.onattach.push((inst) => {
|
|
695
|
+
const bag = inst._zod.bag;
|
|
696
|
+
bag.format = def.format;
|
|
697
|
+
bag.minimum = minimum;
|
|
698
|
+
bag.maximum = maximum;
|
|
699
|
+
if (isInt) bag.pattern = integer;
|
|
700
|
+
});
|
|
701
|
+
inst._zod.check = (payload) => {
|
|
702
|
+
const input = payload.value;
|
|
703
|
+
if (isInt) {
|
|
704
|
+
if (!Number.isInteger(input)) {
|
|
705
|
+
payload.issues.push({
|
|
706
|
+
expected: origin,
|
|
707
|
+
format: def.format,
|
|
708
|
+
code: "invalid_type",
|
|
709
|
+
continue: false,
|
|
710
|
+
input,
|
|
711
|
+
inst
|
|
712
|
+
});
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
if (!Number.isSafeInteger(input)) {
|
|
716
|
+
if (input > 0) payload.issues.push({
|
|
717
|
+
input,
|
|
718
|
+
code: "too_big",
|
|
719
|
+
maximum: Number.MAX_SAFE_INTEGER,
|
|
720
|
+
note: "Integers must be within the safe integer range.",
|
|
721
|
+
inst,
|
|
722
|
+
origin,
|
|
723
|
+
inclusive: true,
|
|
724
|
+
continue: !def.abort
|
|
725
|
+
});
|
|
726
|
+
else payload.issues.push({
|
|
727
|
+
input,
|
|
728
|
+
code: "too_small",
|
|
729
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
730
|
+
note: "Integers must be within the safe integer range.",
|
|
731
|
+
inst,
|
|
732
|
+
origin,
|
|
733
|
+
inclusive: true,
|
|
734
|
+
continue: !def.abort
|
|
735
|
+
});
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
if (input < minimum) payload.issues.push({
|
|
740
|
+
origin: "number",
|
|
741
|
+
input,
|
|
742
|
+
code: "too_small",
|
|
743
|
+
minimum,
|
|
744
|
+
inclusive: true,
|
|
745
|
+
inst,
|
|
746
|
+
continue: !def.abort
|
|
747
|
+
});
|
|
748
|
+
if (input > maximum) payload.issues.push({
|
|
749
|
+
origin: "number",
|
|
750
|
+
input,
|
|
751
|
+
code: "too_big",
|
|
752
|
+
maximum,
|
|
753
|
+
inclusive: true,
|
|
754
|
+
inst,
|
|
755
|
+
continue: !def.abort
|
|
756
|
+
});
|
|
757
|
+
};
|
|
758
|
+
});
|
|
759
|
+
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
760
|
+
var _a;
|
|
761
|
+
$ZodCheck.init(inst, def);
|
|
762
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
763
|
+
const val = payload.value;
|
|
764
|
+
return !nullish(val) && val.length !== void 0;
|
|
765
|
+
});
|
|
766
|
+
inst._zod.onattach.push((inst) => {
|
|
767
|
+
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
768
|
+
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
769
|
+
});
|
|
770
|
+
inst._zod.check = (payload) => {
|
|
771
|
+
const input = payload.value;
|
|
772
|
+
if (input.length <= def.maximum) return;
|
|
773
|
+
const origin = getLengthableOrigin(input);
|
|
774
|
+
payload.issues.push({
|
|
775
|
+
origin,
|
|
776
|
+
code: "too_big",
|
|
777
|
+
maximum: def.maximum,
|
|
778
|
+
inclusive: true,
|
|
779
|
+
input,
|
|
780
|
+
inst,
|
|
781
|
+
continue: !def.abort
|
|
782
|
+
});
|
|
783
|
+
};
|
|
784
|
+
});
|
|
785
|
+
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
786
|
+
var _a;
|
|
787
|
+
$ZodCheck.init(inst, def);
|
|
788
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
789
|
+
const val = payload.value;
|
|
790
|
+
return !nullish(val) && val.length !== void 0;
|
|
791
|
+
});
|
|
792
|
+
inst._zod.onattach.push((inst) => {
|
|
793
|
+
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
794
|
+
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
795
|
+
});
|
|
796
|
+
inst._zod.check = (payload) => {
|
|
797
|
+
const input = payload.value;
|
|
798
|
+
if (input.length >= def.minimum) return;
|
|
799
|
+
const origin = getLengthableOrigin(input);
|
|
800
|
+
payload.issues.push({
|
|
801
|
+
origin,
|
|
802
|
+
code: "too_small",
|
|
803
|
+
minimum: def.minimum,
|
|
804
|
+
inclusive: true,
|
|
805
|
+
input,
|
|
806
|
+
inst,
|
|
807
|
+
continue: !def.abort
|
|
808
|
+
});
|
|
809
|
+
};
|
|
810
|
+
});
|
|
811
|
+
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
812
|
+
var _a;
|
|
813
|
+
$ZodCheck.init(inst, def);
|
|
814
|
+
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
815
|
+
const val = payload.value;
|
|
816
|
+
return !nullish(val) && val.length !== void 0;
|
|
817
|
+
});
|
|
818
|
+
inst._zod.onattach.push((inst) => {
|
|
819
|
+
const bag = inst._zod.bag;
|
|
820
|
+
bag.minimum = def.length;
|
|
821
|
+
bag.maximum = def.length;
|
|
822
|
+
bag.length = def.length;
|
|
823
|
+
});
|
|
824
|
+
inst._zod.check = (payload) => {
|
|
825
|
+
const input = payload.value;
|
|
826
|
+
const length = input.length;
|
|
827
|
+
if (length === def.length) return;
|
|
828
|
+
const origin = getLengthableOrigin(input);
|
|
829
|
+
const tooBig = length > def.length;
|
|
830
|
+
payload.issues.push({
|
|
831
|
+
origin,
|
|
832
|
+
...tooBig ? {
|
|
833
|
+
code: "too_big",
|
|
834
|
+
maximum: def.length
|
|
835
|
+
} : {
|
|
836
|
+
code: "too_small",
|
|
837
|
+
minimum: def.length
|
|
838
|
+
},
|
|
839
|
+
inclusive: true,
|
|
840
|
+
exact: true,
|
|
841
|
+
input: payload.value,
|
|
842
|
+
inst,
|
|
843
|
+
continue: !def.abort
|
|
844
|
+
});
|
|
845
|
+
};
|
|
846
|
+
});
|
|
847
|
+
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
848
|
+
var _a, _b;
|
|
849
|
+
$ZodCheck.init(inst, def);
|
|
850
|
+
inst._zod.onattach.push((inst) => {
|
|
851
|
+
const bag = inst._zod.bag;
|
|
852
|
+
bag.format = def.format;
|
|
853
|
+
if (def.pattern) {
|
|
854
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
855
|
+
bag.patterns.add(def.pattern);
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
859
|
+
def.pattern.lastIndex = 0;
|
|
860
|
+
if (def.pattern.test(payload.value)) return;
|
|
861
|
+
payload.issues.push({
|
|
862
|
+
origin: "string",
|
|
863
|
+
code: "invalid_format",
|
|
864
|
+
format: def.format,
|
|
865
|
+
input: payload.value,
|
|
866
|
+
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
867
|
+
inst,
|
|
868
|
+
continue: !def.abort
|
|
869
|
+
});
|
|
870
|
+
});
|
|
871
|
+
else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
872
|
+
});
|
|
873
|
+
const $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
874
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
875
|
+
inst._zod.check = (payload) => {
|
|
876
|
+
def.pattern.lastIndex = 0;
|
|
877
|
+
if (def.pattern.test(payload.value)) return;
|
|
878
|
+
payload.issues.push({
|
|
879
|
+
origin: "string",
|
|
880
|
+
code: "invalid_format",
|
|
881
|
+
format: "regex",
|
|
882
|
+
input: payload.value,
|
|
883
|
+
pattern: def.pattern.toString(),
|
|
884
|
+
inst,
|
|
885
|
+
continue: !def.abort
|
|
886
|
+
});
|
|
887
|
+
};
|
|
888
|
+
});
|
|
889
|
+
const $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
890
|
+
def.pattern ?? (def.pattern = lowercase);
|
|
891
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
892
|
+
});
|
|
893
|
+
const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
894
|
+
def.pattern ?? (def.pattern = uppercase);
|
|
895
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
896
|
+
});
|
|
897
|
+
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
898
|
+
$ZodCheck.init(inst, def);
|
|
899
|
+
const escapedRegex = escapeRegex(def.includes);
|
|
900
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
901
|
+
def.pattern = pattern;
|
|
902
|
+
inst._zod.onattach.push((inst) => {
|
|
903
|
+
const bag = inst._zod.bag;
|
|
904
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
905
|
+
bag.patterns.add(pattern);
|
|
906
|
+
});
|
|
907
|
+
inst._zod.check = (payload) => {
|
|
908
|
+
if (payload.value.includes(def.includes, def.position)) return;
|
|
909
|
+
payload.issues.push({
|
|
910
|
+
origin: "string",
|
|
911
|
+
code: "invalid_format",
|
|
912
|
+
format: "includes",
|
|
913
|
+
includes: def.includes,
|
|
914
|
+
input: payload.value,
|
|
915
|
+
inst,
|
|
916
|
+
continue: !def.abort
|
|
917
|
+
});
|
|
918
|
+
};
|
|
919
|
+
});
|
|
920
|
+
const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
921
|
+
$ZodCheck.init(inst, def);
|
|
922
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
923
|
+
def.pattern ?? (def.pattern = pattern);
|
|
924
|
+
inst._zod.onattach.push((inst) => {
|
|
925
|
+
const bag = inst._zod.bag;
|
|
926
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
927
|
+
bag.patterns.add(pattern);
|
|
928
|
+
});
|
|
929
|
+
inst._zod.check = (payload) => {
|
|
930
|
+
if (payload.value.startsWith(def.prefix)) return;
|
|
931
|
+
payload.issues.push({
|
|
932
|
+
origin: "string",
|
|
933
|
+
code: "invalid_format",
|
|
934
|
+
format: "starts_with",
|
|
935
|
+
prefix: def.prefix,
|
|
936
|
+
input: payload.value,
|
|
937
|
+
inst,
|
|
938
|
+
continue: !def.abort
|
|
939
|
+
});
|
|
940
|
+
};
|
|
941
|
+
});
|
|
942
|
+
const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
943
|
+
$ZodCheck.init(inst, def);
|
|
944
|
+
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
945
|
+
def.pattern ?? (def.pattern = pattern);
|
|
946
|
+
inst._zod.onattach.push((inst) => {
|
|
947
|
+
const bag = inst._zod.bag;
|
|
948
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
949
|
+
bag.patterns.add(pattern);
|
|
950
|
+
});
|
|
951
|
+
inst._zod.check = (payload) => {
|
|
952
|
+
if (payload.value.endsWith(def.suffix)) return;
|
|
953
|
+
payload.issues.push({
|
|
954
|
+
origin: "string",
|
|
955
|
+
code: "invalid_format",
|
|
956
|
+
format: "ends_with",
|
|
957
|
+
suffix: def.suffix,
|
|
958
|
+
input: payload.value,
|
|
959
|
+
inst,
|
|
960
|
+
continue: !def.abort
|
|
961
|
+
});
|
|
962
|
+
};
|
|
963
|
+
});
|
|
964
|
+
const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
965
|
+
$ZodCheck.init(inst, def);
|
|
966
|
+
inst._zod.check = (payload) => {
|
|
967
|
+
payload.value = def.tx(payload.value);
|
|
968
|
+
};
|
|
969
|
+
});
|
|
970
|
+
//#endregion
|
|
971
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
|
|
972
|
+
var Doc = class {
|
|
973
|
+
constructor(args = []) {
|
|
974
|
+
this.content = [];
|
|
975
|
+
this.indent = 0;
|
|
976
|
+
if (this) this.args = args;
|
|
977
|
+
}
|
|
978
|
+
indented(fn) {
|
|
979
|
+
this.indent += 1;
|
|
980
|
+
fn(this);
|
|
981
|
+
this.indent -= 1;
|
|
982
|
+
}
|
|
983
|
+
write(arg) {
|
|
984
|
+
if (typeof arg === "function") {
|
|
985
|
+
arg(this, { execution: "sync" });
|
|
986
|
+
arg(this, { execution: "async" });
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
const lines = arg.split("\n").filter((x) => x);
|
|
990
|
+
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
991
|
+
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
992
|
+
for (const line of dedented) this.content.push(line);
|
|
993
|
+
}
|
|
994
|
+
compile() {
|
|
995
|
+
const F = Function;
|
|
996
|
+
const args = this?.args;
|
|
997
|
+
const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
|
|
998
|
+
return new F(...args, lines.join("\n"));
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
|
|
1003
|
+
const version = {
|
|
1004
|
+
major: 4,
|
|
1005
|
+
minor: 4,
|
|
1006
|
+
patch: 3
|
|
1007
|
+
};
|
|
1008
|
+
//#endregion
|
|
1009
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
|
|
1010
|
+
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1011
|
+
var _a;
|
|
1012
|
+
inst ?? (inst = {});
|
|
1013
|
+
inst._zod.def = def;
|
|
1014
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
1015
|
+
inst._zod.version = version;
|
|
1016
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
1017
|
+
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
1018
|
+
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1019
|
+
if (checks.length === 0) {
|
|
1020
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
1021
|
+
inst._zod.deferred?.push(() => {
|
|
1022
|
+
inst._zod.run = inst._zod.parse;
|
|
1023
|
+
});
|
|
1024
|
+
} else {
|
|
1025
|
+
const runChecks = (payload, checks, ctx) => {
|
|
1026
|
+
let isAborted = aborted(payload);
|
|
1027
|
+
let asyncResult;
|
|
1028
|
+
for (const ch of checks) {
|
|
1029
|
+
if (ch._zod.def.when) {
|
|
1030
|
+
if (explicitlyAborted(payload)) continue;
|
|
1031
|
+
if (!ch._zod.def.when(payload)) continue;
|
|
1032
|
+
} else if (isAborted) continue;
|
|
1033
|
+
const currLen = payload.issues.length;
|
|
1034
|
+
const _ = ch._zod.check(payload);
|
|
1035
|
+
if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
|
|
1036
|
+
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1037
|
+
await _;
|
|
1038
|
+
if (payload.issues.length === currLen) return;
|
|
1039
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1040
|
+
});
|
|
1041
|
+
else {
|
|
1042
|
+
if (payload.issues.length === currLen) continue;
|
|
1043
|
+
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
if (asyncResult) return asyncResult.then(() => {
|
|
1047
|
+
return payload;
|
|
1048
|
+
});
|
|
1049
|
+
return payload;
|
|
1050
|
+
};
|
|
1051
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
1052
|
+
if (aborted(canary)) {
|
|
1053
|
+
canary.aborted = true;
|
|
1054
|
+
return canary;
|
|
1055
|
+
}
|
|
1056
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
1057
|
+
if (checkResult instanceof Promise) {
|
|
1058
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
1059
|
+
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
1060
|
+
}
|
|
1061
|
+
return inst._zod.parse(checkResult, ctx);
|
|
1062
|
+
};
|
|
1063
|
+
inst._zod.run = (payload, ctx) => {
|
|
1064
|
+
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
1065
|
+
if (ctx.direction === "backward") {
|
|
1066
|
+
const canary = inst._zod.parse({
|
|
1067
|
+
value: payload.value,
|
|
1068
|
+
issues: []
|
|
1069
|
+
}, {
|
|
1070
|
+
...ctx,
|
|
1071
|
+
skipChecks: true
|
|
1072
|
+
});
|
|
1073
|
+
if (canary instanceof Promise) return canary.then((canary) => {
|
|
1074
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1075
|
+
});
|
|
1076
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1077
|
+
}
|
|
1078
|
+
const result = inst._zod.parse(payload, ctx);
|
|
1079
|
+
if (result instanceof Promise) {
|
|
1080
|
+
if (ctx.async === false) throw new $ZodAsyncError();
|
|
1081
|
+
return result.then((result) => runChecks(result, checks, ctx));
|
|
1082
|
+
}
|
|
1083
|
+
return runChecks(result, checks, ctx);
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
defineLazy(inst, "~standard", () => ({
|
|
1087
|
+
validate: (value) => {
|
|
1088
|
+
try {
|
|
1089
|
+
const r = safeParse$1(inst, value);
|
|
1090
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1091
|
+
} catch (_) {
|
|
1092
|
+
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
vendor: "zod",
|
|
1096
|
+
version: 1
|
|
1097
|
+
}));
|
|
1098
|
+
});
|
|
1099
|
+
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1100
|
+
$ZodType.init(inst, def);
|
|
1101
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
1102
|
+
inst._zod.parse = (payload, _) => {
|
|
1103
|
+
if (def.coerce) try {
|
|
1104
|
+
payload.value = String(payload.value);
|
|
1105
|
+
} catch (_) {}
|
|
1106
|
+
if (typeof payload.value === "string") return payload;
|
|
1107
|
+
payload.issues.push({
|
|
1108
|
+
expected: "string",
|
|
1109
|
+
code: "invalid_type",
|
|
1110
|
+
input: payload.value,
|
|
1111
|
+
inst
|
|
1112
|
+
});
|
|
1113
|
+
return payload;
|
|
1114
|
+
};
|
|
1115
|
+
});
|
|
1116
|
+
const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => {
|
|
1117
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
1118
|
+
$ZodString.init(inst, def);
|
|
1119
|
+
});
|
|
1120
|
+
const $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => {
|
|
1121
|
+
def.pattern ?? (def.pattern = guid);
|
|
1122
|
+
$ZodStringFormat.init(inst, def);
|
|
1123
|
+
});
|
|
1124
|
+
const $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => {
|
|
1125
|
+
if (def.version) {
|
|
1126
|
+
const v = {
|
|
1127
|
+
v1: 1,
|
|
1128
|
+
v2: 2,
|
|
1129
|
+
v3: 3,
|
|
1130
|
+
v4: 4,
|
|
1131
|
+
v5: 5,
|
|
1132
|
+
v6: 6,
|
|
1133
|
+
v7: 7,
|
|
1134
|
+
v8: 8
|
|
1135
|
+
}[def.version];
|
|
1136
|
+
if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
1137
|
+
def.pattern ?? (def.pattern = uuid(v));
|
|
1138
|
+
} else def.pattern ?? (def.pattern = uuid());
|
|
1139
|
+
$ZodStringFormat.init(inst, def);
|
|
1140
|
+
});
|
|
1141
|
+
const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
1142
|
+
def.pattern ?? (def.pattern = email);
|
|
1143
|
+
$ZodStringFormat.init(inst, def);
|
|
1144
|
+
});
|
|
1145
|
+
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
1146
|
+
$ZodStringFormat.init(inst, def);
|
|
1147
|
+
inst._zod.check = (payload) => {
|
|
1148
|
+
try {
|
|
1149
|
+
const trimmed = payload.value.trim();
|
|
1150
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
1151
|
+
if (!/^https?:\/\//i.test(trimmed)) {
|
|
1152
|
+
payload.issues.push({
|
|
1153
|
+
code: "invalid_format",
|
|
1154
|
+
format: "url",
|
|
1155
|
+
note: "Invalid URL format",
|
|
1156
|
+
input: payload.value,
|
|
1157
|
+
inst,
|
|
1158
|
+
continue: !def.abort
|
|
1159
|
+
});
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
const url = new URL(trimmed);
|
|
1164
|
+
if (def.hostname) {
|
|
1165
|
+
def.hostname.lastIndex = 0;
|
|
1166
|
+
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1167
|
+
code: "invalid_format",
|
|
1168
|
+
format: "url",
|
|
1169
|
+
note: "Invalid hostname",
|
|
1170
|
+
pattern: def.hostname.source,
|
|
1171
|
+
input: payload.value,
|
|
1172
|
+
inst,
|
|
1173
|
+
continue: !def.abort
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
if (def.protocol) {
|
|
1177
|
+
def.protocol.lastIndex = 0;
|
|
1178
|
+
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1179
|
+
code: "invalid_format",
|
|
1180
|
+
format: "url",
|
|
1181
|
+
note: "Invalid protocol",
|
|
1182
|
+
pattern: def.protocol.source,
|
|
1183
|
+
input: payload.value,
|
|
1184
|
+
inst,
|
|
1185
|
+
continue: !def.abort
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
if (def.normalize) payload.value = url.href;
|
|
1189
|
+
else payload.value = trimmed;
|
|
1190
|
+
return;
|
|
1191
|
+
} catch (_) {
|
|
1192
|
+
payload.issues.push({
|
|
1193
|
+
code: "invalid_format",
|
|
1194
|
+
format: "url",
|
|
1195
|
+
input: payload.value,
|
|
1196
|
+
inst,
|
|
1197
|
+
continue: !def.abort
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
});
|
|
1202
|
+
const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
|
|
1203
|
+
def.pattern ?? (def.pattern = emoji());
|
|
1204
|
+
$ZodStringFormat.init(inst, def);
|
|
1205
|
+
});
|
|
1206
|
+
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
1207
|
+
def.pattern ?? (def.pattern = nanoid);
|
|
1208
|
+
$ZodStringFormat.init(inst, def);
|
|
1209
|
+
});
|
|
1210
|
+
/**
|
|
1211
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1212
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
1213
|
+
* See https://github.com/paralleldrive/cuid.
|
|
1214
|
+
*/
|
|
1215
|
+
const $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => {
|
|
1216
|
+
def.pattern ?? (def.pattern = cuid);
|
|
1217
|
+
$ZodStringFormat.init(inst, def);
|
|
1218
|
+
});
|
|
1219
|
+
const $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => {
|
|
1220
|
+
def.pattern ?? (def.pattern = cuid2);
|
|
1221
|
+
$ZodStringFormat.init(inst, def);
|
|
1222
|
+
});
|
|
1223
|
+
const $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => {
|
|
1224
|
+
def.pattern ?? (def.pattern = ulid);
|
|
1225
|
+
$ZodStringFormat.init(inst, def);
|
|
1226
|
+
});
|
|
1227
|
+
const $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => {
|
|
1228
|
+
def.pattern ?? (def.pattern = xid);
|
|
1229
|
+
$ZodStringFormat.init(inst, def);
|
|
1230
|
+
});
|
|
1231
|
+
const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
1232
|
+
def.pattern ?? (def.pattern = ksuid);
|
|
1233
|
+
$ZodStringFormat.init(inst, def);
|
|
1234
|
+
});
|
|
1235
|
+
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1236
|
+
def.pattern ?? (def.pattern = datetime$1(def));
|
|
1237
|
+
$ZodStringFormat.init(inst, def);
|
|
1238
|
+
});
|
|
1239
|
+
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1240
|
+
def.pattern ?? (def.pattern = date$1);
|
|
1241
|
+
$ZodStringFormat.init(inst, def);
|
|
1242
|
+
});
|
|
1243
|
+
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1244
|
+
def.pattern ?? (def.pattern = time$1(def));
|
|
1245
|
+
$ZodStringFormat.init(inst, def);
|
|
1246
|
+
});
|
|
1247
|
+
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
1248
|
+
def.pattern ?? (def.pattern = duration$1);
|
|
1249
|
+
$ZodStringFormat.init(inst, def);
|
|
1250
|
+
});
|
|
1251
|
+
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
1252
|
+
def.pattern ?? (def.pattern = ipv4);
|
|
1253
|
+
$ZodStringFormat.init(inst, def);
|
|
1254
|
+
inst._zod.bag.format = `ipv4`;
|
|
1255
|
+
});
|
|
1256
|
+
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
1257
|
+
def.pattern ?? (def.pattern = ipv6);
|
|
1258
|
+
$ZodStringFormat.init(inst, def);
|
|
1259
|
+
inst._zod.bag.format = `ipv6`;
|
|
1260
|
+
inst._zod.check = (payload) => {
|
|
1261
|
+
try {
|
|
1262
|
+
new URL(`http://[${payload.value}]`);
|
|
1263
|
+
} catch {
|
|
1264
|
+
payload.issues.push({
|
|
1265
|
+
code: "invalid_format",
|
|
1266
|
+
format: "ipv6",
|
|
1267
|
+
input: payload.value,
|
|
1268
|
+
inst,
|
|
1269
|
+
continue: !def.abort
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
});
|
|
1274
|
+
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1275
|
+
def.pattern ?? (def.pattern = cidrv4);
|
|
1276
|
+
$ZodStringFormat.init(inst, def);
|
|
1277
|
+
});
|
|
1278
|
+
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1279
|
+
def.pattern ?? (def.pattern = cidrv6);
|
|
1280
|
+
$ZodStringFormat.init(inst, def);
|
|
1281
|
+
inst._zod.check = (payload) => {
|
|
1282
|
+
const parts = payload.value.split("/");
|
|
1283
|
+
try {
|
|
1284
|
+
if (parts.length !== 2) throw new Error();
|
|
1285
|
+
const [address, prefix] = parts;
|
|
1286
|
+
if (!prefix) throw new Error();
|
|
1287
|
+
const prefixNum = Number(prefix);
|
|
1288
|
+
if (`${prefixNum}` !== prefix) throw new Error();
|
|
1289
|
+
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1290
|
+
new URL(`http://[${address}]`);
|
|
1291
|
+
} catch {
|
|
1292
|
+
payload.issues.push({
|
|
1293
|
+
code: "invalid_format",
|
|
1294
|
+
format: "cidrv6",
|
|
1295
|
+
input: payload.value,
|
|
1296
|
+
inst,
|
|
1297
|
+
continue: !def.abort
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
});
|
|
1302
|
+
function isValidBase64(data) {
|
|
1303
|
+
if (data === "") return true;
|
|
1304
|
+
if (/\s/.test(data)) return false;
|
|
1305
|
+
if (data.length % 4 !== 0) return false;
|
|
1306
|
+
try {
|
|
1307
|
+
atob(data);
|
|
1308
|
+
return true;
|
|
1309
|
+
} catch {
|
|
1310
|
+
return false;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
1314
|
+
def.pattern ?? (def.pattern = base64);
|
|
1315
|
+
$ZodStringFormat.init(inst, def);
|
|
1316
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
1317
|
+
inst._zod.check = (payload) => {
|
|
1318
|
+
if (isValidBase64(payload.value)) return;
|
|
1319
|
+
payload.issues.push({
|
|
1320
|
+
code: "invalid_format",
|
|
1321
|
+
format: "base64",
|
|
1322
|
+
input: payload.value,
|
|
1323
|
+
inst,
|
|
1324
|
+
continue: !def.abort
|
|
1325
|
+
});
|
|
1326
|
+
};
|
|
1327
|
+
});
|
|
1328
|
+
function isValidBase64URL(data) {
|
|
1329
|
+
if (!base64url.test(data)) return false;
|
|
1330
|
+
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1331
|
+
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1332
|
+
}
|
|
1333
|
+
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1334
|
+
def.pattern ?? (def.pattern = base64url);
|
|
1335
|
+
$ZodStringFormat.init(inst, def);
|
|
1336
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
1337
|
+
inst._zod.check = (payload) => {
|
|
1338
|
+
if (isValidBase64URL(payload.value)) return;
|
|
1339
|
+
payload.issues.push({
|
|
1340
|
+
code: "invalid_format",
|
|
1341
|
+
format: "base64url",
|
|
1342
|
+
input: payload.value,
|
|
1343
|
+
inst,
|
|
1344
|
+
continue: !def.abort
|
|
1345
|
+
});
|
|
1346
|
+
};
|
|
1347
|
+
});
|
|
1348
|
+
const $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => {
|
|
1349
|
+
def.pattern ?? (def.pattern = e164);
|
|
1350
|
+
$ZodStringFormat.init(inst, def);
|
|
1351
|
+
});
|
|
1352
|
+
function isValidJWT(token, algorithm = null) {
|
|
1353
|
+
try {
|
|
1354
|
+
const tokensParts = token.split(".");
|
|
1355
|
+
if (tokensParts.length !== 3) return false;
|
|
1356
|
+
const [header] = tokensParts;
|
|
1357
|
+
if (!header) return false;
|
|
1358
|
+
const parsedHeader = JSON.parse(atob(header));
|
|
1359
|
+
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
1360
|
+
if (!parsedHeader.alg) return false;
|
|
1361
|
+
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
1362
|
+
return true;
|
|
1363
|
+
} catch {
|
|
1364
|
+
return false;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
|
|
1368
|
+
$ZodStringFormat.init(inst, def);
|
|
1369
|
+
inst._zod.check = (payload) => {
|
|
1370
|
+
if (isValidJWT(payload.value, def.alg)) return;
|
|
1371
|
+
payload.issues.push({
|
|
1372
|
+
code: "invalid_format",
|
|
1373
|
+
format: "jwt",
|
|
1374
|
+
input: payload.value,
|
|
1375
|
+
inst,
|
|
1376
|
+
continue: !def.abort
|
|
1377
|
+
});
|
|
1378
|
+
};
|
|
1379
|
+
});
|
|
1380
|
+
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
1381
|
+
$ZodType.init(inst, def);
|
|
1382
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
|
|
1383
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1384
|
+
if (def.coerce) try {
|
|
1385
|
+
payload.value = Number(payload.value);
|
|
1386
|
+
} catch (_) {}
|
|
1387
|
+
const input = payload.value;
|
|
1388
|
+
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1389
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
1390
|
+
payload.issues.push({
|
|
1391
|
+
expected: "number",
|
|
1392
|
+
code: "invalid_type",
|
|
1393
|
+
input,
|
|
1394
|
+
inst,
|
|
1395
|
+
...received ? { received } : {}
|
|
1396
|
+
});
|
|
1397
|
+
return payload;
|
|
1398
|
+
};
|
|
1399
|
+
});
|
|
1400
|
+
const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
1401
|
+
$ZodCheckNumberFormat.init(inst, def);
|
|
1402
|
+
$ZodNumber.init(inst, def);
|
|
1403
|
+
});
|
|
1404
|
+
const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
|
|
1405
|
+
$ZodType.init(inst, def);
|
|
1406
|
+
inst._zod.pattern = boolean$1;
|
|
1407
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1408
|
+
if (def.coerce) try {
|
|
1409
|
+
payload.value = Boolean(payload.value);
|
|
1410
|
+
} catch (_) {}
|
|
1411
|
+
const input = payload.value;
|
|
1412
|
+
if (typeof input === "boolean") return payload;
|
|
1413
|
+
payload.issues.push({
|
|
1414
|
+
expected: "boolean",
|
|
1415
|
+
code: "invalid_type",
|
|
1416
|
+
input,
|
|
1417
|
+
inst
|
|
1418
|
+
});
|
|
1419
|
+
return payload;
|
|
1420
|
+
};
|
|
1421
|
+
});
|
|
1422
|
+
const $ZodUndefined = /*@__PURE__*/ $constructor("$ZodUndefined", (inst, def) => {
|
|
1423
|
+
$ZodType.init(inst, def);
|
|
1424
|
+
inst._zod.pattern = _undefined$2;
|
|
1425
|
+
inst._zod.values = new Set([void 0]);
|
|
1426
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1427
|
+
const input = payload.value;
|
|
1428
|
+
if (typeof input === "undefined") return payload;
|
|
1429
|
+
payload.issues.push({
|
|
1430
|
+
expected: "undefined",
|
|
1431
|
+
code: "invalid_type",
|
|
1432
|
+
input,
|
|
1433
|
+
inst
|
|
1434
|
+
});
|
|
1435
|
+
return payload;
|
|
1436
|
+
};
|
|
1437
|
+
});
|
|
1438
|
+
const $ZodNull = /*@__PURE__*/ $constructor("$ZodNull", (inst, def) => {
|
|
1439
|
+
$ZodType.init(inst, def);
|
|
1440
|
+
inst._zod.pattern = _null$2;
|
|
1441
|
+
inst._zod.values = new Set([null]);
|
|
1442
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1443
|
+
const input = payload.value;
|
|
1444
|
+
if (input === null) return payload;
|
|
1445
|
+
payload.issues.push({
|
|
1446
|
+
expected: "null",
|
|
1447
|
+
code: "invalid_type",
|
|
1448
|
+
input,
|
|
1449
|
+
inst
|
|
1450
|
+
});
|
|
1451
|
+
return payload;
|
|
1452
|
+
};
|
|
1453
|
+
});
|
|
1454
|
+
const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
|
|
1455
|
+
$ZodType.init(inst, def);
|
|
1456
|
+
inst._zod.parse = (payload) => payload;
|
|
1457
|
+
});
|
|
1458
|
+
const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
|
|
1459
|
+
$ZodType.init(inst, def);
|
|
1460
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1461
|
+
payload.issues.push({
|
|
1462
|
+
expected: "never",
|
|
1463
|
+
code: "invalid_type",
|
|
1464
|
+
input: payload.value,
|
|
1465
|
+
inst
|
|
1466
|
+
});
|
|
1467
|
+
return payload;
|
|
1468
|
+
};
|
|
1469
|
+
});
|
|
1470
|
+
function handleArrayResult(result, final, index) {
|
|
1471
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1472
|
+
final.value[index] = result.value;
|
|
1473
|
+
}
|
|
1474
|
+
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1475
|
+
$ZodType.init(inst, def);
|
|
1476
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1477
|
+
const input = payload.value;
|
|
1478
|
+
if (!Array.isArray(input)) {
|
|
1479
|
+
payload.issues.push({
|
|
1480
|
+
expected: "array",
|
|
1481
|
+
code: "invalid_type",
|
|
1482
|
+
input,
|
|
1483
|
+
inst
|
|
1484
|
+
});
|
|
1485
|
+
return payload;
|
|
1486
|
+
}
|
|
1487
|
+
payload.value = Array(input.length);
|
|
1488
|
+
const proms = [];
|
|
1489
|
+
for (let i = 0; i < input.length; i++) {
|
|
1490
|
+
const item = input[i];
|
|
1491
|
+
const result = def.element._zod.run({
|
|
1492
|
+
value: item,
|
|
1493
|
+
issues: []
|
|
1494
|
+
}, ctx);
|
|
1495
|
+
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1496
|
+
else handleArrayResult(result, payload, i);
|
|
1497
|
+
}
|
|
1498
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1499
|
+
return payload;
|
|
1500
|
+
};
|
|
1501
|
+
});
|
|
1502
|
+
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
1503
|
+
const isPresent = key in input;
|
|
1504
|
+
if (result.issues.length) {
|
|
1505
|
+
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
1506
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
1507
|
+
}
|
|
1508
|
+
if (!isPresent && !isOptionalIn) {
|
|
1509
|
+
if (!result.issues.length) final.issues.push({
|
|
1510
|
+
code: "invalid_type",
|
|
1511
|
+
expected: "nonoptional",
|
|
1512
|
+
input: void 0,
|
|
1513
|
+
path: [key]
|
|
1514
|
+
});
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1517
|
+
if (result.value === void 0) {
|
|
1518
|
+
if (isPresent) final.value[key] = void 0;
|
|
1519
|
+
} else final.value[key] = result.value;
|
|
1520
|
+
}
|
|
1521
|
+
function normalizeDef(def) {
|
|
1522
|
+
const keys = Object.keys(def.shape);
|
|
1523
|
+
for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
1524
|
+
const okeys = optionalKeys(def.shape);
|
|
1525
|
+
return {
|
|
1526
|
+
...def,
|
|
1527
|
+
keys,
|
|
1528
|
+
keySet: new Set(keys),
|
|
1529
|
+
numKeys: keys.length,
|
|
1530
|
+
optionalKeys: new Set(okeys)
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
1534
|
+
const unrecognized = [];
|
|
1535
|
+
const keySet = def.keySet;
|
|
1536
|
+
const _catchall = def.catchall._zod;
|
|
1537
|
+
const t = _catchall.def.type;
|
|
1538
|
+
const isOptionalIn = _catchall.optin === "optional";
|
|
1539
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
1540
|
+
for (const key in input) {
|
|
1541
|
+
if (key === "__proto__") continue;
|
|
1542
|
+
if (keySet.has(key)) continue;
|
|
1543
|
+
if (t === "never") {
|
|
1544
|
+
unrecognized.push(key);
|
|
1545
|
+
continue;
|
|
1546
|
+
}
|
|
1547
|
+
const r = _catchall.run({
|
|
1548
|
+
value: input[key],
|
|
1549
|
+
issues: []
|
|
1550
|
+
}, ctx);
|
|
1551
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
1552
|
+
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
1553
|
+
}
|
|
1554
|
+
if (unrecognized.length) payload.issues.push({
|
|
1555
|
+
code: "unrecognized_keys",
|
|
1556
|
+
keys: unrecognized,
|
|
1557
|
+
input,
|
|
1558
|
+
inst
|
|
1559
|
+
});
|
|
1560
|
+
if (!proms.length) return payload;
|
|
1561
|
+
return Promise.all(proms).then(() => {
|
|
1562
|
+
return payload;
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1566
|
+
$ZodType.init(inst, def);
|
|
1567
|
+
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
1568
|
+
const sh = def.shape;
|
|
1569
|
+
Object.defineProperty(def, "shape", { get: () => {
|
|
1570
|
+
const newSh = { ...sh };
|
|
1571
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
1572
|
+
return newSh;
|
|
1573
|
+
} });
|
|
1574
|
+
}
|
|
1575
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1576
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
1577
|
+
const shape = def.shape;
|
|
1578
|
+
const propValues = {};
|
|
1579
|
+
for (const key in shape) {
|
|
1580
|
+
const field = shape[key]._zod;
|
|
1581
|
+
if (field.values) {
|
|
1582
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
1583
|
+
for (const v of field.values) propValues[key].add(v);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
return propValues;
|
|
1587
|
+
});
|
|
1588
|
+
const isObject$1 = isObject;
|
|
1589
|
+
const catchall = def.catchall;
|
|
1590
|
+
let value;
|
|
1591
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1592
|
+
value ?? (value = _normalized.value);
|
|
1593
|
+
const input = payload.value;
|
|
1594
|
+
if (!isObject$1(input)) {
|
|
1595
|
+
payload.issues.push({
|
|
1596
|
+
expected: "object",
|
|
1597
|
+
code: "invalid_type",
|
|
1598
|
+
input,
|
|
1599
|
+
inst
|
|
1600
|
+
});
|
|
1601
|
+
return payload;
|
|
1602
|
+
}
|
|
1603
|
+
payload.value = {};
|
|
1604
|
+
const proms = [];
|
|
1605
|
+
const shape = value.shape;
|
|
1606
|
+
for (const key of value.keys) {
|
|
1607
|
+
const el = shape[key];
|
|
1608
|
+
const isOptionalIn = el._zod.optin === "optional";
|
|
1609
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
1610
|
+
const r = el._zod.run({
|
|
1611
|
+
value: input[key],
|
|
1612
|
+
issues: []
|
|
1613
|
+
}, ctx);
|
|
1614
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
1615
|
+
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
1616
|
+
}
|
|
1617
|
+
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1618
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1619
|
+
};
|
|
1620
|
+
});
|
|
1621
|
+
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
1622
|
+
$ZodObject.init(inst, def);
|
|
1623
|
+
const superParse = inst._zod.parse;
|
|
1624
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1625
|
+
const generateFastpass = (shape) => {
|
|
1626
|
+
const doc = new Doc([
|
|
1627
|
+
"shape",
|
|
1628
|
+
"payload",
|
|
1629
|
+
"ctx"
|
|
1630
|
+
]);
|
|
1631
|
+
const normalized = _normalized.value;
|
|
1632
|
+
const parseStr = (key) => {
|
|
1633
|
+
const k = esc(key);
|
|
1634
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1635
|
+
};
|
|
1636
|
+
doc.write(`const input = payload.value;`);
|
|
1637
|
+
const ids = Object.create(null);
|
|
1638
|
+
let counter = 0;
|
|
1639
|
+
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
1640
|
+
doc.write(`const newResult = {};`);
|
|
1641
|
+
for (const key of normalized.keys) {
|
|
1642
|
+
const id = ids[key];
|
|
1643
|
+
const k = esc(key);
|
|
1644
|
+
const schema = shape[key];
|
|
1645
|
+
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
1646
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1647
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1648
|
+
if (isOptionalIn && isOptionalOut) doc.write(`
|
|
1649
|
+
if (${id}.issues.length) {
|
|
1650
|
+
if (${k} in input) {
|
|
1651
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1652
|
+
...iss,
|
|
1653
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1654
|
+
})));
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
if (${id}.value === undefined) {
|
|
1659
|
+
if (${k} in input) {
|
|
1660
|
+
newResult[${k}] = undefined;
|
|
1661
|
+
}
|
|
1662
|
+
} else {
|
|
1663
|
+
newResult[${k}] = ${id}.value;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
`);
|
|
1667
|
+
else if (!isOptionalIn) doc.write(`
|
|
1668
|
+
const ${id}_present = ${k} in input;
|
|
1669
|
+
if (${id}.issues.length) {
|
|
1670
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1671
|
+
...iss,
|
|
1672
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1673
|
+
})));
|
|
1674
|
+
}
|
|
1675
|
+
if (!${id}_present && !${id}.issues.length) {
|
|
1676
|
+
payload.issues.push({
|
|
1677
|
+
code: "invalid_type",
|
|
1678
|
+
expected: "nonoptional",
|
|
1679
|
+
input: undefined,
|
|
1680
|
+
path: [${k}]
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
if (${id}_present) {
|
|
1685
|
+
if (${id}.value === undefined) {
|
|
1686
|
+
newResult[${k}] = undefined;
|
|
1687
|
+
} else {
|
|
1688
|
+
newResult[${k}] = ${id}.value;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
`);
|
|
1693
|
+
else doc.write(`
|
|
1694
|
+
if (${id}.issues.length) {
|
|
1695
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1696
|
+
...iss,
|
|
1697
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1698
|
+
})));
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
if (${id}.value === undefined) {
|
|
1702
|
+
if (${k} in input) {
|
|
1703
|
+
newResult[${k}] = undefined;
|
|
1704
|
+
}
|
|
1705
|
+
} else {
|
|
1706
|
+
newResult[${k}] = ${id}.value;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
`);
|
|
1710
|
+
}
|
|
1711
|
+
doc.write(`payload.value = newResult;`);
|
|
1712
|
+
doc.write(`return payload;`);
|
|
1713
|
+
const fn = doc.compile();
|
|
1714
|
+
return (payload, ctx) => fn(shape, payload, ctx);
|
|
1715
|
+
};
|
|
1716
|
+
let fastpass;
|
|
1717
|
+
const isObject$2 = isObject;
|
|
1718
|
+
const jit = !globalConfig.jitless;
|
|
1719
|
+
const fastEnabled = jit && allowsEval.value;
|
|
1720
|
+
const catchall = def.catchall;
|
|
1721
|
+
let value;
|
|
1722
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1723
|
+
value ?? (value = _normalized.value);
|
|
1724
|
+
const input = payload.value;
|
|
1725
|
+
if (!isObject$2(input)) {
|
|
1726
|
+
payload.issues.push({
|
|
1727
|
+
expected: "object",
|
|
1728
|
+
code: "invalid_type",
|
|
1729
|
+
input,
|
|
1730
|
+
inst
|
|
1731
|
+
});
|
|
1732
|
+
return payload;
|
|
1733
|
+
}
|
|
1734
|
+
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
1735
|
+
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
1736
|
+
payload = fastpass(payload, ctx);
|
|
1737
|
+
if (!catchall) return payload;
|
|
1738
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1739
|
+
}
|
|
1740
|
+
return superParse(payload, ctx);
|
|
1741
|
+
};
|
|
1742
|
+
});
|
|
1743
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
1744
|
+
for (const result of results) if (result.issues.length === 0) {
|
|
1745
|
+
final.value = result.value;
|
|
1746
|
+
return final;
|
|
1747
|
+
}
|
|
1748
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
1749
|
+
if (nonaborted.length === 1) {
|
|
1750
|
+
final.value = nonaborted[0].value;
|
|
1751
|
+
return nonaborted[0];
|
|
1752
|
+
}
|
|
1753
|
+
final.issues.push({
|
|
1754
|
+
code: "invalid_union",
|
|
1755
|
+
input: final.value,
|
|
1756
|
+
inst,
|
|
1757
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
1758
|
+
});
|
|
1759
|
+
return final;
|
|
1760
|
+
}
|
|
1761
|
+
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
1762
|
+
$ZodType.init(inst, def);
|
|
1763
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
1764
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
1765
|
+
defineLazy(inst._zod, "values", () => {
|
|
1766
|
+
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1767
|
+
});
|
|
1768
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1769
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
1770
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1771
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1772
|
+
}
|
|
1773
|
+
});
|
|
1774
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
1775
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1776
|
+
if (first) return first(payload, ctx);
|
|
1777
|
+
let async = false;
|
|
1778
|
+
const results = [];
|
|
1779
|
+
for (const option of def.options) {
|
|
1780
|
+
const result = option._zod.run({
|
|
1781
|
+
value: payload.value,
|
|
1782
|
+
issues: []
|
|
1783
|
+
}, ctx);
|
|
1784
|
+
if (result instanceof Promise) {
|
|
1785
|
+
results.push(result);
|
|
1786
|
+
async = true;
|
|
1787
|
+
} else {
|
|
1788
|
+
if (result.issues.length === 0) return result;
|
|
1789
|
+
results.push(result);
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
1793
|
+
return Promise.all(results).then((results) => {
|
|
1794
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
1795
|
+
});
|
|
1796
|
+
};
|
|
1797
|
+
});
|
|
1798
|
+
const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
|
|
1799
|
+
$ZodType.init(inst, def);
|
|
1800
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1801
|
+
const input = payload.value;
|
|
1802
|
+
const left = def.left._zod.run({
|
|
1803
|
+
value: input,
|
|
1804
|
+
issues: []
|
|
1805
|
+
}, ctx);
|
|
1806
|
+
const right = def.right._zod.run({
|
|
1807
|
+
value: input,
|
|
1808
|
+
issues: []
|
|
1809
|
+
}, ctx);
|
|
1810
|
+
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
|
|
1811
|
+
return handleIntersectionResults(payload, left, right);
|
|
1812
|
+
});
|
|
1813
|
+
return handleIntersectionResults(payload, left, right);
|
|
1814
|
+
};
|
|
1815
|
+
});
|
|
1816
|
+
function mergeValues(a, b) {
|
|
1817
|
+
if (a === b) return {
|
|
1818
|
+
valid: true,
|
|
1819
|
+
data: a
|
|
1820
|
+
};
|
|
1821
|
+
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
1822
|
+
valid: true,
|
|
1823
|
+
data: a
|
|
1824
|
+
};
|
|
1825
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
1826
|
+
const bKeys = Object.keys(b);
|
|
1827
|
+
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1828
|
+
const newObj = {
|
|
1829
|
+
...a,
|
|
1830
|
+
...b
|
|
1831
|
+
};
|
|
1832
|
+
for (const key of sharedKeys) {
|
|
1833
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
1834
|
+
if (!sharedValue.valid) return {
|
|
1835
|
+
valid: false,
|
|
1836
|
+
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
1837
|
+
};
|
|
1838
|
+
newObj[key] = sharedValue.data;
|
|
1839
|
+
}
|
|
1840
|
+
return {
|
|
1841
|
+
valid: true,
|
|
1842
|
+
data: newObj
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
1846
|
+
if (a.length !== b.length) return {
|
|
1847
|
+
valid: false,
|
|
1848
|
+
mergeErrorPath: []
|
|
1849
|
+
};
|
|
1850
|
+
const newArray = [];
|
|
1851
|
+
for (let index = 0; index < a.length; index++) {
|
|
1852
|
+
const itemA = a[index];
|
|
1853
|
+
const itemB = b[index];
|
|
1854
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
1855
|
+
if (!sharedValue.valid) return {
|
|
1856
|
+
valid: false,
|
|
1857
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
1858
|
+
};
|
|
1859
|
+
newArray.push(sharedValue.data);
|
|
1860
|
+
}
|
|
1861
|
+
return {
|
|
1862
|
+
valid: true,
|
|
1863
|
+
data: newArray
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
return {
|
|
1867
|
+
valid: false,
|
|
1868
|
+
mergeErrorPath: []
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
function handleIntersectionResults(result, left, right) {
|
|
1872
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1873
|
+
let unrecIssue;
|
|
1874
|
+
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
1875
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
1876
|
+
for (const k of iss.keys) {
|
|
1877
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1878
|
+
unrecKeys.get(k).l = true;
|
|
1879
|
+
}
|
|
1880
|
+
} else result.issues.push(iss);
|
|
1881
|
+
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
1882
|
+
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1883
|
+
unrecKeys.get(k).r = true;
|
|
1884
|
+
}
|
|
1885
|
+
else result.issues.push(iss);
|
|
1886
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1887
|
+
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
1888
|
+
...unrecIssue,
|
|
1889
|
+
keys: bothKeys
|
|
1890
|
+
});
|
|
1891
|
+
if (aborted(result)) return result;
|
|
1892
|
+
const merged = mergeValues(left.value, right.value);
|
|
1893
|
+
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1894
|
+
result.value = merged.data;
|
|
1895
|
+
return result;
|
|
1896
|
+
}
|
|
1897
|
+
const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
|
|
1898
|
+
$ZodType.init(inst, def);
|
|
1899
|
+
const items = def.items;
|
|
1900
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1901
|
+
const input = payload.value;
|
|
1902
|
+
if (!Array.isArray(input)) {
|
|
1903
|
+
payload.issues.push({
|
|
1904
|
+
input,
|
|
1905
|
+
inst,
|
|
1906
|
+
expected: "tuple",
|
|
1907
|
+
code: "invalid_type"
|
|
1908
|
+
});
|
|
1909
|
+
return payload;
|
|
1910
|
+
}
|
|
1911
|
+
payload.value = [];
|
|
1912
|
+
const proms = [];
|
|
1913
|
+
const optinStart = getTupleOptStart(items, "optin");
|
|
1914
|
+
const optoutStart = getTupleOptStart(items, "optout");
|
|
1915
|
+
if (!def.rest) {
|
|
1916
|
+
if (input.length < optinStart) {
|
|
1917
|
+
payload.issues.push({
|
|
1918
|
+
code: "too_small",
|
|
1919
|
+
minimum: optinStart,
|
|
1920
|
+
inclusive: true,
|
|
1921
|
+
input,
|
|
1922
|
+
inst,
|
|
1923
|
+
origin: "array"
|
|
1924
|
+
});
|
|
1925
|
+
return payload;
|
|
1926
|
+
}
|
|
1927
|
+
if (input.length > items.length) payload.issues.push({
|
|
1928
|
+
code: "too_big",
|
|
1929
|
+
maximum: items.length,
|
|
1930
|
+
inclusive: true,
|
|
1931
|
+
input,
|
|
1932
|
+
inst,
|
|
1933
|
+
origin: "array"
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
const itemResults = new Array(items.length);
|
|
1937
|
+
for (let i = 0; i < items.length; i++) {
|
|
1938
|
+
const r = items[i]._zod.run({
|
|
1939
|
+
value: input[i],
|
|
1940
|
+
issues: []
|
|
1941
|
+
}, ctx);
|
|
1942
|
+
if (r instanceof Promise) proms.push(r.then((rr) => {
|
|
1943
|
+
itemResults[i] = rr;
|
|
1944
|
+
}));
|
|
1945
|
+
else itemResults[i] = r;
|
|
1946
|
+
}
|
|
1947
|
+
if (def.rest) {
|
|
1948
|
+
let i = items.length - 1;
|
|
1949
|
+
const rest = input.slice(items.length);
|
|
1950
|
+
for (const el of rest) {
|
|
1951
|
+
i++;
|
|
1952
|
+
const result = def.rest._zod.run({
|
|
1953
|
+
value: el,
|
|
1954
|
+
issues: []
|
|
1955
|
+
}, ctx);
|
|
1956
|
+
if (result instanceof Promise) proms.push(result.then((r) => handleTupleResult(r, payload, i)));
|
|
1957
|
+
else handleTupleResult(result, payload, i);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
if (proms.length) return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
|
|
1961
|
+
return handleTupleResults(itemResults, payload, items, input, optoutStart);
|
|
1962
|
+
};
|
|
1963
|
+
});
|
|
1964
|
+
function getTupleOptStart(items, key) {
|
|
1965
|
+
for (let i = items.length - 1; i >= 0; i--) if (items[i]._zod[key] !== "optional") return i + 1;
|
|
1966
|
+
return 0;
|
|
1967
|
+
}
|
|
1968
|
+
function handleTupleResult(result, final, index) {
|
|
1969
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1970
|
+
final.value[index] = result.value;
|
|
1971
|
+
}
|
|
1972
|
+
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1973
|
+
for (let i = 0; i < items.length; i++) {
|
|
1974
|
+
const r = itemResults[i];
|
|
1975
|
+
const isPresent = i < input.length;
|
|
1976
|
+
if (r.issues.length) {
|
|
1977
|
+
if (!isPresent && i >= optoutStart) {
|
|
1978
|
+
final.value.length = i;
|
|
1979
|
+
break;
|
|
1980
|
+
}
|
|
1981
|
+
final.issues.push(...prefixIssues(i, r.issues));
|
|
1982
|
+
}
|
|
1983
|
+
final.value[i] = r.value;
|
|
1984
|
+
}
|
|
1985
|
+
for (let i = final.value.length - 1; i >= input.length; i--) if (items[i]._zod.optout === "optional" && final.value[i] === void 0) final.value.length = i;
|
|
1986
|
+
else break;
|
|
1987
|
+
return final;
|
|
1988
|
+
}
|
|
1989
|
+
const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
1990
|
+
$ZodType.init(inst, def);
|
|
1991
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1992
|
+
const input = payload.value;
|
|
1993
|
+
if (!isPlainObject(input)) {
|
|
1994
|
+
payload.issues.push({
|
|
1995
|
+
expected: "record",
|
|
1996
|
+
code: "invalid_type",
|
|
1997
|
+
input,
|
|
1998
|
+
inst
|
|
1999
|
+
});
|
|
2000
|
+
return payload;
|
|
2001
|
+
}
|
|
2002
|
+
const proms = [];
|
|
2003
|
+
const values = def.keyType._zod.values;
|
|
2004
|
+
if (values) {
|
|
2005
|
+
payload.value = {};
|
|
2006
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
2007
|
+
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
2008
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
2009
|
+
const keyResult = def.keyType._zod.run({
|
|
2010
|
+
value: key,
|
|
2011
|
+
issues: []
|
|
2012
|
+
}, ctx);
|
|
2013
|
+
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
2014
|
+
if (keyResult.issues.length) {
|
|
2015
|
+
payload.issues.push({
|
|
2016
|
+
code: "invalid_key",
|
|
2017
|
+
origin: "record",
|
|
2018
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
2019
|
+
input: key,
|
|
2020
|
+
path: [key],
|
|
2021
|
+
inst
|
|
2022
|
+
});
|
|
2023
|
+
continue;
|
|
2024
|
+
}
|
|
2025
|
+
const outKey = keyResult.value;
|
|
2026
|
+
const result = def.valueType._zod.run({
|
|
2027
|
+
value: input[key],
|
|
2028
|
+
issues: []
|
|
2029
|
+
}, ctx);
|
|
2030
|
+
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
2031
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2032
|
+
payload.value[outKey] = result.value;
|
|
2033
|
+
}));
|
|
2034
|
+
else {
|
|
2035
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2036
|
+
payload.value[outKey] = result.value;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
let unrecognized;
|
|
2040
|
+
for (const key in input) if (!recordKeys.has(key)) {
|
|
2041
|
+
unrecognized = unrecognized ?? [];
|
|
2042
|
+
unrecognized.push(key);
|
|
2043
|
+
}
|
|
2044
|
+
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
2045
|
+
code: "unrecognized_keys",
|
|
2046
|
+
input,
|
|
2047
|
+
inst,
|
|
2048
|
+
keys: unrecognized
|
|
2049
|
+
});
|
|
2050
|
+
} else {
|
|
2051
|
+
payload.value = {};
|
|
2052
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
2053
|
+
if (key === "__proto__") continue;
|
|
2054
|
+
if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
|
|
2055
|
+
let keyResult = def.keyType._zod.run({
|
|
2056
|
+
value: key,
|
|
2057
|
+
issues: []
|
|
2058
|
+
}, ctx);
|
|
2059
|
+
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
2060
|
+
if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
|
|
2061
|
+
const retryResult = def.keyType._zod.run({
|
|
2062
|
+
value: Number(key),
|
|
2063
|
+
issues: []
|
|
2064
|
+
}, ctx);
|
|
2065
|
+
if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
2066
|
+
if (retryResult.issues.length === 0) keyResult = retryResult;
|
|
2067
|
+
}
|
|
2068
|
+
if (keyResult.issues.length) {
|
|
2069
|
+
if (def.mode === "loose") payload.value[key] = input[key];
|
|
2070
|
+
else payload.issues.push({
|
|
2071
|
+
code: "invalid_key",
|
|
2072
|
+
origin: "record",
|
|
2073
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
2074
|
+
input: key,
|
|
2075
|
+
path: [key],
|
|
2076
|
+
inst
|
|
2077
|
+
});
|
|
2078
|
+
continue;
|
|
2079
|
+
}
|
|
2080
|
+
const result = def.valueType._zod.run({
|
|
2081
|
+
value: input[key],
|
|
2082
|
+
issues: []
|
|
2083
|
+
}, ctx);
|
|
2084
|
+
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
2085
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2086
|
+
payload.value[keyResult.value] = result.value;
|
|
2087
|
+
}));
|
|
2088
|
+
else {
|
|
2089
|
+
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2090
|
+
payload.value[keyResult.value] = result.value;
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
2095
|
+
return payload;
|
|
2096
|
+
};
|
|
2097
|
+
});
|
|
2098
|
+
const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
2099
|
+
$ZodType.init(inst, def);
|
|
2100
|
+
const values = getEnumValues(def.entries);
|
|
2101
|
+
const valuesSet = new Set(values);
|
|
2102
|
+
inst._zod.values = valuesSet;
|
|
2103
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
2104
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2105
|
+
const input = payload.value;
|
|
2106
|
+
if (valuesSet.has(input)) return payload;
|
|
2107
|
+
payload.issues.push({
|
|
2108
|
+
code: "invalid_value",
|
|
2109
|
+
values,
|
|
2110
|
+
input,
|
|
2111
|
+
inst
|
|
2112
|
+
});
|
|
2113
|
+
return payload;
|
|
2114
|
+
};
|
|
2115
|
+
});
|
|
2116
|
+
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
2117
|
+
$ZodType.init(inst, def);
|
|
2118
|
+
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
2119
|
+
const values = new Set(def.values);
|
|
2120
|
+
inst._zod.values = values;
|
|
2121
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
2122
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2123
|
+
const input = payload.value;
|
|
2124
|
+
if (values.has(input)) return payload;
|
|
2125
|
+
payload.issues.push({
|
|
2126
|
+
code: "invalid_value",
|
|
2127
|
+
values: def.values,
|
|
2128
|
+
input,
|
|
2129
|
+
inst
|
|
2130
|
+
});
|
|
2131
|
+
return payload;
|
|
2132
|
+
};
|
|
2133
|
+
});
|
|
2134
|
+
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
2135
|
+
$ZodType.init(inst, def);
|
|
2136
|
+
inst._zod.optin = "optional";
|
|
2137
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2138
|
+
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2139
|
+
const _out = def.transform(payload.value, payload);
|
|
2140
|
+
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
2141
|
+
payload.value = output;
|
|
2142
|
+
payload.fallback = true;
|
|
2143
|
+
return payload;
|
|
2144
|
+
});
|
|
2145
|
+
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
2146
|
+
payload.value = _out;
|
|
2147
|
+
payload.fallback = true;
|
|
2148
|
+
return payload;
|
|
2149
|
+
};
|
|
2150
|
+
});
|
|
2151
|
+
function handleOptionalResult(result, input) {
|
|
2152
|
+
if (input === void 0 && (result.issues.length || result.fallback)) return {
|
|
2153
|
+
issues: [],
|
|
2154
|
+
value: void 0
|
|
2155
|
+
};
|
|
2156
|
+
return result;
|
|
2157
|
+
}
|
|
2158
|
+
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2159
|
+
$ZodType.init(inst, def);
|
|
2160
|
+
inst._zod.optin = "optional";
|
|
2161
|
+
inst._zod.optout = "optional";
|
|
2162
|
+
defineLazy(inst._zod, "values", () => {
|
|
2163
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
2164
|
+
});
|
|
2165
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
2166
|
+
const pattern = def.innerType._zod.pattern;
|
|
2167
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2168
|
+
});
|
|
2169
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2170
|
+
if (def.innerType._zod.optin === "optional") {
|
|
2171
|
+
const input = payload.value;
|
|
2172
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2173
|
+
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
|
|
2174
|
+
return handleOptionalResult(result, input);
|
|
2175
|
+
}
|
|
2176
|
+
if (payload.value === void 0) return payload;
|
|
2177
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2178
|
+
};
|
|
2179
|
+
});
|
|
2180
|
+
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2181
|
+
$ZodOptional.init(inst, def);
|
|
2182
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2183
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
2184
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2185
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2186
|
+
};
|
|
2187
|
+
});
|
|
2188
|
+
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
2189
|
+
$ZodType.init(inst, def);
|
|
2190
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2191
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2192
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
2193
|
+
const pattern = def.innerType._zod.pattern;
|
|
2194
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2195
|
+
});
|
|
2196
|
+
defineLazy(inst._zod, "values", () => {
|
|
2197
|
+
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2198
|
+
});
|
|
2199
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2200
|
+
if (payload.value === null) return payload;
|
|
2201
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2202
|
+
};
|
|
2203
|
+
});
|
|
2204
|
+
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
2205
|
+
$ZodType.init(inst, def);
|
|
2206
|
+
inst._zod.optin = "optional";
|
|
2207
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2208
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2209
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2210
|
+
if (payload.value === void 0) {
|
|
2211
|
+
payload.value = def.defaultValue;
|
|
2212
|
+
/**
|
|
2213
|
+
* $ZodDefault returns the default value immediately in forward direction.
|
|
2214
|
+
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
2215
|
+
return payload;
|
|
2216
|
+
}
|
|
2217
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2218
|
+
if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
|
|
2219
|
+
return handleDefaultResult(result, def);
|
|
2220
|
+
};
|
|
2221
|
+
});
|
|
2222
|
+
function handleDefaultResult(payload, def) {
|
|
2223
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2224
|
+
return payload;
|
|
2225
|
+
}
|
|
2226
|
+
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
2227
|
+
$ZodType.init(inst, def);
|
|
2228
|
+
inst._zod.optin = "optional";
|
|
2229
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2230
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2231
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2232
|
+
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2233
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2234
|
+
};
|
|
2235
|
+
});
|
|
2236
|
+
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2237
|
+
$ZodType.init(inst, def);
|
|
2238
|
+
defineLazy(inst._zod, "values", () => {
|
|
2239
|
+
const v = def.innerType._zod.values;
|
|
2240
|
+
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2241
|
+
});
|
|
2242
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2243
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2244
|
+
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
|
|
2245
|
+
return handleNonOptionalResult(result, inst);
|
|
2246
|
+
};
|
|
2247
|
+
});
|
|
2248
|
+
function handleNonOptionalResult(payload, inst) {
|
|
2249
|
+
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
2250
|
+
code: "invalid_type",
|
|
2251
|
+
expected: "nonoptional",
|
|
2252
|
+
input: payload.value,
|
|
2253
|
+
inst
|
|
2254
|
+
});
|
|
2255
|
+
return payload;
|
|
2256
|
+
}
|
|
2257
|
+
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2258
|
+
$ZodType.init(inst, def);
|
|
2259
|
+
inst._zod.optin = "optional";
|
|
2260
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2261
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2262
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2263
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2264
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2265
|
+
if (result instanceof Promise) return result.then((result) => {
|
|
2266
|
+
payload.value = result.value;
|
|
2267
|
+
if (result.issues.length) {
|
|
2268
|
+
payload.value = def.catchValue({
|
|
2269
|
+
...payload,
|
|
2270
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2271
|
+
input: payload.value
|
|
2272
|
+
});
|
|
2273
|
+
payload.issues = [];
|
|
2274
|
+
payload.fallback = true;
|
|
2275
|
+
}
|
|
2276
|
+
return payload;
|
|
2277
|
+
});
|
|
2278
|
+
payload.value = result.value;
|
|
2279
|
+
if (result.issues.length) {
|
|
2280
|
+
payload.value = def.catchValue({
|
|
2281
|
+
...payload,
|
|
2282
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2283
|
+
input: payload.value
|
|
2284
|
+
});
|
|
2285
|
+
payload.issues = [];
|
|
2286
|
+
payload.fallback = true;
|
|
2287
|
+
}
|
|
2288
|
+
return payload;
|
|
2289
|
+
};
|
|
2290
|
+
});
|
|
2291
|
+
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2292
|
+
$ZodType.init(inst, def);
|
|
2293
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
2294
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
2295
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
2296
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
2297
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2298
|
+
if (ctx.direction === "backward") {
|
|
2299
|
+
const right = def.out._zod.run(payload, ctx);
|
|
2300
|
+
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
2301
|
+
return handlePipeResult(right, def.in, ctx);
|
|
2302
|
+
}
|
|
2303
|
+
const left = def.in._zod.run(payload, ctx);
|
|
2304
|
+
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
2305
|
+
return handlePipeResult(left, def.out, ctx);
|
|
2306
|
+
};
|
|
2307
|
+
});
|
|
2308
|
+
function handlePipeResult(left, next, ctx) {
|
|
2309
|
+
if (left.issues.length) {
|
|
2310
|
+
left.aborted = true;
|
|
2311
|
+
return left;
|
|
2312
|
+
}
|
|
2313
|
+
return next._zod.run({
|
|
2314
|
+
value: left.value,
|
|
2315
|
+
issues: left.issues,
|
|
2316
|
+
fallback: left.fallback
|
|
2317
|
+
}, ctx);
|
|
2318
|
+
}
|
|
2319
|
+
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2320
|
+
$ZodType.init(inst, def);
|
|
2321
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
2322
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2323
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
2324
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
2325
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2326
|
+
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2327
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2328
|
+
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
2329
|
+
return handleReadonlyResult(result);
|
|
2330
|
+
};
|
|
2331
|
+
});
|
|
2332
|
+
function handleReadonlyResult(payload) {
|
|
2333
|
+
payload.value = Object.freeze(payload.value);
|
|
2334
|
+
return payload;
|
|
2335
|
+
}
|
|
2336
|
+
const $ZodLazy = /*@__PURE__*/ $constructor("$ZodLazy", (inst, def) => {
|
|
2337
|
+
$ZodType.init(inst, def);
|
|
2338
|
+
defineLazy(inst._zod, "innerType", () => {
|
|
2339
|
+
const d = def;
|
|
2340
|
+
if (!d._cachedInner) d._cachedInner = def.getter();
|
|
2341
|
+
return d._cachedInner;
|
|
2342
|
+
});
|
|
2343
|
+
defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
|
|
2344
|
+
defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
|
|
2345
|
+
defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? void 0);
|
|
2346
|
+
defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? void 0);
|
|
2347
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2348
|
+
return inst._zod.innerType._zod.run(payload, ctx);
|
|
2349
|
+
};
|
|
2350
|
+
});
|
|
2351
|
+
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2352
|
+
$ZodCheck.init(inst, def);
|
|
2353
|
+
$ZodType.init(inst, def);
|
|
2354
|
+
inst._zod.parse = (payload, _) => {
|
|
2355
|
+
return payload;
|
|
2356
|
+
};
|
|
2357
|
+
inst._zod.check = (payload) => {
|
|
2358
|
+
const input = payload.value;
|
|
2359
|
+
const r = def.fn(input);
|
|
2360
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2361
|
+
handleRefineResult(r, payload, input, inst);
|
|
2362
|
+
};
|
|
2363
|
+
});
|
|
2364
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
2365
|
+
if (!result) {
|
|
2366
|
+
const _iss = {
|
|
2367
|
+
code: "custom",
|
|
2368
|
+
input,
|
|
2369
|
+
inst,
|
|
2370
|
+
path: [...inst._zod.def.path ?? []],
|
|
2371
|
+
continue: !inst._zod.def.abort
|
|
2372
|
+
};
|
|
2373
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2374
|
+
payload.issues.push(issue(_iss));
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
//#endregion
|
|
2378
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
|
|
2379
|
+
var _a;
|
|
2380
|
+
var $ZodRegistry = class {
|
|
2381
|
+
constructor() {
|
|
2382
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
2383
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
2384
|
+
}
|
|
2385
|
+
add(schema, ..._meta) {
|
|
2386
|
+
const meta = _meta[0];
|
|
2387
|
+
this._map.set(schema, meta);
|
|
2388
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
2389
|
+
return this;
|
|
2390
|
+
}
|
|
2391
|
+
clear() {
|
|
2392
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
2393
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
2394
|
+
return this;
|
|
2395
|
+
}
|
|
2396
|
+
remove(schema) {
|
|
2397
|
+
const meta = this._map.get(schema);
|
|
2398
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
2399
|
+
this._map.delete(schema);
|
|
2400
|
+
return this;
|
|
2401
|
+
}
|
|
2402
|
+
get(schema) {
|
|
2403
|
+
const p = schema._zod.parent;
|
|
2404
|
+
if (p) {
|
|
2405
|
+
const pm = { ...this.get(p) ?? {} };
|
|
2406
|
+
delete pm.id;
|
|
2407
|
+
const f = {
|
|
2408
|
+
...pm,
|
|
2409
|
+
...this._map.get(schema)
|
|
2410
|
+
};
|
|
2411
|
+
return Object.keys(f).length ? f : void 0;
|
|
2412
|
+
}
|
|
2413
|
+
return this._map.get(schema);
|
|
2414
|
+
}
|
|
2415
|
+
has(schema) {
|
|
2416
|
+
return this._map.has(schema);
|
|
2417
|
+
}
|
|
2418
|
+
};
|
|
2419
|
+
function registry() {
|
|
2420
|
+
return new $ZodRegistry();
|
|
2421
|
+
}
|
|
2422
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2423
|
+
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2424
|
+
//#endregion
|
|
2425
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
|
|
2426
|
+
// @__NO_SIDE_EFFECTS__
|
|
2427
|
+
function _string(Class, params) {
|
|
2428
|
+
return new Class({
|
|
2429
|
+
type: "string",
|
|
2430
|
+
...normalizeParams(params)
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2433
|
+
// @__NO_SIDE_EFFECTS__
|
|
2434
|
+
function _email(Class, params) {
|
|
2435
|
+
return new Class({
|
|
2436
|
+
type: "string",
|
|
2437
|
+
format: "email",
|
|
2438
|
+
check: "string_format",
|
|
2439
|
+
abort: false,
|
|
2440
|
+
...normalizeParams(params)
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2443
|
+
// @__NO_SIDE_EFFECTS__
|
|
2444
|
+
function _guid(Class, params) {
|
|
2445
|
+
return new Class({
|
|
2446
|
+
type: "string",
|
|
2447
|
+
format: "guid",
|
|
2448
|
+
check: "string_format",
|
|
2449
|
+
abort: false,
|
|
2450
|
+
...normalizeParams(params)
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
// @__NO_SIDE_EFFECTS__
|
|
2454
|
+
function _uuid(Class, params) {
|
|
2455
|
+
return new Class({
|
|
2456
|
+
type: "string",
|
|
2457
|
+
format: "uuid",
|
|
2458
|
+
check: "string_format",
|
|
2459
|
+
abort: false,
|
|
2460
|
+
...normalizeParams(params)
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
// @__NO_SIDE_EFFECTS__
|
|
2464
|
+
function _uuidv4(Class, params) {
|
|
2465
|
+
return new Class({
|
|
2466
|
+
type: "string",
|
|
2467
|
+
format: "uuid",
|
|
2468
|
+
check: "string_format",
|
|
2469
|
+
abort: false,
|
|
2470
|
+
version: "v4",
|
|
2471
|
+
...normalizeParams(params)
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
// @__NO_SIDE_EFFECTS__
|
|
2475
|
+
function _uuidv6(Class, params) {
|
|
2476
|
+
return new Class({
|
|
2477
|
+
type: "string",
|
|
2478
|
+
format: "uuid",
|
|
2479
|
+
check: "string_format",
|
|
2480
|
+
abort: false,
|
|
2481
|
+
version: "v6",
|
|
2482
|
+
...normalizeParams(params)
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
// @__NO_SIDE_EFFECTS__
|
|
2486
|
+
function _uuidv7(Class, params) {
|
|
2487
|
+
return new Class({
|
|
2488
|
+
type: "string",
|
|
2489
|
+
format: "uuid",
|
|
2490
|
+
check: "string_format",
|
|
2491
|
+
abort: false,
|
|
2492
|
+
version: "v7",
|
|
2493
|
+
...normalizeParams(params)
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
// @__NO_SIDE_EFFECTS__
|
|
2497
|
+
function _url(Class, params) {
|
|
2498
|
+
return new Class({
|
|
2499
|
+
type: "string",
|
|
2500
|
+
format: "url",
|
|
2501
|
+
check: "string_format",
|
|
2502
|
+
abort: false,
|
|
2503
|
+
...normalizeParams(params)
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
// @__NO_SIDE_EFFECTS__
|
|
2507
|
+
function _emoji(Class, params) {
|
|
2508
|
+
return new Class({
|
|
2509
|
+
type: "string",
|
|
2510
|
+
format: "emoji",
|
|
2511
|
+
check: "string_format",
|
|
2512
|
+
abort: false,
|
|
2513
|
+
...normalizeParams(params)
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
// @__NO_SIDE_EFFECTS__
|
|
2517
|
+
function _nanoid(Class, params) {
|
|
2518
|
+
return new Class({
|
|
2519
|
+
type: "string",
|
|
2520
|
+
format: "nanoid",
|
|
2521
|
+
check: "string_format",
|
|
2522
|
+
abort: false,
|
|
2523
|
+
...normalizeParams(params)
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2526
|
+
/**
|
|
2527
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
2528
|
+
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
2529
|
+
* See https://github.com/paralleldrive/cuid.
|
|
2530
|
+
*/
|
|
2531
|
+
// @__NO_SIDE_EFFECTS__
|
|
2532
|
+
function _cuid(Class, params) {
|
|
2533
|
+
return new Class({
|
|
2534
|
+
type: "string",
|
|
2535
|
+
format: "cuid",
|
|
2536
|
+
check: "string_format",
|
|
2537
|
+
abort: false,
|
|
2538
|
+
...normalizeParams(params)
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
// @__NO_SIDE_EFFECTS__
|
|
2542
|
+
function _cuid2(Class, params) {
|
|
2543
|
+
return new Class({
|
|
2544
|
+
type: "string",
|
|
2545
|
+
format: "cuid2",
|
|
2546
|
+
check: "string_format",
|
|
2547
|
+
abort: false,
|
|
2548
|
+
...normalizeParams(params)
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
// @__NO_SIDE_EFFECTS__
|
|
2552
|
+
function _ulid(Class, params) {
|
|
2553
|
+
return new Class({
|
|
2554
|
+
type: "string",
|
|
2555
|
+
format: "ulid",
|
|
2556
|
+
check: "string_format",
|
|
2557
|
+
abort: false,
|
|
2558
|
+
...normalizeParams(params)
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2561
|
+
// @__NO_SIDE_EFFECTS__
|
|
2562
|
+
function _xid(Class, params) {
|
|
2563
|
+
return new Class({
|
|
2564
|
+
type: "string",
|
|
2565
|
+
format: "xid",
|
|
2566
|
+
check: "string_format",
|
|
2567
|
+
abort: false,
|
|
2568
|
+
...normalizeParams(params)
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
// @__NO_SIDE_EFFECTS__
|
|
2572
|
+
function _ksuid(Class, params) {
|
|
2573
|
+
return new Class({
|
|
2574
|
+
type: "string",
|
|
2575
|
+
format: "ksuid",
|
|
2576
|
+
check: "string_format",
|
|
2577
|
+
abort: false,
|
|
2578
|
+
...normalizeParams(params)
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
// @__NO_SIDE_EFFECTS__
|
|
2582
|
+
function _ipv4(Class, params) {
|
|
2583
|
+
return new Class({
|
|
2584
|
+
type: "string",
|
|
2585
|
+
format: "ipv4",
|
|
2586
|
+
check: "string_format",
|
|
2587
|
+
abort: false,
|
|
2588
|
+
...normalizeParams(params)
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
// @__NO_SIDE_EFFECTS__
|
|
2592
|
+
function _ipv6(Class, params) {
|
|
2593
|
+
return new Class({
|
|
2594
|
+
type: "string",
|
|
2595
|
+
format: "ipv6",
|
|
2596
|
+
check: "string_format",
|
|
2597
|
+
abort: false,
|
|
2598
|
+
...normalizeParams(params)
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
// @__NO_SIDE_EFFECTS__
|
|
2602
|
+
function _cidrv4(Class, params) {
|
|
2603
|
+
return new Class({
|
|
2604
|
+
type: "string",
|
|
2605
|
+
format: "cidrv4",
|
|
2606
|
+
check: "string_format",
|
|
2607
|
+
abort: false,
|
|
2608
|
+
...normalizeParams(params)
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2611
|
+
// @__NO_SIDE_EFFECTS__
|
|
2612
|
+
function _cidrv6(Class, params) {
|
|
2613
|
+
return new Class({
|
|
2614
|
+
type: "string",
|
|
2615
|
+
format: "cidrv6",
|
|
2616
|
+
check: "string_format",
|
|
2617
|
+
abort: false,
|
|
2618
|
+
...normalizeParams(params)
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2621
|
+
// @__NO_SIDE_EFFECTS__
|
|
2622
|
+
function _base64(Class, params) {
|
|
2623
|
+
return new Class({
|
|
2624
|
+
type: "string",
|
|
2625
|
+
format: "base64",
|
|
2626
|
+
check: "string_format",
|
|
2627
|
+
abort: false,
|
|
2628
|
+
...normalizeParams(params)
|
|
2629
|
+
});
|
|
2630
|
+
}
|
|
2631
|
+
// @__NO_SIDE_EFFECTS__
|
|
2632
|
+
function _base64url(Class, params) {
|
|
2633
|
+
return new Class({
|
|
2634
|
+
type: "string",
|
|
2635
|
+
format: "base64url",
|
|
2636
|
+
check: "string_format",
|
|
2637
|
+
abort: false,
|
|
2638
|
+
...normalizeParams(params)
|
|
2639
|
+
});
|
|
2640
|
+
}
|
|
2641
|
+
// @__NO_SIDE_EFFECTS__
|
|
2642
|
+
function _e164(Class, params) {
|
|
2643
|
+
return new Class({
|
|
2644
|
+
type: "string",
|
|
2645
|
+
format: "e164",
|
|
2646
|
+
check: "string_format",
|
|
2647
|
+
abort: false,
|
|
2648
|
+
...normalizeParams(params)
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
// @__NO_SIDE_EFFECTS__
|
|
2652
|
+
function _jwt(Class, params) {
|
|
2653
|
+
return new Class({
|
|
2654
|
+
type: "string",
|
|
2655
|
+
format: "jwt",
|
|
2656
|
+
check: "string_format",
|
|
2657
|
+
abort: false,
|
|
2658
|
+
...normalizeParams(params)
|
|
2659
|
+
});
|
|
2660
|
+
}
|
|
2661
|
+
// @__NO_SIDE_EFFECTS__
|
|
2662
|
+
function _isoDateTime(Class, params) {
|
|
2663
|
+
return new Class({
|
|
2664
|
+
type: "string",
|
|
2665
|
+
format: "datetime",
|
|
2666
|
+
check: "string_format",
|
|
2667
|
+
offset: false,
|
|
2668
|
+
local: false,
|
|
2669
|
+
precision: null,
|
|
2670
|
+
...normalizeParams(params)
|
|
2671
|
+
});
|
|
2672
|
+
}
|
|
2673
|
+
// @__NO_SIDE_EFFECTS__
|
|
2674
|
+
function _isoDate(Class, params) {
|
|
2675
|
+
return new Class({
|
|
2676
|
+
type: "string",
|
|
2677
|
+
format: "date",
|
|
2678
|
+
check: "string_format",
|
|
2679
|
+
...normalizeParams(params)
|
|
2680
|
+
});
|
|
2681
|
+
}
|
|
2682
|
+
// @__NO_SIDE_EFFECTS__
|
|
2683
|
+
function _isoTime(Class, params) {
|
|
2684
|
+
return new Class({
|
|
2685
|
+
type: "string",
|
|
2686
|
+
format: "time",
|
|
2687
|
+
check: "string_format",
|
|
2688
|
+
precision: null,
|
|
2689
|
+
...normalizeParams(params)
|
|
2690
|
+
});
|
|
2691
|
+
}
|
|
2692
|
+
// @__NO_SIDE_EFFECTS__
|
|
2693
|
+
function _isoDuration(Class, params) {
|
|
2694
|
+
return new Class({
|
|
2695
|
+
type: "string",
|
|
2696
|
+
format: "duration",
|
|
2697
|
+
check: "string_format",
|
|
2698
|
+
...normalizeParams(params)
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2701
|
+
// @__NO_SIDE_EFFECTS__
|
|
2702
|
+
function _number(Class, params) {
|
|
2703
|
+
return new Class({
|
|
2704
|
+
type: "number",
|
|
2705
|
+
checks: [],
|
|
2706
|
+
...normalizeParams(params)
|
|
2707
|
+
});
|
|
2708
|
+
}
|
|
2709
|
+
// @__NO_SIDE_EFFECTS__
|
|
2710
|
+
function _int(Class, params) {
|
|
2711
|
+
return new Class({
|
|
2712
|
+
type: "number",
|
|
2713
|
+
check: "number_format",
|
|
2714
|
+
abort: false,
|
|
2715
|
+
format: "safeint",
|
|
2716
|
+
...normalizeParams(params)
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
// @__NO_SIDE_EFFECTS__
|
|
2720
|
+
function _boolean(Class, params) {
|
|
2721
|
+
return new Class({
|
|
2722
|
+
type: "boolean",
|
|
2723
|
+
...normalizeParams(params)
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
// @__NO_SIDE_EFFECTS__
|
|
2727
|
+
function _undefined$1(Class, params) {
|
|
2728
|
+
return new Class({
|
|
2729
|
+
type: "undefined",
|
|
2730
|
+
...normalizeParams(params)
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
// @__NO_SIDE_EFFECTS__
|
|
2734
|
+
function _null$1(Class, params) {
|
|
2735
|
+
return new Class({
|
|
2736
|
+
type: "null",
|
|
2737
|
+
...normalizeParams(params)
|
|
2738
|
+
});
|
|
2739
|
+
}
|
|
2740
|
+
// @__NO_SIDE_EFFECTS__
|
|
2741
|
+
function _unknown(Class) {
|
|
2742
|
+
return new Class({ type: "unknown" });
|
|
2743
|
+
}
|
|
2744
|
+
// @__NO_SIDE_EFFECTS__
|
|
2745
|
+
function _never(Class, params) {
|
|
2746
|
+
return new Class({
|
|
2747
|
+
type: "never",
|
|
2748
|
+
...normalizeParams(params)
|
|
2749
|
+
});
|
|
2750
|
+
}
|
|
2751
|
+
// @__NO_SIDE_EFFECTS__
|
|
2752
|
+
function _lt(value, params) {
|
|
2753
|
+
return new $ZodCheckLessThan({
|
|
2754
|
+
check: "less_than",
|
|
2755
|
+
...normalizeParams(params),
|
|
2756
|
+
value,
|
|
2757
|
+
inclusive: false
|
|
2758
|
+
});
|
|
2759
|
+
}
|
|
2760
|
+
// @__NO_SIDE_EFFECTS__
|
|
2761
|
+
function _lte(value, params) {
|
|
2762
|
+
return new $ZodCheckLessThan({
|
|
2763
|
+
check: "less_than",
|
|
2764
|
+
...normalizeParams(params),
|
|
2765
|
+
value,
|
|
2766
|
+
inclusive: true
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2769
|
+
// @__NO_SIDE_EFFECTS__
|
|
2770
|
+
function _gt(value, params) {
|
|
2771
|
+
return new $ZodCheckGreaterThan({
|
|
2772
|
+
check: "greater_than",
|
|
2773
|
+
...normalizeParams(params),
|
|
2774
|
+
value,
|
|
2775
|
+
inclusive: false
|
|
2776
|
+
});
|
|
2777
|
+
}
|
|
2778
|
+
// @__NO_SIDE_EFFECTS__
|
|
2779
|
+
function _gte(value, params) {
|
|
2780
|
+
return new $ZodCheckGreaterThan({
|
|
2781
|
+
check: "greater_than",
|
|
2782
|
+
...normalizeParams(params),
|
|
2783
|
+
value,
|
|
2784
|
+
inclusive: true
|
|
2785
|
+
});
|
|
2786
|
+
}
|
|
2787
|
+
// @__NO_SIDE_EFFECTS__
|
|
2788
|
+
function _multipleOf(value, params) {
|
|
2789
|
+
return new $ZodCheckMultipleOf({
|
|
2790
|
+
check: "multiple_of",
|
|
2791
|
+
...normalizeParams(params),
|
|
2792
|
+
value
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
// @__NO_SIDE_EFFECTS__
|
|
2796
|
+
function _maxLength(maximum, params) {
|
|
2797
|
+
return new $ZodCheckMaxLength({
|
|
2798
|
+
check: "max_length",
|
|
2799
|
+
...normalizeParams(params),
|
|
2800
|
+
maximum
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
// @__NO_SIDE_EFFECTS__
|
|
2804
|
+
function _minLength(minimum, params) {
|
|
2805
|
+
return new $ZodCheckMinLength({
|
|
2806
|
+
check: "min_length",
|
|
2807
|
+
...normalizeParams(params),
|
|
2808
|
+
minimum
|
|
2809
|
+
});
|
|
2810
|
+
}
|
|
2811
|
+
// @__NO_SIDE_EFFECTS__
|
|
2812
|
+
function _length(length, params) {
|
|
2813
|
+
return new $ZodCheckLengthEquals({
|
|
2814
|
+
check: "length_equals",
|
|
2815
|
+
...normalizeParams(params),
|
|
2816
|
+
length
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
// @__NO_SIDE_EFFECTS__
|
|
2820
|
+
function _regex(pattern, params) {
|
|
2821
|
+
return new $ZodCheckRegex({
|
|
2822
|
+
check: "string_format",
|
|
2823
|
+
format: "regex",
|
|
2824
|
+
...normalizeParams(params),
|
|
2825
|
+
pattern
|
|
2826
|
+
});
|
|
2827
|
+
}
|
|
2828
|
+
// @__NO_SIDE_EFFECTS__
|
|
2829
|
+
function _lowercase(params) {
|
|
2830
|
+
return new $ZodCheckLowerCase({
|
|
2831
|
+
check: "string_format",
|
|
2832
|
+
format: "lowercase",
|
|
2833
|
+
...normalizeParams(params)
|
|
2834
|
+
});
|
|
2835
|
+
}
|
|
2836
|
+
// @__NO_SIDE_EFFECTS__
|
|
2837
|
+
function _uppercase(params) {
|
|
2838
|
+
return new $ZodCheckUpperCase({
|
|
2839
|
+
check: "string_format",
|
|
2840
|
+
format: "uppercase",
|
|
2841
|
+
...normalizeParams(params)
|
|
2842
|
+
});
|
|
2843
|
+
}
|
|
2844
|
+
// @__NO_SIDE_EFFECTS__
|
|
2845
|
+
function _includes(includes, params) {
|
|
2846
|
+
return new $ZodCheckIncludes({
|
|
2847
|
+
check: "string_format",
|
|
2848
|
+
format: "includes",
|
|
2849
|
+
...normalizeParams(params),
|
|
2850
|
+
includes
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
// @__NO_SIDE_EFFECTS__
|
|
2854
|
+
function _startsWith(prefix, params) {
|
|
2855
|
+
return new $ZodCheckStartsWith({
|
|
2856
|
+
check: "string_format",
|
|
2857
|
+
format: "starts_with",
|
|
2858
|
+
...normalizeParams(params),
|
|
2859
|
+
prefix
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
// @__NO_SIDE_EFFECTS__
|
|
2863
|
+
function _endsWith(suffix, params) {
|
|
2864
|
+
return new $ZodCheckEndsWith({
|
|
2865
|
+
check: "string_format",
|
|
2866
|
+
format: "ends_with",
|
|
2867
|
+
...normalizeParams(params),
|
|
2868
|
+
suffix
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
// @__NO_SIDE_EFFECTS__
|
|
2872
|
+
function _overwrite(tx) {
|
|
2873
|
+
return new $ZodCheckOverwrite({
|
|
2874
|
+
check: "overwrite",
|
|
2875
|
+
tx
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
// @__NO_SIDE_EFFECTS__
|
|
2879
|
+
function _normalize(form) {
|
|
2880
|
+
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
2881
|
+
}
|
|
2882
|
+
// @__NO_SIDE_EFFECTS__
|
|
2883
|
+
function _trim() {
|
|
2884
|
+
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
2885
|
+
}
|
|
2886
|
+
// @__NO_SIDE_EFFECTS__
|
|
2887
|
+
function _toLowerCase() {
|
|
2888
|
+
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
2889
|
+
}
|
|
2890
|
+
// @__NO_SIDE_EFFECTS__
|
|
2891
|
+
function _toUpperCase() {
|
|
2892
|
+
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
2893
|
+
}
|
|
2894
|
+
// @__NO_SIDE_EFFECTS__
|
|
2895
|
+
function _slugify() {
|
|
2896
|
+
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
2897
|
+
}
|
|
2898
|
+
// @__NO_SIDE_EFFECTS__
|
|
2899
|
+
function _array(Class, element, params) {
|
|
2900
|
+
return new Class({
|
|
2901
|
+
type: "array",
|
|
2902
|
+
element,
|
|
2903
|
+
...normalizeParams(params)
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
// @__NO_SIDE_EFFECTS__
|
|
2907
|
+
function _refine(Class, fn, _params) {
|
|
2908
|
+
return new Class({
|
|
2909
|
+
type: "custom",
|
|
2910
|
+
check: "custom",
|
|
2911
|
+
fn,
|
|
2912
|
+
...normalizeParams(_params)
|
|
2913
|
+
});
|
|
2914
|
+
}
|
|
2915
|
+
// @__NO_SIDE_EFFECTS__
|
|
2916
|
+
function _superRefine(fn, params) {
|
|
2917
|
+
const ch = /* @__PURE__ */ _check((payload) => {
|
|
2918
|
+
payload.addIssue = (issue$2) => {
|
|
2919
|
+
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
|
|
2920
|
+
else {
|
|
2921
|
+
const _issue = issue$2;
|
|
2922
|
+
if (_issue.fatal) _issue.continue = false;
|
|
2923
|
+
_issue.code ?? (_issue.code = "custom");
|
|
2924
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
2925
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
2926
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2927
|
+
payload.issues.push(issue(_issue));
|
|
2928
|
+
}
|
|
2929
|
+
};
|
|
2930
|
+
return fn(payload.value, payload);
|
|
2931
|
+
}, params);
|
|
2932
|
+
return ch;
|
|
2933
|
+
}
|
|
2934
|
+
// @__NO_SIDE_EFFECTS__
|
|
2935
|
+
function _check(fn, params) {
|
|
2936
|
+
const ch = new $ZodCheck({
|
|
2937
|
+
check: "custom",
|
|
2938
|
+
...normalizeParams(params)
|
|
2939
|
+
});
|
|
2940
|
+
ch._zod.check = fn;
|
|
2941
|
+
return ch;
|
|
2942
|
+
}
|
|
2943
|
+
//#endregion
|
|
2944
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
|
|
2945
|
+
function initializeContext(params) {
|
|
2946
|
+
let target = params?.target ?? "draft-2020-12";
|
|
2947
|
+
if (target === "draft-4") target = "draft-04";
|
|
2948
|
+
if (target === "draft-7") target = "draft-07";
|
|
2949
|
+
return {
|
|
2950
|
+
processors: params.processors ?? {},
|
|
2951
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
2952
|
+
target,
|
|
2953
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
2954
|
+
override: params?.override ?? (() => {}),
|
|
2955
|
+
io: params?.io ?? "output",
|
|
2956
|
+
counter: 0,
|
|
2957
|
+
seen: /* @__PURE__ */ new Map(),
|
|
2958
|
+
cycles: params?.cycles ?? "ref",
|
|
2959
|
+
reused: params?.reused ?? "inline",
|
|
2960
|
+
external: params?.external ?? void 0
|
|
2961
|
+
};
|
|
2962
|
+
}
|
|
2963
|
+
function process(schema, ctx, _params = {
|
|
2964
|
+
path: [],
|
|
2965
|
+
schemaPath: []
|
|
2966
|
+
}) {
|
|
2967
|
+
var _a;
|
|
2968
|
+
const def = schema._zod.def;
|
|
2969
|
+
const seen = ctx.seen.get(schema);
|
|
2970
|
+
if (seen) {
|
|
2971
|
+
seen.count++;
|
|
2972
|
+
if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
|
|
2973
|
+
return seen.schema;
|
|
2974
|
+
}
|
|
2975
|
+
const result = {
|
|
2976
|
+
schema: {},
|
|
2977
|
+
count: 1,
|
|
2978
|
+
cycle: void 0,
|
|
2979
|
+
path: _params.path
|
|
2980
|
+
};
|
|
2981
|
+
ctx.seen.set(schema, result);
|
|
2982
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2983
|
+
if (overrideSchema) result.schema = overrideSchema;
|
|
2984
|
+
else {
|
|
2985
|
+
const params = {
|
|
2986
|
+
..._params,
|
|
2987
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
2988
|
+
path: _params.path
|
|
2989
|
+
};
|
|
2990
|
+
if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
2991
|
+
else {
|
|
2992
|
+
const _json = result.schema;
|
|
2993
|
+
const processor = ctx.processors[def.type];
|
|
2994
|
+
if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
2995
|
+
processor(schema, ctx, _json, params);
|
|
2996
|
+
}
|
|
2997
|
+
const parent = schema._zod.parent;
|
|
2998
|
+
if (parent) {
|
|
2999
|
+
if (!result.ref) result.ref = parent;
|
|
3000
|
+
process(parent, ctx, params);
|
|
3001
|
+
ctx.seen.get(parent).isParent = true;
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
3005
|
+
if (meta) Object.assign(result.schema, meta);
|
|
3006
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
3007
|
+
delete result.schema.examples;
|
|
3008
|
+
delete result.schema.default;
|
|
3009
|
+
}
|
|
3010
|
+
if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
3011
|
+
delete result.schema._prefault;
|
|
3012
|
+
return ctx.seen.get(schema).schema;
|
|
3013
|
+
}
|
|
3014
|
+
function extractDefs(ctx, schema) {
|
|
3015
|
+
const root = ctx.seen.get(schema);
|
|
3016
|
+
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3017
|
+
const idToSchema = /* @__PURE__ */ new Map();
|
|
3018
|
+
for (const entry of ctx.seen.entries()) {
|
|
3019
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
3020
|
+
if (id) {
|
|
3021
|
+
const existing = idToSchema.get(id);
|
|
3022
|
+
if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
3023
|
+
idToSchema.set(id, entry[0]);
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
const makeURI = (entry) => {
|
|
3027
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
3028
|
+
if (ctx.external) {
|
|
3029
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
3030
|
+
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
3031
|
+
if (externalId) return { ref: uriGenerator(externalId) };
|
|
3032
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
3033
|
+
entry[1].defId = id;
|
|
3034
|
+
return {
|
|
3035
|
+
defId: id,
|
|
3036
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
3037
|
+
};
|
|
3038
|
+
}
|
|
3039
|
+
if (entry[1] === root) return { ref: "#" };
|
|
3040
|
+
const defUriPrefix = `#/${defsSegment}/`;
|
|
3041
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
3042
|
+
return {
|
|
3043
|
+
defId,
|
|
3044
|
+
ref: defUriPrefix + defId
|
|
3045
|
+
};
|
|
3046
|
+
};
|
|
3047
|
+
const extractToDef = (entry) => {
|
|
3048
|
+
if (entry[1].schema.$ref) return;
|
|
3049
|
+
const seen = entry[1];
|
|
3050
|
+
const { ref, defId } = makeURI(entry);
|
|
3051
|
+
seen.def = { ...seen.schema };
|
|
3052
|
+
if (defId) seen.defId = defId;
|
|
3053
|
+
const schema = seen.schema;
|
|
3054
|
+
for (const key in schema) delete schema[key];
|
|
3055
|
+
schema.$ref = ref;
|
|
3056
|
+
};
|
|
3057
|
+
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
3058
|
+
const seen = entry[1];
|
|
3059
|
+
if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
3060
|
+
|
|
3061
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
3062
|
+
}
|
|
3063
|
+
for (const entry of ctx.seen.entries()) {
|
|
3064
|
+
const seen = entry[1];
|
|
3065
|
+
if (schema === entry[0]) {
|
|
3066
|
+
extractToDef(entry);
|
|
3067
|
+
continue;
|
|
3068
|
+
}
|
|
3069
|
+
if (ctx.external) {
|
|
3070
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
3071
|
+
if (schema !== entry[0] && ext) {
|
|
3072
|
+
extractToDef(entry);
|
|
3073
|
+
continue;
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
if (ctx.metadataRegistry.get(entry[0])?.id) {
|
|
3077
|
+
extractToDef(entry);
|
|
3078
|
+
continue;
|
|
3079
|
+
}
|
|
3080
|
+
if (seen.cycle) {
|
|
3081
|
+
extractToDef(entry);
|
|
3082
|
+
continue;
|
|
3083
|
+
}
|
|
3084
|
+
if (seen.count > 1) {
|
|
3085
|
+
if (ctx.reused === "ref") {
|
|
3086
|
+
extractToDef(entry);
|
|
3087
|
+
continue;
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
function finalize(ctx, schema) {
|
|
3093
|
+
const root = ctx.seen.get(schema);
|
|
3094
|
+
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3095
|
+
const flattenRef = (zodSchema) => {
|
|
3096
|
+
const seen = ctx.seen.get(zodSchema);
|
|
3097
|
+
if (seen.ref === null) return;
|
|
3098
|
+
const schema = seen.def ?? seen.schema;
|
|
3099
|
+
const _cached = { ...schema };
|
|
3100
|
+
const ref = seen.ref;
|
|
3101
|
+
seen.ref = null;
|
|
3102
|
+
if (ref) {
|
|
3103
|
+
flattenRef(ref);
|
|
3104
|
+
const refSeen = ctx.seen.get(ref);
|
|
3105
|
+
const refSchema = refSeen.schema;
|
|
3106
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
3107
|
+
schema.allOf = schema.allOf ?? [];
|
|
3108
|
+
schema.allOf.push(refSchema);
|
|
3109
|
+
} else Object.assign(schema, refSchema);
|
|
3110
|
+
Object.assign(schema, _cached);
|
|
3111
|
+
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
3112
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
3113
|
+
if (!(key in _cached)) delete schema[key];
|
|
3114
|
+
}
|
|
3115
|
+
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
3116
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
3117
|
+
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
const parent = zodSchema._zod.parent;
|
|
3121
|
+
if (parent && parent !== ref) {
|
|
3122
|
+
flattenRef(parent);
|
|
3123
|
+
const parentSeen = ctx.seen.get(parent);
|
|
3124
|
+
if (parentSeen?.schema.$ref) {
|
|
3125
|
+
schema.$ref = parentSeen.schema.$ref;
|
|
3126
|
+
if (parentSeen.def) for (const key in schema) {
|
|
3127
|
+
if (key === "$ref" || key === "allOf") continue;
|
|
3128
|
+
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
|
|
3129
|
+
}
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
ctx.override({
|
|
3133
|
+
zodSchema,
|
|
3134
|
+
jsonSchema: schema,
|
|
3135
|
+
path: seen.path ?? []
|
|
3136
|
+
});
|
|
3137
|
+
};
|
|
3138
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
3139
|
+
const result = {};
|
|
3140
|
+
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
3141
|
+
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
3142
|
+
else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
3143
|
+
else if (ctx.target === "openapi-3.0") {}
|
|
3144
|
+
if (ctx.external?.uri) {
|
|
3145
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
3146
|
+
if (!id) throw new Error("Schema is missing an `id` property");
|
|
3147
|
+
result.$id = ctx.external.uri(id);
|
|
3148
|
+
}
|
|
3149
|
+
Object.assign(result, root.def ?? root.schema);
|
|
3150
|
+
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
3151
|
+
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
3152
|
+
const defs = ctx.external?.defs ?? {};
|
|
3153
|
+
for (const entry of ctx.seen.entries()) {
|
|
3154
|
+
const seen = entry[1];
|
|
3155
|
+
if (seen.def && seen.defId) {
|
|
3156
|
+
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
3157
|
+
defs[seen.defId] = seen.def;
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
3161
|
+
else result.definitions = defs;
|
|
3162
|
+
try {
|
|
3163
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
3164
|
+
Object.defineProperty(finalized, "~standard", {
|
|
3165
|
+
value: {
|
|
3166
|
+
...schema["~standard"],
|
|
3167
|
+
jsonSchema: {
|
|
3168
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
3169
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
3170
|
+
}
|
|
3171
|
+
},
|
|
3172
|
+
enumerable: false,
|
|
3173
|
+
writable: false
|
|
3174
|
+
});
|
|
3175
|
+
return finalized;
|
|
3176
|
+
} catch (_err) {
|
|
3177
|
+
throw new Error("Error converting schema to JSON.");
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
function isTransforming(_schema, _ctx) {
|
|
3181
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
3182
|
+
if (ctx.seen.has(_schema)) return false;
|
|
3183
|
+
ctx.seen.add(_schema);
|
|
3184
|
+
const def = _schema._zod.def;
|
|
3185
|
+
if (def.type === "transform") return true;
|
|
3186
|
+
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
3187
|
+
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
3188
|
+
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
3189
|
+
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);
|
|
3190
|
+
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
3191
|
+
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3192
|
+
if (def.type === "pipe") {
|
|
3193
|
+
if (_schema._zod.traits.has("$ZodCodec")) return true;
|
|
3194
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
3195
|
+
}
|
|
3196
|
+
if (def.type === "object") {
|
|
3197
|
+
for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
|
|
3198
|
+
return false;
|
|
3199
|
+
}
|
|
3200
|
+
if (def.type === "union") {
|
|
3201
|
+
for (const option of def.options) if (isTransforming(option, ctx)) return true;
|
|
3202
|
+
return false;
|
|
3203
|
+
}
|
|
3204
|
+
if (def.type === "tuple") {
|
|
3205
|
+
for (const item of def.items) if (isTransforming(item, ctx)) return true;
|
|
3206
|
+
if (def.rest && isTransforming(def.rest, ctx)) return true;
|
|
3207
|
+
return false;
|
|
3208
|
+
}
|
|
3209
|
+
return false;
|
|
3210
|
+
}
|
|
3211
|
+
/**
|
|
3212
|
+
* Creates a toJSONSchema method for a schema instance.
|
|
3213
|
+
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
3214
|
+
*/
|
|
3215
|
+
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
3216
|
+
const ctx = initializeContext({
|
|
3217
|
+
...params,
|
|
3218
|
+
processors
|
|
3219
|
+
});
|
|
3220
|
+
process(schema, ctx);
|
|
3221
|
+
extractDefs(ctx, schema);
|
|
3222
|
+
return finalize(ctx, schema);
|
|
3223
|
+
};
|
|
3224
|
+
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
3225
|
+
const { libraryOptions, target } = params ?? {};
|
|
3226
|
+
const ctx = initializeContext({
|
|
3227
|
+
...libraryOptions ?? {},
|
|
3228
|
+
target,
|
|
3229
|
+
io,
|
|
3230
|
+
processors
|
|
3231
|
+
});
|
|
3232
|
+
process(schema, ctx);
|
|
3233
|
+
extractDefs(ctx, schema);
|
|
3234
|
+
return finalize(ctx, schema);
|
|
3235
|
+
};
|
|
3236
|
+
//#endregion
|
|
3237
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
|
|
3238
|
+
const formatMap = {
|
|
3239
|
+
guid: "uuid",
|
|
3240
|
+
url: "uri",
|
|
3241
|
+
datetime: "date-time",
|
|
3242
|
+
json_string: "json-string",
|
|
3243
|
+
regex: ""
|
|
3244
|
+
};
|
|
3245
|
+
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3246
|
+
const json = _json;
|
|
3247
|
+
json.type = "string";
|
|
3248
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
3249
|
+
if (typeof minimum === "number") json.minLength = minimum;
|
|
3250
|
+
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3251
|
+
if (format) {
|
|
3252
|
+
json.format = formatMap[format] ?? format;
|
|
3253
|
+
if (json.format === "") delete json.format;
|
|
3254
|
+
if (format === "time") delete json.format;
|
|
3255
|
+
}
|
|
3256
|
+
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3257
|
+
if (patterns && patterns.size > 0) {
|
|
3258
|
+
const regexes = [...patterns];
|
|
3259
|
+
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
3260
|
+
else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
|
|
3261
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3262
|
+
pattern: regex.source
|
|
3263
|
+
}))];
|
|
3264
|
+
}
|
|
3265
|
+
};
|
|
3266
|
+
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
3267
|
+
const json = _json;
|
|
3268
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
3269
|
+
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
3270
|
+
else json.type = "number";
|
|
3271
|
+
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
3272
|
+
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
3273
|
+
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
3274
|
+
if (exMin) if (legacy) {
|
|
3275
|
+
json.minimum = exclusiveMinimum;
|
|
3276
|
+
json.exclusiveMinimum = true;
|
|
3277
|
+
} else json.exclusiveMinimum = exclusiveMinimum;
|
|
3278
|
+
else if (typeof minimum === "number") json.minimum = minimum;
|
|
3279
|
+
if (exMax) if (legacy) {
|
|
3280
|
+
json.maximum = exclusiveMaximum;
|
|
3281
|
+
json.exclusiveMaximum = true;
|
|
3282
|
+
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3283
|
+
else if (typeof maximum === "number") json.maximum = maximum;
|
|
3284
|
+
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
3285
|
+
};
|
|
3286
|
+
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3287
|
+
json.type = "boolean";
|
|
3288
|
+
};
|
|
3289
|
+
const nullProcessor = (_schema, ctx, json, _params) => {
|
|
3290
|
+
if (ctx.target === "openapi-3.0") {
|
|
3291
|
+
json.type = "string";
|
|
3292
|
+
json.nullable = true;
|
|
3293
|
+
json.enum = [null];
|
|
3294
|
+
} else json.type = "null";
|
|
3295
|
+
};
|
|
3296
|
+
const undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
3297
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
3298
|
+
};
|
|
3299
|
+
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3300
|
+
json.not = {};
|
|
3301
|
+
};
|
|
3302
|
+
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3303
|
+
const def = schema._zod.def;
|
|
3304
|
+
const values = getEnumValues(def.entries);
|
|
3305
|
+
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
3306
|
+
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3307
|
+
json.enum = values;
|
|
3308
|
+
};
|
|
3309
|
+
const literalProcessor = (schema, ctx, json, _params) => {
|
|
3310
|
+
const def = schema._zod.def;
|
|
3311
|
+
const vals = [];
|
|
3312
|
+
for (const val of def.values) if (val === void 0) {
|
|
3313
|
+
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
3314
|
+
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
3315
|
+
else vals.push(Number(val));
|
|
3316
|
+
else vals.push(val);
|
|
3317
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
3318
|
+
const val = vals[0];
|
|
3319
|
+
json.type = val === null ? "null" : typeof val;
|
|
3320
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
3321
|
+
else json.const = val;
|
|
3322
|
+
} else {
|
|
3323
|
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
3324
|
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
3325
|
+
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
3326
|
+
if (vals.every((v) => v === null)) json.type = "null";
|
|
3327
|
+
json.enum = vals;
|
|
3328
|
+
}
|
|
3329
|
+
};
|
|
3330
|
+
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
3331
|
+
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3332
|
+
};
|
|
3333
|
+
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
3334
|
+
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3335
|
+
};
|
|
3336
|
+
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3337
|
+
const json = _json;
|
|
3338
|
+
const def = schema._zod.def;
|
|
3339
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
3340
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
3341
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3342
|
+
json.type = "array";
|
|
3343
|
+
json.items = process(def.element, ctx, {
|
|
3344
|
+
...params,
|
|
3345
|
+
path: [...params.path, "items"]
|
|
3346
|
+
});
|
|
3347
|
+
};
|
|
3348
|
+
const objectProcessor = (schema, ctx, _json, params) => {
|
|
3349
|
+
const json = _json;
|
|
3350
|
+
const def = schema._zod.def;
|
|
3351
|
+
json.type = "object";
|
|
3352
|
+
json.properties = {};
|
|
3353
|
+
const shape = def.shape;
|
|
3354
|
+
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
3355
|
+
...params,
|
|
3356
|
+
path: [
|
|
3357
|
+
...params.path,
|
|
3358
|
+
"properties",
|
|
3359
|
+
key
|
|
3360
|
+
]
|
|
3361
|
+
});
|
|
3362
|
+
const allKeys = new Set(Object.keys(shape));
|
|
3363
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3364
|
+
const v = def.shape[key]._zod;
|
|
3365
|
+
if (ctx.io === "input") return v.optin === void 0;
|
|
3366
|
+
else return v.optout === void 0;
|
|
3367
|
+
}));
|
|
3368
|
+
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
3369
|
+
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
3370
|
+
else if (!def.catchall) {
|
|
3371
|
+
if (ctx.io === "output") json.additionalProperties = false;
|
|
3372
|
+
} else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
|
|
3373
|
+
...params,
|
|
3374
|
+
path: [...params.path, "additionalProperties"]
|
|
3375
|
+
});
|
|
3376
|
+
};
|
|
3377
|
+
const unionProcessor = (schema, ctx, json, params) => {
|
|
3378
|
+
const def = schema._zod.def;
|
|
3379
|
+
const isExclusive = def.inclusive === false;
|
|
3380
|
+
const options = def.options.map((x, i) => process(x, ctx, {
|
|
3381
|
+
...params,
|
|
3382
|
+
path: [
|
|
3383
|
+
...params.path,
|
|
3384
|
+
isExclusive ? "oneOf" : "anyOf",
|
|
3385
|
+
i
|
|
3386
|
+
]
|
|
3387
|
+
}));
|
|
3388
|
+
if (isExclusive) json.oneOf = options;
|
|
3389
|
+
else json.anyOf = options;
|
|
3390
|
+
};
|
|
3391
|
+
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
3392
|
+
const def = schema._zod.def;
|
|
3393
|
+
const a = process(def.left, ctx, {
|
|
3394
|
+
...params,
|
|
3395
|
+
path: [
|
|
3396
|
+
...params.path,
|
|
3397
|
+
"allOf",
|
|
3398
|
+
0
|
|
3399
|
+
]
|
|
3400
|
+
});
|
|
3401
|
+
const b = process(def.right, ctx, {
|
|
3402
|
+
...params,
|
|
3403
|
+
path: [
|
|
3404
|
+
...params.path,
|
|
3405
|
+
"allOf",
|
|
3406
|
+
1
|
|
3407
|
+
]
|
|
3408
|
+
});
|
|
3409
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3410
|
+
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
3411
|
+
};
|
|
3412
|
+
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
3413
|
+
const json = _json;
|
|
3414
|
+
const def = schema._zod.def;
|
|
3415
|
+
json.type = "array";
|
|
3416
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
3417
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
3418
|
+
const prefixItems = def.items.map((x, i) => process(x, ctx, {
|
|
3419
|
+
...params,
|
|
3420
|
+
path: [
|
|
3421
|
+
...params.path,
|
|
3422
|
+
prefixPath,
|
|
3423
|
+
i
|
|
3424
|
+
]
|
|
3425
|
+
}));
|
|
3426
|
+
const rest = def.rest ? process(def.rest, ctx, {
|
|
3427
|
+
...params,
|
|
3428
|
+
path: [
|
|
3429
|
+
...params.path,
|
|
3430
|
+
restPath,
|
|
3431
|
+
...ctx.target === "openapi-3.0" ? [def.items.length] : []
|
|
3432
|
+
]
|
|
3433
|
+
}) : null;
|
|
3434
|
+
if (ctx.target === "draft-2020-12") {
|
|
3435
|
+
json.prefixItems = prefixItems;
|
|
3436
|
+
if (rest) json.items = rest;
|
|
3437
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
3438
|
+
json.items = { anyOf: prefixItems };
|
|
3439
|
+
if (rest) json.items.anyOf.push(rest);
|
|
3440
|
+
json.minItems = prefixItems.length;
|
|
3441
|
+
if (!rest) json.maxItems = prefixItems.length;
|
|
3442
|
+
} else {
|
|
3443
|
+
json.items = prefixItems;
|
|
3444
|
+
if (rest) json.additionalItems = rest;
|
|
3445
|
+
}
|
|
3446
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
3447
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
3448
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3449
|
+
};
|
|
3450
|
+
const recordProcessor = (schema, ctx, _json, params) => {
|
|
3451
|
+
const json = _json;
|
|
3452
|
+
const def = schema._zod.def;
|
|
3453
|
+
json.type = "object";
|
|
3454
|
+
const keyType = def.keyType;
|
|
3455
|
+
const patterns = keyType._zod.bag?.patterns;
|
|
3456
|
+
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
3457
|
+
const valueSchema = process(def.valueType, ctx, {
|
|
3458
|
+
...params,
|
|
3459
|
+
path: [
|
|
3460
|
+
...params.path,
|
|
3461
|
+
"patternProperties",
|
|
3462
|
+
"*"
|
|
3463
|
+
]
|
|
3464
|
+
});
|
|
3465
|
+
json.patternProperties = {};
|
|
3466
|
+
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
3467
|
+
} else {
|
|
3468
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process(def.keyType, ctx, {
|
|
3469
|
+
...params,
|
|
3470
|
+
path: [...params.path, "propertyNames"]
|
|
3471
|
+
});
|
|
3472
|
+
json.additionalProperties = process(def.valueType, ctx, {
|
|
3473
|
+
...params,
|
|
3474
|
+
path: [...params.path, "additionalProperties"]
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
const keyValues = keyType._zod.values;
|
|
3478
|
+
if (keyValues) {
|
|
3479
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
3480
|
+
if (validKeyValues.length > 0) json.required = validKeyValues;
|
|
3481
|
+
}
|
|
3482
|
+
};
|
|
3483
|
+
const nullableProcessor = (schema, ctx, json, params) => {
|
|
3484
|
+
const def = schema._zod.def;
|
|
3485
|
+
const inner = process(def.innerType, ctx, params);
|
|
3486
|
+
const seen = ctx.seen.get(schema);
|
|
3487
|
+
if (ctx.target === "openapi-3.0") {
|
|
3488
|
+
seen.ref = def.innerType;
|
|
3489
|
+
json.nullable = true;
|
|
3490
|
+
} else json.anyOf = [inner, { type: "null" }];
|
|
3491
|
+
};
|
|
3492
|
+
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
3493
|
+
const def = schema._zod.def;
|
|
3494
|
+
process(def.innerType, ctx, params);
|
|
3495
|
+
const seen = ctx.seen.get(schema);
|
|
3496
|
+
seen.ref = def.innerType;
|
|
3497
|
+
};
|
|
3498
|
+
const defaultProcessor = (schema, ctx, json, params) => {
|
|
3499
|
+
const def = schema._zod.def;
|
|
3500
|
+
process(def.innerType, ctx, params);
|
|
3501
|
+
const seen = ctx.seen.get(schema);
|
|
3502
|
+
seen.ref = def.innerType;
|
|
3503
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
3504
|
+
};
|
|
3505
|
+
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
3506
|
+
const def = schema._zod.def;
|
|
3507
|
+
process(def.innerType, ctx, params);
|
|
3508
|
+
const seen = ctx.seen.get(schema);
|
|
3509
|
+
seen.ref = def.innerType;
|
|
3510
|
+
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
3511
|
+
};
|
|
3512
|
+
const catchProcessor = (schema, ctx, json, params) => {
|
|
3513
|
+
const def = schema._zod.def;
|
|
3514
|
+
process(def.innerType, ctx, params);
|
|
3515
|
+
const seen = ctx.seen.get(schema);
|
|
3516
|
+
seen.ref = def.innerType;
|
|
3517
|
+
let catchValue;
|
|
3518
|
+
try {
|
|
3519
|
+
catchValue = def.catchValue(void 0);
|
|
3520
|
+
} catch {
|
|
3521
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
3522
|
+
}
|
|
3523
|
+
json.default = catchValue;
|
|
3524
|
+
};
|
|
3525
|
+
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
3526
|
+
const def = schema._zod.def;
|
|
3527
|
+
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
3528
|
+
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
3529
|
+
process(innerType, ctx, params);
|
|
3530
|
+
const seen = ctx.seen.get(schema);
|
|
3531
|
+
seen.ref = innerType;
|
|
3532
|
+
};
|
|
3533
|
+
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
3534
|
+
const def = schema._zod.def;
|
|
3535
|
+
process(def.innerType, ctx, params);
|
|
3536
|
+
const seen = ctx.seen.get(schema);
|
|
3537
|
+
seen.ref = def.innerType;
|
|
3538
|
+
json.readOnly = true;
|
|
3539
|
+
};
|
|
3540
|
+
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
3541
|
+
const def = schema._zod.def;
|
|
3542
|
+
process(def.innerType, ctx, params);
|
|
3543
|
+
const seen = ctx.seen.get(schema);
|
|
3544
|
+
seen.ref = def.innerType;
|
|
3545
|
+
};
|
|
3546
|
+
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
3547
|
+
const innerType = schema._zod.innerType;
|
|
3548
|
+
process(innerType, ctx, params);
|
|
3549
|
+
const seen = ctx.seen.get(schema);
|
|
3550
|
+
seen.ref = innerType;
|
|
3551
|
+
};
|
|
3552
|
+
//#endregion
|
|
3553
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
|
|
3554
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
3555
|
+
$ZodISODateTime.init(inst, def);
|
|
3556
|
+
ZodStringFormat.init(inst, def);
|
|
3557
|
+
});
|
|
3558
|
+
function datetime(params) {
|
|
3559
|
+
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
3560
|
+
}
|
|
3561
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
3562
|
+
$ZodISODate.init(inst, def);
|
|
3563
|
+
ZodStringFormat.init(inst, def);
|
|
3564
|
+
});
|
|
3565
|
+
function date(params) {
|
|
3566
|
+
return /* @__PURE__ */ _isoDate(ZodISODate, params);
|
|
3567
|
+
}
|
|
3568
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
3569
|
+
$ZodISOTime.init(inst, def);
|
|
3570
|
+
ZodStringFormat.init(inst, def);
|
|
3571
|
+
});
|
|
3572
|
+
function time(params) {
|
|
3573
|
+
return /* @__PURE__ */ _isoTime(ZodISOTime, params);
|
|
3574
|
+
}
|
|
3575
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
3576
|
+
$ZodISODuration.init(inst, def);
|
|
3577
|
+
ZodStringFormat.init(inst, def);
|
|
3578
|
+
});
|
|
3579
|
+
function duration(params) {
|
|
3580
|
+
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
3581
|
+
}
|
|
3582
|
+
//#endregion
|
|
3583
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
3584
|
+
const initializer = (inst, issues) => {
|
|
3585
|
+
$ZodError.init(inst, issues);
|
|
3586
|
+
inst.name = "ZodError";
|
|
3587
|
+
Object.defineProperties(inst, {
|
|
3588
|
+
format: { value: (mapper) => formatError(inst, mapper) },
|
|
3589
|
+
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
3590
|
+
addIssue: { value: (issue) => {
|
|
3591
|
+
inst.issues.push(issue);
|
|
3592
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3593
|
+
} },
|
|
3594
|
+
addIssues: { value: (issues) => {
|
|
3595
|
+
inst.issues.push(...issues);
|
|
3596
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3597
|
+
} },
|
|
3598
|
+
isEmpty: { get() {
|
|
3599
|
+
return inst.issues.length === 0;
|
|
3600
|
+
} }
|
|
3601
|
+
});
|
|
3602
|
+
};
|
|
3603
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
3604
|
+
//#endregion
|
|
3605
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
|
|
3606
|
+
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
3607
|
+
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3608
|
+
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
3609
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
3610
|
+
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
3611
|
+
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
3612
|
+
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
3613
|
+
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
3614
|
+
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
3615
|
+
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
3616
|
+
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3617
|
+
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3618
|
+
//#endregion
|
|
3619
|
+
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
|
|
3620
|
+
const _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
3621
|
+
function _installLazyMethods(inst, group, methods) {
|
|
3622
|
+
const proto = Object.getPrototypeOf(inst);
|
|
3623
|
+
let installed = _installedGroups.get(proto);
|
|
3624
|
+
if (!installed) {
|
|
3625
|
+
installed = /* @__PURE__ */ new Set();
|
|
3626
|
+
_installedGroups.set(proto, installed);
|
|
3627
|
+
}
|
|
3628
|
+
if (installed.has(group)) return;
|
|
3629
|
+
installed.add(group);
|
|
3630
|
+
for (const key in methods) {
|
|
3631
|
+
const fn = methods[key];
|
|
3632
|
+
Object.defineProperty(proto, key, {
|
|
3633
|
+
configurable: true,
|
|
3634
|
+
enumerable: false,
|
|
3635
|
+
get() {
|
|
3636
|
+
const bound = fn.bind(this);
|
|
3637
|
+
Object.defineProperty(this, key, {
|
|
3638
|
+
configurable: true,
|
|
3639
|
+
writable: true,
|
|
3640
|
+
enumerable: true,
|
|
3641
|
+
value: bound
|
|
3642
|
+
});
|
|
3643
|
+
return bound;
|
|
3644
|
+
},
|
|
3645
|
+
set(v) {
|
|
3646
|
+
Object.defineProperty(this, key, {
|
|
3647
|
+
configurable: true,
|
|
3648
|
+
writable: true,
|
|
3649
|
+
enumerable: true,
|
|
3650
|
+
value: v
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
});
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
3657
|
+
$ZodType.init(inst, def);
|
|
3658
|
+
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3659
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3660
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3661
|
+
} });
|
|
3662
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3663
|
+
inst.def = def;
|
|
3664
|
+
inst.type = def.type;
|
|
3665
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
3666
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3667
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3668
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3669
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3670
|
+
inst.spa = inst.safeParseAsync;
|
|
3671
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
3672
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
3673
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3674
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3675
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3676
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3677
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3678
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3679
|
+
_installLazyMethods(inst, "ZodType", {
|
|
3680
|
+
check(...chks) {
|
|
3681
|
+
const def = this.def;
|
|
3682
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3683
|
+
check: ch,
|
|
3684
|
+
def: { check: "custom" },
|
|
3685
|
+
onattach: []
|
|
3686
|
+
} } : ch)] }), { parent: true });
|
|
3687
|
+
},
|
|
3688
|
+
with(...chks) {
|
|
3689
|
+
return this.check(...chks);
|
|
3690
|
+
},
|
|
3691
|
+
clone(def, params) {
|
|
3692
|
+
return clone(this, def, params);
|
|
3693
|
+
},
|
|
3694
|
+
brand() {
|
|
3695
|
+
return this;
|
|
3696
|
+
},
|
|
3697
|
+
register(reg, meta) {
|
|
3698
|
+
reg.add(this, meta);
|
|
3699
|
+
return this;
|
|
3700
|
+
},
|
|
3701
|
+
refine(check, params) {
|
|
3702
|
+
return this.check(refine(check, params));
|
|
3703
|
+
},
|
|
3704
|
+
superRefine(refinement, params) {
|
|
3705
|
+
return this.check(superRefine(refinement, params));
|
|
3706
|
+
},
|
|
3707
|
+
overwrite(fn) {
|
|
3708
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
3709
|
+
},
|
|
3710
|
+
optional() {
|
|
3711
|
+
return optional(this);
|
|
3712
|
+
},
|
|
3713
|
+
exactOptional() {
|
|
3714
|
+
return exactOptional(this);
|
|
3715
|
+
},
|
|
3716
|
+
nullable() {
|
|
3717
|
+
return nullable(this);
|
|
3718
|
+
},
|
|
3719
|
+
nullish() {
|
|
3720
|
+
return optional(nullable(this));
|
|
3721
|
+
},
|
|
3722
|
+
nonoptional(params) {
|
|
3723
|
+
return nonoptional(this, params);
|
|
3724
|
+
},
|
|
3725
|
+
array() {
|
|
3726
|
+
return array(this);
|
|
3727
|
+
},
|
|
3728
|
+
or(arg) {
|
|
3729
|
+
return union([this, arg]);
|
|
3730
|
+
},
|
|
3731
|
+
and(arg) {
|
|
3732
|
+
return intersection(this, arg);
|
|
3733
|
+
},
|
|
3734
|
+
transform(tx) {
|
|
3735
|
+
return pipe(this, transform(tx));
|
|
3736
|
+
},
|
|
3737
|
+
default(d) {
|
|
3738
|
+
return _default(this, d);
|
|
3739
|
+
},
|
|
3740
|
+
prefault(d) {
|
|
3741
|
+
return prefault(this, d);
|
|
3742
|
+
},
|
|
3743
|
+
catch(params) {
|
|
3744
|
+
return _catch(this, params);
|
|
3745
|
+
},
|
|
3746
|
+
pipe(target) {
|
|
3747
|
+
return pipe(this, target);
|
|
3748
|
+
},
|
|
3749
|
+
readonly() {
|
|
3750
|
+
return readonly(this);
|
|
3751
|
+
},
|
|
3752
|
+
describe(description) {
|
|
3753
|
+
const cl = this.clone();
|
|
3754
|
+
globalRegistry.add(cl, { description });
|
|
3755
|
+
return cl;
|
|
3756
|
+
},
|
|
3757
|
+
meta(...args) {
|
|
3758
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
3759
|
+
const cl = this.clone();
|
|
3760
|
+
globalRegistry.add(cl, args[0]);
|
|
3761
|
+
return cl;
|
|
3762
|
+
},
|
|
3763
|
+
isOptional() {
|
|
3764
|
+
return this.safeParse(void 0).success;
|
|
3765
|
+
},
|
|
3766
|
+
isNullable() {
|
|
3767
|
+
return this.safeParse(null).success;
|
|
3768
|
+
},
|
|
3769
|
+
apply(fn) {
|
|
3770
|
+
return fn(this);
|
|
3771
|
+
}
|
|
3772
|
+
});
|
|
3773
|
+
Object.defineProperty(inst, "description", {
|
|
3774
|
+
get() {
|
|
3775
|
+
return globalRegistry.get(inst)?.description;
|
|
3776
|
+
},
|
|
3777
|
+
configurable: true
|
|
3778
|
+
});
|
|
3779
|
+
return inst;
|
|
3780
|
+
});
|
|
3781
|
+
/** @internal */
|
|
3782
|
+
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
3783
|
+
$ZodString.init(inst, def);
|
|
3784
|
+
ZodType.init(inst, def);
|
|
3785
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
3786
|
+
const bag = inst._zod.bag;
|
|
3787
|
+
inst.format = bag.format ?? null;
|
|
3788
|
+
inst.minLength = bag.minimum ?? null;
|
|
3789
|
+
inst.maxLength = bag.maximum ?? null;
|
|
3790
|
+
_installLazyMethods(inst, "_ZodString", {
|
|
3791
|
+
regex(...args) {
|
|
3792
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
3793
|
+
},
|
|
3794
|
+
includes(...args) {
|
|
3795
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
3796
|
+
},
|
|
3797
|
+
startsWith(...args) {
|
|
3798
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
3799
|
+
},
|
|
3800
|
+
endsWith(...args) {
|
|
3801
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
3802
|
+
},
|
|
3803
|
+
min(...args) {
|
|
3804
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
3805
|
+
},
|
|
3806
|
+
max(...args) {
|
|
3807
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
3808
|
+
},
|
|
3809
|
+
length(...args) {
|
|
3810
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
3811
|
+
},
|
|
3812
|
+
nonempty(...args) {
|
|
3813
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
3814
|
+
},
|
|
3815
|
+
lowercase(params) {
|
|
3816
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
3817
|
+
},
|
|
3818
|
+
uppercase(params) {
|
|
3819
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
3820
|
+
},
|
|
3821
|
+
trim() {
|
|
3822
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
3823
|
+
},
|
|
3824
|
+
normalize(...args) {
|
|
3825
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
3826
|
+
},
|
|
3827
|
+
toLowerCase() {
|
|
3828
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
3829
|
+
},
|
|
3830
|
+
toUpperCase() {
|
|
3831
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
3832
|
+
},
|
|
3833
|
+
slugify() {
|
|
3834
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
3835
|
+
}
|
|
3836
|
+
});
|
|
3837
|
+
});
|
|
3838
|
+
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
3839
|
+
$ZodString.init(inst, def);
|
|
3840
|
+
_ZodString.init(inst, def);
|
|
3841
|
+
inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
3842
|
+
inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
3843
|
+
inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
3844
|
+
inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
3845
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3846
|
+
inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
3847
|
+
inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
3848
|
+
inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
3849
|
+
inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
3850
|
+
inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
3851
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3852
|
+
inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
3853
|
+
inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
3854
|
+
inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
3855
|
+
inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
3856
|
+
inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
3857
|
+
inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
3858
|
+
inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
3859
|
+
inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
3860
|
+
inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
3861
|
+
inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
3862
|
+
inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
3863
|
+
inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
3864
|
+
inst.datetime = (params) => inst.check(datetime(params));
|
|
3865
|
+
inst.date = (params) => inst.check(date(params));
|
|
3866
|
+
inst.time = (params) => inst.check(time(params));
|
|
3867
|
+
inst.duration = (params) => inst.check(duration(params));
|
|
3868
|
+
});
|
|
3869
|
+
function string(params) {
|
|
3870
|
+
return /* @__PURE__ */ _string(ZodString, params);
|
|
3871
|
+
}
|
|
3872
|
+
const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
|
|
3873
|
+
$ZodStringFormat.init(inst, def);
|
|
3874
|
+
_ZodString.init(inst, def);
|
|
3875
|
+
});
|
|
3876
|
+
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
3877
|
+
$ZodEmail.init(inst, def);
|
|
3878
|
+
ZodStringFormat.init(inst, def);
|
|
3879
|
+
});
|
|
3880
|
+
const ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def) => {
|
|
3881
|
+
$ZodGUID.init(inst, def);
|
|
3882
|
+
ZodStringFormat.init(inst, def);
|
|
3883
|
+
});
|
|
3884
|
+
const ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def) => {
|
|
3885
|
+
$ZodUUID.init(inst, def);
|
|
3886
|
+
ZodStringFormat.init(inst, def);
|
|
3887
|
+
});
|
|
3888
|
+
const ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def) => {
|
|
3889
|
+
$ZodURL.init(inst, def);
|
|
3890
|
+
ZodStringFormat.init(inst, def);
|
|
3891
|
+
});
|
|
3892
|
+
const ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def) => {
|
|
3893
|
+
$ZodEmoji.init(inst, def);
|
|
3894
|
+
ZodStringFormat.init(inst, def);
|
|
3895
|
+
});
|
|
3896
|
+
const ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def) => {
|
|
3897
|
+
$ZodNanoID.init(inst, def);
|
|
3898
|
+
ZodStringFormat.init(inst, def);
|
|
3899
|
+
});
|
|
3900
|
+
/**
|
|
3901
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
3902
|
+
* (timestamps embedded in the id). Use {@link ZodCUID2} instead.
|
|
3903
|
+
* See https://github.com/paralleldrive/cuid.
|
|
3904
|
+
*/
|
|
3905
|
+
const ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def) => {
|
|
3906
|
+
$ZodCUID.init(inst, def);
|
|
3907
|
+
ZodStringFormat.init(inst, def);
|
|
3908
|
+
});
|
|
3909
|
+
const ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def) => {
|
|
3910
|
+
$ZodCUID2.init(inst, def);
|
|
3911
|
+
ZodStringFormat.init(inst, def);
|
|
3912
|
+
});
|
|
3913
|
+
const ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def) => {
|
|
3914
|
+
$ZodULID.init(inst, def);
|
|
3915
|
+
ZodStringFormat.init(inst, def);
|
|
3916
|
+
});
|
|
3917
|
+
const ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def) => {
|
|
3918
|
+
$ZodXID.init(inst, def);
|
|
3919
|
+
ZodStringFormat.init(inst, def);
|
|
3920
|
+
});
|
|
3921
|
+
const ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def) => {
|
|
3922
|
+
$ZodKSUID.init(inst, def);
|
|
3923
|
+
ZodStringFormat.init(inst, def);
|
|
3924
|
+
});
|
|
3925
|
+
const ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
|
|
3926
|
+
$ZodIPv4.init(inst, def);
|
|
3927
|
+
ZodStringFormat.init(inst, def);
|
|
3928
|
+
});
|
|
3929
|
+
const ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
|
|
3930
|
+
$ZodIPv6.init(inst, def);
|
|
3931
|
+
ZodStringFormat.init(inst, def);
|
|
3932
|
+
});
|
|
3933
|
+
const ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
|
|
3934
|
+
$ZodCIDRv4.init(inst, def);
|
|
3935
|
+
ZodStringFormat.init(inst, def);
|
|
3936
|
+
});
|
|
3937
|
+
const ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def) => {
|
|
3938
|
+
$ZodCIDRv6.init(inst, def);
|
|
3939
|
+
ZodStringFormat.init(inst, def);
|
|
3940
|
+
});
|
|
3941
|
+
const ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def) => {
|
|
3942
|
+
$ZodBase64.init(inst, def);
|
|
3943
|
+
ZodStringFormat.init(inst, def);
|
|
3944
|
+
});
|
|
3945
|
+
const ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def) => {
|
|
3946
|
+
$ZodBase64URL.init(inst, def);
|
|
3947
|
+
ZodStringFormat.init(inst, def);
|
|
3948
|
+
});
|
|
3949
|
+
const ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def) => {
|
|
3950
|
+
$ZodE164.init(inst, def);
|
|
3951
|
+
ZodStringFormat.init(inst, def);
|
|
3952
|
+
});
|
|
3953
|
+
const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
|
|
3954
|
+
$ZodJWT.init(inst, def);
|
|
3955
|
+
ZodStringFormat.init(inst, def);
|
|
3956
|
+
});
|
|
3957
|
+
const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
3958
|
+
$ZodNumber.init(inst, def);
|
|
3959
|
+
ZodType.init(inst, def);
|
|
3960
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3961
|
+
_installLazyMethods(inst, "ZodNumber", {
|
|
3962
|
+
gt(value, params) {
|
|
3963
|
+
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
3964
|
+
},
|
|
3965
|
+
gte(value, params) {
|
|
3966
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3967
|
+
},
|
|
3968
|
+
min(value, params) {
|
|
3969
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
3970
|
+
},
|
|
3971
|
+
lt(value, params) {
|
|
3972
|
+
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
3973
|
+
},
|
|
3974
|
+
lte(value, params) {
|
|
3975
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3976
|
+
},
|
|
3977
|
+
max(value, params) {
|
|
3978
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
3979
|
+
},
|
|
3980
|
+
int(params) {
|
|
3981
|
+
return this.check(int(params));
|
|
3982
|
+
},
|
|
3983
|
+
safe(params) {
|
|
3984
|
+
return this.check(int(params));
|
|
3985
|
+
},
|
|
3986
|
+
positive(params) {
|
|
3987
|
+
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
3988
|
+
},
|
|
3989
|
+
nonnegative(params) {
|
|
3990
|
+
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
3991
|
+
},
|
|
3992
|
+
negative(params) {
|
|
3993
|
+
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
3994
|
+
},
|
|
3995
|
+
nonpositive(params) {
|
|
3996
|
+
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
3997
|
+
},
|
|
3998
|
+
multipleOf(value, params) {
|
|
3999
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4000
|
+
},
|
|
4001
|
+
step(value, params) {
|
|
4002
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
4003
|
+
},
|
|
4004
|
+
finite() {
|
|
4005
|
+
return this;
|
|
4006
|
+
}
|
|
4007
|
+
});
|
|
4008
|
+
const bag = inst._zod.bag;
|
|
4009
|
+
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
4010
|
+
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
4011
|
+
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
4012
|
+
inst.isFinite = true;
|
|
4013
|
+
inst.format = bag.format ?? null;
|
|
4014
|
+
});
|
|
4015
|
+
function number(params) {
|
|
4016
|
+
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
4017
|
+
}
|
|
4018
|
+
const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => {
|
|
4019
|
+
$ZodNumberFormat.init(inst, def);
|
|
4020
|
+
ZodNumber.init(inst, def);
|
|
4021
|
+
});
|
|
4022
|
+
function int(params) {
|
|
4023
|
+
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
4024
|
+
}
|
|
4025
|
+
const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
|
|
4026
|
+
$ZodBoolean.init(inst, def);
|
|
4027
|
+
ZodType.init(inst, def);
|
|
4028
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
4029
|
+
});
|
|
4030
|
+
function boolean(params) {
|
|
4031
|
+
return /* @__PURE__ */ _boolean(ZodBoolean, params);
|
|
4032
|
+
}
|
|
4033
|
+
const ZodUndefined = /*@__PURE__*/ $constructor("ZodUndefined", (inst, def) => {
|
|
4034
|
+
$ZodUndefined.init(inst, def);
|
|
4035
|
+
ZodType.init(inst, def);
|
|
4036
|
+
inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
|
|
4037
|
+
});
|
|
4038
|
+
function _undefined(params) {
|
|
4039
|
+
return /* @__PURE__ */ _undefined$1(ZodUndefined, params);
|
|
4040
|
+
}
|
|
4041
|
+
const ZodNull = /*@__PURE__*/ $constructor("ZodNull", (inst, def) => {
|
|
4042
|
+
$ZodNull.init(inst, def);
|
|
4043
|
+
ZodType.init(inst, def);
|
|
4044
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
4045
|
+
});
|
|
4046
|
+
function _null(params) {
|
|
4047
|
+
return /* @__PURE__ */ _null$1(ZodNull, params);
|
|
4048
|
+
}
|
|
4049
|
+
const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
|
|
4050
|
+
$ZodUnknown.init(inst, def);
|
|
4051
|
+
ZodType.init(inst, def);
|
|
4052
|
+
inst._zod.processJSONSchema = (ctx, json, params) => void 0;
|
|
4053
|
+
});
|
|
4054
|
+
function unknown() {
|
|
4055
|
+
return /* @__PURE__ */ _unknown(ZodUnknown);
|
|
4056
|
+
}
|
|
4057
|
+
const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
|
|
4058
|
+
$ZodNever.init(inst, def);
|
|
4059
|
+
ZodType.init(inst, def);
|
|
4060
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
4061
|
+
});
|
|
4062
|
+
function never(params) {
|
|
4063
|
+
return /* @__PURE__ */ _never(ZodNever, params);
|
|
4064
|
+
}
|
|
4065
|
+
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
4066
|
+
$ZodArray.init(inst, def);
|
|
4067
|
+
ZodType.init(inst, def);
|
|
4068
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
4069
|
+
inst.element = def.element;
|
|
4070
|
+
_installLazyMethods(inst, "ZodArray", {
|
|
4071
|
+
min(n, params) {
|
|
4072
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
4073
|
+
},
|
|
4074
|
+
nonempty(params) {
|
|
4075
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
4076
|
+
},
|
|
4077
|
+
max(n, params) {
|
|
4078
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
4079
|
+
},
|
|
4080
|
+
length(n, params) {
|
|
4081
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
4082
|
+
},
|
|
4083
|
+
unwrap() {
|
|
4084
|
+
return this.element;
|
|
4085
|
+
}
|
|
4086
|
+
});
|
|
4087
|
+
});
|
|
4088
|
+
function array(element, params) {
|
|
4089
|
+
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
4090
|
+
}
|
|
4091
|
+
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
4092
|
+
$ZodObjectJIT.init(inst, def);
|
|
4093
|
+
ZodType.init(inst, def);
|
|
4094
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
4095
|
+
defineLazy(inst, "shape", () => {
|
|
4096
|
+
return def.shape;
|
|
4097
|
+
});
|
|
4098
|
+
_installLazyMethods(inst, "ZodObject", {
|
|
4099
|
+
keyof() {
|
|
4100
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
4101
|
+
},
|
|
4102
|
+
catchall(catchall) {
|
|
4103
|
+
return this.clone({
|
|
4104
|
+
...this._zod.def,
|
|
4105
|
+
catchall
|
|
4106
|
+
});
|
|
4107
|
+
},
|
|
4108
|
+
passthrough() {
|
|
4109
|
+
return this.clone({
|
|
4110
|
+
...this._zod.def,
|
|
4111
|
+
catchall: unknown()
|
|
4112
|
+
});
|
|
4113
|
+
},
|
|
4114
|
+
loose() {
|
|
4115
|
+
return this.clone({
|
|
4116
|
+
...this._zod.def,
|
|
4117
|
+
catchall: unknown()
|
|
4118
|
+
});
|
|
4119
|
+
},
|
|
4120
|
+
strict() {
|
|
4121
|
+
return this.clone({
|
|
4122
|
+
...this._zod.def,
|
|
4123
|
+
catchall: never()
|
|
4124
|
+
});
|
|
4125
|
+
},
|
|
4126
|
+
strip() {
|
|
4127
|
+
return this.clone({
|
|
4128
|
+
...this._zod.def,
|
|
4129
|
+
catchall: void 0
|
|
4130
|
+
});
|
|
4131
|
+
},
|
|
4132
|
+
extend(incoming) {
|
|
4133
|
+
return extend(this, incoming);
|
|
4134
|
+
},
|
|
4135
|
+
safeExtend(incoming) {
|
|
4136
|
+
return safeExtend(this, incoming);
|
|
4137
|
+
},
|
|
4138
|
+
merge(other) {
|
|
4139
|
+
return merge(this, other);
|
|
4140
|
+
},
|
|
4141
|
+
pick(mask) {
|
|
4142
|
+
return pick(this, mask);
|
|
4143
|
+
},
|
|
4144
|
+
omit(mask) {
|
|
4145
|
+
return omit(this, mask);
|
|
4146
|
+
},
|
|
4147
|
+
partial(...args) {
|
|
4148
|
+
return partial(ZodOptional, this, args[0]);
|
|
4149
|
+
},
|
|
4150
|
+
required(...args) {
|
|
4151
|
+
return required(ZodNonOptional, this, args[0]);
|
|
4152
|
+
}
|
|
4153
|
+
});
|
|
4154
|
+
});
|
|
4155
|
+
function object(shape, params) {
|
|
4156
|
+
return new ZodObject({
|
|
4157
|
+
type: "object",
|
|
4158
|
+
shape: shape ?? {},
|
|
4159
|
+
...normalizeParams(params)
|
|
4160
|
+
});
|
|
4161
|
+
}
|
|
4162
|
+
const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
|
|
4163
|
+
$ZodUnion.init(inst, def);
|
|
4164
|
+
ZodType.init(inst, def);
|
|
4165
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
4166
|
+
inst.options = def.options;
|
|
4167
|
+
});
|
|
4168
|
+
function union(options, params) {
|
|
4169
|
+
return new ZodUnion({
|
|
4170
|
+
type: "union",
|
|
4171
|
+
options,
|
|
4172
|
+
...normalizeParams(params)
|
|
4173
|
+
});
|
|
4174
|
+
}
|
|
4175
|
+
const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
|
|
4176
|
+
$ZodIntersection.init(inst, def);
|
|
4177
|
+
ZodType.init(inst, def);
|
|
4178
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
4179
|
+
});
|
|
4180
|
+
function intersection(left, right) {
|
|
4181
|
+
return new ZodIntersection({
|
|
4182
|
+
type: "intersection",
|
|
4183
|
+
left,
|
|
4184
|
+
right
|
|
4185
|
+
});
|
|
4186
|
+
}
|
|
4187
|
+
const ZodTuple = /*@__PURE__*/ $constructor("ZodTuple", (inst, def) => {
|
|
4188
|
+
$ZodTuple.init(inst, def);
|
|
4189
|
+
ZodType.init(inst, def);
|
|
4190
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
4191
|
+
inst.rest = (rest) => inst.clone({
|
|
4192
|
+
...inst._zod.def,
|
|
4193
|
+
rest
|
|
4194
|
+
});
|
|
4195
|
+
});
|
|
4196
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
4197
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
4198
|
+
return new ZodTuple({
|
|
4199
|
+
type: "tuple",
|
|
4200
|
+
items,
|
|
4201
|
+
rest: hasRest ? _paramsOrRest : null,
|
|
4202
|
+
...normalizeParams(hasRest ? _params : _paramsOrRest)
|
|
4203
|
+
});
|
|
4204
|
+
}
|
|
4205
|
+
const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
|
|
4206
|
+
$ZodRecord.init(inst, def);
|
|
4207
|
+
ZodType.init(inst, def);
|
|
4208
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
4209
|
+
inst.keyType = def.keyType;
|
|
4210
|
+
inst.valueType = def.valueType;
|
|
4211
|
+
});
|
|
4212
|
+
function record(keyType, valueType, params) {
|
|
4213
|
+
if (!valueType || !valueType._zod) return new ZodRecord({
|
|
4214
|
+
type: "record",
|
|
4215
|
+
keyType: string(),
|
|
4216
|
+
valueType: keyType,
|
|
4217
|
+
...normalizeParams(valueType)
|
|
4218
|
+
});
|
|
4219
|
+
return new ZodRecord({
|
|
4220
|
+
type: "record",
|
|
4221
|
+
keyType,
|
|
4222
|
+
valueType,
|
|
4223
|
+
...normalizeParams(params)
|
|
4224
|
+
});
|
|
4225
|
+
}
|
|
4226
|
+
const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
4227
|
+
$ZodEnum.init(inst, def);
|
|
4228
|
+
ZodType.init(inst, def);
|
|
4229
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
4230
|
+
inst.enum = def.entries;
|
|
4231
|
+
inst.options = Object.values(def.entries);
|
|
4232
|
+
const keys = new Set(Object.keys(def.entries));
|
|
4233
|
+
inst.extract = (values, params) => {
|
|
4234
|
+
const newEntries = {};
|
|
4235
|
+
for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
|
|
4236
|
+
else throw new Error(`Key ${value} not found in enum`);
|
|
4237
|
+
return new ZodEnum({
|
|
4238
|
+
...def,
|
|
4239
|
+
checks: [],
|
|
4240
|
+
...normalizeParams(params),
|
|
4241
|
+
entries: newEntries
|
|
4242
|
+
});
|
|
4243
|
+
};
|
|
4244
|
+
inst.exclude = (values, params) => {
|
|
4245
|
+
const newEntries = { ...def.entries };
|
|
4246
|
+
for (const value of values) if (keys.has(value)) delete newEntries[value];
|
|
4247
|
+
else throw new Error(`Key ${value} not found in enum`);
|
|
4248
|
+
return new ZodEnum({
|
|
4249
|
+
...def,
|
|
4250
|
+
checks: [],
|
|
4251
|
+
...normalizeParams(params),
|
|
4252
|
+
entries: newEntries
|
|
4253
|
+
});
|
|
4254
|
+
};
|
|
4255
|
+
});
|
|
4256
|
+
function _enum(values, params) {
|
|
4257
|
+
return new ZodEnum({
|
|
4258
|
+
type: "enum",
|
|
4259
|
+
entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
|
|
4260
|
+
...normalizeParams(params)
|
|
4261
|
+
});
|
|
4262
|
+
}
|
|
4263
|
+
const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
|
|
4264
|
+
$ZodLiteral.init(inst, def);
|
|
4265
|
+
ZodType.init(inst, def);
|
|
4266
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
4267
|
+
inst.values = new Set(def.values);
|
|
4268
|
+
Object.defineProperty(inst, "value", { get() {
|
|
4269
|
+
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
4270
|
+
return def.values[0];
|
|
4271
|
+
} });
|
|
4272
|
+
});
|
|
4273
|
+
function literal(value, params) {
|
|
4274
|
+
return new ZodLiteral({
|
|
4275
|
+
type: "literal",
|
|
4276
|
+
values: Array.isArray(value) ? value : [value],
|
|
4277
|
+
...normalizeParams(params)
|
|
4278
|
+
});
|
|
4279
|
+
}
|
|
4280
|
+
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
4281
|
+
$ZodTransform.init(inst, def);
|
|
4282
|
+
ZodType.init(inst, def);
|
|
4283
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
4284
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
4285
|
+
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
4286
|
+
payload.addIssue = (issue$1) => {
|
|
4287
|
+
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
4288
|
+
else {
|
|
4289
|
+
const _issue = issue$1;
|
|
4290
|
+
if (_issue.fatal) _issue.continue = false;
|
|
4291
|
+
_issue.code ?? (_issue.code = "custom");
|
|
4292
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
4293
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
4294
|
+
payload.issues.push(issue(_issue));
|
|
4295
|
+
}
|
|
4296
|
+
};
|
|
4297
|
+
const output = def.transform(payload.value, payload);
|
|
4298
|
+
if (output instanceof Promise) return output.then((output) => {
|
|
4299
|
+
payload.value = output;
|
|
4300
|
+
payload.fallback = true;
|
|
4301
|
+
return payload;
|
|
4302
|
+
});
|
|
4303
|
+
payload.value = output;
|
|
4304
|
+
payload.fallback = true;
|
|
4305
|
+
return payload;
|
|
4306
|
+
};
|
|
4307
|
+
});
|
|
4308
|
+
function transform(fn) {
|
|
4309
|
+
return new ZodTransform({
|
|
4310
|
+
type: "transform",
|
|
4311
|
+
transform: fn
|
|
4312
|
+
});
|
|
4313
|
+
}
|
|
4314
|
+
const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
|
|
4315
|
+
$ZodOptional.init(inst, def);
|
|
4316
|
+
ZodType.init(inst, def);
|
|
4317
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
4318
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4319
|
+
});
|
|
4320
|
+
function optional(innerType) {
|
|
4321
|
+
return new ZodOptional({
|
|
4322
|
+
type: "optional",
|
|
4323
|
+
innerType
|
|
4324
|
+
});
|
|
4325
|
+
}
|
|
4326
|
+
const ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
|
|
4327
|
+
$ZodExactOptional.init(inst, def);
|
|
4328
|
+
ZodType.init(inst, def);
|
|
4329
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
4330
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4331
|
+
});
|
|
4332
|
+
function exactOptional(innerType) {
|
|
4333
|
+
return new ZodExactOptional({
|
|
4334
|
+
type: "optional",
|
|
4335
|
+
innerType
|
|
4336
|
+
});
|
|
4337
|
+
}
|
|
4338
|
+
const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
|
|
4339
|
+
$ZodNullable.init(inst, def);
|
|
4340
|
+
ZodType.init(inst, def);
|
|
4341
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
4342
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4343
|
+
});
|
|
4344
|
+
function nullable(innerType) {
|
|
4345
|
+
return new ZodNullable({
|
|
4346
|
+
type: "nullable",
|
|
4347
|
+
innerType
|
|
4348
|
+
});
|
|
4349
|
+
}
|
|
4350
|
+
const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => {
|
|
4351
|
+
$ZodDefault.init(inst, def);
|
|
4352
|
+
ZodType.init(inst, def);
|
|
4353
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
4354
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4355
|
+
inst.removeDefault = inst.unwrap;
|
|
4356
|
+
});
|
|
4357
|
+
function _default(innerType, defaultValue) {
|
|
4358
|
+
return new ZodDefault({
|
|
4359
|
+
type: "default",
|
|
4360
|
+
innerType,
|
|
4361
|
+
get defaultValue() {
|
|
4362
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
4363
|
+
}
|
|
4364
|
+
});
|
|
4365
|
+
}
|
|
4366
|
+
const ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => {
|
|
4367
|
+
$ZodPrefault.init(inst, def);
|
|
4368
|
+
ZodType.init(inst, def);
|
|
4369
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
4370
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4371
|
+
});
|
|
4372
|
+
function prefault(innerType, defaultValue) {
|
|
4373
|
+
return new ZodPrefault({
|
|
4374
|
+
type: "prefault",
|
|
4375
|
+
innerType,
|
|
4376
|
+
get defaultValue() {
|
|
4377
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
4378
|
+
}
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4381
|
+
const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => {
|
|
4382
|
+
$ZodNonOptional.init(inst, def);
|
|
4383
|
+
ZodType.init(inst, def);
|
|
4384
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
4385
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4386
|
+
});
|
|
4387
|
+
function nonoptional(innerType, params) {
|
|
4388
|
+
return new ZodNonOptional({
|
|
4389
|
+
type: "nonoptional",
|
|
4390
|
+
innerType,
|
|
4391
|
+
...normalizeParams(params)
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4394
|
+
const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
|
|
4395
|
+
$ZodCatch.init(inst, def);
|
|
4396
|
+
ZodType.init(inst, def);
|
|
4397
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
4398
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4399
|
+
inst.removeCatch = inst.unwrap;
|
|
4400
|
+
});
|
|
4401
|
+
function _catch(innerType, catchValue) {
|
|
4402
|
+
return new ZodCatch({
|
|
4403
|
+
type: "catch",
|
|
4404
|
+
innerType,
|
|
4405
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
4406
|
+
});
|
|
4407
|
+
}
|
|
4408
|
+
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
4409
|
+
$ZodPipe.init(inst, def);
|
|
4410
|
+
ZodType.init(inst, def);
|
|
4411
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
4412
|
+
inst.in = def.in;
|
|
4413
|
+
inst.out = def.out;
|
|
4414
|
+
});
|
|
4415
|
+
function pipe(in_, out) {
|
|
4416
|
+
return new ZodPipe({
|
|
4417
|
+
type: "pipe",
|
|
4418
|
+
in: in_,
|
|
4419
|
+
out
|
|
4420
|
+
});
|
|
4421
|
+
}
|
|
4422
|
+
const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
|
|
4423
|
+
$ZodReadonly.init(inst, def);
|
|
4424
|
+
ZodType.init(inst, def);
|
|
4425
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
4426
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
4427
|
+
});
|
|
4428
|
+
function readonly(innerType) {
|
|
4429
|
+
return new ZodReadonly({
|
|
4430
|
+
type: "readonly",
|
|
4431
|
+
innerType
|
|
4432
|
+
});
|
|
4433
|
+
}
|
|
4434
|
+
const ZodLazy = /*@__PURE__*/ $constructor("ZodLazy", (inst, def) => {
|
|
4435
|
+
$ZodLazy.init(inst, def);
|
|
4436
|
+
ZodType.init(inst, def);
|
|
4437
|
+
inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
|
|
4438
|
+
inst.unwrap = () => inst._zod.def.getter();
|
|
4439
|
+
});
|
|
4440
|
+
function lazy(getter) {
|
|
4441
|
+
return new ZodLazy({
|
|
4442
|
+
type: "lazy",
|
|
4443
|
+
getter
|
|
4444
|
+
});
|
|
4445
|
+
}
|
|
4446
|
+
const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
|
|
4447
|
+
$ZodCustom.init(inst, def);
|
|
4448
|
+
ZodType.init(inst, def);
|
|
4449
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
4450
|
+
});
|
|
4451
|
+
function refine(fn, _params = {}) {
|
|
4452
|
+
return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
|
|
4453
|
+
}
|
|
4454
|
+
function superRefine(fn, params) {
|
|
4455
|
+
return /* @__PURE__ */ _superRefine(fn, params);
|
|
4456
|
+
}
|
|
4457
|
+
function json(params) {
|
|
4458
|
+
const jsonSchema = lazy(() => {
|
|
4459
|
+
return union([
|
|
4460
|
+
string(params),
|
|
4461
|
+
number(),
|
|
4462
|
+
boolean(),
|
|
4463
|
+
_null(),
|
|
4464
|
+
array(jsonSchema),
|
|
4465
|
+
record(string(), jsonSchema)
|
|
4466
|
+
]);
|
|
4467
|
+
});
|
|
4468
|
+
return jsonSchema;
|
|
4469
|
+
}
|
|
4470
|
+
//#endregion
|
|
3
4471
|
//#region src/shared/schemas.ts
|
|
4
|
-
const StringArray =
|
|
5
|
-
const SourcePosition =
|
|
6
|
-
line:
|
|
7
|
-
column:
|
|
4472
|
+
const StringArray = array(string());
|
|
4473
|
+
const SourcePosition = object({
|
|
4474
|
+
line: number().int().min(1),
|
|
4475
|
+
column: number().int().min(1)
|
|
8
4476
|
});
|
|
9
|
-
const SourceLocation =
|
|
4477
|
+
const SourceLocation = object({
|
|
10
4478
|
start: SourcePosition,
|
|
11
4479
|
end: SourcePosition
|
|
12
4480
|
});
|
|
13
|
-
const SourceRange =
|
|
14
|
-
start:
|
|
15
|
-
end:
|
|
4481
|
+
const SourceRange = object({
|
|
4482
|
+
start: number().int().min(0),
|
|
4483
|
+
end: number().int().min(0)
|
|
16
4484
|
}).refine((range) => range.start <= range.end);
|
|
17
|
-
const Confidence =
|
|
4485
|
+
const Confidence = _enum([
|
|
18
4486
|
"high",
|
|
19
4487
|
"medium",
|
|
20
4488
|
"low"
|
|
21
4489
|
]);
|
|
22
|
-
const UnsupportedReason =
|
|
4490
|
+
const UnsupportedReason = _enum([
|
|
23
4491
|
"ambiguous-target",
|
|
24
4492
|
"computed-css-only",
|
|
25
4493
|
"dynamic-expression",
|
|
@@ -33,127 +4501,127 @@ const UnsupportedReason = z.enum([
|
|
|
33
4501
|
"unsupported-source-shape",
|
|
34
4502
|
"variable-reference"
|
|
35
4503
|
]);
|
|
36
|
-
const StyleValueSource =
|
|
37
|
-
kind:
|
|
38
|
-
value:
|
|
4504
|
+
const StyleValueSource = union([object({
|
|
4505
|
+
kind: literal("literal"),
|
|
4506
|
+
value: json(),
|
|
39
4507
|
range: SourceRange.optional(),
|
|
40
4508
|
loc: SourceLocation.optional()
|
|
41
|
-
}),
|
|
42
|
-
kind:
|
|
4509
|
+
}), object({
|
|
4510
|
+
kind: literal("unsupported"),
|
|
43
4511
|
reason: UnsupportedReason,
|
|
44
|
-
description:
|
|
4512
|
+
description: string().optional(),
|
|
45
4513
|
range: SourceRange.optional(),
|
|
46
4514
|
loc: SourceLocation.optional()
|
|
47
4515
|
})]);
|
|
48
|
-
const PandaStyleObject =
|
|
49
|
-
const SourceTargetBase =
|
|
50
|
-
id:
|
|
51
|
-
file:
|
|
52
|
-
absoluteFile:
|
|
4516
|
+
const PandaStyleObject = lazy(() => record(string(), union([StyleValueSource, PandaStyleObject])));
|
|
4517
|
+
const SourceTargetBase = object({
|
|
4518
|
+
id: string(),
|
|
4519
|
+
file: string(),
|
|
4520
|
+
absoluteFile: string().optional(),
|
|
53
4521
|
range: SourceRange.optional(),
|
|
54
4522
|
loc: SourceLocation.optional(),
|
|
55
|
-
sourceHash:
|
|
56
|
-
name:
|
|
57
|
-
component:
|
|
58
|
-
element:
|
|
59
|
-
attribute:
|
|
60
|
-
jsxSource:
|
|
4523
|
+
sourceHash: string().optional(),
|
|
4524
|
+
name: string().optional(),
|
|
4525
|
+
component: string().optional(),
|
|
4526
|
+
element: string().optional(),
|
|
4527
|
+
attribute: string().optional(),
|
|
4528
|
+
jsxSource: string().optional(),
|
|
61
4529
|
jsxSourceAliases: StringArray.optional(),
|
|
62
|
-
markerClass:
|
|
4530
|
+
markerClass: string().optional(),
|
|
63
4531
|
confidence: Confidence,
|
|
64
|
-
reason:
|
|
4532
|
+
reason: string().optional()
|
|
65
4533
|
});
|
|
66
|
-
const InspectorManifestEntry =
|
|
4534
|
+
const InspectorManifestEntry = union([
|
|
67
4535
|
SourceTargetBase.extend({
|
|
68
|
-
protocolVersion:
|
|
69
|
-
kind:
|
|
70
|
-
callee:
|
|
4536
|
+
protocolVersion: number(),
|
|
4537
|
+
kind: literal("panda-css"),
|
|
4538
|
+
callee: string(),
|
|
71
4539
|
styleObject: PandaStyleObject,
|
|
72
|
-
dynamic:
|
|
4540
|
+
dynamic: literal(false)
|
|
73
4541
|
}),
|
|
74
4542
|
SourceTargetBase.extend({
|
|
75
|
-
protocolVersion:
|
|
76
|
-
kind:
|
|
77
|
-
dynamic:
|
|
4543
|
+
protocolVersion: number(),
|
|
4544
|
+
kind: literal("dynamic"),
|
|
4545
|
+
dynamic: literal(true),
|
|
78
4546
|
unsupportedReason: UnsupportedReason
|
|
79
4547
|
}),
|
|
80
4548
|
SourceTargetBase.extend({
|
|
81
|
-
protocolVersion:
|
|
82
|
-
kind:
|
|
4549
|
+
protocolVersion: number(),
|
|
4550
|
+
kind: literal("external"),
|
|
83
4551
|
unsupportedReason: UnsupportedReason
|
|
84
4552
|
}),
|
|
85
4553
|
SourceTargetBase.extend({
|
|
86
|
-
protocolVersion:
|
|
87
|
-
kind:
|
|
4554
|
+
protocolVersion: number(),
|
|
4555
|
+
kind: literal("unsupported"),
|
|
88
4556
|
unsupportedReason: UnsupportedReason
|
|
89
4557
|
})
|
|
90
4558
|
]);
|
|
91
|
-
const InspectorManifest =
|
|
92
|
-
version:
|
|
93
|
-
projectRoot:
|
|
94
|
-
generatedAt:
|
|
95
|
-
entries:
|
|
4559
|
+
const InspectorManifest = object({
|
|
4560
|
+
version: number(),
|
|
4561
|
+
projectRoot: string(),
|
|
4562
|
+
generatedAt: string().optional(),
|
|
4563
|
+
entries: array(InspectorManifestEntry)
|
|
96
4564
|
});
|
|
97
|
-
const EditorMetadataUnavailableReason =
|
|
4565
|
+
const EditorMetadataUnavailableReason = _enum([
|
|
98
4566
|
"panda-config-missing",
|
|
99
4567
|
"panda-config-unreadable",
|
|
100
4568
|
"unsupported-panda-config",
|
|
101
4569
|
"production-disabled"
|
|
102
4570
|
]);
|
|
103
|
-
const EditorMetadataSection = (item) =>
|
|
104
|
-
status:
|
|
105
|
-
items:
|
|
106
|
-
}),
|
|
107
|
-
status:
|
|
108
|
-
items:
|
|
4571
|
+
const EditorMetadataSection = (item) => union([object({
|
|
4572
|
+
status: literal("available"),
|
|
4573
|
+
items: array(item)
|
|
4574
|
+
}), object({
|
|
4575
|
+
status: literal("unavailable"),
|
|
4576
|
+
items: tuple([]),
|
|
109
4577
|
reason: EditorMetadataUnavailableReason,
|
|
110
|
-
message:
|
|
4578
|
+
message: string()
|
|
111
4579
|
})]);
|
|
112
|
-
const EditorTokenSourceSection =
|
|
113
|
-
const EditorTokenSourceTarget =
|
|
114
|
-
id:
|
|
115
|
-
kind:
|
|
116
|
-
file:
|
|
117
|
-
absoluteFile:
|
|
4580
|
+
const EditorTokenSourceSection = _enum(["tokens.colors", "semanticTokens.colors"]);
|
|
4581
|
+
const EditorTokenSourceTarget = object({
|
|
4582
|
+
id: string(),
|
|
4583
|
+
kind: literal("panda-config"),
|
|
4584
|
+
file: string(),
|
|
4585
|
+
absoluteFile: string().optional(),
|
|
118
4586
|
range: SourceRange.optional(),
|
|
119
|
-
sourceHash:
|
|
120
|
-
configPath:
|
|
121
|
-
writableSections:
|
|
4587
|
+
sourceHash: string(),
|
|
4588
|
+
configPath: string(),
|
|
4589
|
+
writableSections: array(EditorTokenSourceSection),
|
|
122
4590
|
confidence: Confidence,
|
|
123
|
-
writable:
|
|
124
|
-
readonlyReason:
|
|
125
|
-
});
|
|
126
|
-
const EditorTokenCondition =
|
|
127
|
-
condition:
|
|
128
|
-
value:
|
|
129
|
-
swatch:
|
|
130
|
-
});
|
|
131
|
-
const EditorColorTokenMetadata =
|
|
132
|
-
kind:
|
|
133
|
-
category:
|
|
134
|
-
path:
|
|
135
|
-
label:
|
|
136
|
-
value:
|
|
137
|
-
swatch:
|
|
138
|
-
cssVariable:
|
|
139
|
-
presetName:
|
|
140
|
-
conditions:
|
|
141
|
-
sourceTargetId:
|
|
4591
|
+
writable: boolean(),
|
|
4592
|
+
readonlyReason: string().optional()
|
|
4593
|
+
});
|
|
4594
|
+
const EditorTokenCondition = object({
|
|
4595
|
+
condition: string(),
|
|
4596
|
+
value: json(),
|
|
4597
|
+
swatch: string().optional()
|
|
4598
|
+
});
|
|
4599
|
+
const EditorColorTokenMetadata = object({
|
|
4600
|
+
kind: union([literal("token"), literal("semantic-token")]),
|
|
4601
|
+
category: literal("colors"),
|
|
4602
|
+
path: string(),
|
|
4603
|
+
label: string(),
|
|
4604
|
+
value: json().optional(),
|
|
4605
|
+
swatch: string().optional(),
|
|
4606
|
+
cssVariable: string().optional(),
|
|
4607
|
+
presetName: string().optional(),
|
|
4608
|
+
conditions: array(EditorTokenCondition).optional(),
|
|
4609
|
+
sourceTargetId: string().optional(),
|
|
142
4610
|
sourcePath: StringArray.optional(),
|
|
143
|
-
writable:
|
|
144
|
-
readonlyReason:
|
|
145
|
-
});
|
|
146
|
-
const EditorFontTokenMetadata =
|
|
147
|
-
kind:
|
|
148
|
-
category:
|
|
149
|
-
path:
|
|
150
|
-
label:
|
|
151
|
-
value:
|
|
152
|
-
cssVariable:
|
|
153
|
-
presetName:
|
|
4611
|
+
writable: boolean().optional(),
|
|
4612
|
+
readonlyReason: string().optional()
|
|
4613
|
+
});
|
|
4614
|
+
const EditorFontTokenMetadata = object({
|
|
4615
|
+
kind: literal("token"),
|
|
4616
|
+
category: literal("fonts"),
|
|
4617
|
+
path: string(),
|
|
4618
|
+
label: string(),
|
|
4619
|
+
value: json().optional(),
|
|
4620
|
+
cssVariable: string().optional(),
|
|
4621
|
+
presetName: string().optional(),
|
|
154
4622
|
sourcePath: StringArray.optional()
|
|
155
4623
|
});
|
|
156
|
-
const EditorPropertyCategory =
|
|
4624
|
+
const EditorPropertyCategory = _enum([
|
|
157
4625
|
"color",
|
|
158
4626
|
"spacing",
|
|
159
4627
|
"sizing",
|
|
@@ -163,60 +4631,60 @@ const EditorPropertyCategory = z.enum([
|
|
|
163
4631
|
"effects",
|
|
164
4632
|
"other"
|
|
165
4633
|
]);
|
|
166
|
-
const EditorPropertyMetadata =
|
|
167
|
-
name:
|
|
168
|
-
label:
|
|
4634
|
+
const EditorPropertyMetadata = object({
|
|
4635
|
+
name: string(),
|
|
4636
|
+
label: string(),
|
|
169
4637
|
category: EditorPropertyCategory,
|
|
170
|
-
cssProperty:
|
|
4638
|
+
cssProperty: string().optional(),
|
|
171
4639
|
aliases: StringArray,
|
|
172
|
-
tokenCategory:
|
|
173
|
-
defaultUnit:
|
|
4640
|
+
tokenCategory: string().optional(),
|
|
4641
|
+
defaultUnit: string().optional(),
|
|
4642
|
+
commonness: number().optional()
|
|
174
4643
|
});
|
|
175
|
-
const InspectorEditorMetadata =
|
|
176
|
-
version:
|
|
177
|
-
projectRoot:
|
|
178
|
-
generatedAt:
|
|
4644
|
+
const InspectorEditorMetadata = object({
|
|
4645
|
+
version: number(),
|
|
4646
|
+
projectRoot: string(),
|
|
4647
|
+
generatedAt: string().optional(),
|
|
179
4648
|
tokenSources: EditorMetadataSection(EditorTokenSourceTarget),
|
|
180
4649
|
colorTokens: EditorMetadataSection(EditorColorTokenMetadata),
|
|
181
4650
|
semanticColorTokens: EditorMetadataSection(EditorColorTokenMetadata),
|
|
182
4651
|
fontTokens: EditorMetadataSection(EditorFontTokenMetadata).optional(),
|
|
183
4652
|
properties: EditorMetadataSection(EditorPropertyMetadata)
|
|
184
4653
|
});
|
|
185
|
-
const ManifestUpdate =
|
|
186
|
-
version:
|
|
4654
|
+
const ManifestUpdate = object({
|
|
4655
|
+
version: number(),
|
|
187
4656
|
changedFiles: StringArray,
|
|
188
4657
|
entryIds: StringArray
|
|
189
4658
|
});
|
|
190
|
-
const EditorMetadataUpdate =
|
|
191
|
-
version:
|
|
4659
|
+
const EditorMetadataUpdate = object({
|
|
4660
|
+
version: number(),
|
|
192
4661
|
changedFiles: StringArray,
|
|
193
4662
|
tokenSourceIds: StringArray
|
|
194
4663
|
});
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
written: z.boolean().optional(),
|
|
4664
|
+
const StyleEditError = object({
|
|
4665
|
+
code: _enum([
|
|
4666
|
+
"ambiguous-target",
|
|
4667
|
+
"invalid-edit",
|
|
4668
|
+
"invalid-path",
|
|
4669
|
+
"manifest-entry-not-found",
|
|
4670
|
+
"parse-error",
|
|
4671
|
+
"path-outside-project",
|
|
4672
|
+
"production-disabled",
|
|
4673
|
+
"stale-source",
|
|
4674
|
+
"unsupported-operation",
|
|
4675
|
+
"unsupported-source-shape",
|
|
4676
|
+
"write-failed"
|
|
4677
|
+
]),
|
|
4678
|
+
message: string(),
|
|
4679
|
+
details: json().optional()
|
|
4680
|
+
});
|
|
4681
|
+
const StyleEditResponseBase = object({
|
|
4682
|
+
ok: boolean(),
|
|
4683
|
+
editId: string(),
|
|
4684
|
+
file: string().optional(),
|
|
4685
|
+
diff: string().optional(),
|
|
4686
|
+
nextSource: string().optional(),
|
|
4687
|
+
written: boolean().optional(),
|
|
220
4688
|
manifestUpdate: ManifestUpdate.optional(),
|
|
221
4689
|
warnings: StringArray.optional(),
|
|
222
4690
|
error: StyleEditError.optional()
|
|
@@ -245,11 +4713,11 @@ const TokenConfigEditResponse = StyleEditResponseBase.extend({ metadataUpdate: E
|
|
|
245
4713
|
message: "Failed token config edit responses must include an error."
|
|
246
4714
|
});
|
|
247
4715
|
});
|
|
248
|
-
const StyleEditBatchResponse =
|
|
249
|
-
ok:
|
|
250
|
-
editId:
|
|
251
|
-
responses:
|
|
252
|
-
written:
|
|
4716
|
+
const StyleEditBatchResponse = object({
|
|
4717
|
+
ok: boolean(),
|
|
4718
|
+
editId: literal(""),
|
|
4719
|
+
responses: array(StyleEditResponse),
|
|
4720
|
+
written: boolean().optional(),
|
|
253
4721
|
manifestUpdate: ManifestUpdate.optional(),
|
|
254
4722
|
error: StyleEditError.optional()
|
|
255
4723
|
}).superRefine((response, context) => {
|
|
@@ -264,46 +4732,46 @@ const StyleEditBatchResponse = z.object({
|
|
|
264
4732
|
message: "Failed batch responses must include an error."
|
|
265
4733
|
});
|
|
266
4734
|
});
|
|
267
|
-
const ComponentStyleModuleSource =
|
|
268
|
-
name:
|
|
269
|
-
file:
|
|
270
|
-
editId:
|
|
271
|
-
sourceHash:
|
|
4735
|
+
const ComponentStyleModuleSource = object({
|
|
4736
|
+
name: string(),
|
|
4737
|
+
file: string(),
|
|
4738
|
+
editId: string().optional(),
|
|
4739
|
+
sourceHash: string().optional(),
|
|
272
4740
|
styleObject: PandaStyleObject.optional()
|
|
273
4741
|
});
|
|
274
|
-
const ComponentStyleModuleResponse =
|
|
275
|
-
ok:
|
|
276
|
-
componentFile:
|
|
277
|
-
styleFile:
|
|
278
|
-
importPath:
|
|
279
|
-
exists:
|
|
280
|
-
sources:
|
|
4742
|
+
const ComponentStyleModuleResponse = union([object({
|
|
4743
|
+
ok: literal(true),
|
|
4744
|
+
componentFile: string(),
|
|
4745
|
+
styleFile: string(),
|
|
4746
|
+
importPath: string(),
|
|
4747
|
+
exists: boolean(),
|
|
4748
|
+
sources: array(ComponentStyleModuleSource),
|
|
281
4749
|
warnings: StringArray.optional(),
|
|
282
|
-
error:
|
|
283
|
-
}),
|
|
284
|
-
ok:
|
|
4750
|
+
error: _undefined().optional()
|
|
4751
|
+
}), object({
|
|
4752
|
+
ok: literal(false),
|
|
285
4753
|
error: StyleEditError
|
|
286
4754
|
})]);
|
|
287
|
-
const OpenSourceLocationErrorCode =
|
|
4755
|
+
const OpenSourceLocationErrorCode = _enum([
|
|
288
4756
|
"invalid-request",
|
|
289
4757
|
"missing-metadata",
|
|
290
4758
|
"open-failed",
|
|
291
4759
|
"path-outside-project",
|
|
292
4760
|
"file-not-found"
|
|
293
4761
|
]);
|
|
294
|
-
const OpenSourceLocationResponse =
|
|
295
|
-
ok:
|
|
296
|
-
file:
|
|
297
|
-
line:
|
|
298
|
-
column:
|
|
299
|
-
openEditorUrl:
|
|
300
|
-
error:
|
|
301
|
-
}),
|
|
302
|
-
ok:
|
|
303
|
-
error:
|
|
4762
|
+
const OpenSourceLocationResponse = union([object({
|
|
4763
|
+
ok: literal(true),
|
|
4764
|
+
file: string(),
|
|
4765
|
+
line: number().int().min(1).optional(),
|
|
4766
|
+
column: number().int().min(1).optional(),
|
|
4767
|
+
openEditorUrl: string().startsWith("/__open-in-editor?"),
|
|
4768
|
+
error: _undefined().optional()
|
|
4769
|
+
}), object({
|
|
4770
|
+
ok: literal(false),
|
|
4771
|
+
error: object({
|
|
304
4772
|
code: OpenSourceLocationErrorCode,
|
|
305
|
-
message:
|
|
306
|
-
details:
|
|
4773
|
+
message: string(),
|
|
4774
|
+
details: json().optional()
|
|
307
4775
|
})
|
|
308
4776
|
})]);
|
|
309
4777
|
function isInspectorManifest(value) {
|
|
@@ -402,8 +4870,11 @@ var SculptedRuntime = class {
|
|
|
402
4870
|
}
|
|
403
4871
|
async loadManifest() {
|
|
404
4872
|
const response = await this.#environment.fetch(this.manifestEndpoint, { cache: "no-store" });
|
|
405
|
-
if (!response.ok)
|
|
406
|
-
|
|
4873
|
+
if (!response.ok) {
|
|
4874
|
+
await logNonOkResponseBody("Sculpted manifest endpoint", response);
|
|
4875
|
+
throw new Error(`Failed to load Sculpted manifest: ${response.status}`);
|
|
4876
|
+
}
|
|
4877
|
+
const parsed = await responseJson(response, "Sculpted manifest endpoint");
|
|
407
4878
|
if (!isInspectorManifest(parsed)) throw new Error(manifestLoadMessage(response, parsed === invalidResponseJson ? "invalid-json" : "invalid-protocol"));
|
|
408
4879
|
const manifest = parsed;
|
|
409
4880
|
this.#manifest = manifest;
|
|
@@ -415,8 +4886,11 @@ var SculptedRuntime = class {
|
|
|
415
4886
|
}
|
|
416
4887
|
async loadEditorMetadata() {
|
|
417
4888
|
const response = await this.#environment.fetch(this.editorMetadataEndpoint, { cache: "no-store" });
|
|
418
|
-
if (!response.ok)
|
|
419
|
-
|
|
4889
|
+
if (!response.ok) {
|
|
4890
|
+
await logNonOkResponseBody("Panda editor metadata endpoint", response);
|
|
4891
|
+
throw new Error(`Failed to load Panda editor metadata: ${response.status}`);
|
|
4892
|
+
}
|
|
4893
|
+
const parsed = await responseJson(response, "Panda editor metadata endpoint");
|
|
420
4894
|
if (!isInspectorEditorMetadata(parsed)) throw new Error(editorMetadataLoadMessage(response, parsed === invalidResponseJson ? "invalid-json" : "invalid-protocol"));
|
|
421
4895
|
const metadata = parsed;
|
|
422
4896
|
this.#editorMetadata = metadata;
|
|
@@ -547,7 +5021,7 @@ var SculptedRuntime = class {
|
|
|
547
5021
|
}
|
|
548
5022
|
}
|
|
549
5023
|
async selectElement(element) {
|
|
550
|
-
await this.
|
|
5024
|
+
await this.loadManifest();
|
|
551
5025
|
const markerEditIds = editIdsFromMarkerClassList(element.getAttribute("class") ?? "");
|
|
552
5026
|
const attributeEditIds = (element.getAttribute(this.#attributes.editId) ?? "").split(/\s+/).filter(Boolean);
|
|
553
5027
|
const jsxSource = element.getAttribute(this.#attributes.jsxSource)?.trim() || void 0;
|
|
@@ -1020,12 +5494,12 @@ function editorMetadataLoadMessage(response, reason) {
|
|
|
1020
5494
|
return reason === "invalid-json" ? `Panda editor metadata endpoint returned invalid JSON${status}.` : `Panda editor metadata endpoint returned an invalid response${status}.`;
|
|
1021
5495
|
}
|
|
1022
5496
|
async function styleEditResponseFromFetch(response, editId) {
|
|
1023
|
-
const parsed = await responseJson(response);
|
|
5497
|
+
const parsed = await responseJson(response, "Writeback endpoint");
|
|
1024
5498
|
if (isStyleEditResponseForEditId(parsed, editId)) return parsed;
|
|
1025
5499
|
return styleEditFailure(editId, writebackResponseMessage(response, parsed === invalidResponseJson ? "invalid-json" : "invalid-protocol"));
|
|
1026
5500
|
}
|
|
1027
5501
|
async function styleEditBatchResponseFromFetch(response, requests) {
|
|
1028
|
-
const parsed = await responseJson(response);
|
|
5502
|
+
const parsed = await responseJson(response, "Writeback endpoint");
|
|
1029
5503
|
if (isStyleEditBatchResponse(parsed)) {
|
|
1030
5504
|
if (!parsed.ok) return parsed;
|
|
1031
5505
|
if (parsed.responses.length === requests.length && parsed.responses.every((item, index) => item.ok && item.editId === requests[index]?.editId)) return parsed;
|
|
@@ -1043,7 +5517,7 @@ async function styleEditBatchResponseFromFetch(response, requests) {
|
|
|
1043
5517
|
};
|
|
1044
5518
|
}
|
|
1045
5519
|
async function tokenConfigEditResponseFromFetch(response, editId) {
|
|
1046
|
-
const parsed = await responseJson(response);
|
|
5520
|
+
const parsed = await responseJson(response, "Token writeback endpoint");
|
|
1047
5521
|
if (isTokenConfigEditResponse(parsed, editId)) return parsed;
|
|
1048
5522
|
return {
|
|
1049
5523
|
ok: false,
|
|
@@ -1056,7 +5530,7 @@ async function tokenConfigEditResponseFromFetch(response, editId) {
|
|
|
1056
5530
|
};
|
|
1057
5531
|
}
|
|
1058
5532
|
async function componentStyleModuleResponseFromFetch(response) {
|
|
1059
|
-
const parsed = await responseJson(response);
|
|
5533
|
+
const parsed = await responseJson(response, "Style-module endpoint");
|
|
1060
5534
|
if (isComponentStyleModuleResponse(parsed)) return parsed;
|
|
1061
5535
|
return {
|
|
1062
5536
|
ok: false,
|
|
@@ -1067,7 +5541,7 @@ async function componentStyleModuleResponseFromFetch(response) {
|
|
|
1067
5541
|
};
|
|
1068
5542
|
}
|
|
1069
5543
|
async function openSourceLocationResponseFromFetch(response) {
|
|
1070
|
-
const parsed = await responseJson(response);
|
|
5544
|
+
const parsed = await responseJson(response, "Open-source endpoint");
|
|
1071
5545
|
if (isOpenSourceLocationResponse(parsed)) return parsed;
|
|
1072
5546
|
return {
|
|
1073
5547
|
ok: false,
|
|
@@ -1078,13 +5552,29 @@ async function openSourceLocationResponseFromFetch(response) {
|
|
|
1078
5552
|
};
|
|
1079
5553
|
}
|
|
1080
5554
|
const invalidResponseJson = Symbol("invalid-response-json");
|
|
1081
|
-
|
|
5555
|
+
const loggedNonOkResponses = /* @__PURE__ */ new WeakSet();
|
|
5556
|
+
async function responseJson(response, endpoint) {
|
|
5557
|
+
await logNonOkResponseBody(endpoint, response);
|
|
1082
5558
|
try {
|
|
1083
5559
|
return await response.json();
|
|
1084
5560
|
} catch {
|
|
1085
5561
|
return invalidResponseJson;
|
|
1086
5562
|
}
|
|
1087
5563
|
}
|
|
5564
|
+
async function logNonOkResponseBody(endpoint, response) {
|
|
5565
|
+
if (response.ok || loggedNonOkResponses.has(response)) return;
|
|
5566
|
+
loggedNonOkResponses.add(response);
|
|
5567
|
+
try {
|
|
5568
|
+
if (typeof response.clone !== "function") return;
|
|
5569
|
+
const clone = response.clone();
|
|
5570
|
+
if (typeof clone.text !== "function") return;
|
|
5571
|
+
const body = await clone.text();
|
|
5572
|
+
const status = response.status ? `HTTP ${response.status}` : "a non-2xx status";
|
|
5573
|
+
console.error(`[sculpted] ${endpoint} returned ${status}. Response body:`, body);
|
|
5574
|
+
} catch (error) {
|
|
5575
|
+
logUnexpectedRuntimeError(`Failed to read ${endpoint} response body.`, error);
|
|
5576
|
+
}
|
|
5577
|
+
}
|
|
1088
5578
|
function styleEditFailure(editId, message) {
|
|
1089
5579
|
return {
|
|
1090
5580
|
ok: false,
|
|
@@ -1120,6 +5610,7 @@ function previewConditionPseudoSelector(condition) {
|
|
|
1120
5610
|
if (condition === "focus") return ":focus";
|
|
1121
5611
|
if (condition === "focus-visible") return ":focus-visible";
|
|
1122
5612
|
if (condition === "active") return ":active";
|
|
5613
|
+
if (condition === "disabled") return ":disabled";
|
|
1123
5614
|
}
|
|
1124
5615
|
//#endregion
|
|
1125
5616
|
export { SculptedRuntime, installSculptedRuntime };
|