@eum-agent/channel-feishu 1.0.0 → 1.0.1

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