@snowcone-app/canvas 0.39.0 → 0.39.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3748 +0,0 @@
1
- import { E as Yt, J as qt, F as Xt } from "./ExportManager-BbBfO22S.js";
2
- import { A as Ht } from "./FontAnalyzer-DWHS41ba.js";
3
- var Ae;
4
- function u(e, t, n) {
5
- function o(c, a) {
6
- if (c._zod || Object.defineProperty(c, "_zod", {
7
- value: {
8
- def: a,
9
- constr: s,
10
- traits: /* @__PURE__ */ new Set()
11
- },
12
- enumerable: !1
13
- }), c._zod.traits.has(e))
14
- return;
15
- c._zod.traits.add(e), t(c, a);
16
- const f = s.prototype, l = Object.keys(f);
17
- for (let d = 0; d < l.length; d++) {
18
- const g = l[d];
19
- g in c || (c[g] = f[g].bind(c));
20
- }
21
- }
22
- const r = (n == null ? void 0 : n.Parent) ?? Object;
23
- class i extends r {
24
- }
25
- Object.defineProperty(i, "name", { value: e });
26
- function s(c) {
27
- var a;
28
- const f = n != null && n.Parent ? new i() : this;
29
- o(f, c), (a = f._zod).deferred ?? (a.deferred = []);
30
- for (const l of f._zod.deferred)
31
- l();
32
- return f;
33
- }
34
- return Object.defineProperty(s, "init", { value: o }), Object.defineProperty(s, Symbol.hasInstance, {
35
- value: (c) => {
36
- var a, f;
37
- return n != null && n.Parent && c instanceof n.Parent ? !0 : (f = (a = c == null ? void 0 : c._zod) == null ? void 0 : a.traits) == null ? void 0 : f.has(e);
38
- }
39
- }), Object.defineProperty(s, "name", { value: e }), s;
40
- }
41
- class Y extends Error {
42
- constructor() {
43
- super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
44
- }
45
- }
46
- class ot extends Error {
47
- constructor(t) {
48
- super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
49
- }
50
- }
51
- (Ae = globalThis).__zod_globalConfig ?? (Ae.__zod_globalConfig = {});
52
- const we = globalThis.__zod_globalConfig;
53
- function V(e) {
54
- return we;
55
- }
56
- function rt(e) {
57
- const t = Object.values(e).filter((o) => typeof o == "number");
58
- return Object.entries(e).filter(([o, r]) => t.indexOf(+o) === -1).map(([o, r]) => r);
59
- }
60
- function _e(e, t) {
61
- return typeof t == "bigint" ? t.toString() : t;
62
- }
63
- function fe(e) {
64
- return {
65
- get value() {
66
- {
67
- const t = e();
68
- return Object.defineProperty(this, "value", { value: t }), t;
69
- }
70
- }
71
- };
72
- }
73
- function ke(e) {
74
- return e == null;
75
- }
76
- function $e(e) {
77
- const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
78
- return e.slice(t, n);
79
- }
80
- function Qt(e, t) {
81
- const n = e / t, o = Math.round(n), r = Number.EPSILON * Math.max(Math.abs(n), 1);
82
- return Math.abs(n - o) < r ? 0 : n - o;
83
- }
84
- const Ne = /* @__PURE__ */ Symbol("evaluating");
85
- function y(e, t, n) {
86
- let o;
87
- Object.defineProperty(e, t, {
88
- get() {
89
- if (o !== Ne)
90
- return o === void 0 && (o = Ne, o = n()), o;
91
- },
92
- set(r) {
93
- Object.defineProperty(e, t, {
94
- value: r
95
- // configurable: true,
96
- });
97
- },
98
- configurable: !0
99
- });
100
- }
101
- function W(e, t, n) {
102
- Object.defineProperty(e, t, {
103
- value: n,
104
- writable: !0,
105
- enumerable: !0,
106
- configurable: !0
107
- });
108
- }
109
- function J(...e) {
110
- const t = {};
111
- for (const n of e) {
112
- const o = Object.getOwnPropertyDescriptors(n);
113
- Object.assign(t, o);
114
- }
115
- return Object.defineProperties({}, t);
116
- }
117
- function Ce(e) {
118
- return JSON.stringify(e);
119
- }
120
- function en(e) {
121
- return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
122
- }
123
- const it = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
124
- };
125
- function ee(e) {
126
- return typeof e == "object" && e !== null && !Array.isArray(e);
127
- }
128
- const tn = /* @__PURE__ */ fe(() => {
129
- var e;
130
- if (we.jitless || typeof navigator < "u" && ((e = navigator == null ? void 0 : navigator.userAgent) != null && e.includes("Cloudflare")))
131
- return !1;
132
- try {
133
- const t = Function;
134
- return new t(""), !0;
135
- } catch {
136
- return !1;
137
- }
138
- });
139
- function te(e) {
140
- if (ee(e) === !1)
141
- return !1;
142
- const t = e.constructor;
143
- if (t === void 0 || typeof t != "function")
144
- return !0;
145
- const n = t.prototype;
146
- return !(ee(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
147
- }
148
- function st(e) {
149
- return te(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e;
150
- }
151
- const nn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
152
- function q(e) {
153
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
154
- }
155
- function M(e, t, n) {
156
- const o = new e._zod.constr(t ?? e._zod.def);
157
- return (!t || n != null && n.parent) && (o._zod.parent = e), o;
158
- }
159
- function _(e) {
160
- const t = e;
161
- if (!t)
162
- return {};
163
- if (typeof t == "string")
164
- return { error: () => t };
165
- if ((t == null ? void 0 : t.message) !== void 0) {
166
- if ((t == null ? void 0 : t.error) !== void 0)
167
- throw new Error("Cannot specify both `message` and `error` params");
168
- t.error = t.message;
169
- }
170
- return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
171
- }
172
- function on(e) {
173
- return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
174
- }
175
- const rn = {
176
- safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
177
- int32: [-2147483648, 2147483647],
178
- uint32: [0, 4294967295],
179
- float32: [-34028234663852886e22, 34028234663852886e22],
180
- float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
181
- };
182
- function sn(e, t) {
183
- const n = e._zod.def, o = n.checks;
184
- if (o && o.length > 0)
185
- throw new Error(".pick() cannot be used on object schemas containing refinements");
186
- const i = J(e._zod.def, {
187
- get shape() {
188
- const s = {};
189
- for (const c in t) {
190
- if (!(c in n.shape))
191
- throw new Error(`Unrecognized key: "${c}"`);
192
- t[c] && (s[c] = n.shape[c]);
193
- }
194
- return W(this, "shape", s), s;
195
- },
196
- checks: []
197
- });
198
- return M(e, i);
199
- }
200
- function cn(e, t) {
201
- const n = e._zod.def, o = n.checks;
202
- if (o && o.length > 0)
203
- throw new Error(".omit() cannot be used on object schemas containing refinements");
204
- const i = J(e._zod.def, {
205
- get shape() {
206
- const s = { ...e._zod.def.shape };
207
- for (const c in t) {
208
- if (!(c in n.shape))
209
- throw new Error(`Unrecognized key: "${c}"`);
210
- t[c] && delete s[c];
211
- }
212
- return W(this, "shape", s), s;
213
- },
214
- checks: []
215
- });
216
- return M(e, i);
217
- }
218
- function an(e, t) {
219
- if (!te(t))
220
- throw new Error("Invalid input to extend: expected a plain object");
221
- const n = e._zod.def.checks;
222
- if (n && n.length > 0) {
223
- const i = e._zod.def.shape;
224
- for (const s in t)
225
- if (Object.getOwnPropertyDescriptor(i, s) !== void 0)
226
- throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
227
- }
228
- const r = J(e._zod.def, {
229
- get shape() {
230
- const i = { ...e._zod.def.shape, ...t };
231
- return W(this, "shape", i), i;
232
- }
233
- });
234
- return M(e, r);
235
- }
236
- function un(e, t) {
237
- if (!te(t))
238
- throw new Error("Invalid input to safeExtend: expected a plain object");
239
- const n = J(e._zod.def, {
240
- get shape() {
241
- const o = { ...e._zod.def.shape, ...t };
242
- return W(this, "shape", o), o;
243
- }
244
- });
245
- return M(e, n);
246
- }
247
- function ln(e, t) {
248
- var o;
249
- if ((o = e._zod.def.checks) != null && o.length)
250
- throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
251
- const n = J(e._zod.def, {
252
- get shape() {
253
- const r = { ...e._zod.def.shape, ...t._zod.def.shape };
254
- return W(this, "shape", r), r;
255
- },
256
- get catchall() {
257
- return t._zod.def.catchall;
258
- },
259
- checks: t._zod.def.checks ?? []
260
- });
261
- return M(e, n);
262
- }
263
- function fn(e, t, n) {
264
- const r = t._zod.def.checks;
265
- if (r && r.length > 0)
266
- throw new Error(".partial() cannot be used on object schemas containing refinements");
267
- const s = J(t._zod.def, {
268
- get shape() {
269
- const c = t._zod.def.shape, a = { ...c };
270
- if (n)
271
- for (const f in n) {
272
- if (!(f in c))
273
- throw new Error(`Unrecognized key: "${f}"`);
274
- n[f] && (a[f] = e ? new e({
275
- type: "optional",
276
- innerType: c[f]
277
- }) : c[f]);
278
- }
279
- else
280
- for (const f in c)
281
- a[f] = e ? new e({
282
- type: "optional",
283
- innerType: c[f]
284
- }) : c[f];
285
- return W(this, "shape", a), a;
286
- },
287
- checks: []
288
- });
289
- return M(t, s);
290
- }
291
- function pn(e, t, n) {
292
- const o = J(t._zod.def, {
293
- get shape() {
294
- const r = t._zod.def.shape, i = { ...r };
295
- if (n)
296
- for (const s in n) {
297
- if (!(s in i))
298
- throw new Error(`Unrecognized key: "${s}"`);
299
- n[s] && (i[s] = new e({
300
- type: "nonoptional",
301
- innerType: r[s]
302
- }));
303
- }
304
- else
305
- for (const s in r)
306
- i[s] = new e({
307
- type: "nonoptional",
308
- innerType: r[s]
309
- });
310
- return W(this, "shape", i), i;
311
- }
312
- });
313
- return M(t, o);
314
- }
315
- function K(e, t = 0) {
316
- var n;
317
- if (e.aborted === !0)
318
- return !0;
319
- for (let o = t; o < e.issues.length; o++)
320
- if (((n = e.issues[o]) == null ? void 0 : n.continue) !== !0)
321
- return !0;
322
- return !1;
323
- }
324
- function dn(e, t = 0) {
325
- var n;
326
- if (e.aborted === !0)
327
- return !0;
328
- for (let o = t; o < e.issues.length; o++)
329
- if (((n = e.issues[o]) == null ? void 0 : n.continue) === !1)
330
- return !0;
331
- return !1;
332
- }
333
- function ct(e, t) {
334
- return t.map((n) => {
335
- var o;
336
- return (o = n).path ?? (o.path = []), n.path.unshift(e), n;
337
- });
338
- }
339
- function ie(e) {
340
- return typeof e == "string" ? e : e == null ? void 0 : e.message;
341
- }
342
- function B(e, t, n) {
343
- var a, f, l, d, g, h;
344
- const o = e.message ? e.message : ie((l = (f = (a = e.inst) == null ? void 0 : a._zod.def) == null ? void 0 : f.error) == null ? void 0 : l.call(f, e)) ?? ie((d = t == null ? void 0 : t.error) == null ? void 0 : d.call(t, e)) ?? ie((g = n.customError) == null ? void 0 : g.call(n, e)) ?? ie((h = n.localeError) == null ? void 0 : h.call(n, e)) ?? "Invalid input", { inst: r, continue: i, input: s, ...c } = e;
345
- return c.path ?? (c.path = []), c.message = o, t != null && t.reportInput && (c.input = s), c;
346
- }
347
- function Se(e) {
348
- return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
349
- }
350
- function ne(...e) {
351
- const [t, n, o] = e;
352
- return typeof t == "string" ? {
353
- message: t,
354
- code: "custom",
355
- input: n,
356
- inst: o
357
- } : { ...t };
358
- }
359
- const at = (e, t) => {
360
- e.name = "$ZodError", Object.defineProperty(e, "_zod", {
361
- value: e._zod,
362
- enumerable: !1
363
- }), Object.defineProperty(e, "issues", {
364
- value: t,
365
- enumerable: !1
366
- }), e.message = JSON.stringify(t, _e, 2), Object.defineProperty(e, "toString", {
367
- value: () => e.message,
368
- enumerable: !1
369
- });
370
- }, ut = u("$ZodError", at), lt = u("$ZodError", at, { Parent: Error });
371
- function hn(e, t = (n) => n.message) {
372
- const n = {}, o = [];
373
- for (const r of e.issues)
374
- r.path.length > 0 ? (n[r.path[0]] = n[r.path[0]] || [], n[r.path[0]].push(t(r))) : o.push(t(r));
375
- return { formErrors: o, fieldErrors: n };
376
- }
377
- function mn(e, t = (n) => n.message) {
378
- const n = { _errors: [] }, o = (r, i = []) => {
379
- for (const s of r.issues)
380
- if (s.code === "invalid_union" && s.errors.length)
381
- s.errors.map((c) => o({ issues: c }, [...i, ...s.path]));
382
- else if (s.code === "invalid_key")
383
- o({ issues: s.issues }, [...i, ...s.path]);
384
- else if (s.code === "invalid_element")
385
- o({ issues: s.issues }, [...i, ...s.path]);
386
- else {
387
- const c = [...i, ...s.path];
388
- if (c.length === 0)
389
- n._errors.push(t(s));
390
- else {
391
- let a = n, f = 0;
392
- for (; f < c.length; ) {
393
- const l = c[f];
394
- f === c.length - 1 ? (a[l] = a[l] || { _errors: [] }, a[l]._errors.push(t(s))) : a[l] = a[l] || { _errors: [] }, a = a[l], f++;
395
- }
396
- }
397
- }
398
- };
399
- return o(e), n;
400
- }
401
- const Ze = (e) => (t, n, o, r) => {
402
- const i = o ? { ...o, async: !1 } : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i);
403
- if (s instanceof Promise)
404
- throw new Y();
405
- if (s.issues.length) {
406
- const c = new ((r == null ? void 0 : r.Err) ?? e)(s.issues.map((a) => B(a, i, V())));
407
- throw it(c, r == null ? void 0 : r.callee), c;
408
- }
409
- return s.value;
410
- }, Oe = (e) => async (t, n, o, r) => {
411
- const i = o ? { ...o, async: !0 } : { async: !0 };
412
- let s = t._zod.run({ value: n, issues: [] }, i);
413
- if (s instanceof Promise && (s = await s), s.issues.length) {
414
- const c = new ((r == null ? void 0 : r.Err) ?? e)(s.issues.map((a) => B(a, i, V())));
415
- throw it(c, r == null ? void 0 : r.callee), c;
416
- }
417
- return s.value;
418
- }, pe = (e) => (t, n, o) => {
419
- const r = o ? { ...o, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, r);
420
- if (i instanceof Promise)
421
- throw new Y();
422
- return i.issues.length ? {
423
- success: !1,
424
- error: new (e ?? ut)(i.issues.map((s) => B(s, r, V())))
425
- } : { success: !0, data: i.value };
426
- }, gn = /* @__PURE__ */ pe(lt), de = (e) => async (t, n, o) => {
427
- const r = o ? { ...o, async: !0 } : { async: !0 };
428
- let i = t._zod.run({ value: n, issues: [] }, r);
429
- return i instanceof Promise && (i = await i), i.issues.length ? {
430
- success: !1,
431
- error: new e(i.issues.map((s) => B(s, r, V())))
432
- } : { success: !0, data: i.value };
433
- }, _n = /* @__PURE__ */ de(lt), vn = (e) => (t, n, o) => {
434
- const r = o ? { ...o, direction: "backward" } : { direction: "backward" };
435
- return Ze(e)(t, n, r);
436
- }, yn = (e) => (t, n, o) => Ze(e)(t, n, o), bn = (e) => async (t, n, o) => {
437
- const r = o ? { ...o, direction: "backward" } : { direction: "backward" };
438
- return Oe(e)(t, n, r);
439
- }, zn = (e) => async (t, n, o) => Oe(e)(t, n, o), wn = (e) => (t, n, o) => {
440
- const r = o ? { ...o, direction: "backward" } : { direction: "backward" };
441
- return pe(e)(t, n, r);
442
- }, kn = (e) => (t, n, o) => pe(e)(t, n, o), $n = (e) => async (t, n, o) => {
443
- const r = o ? { ...o, direction: "backward" } : { direction: "backward" };
444
- return de(e)(t, n, r);
445
- }, Sn = (e) => async (t, n, o) => de(e)(t, n, o), Zn = /^[cC][0-9a-z]{6,}$/, On = /^[0-9a-z]+$/, En = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, Tn = /^[0-9a-vA-V]{20}$/, In = /^[A-Za-z0-9]{27}$/, Pn = /^[a-zA-Z0-9_-]{21}$/, An = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Nn = /^([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})$/, je = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([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)$/, Cn = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, jn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
446
- function xn() {
447
- return new RegExp(jn, "u");
448
- }
449
- const Dn = /^(?:(?: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])$/, Rn = /^(([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}|:))$/, Fn = /^((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])$/, Un = /^(([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])$/, Jn = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, ft = /^[A-Za-z0-9_-]*$/, Mn = /^https?$/, Ln = /^\+[1-9]\d{6,14}$/, pt = "(?:(?:\\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])))", Vn = /* @__PURE__ */ new RegExp(`^${pt}$`);
450
- function dt(e) {
451
- const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
452
- return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
453
- }
454
- function Bn(e) {
455
- return new RegExp(`^${dt(e)}$`);
456
- }
457
- function Wn(e) {
458
- const t = dt({ precision: e.precision }), n = ["Z"];
459
- e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
460
- const o = `${t}(?:${n.join("|")})`;
461
- return new RegExp(`^${pt}T(?:${o})$`);
462
- }
463
- const Gn = (e) => {
464
- const t = e ? `[\\s\\S]{${(e == null ? void 0 : e.minimum) ?? 0},${(e == null ? void 0 : e.maximum) ?? ""}}` : "[\\s\\S]*";
465
- return new RegExp(`^${t}$`);
466
- }, Kn = /^-?\d+$/, Yn = /^-?\d+(?:\.\d+)?$/, qn = /^(?:true|false)$/i, Xn = /^[^A-Z]*$/, Hn = /^[^a-z]*$/, R = /* @__PURE__ */ u("$ZodCheck", (e, t) => {
467
- var n;
468
- e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
469
- }), ht = {
470
- number: "number",
471
- bigint: "bigint",
472
- object: "date"
473
- }, mt = /* @__PURE__ */ u("$ZodCheckLessThan", (e, t) => {
474
- R.init(e, t);
475
- const n = ht[typeof t.value];
476
- e._zod.onattach.push((o) => {
477
- const r = o._zod.bag, i = (t.inclusive ? r.maximum : r.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
478
- t.value < i && (t.inclusive ? r.maximum = t.value : r.exclusiveMaximum = t.value);
479
- }), e._zod.check = (o) => {
480
- (t.inclusive ? o.value <= t.value : o.value < t.value) || o.issues.push({
481
- origin: n,
482
- code: "too_big",
483
- maximum: typeof t.value == "object" ? t.value.getTime() : t.value,
484
- input: o.value,
485
- inclusive: t.inclusive,
486
- inst: e,
487
- continue: !t.abort
488
- });
489
- };
490
- }), gt = /* @__PURE__ */ u("$ZodCheckGreaterThan", (e, t) => {
491
- R.init(e, t);
492
- const n = ht[typeof t.value];
493
- e._zod.onattach.push((o) => {
494
- const r = o._zod.bag, i = (t.inclusive ? r.minimum : r.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
495
- t.value > i && (t.inclusive ? r.minimum = t.value : r.exclusiveMinimum = t.value);
496
- }), e._zod.check = (o) => {
497
- (t.inclusive ? o.value >= t.value : o.value > t.value) || o.issues.push({
498
- origin: n,
499
- code: "too_small",
500
- minimum: typeof t.value == "object" ? t.value.getTime() : t.value,
501
- input: o.value,
502
- inclusive: t.inclusive,
503
- inst: e,
504
- continue: !t.abort
505
- });
506
- };
507
- }), Qn = /* @__PURE__ */ u("$ZodCheckMultipleOf", (e, t) => {
508
- R.init(e, t), e._zod.onattach.push((n) => {
509
- var o;
510
- (o = n._zod.bag).multipleOf ?? (o.multipleOf = t.value);
511
- }), e._zod.check = (n) => {
512
- if (typeof n.value != typeof t.value)
513
- throw new Error("Cannot mix number and bigint in multiple_of check.");
514
- (typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : Qt(n.value, t.value) === 0) || n.issues.push({
515
- origin: typeof n.value,
516
- code: "not_multiple_of",
517
- divisor: t.value,
518
- input: n.value,
519
- inst: e,
520
- continue: !t.abort
521
- });
522
- };
523
- }), eo = /* @__PURE__ */ u("$ZodCheckNumberFormat", (e, t) => {
524
- var s;
525
- R.init(e, t), t.format = t.format || "float64";
526
- const n = (s = t.format) == null ? void 0 : s.includes("int"), o = n ? "int" : "number", [r, i] = rn[t.format];
527
- e._zod.onattach.push((c) => {
528
- const a = c._zod.bag;
529
- a.format = t.format, a.minimum = r, a.maximum = i, n && (a.pattern = Kn);
530
- }), e._zod.check = (c) => {
531
- const a = c.value;
532
- if (n) {
533
- if (!Number.isInteger(a)) {
534
- c.issues.push({
535
- expected: o,
536
- format: t.format,
537
- code: "invalid_type",
538
- continue: !1,
539
- input: a,
540
- inst: e
541
- });
542
- return;
543
- }
544
- if (!Number.isSafeInteger(a)) {
545
- a > 0 ? c.issues.push({
546
- input: a,
547
- code: "too_big",
548
- maximum: Number.MAX_SAFE_INTEGER,
549
- note: "Integers must be within the safe integer range.",
550
- inst: e,
551
- origin: o,
552
- inclusive: !0,
553
- continue: !t.abort
554
- }) : c.issues.push({
555
- input: a,
556
- code: "too_small",
557
- minimum: Number.MIN_SAFE_INTEGER,
558
- note: "Integers must be within the safe integer range.",
559
- inst: e,
560
- origin: o,
561
- inclusive: !0,
562
- continue: !t.abort
563
- });
564
- return;
565
- }
566
- }
567
- a < r && c.issues.push({
568
- origin: "number",
569
- input: a,
570
- code: "too_small",
571
- minimum: r,
572
- inclusive: !0,
573
- inst: e,
574
- continue: !t.abort
575
- }), a > i && c.issues.push({
576
- origin: "number",
577
- input: a,
578
- code: "too_big",
579
- maximum: i,
580
- inclusive: !0,
581
- inst: e,
582
- continue: !t.abort
583
- });
584
- };
585
- }), to = /* @__PURE__ */ u("$ZodCheckMaxLength", (e, t) => {
586
- var n;
587
- R.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
588
- const r = o.value;
589
- return !ke(r) && r.length !== void 0;
590
- }), e._zod.onattach.push((o) => {
591
- const r = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
592
- t.maximum < r && (o._zod.bag.maximum = t.maximum);
593
- }), e._zod.check = (o) => {
594
- const r = o.value;
595
- if (r.length <= t.maximum)
596
- return;
597
- const s = Se(r);
598
- o.issues.push({
599
- origin: s,
600
- code: "too_big",
601
- maximum: t.maximum,
602
- inclusive: !0,
603
- input: r,
604
- inst: e,
605
- continue: !t.abort
606
- });
607
- };
608
- }), no = /* @__PURE__ */ u("$ZodCheckMinLength", (e, t) => {
609
- var n;
610
- R.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
611
- const r = o.value;
612
- return !ke(r) && r.length !== void 0;
613
- }), e._zod.onattach.push((o) => {
614
- const r = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
615
- t.minimum > r && (o._zod.bag.minimum = t.minimum);
616
- }), e._zod.check = (o) => {
617
- const r = o.value;
618
- if (r.length >= t.minimum)
619
- return;
620
- const s = Se(r);
621
- o.issues.push({
622
- origin: s,
623
- code: "too_small",
624
- minimum: t.minimum,
625
- inclusive: !0,
626
- input: r,
627
- inst: e,
628
- continue: !t.abort
629
- });
630
- };
631
- }), oo = /* @__PURE__ */ u("$ZodCheckLengthEquals", (e, t) => {
632
- var n;
633
- R.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
634
- const r = o.value;
635
- return !ke(r) && r.length !== void 0;
636
- }), e._zod.onattach.push((o) => {
637
- const r = o._zod.bag;
638
- r.minimum = t.length, r.maximum = t.length, r.length = t.length;
639
- }), e._zod.check = (o) => {
640
- const r = o.value, i = r.length;
641
- if (i === t.length)
642
- return;
643
- const s = Se(r), c = i > t.length;
644
- o.issues.push({
645
- origin: s,
646
- ...c ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
647
- inclusive: !0,
648
- exact: !0,
649
- input: o.value,
650
- inst: e,
651
- continue: !t.abort
652
- });
653
- };
654
- }), he = /* @__PURE__ */ u("$ZodCheckStringFormat", (e, t) => {
655
- var n, o;
656
- R.init(e, t), e._zod.onattach.push((r) => {
657
- const i = r._zod.bag;
658
- i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
659
- }), t.pattern ? (n = e._zod).check ?? (n.check = (r) => {
660
- t.pattern.lastIndex = 0, !t.pattern.test(r.value) && r.issues.push({
661
- origin: "string",
662
- code: "invalid_format",
663
- format: t.format,
664
- input: r.value,
665
- ...t.pattern ? { pattern: t.pattern.toString() } : {},
666
- inst: e,
667
- continue: !t.abort
668
- });
669
- }) : (o = e._zod).check ?? (o.check = () => {
670
- });
671
- }), ro = /* @__PURE__ */ u("$ZodCheckRegex", (e, t) => {
672
- he.init(e, t), e._zod.check = (n) => {
673
- t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
674
- origin: "string",
675
- code: "invalid_format",
676
- format: "regex",
677
- input: n.value,
678
- pattern: t.pattern.toString(),
679
- inst: e,
680
- continue: !t.abort
681
- });
682
- };
683
- }), io = /* @__PURE__ */ u("$ZodCheckLowerCase", (e, t) => {
684
- t.pattern ?? (t.pattern = Xn), he.init(e, t);
685
- }), so = /* @__PURE__ */ u("$ZodCheckUpperCase", (e, t) => {
686
- t.pattern ?? (t.pattern = Hn), he.init(e, t);
687
- }), co = /* @__PURE__ */ u("$ZodCheckIncludes", (e, t) => {
688
- R.init(e, t);
689
- const n = q(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
690
- t.pattern = o, e._zod.onattach.push((r) => {
691
- const i = r._zod.bag;
692
- i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(o);
693
- }), e._zod.check = (r) => {
694
- r.value.includes(t.includes, t.position) || r.issues.push({
695
- origin: "string",
696
- code: "invalid_format",
697
- format: "includes",
698
- includes: t.includes,
699
- input: r.value,
700
- inst: e,
701
- continue: !t.abort
702
- });
703
- };
704
- }), ao = /* @__PURE__ */ u("$ZodCheckStartsWith", (e, t) => {
705
- R.init(e, t);
706
- const n = new RegExp(`^${q(t.prefix)}.*`);
707
- t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
708
- const r = o._zod.bag;
709
- r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n);
710
- }), e._zod.check = (o) => {
711
- o.value.startsWith(t.prefix) || o.issues.push({
712
- origin: "string",
713
- code: "invalid_format",
714
- format: "starts_with",
715
- prefix: t.prefix,
716
- input: o.value,
717
- inst: e,
718
- continue: !t.abort
719
- });
720
- };
721
- }), uo = /* @__PURE__ */ u("$ZodCheckEndsWith", (e, t) => {
722
- R.init(e, t);
723
- const n = new RegExp(`.*${q(t.suffix)}$`);
724
- t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
725
- const r = o._zod.bag;
726
- r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n);
727
- }), e._zod.check = (o) => {
728
- o.value.endsWith(t.suffix) || o.issues.push({
729
- origin: "string",
730
- code: "invalid_format",
731
- format: "ends_with",
732
- suffix: t.suffix,
733
- input: o.value,
734
- inst: e,
735
- continue: !t.abort
736
- });
737
- };
738
- }), lo = /* @__PURE__ */ u("$ZodCheckOverwrite", (e, t) => {
739
- R.init(e, t), e._zod.check = (n) => {
740
- n.value = t.tx(n.value);
741
- };
742
- });
743
- class fo {
744
- constructor(t = []) {
745
- this.content = [], this.indent = 0, this && (this.args = t);
746
- }
747
- indented(t) {
748
- this.indent += 1, t(this), this.indent -= 1;
749
- }
750
- write(t) {
751
- if (typeof t == "function") {
752
- t(this, { execution: "sync" }), t(this, { execution: "async" });
753
- return;
754
- }
755
- const o = t.split(`
756
- `).filter((s) => s), r = Math.min(...o.map((s) => s.length - s.trimStart().length)), i = o.map((s) => s.slice(r)).map((s) => " ".repeat(this.indent * 2) + s);
757
- for (const s of i)
758
- this.content.push(s);
759
- }
760
- compile() {
761
- const t = Function, n = this == null ? void 0 : this.args, r = [...((this == null ? void 0 : this.content) ?? [""]).map((i) => ` ${i}`)];
762
- return new t(...n, r.join(`
763
- `));
764
- }
765
- }
766
- const po = {
767
- major: 4,
768
- minor: 4,
769
- patch: 3
770
- }, $ = /* @__PURE__ */ u("$ZodType", (e, t) => {
771
- var r;
772
- var n;
773
- e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = po;
774
- const o = [...e._zod.def.checks ?? []];
775
- e._zod.traits.has("$ZodCheck") && o.unshift(e);
776
- for (const i of o)
777
- for (const s of i._zod.onattach)
778
- s(e);
779
- if (o.length === 0)
780
- (n = e._zod).deferred ?? (n.deferred = []), (r = e._zod.deferred) == null || r.push(() => {
781
- e._zod.run = e._zod.parse;
782
- });
783
- else {
784
- const i = (c, a, f) => {
785
- let l = K(c), d;
786
- for (const g of a) {
787
- if (g._zod.def.when) {
788
- if (dn(c) || !g._zod.def.when(c))
789
- continue;
790
- } else if (l)
791
- continue;
792
- const h = c.issues.length, w = g._zod.check(c);
793
- if (w instanceof Promise && (f == null ? void 0 : f.async) === !1)
794
- throw new Y();
795
- if (d || w instanceof Promise)
796
- d = (d ?? Promise.resolve()).then(async () => {
797
- await w, c.issues.length !== h && (l || (l = K(c, h)));
798
- });
799
- else {
800
- if (c.issues.length === h)
801
- continue;
802
- l || (l = K(c, h));
803
- }
804
- }
805
- return d ? d.then(() => c) : c;
806
- }, s = (c, a, f) => {
807
- if (K(c))
808
- return c.aborted = !0, c;
809
- const l = i(a, o, f);
810
- if (l instanceof Promise) {
811
- if (f.async === !1)
812
- throw new Y();
813
- return l.then((d) => e._zod.parse(d, f));
814
- }
815
- return e._zod.parse(l, f);
816
- };
817
- e._zod.run = (c, a) => {
818
- if (a.skipChecks)
819
- return e._zod.parse(c, a);
820
- if (a.direction === "backward") {
821
- const l = e._zod.parse({ value: c.value, issues: [] }, { ...a, skipChecks: !0 });
822
- return l instanceof Promise ? l.then((d) => s(d, c, a)) : s(l, c, a);
823
- }
824
- const f = e._zod.parse(c, a);
825
- if (f instanceof Promise) {
826
- if (a.async === !1)
827
- throw new Y();
828
- return f.then((l) => i(l, o, a));
829
- }
830
- return i(f, o, a);
831
- };
832
- }
833
- y(e, "~standard", () => ({
834
- validate: (i) => {
835
- var s;
836
- try {
837
- const c = gn(e, i);
838
- return c.success ? { value: c.data } : { issues: (s = c.error) == null ? void 0 : s.issues };
839
- } catch {
840
- return _n(e, i).then((a) => {
841
- var f;
842
- return a.success ? { value: a.data } : { issues: (f = a.error) == null ? void 0 : f.issues };
843
- });
844
- }
845
- },
846
- vendor: "zod",
847
- version: 1
848
- }));
849
- }), Ee = /* @__PURE__ */ u("$ZodString", (e, t) => {
850
- var n;
851
- $.init(e, t), e._zod.pattern = [...((n = e == null ? void 0 : e._zod.bag) == null ? void 0 : n.patterns) ?? []].pop() ?? Gn(e._zod.bag), e._zod.parse = (o, r) => {
852
- if (t.coerce)
853
- try {
854
- o.value = String(o.value);
855
- } catch {
856
- }
857
- return typeof o.value == "string" || o.issues.push({
858
- expected: "string",
859
- code: "invalid_type",
860
- input: o.value,
861
- inst: e
862
- }), o;
863
- };
864
- }), k = /* @__PURE__ */ u("$ZodStringFormat", (e, t) => {
865
- he.init(e, t), Ee.init(e, t);
866
- }), ho = /* @__PURE__ */ u("$ZodGUID", (e, t) => {
867
- t.pattern ?? (t.pattern = Nn), k.init(e, t);
868
- }), mo = /* @__PURE__ */ u("$ZodUUID", (e, t) => {
869
- if (t.version) {
870
- const o = {
871
- v1: 1,
872
- v2: 2,
873
- v3: 3,
874
- v4: 4,
875
- v5: 5,
876
- v6: 6,
877
- v7: 7,
878
- v8: 8
879
- }[t.version];
880
- if (o === void 0)
881
- throw new Error(`Invalid UUID version: "${t.version}"`);
882
- t.pattern ?? (t.pattern = je(o));
883
- } else
884
- t.pattern ?? (t.pattern = je());
885
- k.init(e, t);
886
- }), go = /* @__PURE__ */ u("$ZodEmail", (e, t) => {
887
- t.pattern ?? (t.pattern = Cn), k.init(e, t);
888
- }), _o = /* @__PURE__ */ u("$ZodURL", (e, t) => {
889
- k.init(e, t), e._zod.check = (n) => {
890
- var o;
891
- try {
892
- const r = n.value.trim();
893
- if (!t.normalize && ((o = t.protocol) == null ? void 0 : o.source) === Mn.source && !/^https?:\/\//i.test(r)) {
894
- n.issues.push({
895
- code: "invalid_format",
896
- format: "url",
897
- note: "Invalid URL format",
898
- input: n.value,
899
- inst: e,
900
- continue: !t.abort
901
- });
902
- return;
903
- }
904
- const i = new URL(r);
905
- t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(i.hostname) || n.issues.push({
906
- code: "invalid_format",
907
- format: "url",
908
- note: "Invalid hostname",
909
- pattern: t.hostname.source,
910
- input: n.value,
911
- inst: e,
912
- continue: !t.abort
913
- })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) || n.issues.push({
914
- code: "invalid_format",
915
- format: "url",
916
- note: "Invalid protocol",
917
- pattern: t.protocol.source,
918
- input: n.value,
919
- inst: e,
920
- continue: !t.abort
921
- })), t.normalize ? n.value = i.href : n.value = r;
922
- return;
923
- } catch {
924
- n.issues.push({
925
- code: "invalid_format",
926
- format: "url",
927
- input: n.value,
928
- inst: e,
929
- continue: !t.abort
930
- });
931
- }
932
- };
933
- }), vo = /* @__PURE__ */ u("$ZodEmoji", (e, t) => {
934
- t.pattern ?? (t.pattern = xn()), k.init(e, t);
935
- }), yo = /* @__PURE__ */ u("$ZodNanoID", (e, t) => {
936
- t.pattern ?? (t.pattern = Pn), k.init(e, t);
937
- }), bo = /* @__PURE__ */ u("$ZodCUID", (e, t) => {
938
- t.pattern ?? (t.pattern = Zn), k.init(e, t);
939
- }), zo = /* @__PURE__ */ u("$ZodCUID2", (e, t) => {
940
- t.pattern ?? (t.pattern = On), k.init(e, t);
941
- }), wo = /* @__PURE__ */ u("$ZodULID", (e, t) => {
942
- t.pattern ?? (t.pattern = En), k.init(e, t);
943
- }), ko = /* @__PURE__ */ u("$ZodXID", (e, t) => {
944
- t.pattern ?? (t.pattern = Tn), k.init(e, t);
945
- }), $o = /* @__PURE__ */ u("$ZodKSUID", (e, t) => {
946
- t.pattern ?? (t.pattern = In), k.init(e, t);
947
- }), So = /* @__PURE__ */ u("$ZodISODateTime", (e, t) => {
948
- t.pattern ?? (t.pattern = Wn(t)), k.init(e, t);
949
- }), Zo = /* @__PURE__ */ u("$ZodISODate", (e, t) => {
950
- t.pattern ?? (t.pattern = Vn), k.init(e, t);
951
- }), Oo = /* @__PURE__ */ u("$ZodISOTime", (e, t) => {
952
- t.pattern ?? (t.pattern = Bn(t)), k.init(e, t);
953
- }), Eo = /* @__PURE__ */ u("$ZodISODuration", (e, t) => {
954
- t.pattern ?? (t.pattern = An), k.init(e, t);
955
- }), To = /* @__PURE__ */ u("$ZodIPv4", (e, t) => {
956
- t.pattern ?? (t.pattern = Dn), k.init(e, t), e._zod.bag.format = "ipv4";
957
- }), Io = /* @__PURE__ */ u("$ZodIPv6", (e, t) => {
958
- t.pattern ?? (t.pattern = Rn), k.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
959
- try {
960
- new URL(`http://[${n.value}]`);
961
- } catch {
962
- n.issues.push({
963
- code: "invalid_format",
964
- format: "ipv6",
965
- input: n.value,
966
- inst: e,
967
- continue: !t.abort
968
- });
969
- }
970
- };
971
- }), Po = /* @__PURE__ */ u("$ZodCIDRv4", (e, t) => {
972
- t.pattern ?? (t.pattern = Fn), k.init(e, t);
973
- }), Ao = /* @__PURE__ */ u("$ZodCIDRv6", (e, t) => {
974
- t.pattern ?? (t.pattern = Un), k.init(e, t), e._zod.check = (n) => {
975
- const o = n.value.split("/");
976
- try {
977
- if (o.length !== 2)
978
- throw new Error();
979
- const [r, i] = o;
980
- if (!i)
981
- throw new Error();
982
- const s = Number(i);
983
- if (`${s}` !== i)
984
- throw new Error();
985
- if (s < 0 || s > 128)
986
- throw new Error();
987
- new URL(`http://[${r}]`);
988
- } catch {
989
- n.issues.push({
990
- code: "invalid_format",
991
- format: "cidrv6",
992
- input: n.value,
993
- inst: e,
994
- continue: !t.abort
995
- });
996
- }
997
- };
998
- });
999
- function _t(e) {
1000
- if (e === "")
1001
- return !0;
1002
- if (/\s/.test(e) || e.length % 4 !== 0)
1003
- return !1;
1004
- try {
1005
- return atob(e), !0;
1006
- } catch {
1007
- return !1;
1008
- }
1009
- }
1010
- const No = /* @__PURE__ */ u("$ZodBase64", (e, t) => {
1011
- t.pattern ?? (t.pattern = Jn), k.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
1012
- _t(n.value) || n.issues.push({
1013
- code: "invalid_format",
1014
- format: "base64",
1015
- input: n.value,
1016
- inst: e,
1017
- continue: !t.abort
1018
- });
1019
- };
1020
- });
1021
- function Co(e) {
1022
- if (!ft.test(e))
1023
- return !1;
1024
- const t = e.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
1025
- return _t(n);
1026
- }
1027
- const jo = /* @__PURE__ */ u("$ZodBase64URL", (e, t) => {
1028
- t.pattern ?? (t.pattern = ft), k.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
1029
- Co(n.value) || n.issues.push({
1030
- code: "invalid_format",
1031
- format: "base64url",
1032
- input: n.value,
1033
- inst: e,
1034
- continue: !t.abort
1035
- });
1036
- };
1037
- }), xo = /* @__PURE__ */ u("$ZodE164", (e, t) => {
1038
- t.pattern ?? (t.pattern = Ln), k.init(e, t);
1039
- });
1040
- function Do(e, t = null) {
1041
- try {
1042
- const n = e.split(".");
1043
- if (n.length !== 3)
1044
- return !1;
1045
- const [o] = n;
1046
- if (!o)
1047
- return !1;
1048
- const r = JSON.parse(atob(o));
1049
- return !("typ" in r && (r == null ? void 0 : r.typ) !== "JWT" || !r.alg || t && (!("alg" in r) || r.alg !== t));
1050
- } catch {
1051
- return !1;
1052
- }
1053
- }
1054
- const Ro = /* @__PURE__ */ u("$ZodJWT", (e, t) => {
1055
- k.init(e, t), e._zod.check = (n) => {
1056
- Do(n.value, t.alg) || n.issues.push({
1057
- code: "invalid_format",
1058
- format: "jwt",
1059
- input: n.value,
1060
- inst: e,
1061
- continue: !t.abort
1062
- });
1063
- };
1064
- }), vt = /* @__PURE__ */ u("$ZodNumber", (e, t) => {
1065
- $.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Yn, e._zod.parse = (n, o) => {
1066
- if (t.coerce)
1067
- try {
1068
- n.value = Number(n.value);
1069
- } catch {
1070
- }
1071
- const r = n.value;
1072
- if (typeof r == "number" && !Number.isNaN(r) && Number.isFinite(r))
1073
- return n;
1074
- const i = typeof r == "number" ? Number.isNaN(r) ? "NaN" : Number.isFinite(r) ? void 0 : "Infinity" : void 0;
1075
- return n.issues.push({
1076
- expected: "number",
1077
- code: "invalid_type",
1078
- input: r,
1079
- inst: e,
1080
- ...i ? { received: i } : {}
1081
- }), n;
1082
- };
1083
- }), Fo = /* @__PURE__ */ u("$ZodNumberFormat", (e, t) => {
1084
- eo.init(e, t), vt.init(e, t);
1085
- }), Uo = /* @__PURE__ */ u("$ZodBoolean", (e, t) => {
1086
- $.init(e, t), e._zod.pattern = qn, e._zod.parse = (n, o) => {
1087
- if (t.coerce)
1088
- try {
1089
- n.value = !!n.value;
1090
- } catch {
1091
- }
1092
- const r = n.value;
1093
- return typeof r == "boolean" || n.issues.push({
1094
- expected: "boolean",
1095
- code: "invalid_type",
1096
- input: r,
1097
- inst: e
1098
- }), n;
1099
- };
1100
- }), Jo = /* @__PURE__ */ u("$ZodUnknown", (e, t) => {
1101
- $.init(e, t), e._zod.parse = (n) => n;
1102
- }), Mo = /* @__PURE__ */ u("$ZodNever", (e, t) => {
1103
- $.init(e, t), e._zod.parse = (n, o) => (n.issues.push({
1104
- expected: "never",
1105
- code: "invalid_type",
1106
- input: n.value,
1107
- inst: e
1108
- }), n);
1109
- });
1110
- function xe(e, t, n) {
1111
- e.issues.length && t.issues.push(...ct(n, e.issues)), t.value[n] = e.value;
1112
- }
1113
- const Lo = /* @__PURE__ */ u("$ZodArray", (e, t) => {
1114
- $.init(e, t), e._zod.parse = (n, o) => {
1115
- const r = n.value;
1116
- if (!Array.isArray(r))
1117
- return n.issues.push({
1118
- expected: "array",
1119
- code: "invalid_type",
1120
- input: r,
1121
- inst: e
1122
- }), n;
1123
- n.value = Array(r.length);
1124
- const i = [];
1125
- for (let s = 0; s < r.length; s++) {
1126
- const c = r[s], a = t.element._zod.run({
1127
- value: c,
1128
- issues: []
1129
- }, o);
1130
- a instanceof Promise ? i.push(a.then((f) => xe(f, n, s))) : xe(a, n, s);
1131
- }
1132
- return i.length ? Promise.all(i).then(() => n) : n;
1133
- };
1134
- });
1135
- function ae(e, t, n, o, r, i) {
1136
- const s = n in o;
1137
- if (e.issues.length) {
1138
- if (r && i && !s)
1139
- return;
1140
- t.issues.push(...ct(n, e.issues));
1141
- }
1142
- if (!s && !r) {
1143
- e.issues.length || t.issues.push({
1144
- code: "invalid_type",
1145
- expected: "nonoptional",
1146
- input: void 0,
1147
- path: [n]
1148
- });
1149
- return;
1150
- }
1151
- e.value === void 0 ? s && (t.value[n] = void 0) : t.value[n] = e.value;
1152
- }
1153
- function yt(e) {
1154
- var o, r, i, s;
1155
- const t = Object.keys(e.shape);
1156
- for (const c of t)
1157
- if (!((s = (i = (r = (o = e.shape) == null ? void 0 : o[c]) == null ? void 0 : r._zod) == null ? void 0 : i.traits) != null && s.has("$ZodType")))
1158
- throw new Error(`Invalid element at key "${c}": expected a Zod schema`);
1159
- const n = on(e.shape);
1160
- return {
1161
- ...e,
1162
- keys: t,
1163
- keySet: new Set(t),
1164
- numKeys: t.length,
1165
- optionalKeys: new Set(n)
1166
- };
1167
- }
1168
- function bt(e, t, n, o, r, i) {
1169
- const s = [], c = r.keySet, a = r.catchall._zod, f = a.def.type, l = a.optin === "optional", d = a.optout === "optional";
1170
- for (const g in t) {
1171
- if (g === "__proto__" || c.has(g))
1172
- continue;
1173
- if (f === "never") {
1174
- s.push(g);
1175
- continue;
1176
- }
1177
- const h = a.run({ value: t[g], issues: [] }, o);
1178
- h instanceof Promise ? e.push(h.then((w) => ae(w, n, g, t, l, d))) : ae(h, n, g, t, l, d);
1179
- }
1180
- return s.length && n.issues.push({
1181
- code: "unrecognized_keys",
1182
- keys: s,
1183
- input: t,
1184
- inst: i
1185
- }), e.length ? Promise.all(e).then(() => n) : n;
1186
- }
1187
- const Vo = /* @__PURE__ */ u("$ZodObject", (e, t) => {
1188
- $.init(e, t);
1189
- const n = Object.getOwnPropertyDescriptor(t, "shape");
1190
- if (!(n != null && n.get)) {
1191
- const c = t.shape;
1192
- Object.defineProperty(t, "shape", {
1193
- get: () => {
1194
- const a = { ...c };
1195
- return Object.defineProperty(t, "shape", {
1196
- value: a
1197
- }), a;
1198
- }
1199
- });
1200
- }
1201
- const o = fe(() => yt(t));
1202
- y(e._zod, "propValues", () => {
1203
- const c = t.shape, a = {};
1204
- for (const f in c) {
1205
- const l = c[f]._zod;
1206
- if (l.values) {
1207
- a[f] ?? (a[f] = /* @__PURE__ */ new Set());
1208
- for (const d of l.values)
1209
- a[f].add(d);
1210
- }
1211
- }
1212
- return a;
1213
- });
1214
- const r = ee, i = t.catchall;
1215
- let s;
1216
- e._zod.parse = (c, a) => {
1217
- s ?? (s = o.value);
1218
- const f = c.value;
1219
- if (!r(f))
1220
- return c.issues.push({
1221
- expected: "object",
1222
- code: "invalid_type",
1223
- input: f,
1224
- inst: e
1225
- }), c;
1226
- c.value = {};
1227
- const l = [], d = s.shape;
1228
- for (const g of s.keys) {
1229
- const h = d[g], w = h._zod.optin === "optional", E = h._zod.optout === "optional", j = h._zod.run({ value: f[g], issues: [] }, a);
1230
- j instanceof Promise ? l.push(j.then((T) => ae(T, c, g, f, w, E))) : ae(j, c, g, f, w, E);
1231
- }
1232
- return i ? bt(l, f, c, a, o.value, e) : l.length ? Promise.all(l).then(() => c) : c;
1233
- };
1234
- }), Bo = /* @__PURE__ */ u("$ZodObjectJIT", (e, t) => {
1235
- Vo.init(e, t);
1236
- const n = e._zod.parse, o = fe(() => yt(t)), r = (g) => {
1237
- var H, x;
1238
- const h = new fo(["shape", "payload", "ctx"]), w = o.value, E = (U) => {
1239
- const O = Ce(U);
1240
- return `shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`;
1241
- };
1242
- h.write("const input = payload.value;");
1243
- const j = /* @__PURE__ */ Object.create(null);
1244
- let T = 0;
1245
- for (const U of w.keys)
1246
- j[U] = `key_${T++}`;
1247
- h.write("const newResult = {};");
1248
- for (const U of w.keys) {
1249
- const O = j[U], A = Ce(U), G = g[U], Pe = ((H = G == null ? void 0 : G._zod) == null ? void 0 : H.optin) === "optional", Kt = ((x = G == null ? void 0 : G._zod) == null ? void 0 : x.optout) === "optional";
1250
- h.write(`const ${O} = ${E(U)};`), Pe && Kt ? h.write(`
1251
- if (${O}.issues.length) {
1252
- if (${A} in input) {
1253
- payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
1254
- ...iss,
1255
- path: iss.path ? [${A}, ...iss.path] : [${A}]
1256
- })));
1257
- }
1258
- }
1259
-
1260
- if (${O}.value === undefined) {
1261
- if (${A} in input) {
1262
- newResult[${A}] = undefined;
1263
- }
1264
- } else {
1265
- newResult[${A}] = ${O}.value;
1266
- }
1267
-
1268
- `) : Pe ? h.write(`
1269
- if (${O}.issues.length) {
1270
- payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
1271
- ...iss,
1272
- path: iss.path ? [${A}, ...iss.path] : [${A}]
1273
- })));
1274
- }
1275
-
1276
- if (${O}.value === undefined) {
1277
- if (${A} in input) {
1278
- newResult[${A}] = undefined;
1279
- }
1280
- } else {
1281
- newResult[${A}] = ${O}.value;
1282
- }
1283
-
1284
- `) : h.write(`
1285
- const ${O}_present = ${A} in input;
1286
- if (${O}.issues.length) {
1287
- payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
1288
- ...iss,
1289
- path: iss.path ? [${A}, ...iss.path] : [${A}]
1290
- })));
1291
- }
1292
- if (!${O}_present && !${O}.issues.length) {
1293
- payload.issues.push({
1294
- code: "invalid_type",
1295
- expected: "nonoptional",
1296
- input: undefined,
1297
- path: [${A}]
1298
- });
1299
- }
1300
-
1301
- if (${O}_present) {
1302
- if (${O}.value === undefined) {
1303
- newResult[${A}] = undefined;
1304
- } else {
1305
- newResult[${A}] = ${O}.value;
1306
- }
1307
- }
1308
-
1309
- `);
1310
- }
1311
- h.write("payload.value = newResult;"), h.write("return payload;");
1312
- const P = h.compile();
1313
- return (U, O) => P(g, U, O);
1314
- };
1315
- let i;
1316
- const s = ee, c = !we.jitless, f = c && tn.value, l = t.catchall;
1317
- let d;
1318
- e._zod.parse = (g, h) => {
1319
- d ?? (d = o.value);
1320
- const w = g.value;
1321
- return s(w) ? c && f && (h == null ? void 0 : h.async) === !1 && h.jitless !== !0 ? (i || (i = r(t.shape)), g = i(g, h), l ? bt([], w, g, h, d, e) : g) : n(g, h) : (g.issues.push({
1322
- expected: "object",
1323
- code: "invalid_type",
1324
- input: w,
1325
- inst: e
1326
- }), g);
1327
- };
1328
- });
1329
- function De(e, t, n, o) {
1330
- for (const i of e)
1331
- if (i.issues.length === 0)
1332
- return t.value = i.value, t;
1333
- const r = e.filter((i) => !K(i));
1334
- return r.length === 1 ? (t.value = r[0].value, r[0]) : (t.issues.push({
1335
- code: "invalid_union",
1336
- input: t.value,
1337
- inst: n,
1338
- errors: e.map((i) => i.issues.map((s) => B(s, o, V())))
1339
- }), t);
1340
- }
1341
- const zt = /* @__PURE__ */ u("$ZodUnion", (e, t) => {
1342
- $.init(e, t), y(e._zod, "optin", () => t.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0), y(e._zod, "optout", () => t.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0), y(e._zod, "values", () => {
1343
- if (t.options.every((o) => o._zod.values))
1344
- return new Set(t.options.flatMap((o) => Array.from(o._zod.values)));
1345
- }), y(e._zod, "pattern", () => {
1346
- if (t.options.every((o) => o._zod.pattern)) {
1347
- const o = t.options.map((r) => r._zod.pattern);
1348
- return new RegExp(`^(${o.map((r) => $e(r.source)).join("|")})$`);
1349
- }
1350
- });
1351
- const n = t.options.length === 1 ? t.options[0]._zod.run : null;
1352
- e._zod.parse = (o, r) => {
1353
- if (n)
1354
- return n(o, r);
1355
- let i = !1;
1356
- const s = [];
1357
- for (const c of t.options) {
1358
- const a = c._zod.run({
1359
- value: o.value,
1360
- issues: []
1361
- }, r);
1362
- if (a instanceof Promise)
1363
- s.push(a), i = !0;
1364
- else {
1365
- if (a.issues.length === 0)
1366
- return a;
1367
- s.push(a);
1368
- }
1369
- }
1370
- return i ? Promise.all(s).then((c) => De(c, o, e, r)) : De(s, o, e, r);
1371
- };
1372
- }), Wo = /* @__PURE__ */ u("$ZodDiscriminatedUnion", (e, t) => {
1373
- t.inclusive = !1, zt.init(e, t);
1374
- const n = e._zod.parse;
1375
- y(e._zod, "propValues", () => {
1376
- const r = {};
1377
- for (const i of t.options) {
1378
- const s = i._zod.propValues;
1379
- if (!s || Object.keys(s).length === 0)
1380
- throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);
1381
- for (const [c, a] of Object.entries(s)) {
1382
- r[c] || (r[c] = /* @__PURE__ */ new Set());
1383
- for (const f of a)
1384
- r[c].add(f);
1385
- }
1386
- }
1387
- return r;
1388
- });
1389
- const o = fe(() => {
1390
- var s;
1391
- const r = t.options, i = /* @__PURE__ */ new Map();
1392
- for (const c of r) {
1393
- const a = (s = c._zod.propValues) == null ? void 0 : s[t.discriminator];
1394
- if (!a || a.size === 0)
1395
- throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(c)}"`);
1396
- for (const f of a) {
1397
- if (i.has(f))
1398
- throw new Error(`Duplicate discriminator value "${String(f)}"`);
1399
- i.set(f, c);
1400
- }
1401
- }
1402
- return i;
1403
- });
1404
- e._zod.parse = (r, i) => {
1405
- const s = r.value;
1406
- if (!ee(s))
1407
- return r.issues.push({
1408
- code: "invalid_type",
1409
- expected: "object",
1410
- input: s,
1411
- inst: e
1412
- }), r;
1413
- const c = o.value.get(s == null ? void 0 : s[t.discriminator]);
1414
- return c ? c._zod.run(r, i) : t.unionFallback || i.direction === "backward" ? n(r, i) : (r.issues.push({
1415
- code: "invalid_union",
1416
- errors: [],
1417
- note: "No matching discriminator",
1418
- discriminator: t.discriminator,
1419
- options: Array.from(o.value.keys()),
1420
- input: s,
1421
- path: [t.discriminator],
1422
- inst: e
1423
- }), r);
1424
- };
1425
- }), Go = /* @__PURE__ */ u("$ZodIntersection", (e, t) => {
1426
- $.init(e, t), e._zod.parse = (n, o) => {
1427
- const r = n.value, i = t.left._zod.run({ value: r, issues: [] }, o), s = t.right._zod.run({ value: r, issues: [] }, o);
1428
- return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([a, f]) => Re(n, a, f)) : Re(n, i, s);
1429
- };
1430
- });
1431
- function ve(e, t) {
1432
- if (e === t)
1433
- return { valid: !0, data: e };
1434
- if (e instanceof Date && t instanceof Date && +e == +t)
1435
- return { valid: !0, data: e };
1436
- if (te(e) && te(t)) {
1437
- const n = Object.keys(t), o = Object.keys(e).filter((i) => n.indexOf(i) !== -1), r = { ...e, ...t };
1438
- for (const i of o) {
1439
- const s = ve(e[i], t[i]);
1440
- if (!s.valid)
1441
- return {
1442
- valid: !1,
1443
- mergeErrorPath: [i, ...s.mergeErrorPath]
1444
- };
1445
- r[i] = s.data;
1446
- }
1447
- return { valid: !0, data: r };
1448
- }
1449
- if (Array.isArray(e) && Array.isArray(t)) {
1450
- if (e.length !== t.length)
1451
- return { valid: !1, mergeErrorPath: [] };
1452
- const n = [];
1453
- for (let o = 0; o < e.length; o++) {
1454
- const r = e[o], i = t[o], s = ve(r, i);
1455
- if (!s.valid)
1456
- return {
1457
- valid: !1,
1458
- mergeErrorPath: [o, ...s.mergeErrorPath]
1459
- };
1460
- n.push(s.data);
1461
- }
1462
- return { valid: !0, data: n };
1463
- }
1464
- return { valid: !1, mergeErrorPath: [] };
1465
- }
1466
- function Re(e, t, n) {
1467
- const o = /* @__PURE__ */ new Map();
1468
- let r;
1469
- for (const c of t.issues)
1470
- if (c.code === "unrecognized_keys") {
1471
- r ?? (r = c);
1472
- for (const a of c.keys)
1473
- o.has(a) || o.set(a, {}), o.get(a).l = !0;
1474
- } else
1475
- e.issues.push(c);
1476
- for (const c of n.issues)
1477
- if (c.code === "unrecognized_keys")
1478
- for (const a of c.keys)
1479
- o.has(a) || o.set(a, {}), o.get(a).r = !0;
1480
- else
1481
- e.issues.push(c);
1482
- const i = [...o].filter(([, c]) => c.l && c.r).map(([c]) => c);
1483
- if (i.length && r && e.issues.push({ ...r, keys: i }), K(e))
1484
- return e;
1485
- const s = ve(t.value, n.value);
1486
- if (!s.valid)
1487
- throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);
1488
- return e.value = s.data, e;
1489
- }
1490
- const Ko = /* @__PURE__ */ u("$ZodEnum", (e, t) => {
1491
- $.init(e, t);
1492
- const n = rt(t.entries), o = new Set(n);
1493
- e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((r) => nn.has(typeof r)).map((r) => typeof r == "string" ? q(r) : r.toString()).join("|")})$`), e._zod.parse = (r, i) => {
1494
- const s = r.value;
1495
- return o.has(s) || r.issues.push({
1496
- code: "invalid_value",
1497
- values: n,
1498
- input: s,
1499
- inst: e
1500
- }), r;
1501
- };
1502
- }), Yo = /* @__PURE__ */ u("$ZodLiteral", (e, t) => {
1503
- if ($.init(e, t), t.values.length === 0)
1504
- throw new Error("Cannot create literal schema with no valid values");
1505
- const n = new Set(t.values);
1506
- e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((o) => typeof o == "string" ? q(o) : o ? q(o.toString()) : String(o)).join("|")})$`), e._zod.parse = (o, r) => {
1507
- const i = o.value;
1508
- return n.has(i) || o.issues.push({
1509
- code: "invalid_value",
1510
- values: t.values,
1511
- input: i,
1512
- inst: e
1513
- }), o;
1514
- };
1515
- }), qo = /* @__PURE__ */ u("$ZodTransform", (e, t) => {
1516
- $.init(e, t), e._zod.optin = "optional", e._zod.parse = (n, o) => {
1517
- if (o.direction === "backward")
1518
- throw new ot(e.constructor.name);
1519
- const r = t.transform(n.value, n);
1520
- if (o.async)
1521
- return (r instanceof Promise ? r : Promise.resolve(r)).then((s) => (n.value = s, n.fallback = !0, n));
1522
- if (r instanceof Promise)
1523
- throw new Y();
1524
- return n.value = r, n.fallback = !0, n;
1525
- };
1526
- });
1527
- function Fe(e, t) {
1528
- return t === void 0 && (e.issues.length || e.fallback) ? { issues: [], value: void 0 } : e;
1529
- }
1530
- const wt = /* @__PURE__ */ u("$ZodOptional", (e, t) => {
1531
- $.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", y(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), y(e._zod, "pattern", () => {
1532
- const n = t.innerType._zod.pattern;
1533
- return n ? new RegExp(`^(${$e(n.source)})?$`) : void 0;
1534
- }), e._zod.parse = (n, o) => {
1535
- if (t.innerType._zod.optin === "optional") {
1536
- const r = n.value, i = t.innerType._zod.run(n, o);
1537
- return i instanceof Promise ? i.then((s) => Fe(s, r)) : Fe(i, r);
1538
- }
1539
- return n.value === void 0 ? n : t.innerType._zod.run(n, o);
1540
- };
1541
- }), Xo = /* @__PURE__ */ u("$ZodExactOptional", (e, t) => {
1542
- wt.init(e, t), y(e._zod, "values", () => t.innerType._zod.values), y(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (n, o) => t.innerType._zod.run(n, o);
1543
- }), Ho = /* @__PURE__ */ u("$ZodNullable", (e, t) => {
1544
- $.init(e, t), y(e._zod, "optin", () => t.innerType._zod.optin), y(e._zod, "optout", () => t.innerType._zod.optout), y(e._zod, "pattern", () => {
1545
- const n = t.innerType._zod.pattern;
1546
- return n ? new RegExp(`^(${$e(n.source)}|null)$`) : void 0;
1547
- }), y(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, o) => n.value === null ? n : t.innerType._zod.run(n, o);
1548
- }), Qo = /* @__PURE__ */ u("$ZodDefault", (e, t) => {
1549
- $.init(e, t), e._zod.optin = "optional", y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
1550
- if (o.direction === "backward")
1551
- return t.innerType._zod.run(n, o);
1552
- if (n.value === void 0)
1553
- return n.value = t.defaultValue, n;
1554
- const r = t.innerType._zod.run(n, o);
1555
- return r instanceof Promise ? r.then((i) => Ue(i, t)) : Ue(r, t);
1556
- };
1557
- });
1558
- function Ue(e, t) {
1559
- return e.value === void 0 && (e.value = t.defaultValue), e;
1560
- }
1561
- const er = /* @__PURE__ */ u("$ZodPrefault", (e, t) => {
1562
- $.init(e, t), e._zod.optin = "optional", y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => (o.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, o));
1563
- }), tr = /* @__PURE__ */ u("$ZodNonOptional", (e, t) => {
1564
- $.init(e, t), y(e._zod, "values", () => {
1565
- const n = t.innerType._zod.values;
1566
- return n ? new Set([...n].filter((o) => o !== void 0)) : void 0;
1567
- }), e._zod.parse = (n, o) => {
1568
- const r = t.innerType._zod.run(n, o);
1569
- return r instanceof Promise ? r.then((i) => Je(i, e)) : Je(r, e);
1570
- };
1571
- });
1572
- function Je(e, t) {
1573
- return !e.issues.length && e.value === void 0 && e.issues.push({
1574
- code: "invalid_type",
1575
- expected: "nonoptional",
1576
- input: e.value,
1577
- inst: t
1578
- }), e;
1579
- }
1580
- const nr = /* @__PURE__ */ u("$ZodCatch", (e, t) => {
1581
- $.init(e, t), e._zod.optin = "optional", y(e._zod, "optout", () => t.innerType._zod.optout), y(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
1582
- if (o.direction === "backward")
1583
- return t.innerType._zod.run(n, o);
1584
- const r = t.innerType._zod.run(n, o);
1585
- return r instanceof Promise ? r.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
1586
- ...n,
1587
- error: {
1588
- issues: i.issues.map((s) => B(s, o, V()))
1589
- },
1590
- input: n.value
1591
- }), n.issues = [], n.fallback = !0), n)) : (n.value = r.value, r.issues.length && (n.value = t.catchValue({
1592
- ...n,
1593
- error: {
1594
- issues: r.issues.map((i) => B(i, o, V()))
1595
- },
1596
- input: n.value
1597
- }), n.issues = [], n.fallback = !0), n);
1598
- };
1599
- }), or = /* @__PURE__ */ u("$ZodPipe", (e, t) => {
1600
- $.init(e, t), y(e._zod, "values", () => t.in._zod.values), y(e._zod, "optin", () => t.in._zod.optin), y(e._zod, "optout", () => t.out._zod.optout), y(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, o) => {
1601
- if (o.direction === "backward") {
1602
- const i = t.out._zod.run(n, o);
1603
- return i instanceof Promise ? i.then((s) => se(s, t.in, o)) : se(i, t.in, o);
1604
- }
1605
- const r = t.in._zod.run(n, o);
1606
- return r instanceof Promise ? r.then((i) => se(i, t.out, o)) : se(r, t.out, o);
1607
- };
1608
- });
1609
- function se(e, t, n) {
1610
- return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues, fallback: e.fallback }, n);
1611
- }
1612
- const rr = /* @__PURE__ */ u("$ZodReadonly", (e, t) => {
1613
- $.init(e, t), y(e._zod, "propValues", () => t.innerType._zod.propValues), y(e._zod, "values", () => t.innerType._zod.values), y(e._zod, "optin", () => {
1614
- var n, o;
1615
- return (o = (n = t.innerType) == null ? void 0 : n._zod) == null ? void 0 : o.optin;
1616
- }), y(e._zod, "optout", () => {
1617
- var n, o;
1618
- return (o = (n = t.innerType) == null ? void 0 : n._zod) == null ? void 0 : o.optout;
1619
- }), e._zod.parse = (n, o) => {
1620
- if (o.direction === "backward")
1621
- return t.innerType._zod.run(n, o);
1622
- const r = t.innerType._zod.run(n, o);
1623
- return r instanceof Promise ? r.then(Me) : Me(r);
1624
- };
1625
- });
1626
- function Me(e) {
1627
- return e.value = Object.freeze(e.value), e;
1628
- }
1629
- const ir = /* @__PURE__ */ u("$ZodLazy", (e, t) => {
1630
- $.init(e, t), y(e._zod, "innerType", () => {
1631
- const n = t;
1632
- return n._cachedInner || (n._cachedInner = t.getter()), n._cachedInner;
1633
- }), y(e._zod, "pattern", () => {
1634
- var n, o;
1635
- return (o = (n = e._zod.innerType) == null ? void 0 : n._zod) == null ? void 0 : o.pattern;
1636
- }), y(e._zod, "propValues", () => {
1637
- var n, o;
1638
- return (o = (n = e._zod.innerType) == null ? void 0 : n._zod) == null ? void 0 : o.propValues;
1639
- }), y(e._zod, "optin", () => {
1640
- var n, o;
1641
- return ((o = (n = e._zod.innerType) == null ? void 0 : n._zod) == null ? void 0 : o.optin) ?? void 0;
1642
- }), y(e._zod, "optout", () => {
1643
- var n, o;
1644
- return ((o = (n = e._zod.innerType) == null ? void 0 : n._zod) == null ? void 0 : o.optout) ?? void 0;
1645
- }), e._zod.parse = (n, o) => e._zod.innerType._zod.run(n, o);
1646
- }), sr = /* @__PURE__ */ u("$ZodCustom", (e, t) => {
1647
- R.init(e, t), $.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
1648
- const o = n.value, r = t.fn(o);
1649
- if (r instanceof Promise)
1650
- return r.then((i) => Le(i, n, o, e));
1651
- Le(r, n, o, e);
1652
- };
1653
- });
1654
- function Le(e, t, n, o) {
1655
- if (!e) {
1656
- const r = {
1657
- code: "custom",
1658
- input: n,
1659
- inst: o,
1660
- // incorporates params.error into issue reporting
1661
- path: [...o._zod.def.path ?? []],
1662
- // incorporates params.error into issue reporting
1663
- continue: !o._zod.def.abort
1664
- // params: inst._zod.def.params,
1665
- };
1666
- o._zod.def.params && (r.params = o._zod.def.params), t.issues.push(ne(r));
1667
- }
1668
- }
1669
- var Ve;
1670
- class cr {
1671
- constructor() {
1672
- this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
1673
- }
1674
- add(t, ...n) {
1675
- const o = n[0];
1676
- return this._map.set(t, o), o && typeof o == "object" && "id" in o && this._idmap.set(o.id, t), this;
1677
- }
1678
- clear() {
1679
- return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
1680
- }
1681
- remove(t) {
1682
- const n = this._map.get(t);
1683
- return n && typeof n == "object" && "id" in n && this._idmap.delete(n.id), this._map.delete(t), this;
1684
- }
1685
- get(t) {
1686
- const n = t._zod.parent;
1687
- if (n) {
1688
- const o = { ...this.get(n) ?? {} };
1689
- delete o.id;
1690
- const r = { ...o, ...this._map.get(t) };
1691
- return Object.keys(r).length ? r : void 0;
1692
- }
1693
- return this._map.get(t);
1694
- }
1695
- has(t) {
1696
- return this._map.has(t);
1697
- }
1698
- }
1699
- function ar() {
1700
- return new cr();
1701
- }
1702
- (Ve = globalThis).__zod_globalRegistry ?? (Ve.__zod_globalRegistry = ar());
1703
- const Q = globalThis.__zod_globalRegistry;
1704
- // @__NO_SIDE_EFFECTS__
1705
- function ur(e, t) {
1706
- return new e({
1707
- type: "string",
1708
- ..._(t)
1709
- });
1710
- }
1711
- // @__NO_SIDE_EFFECTS__
1712
- function lr(e, t) {
1713
- return new e({
1714
- type: "string",
1715
- format: "email",
1716
- check: "string_format",
1717
- abort: !1,
1718
- ..._(t)
1719
- });
1720
- }
1721
- // @__NO_SIDE_EFFECTS__
1722
- function Be(e, t) {
1723
- return new e({
1724
- type: "string",
1725
- format: "guid",
1726
- check: "string_format",
1727
- abort: !1,
1728
- ..._(t)
1729
- });
1730
- }
1731
- // @__NO_SIDE_EFFECTS__
1732
- function fr(e, t) {
1733
- return new e({
1734
- type: "string",
1735
- format: "uuid",
1736
- check: "string_format",
1737
- abort: !1,
1738
- ..._(t)
1739
- });
1740
- }
1741
- // @__NO_SIDE_EFFECTS__
1742
- function pr(e, t) {
1743
- return new e({
1744
- type: "string",
1745
- format: "uuid",
1746
- check: "string_format",
1747
- abort: !1,
1748
- version: "v4",
1749
- ..._(t)
1750
- });
1751
- }
1752
- // @__NO_SIDE_EFFECTS__
1753
- function dr(e, t) {
1754
- return new e({
1755
- type: "string",
1756
- format: "uuid",
1757
- check: "string_format",
1758
- abort: !1,
1759
- version: "v6",
1760
- ..._(t)
1761
- });
1762
- }
1763
- // @__NO_SIDE_EFFECTS__
1764
- function hr(e, t) {
1765
- return new e({
1766
- type: "string",
1767
- format: "uuid",
1768
- check: "string_format",
1769
- abort: !1,
1770
- version: "v7",
1771
- ..._(t)
1772
- });
1773
- }
1774
- // @__NO_SIDE_EFFECTS__
1775
- function mr(e, t) {
1776
- return new e({
1777
- type: "string",
1778
- format: "url",
1779
- check: "string_format",
1780
- abort: !1,
1781
- ..._(t)
1782
- });
1783
- }
1784
- // @__NO_SIDE_EFFECTS__
1785
- function gr(e, t) {
1786
- return new e({
1787
- type: "string",
1788
- format: "emoji",
1789
- check: "string_format",
1790
- abort: !1,
1791
- ..._(t)
1792
- });
1793
- }
1794
- // @__NO_SIDE_EFFECTS__
1795
- function _r(e, t) {
1796
- return new e({
1797
- type: "string",
1798
- format: "nanoid",
1799
- check: "string_format",
1800
- abort: !1,
1801
- ..._(t)
1802
- });
1803
- }
1804
- // @__NO_SIDE_EFFECTS__
1805
- function vr(e, t) {
1806
- return new e({
1807
- type: "string",
1808
- format: "cuid",
1809
- check: "string_format",
1810
- abort: !1,
1811
- ..._(t)
1812
- });
1813
- }
1814
- // @__NO_SIDE_EFFECTS__
1815
- function yr(e, t) {
1816
- return new e({
1817
- type: "string",
1818
- format: "cuid2",
1819
- check: "string_format",
1820
- abort: !1,
1821
- ..._(t)
1822
- });
1823
- }
1824
- // @__NO_SIDE_EFFECTS__
1825
- function br(e, t) {
1826
- return new e({
1827
- type: "string",
1828
- format: "ulid",
1829
- check: "string_format",
1830
- abort: !1,
1831
- ..._(t)
1832
- });
1833
- }
1834
- // @__NO_SIDE_EFFECTS__
1835
- function zr(e, t) {
1836
- return new e({
1837
- type: "string",
1838
- format: "xid",
1839
- check: "string_format",
1840
- abort: !1,
1841
- ..._(t)
1842
- });
1843
- }
1844
- // @__NO_SIDE_EFFECTS__
1845
- function wr(e, t) {
1846
- return new e({
1847
- type: "string",
1848
- format: "ksuid",
1849
- check: "string_format",
1850
- abort: !1,
1851
- ..._(t)
1852
- });
1853
- }
1854
- // @__NO_SIDE_EFFECTS__
1855
- function kr(e, t) {
1856
- return new e({
1857
- type: "string",
1858
- format: "ipv4",
1859
- check: "string_format",
1860
- abort: !1,
1861
- ..._(t)
1862
- });
1863
- }
1864
- // @__NO_SIDE_EFFECTS__
1865
- function $r(e, t) {
1866
- return new e({
1867
- type: "string",
1868
- format: "ipv6",
1869
- check: "string_format",
1870
- abort: !1,
1871
- ..._(t)
1872
- });
1873
- }
1874
- // @__NO_SIDE_EFFECTS__
1875
- function Sr(e, t) {
1876
- return new e({
1877
- type: "string",
1878
- format: "cidrv4",
1879
- check: "string_format",
1880
- abort: !1,
1881
- ..._(t)
1882
- });
1883
- }
1884
- // @__NO_SIDE_EFFECTS__
1885
- function Zr(e, t) {
1886
- return new e({
1887
- type: "string",
1888
- format: "cidrv6",
1889
- check: "string_format",
1890
- abort: !1,
1891
- ..._(t)
1892
- });
1893
- }
1894
- // @__NO_SIDE_EFFECTS__
1895
- function Or(e, t) {
1896
- return new e({
1897
- type: "string",
1898
- format: "base64",
1899
- check: "string_format",
1900
- abort: !1,
1901
- ..._(t)
1902
- });
1903
- }
1904
- // @__NO_SIDE_EFFECTS__
1905
- function Er(e, t) {
1906
- return new e({
1907
- type: "string",
1908
- format: "base64url",
1909
- check: "string_format",
1910
- abort: !1,
1911
- ..._(t)
1912
- });
1913
- }
1914
- // @__NO_SIDE_EFFECTS__
1915
- function Tr(e, t) {
1916
- return new e({
1917
- type: "string",
1918
- format: "e164",
1919
- check: "string_format",
1920
- abort: !1,
1921
- ..._(t)
1922
- });
1923
- }
1924
- // @__NO_SIDE_EFFECTS__
1925
- function Ir(e, t) {
1926
- return new e({
1927
- type: "string",
1928
- format: "jwt",
1929
- check: "string_format",
1930
- abort: !1,
1931
- ..._(t)
1932
- });
1933
- }
1934
- // @__NO_SIDE_EFFECTS__
1935
- function Pr(e, t) {
1936
- return new e({
1937
- type: "string",
1938
- format: "datetime",
1939
- check: "string_format",
1940
- offset: !1,
1941
- local: !1,
1942
- precision: null,
1943
- ..._(t)
1944
- });
1945
- }
1946
- // @__NO_SIDE_EFFECTS__
1947
- function Ar(e, t) {
1948
- return new e({
1949
- type: "string",
1950
- format: "date",
1951
- check: "string_format",
1952
- ..._(t)
1953
- });
1954
- }
1955
- // @__NO_SIDE_EFFECTS__
1956
- function Nr(e, t) {
1957
- return new e({
1958
- type: "string",
1959
- format: "time",
1960
- check: "string_format",
1961
- precision: null,
1962
- ..._(t)
1963
- });
1964
- }
1965
- // @__NO_SIDE_EFFECTS__
1966
- function Cr(e, t) {
1967
- return new e({
1968
- type: "string",
1969
- format: "duration",
1970
- check: "string_format",
1971
- ..._(t)
1972
- });
1973
- }
1974
- // @__NO_SIDE_EFFECTS__
1975
- function jr(e, t) {
1976
- return new e({
1977
- type: "number",
1978
- checks: [],
1979
- ..._(t)
1980
- });
1981
- }
1982
- // @__NO_SIDE_EFFECTS__
1983
- function xr(e, t) {
1984
- return new e({
1985
- type: "number",
1986
- check: "number_format",
1987
- abort: !1,
1988
- format: "safeint",
1989
- ..._(t)
1990
- });
1991
- }
1992
- // @__NO_SIDE_EFFECTS__
1993
- function Dr(e, t) {
1994
- return new e({
1995
- type: "boolean",
1996
- ..._(t)
1997
- });
1998
- }
1999
- // @__NO_SIDE_EFFECTS__
2000
- function Rr(e) {
2001
- return new e({
2002
- type: "unknown"
2003
- });
2004
- }
2005
- // @__NO_SIDE_EFFECTS__
2006
- function Fr(e, t) {
2007
- return new e({
2008
- type: "never",
2009
- ..._(t)
2010
- });
2011
- }
2012
- // @__NO_SIDE_EFFECTS__
2013
- function We(e, t) {
2014
- return new mt({
2015
- check: "less_than",
2016
- ..._(t),
2017
- value: e,
2018
- inclusive: !1
2019
- });
2020
- }
2021
- // @__NO_SIDE_EFFECTS__
2022
- function me(e, t) {
2023
- return new mt({
2024
- check: "less_than",
2025
- ..._(t),
2026
- value: e,
2027
- inclusive: !0
2028
- });
2029
- }
2030
- // @__NO_SIDE_EFFECTS__
2031
- function Ge(e, t) {
2032
- return new gt({
2033
- check: "greater_than",
2034
- ..._(t),
2035
- value: e,
2036
- inclusive: !1
2037
- });
2038
- }
2039
- // @__NO_SIDE_EFFECTS__
2040
- function ge(e, t) {
2041
- return new gt({
2042
- check: "greater_than",
2043
- ..._(t),
2044
- value: e,
2045
- inclusive: !0
2046
- });
2047
- }
2048
- // @__NO_SIDE_EFFECTS__
2049
- function Ke(e, t) {
2050
- return new Qn({
2051
- check: "multiple_of",
2052
- ..._(t),
2053
- value: e
2054
- });
2055
- }
2056
- // @__NO_SIDE_EFFECTS__
2057
- function kt(e, t) {
2058
- return new to({
2059
- check: "max_length",
2060
- ..._(t),
2061
- maximum: e
2062
- });
2063
- }
2064
- // @__NO_SIDE_EFFECTS__
2065
- function ue(e, t) {
2066
- return new no({
2067
- check: "min_length",
2068
- ..._(t),
2069
- minimum: e
2070
- });
2071
- }
2072
- // @__NO_SIDE_EFFECTS__
2073
- function $t(e, t) {
2074
- return new oo({
2075
- check: "length_equals",
2076
- ..._(t),
2077
- length: e
2078
- });
2079
- }
2080
- // @__NO_SIDE_EFFECTS__
2081
- function Ur(e, t) {
2082
- return new ro({
2083
- check: "string_format",
2084
- format: "regex",
2085
- ..._(t),
2086
- pattern: e
2087
- });
2088
- }
2089
- // @__NO_SIDE_EFFECTS__
2090
- function Jr(e) {
2091
- return new io({
2092
- check: "string_format",
2093
- format: "lowercase",
2094
- ..._(e)
2095
- });
2096
- }
2097
- // @__NO_SIDE_EFFECTS__
2098
- function Mr(e) {
2099
- return new so({
2100
- check: "string_format",
2101
- format: "uppercase",
2102
- ..._(e)
2103
- });
2104
- }
2105
- // @__NO_SIDE_EFFECTS__
2106
- function Lr(e, t) {
2107
- return new co({
2108
- check: "string_format",
2109
- format: "includes",
2110
- ..._(t),
2111
- includes: e
2112
- });
2113
- }
2114
- // @__NO_SIDE_EFFECTS__
2115
- function Vr(e, t) {
2116
- return new ao({
2117
- check: "string_format",
2118
- format: "starts_with",
2119
- ..._(t),
2120
- prefix: e
2121
- });
2122
- }
2123
- // @__NO_SIDE_EFFECTS__
2124
- function Br(e, t) {
2125
- return new uo({
2126
- check: "string_format",
2127
- format: "ends_with",
2128
- ..._(t),
2129
- suffix: e
2130
- });
2131
- }
2132
- // @__NO_SIDE_EFFECTS__
2133
- function X(e) {
2134
- return new lo({
2135
- check: "overwrite",
2136
- tx: e
2137
- });
2138
- }
2139
- // @__NO_SIDE_EFFECTS__
2140
- function Wr(e) {
2141
- return /* @__PURE__ */ X((t) => t.normalize(e));
2142
- }
2143
- // @__NO_SIDE_EFFECTS__
2144
- function Gr() {
2145
- return /* @__PURE__ */ X((e) => e.trim());
2146
- }
2147
- // @__NO_SIDE_EFFECTS__
2148
- function Kr() {
2149
- return /* @__PURE__ */ X((e) => e.toLowerCase());
2150
- }
2151
- // @__NO_SIDE_EFFECTS__
2152
- function Yr() {
2153
- return /* @__PURE__ */ X((e) => e.toUpperCase());
2154
- }
2155
- // @__NO_SIDE_EFFECTS__
2156
- function qr() {
2157
- return /* @__PURE__ */ X((e) => en(e));
2158
- }
2159
- // @__NO_SIDE_EFFECTS__
2160
- function Xr(e, t, n) {
2161
- return new e({
2162
- type: "array",
2163
- element: t,
2164
- // get element() {
2165
- // return element;
2166
- // },
2167
- ..._(n)
2168
- });
2169
- }
2170
- // @__NO_SIDE_EFFECTS__
2171
- function Hr(e, t, n) {
2172
- return new e({
2173
- type: "custom",
2174
- check: "custom",
2175
- fn: t,
2176
- ..._(n)
2177
- });
2178
- }
2179
- // @__NO_SIDE_EFFECTS__
2180
- function Qr(e, t) {
2181
- const n = /* @__PURE__ */ ei((o) => (o.addIssue = (r) => {
2182
- if (typeof r == "string")
2183
- o.issues.push(ne(r, o.value, n._zod.def));
2184
- else {
2185
- const i = r;
2186
- i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = o.value), i.inst ?? (i.inst = n), i.continue ?? (i.continue = !n._zod.def.abort), o.issues.push(ne(i));
2187
- }
2188
- }, e(o.value, o)), t);
2189
- return n;
2190
- }
2191
- // @__NO_SIDE_EFFECTS__
2192
- function ei(e, t) {
2193
- const n = new R({
2194
- check: "custom",
2195
- ..._(t)
2196
- });
2197
- return n._zod.check = e, n;
2198
- }
2199
- function St(e) {
2200
- let t = (e == null ? void 0 : e.target) ?? "draft-2020-12";
2201
- return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
2202
- processors: e.processors ?? {},
2203
- metadataRegistry: (e == null ? void 0 : e.metadata) ?? Q,
2204
- target: t,
2205
- unrepresentable: (e == null ? void 0 : e.unrepresentable) ?? "throw",
2206
- override: (e == null ? void 0 : e.override) ?? (() => {
2207
- }),
2208
- io: (e == null ? void 0 : e.io) ?? "output",
2209
- counter: 0,
2210
- seen: /* @__PURE__ */ new Map(),
2211
- cycles: (e == null ? void 0 : e.cycles) ?? "ref",
2212
- reused: (e == null ? void 0 : e.reused) ?? "inline",
2213
- external: (e == null ? void 0 : e.external) ?? void 0
2214
- };
2215
- }
2216
- function I(e, t, n = { path: [], schemaPath: [] }) {
2217
- var l, d;
2218
- var o;
2219
- const r = e._zod.def, i = t.seen.get(e);
2220
- if (i)
2221
- return i.count++, n.schemaPath.includes(e) && (i.cycle = n.path), i.schema;
2222
- const s = { schema: {}, count: 1, cycle: void 0, path: n.path };
2223
- t.seen.set(e, s);
2224
- const c = (d = (l = e._zod).toJSONSchema) == null ? void 0 : d.call(l);
2225
- if (c)
2226
- s.schema = c;
2227
- else {
2228
- const g = {
2229
- ...n,
2230
- schemaPath: [...n.schemaPath, e],
2231
- path: n.path
2232
- };
2233
- if (e._zod.processJSONSchema)
2234
- e._zod.processJSONSchema(t, s.schema, g);
2235
- else {
2236
- const w = s.schema, E = t.processors[r.type];
2237
- if (!E)
2238
- throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);
2239
- E(e, t, w, g);
2240
- }
2241
- const h = e._zod.parent;
2242
- h && (s.ref || (s.ref = h), I(h, t, g), t.seen.get(h).isParent = !0);
2243
- }
2244
- const a = t.metadataRegistry.get(e);
2245
- return a && Object.assign(s.schema, a), t.io === "input" && N(e) && (delete s.schema.examples, delete s.schema.default), t.io === "input" && "_prefault" in s.schema && ((o = s.schema).default ?? (o.default = s.schema._prefault)), delete s.schema._prefault, t.seen.get(e).schema;
2246
- }
2247
- function Zt(e, t) {
2248
- var s, c, a, f;
2249
- const n = e.seen.get(t);
2250
- if (!n)
2251
- throw new Error("Unprocessed schema. This is a bug in Zod.");
2252
- const o = /* @__PURE__ */ new Map();
2253
- for (const l of e.seen.entries()) {
2254
- const d = (s = e.metadataRegistry.get(l[0])) == null ? void 0 : s.id;
2255
- if (d) {
2256
- const g = o.get(d);
2257
- if (g && g !== l[0])
2258
- throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2259
- o.set(d, l[0]);
2260
- }
2261
- }
2262
- const r = (l) => {
2263
- var E;
2264
- const d = e.target === "draft-2020-12" ? "$defs" : "definitions";
2265
- if (e.external) {
2266
- const j = (E = e.external.registry.get(l[0])) == null ? void 0 : E.id, T = e.external.uri ?? ((H) => H);
2267
- if (j)
2268
- return { ref: T(j) };
2269
- const P = l[1].defId ?? l[1].schema.id ?? `schema${e.counter++}`;
2270
- return l[1].defId = P, { defId: P, ref: `${T("__shared")}#/${d}/${P}` };
2271
- }
2272
- if (l[1] === n)
2273
- return { ref: "#" };
2274
- const h = `#/${d}/`, w = l[1].schema.id ?? `__schema${e.counter++}`;
2275
- return { defId: w, ref: h + w };
2276
- }, i = (l) => {
2277
- if (l[1].schema.$ref)
2278
- return;
2279
- const d = l[1], { ref: g, defId: h } = r(l);
2280
- d.def = { ...d.schema }, h && (d.defId = h);
2281
- const w = d.schema;
2282
- for (const E in w)
2283
- delete w[E];
2284
- w.$ref = g;
2285
- };
2286
- if (e.cycles === "throw")
2287
- for (const l of e.seen.entries()) {
2288
- const d = l[1];
2289
- if (d.cycle)
2290
- throw new Error(`Cycle detected: #/${(c = d.cycle) == null ? void 0 : c.join("/")}/<root>
2291
-
2292
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2293
- }
2294
- for (const l of e.seen.entries()) {
2295
- const d = l[1];
2296
- if (t === l[0]) {
2297
- i(l);
2298
- continue;
2299
- }
2300
- if (e.external) {
2301
- const h = (a = e.external.registry.get(l[0])) == null ? void 0 : a.id;
2302
- if (t !== l[0] && h) {
2303
- i(l);
2304
- continue;
2305
- }
2306
- }
2307
- if ((f = e.metadataRegistry.get(l[0])) == null ? void 0 : f.id) {
2308
- i(l);
2309
- continue;
2310
- }
2311
- if (d.cycle) {
2312
- i(l);
2313
- continue;
2314
- }
2315
- if (d.count > 1 && e.reused === "ref") {
2316
- i(l);
2317
- continue;
2318
- }
2319
- }
2320
- }
2321
- function Ot(e, t) {
2322
- var c, a, f, l;
2323
- const n = e.seen.get(t);
2324
- if (!n)
2325
- throw new Error("Unprocessed schema. This is a bug in Zod.");
2326
- const o = (d) => {
2327
- const g = e.seen.get(d);
2328
- if (g.ref === null)
2329
- return;
2330
- const h = g.def ?? g.schema, w = { ...h }, E = g.ref;
2331
- if (g.ref = null, E) {
2332
- o(E);
2333
- const T = e.seen.get(E), P = T.schema;
2334
- if (P.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (h.allOf = h.allOf ?? [], h.allOf.push(P)) : Object.assign(h, P), Object.assign(h, w), d._zod.parent === E)
2335
- for (const x in h)
2336
- x === "$ref" || x === "allOf" || x in w || delete h[x];
2337
- if (P.$ref && T.def)
2338
- for (const x in h)
2339
- x === "$ref" || x === "allOf" || x in T.def && JSON.stringify(h[x]) === JSON.stringify(T.def[x]) && delete h[x];
2340
- }
2341
- const j = d._zod.parent;
2342
- if (j && j !== E) {
2343
- o(j);
2344
- const T = e.seen.get(j);
2345
- if (T != null && T.schema.$ref && (h.$ref = T.schema.$ref, T.def))
2346
- for (const P in h)
2347
- P === "$ref" || P === "allOf" || P in T.def && JSON.stringify(h[P]) === JSON.stringify(T.def[P]) && delete h[P];
2348
- }
2349
- e.override({
2350
- zodSchema: d,
2351
- jsonSchema: h,
2352
- path: g.path ?? []
2353
- });
2354
- };
2355
- for (const d of [...e.seen.entries()].reverse())
2356
- o(d[0]);
2357
- const r = {};
2358
- if (e.target === "draft-2020-12" ? r.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? r.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? r.$schema = "http://json-schema.org/draft-04/schema#" : e.target, (c = e.external) != null && c.uri) {
2359
- const d = (a = e.external.registry.get(t)) == null ? void 0 : a.id;
2360
- if (!d)
2361
- throw new Error("Schema is missing an `id` property");
2362
- r.$id = e.external.uri(d);
2363
- }
2364
- Object.assign(r, n.def ?? n.schema);
2365
- const i = (f = e.metadataRegistry.get(t)) == null ? void 0 : f.id;
2366
- i !== void 0 && r.id === i && delete r.id;
2367
- const s = ((l = e.external) == null ? void 0 : l.defs) ?? {};
2368
- for (const d of e.seen.entries()) {
2369
- const g = d[1];
2370
- g.def && g.defId && (g.def.id === g.defId && delete g.def.id, s[g.defId] = g.def);
2371
- }
2372
- e.external || Object.keys(s).length > 0 && (e.target === "draft-2020-12" ? r.$defs = s : r.definitions = s);
2373
- try {
2374
- const d = JSON.parse(JSON.stringify(r));
2375
- return Object.defineProperty(d, "~standard", {
2376
- value: {
2377
- ...t["~standard"],
2378
- jsonSchema: {
2379
- input: le(t, "input", e.processors),
2380
- output: le(t, "output", e.processors)
2381
- }
2382
- },
2383
- enumerable: !1,
2384
- writable: !1
2385
- }), d;
2386
- } catch {
2387
- throw new Error("Error converting schema to JSON.");
2388
- }
2389
- }
2390
- function N(e, t) {
2391
- const n = t ?? { seen: /* @__PURE__ */ new Set() };
2392
- if (n.seen.has(e))
2393
- return !1;
2394
- n.seen.add(e);
2395
- const o = e._zod.def;
2396
- if (o.type === "transform")
2397
- return !0;
2398
- if (o.type === "array")
2399
- return N(o.element, n);
2400
- if (o.type === "set")
2401
- return N(o.valueType, n);
2402
- if (o.type === "lazy")
2403
- return N(o.getter(), n);
2404
- if (o.type === "promise" || o.type === "optional" || o.type === "nonoptional" || o.type === "nullable" || o.type === "readonly" || o.type === "default" || o.type === "prefault")
2405
- return N(o.innerType, n);
2406
- if (o.type === "intersection")
2407
- return N(o.left, n) || N(o.right, n);
2408
- if (o.type === "record" || o.type === "map")
2409
- return N(o.keyType, n) || N(o.valueType, n);
2410
- if (o.type === "pipe")
2411
- return e._zod.traits.has("$ZodCodec") ? !0 : N(o.in, n) || N(o.out, n);
2412
- if (o.type === "object") {
2413
- for (const r in o.shape)
2414
- if (N(o.shape[r], n))
2415
- return !0;
2416
- return !1;
2417
- }
2418
- if (o.type === "union") {
2419
- for (const r of o.options)
2420
- if (N(r, n))
2421
- return !0;
2422
- return !1;
2423
- }
2424
- if (o.type === "tuple") {
2425
- for (const r of o.items)
2426
- if (N(r, n))
2427
- return !0;
2428
- return !!(o.rest && N(o.rest, n));
2429
- }
2430
- return !1;
2431
- }
2432
- const ti = (e, t = {}) => (n) => {
2433
- const o = St({ ...n, processors: t });
2434
- return I(e, o), Zt(o, e), Ot(o, e);
2435
- }, le = (e, t, n = {}) => (o) => {
2436
- const { libraryOptions: r, target: i } = o ?? {}, s = St({ ...r ?? {}, target: i, io: t, processors: n });
2437
- return I(e, s), Zt(s, e), Ot(s, e);
2438
- }, ni = {
2439
- guid: "uuid",
2440
- url: "uri",
2441
- datetime: "date-time",
2442
- json_string: "json-string",
2443
- regex: ""
2444
- // do not set
2445
- }, oi = (e, t, n, o) => {
2446
- const r = n;
2447
- r.type = "string";
2448
- const { minimum: i, maximum: s, format: c, patterns: a, contentEncoding: f } = e._zod.bag;
2449
- if (typeof i == "number" && (r.minLength = i), typeof s == "number" && (r.maxLength = s), c && (r.format = ni[c] ?? c, r.format === "" && delete r.format, c === "time" && delete r.format), f && (r.contentEncoding = f), a && a.size > 0) {
2450
- const l = [...a];
2451
- l.length === 1 ? r.pattern = l[0].source : l.length > 1 && (r.allOf = [
2452
- ...l.map((d) => ({
2453
- ...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
2454
- pattern: d.source
2455
- }))
2456
- ]);
2457
- }
2458
- }, ri = (e, t, n, o) => {
2459
- const r = n, { minimum: i, maximum: s, format: c, multipleOf: a, exclusiveMaximum: f, exclusiveMinimum: l } = e._zod.bag;
2460
- typeof c == "string" && c.includes("int") ? r.type = "integer" : r.type = "number";
2461
- const d = typeof l == "number" && l >= (i ?? Number.NEGATIVE_INFINITY), g = typeof f == "number" && f <= (s ?? Number.POSITIVE_INFINITY), h = t.target === "draft-04" || t.target === "openapi-3.0";
2462
- d ? h ? (r.minimum = l, r.exclusiveMinimum = !0) : r.exclusiveMinimum = l : typeof i == "number" && (r.minimum = i), g ? h ? (r.maximum = f, r.exclusiveMaximum = !0) : r.exclusiveMaximum = f : typeof s == "number" && (r.maximum = s), typeof a == "number" && (r.multipleOf = a);
2463
- }, ii = (e, t, n, o) => {
2464
- n.type = "boolean";
2465
- }, si = (e, t, n, o) => {
2466
- n.not = {};
2467
- }, ci = (e, t, n, o) => {
2468
- }, ai = (e, t, n, o) => {
2469
- const r = e._zod.def, i = rt(r.entries);
2470
- i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), n.enum = i;
2471
- }, ui = (e, t, n, o) => {
2472
- const r = e._zod.def, i = [];
2473
- for (const s of r.values)
2474
- if (s === void 0) {
2475
- if (t.unrepresentable === "throw")
2476
- throw new Error("Literal `undefined` cannot be represented in JSON Schema");
2477
- } else if (typeof s == "bigint") {
2478
- if (t.unrepresentable === "throw")
2479
- throw new Error("BigInt literals cannot be represented in JSON Schema");
2480
- i.push(Number(s));
2481
- } else
2482
- i.push(s);
2483
- if (i.length !== 0) if (i.length === 1) {
2484
- const s = i[0];
2485
- n.type = s === null ? "null" : typeof s, t.target === "draft-04" || t.target === "openapi-3.0" ? n.enum = [s] : n.const = s;
2486
- } else
2487
- i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), i.every((s) => typeof s == "boolean") && (n.type = "boolean"), i.every((s) => s === null) && (n.type = "null"), n.enum = i;
2488
- }, li = (e, t, n, o) => {
2489
- if (t.unrepresentable === "throw")
2490
- throw new Error("Custom types cannot be represented in JSON Schema");
2491
- }, fi = (e, t, n, o) => {
2492
- if (t.unrepresentable === "throw")
2493
- throw new Error("Transforms cannot be represented in JSON Schema");
2494
- }, pi = (e, t, n, o) => {
2495
- const r = n, i = e._zod.def, { minimum: s, maximum: c } = e._zod.bag;
2496
- typeof s == "number" && (r.minItems = s), typeof c == "number" && (r.maxItems = c), r.type = "array", r.items = I(i.element, t, {
2497
- ...o,
2498
- path: [...o.path, "items"]
2499
- });
2500
- }, di = (e, t, n, o) => {
2501
- var f;
2502
- const r = n, i = e._zod.def;
2503
- r.type = "object", r.properties = {};
2504
- const s = i.shape;
2505
- for (const l in s)
2506
- r.properties[l] = I(s[l], t, {
2507
- ...o,
2508
- path: [...o.path, "properties", l]
2509
- });
2510
- const c = new Set(Object.keys(s)), a = new Set([...c].filter((l) => {
2511
- const d = i.shape[l]._zod;
2512
- return t.io === "input" ? d.optin === void 0 : d.optout === void 0;
2513
- }));
2514
- a.size > 0 && (r.required = Array.from(a)), ((f = i.catchall) == null ? void 0 : f._zod.def.type) === "never" ? r.additionalProperties = !1 : i.catchall ? i.catchall && (r.additionalProperties = I(i.catchall, t, {
2515
- ...o,
2516
- path: [...o.path, "additionalProperties"]
2517
- })) : t.io === "output" && (r.additionalProperties = !1);
2518
- }, hi = (e, t, n, o) => {
2519
- const r = e._zod.def, i = r.inclusive === !1, s = r.options.map((c, a) => I(c, t, {
2520
- ...o,
2521
- path: [...o.path, i ? "oneOf" : "anyOf", a]
2522
- }));
2523
- i ? n.oneOf = s : n.anyOf = s;
2524
- }, mi = (e, t, n, o) => {
2525
- const r = e._zod.def, i = I(r.left, t, {
2526
- ...o,
2527
- path: [...o.path, "allOf", 0]
2528
- }), s = I(r.right, t, {
2529
- ...o,
2530
- path: [...o.path, "allOf", 1]
2531
- }), c = (f) => "allOf" in f && Object.keys(f).length === 1, a = [
2532
- ...c(i) ? i.allOf : [i],
2533
- ...c(s) ? s.allOf : [s]
2534
- ];
2535
- n.allOf = a;
2536
- }, gi = (e, t, n, o) => {
2537
- const r = e._zod.def, i = I(r.innerType, t, o), s = t.seen.get(e);
2538
- t.target === "openapi-3.0" ? (s.ref = r.innerType, n.nullable = !0) : n.anyOf = [i, { type: "null" }];
2539
- }, _i = (e, t, n, o) => {
2540
- const r = e._zod.def;
2541
- I(r.innerType, t, o);
2542
- const i = t.seen.get(e);
2543
- i.ref = r.innerType;
2544
- }, vi = (e, t, n, o) => {
2545
- const r = e._zod.def;
2546
- I(r.innerType, t, o);
2547
- const i = t.seen.get(e);
2548
- i.ref = r.innerType, n.default = JSON.parse(JSON.stringify(r.defaultValue));
2549
- }, yi = (e, t, n, o) => {
2550
- const r = e._zod.def;
2551
- I(r.innerType, t, o);
2552
- const i = t.seen.get(e);
2553
- i.ref = r.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(r.defaultValue)));
2554
- }, bi = (e, t, n, o) => {
2555
- const r = e._zod.def;
2556
- I(r.innerType, t, o);
2557
- const i = t.seen.get(e);
2558
- i.ref = r.innerType;
2559
- let s;
2560
- try {
2561
- s = r.catchValue(void 0);
2562
- } catch {
2563
- throw new Error("Dynamic catch values are not supported in JSON Schema");
2564
- }
2565
- n.default = s;
2566
- }, zi = (e, t, n, o) => {
2567
- const r = e._zod.def, i = r.in._zod.traits.has("$ZodTransform"), s = t.io === "input" ? i ? r.out : r.in : r.out;
2568
- I(s, t, o);
2569
- const c = t.seen.get(e);
2570
- c.ref = s;
2571
- }, wi = (e, t, n, o) => {
2572
- const r = e._zod.def;
2573
- I(r.innerType, t, o);
2574
- const i = t.seen.get(e);
2575
- i.ref = r.innerType, n.readOnly = !0;
2576
- }, Et = (e, t, n, o) => {
2577
- const r = e._zod.def;
2578
- I(r.innerType, t, o);
2579
- const i = t.seen.get(e);
2580
- i.ref = r.innerType;
2581
- }, ki = (e, t, n, o) => {
2582
- const r = e._zod.innerType;
2583
- I(r, t, o);
2584
- const i = t.seen.get(e);
2585
- i.ref = r;
2586
- }, $i = /* @__PURE__ */ u("ZodISODateTime", (e, t) => {
2587
- So.init(e, t), Z.init(e, t);
2588
- });
2589
- function Si(e) {
2590
- return /* @__PURE__ */ Pr($i, e);
2591
- }
2592
- const Zi = /* @__PURE__ */ u("ZodISODate", (e, t) => {
2593
- Zo.init(e, t), Z.init(e, t);
2594
- });
2595
- function Oi(e) {
2596
- return /* @__PURE__ */ Ar(Zi, e);
2597
- }
2598
- const Ei = /* @__PURE__ */ u("ZodISOTime", (e, t) => {
2599
- Oo.init(e, t), Z.init(e, t);
2600
- });
2601
- function Ti(e) {
2602
- return /* @__PURE__ */ Nr(Ei, e);
2603
- }
2604
- const Ii = /* @__PURE__ */ u("ZodISODuration", (e, t) => {
2605
- Eo.init(e, t), Z.init(e, t);
2606
- });
2607
- function Pi(e) {
2608
- return /* @__PURE__ */ Cr(Ii, e);
2609
- }
2610
- const Ai = (e, t) => {
2611
- ut.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
2612
- format: {
2613
- value: (n) => mn(e, n)
2614
- // enumerable: false,
2615
- },
2616
- flatten: {
2617
- value: (n) => hn(e, n)
2618
- // enumerable: false,
2619
- },
2620
- addIssue: {
2621
- value: (n) => {
2622
- e.issues.push(n), e.message = JSON.stringify(e.issues, _e, 2);
2623
- }
2624
- // enumerable: false,
2625
- },
2626
- addIssues: {
2627
- value: (n) => {
2628
- e.issues.push(...n), e.message = JSON.stringify(e.issues, _e, 2);
2629
- }
2630
- // enumerable: false,
2631
- },
2632
- isEmpty: {
2633
- get() {
2634
- return e.issues.length === 0;
2635
- }
2636
- // enumerable: false,
2637
- }
2638
- });
2639
- }, F = /* @__PURE__ */ u("ZodError", Ai, {
2640
- Parent: Error
2641
- }), Ni = /* @__PURE__ */ Ze(F), Ci = /* @__PURE__ */ Oe(F), ji = /* @__PURE__ */ pe(F), xi = /* @__PURE__ */ de(F), Di = /* @__PURE__ */ vn(F), Ri = /* @__PURE__ */ yn(F), Fi = /* @__PURE__ */ bn(F), Ui = /* @__PURE__ */ zn(F), Ji = /* @__PURE__ */ wn(F), Mi = /* @__PURE__ */ kn(F), Li = /* @__PURE__ */ $n(F), Vi = /* @__PURE__ */ Sn(F), Ye = /* @__PURE__ */ new WeakMap();
2642
- function oe(e, t, n) {
2643
- const o = Object.getPrototypeOf(e);
2644
- let r = Ye.get(o);
2645
- if (r || (r = /* @__PURE__ */ new Set(), Ye.set(o, r)), !r.has(t)) {
2646
- r.add(t);
2647
- for (const i in n) {
2648
- const s = n[i];
2649
- Object.defineProperty(o, i, {
2650
- configurable: !0,
2651
- enumerable: !1,
2652
- get() {
2653
- const c = s.bind(this);
2654
- return Object.defineProperty(this, i, {
2655
- configurable: !0,
2656
- writable: !0,
2657
- enumerable: !0,
2658
- value: c
2659
- }), c;
2660
- },
2661
- set(c) {
2662
- Object.defineProperty(this, i, {
2663
- configurable: !0,
2664
- writable: !0,
2665
- enumerable: !0,
2666
- value: c
2667
- });
2668
- }
2669
- });
2670
- }
2671
- }
2672
- }
2673
- const S = /* @__PURE__ */ u("ZodType", (e, t) => ($.init(e, t), Object.assign(e["~standard"], {
2674
- jsonSchema: {
2675
- input: le(e, "input"),
2676
- output: le(e, "output")
2677
- }
2678
- }), e.toJSONSchema = ti(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.parse = (n, o) => Ni(e, n, o, { callee: e.parse }), e.safeParse = (n, o) => ji(e, n, o), e.parseAsync = async (n, o) => Ci(e, n, o, { callee: e.parseAsync }), e.safeParseAsync = async (n, o) => xi(e, n, o), e.spa = e.safeParseAsync, e.encode = (n, o) => Di(e, n, o), e.decode = (n, o) => Ri(e, n, o), e.encodeAsync = async (n, o) => Fi(e, n, o), e.decodeAsync = async (n, o) => Ui(e, n, o), e.safeEncode = (n, o) => Ji(e, n, o), e.safeDecode = (n, o) => Mi(e, n, o), e.safeEncodeAsync = async (n, o) => Li(e, n, o), e.safeDecodeAsync = async (n, o) => Vi(e, n, o), oe(e, "ZodType", {
2679
- check(...n) {
2680
- const o = this.def;
2681
- return this.clone(J(o, {
2682
- checks: [
2683
- ...o.checks ?? [],
2684
- ...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
2685
- ]
2686
- }), { parent: !0 });
2687
- },
2688
- with(...n) {
2689
- return this.check(...n);
2690
- },
2691
- clone(n, o) {
2692
- return M(this, n, o);
2693
- },
2694
- brand() {
2695
- return this;
2696
- },
2697
- register(n, o) {
2698
- return n.add(this, o), this;
2699
- },
2700
- refine(n, o) {
2701
- return this.check(Ds(n, o));
2702
- },
2703
- superRefine(n, o) {
2704
- return this.check(Rs(n, o));
2705
- },
2706
- overwrite(n) {
2707
- return this.check(/* @__PURE__ */ X(n));
2708
- },
2709
- optional() {
2710
- return Qe(this);
2711
- },
2712
- exactOptional() {
2713
- return ks(this);
2714
- },
2715
- nullable() {
2716
- return et(this);
2717
- },
2718
- nullish() {
2719
- return Qe(et(this));
2720
- },
2721
- nonoptional(n) {
2722
- return Ts(this, n);
2723
- },
2724
- array() {
2725
- return C(this);
2726
- },
2727
- or(n) {
2728
- return At([this, n]);
2729
- },
2730
- and(n) {
2731
- return vs(this, n);
2732
- },
2733
- transform(n) {
2734
- return tt(this, zs(n));
2735
- },
2736
- default(n) {
2737
- return Zs(this, n);
2738
- },
2739
- prefault(n) {
2740
- return Es(this, n);
2741
- },
2742
- catch(n) {
2743
- return Ps(this, n);
2744
- },
2745
- pipe(n) {
2746
- return tt(this, n);
2747
- },
2748
- readonly() {
2749
- return Cs(this);
2750
- },
2751
- describe(n) {
2752
- const o = this.clone();
2753
- return Q.add(o, { description: n }), o;
2754
- },
2755
- meta(...n) {
2756
- if (n.length === 0)
2757
- return Q.get(this);
2758
- const o = this.clone();
2759
- return Q.add(o, n[0]), o;
2760
- },
2761
- isOptional() {
2762
- return this.safeParse(void 0).success;
2763
- },
2764
- isNullable() {
2765
- return this.safeParse(null).success;
2766
- },
2767
- apply(n) {
2768
- return n(this);
2769
- }
2770
- }), Object.defineProperty(e, "description", {
2771
- get() {
2772
- var n;
2773
- return (n = Q.get(e)) == null ? void 0 : n.description;
2774
- },
2775
- configurable: !0
2776
- }), e)), Tt = /* @__PURE__ */ u("_ZodString", (e, t) => {
2777
- Ee.init(e, t), S.init(e, t), e._zod.processJSONSchema = (o, r, i) => oi(e, o, r);
2778
- const n = e._zod.bag;
2779
- e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, oe(e, "_ZodString", {
2780
- regex(...o) {
2781
- return this.check(/* @__PURE__ */ Ur(...o));
2782
- },
2783
- includes(...o) {
2784
- return this.check(/* @__PURE__ */ Lr(...o));
2785
- },
2786
- startsWith(...o) {
2787
- return this.check(/* @__PURE__ */ Vr(...o));
2788
- },
2789
- endsWith(...o) {
2790
- return this.check(/* @__PURE__ */ Br(...o));
2791
- },
2792
- min(...o) {
2793
- return this.check(/* @__PURE__ */ ue(...o));
2794
- },
2795
- max(...o) {
2796
- return this.check(/* @__PURE__ */ kt(...o));
2797
- },
2798
- length(...o) {
2799
- return this.check(/* @__PURE__ */ $t(...o));
2800
- },
2801
- nonempty(...o) {
2802
- return this.check(/* @__PURE__ */ ue(1, ...o));
2803
- },
2804
- lowercase(o) {
2805
- return this.check(/* @__PURE__ */ Jr(o));
2806
- },
2807
- uppercase(o) {
2808
- return this.check(/* @__PURE__ */ Mr(o));
2809
- },
2810
- trim() {
2811
- return this.check(/* @__PURE__ */ Gr());
2812
- },
2813
- normalize(...o) {
2814
- return this.check(/* @__PURE__ */ Wr(...o));
2815
- },
2816
- toLowerCase() {
2817
- return this.check(/* @__PURE__ */ Kr());
2818
- },
2819
- toUpperCase() {
2820
- return this.check(/* @__PURE__ */ Yr());
2821
- },
2822
- slugify() {
2823
- return this.check(/* @__PURE__ */ qr());
2824
- }
2825
- });
2826
- }), Bi = /* @__PURE__ */ u("ZodString", (e, t) => {
2827
- Ee.init(e, t), Tt.init(e, t), e.email = (n) => e.check(/* @__PURE__ */ lr(Wi, n)), e.url = (n) => e.check(/* @__PURE__ */ mr(Gi, n)), e.jwt = (n) => e.check(/* @__PURE__ */ Ir(as, n)), e.emoji = (n) => e.check(/* @__PURE__ */ gr(Ki, n)), e.guid = (n) => e.check(/* @__PURE__ */ Be(qe, n)), e.uuid = (n) => e.check(/* @__PURE__ */ fr(ce, n)), e.uuidv4 = (n) => e.check(/* @__PURE__ */ pr(ce, n)), e.uuidv6 = (n) => e.check(/* @__PURE__ */ dr(ce, n)), e.uuidv7 = (n) => e.check(/* @__PURE__ */ hr(ce, n)), e.nanoid = (n) => e.check(/* @__PURE__ */ _r(Yi, n)), e.guid = (n) => e.check(/* @__PURE__ */ Be(qe, n)), e.cuid = (n) => e.check(/* @__PURE__ */ vr(qi, n)), e.cuid2 = (n) => e.check(/* @__PURE__ */ yr(Xi, n)), e.ulid = (n) => e.check(/* @__PURE__ */ br(Hi, n)), e.base64 = (n) => e.check(/* @__PURE__ */ Or(is, n)), e.base64url = (n) => e.check(/* @__PURE__ */ Er(ss, n)), e.xid = (n) => e.check(/* @__PURE__ */ zr(Qi, n)), e.ksuid = (n) => e.check(/* @__PURE__ */ wr(es, n)), e.ipv4 = (n) => e.check(/* @__PURE__ */ kr(ts, n)), e.ipv6 = (n) => e.check(/* @__PURE__ */ $r(ns, n)), e.cidrv4 = (n) => e.check(/* @__PURE__ */ Sr(os, n)), e.cidrv6 = (n) => e.check(/* @__PURE__ */ Zr(rs, n)), e.e164 = (n) => e.check(/* @__PURE__ */ Tr(cs, n)), e.datetime = (n) => e.check(Si(n)), e.date = (n) => e.check(Oi(n)), e.time = (n) => e.check(Ti(n)), e.duration = (n) => e.check(Pi(n));
2828
- });
2829
- function b(e) {
2830
- return /* @__PURE__ */ ur(Bi, e);
2831
- }
2832
- const Z = /* @__PURE__ */ u("ZodStringFormat", (e, t) => {
2833
- k.init(e, t), Tt.init(e, t);
2834
- }), Wi = /* @__PURE__ */ u("ZodEmail", (e, t) => {
2835
- go.init(e, t), Z.init(e, t);
2836
- }), qe = /* @__PURE__ */ u("ZodGUID", (e, t) => {
2837
- ho.init(e, t), Z.init(e, t);
2838
- }), ce = /* @__PURE__ */ u("ZodUUID", (e, t) => {
2839
- mo.init(e, t), Z.init(e, t);
2840
- }), Gi = /* @__PURE__ */ u("ZodURL", (e, t) => {
2841
- _o.init(e, t), Z.init(e, t);
2842
- }), Ki = /* @__PURE__ */ u("ZodEmoji", (e, t) => {
2843
- vo.init(e, t), Z.init(e, t);
2844
- }), Yi = /* @__PURE__ */ u("ZodNanoID", (e, t) => {
2845
- yo.init(e, t), Z.init(e, t);
2846
- }), qi = /* @__PURE__ */ u("ZodCUID", (e, t) => {
2847
- bo.init(e, t), Z.init(e, t);
2848
- }), Xi = /* @__PURE__ */ u("ZodCUID2", (e, t) => {
2849
- zo.init(e, t), Z.init(e, t);
2850
- }), Hi = /* @__PURE__ */ u("ZodULID", (e, t) => {
2851
- wo.init(e, t), Z.init(e, t);
2852
- }), Qi = /* @__PURE__ */ u("ZodXID", (e, t) => {
2853
- ko.init(e, t), Z.init(e, t);
2854
- }), es = /* @__PURE__ */ u("ZodKSUID", (e, t) => {
2855
- $o.init(e, t), Z.init(e, t);
2856
- }), ts = /* @__PURE__ */ u("ZodIPv4", (e, t) => {
2857
- To.init(e, t), Z.init(e, t);
2858
- }), ns = /* @__PURE__ */ u("ZodIPv6", (e, t) => {
2859
- Io.init(e, t), Z.init(e, t);
2860
- }), os = /* @__PURE__ */ u("ZodCIDRv4", (e, t) => {
2861
- Po.init(e, t), Z.init(e, t);
2862
- }), rs = /* @__PURE__ */ u("ZodCIDRv6", (e, t) => {
2863
- Ao.init(e, t), Z.init(e, t);
2864
- }), is = /* @__PURE__ */ u("ZodBase64", (e, t) => {
2865
- No.init(e, t), Z.init(e, t);
2866
- }), ss = /* @__PURE__ */ u("ZodBase64URL", (e, t) => {
2867
- jo.init(e, t), Z.init(e, t);
2868
- }), cs = /* @__PURE__ */ u("ZodE164", (e, t) => {
2869
- xo.init(e, t), Z.init(e, t);
2870
- }), as = /* @__PURE__ */ u("ZodJWT", (e, t) => {
2871
- Ro.init(e, t), Z.init(e, t);
2872
- }), It = /* @__PURE__ */ u("ZodNumber", (e, t) => {
2873
- vt.init(e, t), S.init(e, t), e._zod.processJSONSchema = (o, r, i) => ri(e, o, r), oe(e, "ZodNumber", {
2874
- gt(o, r) {
2875
- return this.check(/* @__PURE__ */ Ge(o, r));
2876
- },
2877
- gte(o, r) {
2878
- return this.check(/* @__PURE__ */ ge(o, r));
2879
- },
2880
- min(o, r) {
2881
- return this.check(/* @__PURE__ */ ge(o, r));
2882
- },
2883
- lt(o, r) {
2884
- return this.check(/* @__PURE__ */ We(o, r));
2885
- },
2886
- lte(o, r) {
2887
- return this.check(/* @__PURE__ */ me(o, r));
2888
- },
2889
- max(o, r) {
2890
- return this.check(/* @__PURE__ */ me(o, r));
2891
- },
2892
- int(o) {
2893
- return this.check(Xe(o));
2894
- },
2895
- safe(o) {
2896
- return this.check(Xe(o));
2897
- },
2898
- positive(o) {
2899
- return this.check(/* @__PURE__ */ Ge(0, o));
2900
- },
2901
- nonnegative(o) {
2902
- return this.check(/* @__PURE__ */ ge(0, o));
2903
- },
2904
- negative(o) {
2905
- return this.check(/* @__PURE__ */ We(0, o));
2906
- },
2907
- nonpositive(o) {
2908
- return this.check(/* @__PURE__ */ me(0, o));
2909
- },
2910
- multipleOf(o, r) {
2911
- return this.check(/* @__PURE__ */ Ke(o, r));
2912
- },
2913
- step(o, r) {
2914
- return this.check(/* @__PURE__ */ Ke(o, r));
2915
- },
2916
- finite() {
2917
- return this;
2918
- }
2919
- });
2920
- const n = e._zod.bag;
2921
- e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
2922
- });
2923
- function p(e) {
2924
- return /* @__PURE__ */ jr(It, e);
2925
- }
2926
- const us = /* @__PURE__ */ u("ZodNumberFormat", (e, t) => {
2927
- Fo.init(e, t), It.init(e, t);
2928
- });
2929
- function Xe(e) {
2930
- return /* @__PURE__ */ xr(us, e);
2931
- }
2932
- const ls = /* @__PURE__ */ u("ZodBoolean", (e, t) => {
2933
- Uo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => ii(e, n, o);
2934
- });
2935
- function m(e) {
2936
- return /* @__PURE__ */ Dr(ls, e);
2937
- }
2938
- const fs = /* @__PURE__ */ u("ZodUnknown", (e, t) => {
2939
- Jo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => ci();
2940
- });
2941
- function He() {
2942
- return /* @__PURE__ */ Rr(fs);
2943
- }
2944
- const ps = /* @__PURE__ */ u("ZodNever", (e, t) => {
2945
- Mo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => si(e, n, o);
2946
- });
2947
- function ds(e) {
2948
- return /* @__PURE__ */ Fr(ps, e);
2949
- }
2950
- const hs = /* @__PURE__ */ u("ZodArray", (e, t) => {
2951
- Lo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => pi(e, n, o, r), e.element = t.element, oe(e, "ZodArray", {
2952
- min(n, o) {
2953
- return this.check(/* @__PURE__ */ ue(n, o));
2954
- },
2955
- nonempty(n) {
2956
- return this.check(/* @__PURE__ */ ue(1, n));
2957
- },
2958
- max(n, o) {
2959
- return this.check(/* @__PURE__ */ kt(n, o));
2960
- },
2961
- length(n, o) {
2962
- return this.check(/* @__PURE__ */ $t(n, o));
2963
- },
2964
- unwrap() {
2965
- return this.element;
2966
- }
2967
- });
2968
- });
2969
- function C(e, t) {
2970
- return /* @__PURE__ */ Xr(hs, e, t);
2971
- }
2972
- const ms = /* @__PURE__ */ u("ZodObject", (e, t) => {
2973
- Bo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => di(e, n, o, r), y(e, "shape", () => t.shape), oe(e, "ZodObject", {
2974
- keyof() {
2975
- return D(Object.keys(this._zod.def.shape));
2976
- },
2977
- catchall(n) {
2978
- return this.clone({ ...this._zod.def, catchall: n });
2979
- },
2980
- passthrough() {
2981
- return this.clone({ ...this._zod.def, catchall: He() });
2982
- },
2983
- loose() {
2984
- return this.clone({ ...this._zod.def, catchall: He() });
2985
- },
2986
- strict() {
2987
- return this.clone({ ...this._zod.def, catchall: ds() });
2988
- },
2989
- strip() {
2990
- return this.clone({ ...this._zod.def, catchall: void 0 });
2991
- },
2992
- extend(n) {
2993
- return an(this, n);
2994
- },
2995
- safeExtend(n) {
2996
- return un(this, n);
2997
- },
2998
- merge(n) {
2999
- return ln(this, n);
3000
- },
3001
- pick(n) {
3002
- return sn(this, n);
3003
- },
3004
- omit(n) {
3005
- return cn(this, n);
3006
- },
3007
- partial(...n) {
3008
- return fn(Nt, this, n[0]);
3009
- },
3010
- required(...n) {
3011
- return pn(Ct, this, n[0]);
3012
- }
3013
- });
3014
- });
3015
- function v(e, t) {
3016
- const n = {
3017
- type: "object",
3018
- shape: e ?? {},
3019
- ..._(t)
3020
- };
3021
- return new ms(n);
3022
- }
3023
- const Pt = /* @__PURE__ */ u("ZodUnion", (e, t) => {
3024
- zt.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => hi(e, n, o, r), e.options = t.options;
3025
- });
3026
- function At(e, t) {
3027
- return new Pt({
3028
- type: "union",
3029
- options: e,
3030
- ..._(t)
3031
- });
3032
- }
3033
- const gs = /* @__PURE__ */ u("ZodDiscriminatedUnion", (e, t) => {
3034
- Pt.init(e, t), Wo.init(e, t);
3035
- });
3036
- function Te(e, t, n) {
3037
- return new gs({
3038
- type: "union",
3039
- options: t,
3040
- discriminator: e,
3041
- ..._(n)
3042
- });
3043
- }
3044
- const _s = /* @__PURE__ */ u("ZodIntersection", (e, t) => {
3045
- Go.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => mi(e, n, o, r);
3046
- });
3047
- function vs(e, t) {
3048
- return new _s({
3049
- type: "intersection",
3050
- left: e,
3051
- right: t
3052
- });
3053
- }
3054
- const ye = /* @__PURE__ */ u("ZodEnum", (e, t) => {
3055
- Ko.init(e, t), S.init(e, t), e._zod.processJSONSchema = (o, r, i) => ai(e, o, r), e.enum = t.entries, e.options = Object.values(t.entries);
3056
- const n = new Set(Object.keys(t.entries));
3057
- e.extract = (o, r) => {
3058
- const i = {};
3059
- for (const s of o)
3060
- if (n.has(s))
3061
- i[s] = t.entries[s];
3062
- else
3063
- throw new Error(`Key ${s} not found in enum`);
3064
- return new ye({
3065
- ...t,
3066
- checks: [],
3067
- ..._(r),
3068
- entries: i
3069
- });
3070
- }, e.exclude = (o, r) => {
3071
- const i = { ...t.entries };
3072
- for (const s of o)
3073
- if (n.has(s))
3074
- delete i[s];
3075
- else
3076
- throw new Error(`Key ${s} not found in enum`);
3077
- return new ye({
3078
- ...t,
3079
- checks: [],
3080
- ..._(r),
3081
- entries: i
3082
- });
3083
- };
3084
- });
3085
- function D(e, t) {
3086
- const n = Array.isArray(e) ? Object.fromEntries(e.map((o) => [o, o])) : e;
3087
- return new ye({
3088
- type: "enum",
3089
- entries: n,
3090
- ..._(t)
3091
- });
3092
- }
3093
- const ys = /* @__PURE__ */ u("ZodLiteral", (e, t) => {
3094
- Yo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => ui(e, n, o), e.values = new Set(t.values), Object.defineProperty(e, "value", {
3095
- get() {
3096
- if (t.values.length > 1)
3097
- throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
3098
- return t.values[0];
3099
- }
3100
- });
3101
- });
3102
- function z(e, t) {
3103
- return new ys({
3104
- type: "literal",
3105
- values: Array.isArray(e) ? e : [e],
3106
- ..._(t)
3107
- });
3108
- }
3109
- const bs = /* @__PURE__ */ u("ZodTransform", (e, t) => {
3110
- qo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => fi(e, n), e._zod.parse = (n, o) => {
3111
- if (o.direction === "backward")
3112
- throw new ot(e.constructor.name);
3113
- n.addIssue = (i) => {
3114
- if (typeof i == "string")
3115
- n.issues.push(ne(i, n.value, t));
3116
- else {
3117
- const s = i;
3118
- s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = n.value), s.inst ?? (s.inst = e), n.issues.push(ne(s));
3119
- }
3120
- };
3121
- const r = t.transform(n.value, n);
3122
- return r instanceof Promise ? r.then((i) => (n.value = i, n.fallback = !0, n)) : (n.value = r, n.fallback = !0, n);
3123
- };
3124
- });
3125
- function zs(e) {
3126
- return new bs({
3127
- type: "transform",
3128
- transform: e
3129
- });
3130
- }
3131
- const Nt = /* @__PURE__ */ u("ZodOptional", (e, t) => {
3132
- wt.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => Et(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
3133
- });
3134
- function Qe(e) {
3135
- return new Nt({
3136
- type: "optional",
3137
- innerType: e
3138
- });
3139
- }
3140
- const ws = /* @__PURE__ */ u("ZodExactOptional", (e, t) => {
3141
- Xo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => Et(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
3142
- });
3143
- function ks(e) {
3144
- return new ws({
3145
- type: "optional",
3146
- innerType: e
3147
- });
3148
- }
3149
- const $s = /* @__PURE__ */ u("ZodNullable", (e, t) => {
3150
- Ho.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => gi(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
3151
- });
3152
- function et(e) {
3153
- return new $s({
3154
- type: "nullable",
3155
- innerType: e
3156
- });
3157
- }
3158
- const Ss = /* @__PURE__ */ u("ZodDefault", (e, t) => {
3159
- Qo.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => vi(e, n, o, r), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
3160
- });
3161
- function Zs(e, t) {
3162
- return new Ss({
3163
- type: "default",
3164
- innerType: e,
3165
- get defaultValue() {
3166
- return typeof t == "function" ? t() : st(t);
3167
- }
3168
- });
3169
- }
3170
- const Os = /* @__PURE__ */ u("ZodPrefault", (e, t) => {
3171
- er.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => yi(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
3172
- });
3173
- function Es(e, t) {
3174
- return new Os({
3175
- type: "prefault",
3176
- innerType: e,
3177
- get defaultValue() {
3178
- return typeof t == "function" ? t() : st(t);
3179
- }
3180
- });
3181
- }
3182
- const Ct = /* @__PURE__ */ u("ZodNonOptional", (e, t) => {
3183
- tr.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => _i(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
3184
- });
3185
- function Ts(e, t) {
3186
- return new Ct({
3187
- type: "nonoptional",
3188
- innerType: e,
3189
- ..._(t)
3190
- });
3191
- }
3192
- const Is = /* @__PURE__ */ u("ZodCatch", (e, t) => {
3193
- nr.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => bi(e, n, o, r), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
3194
- });
3195
- function Ps(e, t) {
3196
- return new Is({
3197
- type: "catch",
3198
- innerType: e,
3199
- catchValue: typeof t == "function" ? t : () => t
3200
- });
3201
- }
3202
- const As = /* @__PURE__ */ u("ZodPipe", (e, t) => {
3203
- or.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => zi(e, n, o, r), e.in = t.in, e.out = t.out;
3204
- });
3205
- function tt(e, t) {
3206
- return new As({
3207
- type: "pipe",
3208
- in: e,
3209
- out: t
3210
- // ...util.normalizeParams(params),
3211
- });
3212
- }
3213
- const Ns = /* @__PURE__ */ u("ZodReadonly", (e, t) => {
3214
- rr.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => wi(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
3215
- });
3216
- function Cs(e) {
3217
- return new Ns({
3218
- type: "readonly",
3219
- innerType: e
3220
- });
3221
- }
3222
- const js = /* @__PURE__ */ u("ZodLazy", (e, t) => {
3223
- ir.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => ki(e, n, o, r), e.unwrap = () => e._zod.def.getter();
3224
- });
3225
- function jt(e) {
3226
- return new js({
3227
- type: "lazy",
3228
- getter: e
3229
- });
3230
- }
3231
- const xs = /* @__PURE__ */ u("ZodCustom", (e, t) => {
3232
- sr.init(e, t), S.init(e, t), e._zod.processJSONSchema = (n, o, r) => li(e, n);
3233
- });
3234
- function Ds(e, t = {}) {
3235
- return /* @__PURE__ */ Hr(xs, e, t);
3236
- }
3237
- function Rs(e, t) {
3238
- return /* @__PURE__ */ Qr(e, t);
3239
- }
3240
- const be = v({
3241
- x: p(),
3242
- y: p()
3243
- }), Fs = v({
3244
- enabled: m(),
3245
- color: b(),
3246
- width: p(),
3247
- dashArray: C(p()).optional(),
3248
- lineCap: D(["butt", "round", "square"]).optional(),
3249
- lineJoin: D(["miter", "round", "bevel"]).optional(),
3250
- miterLimit: p().optional(),
3251
- opacity: p().optional(),
3252
- feather: p().optional()
3253
- }), Us = v({
3254
- fill: m().optional(),
3255
- stroke: m().optional(),
3256
- scope: D(["group", "artboard"]).optional()
3257
- }), Js = v({
3258
- enabled: m(),
3259
- style: D(["worn", "cracked", "grunge", "retro", "custom"]),
3260
- intensity: p(),
3261
- fadeAmount: p().optional(),
3262
- grainAmount: p().optional(),
3263
- scratchAmount: p().optional(),
3264
- edgeWear: p().optional(),
3265
- textureUrl: b().optional(),
3266
- textureOpacity: p().optional(),
3267
- textureBlendMode: D(["multiply", "screen", "overlay"]).optional(),
3268
- seed: p().optional()
3269
- }), Ms = v({
3270
- id: b(),
3271
- type: D(["clip", "alpha", "luma", "distress"]),
3272
- // maskElement is a nested element config -- use lazy to break the cycle
3273
- maskElement: jt(() => Ie),
3274
- inverted: m().optional(),
3275
- feather: p().optional(),
3276
- opacity: p().optional(),
3277
- blendMode: b().optional()
3278
- }), Ls = v({
3279
- color: b().optional(),
3280
- fontFamily: b().optional(),
3281
- fontSize: p().optional(),
3282
- bold: m().optional(),
3283
- italic: m().optional(),
3284
- underline: m().optional(),
3285
- strikethrough: m().optional(),
3286
- letterSpacing: p().optional()
3287
- }), Vs = v({
3288
- text: b(),
3289
- style: Ls
3290
- }), Bs = v({
3291
- spans: C(Vs)
3292
- }), Ws = v({
3293
- charIndex: p(),
3294
- glyphIndex: p(),
3295
- unicode: b(),
3296
- alternateName: b().optional()
3297
- }), Gs = v({
3298
- liga: m().optional(),
3299
- dlig: m().optional(),
3300
- calt: m().optional(),
3301
- swsh: m().optional(),
3302
- smcp: m().optional(),
3303
- c2sc: m().optional(),
3304
- onum: m().optional(),
3305
- lnum: m().optional(),
3306
- tnum: m().optional(),
3307
- pnum: m().optional(),
3308
- ss01: m().optional(),
3309
- ss02: m().optional(),
3310
- ss03: m().optional(),
3311
- ss04: m().optional(),
3312
- ss05: m().optional(),
3313
- ss06: m().optional(),
3314
- ss07: m().optional(),
3315
- ss08: m().optional(),
3316
- ss09: m().optional(),
3317
- ss10: m().optional(),
3318
- ss11: m().optional(),
3319
- ss12: m().optional(),
3320
- ss13: m().optional(),
3321
- ss14: m().optional(),
3322
- ss15: m().optional(),
3323
- ss16: m().optional(),
3324
- ss17: m().optional(),
3325
- ss18: m().optional(),
3326
- ss19: m().optional(),
3327
- ss20: m().optional(),
3328
- cv01: m().optional(),
3329
- cv02: m().optional(),
3330
- cv03: m().optional(),
3331
- cv04: m().optional(),
3332
- cv05: m().optional(),
3333
- ccmp: m().optional(),
3334
- locl: m().optional(),
3335
- kern: m().optional(),
3336
- mark: m().optional(),
3337
- mkmk: m().optional()
3338
- }), xt = v({
3339
- type: z("custom"),
3340
- controlPoints: C(be)
3341
- }).passthrough(), Dt = v({
3342
- type: z("distort")
3343
- }).passthrough(), Rt = v({
3344
- type: z("circle"),
3345
- radius: p(),
3346
- scale: p(),
3347
- reverse: m()
3348
- }), Ft = v({
3349
- type: z("lean"),
3350
- leanAmount: p()
3351
- }).passthrough(), Ut = v({
3352
- type: z("arch"),
3353
- archHeight: p()
3354
- }).passthrough(), Jt = v({
3355
- type: z("ascend"),
3356
- ascendAngle: p()
3357
- }).passthrough(), Mt = v({
3358
- type: z("wave"),
3359
- amplitude: p(),
3360
- frequency: p()
3361
- }).passthrough(), Lt = v({
3362
- type: z("flag"),
3363
- amplitude: p(),
3364
- frequency: p()
3365
- }).passthrough(), Vt = v({
3366
- type: z("image"),
3367
- width: p(),
3368
- height: p(),
3369
- cropX: p(),
3370
- cropY: p(),
3371
- cropWidth: p(),
3372
- cropHeight: p(),
3373
- flipHorizontal: m(),
3374
- flipVertical: m(),
3375
- borderRadius: p(),
3376
- // Brightness/contrast/saturation (1 = neutral) — optional; the canonical
3377
- // neutral state is ABSENCE, so saved states never carry {1,1,1}.
3378
- adjustments: v({
3379
- brightness: p(),
3380
- contrast: p(),
3381
- saturation: p()
3382
- }).optional()
3383
- }), Bt = v({
3384
- type: z("group")
3385
- }), nt = v({
3386
- offset: p().min(0).max(1),
3387
- color: b()
3388
- }), Ks = Te("type", [
3389
- v({ type: z("solid"), color: b() }),
3390
- v({ type: z("linear"), angle: p(), stops: C(nt).min(2) }),
3391
- v({ type: z("radial"), stops: C(nt).min(2) })
3392
- ]), Wt = v({
3393
- type: z("shape"),
3394
- shapeType: D(["rectangle", "circle", "ellipse", "triangle", "polygon", "star", "line"]),
3395
- width: p(),
3396
- height: p(),
3397
- borderRadius: p().optional(),
3398
- radiusX: p().optional(),
3399
- radiusY: p().optional(),
3400
- sides: p().optional(),
3401
- points: p().optional(),
3402
- innerRadius: p().optional(),
3403
- fillColor: b().optional(),
3404
- fillOpacity: p().optional(),
3405
- fill: Ks.optional()
3406
- }), Ys = v({
3407
- id: b(),
3408
- x: p(),
3409
- y: p(),
3410
- type: D(["corner", "smooth", "bezier"]),
3411
- handleIn: be.optional(),
3412
- handleOut: be.optional()
3413
- }), Gt = v({
3414
- type: z("path"),
3415
- points: C(Ys),
3416
- closed: m(),
3417
- width: p(),
3418
- height: p(),
3419
- fillEnabled: m().optional(),
3420
- fillColor: b().optional(),
3421
- fillOpacity: p().optional(),
3422
- strokeEnabled: m().optional(),
3423
- strokeColor: b().optional(),
3424
- strokeWidth: p().optional()
3425
- }), _c = Te("type", [
3426
- xt,
3427
- Dt,
3428
- Rt,
3429
- Ft,
3430
- Ut,
3431
- Jt,
3432
- Mt,
3433
- Lt,
3434
- Vt,
3435
- Bt,
3436
- Wt,
3437
- Gt
3438
- ]), re = v({
3439
- id: b(),
3440
- x: p(),
3441
- y: p(),
3442
- rotation: p(),
3443
- opacity: p(),
3444
- // Layer properties
3445
- name: b().optional(),
3446
- visible: m().optional(),
3447
- locked: m().optional(),
3448
- isClipping: m().optional(),
3449
- // Effects
3450
- blendMode: D(["normal", "knockout", "clip"]).optional(),
3451
- knockoutParts: Us.optional(),
3452
- stroke: Fs.optional(),
3453
- masks: C(Ms).optional(),
3454
- distressEffect: Js.optional()
3455
- }), L = re.extend({
3456
- // Rich text
3457
- richText: Bs.optional(),
3458
- // Legacy plain text
3459
- text: b().optional(),
3460
- // Element-level style defaults
3461
- fontSize: p().optional(),
3462
- fontFamily: b().optional(),
3463
- color: b().optional(),
3464
- textAlign: D(["left", "center", "right"]).optional(),
3465
- bold: m().optional(),
3466
- italic: m().optional(),
3467
- underline: m().optional(),
3468
- strikethrough: m().optional(),
3469
- // Typography
3470
- letterSpacing: p().optional(),
3471
- lineHeight: p().optional(),
3472
- glyphOverrides: C(Ws).optional(),
3473
- openTypeFeatures: Gs.optional()
3474
- }), qs = L.extend({
3475
- transformType: z("custom"),
3476
- transformData: xt.optional()
3477
- }), Xs = L.extend({
3478
- transformType: z("distort"),
3479
- transformData: Dt.optional()
3480
- }), Hs = L.extend({
3481
- transformType: z("circle"),
3482
- transformData: Rt.optional()
3483
- }), Qs = L.extend({
3484
- transformType: z("lean"),
3485
- transformData: Ft.optional()
3486
- }), ec = L.extend({
3487
- transformType: z("arch"),
3488
- transformData: Ut.optional()
3489
- }), tc = L.extend({
3490
- transformType: z("ascend"),
3491
- transformData: Jt.optional()
3492
- }), nc = L.extend({
3493
- transformType: z("wave"),
3494
- transformData: Mt.optional()
3495
- }), oc = L.extend({
3496
- transformType: z("flag"),
3497
- transformData: Lt.optional()
3498
- }), rc = re.extend({
3499
- transformType: z("image"),
3500
- transformData: Vt.optional(),
3501
- imageUrl: b().optional(),
3502
- imageAspectRatio: p().optional()
3503
- }), ic = re.extend({
3504
- transformType: z("group"),
3505
- transformData: Bt.optional(),
3506
- children: jt(() => C(Ie)).optional()
3507
- }), sc = re.extend({
3508
- transformType: z("shape"),
3509
- transformData: Wt.optional()
3510
- }), cc = re.extend({
3511
- transformType: z("path"),
3512
- transformData: Gt.optional()
3513
- }), Ie = Te("transformType", [
3514
- qs,
3515
- Xs,
3516
- Hs,
3517
- Qs,
3518
- ec,
3519
- tc,
3520
- nc,
3521
- oc,
3522
- rc,
3523
- ic,
3524
- sc,
3525
- cc
3526
- ]), ac = At([
3527
- z("rectangle"),
3528
- z("circle"),
3529
- v({ type: z("rounded"), radius: p() }),
3530
- v({ type: z("path"), d: b() }),
3531
- v({
3532
- type: z("composite-path"),
3533
- pieces: C(
3534
- v({
3535
- d: b(),
3536
- x: p(),
3537
- y: p(),
3538
- // degrees clockwise, any multiple of 45 (utils/pieceRotation.ts — 45 = a bandana's folded view)
3539
- rotation: p().refine((e) => Number.isFinite(e) && e % 45 === 0, { message: "rotation must be a multiple of 45 (degrees clockwise)" }).optional(),
3540
- baseWidth: p().optional(),
3541
- baseHeight: p().optional()
3542
- })
3543
- )
3544
- })
3545
- ]), uc = v({
3546
- enabled: m(),
3547
- textureUrl: b(),
3548
- intensity: p()
3549
- }), lc = v({
3550
- id: b(),
3551
- name: b(),
3552
- x: p(),
3553
- y: p(),
3554
- width: p(),
3555
- height: p(),
3556
- backgroundColor: b(),
3557
- backgroundType: D(["color", "transparent", "texture"]).optional(),
3558
- backgroundTexture: b().optional(),
3559
- exportBackground: m().optional(),
3560
- clipShape: ac.optional(),
3561
- previewBackgroundColor: b().optional(),
3562
- distressTexture: uc.optional(),
3563
- // Pacing role for multi-page templates (ADR-0086) — template metadata,
3564
- // stripped from the server render wire by serializeStateForServer
3565
- role: D(["cover", "front-matter", "repeating", "back-matter"]).optional(),
3566
- elementIds: C(b())
3567
- }), fc = v({
3568
- family: b().min(1),
3569
- url: b().min(1),
3570
- weight: p().optional(),
3571
- style: D(["normal", "italic"]).optional()
3572
- }), pc = v({
3573
- version: z(1),
3574
- artboards: C(lc),
3575
- elements: C(Ie),
3576
- activeArtboardId: b(),
3577
- customFonts: C(fc).optional()
3578
- });
3579
- function ze(e, t = /* @__PURE__ */ new Set()) {
3580
- var n;
3581
- for (const o of e) {
3582
- typeof o.fontFamily == "string" && o.fontFamily.trim() && t.add(o.fontFamily);
3583
- const r = o.richText;
3584
- if (r != null && r.spans)
3585
- for (const i of r.spans)
3586
- typeof ((n = i.style) == null ? void 0 : n.fontFamily) == "string" && i.style.fontFamily.trim() && t.add(i.style.fontFamily);
3587
- if (Array.isArray(o.children) && ze(o.children, t), Array.isArray(o.masks)) {
3588
- const i = o.masks.map((s) => s.maskElement).filter((s) => !!s);
3589
- ze(i, t);
3590
- }
3591
- }
3592
- return t;
3593
- }
3594
- function vc(e, t, n = {}) {
3595
- var a;
3596
- const o = e.getAllArtboards(), r = e.getActiveArtboardId(), i = o.map(
3597
- (f) => {
3598
- const l = f.toJSON();
3599
- return {
3600
- id: l.id ?? f.id,
3601
- name: l.name ?? f.name,
3602
- x: l.x ?? f.x,
3603
- y: l.y ?? f.y,
3604
- width: l.width ?? f.width,
3605
- height: l.height ?? f.height,
3606
- backgroundColor: l.backgroundColor ?? f.backgroundColor,
3607
- ...l.backgroundType && { backgroundType: l.backgroundType },
3608
- ...l.backgroundTexture && { backgroundTexture: l.backgroundTexture },
3609
- ...l.exportBackground !== void 0 && { exportBackground: l.exportBackground },
3610
- ...l.clipShape && { clipShape: l.clipShape },
3611
- ...l.previewBackgroundColor && { previewBackgroundColor: l.previewBackgroundColor },
3612
- ...l.role && { role: l.role },
3613
- elementIds: l.elementIds ?? f.getElementIds()
3614
- };
3615
- }
3616
- ), s = t.map(
3617
- (f) => f.toJSON()
3618
- ), c = n.customFonts !== void 0 ? [...n.customFonts] : Xt.forFamilies([
3619
- ...ze(s)
3620
- ]);
3621
- return {
3622
- version: 1,
3623
- artboards: i,
3624
- elements: s,
3625
- activeArtboardId: r ?? ((a = i[0]) == null ? void 0 : a.id) ?? "",
3626
- ...c.length > 0 && { customFonts: c }
3627
- };
3628
- }
3629
- function yc(e) {
3630
- const t = e.artboards.map(
3631
- (r) => Ht.fromJSON({
3632
- id: r.id,
3633
- name: r.name,
3634
- x: r.x,
3635
- y: r.y,
3636
- width: r.width,
3637
- height: r.height,
3638
- backgroundColor: r.backgroundColor,
3639
- backgroundType: r.backgroundType,
3640
- backgroundTexture: r.backgroundTexture,
3641
- exportBackground: r.exportBackground,
3642
- clipShape: r.clipShape,
3643
- previewBackgroundColor: r.previewBackgroundColor,
3644
- role: r.role,
3645
- elementIds: r.elementIds
3646
- })
3647
- ), n = e.elements.map(
3648
- (r) => Yt.createFromJSON(r)
3649
- ), o = e.customFonts ?? [];
3650
- return o.length > 0 && qt(o), {
3651
- artboards: t,
3652
- elements: n,
3653
- activeArtboardId: e.activeArtboardId,
3654
- customFonts: o
3655
- };
3656
- }
3657
- function dc(e) {
3658
- const t = pc.safeParse(e);
3659
- return t.success ? { success: !0, data: t.data } : { success: !1, errors: t.error.issues.map((o) => ({
3660
- path: o.path.join("."),
3661
- message: o.message
3662
- })) };
3663
- }
3664
- function bc(e) {
3665
- if (typeof e != "object" || e === null)
3666
- throw new Error("migrateState: input must be a non-null object");
3667
- const t = e;
3668
- if (t.version === 1) {
3669
- const n = dc(e);
3670
- if (n.success)
3671
- return n.data;
3672
- const o = n.errors.map((r) => `${r.path}: ${r.message}`).join("; ");
3673
- throw new Error(`migrateState: invalid v1 state: ${o}`);
3674
- }
3675
- if (typeof t.metadata == "object" && t.metadata !== null && "version" in t.metadata)
3676
- return hc(t);
3677
- throw new Error(
3678
- `migrateState: unknown state format (version=${String(t.version ?? "undefined")})`
3679
- );
3680
- }
3681
- function hc(e) {
3682
- var o;
3683
- const n = e.metadata.version;
3684
- if (n === "1.0.0") {
3685
- const r = e.canvas ?? {}, i = e.elements ?? [], s = "artboard-migrated";
3686
- return {
3687
- version: 1,
3688
- artboards: [
3689
- {
3690
- id: s,
3691
- name: "Artboard 1",
3692
- x: 0,
3693
- y: 0,
3694
- width: r.width ?? 1920,
3695
- height: r.height ?? 1080,
3696
- backgroundColor: r.backgroundColor ?? "#ffffff",
3697
- elementIds: i.map((c) => c.id).filter(Boolean)
3698
- }
3699
- ],
3700
- elements: i,
3701
- activeArtboardId: s
3702
- };
3703
- }
3704
- if (n === "2.0.0") {
3705
- const r = e.artboards ?? [], i = [], s = r.map(
3706
- (c) => {
3707
- const a = c.elements ?? [], f = a.map((l) => l.id).filter(Boolean);
3708
- return i.push(...a), {
3709
- id: c.id,
3710
- name: c.name,
3711
- x: c.x,
3712
- y: c.y,
3713
- width: c.width,
3714
- height: c.height,
3715
- backgroundColor: c.backgroundColor,
3716
- elementIds: f
3717
- };
3718
- }
3719
- );
3720
- return {
3721
- version: 1,
3722
- artboards: s,
3723
- elements: i,
3724
- activeArtboardId: e.activeArtboardId ?? ((o = s[0]) == null ? void 0 : o.id) ?? ""
3725
- };
3726
- }
3727
- throw new Error(
3728
- `migrateFromCanvasDocument: unsupported CanvasDocument version "${n}"`
3729
- );
3730
- }
3731
- export {
3732
- Ie as A,
3733
- pc as C,
3734
- lc as S,
3735
- _c as a,
3736
- Te as b,
3737
- b as c,
3738
- yc as d,
3739
- C as e,
3740
- z as l,
3741
- bc as m,
3742
- p as n,
3743
- v as o,
3744
- vc as s,
3745
- At as u,
3746
- dc as v
3747
- };
3748
- //# sourceMappingURL=CanvasStateV1-CJJff7Ci.js.map