@rayadesu/dsh-billing 0.1.0-rc.8

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