@reforma/components 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/Scrollable/Scrollable.d.ts +1 -2
  2. package/dist/Scrollable/Scrollable.d.ts.map +1 -1
  3. package/dist/Scrollable/Scrollable.js +45 -38
  4. package/dist/Scrollable/Scrollable.js.map +1 -1
  5. package/dist/Scrollable/useScrollChrome.d.ts +1 -2
  6. package/dist/Scrollable/useScrollChrome.d.ts.map +1 -1
  7. package/dist/Scrollable/useScrollChrome.js +125 -110
  8. package/dist/Scrollable/useScrollChrome.js.map +1 -1
  9. package/dist/chat/ComposerBanner/ComposerBanner.d.ts +2 -1
  10. package/dist/chat/ComposerBanner/ComposerBanner.d.ts.map +1 -1
  11. package/dist/chat/ComposerBanner/ComposerBanner.js +37 -29
  12. package/dist/chat/ComposerBanner/ComposerBanner.js.map +1 -1
  13. package/dist/chat/ComposerBanner/ComposerBanner.module.css +1 -1
  14. package/dist/chat/ComposerBanner/ComposerBanner.module.css.js +5 -3
  15. package/dist/chat/ComposerBanner/ComposerBanner.module.css.js.map +1 -1
  16. package/dist/chat/Tool/agent/AgentTool.d.ts.map +1 -1
  17. package/dist/chat/Tool/agent/AgentTool.js +89 -90
  18. package/dist/chat/Tool/agent/AgentTool.js.map +1 -1
  19. package/dist/chat/Tool/edit/EditTool.js +1 -1
  20. package/dist/chat/Tool/edit/EditTool.js.map +1 -1
  21. package/dist/node_modules/zod/v4/classic/errors.js +38 -0
  22. package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
  23. package/dist/node_modules/zod/v4/classic/parse.js +21 -0
  24. package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
  25. package/dist/node_modules/zod/v4/classic/schemas.js +822 -0
  26. package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
  27. package/dist/node_modules/zod/v4/core/api.js +561 -0
  28. package/dist/node_modules/zod/v4/core/api.js.map +1 -0
  29. package/dist/node_modules/zod/v4/core/checks.js +262 -0
  30. package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
  31. package/dist/node_modules/zod/v4/core/core.js +97 -0
  32. package/dist/node_modules/zod/v4/core/core.js.map +1 -0
  33. package/dist/node_modules/zod/v4/core/doc.js +35 -0
  34. package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
  35. package/dist/node_modules/zod/v4/core/errors.js +79 -0
  36. package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
  37. package/dist/node_modules/zod/v4/core/json-schema-processors.js +308 -0
  38. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
  39. package/dist/node_modules/zod/v4/core/memoizer.js +203 -0
  40. package/dist/node_modules/zod/v4/core/memoizer.js.map +1 -0
  41. package/dist/node_modules/zod/v4/core/parse.js +113 -0
  42. package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
  43. package/dist/node_modules/zod/v4/core/regexes.js +59 -0
  44. package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
  45. package/dist/node_modules/zod/v4/core/registries.js +41 -0
  46. package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
  47. package/dist/node_modules/zod/v4/core/schemas.js +1104 -0
  48. package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
  49. package/dist/node_modules/zod/v4/core/to-json-schema.js +380 -0
  50. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
  51. package/dist/node_modules/zod/v4/core/util.js +465 -0
  52. package/dist/node_modules/zod/v4/core/util.js.map +1 -0
  53. package/dist/node_modules/zod/v4/core/versions.js +9 -0
  54. package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
  55. package/dist/node_modules/zod/v4/locales/en.js +97 -0
  56. package/dist/node_modules/zod/v4/locales/en.js.map +1 -0
  57. package/dist/openui/actions.d.ts +16 -0
  58. package/dist/openui/actions.d.ts.map +1 -0
  59. package/dist/openui/actions.js +58 -0
  60. package/dist/openui/actions.js.map +1 -0
  61. package/dist/openui/components/controls.d.ts +34 -0
  62. package/dist/openui/components/controls.d.ts.map +1 -0
  63. package/dist/openui/components/controls.js +40 -0
  64. package/dist/openui/components/controls.js.map +1 -0
  65. package/dist/openui/components/layout.d.ts +74 -0
  66. package/dist/openui/components/layout.d.ts.map +1 -0
  67. package/dist/openui/components/layout.js +154 -0
  68. package/dist/openui/components/layout.js.map +1 -0
  69. package/dist/openui/components/list.d.ts +17 -0
  70. package/dist/openui/components/list.d.ts.map +1 -0
  71. package/dist/openui/components/list.js +96 -0
  72. package/dist/openui/components/list.js.map +1 -0
  73. package/dist/openui/components/svg.d.ts +100 -0
  74. package/dist/openui/components/svg.d.ts.map +1 -0
  75. package/dist/openui/components/svg.js +246 -0
  76. package/dist/openui/components/svg.js.map +1 -0
  77. package/dist/openui/components/table.d.ts +6 -0
  78. package/dist/openui/components/table.d.ts.map +1 -0
  79. package/dist/openui/components/table.js +54 -0
  80. package/dist/openui/components/table.js.map +1 -0
  81. package/dist/openui/components/text.d.ts +89 -0
  82. package/dist/openui/components/text.d.ts.map +1 -0
  83. package/dist/openui/components/text.js +181 -0
  84. package/dist/openui/components/text.js.map +1 -0
  85. package/dist/openui/functions/colors.d.ts +12 -0
  86. package/dist/openui/functions/colors.d.ts.map +1 -0
  87. package/dist/openui/functions/colors.js +32 -0
  88. package/dist/openui/functions/colors.js.map +1 -0
  89. package/dist/openui/functions/data.d.ts +170 -0
  90. package/dist/openui/functions/data.d.ts.map +1 -0
  91. package/dist/openui/functions/data.js +308 -0
  92. package/dist/openui/functions/data.js.map +1 -0
  93. package/dist/openui/functions/dates.d.ts +57 -0
  94. package/dist/openui/functions/dates.d.ts.map +1 -0
  95. package/dist/openui/functions/dates.js +184 -0
  96. package/dist/openui/functions/dates.js.map +1 -0
  97. package/dist/openui/functions/index.d.ts +136 -0
  98. package/dist/openui/functions/index.d.ts.map +1 -0
  99. package/dist/openui/functions/index.js +11 -0
  100. package/dist/openui/functions/index.js.map +1 -0
  101. package/dist/openui/functions/lists.d.ts +102 -0
  102. package/dist/openui/functions/lists.d.ts.map +1 -0
  103. package/dist/openui/functions/lists.js +305 -0
  104. package/dist/openui/functions/lists.js.map +1 -0
  105. package/dist/openui/functions/numbers.d.ts +72 -0
  106. package/dist/openui/functions/numbers.d.ts.map +1 -0
  107. package/dist/openui/functions/numbers.js +201 -0
  108. package/dist/openui/functions/numbers.js.map +1 -0
  109. package/dist/openui/functions/shared.d.ts +28 -0
  110. package/dist/openui/functions/shared.d.ts.map +1 -0
  111. package/dist/openui/functions/shared.js +69 -0
  112. package/dist/openui/functions/shared.js.map +1 -0
  113. package/dist/openui/functions/text.d.ts +97 -0
  114. package/dist/openui/functions/text.d.ts.map +1 -0
  115. package/dist/openui/functions/text.js +223 -0
  116. package/dist/openui/functions/text.js.map +1 -0
  117. package/dist/openui/index.d.ts +5 -0
  118. package/dist/openui/index.d.ts.map +1 -0
  119. package/dist/openui/index.js +14 -0
  120. package/dist/openui/index.js.map +1 -0
  121. package/dist/openui/library.d.ts +8 -0
  122. package/dist/openui/library.d.ts.map +1 -0
  123. package/dist/openui/library.js +37 -0
  124. package/dist/openui/library.js.map +1 -0
  125. package/dist/openui/schema.d.ts +36 -0
  126. package/dist/openui/schema.d.ts.map +1 -0
  127. package/dist/openui/schema.js +24 -0
  128. package/dist/openui/schema.js.map +1 -0
  129. package/package.json +4 -2
@@ -0,0 +1,308 @@
1
+ import { base64 as K, base64url as q, number as B, integer as L } from "./regexes.js";
2
+ import { base64Charset as $, base64urlCharset as D } from "./schemas.js";
3
+ import { handleUnrepresentable as O, process as l } from "./to-json-schema.js";
4
+ import { assignProp as E, getEnumValues as G, BIGINT_FORMAT_RANGES as U, NUMBER_FORMAT_RANGES as Z } from "./util.js";
5
+ const h = (t, e, o) => {
6
+ (t[e] === void 0 || o > t[e]) && (t[e] = o);
7
+ }, b = (t, e, o) => {
8
+ (t[e] === void 0 || o < t[e]) && (t[e] = o);
9
+ }, S = (t, e) => {
10
+ h(t, "minimum", e), b(t, "maximum", e);
11
+ }, k = (t, e) => {
12
+ t.multipleOf ?? (t.multipleOf = []), t.multipleOf.includes(e) || t.multipleOf.push(e);
13
+ }, A = (t, e) => {
14
+ t.patterns ?? (t.patterns = /* @__PURE__ */ new Set()), t.patterns.add(e);
15
+ }, V = (t, e) => {
16
+ t.mime = t.mime ? t.mime.filter((o) => e.includes(o)) : [...e];
17
+ }, F = (t, e) => {
18
+ t.format = e, e.includes("int") && (t.isInt = !0);
19
+ }, x = (t, e) => h(t, "minimum", e.minimum), I = (t, e) => b(t, "maximum", e.maximum), w = (t) => (e, o) => {
20
+ F(e, o.format);
21
+ const [i, n] = t[o.format];
22
+ h(e, "minimum", i), b(e, "maximum", n);
23
+ }, Y = {
24
+ greater_than: (t, e) => h(t, e.inclusive ? "minimum" : "exclusiveMinimum", e.value),
25
+ less_than: (t, e) => b(t, e.inclusive ? "maximum" : "exclusiveMaximum", e.value),
26
+ multiple_of: (t, e) => k(t, e.value),
27
+ number_format: w(Z),
28
+ bigint_format: w(U),
29
+ min_length: x,
30
+ max_length: I,
31
+ length_equals: (t, e) => S(t, e.length),
32
+ min_size: x,
33
+ max_size: I,
34
+ size_equals: (t, e) => S(t, e.size),
35
+ string_format: (t, e) => {
36
+ F(t, e.format), e.pattern && A(t, e.pattern), (e.format === "base64" || e.format === "base64url") && (t.contentEncoding = e.format), (e.local || e.precision === -1) && (t.laxFormat = !0);
37
+ },
38
+ mime_type: (t, e) => V(t, e.mime)
39
+ };
40
+ function z(t) {
41
+ const e = {}, o = t._zod.def, i = t._zod.traits.has("$ZodCheck") ? [t, ...o.checks ?? []] : o.checks ?? [];
42
+ for (const r of i)
43
+ Y[r._zod.def.check]?.(e, r._zod.def);
44
+ const n = t._zod.bag;
45
+ n.minimum !== void 0 && h(e, "minimum", n.minimum), n.exclusiveMinimum !== void 0 && h(e, "exclusiveMinimum", n.exclusiveMinimum), n.maximum !== void 0 && b(e, "maximum", n.maximum), n.exclusiveMaximum !== void 0 && b(e, "exclusiveMaximum", n.exclusiveMaximum), n.multipleOf !== void 0 && k(e, n.multipleOf), n.format !== void 0 && (e.format ?? (e.format = n.format), n.format.includes("int") && (e.isInt = !0)), n.mime && V(e, n.mime);
46
+ for (const r of n.patterns ?? [])
47
+ A(e, r);
48
+ return e;
49
+ }
50
+ const W = {
51
+ guid: "uuid",
52
+ url: "uri",
53
+ datetime: "date-time",
54
+ json_string: "json-string",
55
+ regex: ""
56
+ // do not set
57
+ }, H = /* @__PURE__ */ new Map([
58
+ [$, K],
59
+ [D, q]
60
+ ]), C = (t) => H.get(t) ?? t, ne = (t, e, o, i) => {
61
+ const n = o;
62
+ n.type = "string";
63
+ const { minimum: r, maximum: s, format: f, patterns: a, contentEncoding: m, laxFormat: c } = z(t);
64
+ if (typeof r == "number" && (n.minLength = r), typeof s == "number" && (n.maxLength = s), f && (n.format = W[f] ?? f, n.format === "" && delete n.format, (f === "time" || c) && delete n.format), m && (n.contentEncoding = m), a && a.size > 0) {
65
+ const d = [...a].map(C);
66
+ d.length === 1 ? n.pattern = d[0].source : d.length > 1 && (n.allOf = [
67
+ ...d.map((P) => ({
68
+ ...e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0" ? { type: "string" } : {},
69
+ pattern: P.source
70
+ }))
71
+ ]);
72
+ }
73
+ }, ie = (t, e, o, i) => {
74
+ const n = o, { minimum: r, maximum: s, multipleOf: f, exclusiveMaximum: a, exclusiveMinimum: m, isInt: c } = z(t);
75
+ n.type = c ? "integer" : "number";
76
+ const d = typeof m == "number" && m >= (r ?? Number.NEGATIVE_INFINITY), P = typeof a == "number" && a <= (s ?? Number.POSITIVE_INFINITY), p = e.target === "draft-04" || e.target === "openapi-3.0";
77
+ if (d ? p ? (n.minimum = m, n.exclusiveMinimum = !0) : n.exclusiveMinimum = m : typeof r == "number" && (n.minimum = r), P ? p ? (n.maximum = a, n.exclusiveMaximum = !0) : n.exclusiveMaximum = a : typeof s == "number" && (n.maximum = s), f) {
78
+ const u = /* @__PURE__ */ new Set();
79
+ for (const y of f)
80
+ Number.isFinite(y) && y !== 0 ? u.add(Math.abs(y)) : O(t, e, n, i, `A multipleOf divisor of ${y} cannot be represented in JSON Schema`);
81
+ const [_, ...g] = u;
82
+ _ !== void 0 && (n.multipleOf = _), g.length && (n.allOf = [...n.allOf ?? [], ...g.map((y) => ({ multipleOf: y }))]);
83
+ }
84
+ }, oe = (t, e, o, i) => {
85
+ o.type = "boolean";
86
+ }, re = (t, e, o, i) => {
87
+ o.not = {};
88
+ }, se = (t, e, o, i) => {
89
+ }, fe = (t, e, o, i) => {
90
+ }, ae = (t, e, o, i) => {
91
+ const n = t._zod.def, r = G(n.entries);
92
+ if (r.length === 0) {
93
+ o.not = {};
94
+ return;
95
+ }
96
+ r.every((s) => typeof s == "number") && (o.type = "number"), r.every((s) => typeof s == "string") && (o.type = "string"), o.enum = r;
97
+ }, me = (t, e, o, i) => {
98
+ O(t, e, o, i, "Custom types cannot be represented in JSON Schema");
99
+ }, ue = (t, e, o, i) => {
100
+ O(t, e, o, i, "Transforms cannot be represented in JSON Schema");
101
+ }, ce = (t, e, o, i) => {
102
+ const n = o, r = t._zod.def, { minimum: s, maximum: f } = z(t);
103
+ typeof s == "number" && (n.minItems = s), typeof f == "number" && (n.maxItems = f), n.type = "array", n.items = l(r.element, e, {
104
+ ...i,
105
+ path: [...i.path, "items"]
106
+ });
107
+ };
108
+ function T(t) {
109
+ const e = t._zod.def;
110
+ return e.type === "pipe" && e.in._zod.traits.has("$ZodTransform") ? T(e.out) : e.type === "catch" ? T(e.innerType) : t._zod.optin;
111
+ }
112
+ const le = (t, e, o, i) => {
113
+ const n = o, r = t._zod.def, s = r.shape;
114
+ if (Object.getOwnPropertySymbols(s).length && O(t, e, n, i, "Symbol keys cannot be represented in JSON Schema"))
115
+ return;
116
+ n.type = "object", n.properties = {};
117
+ for (const m in s)
118
+ E(n.properties, m, l(s[m], e, {
119
+ ...i,
120
+ path: [...i.path, "properties", m]
121
+ }));
122
+ const a = [];
123
+ for (const m of Object.keys(s)) {
124
+ const c = r.shape[m];
125
+ (e.io === "input" ? T(c) === void 0 : c._zod.optout === void 0) && a.push(m);
126
+ }
127
+ a.length > 0 && (n.required = a), r.catchall?._zod.def.type === "never" ? n.additionalProperties = !1 : r.catchall ? r.catchall && (n.additionalProperties = l(r.catchall, e, {
128
+ ...i,
129
+ path: [...i.path, "additionalProperties"]
130
+ })) : e.io === "output" && (n.additionalProperties = !1);
131
+ }, pe = (t, e, o, i) => {
132
+ const n = t._zod.def, r = n.inclusive === !1, s = n.options.map((f, a) => l(f, e, {
133
+ ...i,
134
+ path: [...i.path, r ? "oneOf" : "anyOf", a]
135
+ }));
136
+ r ? o.oneOf = s : o.anyOf = s;
137
+ }, de = (t, e, o, i) => {
138
+ const n = t._zod.def, r = l(n.left, e, {
139
+ ...i,
140
+ path: [...i.path, "allOf", 0]
141
+ }), s = l(n.right, e, {
142
+ ...i,
143
+ path: [...i.path, "allOf", 1]
144
+ }), f = (m) => "allOf" in m && Object.keys(m).length === 1, a = [
145
+ ...f(r) ? r.allOf : [r],
146
+ ...f(s) ? s.allOf : [s]
147
+ ];
148
+ o.allOf = a, e.intersections.push(a);
149
+ };
150
+ function v(t, e, o) {
151
+ if (e.$ref) {
152
+ if (o.has(e))
153
+ return e;
154
+ o.add(e);
155
+ const u = t.get(e)?.def;
156
+ if (!u)
157
+ return e;
158
+ const _ = v(t, u, o);
159
+ return _ === u ? e : _;
160
+ }
161
+ for (const u of ["anyOf", "oneOf"]) {
162
+ const _ = e[u];
163
+ if (!Array.isArray(_))
164
+ continue;
165
+ const g = _.map((y) => v(t, y, o));
166
+ g.some((y, R) => y !== _[R]) && (e = { ...e, [u]: g });
167
+ }
168
+ const i = Array.isArray(e.type) ? e.type : [e.type], n = !i.includes("string") && i.some((u) => u === "number" || u === "integer"), r = e.enum ?? (e.const !== void 0 ? [e.const] : void 0);
169
+ if (!n && !r?.some((u) => typeof u == "number"))
170
+ return e;
171
+ const { minimum: s, maximum: f, exclusiveMinimum: a, exclusiveMaximum: m, multipleOf: c, format: d, id: P, ...p } = e;
172
+ return p.enum ? p.enum = p.enum.map((u) => typeof u == "number" ? String(u) : u) : typeof p.const == "number" && (p.const = String(p.const)), n && (p.type = "string", r || (p.pattern = (i.includes("number") ? B : L).source)), p;
173
+ }
174
+ const M = /* @__PURE__ */ new WeakMap();
175
+ function Q(t) {
176
+ const e = /* @__PURE__ */ new Map();
177
+ for (const i of t.seen.values())
178
+ i.def && !e.has(i.schema) && e.set(i.schema, i);
179
+ const o = /* @__PURE__ */ new Map();
180
+ for (const i of M.get(t) ?? []) {
181
+ const n = t.seen.get(i), r = (n?.def ?? n?.schema)?.propertyNames;
182
+ if (!r || r === !0 || o.has(r))
183
+ continue;
184
+ const s = v(e, r, /* @__PURE__ */ new Set());
185
+ s !== r && o.set(r, s);
186
+ }
187
+ if (o.size)
188
+ for (const i of t.seen.values())
189
+ for (const n of [i.schema, i.def]) {
190
+ const r = n && o.get(n.propertyNames);
191
+ r && (n.propertyNames = r);
192
+ }
193
+ }
194
+ const ye = (t, e, o, i) => {
195
+ const n = o, r = t._zod.def;
196
+ n.type = "object";
197
+ const s = r.keyType, f = z(s).patterns;
198
+ if (r.mode === "loose" && f && f.size > 0) {
199
+ const c = l(r.valueType, e, {
200
+ ...i,
201
+ path: [...i.path, "patternProperties", "*"]
202
+ });
203
+ n.patternProperties = {};
204
+ for (const d of f)
205
+ E(n.patternProperties, C(d).source, c);
206
+ } else {
207
+ if (e.target === "draft-07" || e.target === "draft-2020-12") {
208
+ n.propertyNames = l(r.keyType, e, {
209
+ ...i,
210
+ path: [...i.path, "propertyNames"]
211
+ });
212
+ let c = M.get(e);
213
+ c || (c = [], M.set(e, c), e.deferred.push(() => Q(e))), c.push(t);
214
+ }
215
+ n.additionalProperties = l(r.valueType, e, {
216
+ ...i,
217
+ path: [...i.path, "additionalProperties"]
218
+ });
219
+ }
220
+ const a = s._zod.values, m = e.io === "input" && T(r.valueType) !== void 0;
221
+ if (a && !r.partial && !m) {
222
+ const c = [...a].filter((d) => typeof d == "string" || typeof d == "number");
223
+ c.length > 0 && (n.required = c.map(String));
224
+ }
225
+ }, _e = (t, e, o, i) => {
226
+ const n = t._zod.def, r = l(n.innerType, e, i), s = e.seen.get(t);
227
+ e.target === "openapi-3.0" ? (s.ref = n.innerType, o.nullable = !0) : o.anyOf = [r, { type: "null" }];
228
+ }, he = (t, e, o, i) => {
229
+ const n = t._zod.def;
230
+ l(n.innerType, e, i);
231
+ const r = e.seen.get(t);
232
+ r.ref = n.innerType;
233
+ }, N = /* @__PURE__ */ Symbol();
234
+ function J(t, e, o, i, n) {
235
+ let r = !1;
236
+ const s = JSON.stringify(t, (f, a) => typeof a != "bigint" ? a : (r = !0, null));
237
+ return r ? (O(e, o, i, n, "BigInt defaults cannot be represented in JSON Schema"), N) : JSON.parse(s);
238
+ }
239
+ const be = (t, e, o, i) => {
240
+ const n = t._zod.def;
241
+ l(n.innerType, e, i);
242
+ const r = e.seen.get(t);
243
+ r.ref = n.innerType;
244
+ const s = J(n.defaultValue, t, e, o, i);
245
+ s !== N && (o.default = s);
246
+ }, Oe = (t, e, o, i) => {
247
+ const n = t._zod.def;
248
+ l(n.innerType, e, i);
249
+ const r = e.seen.get(t);
250
+ if (r.ref = n.innerType, e.io !== "input")
251
+ return;
252
+ const s = J(n.defaultValue, t, e, o, i);
253
+ s !== N && (o._prefault = s);
254
+ }, ge = (t, e, o, i) => {
255
+ const n = t._zod.def;
256
+ l(n.innerType, e, i);
257
+ const r = e.seen.get(t);
258
+ r.ref = n.innerType;
259
+ let s;
260
+ try {
261
+ s = n.catchValue(void 0);
262
+ } catch {
263
+ O(t, e, o, i, "Dynamic catch values are not supported in JSON Schema");
264
+ return;
265
+ }
266
+ o.default = s;
267
+ }, Pe = (t, e, o, i) => {
268
+ const n = t._zod.def, r = n.in._zod.traits.has("$ZodTransform"), s = e.io === "input" ? r ? n.out : n.in : n.out;
269
+ l(s, e, i);
270
+ const f = e.seen.get(t);
271
+ f.ref = s;
272
+ }, Te = (t, e, o, i) => {
273
+ const n = t._zod.def;
274
+ l(n.innerType, e, i);
275
+ const r = e.seen.get(t);
276
+ r.ref = n.innerType, o.readOnly = !0;
277
+ }, ze = (t, e, o, i) => {
278
+ const n = t._zod.def;
279
+ l(n.innerType, e, i);
280
+ const r = e.seen.get(t);
281
+ r.ref = n.innerType;
282
+ };
283
+ export {
284
+ z as aggregateChecks,
285
+ se as anyProcessor,
286
+ ce as arrayProcessor,
287
+ oe as booleanProcessor,
288
+ ge as catchProcessor,
289
+ me as customProcessor,
290
+ be as defaultProcessor,
291
+ ae as enumProcessor,
292
+ de as intersectionProcessor,
293
+ re as neverProcessor,
294
+ he as nonoptionalProcessor,
295
+ _e as nullableProcessor,
296
+ ie as numberProcessor,
297
+ le as objectProcessor,
298
+ ze as optionalProcessor,
299
+ Pe as pipeProcessor,
300
+ Oe as prefaultProcessor,
301
+ Te as readonlyProcessor,
302
+ ye as recordProcessor,
303
+ ne as stringProcessor,
304
+ ue as transformProcessor,
305
+ pe as unionProcessor,
306
+ fe as unknownProcessor
307
+ };
308
+ //# sourceMappingURL=json-schema-processors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema-processors.js","sources":["../../../../../../../node_modules/zod/v4/core/json-schema-processors.js"],"sourcesContent":["import * as regexes from \"./regexes.js\";\nimport { base64Charset, base64urlCharset } from \"./schemas.js\";\nimport { extractDefs, finalize, handleUnrepresentable, initializeContext, processSchema, } from \"./to-json-schema.js\";\nimport { BIGINT_FORMAT_RANGES, NUMBER_FORMAT_RANGES, assignProp, getEnumValues } from \"./util.js\";\nconst narrowMin = (agg, key, value) => {\n if (agg[key] === undefined || value > agg[key])\n agg[key] = value;\n};\nconst narrowMax = (agg, key, value) => {\n if (agg[key] === undefined || value < agg[key])\n agg[key] = value;\n};\nconst narrowBoth = (agg, value) => {\n narrowMin(agg, \"minimum\", value);\n narrowMax(agg, \"maximum\", value);\n};\nconst addDivisor = (agg, value) => {\n agg.multipleOf ?? (agg.multipleOf = []);\n if (!agg.multipleOf.includes(value))\n agg.multipleOf.push(value);\n};\nconst addPattern = (agg, pattern) => {\n agg.patterns ?? (agg.patterns = new Set());\n agg.patterns.add(pattern);\n};\nconst intersectMime = (agg, mime) => {\n agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];\n};\n// last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one\nconst setFormat = (agg, format) => {\n agg.format = format;\n if (format.includes(\"int\"))\n agg.isInt = true;\n};\nconst minContributor = (agg, def) => narrowMin(agg, \"minimum\", def.minimum);\nconst maxContributor = (agg, def) => narrowMax(agg, \"maximum\", def.maximum);\nconst formatContributor = (ranges) => (agg, def) => {\n setFormat(agg, def.format);\n const [minimum, maximum] = ranges[def.format];\n narrowMin(agg, \"minimum\", minimum);\n narrowMax(agg, \"maximum\", maximum);\n};\nconst contributors = {\n greater_than: (agg, def) => narrowMin(agg, def.inclusive ? \"minimum\" : \"exclusiveMinimum\", def.value),\n less_than: (agg, def) => narrowMax(agg, def.inclusive ? \"maximum\" : \"exclusiveMaximum\", def.value),\n multiple_of: (agg, def) => addDivisor(agg, def.value),\n number_format: formatContributor(NUMBER_FORMAT_RANGES),\n bigint_format: formatContributor(BIGINT_FORMAT_RANGES),\n min_length: minContributor,\n max_length: maxContributor,\n length_equals: (agg, def) => narrowBoth(agg, def.length),\n min_size: minContributor,\n max_size: maxContributor,\n size_equals: (agg, def) => narrowBoth(agg, def.size),\n string_format: (agg, def) => {\n setFormat(agg, def.format);\n if (def.pattern)\n addPattern(agg, def.pattern);\n if (def.format === \"base64\" || def.format === \"base64url\")\n agg.contentEncoding = def.format;\n if (def.local || def.precision === -1)\n agg.laxFormat = true;\n },\n mime_type: (agg, def) => intersectMime(agg, def.mime),\n};\nexport function aggregateChecks(schema) {\n const agg = {};\n const def = schema._zod.def;\n // a format schema is its own first check, same rule as $ZodType init\n const list = schema._zod.traits.has(\"$ZodCheck\")\n ? [schema, ...(def.checks ?? [])]\n : (def.checks ?? []);\n for (const ch of list)\n contributors[ch._zod.def.check]?.(agg, ch._zod.def);\n // reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other\n const bag = schema._zod.bag;\n if (bag.minimum !== undefined)\n narrowMin(agg, \"minimum\", bag.minimum);\n if (bag.exclusiveMinimum !== undefined)\n narrowMin(agg, \"exclusiveMinimum\", bag.exclusiveMinimum);\n if (bag.maximum !== undefined)\n narrowMax(agg, \"maximum\", bag.maximum);\n if (bag.exclusiveMaximum !== undefined)\n narrowMax(agg, \"exclusiveMaximum\", bag.exclusiveMaximum);\n if (bag.multipleOf !== undefined)\n addDivisor(agg, bag.multipleOf);\n if (bag.format !== undefined) {\n agg.format ?? (agg.format = bag.format);\n if (bag.format.includes(\"int\"))\n agg.isInt = true;\n }\n if (bag.mime)\n intersectMime(agg, bag.mime);\n for (const pattern of bag.patterns ?? [])\n addPattern(agg, pattern);\n return agg;\n}\nconst formatMap = {\n guid: \"uuid\",\n url: \"uri\",\n datetime: \"date-time\",\n json_string: \"json-string\",\n regex: \"\", // do not set\n};\n// ==================== SIMPLE TYPE PROCESSORS ====================\n// the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes\nconst exactPatterns = new Map([\n [base64Charset, regexes.base64],\n [base64urlCharset, regexes.base64url],\n]);\nconst exactPattern = (p) => exactPatterns.get(p) ?? p;\nexport const stringProcessor = (schema, ctx, _json, _params) => {\n const json = _json;\n json.type = \"string\";\n const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);\n if (typeof minimum === \"number\")\n json.minLength = minimum;\n if (typeof maximum === \"number\")\n json.maxLength = maximum;\n // custom pattern overrides format\n if (format) {\n json.format = formatMap[format] ?? format;\n if (json.format === \"\")\n delete json.format; // empty format is not valid\n // `z.iso.time()` is never full-time, and `laxFormat` carries the datetime shapes that also accept what their keyword forbids\n if (format === \"time\" || laxFormat) {\n delete json.format;\n }\n }\n if (contentEncoding)\n json.contentEncoding = contentEncoding;\n if (patterns && patterns.size > 0) {\n const patternList = [...patterns].map(exactPattern);\n if (patternList.length === 1)\n json.pattern = patternList[0].source;\n else if (patternList.length > 1) {\n json.allOf = [\n ...patternList.map((regex) => ({\n ...(ctx.target === \"draft-07\" || ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\"\n ? { type: \"string\" }\n : {}),\n pattern: regex.source,\n })),\n ];\n }\n }\n};\nexport const numberProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);\n json.type = isInt ? \"integer\" : \"number\";\n // when both minimum and exclusiveMinimum exist, pick the more restrictive one\n const exMin = typeof exclusiveMinimum === \"number\" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);\n const exMax = typeof exclusiveMaximum === \"number\" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);\n const legacy = ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\";\n if (exMin) {\n if (legacy) {\n json.minimum = exclusiveMinimum;\n json.exclusiveMinimum = true;\n }\n else {\n json.exclusiveMinimum = exclusiveMinimum;\n }\n }\n else if (typeof minimum === \"number\") {\n json.minimum = minimum;\n }\n if (exMax) {\n if (legacy) {\n json.maximum = exclusiveMaximum;\n json.exclusiveMaximum = true;\n }\n else {\n json.exclusiveMaximum = exclusiveMaximum;\n }\n }\n else if (typeof maximum === \"number\") {\n json.maximum = maximum;\n }\n if (multipleOf) {\n // JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.\n const divisors = new Set();\n for (const divisor of multipleOf) {\n if (Number.isFinite(divisor) && divisor !== 0)\n divisors.add(Math.abs(divisor));\n else\n handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);\n }\n // chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns\n const [first, ...rest] = divisors;\n if (first !== undefined)\n json.multipleOf = first;\n if (rest.length)\n json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];\n }\n};\nexport const booleanProcessor = (_schema, _ctx, json, _params) => {\n json.type = \"boolean\";\n};\nexport const bigintProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"BigInt cannot be represented in JSON Schema\");\n};\nexport const symbolProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Symbols cannot be represented in JSON Schema\");\n};\nexport const nullProcessor = (_schema, ctx, json, _params) => {\n if (ctx.target === \"openapi-3.0\") {\n json.type = \"string\";\n json.nullable = true;\n json.enum = [null];\n }\n else {\n json.type = \"null\";\n }\n};\nexport const undefinedProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Undefined cannot be represented in JSON Schema\");\n};\nexport const voidProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Void cannot be represented in JSON Schema\");\n};\nexport const neverProcessor = (_schema, _ctx, json, _params) => {\n json.not = {};\n};\nexport const anyProcessor = (_schema, _ctx, _json, _params) => {\n // empty schema accepts anything\n};\nexport const unknownProcessor = (_schema, _ctx, _json, _params) => {\n // empty schema accepts anything\n};\nexport const dateProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Date cannot be represented in JSON Schema\");\n};\nexport const enumProcessor = (schema, _ctx, json, _params) => {\n const def = schema._zod.def;\n const values = getEnumValues(def.entries);\n // an empty enum accepts nothing, same as z.never()\n if (values.length === 0) {\n json.not = {};\n return;\n }\n // Number enums can have both string and number values\n if (values.every((v) => typeof v === \"number\"))\n json.type = \"number\";\n if (values.every((v) => typeof v === \"string\"))\n json.type = \"string\";\n json.enum = values;\n};\nexport const literalProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n // a literal with no values accepts nothing, same as z.never()\n if (def.values.length === 0) {\n json.not = {};\n return;\n }\n const vals = [];\n for (const val of def.values) {\n if (val === undefined) {\n // a custom schema replaces the whole literal, so there is nothing left to accumulate\n if (handleUnrepresentable(schema, ctx, json, params, \"Literal `undefined` cannot be represented in JSON Schema\"))\n return;\n // otherwise do not add to vals\n }\n else if (typeof val === \"bigint\") {\n if (handleUnrepresentable(schema, ctx, json, params, \"BigInt literals cannot be represented in JSON Schema\"))\n return;\n vals.push(Number(val));\n }\n else {\n vals.push(val);\n }\n }\n if (vals.length === 0) {\n // do nothing (an undefined literal was stripped)\n }\n else if (vals.length === 1) {\n const val = vals[0];\n json.type = val === null ? \"null\" : typeof val;\n if (ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\") {\n json.enum = [val];\n }\n else {\n json.const = val;\n }\n }\n else {\n if (vals.every((v) => typeof v === \"number\"))\n json.type = \"number\";\n if (vals.every((v) => typeof v === \"string\"))\n json.type = \"string\";\n if (vals.every((v) => typeof v === \"boolean\"))\n json.type = \"boolean\";\n if (vals.every((v) => v === null))\n json.type = \"null\";\n json.enum = vals;\n }\n};\nexport const nanProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"NaN cannot be represented in JSON Schema\");\n};\nexport const templateLiteralProcessor = (schema, _ctx, json, _params) => {\n const _json = json;\n const pattern = schema._zod.pattern;\n if (!pattern)\n throw new Error(\"Pattern not found in template literal\");\n _json.type = \"string\";\n _json.pattern = pattern.source;\n};\nexport const fileProcessor = (schema, _ctx, json, _params) => {\n const _json = json;\n _json.type = \"string\";\n _json.format = \"binary\";\n _json.contentEncoding = \"binary\";\n const { minimum, maximum, mime } = aggregateChecks(schema);\n if (minimum !== undefined)\n _json.minLength = minimum;\n if (maximum !== undefined)\n _json.maxLength = maximum;\n if (!mime)\n return;\n // an empty intersection means the mime checks share no value, so nothing passes at runtime; `anyOf` must be non-empty, so the false schema is `not: {}`\n if (mime.length === 0)\n _json.not = {};\n else if (mime.length === 1)\n _json.contentMediaType = mime[0];\n // only contentMediaType differs, so the shared props stay at the root\n else\n _json.anyOf = mime.map((m) => ({ contentMediaType: m }));\n};\nexport const successProcessor = (_schema, _ctx, json, _params) => {\n json.type = \"boolean\";\n};\nexport const customProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Custom types cannot be represented in JSON Schema\");\n};\nexport const functionProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Function types cannot be represented in JSON Schema\");\n};\nexport const transformProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Transforms cannot be represented in JSON Schema\");\n};\nexport const mapProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Map cannot be represented in JSON Schema\");\n};\nexport const setProcessor = (schema, ctx, json, params) => {\n handleUnrepresentable(schema, ctx, json, params, \"Set cannot be represented in JSON Schema\");\n};\n// ==================== COMPOSITE TYPE PROCESSORS ====================\nexport const arrayProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n const { minimum, maximum } = aggregateChecks(schema);\n if (typeof minimum === \"number\")\n json.minItems = minimum;\n if (typeof maximum === \"number\")\n json.maxItems = maximum;\n json.type = \"array\";\n json.items = processSchema(def.element, ctx, {\n ...params,\n path: [...params.path, \"items\"],\n });\n};\n// Transform and catch set `optin = \"optional\"` at runtime so the parser lets them observe an\n// absent key, but their declared input type stays required. An input JSON Schema describes the\n// declared type, so resolve past them to the schema that actually carries the optionality.\n// Used by both `objectProcessor` (for `required`) and `tupleProcessor` (for `minItems`); see\n// wiki/optionality.md, \"The JSON Schema emitter reads the *static* value\".\nfunction inputOptin(schema) {\n const def = schema._zod.def;\n if (def.type === \"pipe\" && def.in._zod.traits.has(\"$ZodTransform\")) {\n return inputOptin(def.out);\n }\n if (def.type === \"catch\") {\n return inputOptin(def.innerType);\n }\n return schema._zod.optin;\n}\nexport const objectProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n const shape = def.shape;\n // dropping it while still emitting `additionalProperties: false` would emit a schema that rejects data this one requires\n const symbolKeys = Object.getOwnPropertySymbols(shape);\n if (symbolKeys.length &&\n handleUnrepresentable(schema, ctx, json, params, \"Symbol keys cannot be represented in JSON Schema\")) {\n return;\n }\n json.type = \"object\";\n json.properties = {};\n for (const key in shape) {\n // assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into\n assignProp(json.properties, key, processSchema(shape[key], ctx, {\n ...params,\n path: [...params.path, \"properties\", key],\n }));\n }\n // required keys\n const requiredKeys = [];\n for (const key of Object.keys(shape)) {\n const field = def.shape[key];\n if (ctx.io === \"input\" ? inputOptin(field) === undefined : field._zod.optout === undefined) {\n requiredKeys.push(key);\n }\n }\n if (requiredKeys.length > 0) {\n json.required = requiredKeys;\n }\n // catchall\n if (def.catchall?._zod.def.type === \"never\") {\n // strict\n json.additionalProperties = false;\n }\n else if (!def.catchall) {\n // regular\n if (ctx.io === \"output\")\n json.additionalProperties = false;\n }\n else if (def.catchall) {\n json.additionalProperties = processSchema(def.catchall, ctx, {\n ...params,\n path: [...params.path, \"additionalProperties\"],\n });\n }\n};\nexport const unionProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n // Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions\n const isExclusive = def.inclusive === false;\n const options = def.options.map((x, i) => processSchema(x, ctx, {\n ...params,\n path: [...params.path, isExclusive ? \"oneOf\" : \"anyOf\", i],\n }));\n if (isExclusive) {\n json.oneOf = options;\n }\n else {\n json.anyOf = options;\n }\n};\nexport const intersectionProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n const a = processSchema(def.left, ctx, {\n ...params,\n path: [...params.path, \"allOf\", 0],\n });\n const b = processSchema(def.right, ctx, {\n ...params,\n path: [...params.path, \"allOf\", 1],\n });\n const isSimpleIntersection = (val) => \"allOf\" in val && Object.keys(val).length === 1;\n const allOf = [\n ...(isSimpleIntersection(a) ? a.allOf : [a]),\n ...(isSimpleIntersection(b) ? b.allOf : [b]),\n ];\n json.allOf = allOf;\n // Recorded innermost first, so a nested intersection has already folded by the time this one is considered. The array is the handle rather than the schema, because a wrapper that inherits this schema shares the same array; `finalize` folds every object holding it. See `foldIntersection`.\n ctx.intersections.push(allOf);\n};\nexport const tupleProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n json.type = \"array\";\n const prefixPath = ctx.target === \"draft-2020-12\" ? \"prefixItems\" : \"items\";\n const restPath = ctx.target === \"draft-2020-12\" ? \"items\" : ctx.target === \"openapi-3.0\" ? \"items\" : \"additionalItems\";\n const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {\n ...params,\n path: [...params.path, prefixPath, i],\n }));\n const rest = def.rest\n ? processSchema(def.rest, ctx, {\n ...params,\n path: [...params.path, restPath, ...(ctx.target === \"openapi-3.0\" ? [def.items.length] : [])],\n })\n : null;\n let minItems = def.items.length;\n while (minItems > 0) {\n const item = def.items[minItems - 1];\n const optional = ctx.io === \"input\" ? inputOptin(item) !== undefined : item._zod.optout === \"optional\";\n if (!optional)\n break;\n minItems--;\n }\n const maxItems = def.items.length;\n const isClosed = !def.rest;\n if (ctx.target === \"draft-2020-12\") {\n json.prefixItems = prefixItems;\n if (isClosed) {\n json.items = false;\n }\n else if (rest) {\n json.items = rest;\n }\n if (minItems > 0)\n json.minItems = minItems;\n if (isClosed)\n json.maxItems = maxItems;\n }\n else if (ctx.target === \"openapi-3.0\") {\n json.items = {\n anyOf: prefixItems,\n };\n if (rest) {\n json.items.anyOf.push(rest);\n }\n if (minItems > 0)\n json.minItems = minItems;\n if (isClosed)\n json.maxItems = maxItems;\n }\n else {\n json.items = prefixItems;\n if (isClosed) {\n json.additionalItems = false;\n }\n else if (rest) {\n json.additionalItems = rest;\n }\n if (minItems > 0)\n json.minItems = minItems;\n if (isClosed)\n json.maxItems = maxItems;\n }\n // explicit user-defined length checks take precedence\n const { minimum, maximum } = aggregateChecks(schema);\n if (typeof minimum === \"number\")\n json.minItems = minimum;\n if (typeof maximum === \"number\")\n json.maxItems = maximum;\n};\n/** JSON object keys are always strings, so a numeric record key schema is re-expressed over the\n * numeric-string form the record parser matches. Deferred to `finalize`, after the flatten: a key\n * behind a wrapper only carries its own `type` before then, and a union key only has its branches.\n *\n * A numeric bound cannot apply to a property name, so `minimum` and its siblings are dropped rather\n * than carried over: keeping them beside `type: \"string\"` reproduces the match-nothing schema this\n * exists to fix. A key that carries one therefore emits wider than the record parses — `z.record(z.number().min(5), V)`\n * accepts `\"3\"` — which is the deliberate trade, since throwing on it would reject an ordinary schema\n * outright. */\nfunction stringifyKeyNames(bySchema, json, visited) {\n // an extracted key that rewrites cannot go on sharing its definition — the string form a key position needs is not the number form every other reference wants — so it inlines. One that does not rewrite keeps the `$ref`.\n if (json.$ref) {\n // a recursive key holds its own reference inside its definition, so a node already on the path is left alone rather than resolved again\n if (visited.has(json))\n return json;\n visited.add(json);\n const def = bySchema.get(json)?.def;\n if (!def)\n return json;\n const inlined = stringifyKeyNames(bySchema, def, visited);\n return inlined === def ? json : inlined;\n }\n for (const keyword of [\"anyOf\", \"oneOf\"]) {\n const branches = json[keyword];\n if (!Array.isArray(branches))\n continue;\n const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));\n // rebuilding regardless would detach a key that had nothing to re-express, dropping its `$ref` and leaking the internal `id`\n if (mapped.some((branch, i) => branch !== branches[i]))\n json = { ...json, [keyword]: mapped };\n }\n // a member that already admits a string leaves the key unconstrained, so the node's own type re-expresses only when every member is numeric\n const types = Array.isArray(json.type) ? json.type : [json.type];\n const numericType = !types.includes(\"string\") && types.some((t) => t === \"number\" || t === \"integer\");\n // a heterogeneous key carries no type at all, so its numeric members are caught here instead\n const values = json.enum ?? (json.const !== undefined ? [json.const] : undefined);\n if (!numericType && !values?.some((v) => typeof v === \"number\"))\n return json;\n const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;\n if (rest.enum)\n rest.enum = rest.enum.map((v) => (typeof v === \"number\" ? String(v) : v));\n else if (typeof rest.const === \"number\")\n rest.const = String(rest.const);\n // a heterogeneous key keeps its absent type: the stringified members already say what a key may be\n if (!numericType)\n return rest;\n rest.type = \"string\";\n if (!values)\n rest.pattern = (types.includes(\"number\") ? regexes.number : regexes.integer).source;\n return rest;\n}\n/** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */\nconst pendingRecords = new WeakMap();\nfunction rewriteKeyNames(ctx) {\n // an extracted key is resolved by the object `extractToDef` left in its place, so the map is built once rather than searched per reference. `_zod.toJSONSchema` can hand the same object to two schemas, so the first entry carrying a body wins, as a search would have found it.\n const bySchema = new Map();\n for (const entry of ctx.seen.values()) {\n if (entry.def && !bySchema.has(entry.schema))\n bySchema.set(entry.schema, entry);\n }\n const rewrites = new Map();\n for (const record of pendingRecords.get(ctx) ?? []) {\n const seen = ctx.seen.get(record);\n const names = (seen?.def ?? seen?.schema)?.propertyNames;\n if (!names || names === true || rewrites.has(names))\n continue;\n const rewritten = stringifyKeyNames(bySchema, names, new Set());\n if (rewritten !== names)\n rewrites.set(names, rewritten);\n }\n if (!rewrites.size)\n return;\n // the flatten has already copied each record's own properties onto every wrapper by reference, and an extracted body is another such copy, so every carrier holding a rewritten key is updated together\n for (const entry of ctx.seen.values()) {\n for (const carrier of [entry.schema, entry.def]) {\n const rewritten = carrier && rewrites.get(carrier.propertyNames);\n if (rewritten)\n carrier.propertyNames = rewritten;\n }\n }\n}\nexport const recordProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n json.type = \"object\";\n // For looseRecord with regex patterns, use patternProperties. This correctly represents \"only validate keys matching the pattern\" semantics and composes well with allOf (intersections)\n const keyType = def.keyType;\n const patterns = aggregateChecks(keyType).patterns;\n if (def.mode === \"loose\" && patterns && patterns.size > 0) {\n // Use patternProperties for looseRecord with regex patterns\n const valueSchema = processSchema(def.valueType, ctx, {\n ...params,\n path: [...params.path, \"patternProperties\", \"*\"],\n });\n json.patternProperties = {};\n for (const pattern of patterns) {\n assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);\n }\n }\n else {\n // Default behavior: use propertyNames + additionalProperties\n if (ctx.target === \"draft-07\" || ctx.target === \"draft-2020-12\") {\n json.propertyNames = processSchema(def.keyType, ctx, {\n ...params,\n path: [...params.path, \"propertyNames\"],\n });\n let pending = pendingRecords.get(ctx);\n if (!pending) {\n pending = [];\n pendingRecords.set(ctx, pending);\n ctx.deferred.push(() => rewriteKeyNames(ctx));\n }\n pending.push(schema);\n }\n json.additionalProperties = processSchema(def.valueType, ctx, {\n ...params,\n path: [...params.path, \"additionalProperties\"],\n });\n }\n // Add required for keys with discrete values (enum, literal, etc.)\n const keyValues = keyType._zod.values;\n // Every key shares one value schema, so an optional-in value makes the whole key set omittable on input. Output keeps them: the exhaustive branch assigns every key, even one whose value came back undefined.\n const omittableOnInput = ctx.io === \"input\" && inputOptin(def.valueType) !== undefined;\n if (keyValues && !def.partial && !omittableOnInput) {\n const validKeyValues = [...keyValues].filter((v) => typeof v === \"string\" || typeof v === \"number\");\n if (validKeyValues.length > 0) {\n json.required = validKeyValues.map(String);\n }\n }\n};\nexport const nullableProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n const inner = processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n if (ctx.target === \"openapi-3.0\") {\n seen.ref = def.innerType;\n json.nullable = true;\n }\n else {\n json.anyOf = [inner, { type: \"null\" }];\n }\n};\nexport const nonoptionalProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\n/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.\n * A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other\n * unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */\nconst UNREPRESENTABLE_DEFAULT = Symbol();\nfunction serializeDefaultValue(value, schema, ctx, json, params) {\n let unrepresentable = false;\n const serialized = JSON.stringify(value, (_, val) => {\n if (typeof val !== \"bigint\")\n return val;\n unrepresentable = true;\n return null;\n });\n if (!unrepresentable)\n return JSON.parse(serialized);\n handleUnrepresentable(schema, ctx, json, params, \"BigInt defaults cannot be represented in JSON Schema\");\n return UNREPRESENTABLE_DEFAULT;\n}\nexport const defaultProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);\n if (value !== UNREPRESENTABLE_DEFAULT)\n json.default = value;\n};\nexport const prefaultProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n if (ctx.io !== \"input\")\n return;\n const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);\n if (value !== UNREPRESENTABLE_DEFAULT)\n json._prefault = value;\n};\nexport const catchProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n let catchValue;\n try {\n catchValue = def.catchValue(undefined);\n }\n catch {\n handleUnrepresentable(schema, ctx, json, params, \"Dynamic catch values are not supported in JSON Schema\");\n return;\n }\n json.default = catchValue;\n};\nexport const pipeProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n const inIsTransform = def.in._zod.traits.has(\"$ZodTransform\");\n const innerType = ctx.io === \"input\" ? (inIsTransform ? def.out : def.in) : def.out;\n processSchema(innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = innerType;\n};\nexport const readonlyProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n json.readOnly = true;\n};\nexport const promiseProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\nexport const optionalProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n processSchema(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\nexport const lazyProcessor = (schema, ctx, _json, params) => {\n const innerType = schema._zod.innerType;\n processSchema(innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = innerType;\n};\n// ==================== ALL PROCESSORS ====================\nexport const allProcessors = {\n string: stringProcessor,\n number: numberProcessor,\n boolean: booleanProcessor,\n bigint: bigintProcessor,\n symbol: symbolProcessor,\n null: nullProcessor,\n undefined: undefinedProcessor,\n void: voidProcessor,\n never: neverProcessor,\n any: anyProcessor,\n unknown: unknownProcessor,\n date: dateProcessor,\n enum: enumProcessor,\n literal: literalProcessor,\n nan: nanProcessor,\n template_literal: templateLiteralProcessor,\n file: fileProcessor,\n success: successProcessor,\n custom: customProcessor,\n function: functionProcessor,\n transform: transformProcessor,\n map: mapProcessor,\n set: setProcessor,\n array: arrayProcessor,\n object: objectProcessor,\n union: unionProcessor,\n intersection: intersectionProcessor,\n tuple: tupleProcessor,\n record: recordProcessor,\n nullable: nullableProcessor,\n nonoptional: nonoptionalProcessor,\n default: defaultProcessor,\n prefault: prefaultProcessor,\n catch: catchProcessor,\n pipe: pipeProcessor,\n readonly: readonlyProcessor,\n promise: promiseProcessor,\n optional: optionalProcessor,\n lazy: lazyProcessor,\n};\nexport function toJSONSchema(input, params) {\n if (\"_idmap\" in input) {\n // Registry case\n const registry = input;\n const ctx = initializeContext({ ...params, processors: allProcessors });\n const defs = {};\n // First pass: process all schemas to build the seen map\n for (const entry of registry._idmap.entries()) {\n const [_, schema] = entry;\n processSchema(schema, ctx);\n }\n const schemas = {};\n const external = {\n registry,\n uri: params?.uri,\n defs,\n };\n // Update the context with external configuration\n ctx.external = external;\n // Second pass: emit each schema\n for (const entry of registry._idmap.entries()) {\n const [key, schema] = entry;\n extractDefs(ctx, schema);\n assignProp(schemas, key, finalize(ctx, schema));\n }\n if (Object.keys(defs).length > 0) {\n const defsSegment = ctx.target === \"draft-2020-12\" ? \"$defs\" : \"definitions\";\n schemas.__shared = {\n [defsSegment]: defs,\n };\n }\n return { schemas };\n }\n // Single schema case\n const ctx = initializeContext({ ...params, processors: allProcessors });\n processSchema(input, ctx);\n extractDefs(ctx, input);\n return finalize(ctx, input);\n}\n"],"names":["narrowMin","agg","key","value","narrowMax","narrowBoth","addDivisor","addPattern","pattern","intersectMime","mime","m","setFormat","format","minContributor","def","maxContributor","formatContributor","ranges","minimum","maximum","contributors","NUMBER_FORMAT_RANGES","BIGINT_FORMAT_RANGES","aggregateChecks","schema","list","ch","bag","formatMap","exactPatterns","base64Charset","regexes.base64","base64urlCharset","regexes.base64url","exactPattern","p","stringProcessor","ctx","_json","_params","json","patterns","contentEncoding","laxFormat","patternList","regex","numberProcessor","params","multipleOf","exclusiveMaximum","exclusiveMinimum","isInt","exMin","exMax","legacy","divisors","divisor","handleUnrepresentable","first","rest","booleanProcessor","_schema","_ctx","neverProcessor","anyProcessor","unknownProcessor","enumProcessor","values","getEnumValues","v","customProcessor","transformProcessor","arrayProcessor","processSchema","inputOptin","objectProcessor","shape","assignProp","requiredKeys","field","unionProcessor","isExclusive","options","x","i","intersectionProcessor","a","b","isSimpleIntersection","val","allOf","stringifyKeyNames","bySchema","visited","inlined","keyword","branches","mapped","branch","types","numericType","t","id","regexes.number","regexes.integer","pendingRecords","rewriteKeyNames","entry","rewrites","record","seen","names","rewritten","carrier","recordProcessor","keyType","valueSchema","pending","keyValues","omittableOnInput","validKeyValues","nullableProcessor","inner","nonoptionalProcessor","UNREPRESENTABLE_DEFAULT","serializeDefaultValue","unrepresentable","serialized","_","defaultProcessor","prefaultProcessor","catchProcessor","catchValue","pipeProcessor","inIs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GAAQa,GAAKC,GAAOS,MAAW;AACzD,QAAMjC,IAAMU,EAAO,KAAK,KAClB8G,IAAgBxH,EAAI,GAAG,KAAK,OAAO,IAAI,eAAe,GACtDyH,IAAYlG,EAAI,OAAO,UAAWiG,IAAgBxH,EAAI,MAAMA,EAAI,KAAMA,EAAI;AAChF,EAAA2D,EAAc8D,GAAWlG,GAAKU,CAAM;AACpC,QAAM+D,IAAOzE,EAAI,KAAK,IAAIb,CAAM;AAChC,EAAAsF,EAAK,MAAMyB;AACf,GACaC,KAAoB,CAAChH,GAAQa,GAAKG,GAAMO,MAAW;AAC5D,QAAMjC,IAAMU,EAAO,KAAK;AACxB,EAAAiD,EAAc3D,EAAI,WAAWuB,GAAKU,CAAM;AACxC,QAAM+D,IAAOzE,EAAI,KAAK,IAAIb,CAAM;AAChC,EAAAsF,EAAK,MAAMhG,EAAI,WACf0B,EAAK,WAAW;AACpB,GAOaiG,KAAoB,CAACjH,GAAQa,GAAKC,GAAOS,MAAW;AAC7D,QAAMjC,IAAMU,EAAO,KAAK;AACxB,EAAAiD,EAAc3D,EAAI,WAAWuB,GAAKU,CAAM;AACxC,QAAM+D,IAAOzE,EAAI,KAAK,IAAIb,CAAM;AAChC,EAAAsF,EAAK,MAAMhG,EAAI;AACnB;","x_google_ignoreList":[0]}
@@ -0,0 +1,203 @@
1
+ import { rawShape as R } from "./util.js";
2
+ class A extends Error {
3
+ constructor() {
4
+ super("Cannot parse a reference cycle that closes through a transform"), this.name = "ZodCyclicError";
5
+ }
6
+ }
7
+ const S = "~memo", O = [];
8
+ function T(e) {
9
+ return e !== null && typeof e == "object";
10
+ }
11
+ function E(e) {
12
+ return e.map((s) => s.path ? { ...s, path: s.path.slice() } : { ...s });
13
+ }
14
+ const j = /* @__PURE__ */ new WeakMap(), g = 0, w = 1, _ = 2;
15
+ function y(e, s, c) {
16
+ const i = j.get(e);
17
+ if (i !== void 0)
18
+ return i ? _ : g;
19
+ if (s.has(e))
20
+ return _;
21
+ s.add(e);
22
+ let a = g;
23
+ const n = (t) => {
24
+ if (a !== _ && t?._zod) {
25
+ const u = y(t, s);
26
+ u > a && (a = u);
27
+ }
28
+ }, d = (t, u) => {
29
+ let o = g;
30
+ for (const f of Reflect.ownKeys(t)) {
31
+ const k = Object.getOwnPropertyDescriptor(t, f);
32
+ if (!k.enumerable)
33
+ continue;
34
+ const p = k.get ? w : k.value?._zod ? y(k.value, s) : g;
35
+ p > o && (o = p);
36
+ }
37
+ return o;
38
+ }, b = (t) => {
39
+ t > a && (a = t);
40
+ }, r = e._zod.def;
41
+ switch (r.type) {
42
+ case "object": {
43
+ const t = R(r);
44
+ b(t ? d(t) : w), n(r.catchall);
45
+ break;
46
+ }
47
+ case "array":
48
+ n(r.element);
49
+ break;
50
+ case "tuple":
51
+ for (const t of r.items)
52
+ n(t);
53
+ n(r.rest);
54
+ break;
55
+ case "record":
56
+ case "map":
57
+ n(r.keyType), n(r.valueType);
58
+ break;
59
+ case "set":
60
+ n(r.valueType);
61
+ break;
62
+ case "union":
63
+ for (const t of r.options)
64
+ n(t);
65
+ break;
66
+ case "intersection":
67
+ n(r.left), n(r.right);
68
+ break;
69
+ case "optional":
70
+ case "nullable":
71
+ case "default":
72
+ case "prefault":
73
+ case "catch":
74
+ case "readonly":
75
+ case "nonoptional":
76
+ case "promise":
77
+ case "success":
78
+ n(r.innerType);
79
+ break;
80
+ case "pipe":
81
+ n(r.in), n(r.out);
82
+ break;
83
+ case "function":
84
+ n(r.input), n(r.output);
85
+ break;
86
+ // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
87
+ case "lazy": {
88
+ const t = r._cachedInner ?? void 0;
89
+ b(t ? y(t, s) : w);
90
+ break;
91
+ }
92
+ // a leaf by choice: `parts` are regex fragments, not data positions
93
+ case "template_literal":
94
+ // leaves
95
+ case "string":
96
+ case "number":
97
+ case "int":
98
+ case "boolean":
99
+ case "bigint":
100
+ case "symbol":
101
+ case "undefined":
102
+ case "null":
103
+ case "void":
104
+ case "never":
105
+ case "any":
106
+ case "unknown":
107
+ case "date":
108
+ case "nan":
109
+ case "enum":
110
+ case "literal":
111
+ case "file":
112
+ case "transform":
113
+ case "custom":
114
+ break;
115
+ default:
116
+ for (const t in r) {
117
+ const u = Object.getOwnPropertyDescriptor(r, t);
118
+ if (!u || u.get)
119
+ continue;
120
+ const o = u.value;
121
+ if (!(!o || typeof o != "object")) {
122
+ if (o._zod)
123
+ n(o);
124
+ else if (Array.isArray(o))
125
+ for (const f of o)
126
+ n(f);
127
+ }
128
+ }
129
+ }
130
+ return s.delete(e), C(e, a);
131
+ }
132
+ function C(e, s) {
133
+ return s !== w && j.set(e, s === _), s;
134
+ }
135
+ function I(e, s) {
136
+ let c = e.buckets.get(s);
137
+ return c || (c = /* @__PURE__ */ new WeakMap(), e.buckets.set(s, c)), c;
138
+ }
139
+ let z;
140
+ const v = [], M = {
141
+ alloc(e, s, c) {
142
+ const i = z;
143
+ if (!i)
144
+ return c;
145
+ z = void 0;
146
+ const a = { value: c, issues: null };
147
+ return i.set(s.value, a), v.push(a), c;
148
+ },
149
+ guard(e) {
150
+ var s;
151
+ (s = e._zod).deferred ?? (s.deferred = []), e._zod.deferred.push(() => {
152
+ const c = e._zod.parse, i = (a, n) => {
153
+ if (n.direction !== "backward" && N(n, a.value))
154
+ throw new A();
155
+ return c(a, n);
156
+ };
157
+ e._zod.parse = i, e._zod.run === c && (e._zod.run = i);
158
+ });
159
+ },
160
+ attach(e) {
161
+ var s;
162
+ let c, i = !1, a, n;
163
+ (s = e._zod).deferred ?? (s.deferred = []), e._zod.deferred.push(() => {
164
+ const d = e._zod.parse, b = (r, l) => {
165
+ if (c === void 0) {
166
+ const h = y(e, /* @__PURE__ */ new Set());
167
+ if (h === g)
168
+ return e._zod.parse = d, e._zod.run === b && (e._zod.run = d), d(r, l);
169
+ h === _ || i ? c = !0 : i = !0;
170
+ }
171
+ const t = r.value;
172
+ if (!T(t))
173
+ return d(r, l);
174
+ let u = l[S];
175
+ u || (u = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0 }, l[S] = u);
176
+ let o;
177
+ a === l ? o = n : (o = I(u, e), a = l, n = o);
178
+ const f = o.get(t);
179
+ if (f)
180
+ return r.value = f.value, f.issues ? f.issues.length && r.issues.push(...E(f.issues)) : (r.memo = !0, u.backEdges ?? (u.backEdges = /* @__PURE__ */ new WeakSet()), u.backEdges.add(f.value)), r;
181
+ z = o;
182
+ const k = v.length, p = d(r, l);
183
+ z = void 0;
184
+ const m = v.length > k ? v.pop() : void 0;
185
+ return p instanceof Promise ? p.then((h) => (m && (m.issues = h.issues.length ? E(h.issues) : O), h)) : (m && (m.issues = p.issues.length ? E(p.issues) : O), p);
186
+ };
187
+ e._zod.parse = b, e._zod.run === d && (e._zod.run = b);
188
+ });
189
+ }
190
+ };
191
+ function W() {
192
+ return M;
193
+ }
194
+ function N(e, s) {
195
+ const c = e[S]?.backEdges;
196
+ return c !== void 0 && T(s) && c.has(s);
197
+ }
198
+ export {
199
+ A as $ZodCyclicError,
200
+ N as isBackEdge,
201
+ W as memoizer
202
+ };
203
+ //# sourceMappingURL=memoizer.js.map