@alfe.ai/cli 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ const ID_PREFIXES = {
25
25
  token: "tok",
26
26
  transaction: "txn",
27
27
  subscription: "sub",
28
+ conversation: "conv",
28
29
  request: "req",
29
30
  connection: "conn",
30
31
  correlation: "cor",
@@ -280,8 +281,11 @@ var AuthService = class {
280
281
  this.client = client;
281
282
  }
282
283
  prefix = "/auth";
283
- validate() {
284
- return this.client.request(`${this.prefix}/validate`);
284
+ validate(token) {
285
+ return this.client.request(`${this.prefix}/validate`, {
286
+ method: "POST",
287
+ body: JSON.stringify({ token })
288
+ });
285
289
  }
286
290
  listTokens() {
287
291
  return this.client.request(`${this.prefix}/tokens`);
@@ -297,6 +301,2787 @@ var AuthService = class {
297
301
  }
298
302
  };
299
303
  //#endregion
304
+ //#region ../../packages-internal/types/dist/lib/enum-values.js
305
+ /**
306
+ * Converts a const enum object into a non-empty readonly tuple.
307
+ *
308
+ * Satisfies both `z.enum()` and ElectroDB `type` field requirements
309
+ * (both need `readonly [string, ...string[]]`).
310
+ */
311
+ function enumValues(obj) {
312
+ return Object.values(obj);
313
+ }
314
+ Object.freeze({ status: "aborted" });
315
+ function $constructor(name, initializer, params) {
316
+ function init(inst, def) {
317
+ if (!inst._zod) Object.defineProperty(inst, "_zod", {
318
+ value: {
319
+ def,
320
+ constr: _,
321
+ traits: /* @__PURE__ */ new Set()
322
+ },
323
+ enumerable: false
324
+ });
325
+ if (inst._zod.traits.has(name)) return;
326
+ inst._zod.traits.add(name);
327
+ initializer(inst, def);
328
+ const proto = _.prototype;
329
+ const keys = Object.keys(proto);
330
+ for (let i = 0; i < keys.length; i++) {
331
+ const k = keys[i];
332
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
333
+ }
334
+ }
335
+ const Parent = params?.Parent ?? Object;
336
+ class Definition extends Parent {}
337
+ Object.defineProperty(Definition, "name", { value: name });
338
+ function _(def) {
339
+ var _a;
340
+ const inst = params?.Parent ? new Definition() : this;
341
+ init(inst, def);
342
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
343
+ for (const fn of inst._zod.deferred) fn();
344
+ return inst;
345
+ }
346
+ Object.defineProperty(_, "init", { value: init });
347
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
348
+ if (params?.Parent && inst instanceof params.Parent) return true;
349
+ return inst?._zod?.traits?.has(name);
350
+ } });
351
+ Object.defineProperty(_, "name", { value: name });
352
+ return _;
353
+ }
354
+ var $ZodAsyncError = class extends Error {
355
+ constructor() {
356
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
357
+ }
358
+ };
359
+ var $ZodEncodeError = class extends Error {
360
+ constructor(name) {
361
+ super(`Encountered unidirectional transform during encode: ${name}`);
362
+ this.name = "ZodEncodeError";
363
+ }
364
+ };
365
+ const globalConfig = {};
366
+ function config(newConfig) {
367
+ if (newConfig) Object.assign(globalConfig, newConfig);
368
+ return globalConfig;
369
+ }
370
+ //#endregion
371
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
372
+ function getEnumValues(entries) {
373
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
374
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
375
+ }
376
+ function jsonStringifyReplacer(_, value) {
377
+ if (typeof value === "bigint") return value.toString();
378
+ return value;
379
+ }
380
+ function cached(getter) {
381
+ return { get value() {
382
+ {
383
+ const value = getter();
384
+ Object.defineProperty(this, "value", { value });
385
+ return value;
386
+ }
387
+ throw new Error("cached value already set");
388
+ } };
389
+ }
390
+ function nullish(input) {
391
+ return input === null || input === void 0;
392
+ }
393
+ function cleanRegex(source) {
394
+ const start = source.startsWith("^") ? 1 : 0;
395
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
396
+ return source.slice(start, end);
397
+ }
398
+ function floatSafeRemainder(val, step) {
399
+ const valDecCount = (val.toString().split(".")[1] || "").length;
400
+ const stepString = step.toString();
401
+ let stepDecCount = (stepString.split(".")[1] || "").length;
402
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
403
+ const match = stepString.match(/\d?e-(\d?)/);
404
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
405
+ }
406
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
407
+ return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
408
+ }
409
+ const EVALUATING = Symbol("evaluating");
410
+ function defineLazy(object, key, getter) {
411
+ let value = void 0;
412
+ Object.defineProperty(object, key, {
413
+ get() {
414
+ if (value === EVALUATING) return;
415
+ if (value === void 0) {
416
+ value = EVALUATING;
417
+ value = getter();
418
+ }
419
+ return value;
420
+ },
421
+ set(v) {
422
+ Object.defineProperty(object, key, { value: v });
423
+ },
424
+ configurable: true
425
+ });
426
+ }
427
+ function assignProp(target, prop, value) {
428
+ Object.defineProperty(target, prop, {
429
+ value,
430
+ writable: true,
431
+ enumerable: true,
432
+ configurable: true
433
+ });
434
+ }
435
+ function mergeDefs(...defs) {
436
+ const mergedDescriptors = {};
437
+ for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
438
+ return Object.defineProperties({}, mergedDescriptors);
439
+ }
440
+ function esc(str) {
441
+ return JSON.stringify(str);
442
+ }
443
+ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
444
+ function isObject(data) {
445
+ return typeof data === "object" && data !== null && !Array.isArray(data);
446
+ }
447
+ const allowsEval = cached(() => {
448
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
449
+ try {
450
+ new Function("");
451
+ return true;
452
+ } catch (_) {
453
+ return false;
454
+ }
455
+ });
456
+ function isPlainObject(o) {
457
+ if (isObject(o) === false) return false;
458
+ const ctor = o.constructor;
459
+ if (ctor === void 0) return true;
460
+ if (typeof ctor !== "function") return true;
461
+ const prot = ctor.prototype;
462
+ if (isObject(prot) === false) return false;
463
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
464
+ return true;
465
+ }
466
+ function shallowClone(o) {
467
+ if (isPlainObject(o)) return { ...o };
468
+ if (Array.isArray(o)) return [...o];
469
+ return o;
470
+ }
471
+ const propertyKeyTypes = new Set([
472
+ "string",
473
+ "number",
474
+ "symbol"
475
+ ]);
476
+ function escapeRegex(str) {
477
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
478
+ }
479
+ function clone(inst, def, params) {
480
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
481
+ if (!def || params?.parent) cl._zod.parent = inst;
482
+ return cl;
483
+ }
484
+ function normalizeParams(_params) {
485
+ const params = _params;
486
+ if (!params) return {};
487
+ if (typeof params === "string") return { error: () => params };
488
+ if (params?.message !== void 0) {
489
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
490
+ params.error = params.message;
491
+ }
492
+ delete params.message;
493
+ if (typeof params.error === "string") return {
494
+ ...params,
495
+ error: () => params.error
496
+ };
497
+ return params;
498
+ }
499
+ function optionalKeys(shape) {
500
+ return Object.keys(shape).filter((k) => {
501
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
502
+ });
503
+ }
504
+ const NUMBER_FORMAT_RANGES = {
505
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
506
+ int32: [-2147483648, 2147483647],
507
+ uint32: [0, 4294967295],
508
+ float32: [-34028234663852886e22, 34028234663852886e22],
509
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
510
+ };
511
+ function pick(schema, mask) {
512
+ const currDef = schema._zod.def;
513
+ const checks = currDef.checks;
514
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
515
+ return clone(schema, mergeDefs(schema._zod.def, {
516
+ get shape() {
517
+ const newShape = {};
518
+ for (const key in mask) {
519
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
520
+ if (!mask[key]) continue;
521
+ newShape[key] = currDef.shape[key];
522
+ }
523
+ assignProp(this, "shape", newShape);
524
+ return newShape;
525
+ },
526
+ checks: []
527
+ }));
528
+ }
529
+ function omit(schema, mask) {
530
+ const currDef = schema._zod.def;
531
+ const checks = currDef.checks;
532
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
533
+ return clone(schema, mergeDefs(schema._zod.def, {
534
+ get shape() {
535
+ const newShape = { ...schema._zod.def.shape };
536
+ for (const key in mask) {
537
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
538
+ if (!mask[key]) continue;
539
+ delete newShape[key];
540
+ }
541
+ assignProp(this, "shape", newShape);
542
+ return newShape;
543
+ },
544
+ checks: []
545
+ }));
546
+ }
547
+ function extend(schema, shape) {
548
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
549
+ const checks = schema._zod.def.checks;
550
+ if (checks && checks.length > 0) {
551
+ const existingShape = schema._zod.def.shape;
552
+ 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.");
553
+ }
554
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
555
+ const _shape = {
556
+ ...schema._zod.def.shape,
557
+ ...shape
558
+ };
559
+ assignProp(this, "shape", _shape);
560
+ return _shape;
561
+ } }));
562
+ }
563
+ function safeExtend(schema, shape) {
564
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
565
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
566
+ const _shape = {
567
+ ...schema._zod.def.shape,
568
+ ...shape
569
+ };
570
+ assignProp(this, "shape", _shape);
571
+ return _shape;
572
+ } }));
573
+ }
574
+ function merge(a, b) {
575
+ return clone(a, mergeDefs(a._zod.def, {
576
+ get shape() {
577
+ const _shape = {
578
+ ...a._zod.def.shape,
579
+ ...b._zod.def.shape
580
+ };
581
+ assignProp(this, "shape", _shape);
582
+ return _shape;
583
+ },
584
+ get catchall() {
585
+ return b._zod.def.catchall;
586
+ },
587
+ checks: []
588
+ }));
589
+ }
590
+ function partial(Class, schema, mask) {
591
+ const checks = schema._zod.def.checks;
592
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
593
+ return clone(schema, mergeDefs(schema._zod.def, {
594
+ get shape() {
595
+ const oldShape = schema._zod.def.shape;
596
+ const shape = { ...oldShape };
597
+ if (mask) for (const key in mask) {
598
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
599
+ if (!mask[key]) continue;
600
+ shape[key] = Class ? new Class({
601
+ type: "optional",
602
+ innerType: oldShape[key]
603
+ }) : oldShape[key];
604
+ }
605
+ else for (const key in oldShape) shape[key] = Class ? new Class({
606
+ type: "optional",
607
+ innerType: oldShape[key]
608
+ }) : oldShape[key];
609
+ assignProp(this, "shape", shape);
610
+ return shape;
611
+ },
612
+ checks: []
613
+ }));
614
+ }
615
+ function required(Class, schema, mask) {
616
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
617
+ const oldShape = schema._zod.def.shape;
618
+ const shape = { ...oldShape };
619
+ if (mask) for (const key in mask) {
620
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
621
+ if (!mask[key]) continue;
622
+ shape[key] = new Class({
623
+ type: "nonoptional",
624
+ innerType: oldShape[key]
625
+ });
626
+ }
627
+ else for (const key in oldShape) shape[key] = new Class({
628
+ type: "nonoptional",
629
+ innerType: oldShape[key]
630
+ });
631
+ assignProp(this, "shape", shape);
632
+ return shape;
633
+ } }));
634
+ }
635
+ function aborted(x, startIndex = 0) {
636
+ if (x.aborted === true) return true;
637
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
638
+ return false;
639
+ }
640
+ function prefixIssues(path, issues) {
641
+ return issues.map((iss) => {
642
+ var _a;
643
+ (_a = iss).path ?? (_a.path = []);
644
+ iss.path.unshift(path);
645
+ return iss;
646
+ });
647
+ }
648
+ function unwrapMessage(message) {
649
+ return typeof message === "string" ? message : message?.message;
650
+ }
651
+ function finalizeIssue(iss, ctx, config) {
652
+ const full = {
653
+ ...iss,
654
+ path: iss.path ?? []
655
+ };
656
+ if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
657
+ delete full.inst;
658
+ delete full.continue;
659
+ if (!ctx?.reportInput) delete full.input;
660
+ return full;
661
+ }
662
+ function getLengthableOrigin(input) {
663
+ if (Array.isArray(input)) return "array";
664
+ if (typeof input === "string") return "string";
665
+ return "unknown";
666
+ }
667
+ function issue(...args) {
668
+ const [iss, input, inst] = args;
669
+ if (typeof iss === "string") return {
670
+ message: iss,
671
+ code: "custom",
672
+ input,
673
+ inst
674
+ };
675
+ return { ...iss };
676
+ }
677
+ //#endregion
678
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
679
+ const initializer$1 = (inst, def) => {
680
+ inst.name = "$ZodError";
681
+ Object.defineProperty(inst, "_zod", {
682
+ value: inst._zod,
683
+ enumerable: false
684
+ });
685
+ Object.defineProperty(inst, "issues", {
686
+ value: def,
687
+ enumerable: false
688
+ });
689
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
690
+ Object.defineProperty(inst, "toString", {
691
+ value: () => inst.message,
692
+ enumerable: false
693
+ });
694
+ };
695
+ const $ZodError = $constructor("$ZodError", initializer$1);
696
+ const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
697
+ function flattenError(error, mapper = (issue) => issue.message) {
698
+ const fieldErrors = {};
699
+ const formErrors = [];
700
+ for (const sub of error.issues) if (sub.path.length > 0) {
701
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
702
+ fieldErrors[sub.path[0]].push(mapper(sub));
703
+ } else formErrors.push(mapper(sub));
704
+ return {
705
+ formErrors,
706
+ fieldErrors
707
+ };
708
+ }
709
+ function formatError(error, mapper = (issue) => issue.message) {
710
+ const fieldErrors = { _errors: [] };
711
+ const processError = (error) => {
712
+ for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
713
+ else if (issue.code === "invalid_key") processError({ issues: issue.issues });
714
+ else if (issue.code === "invalid_element") processError({ issues: issue.issues });
715
+ else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
716
+ else {
717
+ let curr = fieldErrors;
718
+ let i = 0;
719
+ while (i < issue.path.length) {
720
+ const el = issue.path[i];
721
+ if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
722
+ else {
723
+ curr[el] = curr[el] || { _errors: [] };
724
+ curr[el]._errors.push(mapper(issue));
725
+ }
726
+ curr = curr[el];
727
+ i++;
728
+ }
729
+ }
730
+ };
731
+ processError(error);
732
+ return fieldErrors;
733
+ }
734
+ //#endregion
735
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
736
+ const _parse = (_Err) => (schema, value, _ctx, _params) => {
737
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
738
+ const result = schema._zod.run({
739
+ value,
740
+ issues: []
741
+ }, ctx);
742
+ if (result instanceof Promise) throw new $ZodAsyncError();
743
+ if (result.issues.length) {
744
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
745
+ captureStackTrace(e, _params?.callee);
746
+ throw e;
747
+ }
748
+ return result.value;
749
+ };
750
+ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
751
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
752
+ let result = schema._zod.run({
753
+ value,
754
+ issues: []
755
+ }, ctx);
756
+ if (result instanceof Promise) result = await result;
757
+ if (result.issues.length) {
758
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
759
+ captureStackTrace(e, params?.callee);
760
+ throw e;
761
+ }
762
+ return result.value;
763
+ };
764
+ const _safeParse = (_Err) => (schema, value, _ctx) => {
765
+ const ctx = _ctx ? {
766
+ ..._ctx,
767
+ async: false
768
+ } : { async: false };
769
+ const result = schema._zod.run({
770
+ value,
771
+ issues: []
772
+ }, ctx);
773
+ if (result instanceof Promise) throw new $ZodAsyncError();
774
+ return result.issues.length ? {
775
+ success: false,
776
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
777
+ } : {
778
+ success: true,
779
+ data: result.value
780
+ };
781
+ };
782
+ const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
783
+ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
784
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
785
+ let result = schema._zod.run({
786
+ value,
787
+ issues: []
788
+ }, ctx);
789
+ if (result instanceof Promise) result = await result;
790
+ return result.issues.length ? {
791
+ success: false,
792
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
793
+ } : {
794
+ success: true,
795
+ data: result.value
796
+ };
797
+ };
798
+ const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
799
+ const _encode = (_Err) => (schema, value, _ctx) => {
800
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
801
+ return _parse(_Err)(schema, value, ctx);
802
+ };
803
+ const _decode = (_Err) => (schema, value, _ctx) => {
804
+ return _parse(_Err)(schema, value, _ctx);
805
+ };
806
+ const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
807
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
808
+ return _parseAsync(_Err)(schema, value, ctx);
809
+ };
810
+ const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
811
+ return _parseAsync(_Err)(schema, value, _ctx);
812
+ };
813
+ const _safeEncode = (_Err) => (schema, value, _ctx) => {
814
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
815
+ return _safeParse(_Err)(schema, value, ctx);
816
+ };
817
+ const _safeDecode = (_Err) => (schema, value, _ctx) => {
818
+ return _safeParse(_Err)(schema, value, _ctx);
819
+ };
820
+ const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
821
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
822
+ return _safeParseAsync(_Err)(schema, value, ctx);
823
+ };
824
+ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
825
+ return _safeParseAsync(_Err)(schema, value, _ctx);
826
+ };
827
+ const integer = /^-?\d+$/;
828
+ const number$1 = /^-?\d+(?:\.\d+)?$/;
829
+ //#endregion
830
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
831
+ const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
832
+ var _a;
833
+ inst._zod ?? (inst._zod = {});
834
+ inst._zod.def = def;
835
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
836
+ });
837
+ const numericOriginMap = {
838
+ number: "number",
839
+ bigint: "bigint",
840
+ object: "date"
841
+ };
842
+ const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
843
+ $ZodCheck.init(inst, def);
844
+ const origin = numericOriginMap[typeof def.value];
845
+ inst._zod.onattach.push((inst) => {
846
+ const bag = inst._zod.bag;
847
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
848
+ if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
849
+ else bag.exclusiveMaximum = def.value;
850
+ });
851
+ inst._zod.check = (payload) => {
852
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
853
+ payload.issues.push({
854
+ origin,
855
+ code: "too_big",
856
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
857
+ input: payload.value,
858
+ inclusive: def.inclusive,
859
+ inst,
860
+ continue: !def.abort
861
+ });
862
+ };
863
+ });
864
+ const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
865
+ $ZodCheck.init(inst, def);
866
+ const origin = numericOriginMap[typeof def.value];
867
+ inst._zod.onattach.push((inst) => {
868
+ const bag = inst._zod.bag;
869
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
870
+ if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
871
+ else bag.exclusiveMinimum = def.value;
872
+ });
873
+ inst._zod.check = (payload) => {
874
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
875
+ payload.issues.push({
876
+ origin,
877
+ code: "too_small",
878
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
879
+ input: payload.value,
880
+ inclusive: def.inclusive,
881
+ inst,
882
+ continue: !def.abort
883
+ });
884
+ };
885
+ });
886
+ const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
887
+ $ZodCheck.init(inst, def);
888
+ inst._zod.onattach.push((inst) => {
889
+ var _a;
890
+ (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
891
+ });
892
+ inst._zod.check = (payload) => {
893
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
894
+ if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
895
+ payload.issues.push({
896
+ origin: typeof payload.value,
897
+ code: "not_multiple_of",
898
+ divisor: def.value,
899
+ input: payload.value,
900
+ inst,
901
+ continue: !def.abort
902
+ });
903
+ };
904
+ });
905
+ const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
906
+ $ZodCheck.init(inst, def);
907
+ def.format = def.format || "float64";
908
+ const isInt = def.format?.includes("int");
909
+ const origin = isInt ? "int" : "number";
910
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
911
+ inst._zod.onattach.push((inst) => {
912
+ const bag = inst._zod.bag;
913
+ bag.format = def.format;
914
+ bag.minimum = minimum;
915
+ bag.maximum = maximum;
916
+ if (isInt) bag.pattern = integer;
917
+ });
918
+ inst._zod.check = (payload) => {
919
+ const input = payload.value;
920
+ if (isInt) {
921
+ if (!Number.isInteger(input)) {
922
+ payload.issues.push({
923
+ expected: origin,
924
+ format: def.format,
925
+ code: "invalid_type",
926
+ continue: false,
927
+ input,
928
+ inst
929
+ });
930
+ return;
931
+ }
932
+ if (!Number.isSafeInteger(input)) {
933
+ if (input > 0) payload.issues.push({
934
+ input,
935
+ code: "too_big",
936
+ maximum: Number.MAX_SAFE_INTEGER,
937
+ note: "Integers must be within the safe integer range.",
938
+ inst,
939
+ origin,
940
+ inclusive: true,
941
+ continue: !def.abort
942
+ });
943
+ else payload.issues.push({
944
+ input,
945
+ code: "too_small",
946
+ minimum: Number.MIN_SAFE_INTEGER,
947
+ note: "Integers must be within the safe integer range.",
948
+ inst,
949
+ origin,
950
+ inclusive: true,
951
+ continue: !def.abort
952
+ });
953
+ return;
954
+ }
955
+ }
956
+ if (input < minimum) payload.issues.push({
957
+ origin: "number",
958
+ input,
959
+ code: "too_small",
960
+ minimum,
961
+ inclusive: true,
962
+ inst,
963
+ continue: !def.abort
964
+ });
965
+ if (input > maximum) payload.issues.push({
966
+ origin: "number",
967
+ input,
968
+ code: "too_big",
969
+ maximum,
970
+ inclusive: true,
971
+ inst,
972
+ continue: !def.abort
973
+ });
974
+ };
975
+ });
976
+ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
977
+ var _a;
978
+ $ZodCheck.init(inst, def);
979
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
980
+ const val = payload.value;
981
+ return !nullish(val) && val.length !== void 0;
982
+ });
983
+ inst._zod.onattach.push((inst) => {
984
+ const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
985
+ if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
986
+ });
987
+ inst._zod.check = (payload) => {
988
+ const input = payload.value;
989
+ if (input.length <= def.maximum) return;
990
+ const origin = getLengthableOrigin(input);
991
+ payload.issues.push({
992
+ origin,
993
+ code: "too_big",
994
+ maximum: def.maximum,
995
+ inclusive: true,
996
+ input,
997
+ inst,
998
+ continue: !def.abort
999
+ });
1000
+ };
1001
+ });
1002
+ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
1003
+ var _a;
1004
+ $ZodCheck.init(inst, def);
1005
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1006
+ const val = payload.value;
1007
+ return !nullish(val) && val.length !== void 0;
1008
+ });
1009
+ inst._zod.onattach.push((inst) => {
1010
+ const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1011
+ if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
1012
+ });
1013
+ inst._zod.check = (payload) => {
1014
+ const input = payload.value;
1015
+ if (input.length >= def.minimum) return;
1016
+ const origin = getLengthableOrigin(input);
1017
+ payload.issues.push({
1018
+ origin,
1019
+ code: "too_small",
1020
+ minimum: def.minimum,
1021
+ inclusive: true,
1022
+ input,
1023
+ inst,
1024
+ continue: !def.abort
1025
+ });
1026
+ };
1027
+ });
1028
+ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
1029
+ var _a;
1030
+ $ZodCheck.init(inst, def);
1031
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1032
+ const val = payload.value;
1033
+ return !nullish(val) && val.length !== void 0;
1034
+ });
1035
+ inst._zod.onattach.push((inst) => {
1036
+ const bag = inst._zod.bag;
1037
+ bag.minimum = def.length;
1038
+ bag.maximum = def.length;
1039
+ bag.length = def.length;
1040
+ });
1041
+ inst._zod.check = (payload) => {
1042
+ const input = payload.value;
1043
+ const length = input.length;
1044
+ if (length === def.length) return;
1045
+ const origin = getLengthableOrigin(input);
1046
+ const tooBig = length > def.length;
1047
+ payload.issues.push({
1048
+ origin,
1049
+ ...tooBig ? {
1050
+ code: "too_big",
1051
+ maximum: def.length
1052
+ } : {
1053
+ code: "too_small",
1054
+ minimum: def.length
1055
+ },
1056
+ inclusive: true,
1057
+ exact: true,
1058
+ input: payload.value,
1059
+ inst,
1060
+ continue: !def.abort
1061
+ });
1062
+ };
1063
+ });
1064
+ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
1065
+ $ZodCheck.init(inst, def);
1066
+ inst._zod.check = (payload) => {
1067
+ payload.value = def.tx(payload.value);
1068
+ };
1069
+ });
1070
+ //#endregion
1071
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
1072
+ var Doc = class {
1073
+ constructor(args = []) {
1074
+ this.content = [];
1075
+ this.indent = 0;
1076
+ if (this) this.args = args;
1077
+ }
1078
+ indented(fn) {
1079
+ this.indent += 1;
1080
+ fn(this);
1081
+ this.indent -= 1;
1082
+ }
1083
+ write(arg) {
1084
+ if (typeof arg === "function") {
1085
+ arg(this, { execution: "sync" });
1086
+ arg(this, { execution: "async" });
1087
+ return;
1088
+ }
1089
+ const lines = arg.split("\n").filter((x) => x);
1090
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
1091
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
1092
+ for (const line of dedented) this.content.push(line);
1093
+ }
1094
+ compile() {
1095
+ const F = Function;
1096
+ const args = this?.args;
1097
+ const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
1098
+ return new F(...args, lines.join("\n"));
1099
+ }
1100
+ };
1101
+ //#endregion
1102
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
1103
+ const version = {
1104
+ major: 4,
1105
+ minor: 3,
1106
+ patch: 6
1107
+ };
1108
+ //#endregion
1109
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
1110
+ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1111
+ var _a;
1112
+ inst ?? (inst = {});
1113
+ inst._zod.def = def;
1114
+ inst._zod.bag = inst._zod.bag || {};
1115
+ inst._zod.version = version;
1116
+ const checks = [...inst._zod.def.checks ?? []];
1117
+ if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1118
+ for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1119
+ if (checks.length === 0) {
1120
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
1121
+ inst._zod.deferred?.push(() => {
1122
+ inst._zod.run = inst._zod.parse;
1123
+ });
1124
+ } else {
1125
+ const runChecks = (payload, checks, ctx) => {
1126
+ let isAborted = aborted(payload);
1127
+ let asyncResult;
1128
+ for (const ch of checks) {
1129
+ if (ch._zod.def.when) {
1130
+ if (!ch._zod.def.when(payload)) continue;
1131
+ } else if (isAborted) continue;
1132
+ const currLen = payload.issues.length;
1133
+ const _ = ch._zod.check(payload);
1134
+ if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
1135
+ if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1136
+ await _;
1137
+ if (payload.issues.length === currLen) return;
1138
+ if (!isAborted) isAborted = aborted(payload, currLen);
1139
+ });
1140
+ else {
1141
+ if (payload.issues.length === currLen) continue;
1142
+ if (!isAborted) isAborted = aborted(payload, currLen);
1143
+ }
1144
+ }
1145
+ if (asyncResult) return asyncResult.then(() => {
1146
+ return payload;
1147
+ });
1148
+ return payload;
1149
+ };
1150
+ const handleCanaryResult = (canary, payload, ctx) => {
1151
+ if (aborted(canary)) {
1152
+ canary.aborted = true;
1153
+ return canary;
1154
+ }
1155
+ const checkResult = runChecks(payload, checks, ctx);
1156
+ if (checkResult instanceof Promise) {
1157
+ if (ctx.async === false) throw new $ZodAsyncError();
1158
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
1159
+ }
1160
+ return inst._zod.parse(checkResult, ctx);
1161
+ };
1162
+ inst._zod.run = (payload, ctx) => {
1163
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
1164
+ if (ctx.direction === "backward") {
1165
+ const canary = inst._zod.parse({
1166
+ value: payload.value,
1167
+ issues: []
1168
+ }, {
1169
+ ...ctx,
1170
+ skipChecks: true
1171
+ });
1172
+ if (canary instanceof Promise) return canary.then((canary) => {
1173
+ return handleCanaryResult(canary, payload, ctx);
1174
+ });
1175
+ return handleCanaryResult(canary, payload, ctx);
1176
+ }
1177
+ const result = inst._zod.parse(payload, ctx);
1178
+ if (result instanceof Promise) {
1179
+ if (ctx.async === false) throw new $ZodAsyncError();
1180
+ return result.then((result) => runChecks(result, checks, ctx));
1181
+ }
1182
+ return runChecks(result, checks, ctx);
1183
+ };
1184
+ }
1185
+ defineLazy(inst, "~standard", () => ({
1186
+ validate: (value) => {
1187
+ try {
1188
+ const r = safeParse$1(inst, value);
1189
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
1190
+ } catch (_) {
1191
+ return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1192
+ }
1193
+ },
1194
+ vendor: "zod",
1195
+ version: 1
1196
+ }));
1197
+ });
1198
+ const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
1199
+ $ZodType.init(inst, def);
1200
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
1201
+ inst._zod.parse = (payload, _ctx) => {
1202
+ if (def.coerce) try {
1203
+ payload.value = Number(payload.value);
1204
+ } catch (_) {}
1205
+ const input = payload.value;
1206
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1207
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1208
+ payload.issues.push({
1209
+ expected: "number",
1210
+ code: "invalid_type",
1211
+ input,
1212
+ inst,
1213
+ ...received ? { received } : {}
1214
+ });
1215
+ return payload;
1216
+ };
1217
+ });
1218
+ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
1219
+ $ZodCheckNumberFormat.init(inst, def);
1220
+ $ZodNumber.init(inst, def);
1221
+ });
1222
+ const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
1223
+ $ZodType.init(inst, def);
1224
+ inst._zod.parse = (payload) => payload;
1225
+ });
1226
+ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1227
+ $ZodType.init(inst, def);
1228
+ inst._zod.parse = (payload, _ctx) => {
1229
+ payload.issues.push({
1230
+ expected: "never",
1231
+ code: "invalid_type",
1232
+ input: payload.value,
1233
+ inst
1234
+ });
1235
+ return payload;
1236
+ };
1237
+ });
1238
+ function handleArrayResult(result, final, index) {
1239
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1240
+ final.value[index] = result.value;
1241
+ }
1242
+ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1243
+ $ZodType.init(inst, def);
1244
+ inst._zod.parse = (payload, ctx) => {
1245
+ const input = payload.value;
1246
+ if (!Array.isArray(input)) {
1247
+ payload.issues.push({
1248
+ expected: "array",
1249
+ code: "invalid_type",
1250
+ input,
1251
+ inst
1252
+ });
1253
+ return payload;
1254
+ }
1255
+ payload.value = Array(input.length);
1256
+ const proms = [];
1257
+ for (let i = 0; i < input.length; i++) {
1258
+ const item = input[i];
1259
+ const result = def.element._zod.run({
1260
+ value: item,
1261
+ issues: []
1262
+ }, ctx);
1263
+ if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1264
+ else handleArrayResult(result, payload, i);
1265
+ }
1266
+ if (proms.length) return Promise.all(proms).then(() => payload);
1267
+ return payload;
1268
+ };
1269
+ });
1270
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
1271
+ if (result.issues.length) {
1272
+ if (isOptionalOut && !(key in input)) return;
1273
+ final.issues.push(...prefixIssues(key, result.issues));
1274
+ }
1275
+ if (result.value === void 0) {
1276
+ if (key in input) final.value[key] = void 0;
1277
+ } else final.value[key] = result.value;
1278
+ }
1279
+ function normalizeDef(def) {
1280
+ const keys = Object.keys(def.shape);
1281
+ 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`);
1282
+ const okeys = optionalKeys(def.shape);
1283
+ return {
1284
+ ...def,
1285
+ keys,
1286
+ keySet: new Set(keys),
1287
+ numKeys: keys.length,
1288
+ optionalKeys: new Set(okeys)
1289
+ };
1290
+ }
1291
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1292
+ const unrecognized = [];
1293
+ const keySet = def.keySet;
1294
+ const _catchall = def.catchall._zod;
1295
+ const t = _catchall.def.type;
1296
+ const isOptionalOut = _catchall.optout === "optional";
1297
+ for (const key in input) {
1298
+ if (keySet.has(key)) continue;
1299
+ if (t === "never") {
1300
+ unrecognized.push(key);
1301
+ continue;
1302
+ }
1303
+ const r = _catchall.run({
1304
+ value: input[key],
1305
+ issues: []
1306
+ }, ctx);
1307
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1308
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
1309
+ }
1310
+ if (unrecognized.length) payload.issues.push({
1311
+ code: "unrecognized_keys",
1312
+ keys: unrecognized,
1313
+ input,
1314
+ inst
1315
+ });
1316
+ if (!proms.length) return payload;
1317
+ return Promise.all(proms).then(() => {
1318
+ return payload;
1319
+ });
1320
+ }
1321
+ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1322
+ $ZodType.init(inst, def);
1323
+ if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1324
+ const sh = def.shape;
1325
+ Object.defineProperty(def, "shape", { get: () => {
1326
+ const newSh = { ...sh };
1327
+ Object.defineProperty(def, "shape", { value: newSh });
1328
+ return newSh;
1329
+ } });
1330
+ }
1331
+ const _normalized = cached(() => normalizeDef(def));
1332
+ defineLazy(inst._zod, "propValues", () => {
1333
+ const shape = def.shape;
1334
+ const propValues = {};
1335
+ for (const key in shape) {
1336
+ const field = shape[key]._zod;
1337
+ if (field.values) {
1338
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1339
+ for (const v of field.values) propValues[key].add(v);
1340
+ }
1341
+ }
1342
+ return propValues;
1343
+ });
1344
+ const isObject$2 = isObject;
1345
+ const catchall = def.catchall;
1346
+ let value;
1347
+ inst._zod.parse = (payload, ctx) => {
1348
+ value ?? (value = _normalized.value);
1349
+ const input = payload.value;
1350
+ if (!isObject$2(input)) {
1351
+ payload.issues.push({
1352
+ expected: "object",
1353
+ code: "invalid_type",
1354
+ input,
1355
+ inst
1356
+ });
1357
+ return payload;
1358
+ }
1359
+ payload.value = {};
1360
+ const proms = [];
1361
+ const shape = value.shape;
1362
+ for (const key of value.keys) {
1363
+ const el = shape[key];
1364
+ const isOptionalOut = el._zod.optout === "optional";
1365
+ const r = el._zod.run({
1366
+ value: input[key],
1367
+ issues: []
1368
+ }, ctx);
1369
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1370
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
1371
+ }
1372
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1373
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1374
+ };
1375
+ });
1376
+ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
1377
+ $ZodObject.init(inst, def);
1378
+ const superParse = inst._zod.parse;
1379
+ const _normalized = cached(() => normalizeDef(def));
1380
+ const generateFastpass = (shape) => {
1381
+ const doc = new Doc([
1382
+ "shape",
1383
+ "payload",
1384
+ "ctx"
1385
+ ]);
1386
+ const normalized = _normalized.value;
1387
+ const parseStr = (key) => {
1388
+ const k = esc(key);
1389
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1390
+ };
1391
+ doc.write(`const input = payload.value;`);
1392
+ const ids = Object.create(null);
1393
+ let counter = 0;
1394
+ for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1395
+ doc.write(`const newResult = {};`);
1396
+ for (const key of normalized.keys) {
1397
+ const id = ids[key];
1398
+ const k = esc(key);
1399
+ const isOptionalOut = shape[key]?._zod?.optout === "optional";
1400
+ doc.write(`const ${id} = ${parseStr(key)};`);
1401
+ if (isOptionalOut) doc.write(`
1402
+ if (${id}.issues.length) {
1403
+ if (${k} in input) {
1404
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1405
+ ...iss,
1406
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1407
+ })));
1408
+ }
1409
+ }
1410
+
1411
+ if (${id}.value === undefined) {
1412
+ if (${k} in input) {
1413
+ newResult[${k}] = undefined;
1414
+ }
1415
+ } else {
1416
+ newResult[${k}] = ${id}.value;
1417
+ }
1418
+
1419
+ `);
1420
+ else doc.write(`
1421
+ if (${id}.issues.length) {
1422
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1423
+ ...iss,
1424
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1425
+ })));
1426
+ }
1427
+
1428
+ if (${id}.value === undefined) {
1429
+ if (${k} in input) {
1430
+ newResult[${k}] = undefined;
1431
+ }
1432
+ } else {
1433
+ newResult[${k}] = ${id}.value;
1434
+ }
1435
+
1436
+ `);
1437
+ }
1438
+ doc.write(`payload.value = newResult;`);
1439
+ doc.write(`return payload;`);
1440
+ const fn = doc.compile();
1441
+ return (payload, ctx) => fn(shape, payload, ctx);
1442
+ };
1443
+ let fastpass;
1444
+ const isObject$1 = isObject;
1445
+ const jit = !globalConfig.jitless;
1446
+ const fastEnabled = jit && allowsEval.value;
1447
+ const catchall = def.catchall;
1448
+ let value;
1449
+ inst._zod.parse = (payload, ctx) => {
1450
+ value ?? (value = _normalized.value);
1451
+ const input = payload.value;
1452
+ if (!isObject$1(input)) {
1453
+ payload.issues.push({
1454
+ expected: "object",
1455
+ code: "invalid_type",
1456
+ input,
1457
+ inst
1458
+ });
1459
+ return payload;
1460
+ }
1461
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1462
+ if (!fastpass) fastpass = generateFastpass(def.shape);
1463
+ payload = fastpass(payload, ctx);
1464
+ if (!catchall) return payload;
1465
+ return handleCatchall([], input, payload, ctx, value, inst);
1466
+ }
1467
+ return superParse(payload, ctx);
1468
+ };
1469
+ });
1470
+ function handleUnionResults(results, final, inst, ctx) {
1471
+ for (const result of results) if (result.issues.length === 0) {
1472
+ final.value = result.value;
1473
+ return final;
1474
+ }
1475
+ const nonaborted = results.filter((r) => !aborted(r));
1476
+ if (nonaborted.length === 1) {
1477
+ final.value = nonaborted[0].value;
1478
+ return nonaborted[0];
1479
+ }
1480
+ final.issues.push({
1481
+ code: "invalid_union",
1482
+ input: final.value,
1483
+ inst,
1484
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1485
+ });
1486
+ return final;
1487
+ }
1488
+ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1489
+ $ZodType.init(inst, def);
1490
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1491
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1492
+ defineLazy(inst._zod, "values", () => {
1493
+ if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1494
+ });
1495
+ defineLazy(inst._zod, "pattern", () => {
1496
+ if (def.options.every((o) => o._zod.pattern)) {
1497
+ const patterns = def.options.map((o) => o._zod.pattern);
1498
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1499
+ }
1500
+ });
1501
+ const single = def.options.length === 1;
1502
+ const first = def.options[0]._zod.run;
1503
+ inst._zod.parse = (payload, ctx) => {
1504
+ if (single) return first(payload, ctx);
1505
+ let async = false;
1506
+ const results = [];
1507
+ for (const option of def.options) {
1508
+ const result = option._zod.run({
1509
+ value: payload.value,
1510
+ issues: []
1511
+ }, ctx);
1512
+ if (result instanceof Promise) {
1513
+ results.push(result);
1514
+ async = true;
1515
+ } else {
1516
+ if (result.issues.length === 0) return result;
1517
+ results.push(result);
1518
+ }
1519
+ }
1520
+ if (!async) return handleUnionResults(results, payload, inst, ctx);
1521
+ return Promise.all(results).then((results) => {
1522
+ return handleUnionResults(results, payload, inst, ctx);
1523
+ });
1524
+ };
1525
+ });
1526
+ const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
1527
+ $ZodType.init(inst, def);
1528
+ inst._zod.parse = (payload, ctx) => {
1529
+ const input = payload.value;
1530
+ const left = def.left._zod.run({
1531
+ value: input,
1532
+ issues: []
1533
+ }, ctx);
1534
+ const right = def.right._zod.run({
1535
+ value: input,
1536
+ issues: []
1537
+ }, ctx);
1538
+ if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
1539
+ return handleIntersectionResults(payload, left, right);
1540
+ });
1541
+ return handleIntersectionResults(payload, left, right);
1542
+ };
1543
+ });
1544
+ function mergeValues(a, b) {
1545
+ if (a === b) return {
1546
+ valid: true,
1547
+ data: a
1548
+ };
1549
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
1550
+ valid: true,
1551
+ data: a
1552
+ };
1553
+ if (isPlainObject(a) && isPlainObject(b)) {
1554
+ const bKeys = Object.keys(b);
1555
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1556
+ const newObj = {
1557
+ ...a,
1558
+ ...b
1559
+ };
1560
+ for (const key of sharedKeys) {
1561
+ const sharedValue = mergeValues(a[key], b[key]);
1562
+ if (!sharedValue.valid) return {
1563
+ valid: false,
1564
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
1565
+ };
1566
+ newObj[key] = sharedValue.data;
1567
+ }
1568
+ return {
1569
+ valid: true,
1570
+ data: newObj
1571
+ };
1572
+ }
1573
+ if (Array.isArray(a) && Array.isArray(b)) {
1574
+ if (a.length !== b.length) return {
1575
+ valid: false,
1576
+ mergeErrorPath: []
1577
+ };
1578
+ const newArray = [];
1579
+ for (let index = 0; index < a.length; index++) {
1580
+ const itemA = a[index];
1581
+ const itemB = b[index];
1582
+ const sharedValue = mergeValues(itemA, itemB);
1583
+ if (!sharedValue.valid) return {
1584
+ valid: false,
1585
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
1586
+ };
1587
+ newArray.push(sharedValue.data);
1588
+ }
1589
+ return {
1590
+ valid: true,
1591
+ data: newArray
1592
+ };
1593
+ }
1594
+ return {
1595
+ valid: false,
1596
+ mergeErrorPath: []
1597
+ };
1598
+ }
1599
+ function handleIntersectionResults(result, left, right) {
1600
+ const unrecKeys = /* @__PURE__ */ new Map();
1601
+ let unrecIssue;
1602
+ for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1603
+ unrecIssue ?? (unrecIssue = iss);
1604
+ for (const k of iss.keys) {
1605
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1606
+ unrecKeys.get(k).l = true;
1607
+ }
1608
+ } else result.issues.push(iss);
1609
+ for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1610
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1611
+ unrecKeys.get(k).r = true;
1612
+ }
1613
+ else result.issues.push(iss);
1614
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1615
+ if (bothKeys.length && unrecIssue) result.issues.push({
1616
+ ...unrecIssue,
1617
+ keys: bothKeys
1618
+ });
1619
+ if (aborted(result)) return result;
1620
+ const merged = mergeValues(left.value, right.value);
1621
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1622
+ result.value = merged.data;
1623
+ return result;
1624
+ }
1625
+ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1626
+ $ZodType.init(inst, def);
1627
+ const values = getEnumValues(def.entries);
1628
+ const valuesSet = new Set(values);
1629
+ inst._zod.values = valuesSet;
1630
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1631
+ inst._zod.parse = (payload, _ctx) => {
1632
+ const input = payload.value;
1633
+ if (valuesSet.has(input)) return payload;
1634
+ payload.issues.push({
1635
+ code: "invalid_value",
1636
+ values,
1637
+ input,
1638
+ inst
1639
+ });
1640
+ return payload;
1641
+ };
1642
+ });
1643
+ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1644
+ $ZodType.init(inst, def);
1645
+ inst._zod.parse = (payload, ctx) => {
1646
+ if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
1647
+ const _out = def.transform(payload.value, payload);
1648
+ if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
1649
+ payload.value = output;
1650
+ return payload;
1651
+ });
1652
+ if (_out instanceof Promise) throw new $ZodAsyncError();
1653
+ payload.value = _out;
1654
+ return payload;
1655
+ };
1656
+ });
1657
+ function handleOptionalResult(result, input) {
1658
+ if (result.issues.length && input === void 0) return {
1659
+ issues: [],
1660
+ value: void 0
1661
+ };
1662
+ return result;
1663
+ }
1664
+ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1665
+ $ZodType.init(inst, def);
1666
+ inst._zod.optin = "optional";
1667
+ inst._zod.optout = "optional";
1668
+ defineLazy(inst._zod, "values", () => {
1669
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
1670
+ });
1671
+ defineLazy(inst._zod, "pattern", () => {
1672
+ const pattern = def.innerType._zod.pattern;
1673
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1674
+ });
1675
+ inst._zod.parse = (payload, ctx) => {
1676
+ if (def.innerType._zod.optin === "optional") {
1677
+ const result = def.innerType._zod.run(payload, ctx);
1678
+ if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
1679
+ return handleOptionalResult(result, payload.value);
1680
+ }
1681
+ if (payload.value === void 0) return payload;
1682
+ return def.innerType._zod.run(payload, ctx);
1683
+ };
1684
+ });
1685
+ const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
1686
+ $ZodOptional.init(inst, def);
1687
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1688
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
1689
+ inst._zod.parse = (payload, ctx) => {
1690
+ return def.innerType._zod.run(payload, ctx);
1691
+ };
1692
+ });
1693
+ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1694
+ $ZodType.init(inst, def);
1695
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1696
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1697
+ defineLazy(inst._zod, "pattern", () => {
1698
+ const pattern = def.innerType._zod.pattern;
1699
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1700
+ });
1701
+ defineLazy(inst._zod, "values", () => {
1702
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
1703
+ });
1704
+ inst._zod.parse = (payload, ctx) => {
1705
+ if (payload.value === null) return payload;
1706
+ return def.innerType._zod.run(payload, ctx);
1707
+ };
1708
+ });
1709
+ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
1710
+ $ZodType.init(inst, def);
1711
+ inst._zod.optin = "optional";
1712
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1713
+ inst._zod.parse = (payload, ctx) => {
1714
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1715
+ if (payload.value === void 0) {
1716
+ payload.value = def.defaultValue;
1717
+ /**
1718
+ * $ZodDefault returns the default value immediately in forward direction.
1719
+ * 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. */
1720
+ return payload;
1721
+ }
1722
+ const result = def.innerType._zod.run(payload, ctx);
1723
+ if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
1724
+ return handleDefaultResult(result, def);
1725
+ };
1726
+ });
1727
+ function handleDefaultResult(payload, def) {
1728
+ if (payload.value === void 0) payload.value = def.defaultValue;
1729
+ return payload;
1730
+ }
1731
+ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
1732
+ $ZodType.init(inst, def);
1733
+ inst._zod.optin = "optional";
1734
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1735
+ inst._zod.parse = (payload, ctx) => {
1736
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1737
+ if (payload.value === void 0) payload.value = def.defaultValue;
1738
+ return def.innerType._zod.run(payload, ctx);
1739
+ };
1740
+ });
1741
+ const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
1742
+ $ZodType.init(inst, def);
1743
+ defineLazy(inst._zod, "values", () => {
1744
+ const v = def.innerType._zod.values;
1745
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
1746
+ });
1747
+ inst._zod.parse = (payload, ctx) => {
1748
+ const result = def.innerType._zod.run(payload, ctx);
1749
+ if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
1750
+ return handleNonOptionalResult(result, inst);
1751
+ };
1752
+ });
1753
+ function handleNonOptionalResult(payload, inst) {
1754
+ if (!payload.issues.length && payload.value === void 0) payload.issues.push({
1755
+ code: "invalid_type",
1756
+ expected: "nonoptional",
1757
+ input: payload.value,
1758
+ inst
1759
+ });
1760
+ return payload;
1761
+ }
1762
+ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
1763
+ $ZodType.init(inst, def);
1764
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1765
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1766
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1767
+ inst._zod.parse = (payload, ctx) => {
1768
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1769
+ const result = def.innerType._zod.run(payload, ctx);
1770
+ if (result instanceof Promise) return result.then((result) => {
1771
+ payload.value = result.value;
1772
+ if (result.issues.length) {
1773
+ payload.value = def.catchValue({
1774
+ ...payload,
1775
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
1776
+ input: payload.value
1777
+ });
1778
+ payload.issues = [];
1779
+ }
1780
+ return payload;
1781
+ });
1782
+ payload.value = result.value;
1783
+ if (result.issues.length) {
1784
+ payload.value = def.catchValue({
1785
+ ...payload,
1786
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
1787
+ input: payload.value
1788
+ });
1789
+ payload.issues = [];
1790
+ }
1791
+ return payload;
1792
+ };
1793
+ });
1794
+ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
1795
+ $ZodType.init(inst, def);
1796
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
1797
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1798
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1799
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
1800
+ inst._zod.parse = (payload, ctx) => {
1801
+ if (ctx.direction === "backward") {
1802
+ const right = def.out._zod.run(payload, ctx);
1803
+ if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
1804
+ return handlePipeResult(right, def.in, ctx);
1805
+ }
1806
+ const left = def.in._zod.run(payload, ctx);
1807
+ if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
1808
+ return handlePipeResult(left, def.out, ctx);
1809
+ };
1810
+ });
1811
+ function handlePipeResult(left, next, ctx) {
1812
+ if (left.issues.length) {
1813
+ left.aborted = true;
1814
+ return left;
1815
+ }
1816
+ return next._zod.run({
1817
+ value: left.value,
1818
+ issues: left.issues
1819
+ }, ctx);
1820
+ }
1821
+ const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
1822
+ $ZodType.init(inst, def);
1823
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1824
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1825
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
1826
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
1827
+ inst._zod.parse = (payload, ctx) => {
1828
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1829
+ const result = def.innerType._zod.run(payload, ctx);
1830
+ if (result instanceof Promise) return result.then(handleReadonlyResult);
1831
+ return handleReadonlyResult(result);
1832
+ };
1833
+ });
1834
+ function handleReadonlyResult(payload) {
1835
+ payload.value = Object.freeze(payload.value);
1836
+ return payload;
1837
+ }
1838
+ const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
1839
+ $ZodCheck.init(inst, def);
1840
+ $ZodType.init(inst, def);
1841
+ inst._zod.parse = (payload, _) => {
1842
+ return payload;
1843
+ };
1844
+ inst._zod.check = (payload) => {
1845
+ const input = payload.value;
1846
+ const r = def.fn(input);
1847
+ if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
1848
+ handleRefineResult(r, payload, input, inst);
1849
+ };
1850
+ });
1851
+ function handleRefineResult(result, payload, input, inst) {
1852
+ if (!result) {
1853
+ const _iss = {
1854
+ code: "custom",
1855
+ input,
1856
+ inst,
1857
+ path: [...inst._zod.def.path ?? []],
1858
+ continue: !inst._zod.def.abort
1859
+ };
1860
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
1861
+ payload.issues.push(issue(_iss));
1862
+ }
1863
+ }
1864
+ //#endregion
1865
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
1866
+ var _a;
1867
+ var $ZodRegistry = class {
1868
+ constructor() {
1869
+ this._map = /* @__PURE__ */ new WeakMap();
1870
+ this._idmap = /* @__PURE__ */ new Map();
1871
+ }
1872
+ add(schema, ..._meta) {
1873
+ const meta = _meta[0];
1874
+ this._map.set(schema, meta);
1875
+ if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
1876
+ return this;
1877
+ }
1878
+ clear() {
1879
+ this._map = /* @__PURE__ */ new WeakMap();
1880
+ this._idmap = /* @__PURE__ */ new Map();
1881
+ return this;
1882
+ }
1883
+ remove(schema) {
1884
+ const meta = this._map.get(schema);
1885
+ if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
1886
+ this._map.delete(schema);
1887
+ return this;
1888
+ }
1889
+ get(schema) {
1890
+ const p = schema._zod.parent;
1891
+ if (p) {
1892
+ const pm = { ...this.get(p) ?? {} };
1893
+ delete pm.id;
1894
+ const f = {
1895
+ ...pm,
1896
+ ...this._map.get(schema)
1897
+ };
1898
+ return Object.keys(f).length ? f : void 0;
1899
+ }
1900
+ return this._map.get(schema);
1901
+ }
1902
+ has(schema) {
1903
+ return this._map.has(schema);
1904
+ }
1905
+ };
1906
+ function registry() {
1907
+ return new $ZodRegistry();
1908
+ }
1909
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
1910
+ const globalRegistry = globalThis.__zod_globalRegistry;
1911
+ //#endregion
1912
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
1913
+ /* @__NO_SIDE_EFFECTS__ */
1914
+ function _number(Class, params) {
1915
+ return new Class({
1916
+ type: "number",
1917
+ checks: [],
1918
+ ...normalizeParams(params)
1919
+ });
1920
+ }
1921
+ /* @__NO_SIDE_EFFECTS__ */
1922
+ function _int(Class, params) {
1923
+ return new Class({
1924
+ type: "number",
1925
+ check: "number_format",
1926
+ abort: false,
1927
+ format: "safeint",
1928
+ ...normalizeParams(params)
1929
+ });
1930
+ }
1931
+ /* @__NO_SIDE_EFFECTS__ */
1932
+ function _unknown(Class) {
1933
+ return new Class({ type: "unknown" });
1934
+ }
1935
+ /* @__NO_SIDE_EFFECTS__ */
1936
+ function _never(Class, params) {
1937
+ return new Class({
1938
+ type: "never",
1939
+ ...normalizeParams(params)
1940
+ });
1941
+ }
1942
+ /* @__NO_SIDE_EFFECTS__ */
1943
+ function _lt(value, params) {
1944
+ return new $ZodCheckLessThan({
1945
+ check: "less_than",
1946
+ ...normalizeParams(params),
1947
+ value,
1948
+ inclusive: false
1949
+ });
1950
+ }
1951
+ /* @__NO_SIDE_EFFECTS__ */
1952
+ function _lte(value, params) {
1953
+ return new $ZodCheckLessThan({
1954
+ check: "less_than",
1955
+ ...normalizeParams(params),
1956
+ value,
1957
+ inclusive: true
1958
+ });
1959
+ }
1960
+ /* @__NO_SIDE_EFFECTS__ */
1961
+ function _gt(value, params) {
1962
+ return new $ZodCheckGreaterThan({
1963
+ check: "greater_than",
1964
+ ...normalizeParams(params),
1965
+ value,
1966
+ inclusive: false
1967
+ });
1968
+ }
1969
+ /* @__NO_SIDE_EFFECTS__ */
1970
+ function _gte(value, params) {
1971
+ return new $ZodCheckGreaterThan({
1972
+ check: "greater_than",
1973
+ ...normalizeParams(params),
1974
+ value,
1975
+ inclusive: true
1976
+ });
1977
+ }
1978
+ /* @__NO_SIDE_EFFECTS__ */
1979
+ function _multipleOf(value, params) {
1980
+ return new $ZodCheckMultipleOf({
1981
+ check: "multiple_of",
1982
+ ...normalizeParams(params),
1983
+ value
1984
+ });
1985
+ }
1986
+ /* @__NO_SIDE_EFFECTS__ */
1987
+ function _maxLength(maximum, params) {
1988
+ return new $ZodCheckMaxLength({
1989
+ check: "max_length",
1990
+ ...normalizeParams(params),
1991
+ maximum
1992
+ });
1993
+ }
1994
+ /* @__NO_SIDE_EFFECTS__ */
1995
+ function _minLength(minimum, params) {
1996
+ return new $ZodCheckMinLength({
1997
+ check: "min_length",
1998
+ ...normalizeParams(params),
1999
+ minimum
2000
+ });
2001
+ }
2002
+ /* @__NO_SIDE_EFFECTS__ */
2003
+ function _length(length, params) {
2004
+ return new $ZodCheckLengthEquals({
2005
+ check: "length_equals",
2006
+ ...normalizeParams(params),
2007
+ length
2008
+ });
2009
+ }
2010
+ /* @__NO_SIDE_EFFECTS__ */
2011
+ function _overwrite(tx) {
2012
+ return new $ZodCheckOverwrite({
2013
+ check: "overwrite",
2014
+ tx
2015
+ });
2016
+ }
2017
+ /* @__NO_SIDE_EFFECTS__ */
2018
+ function _array(Class, element, params) {
2019
+ return new Class({
2020
+ type: "array",
2021
+ element,
2022
+ ...normalizeParams(params)
2023
+ });
2024
+ }
2025
+ /* @__NO_SIDE_EFFECTS__ */
2026
+ function _refine(Class, fn, _params) {
2027
+ return new Class({
2028
+ type: "custom",
2029
+ check: "custom",
2030
+ fn,
2031
+ ...normalizeParams(_params)
2032
+ });
2033
+ }
2034
+ /* @__NO_SIDE_EFFECTS__ */
2035
+ function _superRefine(fn) {
2036
+ const ch = /* @__PURE__ */ _check((payload) => {
2037
+ payload.addIssue = (issue$2) => {
2038
+ if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
2039
+ else {
2040
+ const _issue = issue$2;
2041
+ if (_issue.fatal) _issue.continue = false;
2042
+ _issue.code ?? (_issue.code = "custom");
2043
+ _issue.input ?? (_issue.input = payload.value);
2044
+ _issue.inst ?? (_issue.inst = ch);
2045
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2046
+ payload.issues.push(issue(_issue));
2047
+ }
2048
+ };
2049
+ return fn(payload.value, payload);
2050
+ });
2051
+ return ch;
2052
+ }
2053
+ /* @__NO_SIDE_EFFECTS__ */
2054
+ function _check(fn, params) {
2055
+ const ch = new $ZodCheck({
2056
+ check: "custom",
2057
+ ...normalizeParams(params)
2058
+ });
2059
+ ch._zod.check = fn;
2060
+ return ch;
2061
+ }
2062
+ //#endregion
2063
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
2064
+ function initializeContext(params) {
2065
+ let target = params?.target ?? "draft-2020-12";
2066
+ if (target === "draft-4") target = "draft-04";
2067
+ if (target === "draft-7") target = "draft-07";
2068
+ return {
2069
+ processors: params.processors ?? {},
2070
+ metadataRegistry: params?.metadata ?? globalRegistry,
2071
+ target,
2072
+ unrepresentable: params?.unrepresentable ?? "throw",
2073
+ override: params?.override ?? (() => {}),
2074
+ io: params?.io ?? "output",
2075
+ counter: 0,
2076
+ seen: /* @__PURE__ */ new Map(),
2077
+ cycles: params?.cycles ?? "ref",
2078
+ reused: params?.reused ?? "inline",
2079
+ external: params?.external ?? void 0
2080
+ };
2081
+ }
2082
+ function process$1(schema, ctx, _params = {
2083
+ path: [],
2084
+ schemaPath: []
2085
+ }) {
2086
+ var _a;
2087
+ const def = schema._zod.def;
2088
+ const seen = ctx.seen.get(schema);
2089
+ if (seen) {
2090
+ seen.count++;
2091
+ if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
2092
+ return seen.schema;
2093
+ }
2094
+ const result = {
2095
+ schema: {},
2096
+ count: 1,
2097
+ cycle: void 0,
2098
+ path: _params.path
2099
+ };
2100
+ ctx.seen.set(schema, result);
2101
+ const overrideSchema = schema._zod.toJSONSchema?.();
2102
+ if (overrideSchema) result.schema = overrideSchema;
2103
+ else {
2104
+ const params = {
2105
+ ..._params,
2106
+ schemaPath: [..._params.schemaPath, schema],
2107
+ path: _params.path
2108
+ };
2109
+ if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
2110
+ else {
2111
+ const _json = result.schema;
2112
+ const processor = ctx.processors[def.type];
2113
+ if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
2114
+ processor(schema, ctx, _json, params);
2115
+ }
2116
+ const parent = schema._zod.parent;
2117
+ if (parent) {
2118
+ if (!result.ref) result.ref = parent;
2119
+ process$1(parent, ctx, params);
2120
+ ctx.seen.get(parent).isParent = true;
2121
+ }
2122
+ }
2123
+ const meta = ctx.metadataRegistry.get(schema);
2124
+ if (meta) Object.assign(result.schema, meta);
2125
+ if (ctx.io === "input" && isTransforming(schema)) {
2126
+ delete result.schema.examples;
2127
+ delete result.schema.default;
2128
+ }
2129
+ if (ctx.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
2130
+ delete result.schema._prefault;
2131
+ return ctx.seen.get(schema).schema;
2132
+ }
2133
+ function extractDefs(ctx, schema) {
2134
+ const root = ctx.seen.get(schema);
2135
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2136
+ const idToSchema = /* @__PURE__ */ new Map();
2137
+ for (const entry of ctx.seen.entries()) {
2138
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
2139
+ if (id) {
2140
+ const existing = idToSchema.get(id);
2141
+ 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.`);
2142
+ idToSchema.set(id, entry[0]);
2143
+ }
2144
+ }
2145
+ const makeURI = (entry) => {
2146
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
2147
+ if (ctx.external) {
2148
+ const externalId = ctx.external.registry.get(entry[0])?.id;
2149
+ const uriGenerator = ctx.external.uri ?? ((id) => id);
2150
+ if (externalId) return { ref: uriGenerator(externalId) };
2151
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
2152
+ entry[1].defId = id;
2153
+ return {
2154
+ defId: id,
2155
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
2156
+ };
2157
+ }
2158
+ if (entry[1] === root) return { ref: "#" };
2159
+ const defUriPrefix = `#/${defsSegment}/`;
2160
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
2161
+ return {
2162
+ defId,
2163
+ ref: defUriPrefix + defId
2164
+ };
2165
+ };
2166
+ const extractToDef = (entry) => {
2167
+ if (entry[1].schema.$ref) return;
2168
+ const seen = entry[1];
2169
+ const { ref, defId } = makeURI(entry);
2170
+ seen.def = { ...seen.schema };
2171
+ if (defId) seen.defId = defId;
2172
+ const schema = seen.schema;
2173
+ for (const key in schema) delete schema[key];
2174
+ schema.$ref = ref;
2175
+ };
2176
+ if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
2177
+ const seen = entry[1];
2178
+ if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
2179
+
2180
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2181
+ }
2182
+ for (const entry of ctx.seen.entries()) {
2183
+ const seen = entry[1];
2184
+ if (schema === entry[0]) {
2185
+ extractToDef(entry);
2186
+ continue;
2187
+ }
2188
+ if (ctx.external) {
2189
+ const ext = ctx.external.registry.get(entry[0])?.id;
2190
+ if (schema !== entry[0] && ext) {
2191
+ extractToDef(entry);
2192
+ continue;
2193
+ }
2194
+ }
2195
+ if (ctx.metadataRegistry.get(entry[0])?.id) {
2196
+ extractToDef(entry);
2197
+ continue;
2198
+ }
2199
+ if (seen.cycle) {
2200
+ extractToDef(entry);
2201
+ continue;
2202
+ }
2203
+ if (seen.count > 1) {
2204
+ if (ctx.reused === "ref") {
2205
+ extractToDef(entry);
2206
+ continue;
2207
+ }
2208
+ }
2209
+ }
2210
+ }
2211
+ function finalize(ctx, schema) {
2212
+ const root = ctx.seen.get(schema);
2213
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2214
+ const flattenRef = (zodSchema) => {
2215
+ const seen = ctx.seen.get(zodSchema);
2216
+ if (seen.ref === null) return;
2217
+ const schema = seen.def ?? seen.schema;
2218
+ const _cached = { ...schema };
2219
+ const ref = seen.ref;
2220
+ seen.ref = null;
2221
+ if (ref) {
2222
+ flattenRef(ref);
2223
+ const refSeen = ctx.seen.get(ref);
2224
+ const refSchema = refSeen.schema;
2225
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2226
+ schema.allOf = schema.allOf ?? [];
2227
+ schema.allOf.push(refSchema);
2228
+ } else Object.assign(schema, refSchema);
2229
+ Object.assign(schema, _cached);
2230
+ if (zodSchema._zod.parent === ref) for (const key in schema) {
2231
+ if (key === "$ref" || key === "allOf") continue;
2232
+ if (!(key in _cached)) delete schema[key];
2233
+ }
2234
+ if (refSchema.$ref && refSeen.def) for (const key in schema) {
2235
+ if (key === "$ref" || key === "allOf") continue;
2236
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
2237
+ }
2238
+ }
2239
+ const parent = zodSchema._zod.parent;
2240
+ if (parent && parent !== ref) {
2241
+ flattenRef(parent);
2242
+ const parentSeen = ctx.seen.get(parent);
2243
+ if (parentSeen?.schema.$ref) {
2244
+ schema.$ref = parentSeen.schema.$ref;
2245
+ if (parentSeen.def) for (const key in schema) {
2246
+ if (key === "$ref" || key === "allOf") continue;
2247
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
2248
+ }
2249
+ }
2250
+ }
2251
+ ctx.override({
2252
+ zodSchema,
2253
+ jsonSchema: schema,
2254
+ path: seen.path ?? []
2255
+ });
2256
+ };
2257
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
2258
+ const result = {};
2259
+ if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
2260
+ else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
2261
+ else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
2262
+ else if (ctx.target === "openapi-3.0") {}
2263
+ if (ctx.external?.uri) {
2264
+ const id = ctx.external.registry.get(schema)?.id;
2265
+ if (!id) throw new Error("Schema is missing an `id` property");
2266
+ result.$id = ctx.external.uri(id);
2267
+ }
2268
+ Object.assign(result, root.def ?? root.schema);
2269
+ const defs = ctx.external?.defs ?? {};
2270
+ for (const entry of ctx.seen.entries()) {
2271
+ const seen = entry[1];
2272
+ if (seen.def && seen.defId) defs[seen.defId] = seen.def;
2273
+ }
2274
+ if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
2275
+ else result.definitions = defs;
2276
+ try {
2277
+ const finalized = JSON.parse(JSON.stringify(result));
2278
+ Object.defineProperty(finalized, "~standard", {
2279
+ value: {
2280
+ ...schema["~standard"],
2281
+ jsonSchema: {
2282
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
2283
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
2284
+ }
2285
+ },
2286
+ enumerable: false,
2287
+ writable: false
2288
+ });
2289
+ return finalized;
2290
+ } catch (_err) {
2291
+ throw new Error("Error converting schema to JSON.");
2292
+ }
2293
+ }
2294
+ function isTransforming(_schema, _ctx) {
2295
+ const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
2296
+ if (ctx.seen.has(_schema)) return false;
2297
+ ctx.seen.add(_schema);
2298
+ const def = _schema._zod.def;
2299
+ if (def.type === "transform") return true;
2300
+ if (def.type === "array") return isTransforming(def.element, ctx);
2301
+ if (def.type === "set") return isTransforming(def.valueType, ctx);
2302
+ if (def.type === "lazy") return isTransforming(def.getter(), ctx);
2303
+ 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);
2304
+ if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
2305
+ if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
2306
+ if (def.type === "pipe") return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
2307
+ if (def.type === "object") {
2308
+ for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
2309
+ return false;
2310
+ }
2311
+ if (def.type === "union") {
2312
+ for (const option of def.options) if (isTransforming(option, ctx)) return true;
2313
+ return false;
2314
+ }
2315
+ if (def.type === "tuple") {
2316
+ for (const item of def.items) if (isTransforming(item, ctx)) return true;
2317
+ if (def.rest && isTransforming(def.rest, ctx)) return true;
2318
+ return false;
2319
+ }
2320
+ return false;
2321
+ }
2322
+ /**
2323
+ * Creates a toJSONSchema method for a schema instance.
2324
+ * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
2325
+ */
2326
+ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
2327
+ const ctx = initializeContext({
2328
+ ...params,
2329
+ processors
2330
+ });
2331
+ process$1(schema, ctx);
2332
+ extractDefs(ctx, schema);
2333
+ return finalize(ctx, schema);
2334
+ };
2335
+ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
2336
+ const { libraryOptions, target } = params ?? {};
2337
+ const ctx = initializeContext({
2338
+ ...libraryOptions ?? {},
2339
+ target,
2340
+ io,
2341
+ processors
2342
+ });
2343
+ process$1(schema, ctx);
2344
+ extractDefs(ctx, schema);
2345
+ return finalize(ctx, schema);
2346
+ };
2347
+ //#endregion
2348
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
2349
+ const numberProcessor = (schema, ctx, _json, _params) => {
2350
+ const json = _json;
2351
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
2352
+ if (typeof format === "string" && format.includes("int")) json.type = "integer";
2353
+ else json.type = "number";
2354
+ if (typeof exclusiveMinimum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
2355
+ json.minimum = exclusiveMinimum;
2356
+ json.exclusiveMinimum = true;
2357
+ } else json.exclusiveMinimum = exclusiveMinimum;
2358
+ if (typeof minimum === "number") {
2359
+ json.minimum = minimum;
2360
+ if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") if (exclusiveMinimum >= minimum) delete json.minimum;
2361
+ else delete json.exclusiveMinimum;
2362
+ }
2363
+ if (typeof exclusiveMaximum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
2364
+ json.maximum = exclusiveMaximum;
2365
+ json.exclusiveMaximum = true;
2366
+ } else json.exclusiveMaximum = exclusiveMaximum;
2367
+ if (typeof maximum === "number") {
2368
+ json.maximum = maximum;
2369
+ if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") if (exclusiveMaximum <= maximum) delete json.maximum;
2370
+ else delete json.exclusiveMaximum;
2371
+ }
2372
+ if (typeof multipleOf === "number") json.multipleOf = multipleOf;
2373
+ };
2374
+ const neverProcessor = (_schema, _ctx, json, _params) => {
2375
+ json.not = {};
2376
+ };
2377
+ const unknownProcessor = (_schema, _ctx, _json, _params) => {};
2378
+ const enumProcessor = (schema, _ctx, json, _params) => {
2379
+ const def = schema._zod.def;
2380
+ const values = getEnumValues(def.entries);
2381
+ if (values.every((v) => typeof v === "number")) json.type = "number";
2382
+ if (values.every((v) => typeof v === "string")) json.type = "string";
2383
+ json.enum = values;
2384
+ };
2385
+ const customProcessor = (_schema, ctx, _json, _params) => {
2386
+ if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
2387
+ };
2388
+ const transformProcessor = (_schema, ctx, _json, _params) => {
2389
+ if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
2390
+ };
2391
+ const arrayProcessor = (schema, ctx, _json, params) => {
2392
+ const json = _json;
2393
+ const def = schema._zod.def;
2394
+ const { minimum, maximum } = schema._zod.bag;
2395
+ if (typeof minimum === "number") json.minItems = minimum;
2396
+ if (typeof maximum === "number") json.maxItems = maximum;
2397
+ json.type = "array";
2398
+ json.items = process$1(def.element, ctx, {
2399
+ ...params,
2400
+ path: [...params.path, "items"]
2401
+ });
2402
+ };
2403
+ const objectProcessor = (schema, ctx, _json, params) => {
2404
+ const json = _json;
2405
+ const def = schema._zod.def;
2406
+ json.type = "object";
2407
+ json.properties = {};
2408
+ const shape = def.shape;
2409
+ for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
2410
+ ...params,
2411
+ path: [
2412
+ ...params.path,
2413
+ "properties",
2414
+ key
2415
+ ]
2416
+ });
2417
+ const allKeys = new Set(Object.keys(shape));
2418
+ const requiredKeys = new Set([...allKeys].filter((key) => {
2419
+ const v = def.shape[key]._zod;
2420
+ if (ctx.io === "input") return v.optin === void 0;
2421
+ else return v.optout === void 0;
2422
+ }));
2423
+ if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
2424
+ if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
2425
+ else if (!def.catchall) {
2426
+ if (ctx.io === "output") json.additionalProperties = false;
2427
+ } else if (def.catchall) json.additionalProperties = process$1(def.catchall, ctx, {
2428
+ ...params,
2429
+ path: [...params.path, "additionalProperties"]
2430
+ });
2431
+ };
2432
+ const unionProcessor = (schema, ctx, json, params) => {
2433
+ const def = schema._zod.def;
2434
+ const isExclusive = def.inclusive === false;
2435
+ const options = def.options.map((x, i) => process$1(x, ctx, {
2436
+ ...params,
2437
+ path: [
2438
+ ...params.path,
2439
+ isExclusive ? "oneOf" : "anyOf",
2440
+ i
2441
+ ]
2442
+ }));
2443
+ if (isExclusive) json.oneOf = options;
2444
+ else json.anyOf = options;
2445
+ };
2446
+ const intersectionProcessor = (schema, ctx, json, params) => {
2447
+ const def = schema._zod.def;
2448
+ const a = process$1(def.left, ctx, {
2449
+ ...params,
2450
+ path: [
2451
+ ...params.path,
2452
+ "allOf",
2453
+ 0
2454
+ ]
2455
+ });
2456
+ const b = process$1(def.right, ctx, {
2457
+ ...params,
2458
+ path: [
2459
+ ...params.path,
2460
+ "allOf",
2461
+ 1
2462
+ ]
2463
+ });
2464
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
2465
+ json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
2466
+ };
2467
+ const nullableProcessor = (schema, ctx, json, params) => {
2468
+ const def = schema._zod.def;
2469
+ const inner = process$1(def.innerType, ctx, params);
2470
+ const seen = ctx.seen.get(schema);
2471
+ if (ctx.target === "openapi-3.0") {
2472
+ seen.ref = def.innerType;
2473
+ json.nullable = true;
2474
+ } else json.anyOf = [inner, { type: "null" }];
2475
+ };
2476
+ const nonoptionalProcessor = (schema, ctx, _json, params) => {
2477
+ const def = schema._zod.def;
2478
+ process$1(def.innerType, ctx, params);
2479
+ const seen = ctx.seen.get(schema);
2480
+ seen.ref = def.innerType;
2481
+ };
2482
+ const defaultProcessor = (schema, ctx, json, params) => {
2483
+ const def = schema._zod.def;
2484
+ process$1(def.innerType, ctx, params);
2485
+ const seen = ctx.seen.get(schema);
2486
+ seen.ref = def.innerType;
2487
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
2488
+ };
2489
+ const prefaultProcessor = (schema, ctx, json, params) => {
2490
+ const def = schema._zod.def;
2491
+ process$1(def.innerType, ctx, params);
2492
+ const seen = ctx.seen.get(schema);
2493
+ seen.ref = def.innerType;
2494
+ if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
2495
+ };
2496
+ const catchProcessor = (schema, ctx, json, params) => {
2497
+ const def = schema._zod.def;
2498
+ process$1(def.innerType, ctx, params);
2499
+ const seen = ctx.seen.get(schema);
2500
+ seen.ref = def.innerType;
2501
+ let catchValue;
2502
+ try {
2503
+ catchValue = def.catchValue(void 0);
2504
+ } catch {
2505
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
2506
+ }
2507
+ json.default = catchValue;
2508
+ };
2509
+ const pipeProcessor = (schema, ctx, _json, params) => {
2510
+ const def = schema._zod.def;
2511
+ const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
2512
+ process$1(innerType, ctx, params);
2513
+ const seen = ctx.seen.get(schema);
2514
+ seen.ref = innerType;
2515
+ };
2516
+ const readonlyProcessor = (schema, ctx, json, params) => {
2517
+ const def = schema._zod.def;
2518
+ process$1(def.innerType, ctx, params);
2519
+ const seen = ctx.seen.get(schema);
2520
+ seen.ref = def.innerType;
2521
+ json.readOnly = true;
2522
+ };
2523
+ const optionalProcessor = (schema, ctx, _json, params) => {
2524
+ const def = schema._zod.def;
2525
+ process$1(def.innerType, ctx, params);
2526
+ const seen = ctx.seen.get(schema);
2527
+ seen.ref = def.innerType;
2528
+ };
2529
+ //#endregion
2530
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
2531
+ const initializer = (inst, issues) => {
2532
+ $ZodError.init(inst, issues);
2533
+ inst.name = "ZodError";
2534
+ Object.defineProperties(inst, {
2535
+ format: { value: (mapper) => formatError(inst, mapper) },
2536
+ flatten: { value: (mapper) => flattenError(inst, mapper) },
2537
+ addIssue: { value: (issue) => {
2538
+ inst.issues.push(issue);
2539
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
2540
+ } },
2541
+ addIssues: { value: (issues) => {
2542
+ inst.issues.push(...issues);
2543
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
2544
+ } },
2545
+ isEmpty: { get() {
2546
+ return inst.issues.length === 0;
2547
+ } }
2548
+ });
2549
+ };
2550
+ $constructor("ZodError", initializer);
2551
+ const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
2552
+ //#endregion
2553
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
2554
+ const parse = /* @__PURE__ */ _parse(ZodRealError);
2555
+ const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
2556
+ const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
2557
+ const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
2558
+ const encode = /* @__PURE__ */ _encode(ZodRealError);
2559
+ const decode = /* @__PURE__ */ _decode(ZodRealError);
2560
+ const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
2561
+ const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
2562
+ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
2563
+ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
2564
+ const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
2565
+ const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
2566
+ //#endregion
2567
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
2568
+ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2569
+ $ZodType.init(inst, def);
2570
+ Object.assign(inst["~standard"], { jsonSchema: {
2571
+ input: createStandardJSONSchemaMethod(inst, "input"),
2572
+ output: createStandardJSONSchemaMethod(inst, "output")
2573
+ } });
2574
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
2575
+ inst.def = def;
2576
+ inst.type = def.type;
2577
+ Object.defineProperty(inst, "_def", { value: def });
2578
+ inst.check = (...checks) => {
2579
+ return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
2580
+ check: ch,
2581
+ def: { check: "custom" },
2582
+ onattach: []
2583
+ } } : ch)] }), { parent: true });
2584
+ };
2585
+ inst.with = inst.check;
2586
+ inst.clone = (def, params) => clone(inst, def, params);
2587
+ inst.brand = () => inst;
2588
+ inst.register = ((reg, meta) => {
2589
+ reg.add(inst, meta);
2590
+ return inst;
2591
+ });
2592
+ inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
2593
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
2594
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
2595
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
2596
+ inst.spa = inst.safeParseAsync;
2597
+ inst.encode = (data, params) => encode(inst, data, params);
2598
+ inst.decode = (data, params) => decode(inst, data, params);
2599
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
2600
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
2601
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
2602
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
2603
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
2604
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
2605
+ inst.refine = (check, params) => inst.check(refine(check, params));
2606
+ inst.superRefine = (refinement) => inst.check(superRefine(refinement));
2607
+ inst.overwrite = (fn) => inst.check(/* @__PURE__ */ _overwrite(fn));
2608
+ inst.optional = () => optional(inst);
2609
+ inst.exactOptional = () => exactOptional(inst);
2610
+ inst.nullable = () => nullable(inst);
2611
+ inst.nullish = () => optional(nullable(inst));
2612
+ inst.nonoptional = (params) => nonoptional(inst, params);
2613
+ inst.array = () => array(inst);
2614
+ inst.or = (arg) => union([inst, arg]);
2615
+ inst.and = (arg) => intersection(inst, arg);
2616
+ inst.transform = (tx) => pipe(inst, transform(tx));
2617
+ inst.default = (def) => _default(inst, def);
2618
+ inst.prefault = (def) => prefault(inst, def);
2619
+ inst.catch = (params) => _catch(inst, params);
2620
+ inst.pipe = (target) => pipe(inst, target);
2621
+ inst.readonly = () => readonly(inst);
2622
+ inst.describe = (description) => {
2623
+ const cl = inst.clone();
2624
+ globalRegistry.add(cl, { description });
2625
+ return cl;
2626
+ };
2627
+ Object.defineProperty(inst, "description", {
2628
+ get() {
2629
+ return globalRegistry.get(inst)?.description;
2630
+ },
2631
+ configurable: true
2632
+ });
2633
+ inst.meta = (...args) => {
2634
+ if (args.length === 0) return globalRegistry.get(inst);
2635
+ const cl = inst.clone();
2636
+ globalRegistry.add(cl, args[0]);
2637
+ return cl;
2638
+ };
2639
+ inst.isOptional = () => inst.safeParse(void 0).success;
2640
+ inst.isNullable = () => inst.safeParse(null).success;
2641
+ inst.apply = (fn) => fn(inst);
2642
+ return inst;
2643
+ });
2644
+ const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
2645
+ $ZodNumber.init(inst, def);
2646
+ ZodType.init(inst, def);
2647
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
2648
+ inst.gt = (value, params) => inst.check(/* @__PURE__ */ _gt(value, params));
2649
+ inst.gte = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
2650
+ inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
2651
+ inst.lt = (value, params) => inst.check(/* @__PURE__ */ _lt(value, params));
2652
+ inst.lte = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
2653
+ inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
2654
+ inst.int = (params) => inst.check(int(params));
2655
+ inst.safe = (params) => inst.check(int(params));
2656
+ inst.positive = (params) => inst.check(/* @__PURE__ */ _gt(0, params));
2657
+ inst.nonnegative = (params) => inst.check(/* @__PURE__ */ _gte(0, params));
2658
+ inst.negative = (params) => inst.check(/* @__PURE__ */ _lt(0, params));
2659
+ inst.nonpositive = (params) => inst.check(/* @__PURE__ */ _lte(0, params));
2660
+ inst.multipleOf = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
2661
+ inst.step = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
2662
+ inst.finite = () => inst;
2663
+ const bag = inst._zod.bag;
2664
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
2665
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
2666
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
2667
+ inst.isFinite = true;
2668
+ inst.format = bag.format ?? null;
2669
+ });
2670
+ function number(params) {
2671
+ return /* @__PURE__ */ _number(ZodNumber, params);
2672
+ }
2673
+ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
2674
+ $ZodNumberFormat.init(inst, def);
2675
+ ZodNumber.init(inst, def);
2676
+ });
2677
+ function int(params) {
2678
+ return /* @__PURE__ */ _int(ZodNumberFormat, params);
2679
+ }
2680
+ const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2681
+ $ZodUnknown.init(inst, def);
2682
+ ZodType.init(inst, def);
2683
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
2684
+ });
2685
+ function unknown() {
2686
+ return /* @__PURE__ */ _unknown(ZodUnknown);
2687
+ }
2688
+ const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
2689
+ $ZodNever.init(inst, def);
2690
+ ZodType.init(inst, def);
2691
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
2692
+ });
2693
+ function never(params) {
2694
+ return /* @__PURE__ */ _never(ZodNever, params);
2695
+ }
2696
+ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
2697
+ $ZodArray.init(inst, def);
2698
+ ZodType.init(inst, def);
2699
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
2700
+ inst.element = def.element;
2701
+ inst.min = (minLength, params) => inst.check(/* @__PURE__ */ _minLength(minLength, params));
2702
+ inst.nonempty = (params) => inst.check(/* @__PURE__ */ _minLength(1, params));
2703
+ inst.max = (maxLength, params) => inst.check(/* @__PURE__ */ _maxLength(maxLength, params));
2704
+ inst.length = (len, params) => inst.check(/* @__PURE__ */ _length(len, params));
2705
+ inst.unwrap = () => inst.element;
2706
+ });
2707
+ function array(element, params) {
2708
+ return /* @__PURE__ */ _array(ZodArray, element, params);
2709
+ }
2710
+ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
2711
+ $ZodObjectJIT.init(inst, def);
2712
+ ZodType.init(inst, def);
2713
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
2714
+ defineLazy(inst, "shape", () => {
2715
+ return def.shape;
2716
+ });
2717
+ inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
2718
+ inst.catchall = (catchall) => inst.clone({
2719
+ ...inst._zod.def,
2720
+ catchall
2721
+ });
2722
+ inst.passthrough = () => inst.clone({
2723
+ ...inst._zod.def,
2724
+ catchall: unknown()
2725
+ });
2726
+ inst.loose = () => inst.clone({
2727
+ ...inst._zod.def,
2728
+ catchall: unknown()
2729
+ });
2730
+ inst.strict = () => inst.clone({
2731
+ ...inst._zod.def,
2732
+ catchall: never()
2733
+ });
2734
+ inst.strip = () => inst.clone({
2735
+ ...inst._zod.def,
2736
+ catchall: void 0
2737
+ });
2738
+ inst.extend = (incoming) => {
2739
+ return extend(inst, incoming);
2740
+ };
2741
+ inst.safeExtend = (incoming) => {
2742
+ return safeExtend(inst, incoming);
2743
+ };
2744
+ inst.merge = (other) => merge(inst, other);
2745
+ inst.pick = (mask) => pick(inst, mask);
2746
+ inst.omit = (mask) => omit(inst, mask);
2747
+ inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
2748
+ inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
2749
+ });
2750
+ function object(shape, params) {
2751
+ return new ZodObject({
2752
+ type: "object",
2753
+ shape: shape ?? {},
2754
+ ...normalizeParams(params)
2755
+ });
2756
+ }
2757
+ const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
2758
+ $ZodUnion.init(inst, def);
2759
+ ZodType.init(inst, def);
2760
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
2761
+ inst.options = def.options;
2762
+ });
2763
+ function union(options, params) {
2764
+ return new ZodUnion({
2765
+ type: "union",
2766
+ options,
2767
+ ...normalizeParams(params)
2768
+ });
2769
+ }
2770
+ const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
2771
+ $ZodIntersection.init(inst, def);
2772
+ ZodType.init(inst, def);
2773
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
2774
+ });
2775
+ function intersection(left, right) {
2776
+ return new ZodIntersection({
2777
+ type: "intersection",
2778
+ left,
2779
+ right
2780
+ });
2781
+ }
2782
+ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
2783
+ $ZodEnum.init(inst, def);
2784
+ ZodType.init(inst, def);
2785
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
2786
+ inst.enum = def.entries;
2787
+ inst.options = Object.values(def.entries);
2788
+ const keys = new Set(Object.keys(def.entries));
2789
+ inst.extract = (values, params) => {
2790
+ const newEntries = {};
2791
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
2792
+ else throw new Error(`Key ${value} not found in enum`);
2793
+ return new ZodEnum({
2794
+ ...def,
2795
+ checks: [],
2796
+ ...normalizeParams(params),
2797
+ entries: newEntries
2798
+ });
2799
+ };
2800
+ inst.exclude = (values, params) => {
2801
+ const newEntries = { ...def.entries };
2802
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
2803
+ else throw new Error(`Key ${value} not found in enum`);
2804
+ return new ZodEnum({
2805
+ ...def,
2806
+ checks: [],
2807
+ ...normalizeParams(params),
2808
+ entries: newEntries
2809
+ });
2810
+ };
2811
+ });
2812
+ function _enum(values, params) {
2813
+ return new ZodEnum({
2814
+ type: "enum",
2815
+ entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
2816
+ ...normalizeParams(params)
2817
+ });
2818
+ }
2819
+ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
2820
+ $ZodTransform.init(inst, def);
2821
+ ZodType.init(inst, def);
2822
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
2823
+ inst._zod.parse = (payload, _ctx) => {
2824
+ if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
2825
+ payload.addIssue = (issue$1) => {
2826
+ if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
2827
+ else {
2828
+ const _issue = issue$1;
2829
+ if (_issue.fatal) _issue.continue = false;
2830
+ _issue.code ?? (_issue.code = "custom");
2831
+ _issue.input ?? (_issue.input = payload.value);
2832
+ _issue.inst ?? (_issue.inst = inst);
2833
+ payload.issues.push(issue(_issue));
2834
+ }
2835
+ };
2836
+ const output = def.transform(payload.value, payload);
2837
+ if (output instanceof Promise) return output.then((output) => {
2838
+ payload.value = output;
2839
+ return payload;
2840
+ });
2841
+ payload.value = output;
2842
+ return payload;
2843
+ };
2844
+ });
2845
+ function transform(fn) {
2846
+ return new ZodTransform({
2847
+ type: "transform",
2848
+ transform: fn
2849
+ });
2850
+ }
2851
+ const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
2852
+ $ZodOptional.init(inst, def);
2853
+ ZodType.init(inst, def);
2854
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
2855
+ inst.unwrap = () => inst._zod.def.innerType;
2856
+ });
2857
+ function optional(innerType) {
2858
+ return new ZodOptional({
2859
+ type: "optional",
2860
+ innerType
2861
+ });
2862
+ }
2863
+ const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
2864
+ $ZodExactOptional.init(inst, def);
2865
+ ZodType.init(inst, def);
2866
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
2867
+ inst.unwrap = () => inst._zod.def.innerType;
2868
+ });
2869
+ function exactOptional(innerType) {
2870
+ return new ZodExactOptional({
2871
+ type: "optional",
2872
+ innerType
2873
+ });
2874
+ }
2875
+ const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
2876
+ $ZodNullable.init(inst, def);
2877
+ ZodType.init(inst, def);
2878
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
2879
+ inst.unwrap = () => inst._zod.def.innerType;
2880
+ });
2881
+ function nullable(innerType) {
2882
+ return new ZodNullable({
2883
+ type: "nullable",
2884
+ innerType
2885
+ });
2886
+ }
2887
+ const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
2888
+ $ZodDefault.init(inst, def);
2889
+ ZodType.init(inst, def);
2890
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
2891
+ inst.unwrap = () => inst._zod.def.innerType;
2892
+ inst.removeDefault = inst.unwrap;
2893
+ });
2894
+ function _default(innerType, defaultValue) {
2895
+ return new ZodDefault({
2896
+ type: "default",
2897
+ innerType,
2898
+ get defaultValue() {
2899
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
2900
+ }
2901
+ });
2902
+ }
2903
+ const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
2904
+ $ZodPrefault.init(inst, def);
2905
+ ZodType.init(inst, def);
2906
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
2907
+ inst.unwrap = () => inst._zod.def.innerType;
2908
+ });
2909
+ function prefault(innerType, defaultValue) {
2910
+ return new ZodPrefault({
2911
+ type: "prefault",
2912
+ innerType,
2913
+ get defaultValue() {
2914
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
2915
+ }
2916
+ });
2917
+ }
2918
+ const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
2919
+ $ZodNonOptional.init(inst, def);
2920
+ ZodType.init(inst, def);
2921
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
2922
+ inst.unwrap = () => inst._zod.def.innerType;
2923
+ });
2924
+ function nonoptional(innerType, params) {
2925
+ return new ZodNonOptional({
2926
+ type: "nonoptional",
2927
+ innerType,
2928
+ ...normalizeParams(params)
2929
+ });
2930
+ }
2931
+ const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
2932
+ $ZodCatch.init(inst, def);
2933
+ ZodType.init(inst, def);
2934
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
2935
+ inst.unwrap = () => inst._zod.def.innerType;
2936
+ inst.removeCatch = inst.unwrap;
2937
+ });
2938
+ function _catch(innerType, catchValue) {
2939
+ return new ZodCatch({
2940
+ type: "catch",
2941
+ innerType,
2942
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
2943
+ });
2944
+ }
2945
+ const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
2946
+ $ZodPipe.init(inst, def);
2947
+ ZodType.init(inst, def);
2948
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
2949
+ inst.in = def.in;
2950
+ inst.out = def.out;
2951
+ });
2952
+ function pipe(in_, out) {
2953
+ return new ZodPipe({
2954
+ type: "pipe",
2955
+ in: in_,
2956
+ out
2957
+ });
2958
+ }
2959
+ const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
2960
+ $ZodReadonly.init(inst, def);
2961
+ ZodType.init(inst, def);
2962
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
2963
+ inst.unwrap = () => inst._zod.def.innerType;
2964
+ });
2965
+ function readonly(innerType) {
2966
+ return new ZodReadonly({
2967
+ type: "readonly",
2968
+ innerType
2969
+ });
2970
+ }
2971
+ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
2972
+ $ZodCustom.init(inst, def);
2973
+ ZodType.init(inst, def);
2974
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
2975
+ });
2976
+ function refine(fn, _params = {}) {
2977
+ return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
2978
+ }
2979
+ function superRefine(fn) {
2980
+ return /* @__PURE__ */ _superRefine(fn);
2981
+ }
2982
+ enumValues({
2983
+ Active: "active",
2984
+ PastDue: "past_due",
2985
+ Canceled: "canceled",
2986
+ Incomplete: "incomplete"
2987
+ });
2988
+ enumValues({
2989
+ Anthropic: "anthropic",
2990
+ OpenAI: "openai"
2991
+ });
2992
+ enumValues({
2993
+ Month: "month",
2994
+ Year: "year"
2995
+ });
2996
+ object({ gracePeriodDays: number().int().positive().optional() });
2997
+ enumValues({
2998
+ Active: "active",
2999
+ Inactive: "inactive",
3000
+ Deleted: "deleted"
3001
+ });
3002
+ enumValues({
3003
+ SelfHosted: "self-hosted",
3004
+ Managed: "managed"
3005
+ });
3006
+ enumValues({
3007
+ OpenClaw: "openclaw",
3008
+ NanoClaw: "nanoclaw"
3009
+ });
3010
+ enumValues({
3011
+ None: "none",
3012
+ Pending: "pending",
3013
+ Provisioning: "provisioning",
3014
+ Running: "running",
3015
+ Stopped: "stopped",
3016
+ Failed: "failed",
3017
+ BillingSuspended: "billing_suspended"
3018
+ });
3019
+ enumValues({
3020
+ Active: "active",
3021
+ Removed: "removed"
3022
+ });
3023
+ enumValues({
3024
+ Installing: "installing",
3025
+ Active: "active",
3026
+ Error: "error",
3027
+ Removing: "removing",
3028
+ Inactive: "inactive",
3029
+ Unknown: "unknown"
3030
+ });
3031
+ enumValues({
3032
+ Active: "active",
3033
+ Depleted: "depleted",
3034
+ Paused: "paused"
3035
+ });
3036
+ enumValues({
3037
+ Usage: "usage",
3038
+ TopUp: "top_up",
3039
+ SubscriptionCredit: "subscription_credit",
3040
+ AutoRecharge: "auto_recharge",
3041
+ AdminGift: "admin_gift",
3042
+ Refund: "refund"
3043
+ });
3044
+ enumValues({
3045
+ Pending: "pending",
3046
+ Completed: "completed",
3047
+ Failed: "failed"
3048
+ });
3049
+ enumValues({
3050
+ Hour: "hour",
3051
+ Day: "day",
3052
+ Week: "week",
3053
+ Month: "month"
3054
+ });
3055
+ enumValues({
3056
+ Synced: "synced",
3057
+ Stale: "stale",
3058
+ Error: "error"
3059
+ });
3060
+ enumValues({
3061
+ Standard: "STANDARD",
3062
+ GlacierIR: "GLACIER_IR"
3063
+ });
3064
+ enumValues({
3065
+ Push: "push",
3066
+ Pull: "pull",
3067
+ Delete: "delete",
3068
+ Restore: "restore"
3069
+ });
3070
+ enumValues({
3071
+ Success: "success",
3072
+ Error: "error"
3073
+ });
3074
+ enumValues({
3075
+ User: "user",
3076
+ Agent: "agent",
3077
+ Support: "support"
3078
+ });
3079
+ enumValues({
3080
+ Dev: "dev",
3081
+ Test: "test",
3082
+ Live: "live"
3083
+ });
3084
+ //#endregion
300
3085
  //#region src/commands/login.ts
301
3086
  /**
302
3087
  * alfe login — authenticate with the Alfe API.
@@ -312,7 +3097,7 @@ const loginCommand = new Command("login").description("Authenticate with the Alf
312
3097
  const spinner = ora("Checking existing credentials…").start();
313
3098
  try {
314
3099
  const existing = await readConfig();
315
- const result = await createAuthService$1(existing.api_key, existing.gateway).validate();
3100
+ const result = await createAuthService$1(existing.api_key, existing.gateway).validate(existing.api_key);
316
3101
  if (result.ok && result.data.valid) {
317
3102
  spinner.succeed(chalk.green("Already logged in. Your API key is valid."));
318
3103
  return;
@@ -328,7 +3113,7 @@ const loginCommand = new Command("login").description("Authenticate with the Alf
328
3113
  validate: (value) => value.trim().length > 0 ? true : "API key cannot be empty"
329
3114
  });
330
3115
  const spinner = ora("Validating API key…").start();
331
- const result = await createAuthService$1(apiKey.trim()).validate();
3116
+ const result = await createAuthService$1(apiKey.trim()).validate(apiKey.trim());
332
3117
  if (!result.ok || !result.data.valid) {
333
3118
  spinner.fail(chalk.red("Invalid API key. Please check your key and try again."));
334
3119
  process.exit(1);
@@ -406,7 +3191,7 @@ async function initWorkspace(name, workspace) {
406
3191
  }
407
3192
  /**
408
3193
  * Write cloud-provided persona files into the workspace.
409
- * Files come from the personality registry (S3) as a filename→content map.
3194
+ * Files come from the template registry (S3) as a filename→content map.
410
3195
  * Only writes files that have non-empty content.
411
3196
  */
412
3197
  async function writeWorkspaceFiles(workspace, config) {
@@ -475,7 +3260,7 @@ const setupCommand = new Command("setup").description("Set up Alfe — authentic
475
3260
  const spinner = ora("Checking existing credentials…").start();
476
3261
  try {
477
3262
  const existing = await readConfig();
478
- const result = await createAuthService(existing.api_key, existing.gateway).validate();
3263
+ const result = await createAuthService(existing.api_key, existing.gateway).validate(existing.api_key);
479
3264
  if (result.ok && result.data.valid) {
480
3265
  spinner.succeed(chalk.green("Already authenticated."));
481
3266
  needsLogin = false;
@@ -494,7 +3279,7 @@ const setupCommand = new Command("setup").description("Set up Alfe — authentic
494
3279
  });
495
3280
  apiKey = apiKey.trim();
496
3281
  const spinner = ora("Validating API key…").start();
497
- const result = await createAuthService(apiKey).validate();
3282
+ const result = await createAuthService(apiKey).validate(apiKey);
498
3283
  if (!result.ok || !result.data.valid) {
499
3284
  spinner.fail(chalk.red("Invalid API key. Run alfe setup again with a valid key."));
500
3285
  process.exit(1);