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