@loopstack/loopstack-studio 0.23.1 → 0.24.0

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 (62) hide show
  1. package/dist/api/index.js +12 -10
  2. package/dist/api/secrets.js +16 -0
  3. package/dist/components/dynamic-form/ArrayController.js +68 -64
  4. package/dist/components/dynamic-form/Form.js +46 -40
  5. package/dist/components/dynamic-form/FormElement.js +1 -1
  6. package/dist/components/dynamic-form/FormElementHeader.js +2 -2
  7. package/dist/components/dynamic-form/ObjectController.js +24 -21
  8. package/dist/components/dynamic-form/fields/BaseFieldWrapper.js +1 -1
  9. package/dist/components/dynamic-form/fields/InputField.js +20 -19
  10. package/dist/components/dynamic-form/fields/RadioField.js +18 -18
  11. package/dist/components/dynamic-form/fields/SelectField.js +19 -19
  12. package/dist/components/dynamic-form/fields/TextareaField.js +17 -17
  13. package/dist/components/layout/MainLayout.js +18 -31
  14. package/dist/components/layout/StudioSidebar.js +168 -108
  15. package/dist/components/page/PageBreadcrumbs.js +79 -32
  16. package/dist/components/ui-widgets/UiWidget.js +36 -27
  17. package/dist/components/ui-widgets/widgets/SecretInput.js +42 -0
  18. package/dist/features/code-explorer/components/FileContentViewer.js +47 -30
  19. package/dist/features/documents/components/DocumentList.js +5 -1
  20. package/dist/features/documents/renderers/AiMessage.js +11 -11
  21. package/dist/features/documents/renderers/DocumentFormRenderer.js +17 -11
  22. package/dist/features/workbench/components/WorkbenchFilesPanel.js +32 -25
  23. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +57 -49
  24. package/dist/features/workbench/components/WorkbenchIconSidebar.js +46 -34
  25. package/dist/features/workbench/components/WorkbenchSecretsPanel.js +182 -0
  26. package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +132 -117
  27. package/dist/hooks/index.js +1 -1
  28. package/dist/hooks/query-keys.js +41 -34
  29. package/dist/hooks/useSecrets.js +69 -0
  30. package/dist/index.d.ts +43 -0
  31. package/dist/index.js +2 -2
  32. package/dist/pages/DashboardPage.js +87 -35
  33. package/dist/pages/EmbedWorkbenchPage.js +43 -39
  34. package/dist/types/ai.types.js +13 -0
  35. package/package.json +2 -3
  36. package/dist/node_modules/@ai-sdk/provider/dist/index.js +0 -65
  37. package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -1008
  38. package/dist/node_modules/ai/dist/index.js +0 -1083
  39. package/dist/node_modules/zod/v3/ZodError.js +0 -79
  40. package/dist/node_modules/zod/v3/errors.js +0 -6
  41. package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -5
  42. package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -90
  43. package/dist/node_modules/zod/v3/helpers/util.js +0 -72
  44. package/dist/node_modules/zod/v3/locales/en.js +0 -58
  45. package/dist/node_modules/zod/v3/types.js +0 -2425
  46. package/dist/node_modules/zod/v4/classic/errors.js +0 -21
  47. package/dist/node_modules/zod/v4/classic/iso.js +0 -29
  48. package/dist/node_modules/zod/v4/classic/parse.js +0 -4
  49. package/dist/node_modules/zod/v4/classic/schemas.js +0 -392
  50. package/dist/node_modules/zod/v4/core/api.js +0 -532
  51. package/dist/node_modules/zod/v4/core/checks.js +0 -283
  52. package/dist/node_modules/zod/v4/core/core.js +0 -44
  53. package/dist/node_modules/zod/v4/core/doc.js +0 -21
  54. package/dist/node_modules/zod/v4/core/errors.js +0 -40
  55. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -305
  56. package/dist/node_modules/zod/v4/core/parse.js +0 -66
  57. package/dist/node_modules/zod/v4/core/regexes.js +0 -28
  58. package/dist/node_modules/zod/v4/core/registries.js +0 -38
  59. package/dist/node_modules/zod/v4/core/schemas.js +0 -863
  60. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -220
  61. package/dist/node_modules/zod/v4/core/util.js +0 -267
  62. package/dist/node_modules/zod/v4/core/versions.js +0 -6
@@ -1,1008 +0,0 @@
1
- import { AISDKError, InvalidArgumentError, JSONParseError, TypeValidationError } from "../../provider/dist/index.js";
2
- import { toJSONSchema } from "../../../zod/v4/core/json-schema-processors.js";
3
- import { safeParseAsync } from "../../../zod/v4/classic/parse.js";
4
- import { ZodFirstPartyTypeKind } from "../../../zod/v3/types.js";
5
- var { btoa, atob } = globalThis, name = "AI_DownloadError", marker = `vercel.ai.error.${name}`, symbol = Symbol.for(marker), _a, _b, DownloadError = class extends (_b = AISDKError, _a = symbol, _b) {
6
- constructor({ url: g, statusCode: G, statusText: K, cause: q, message: J = q == null ? `Failed to download ${g}: ${G} ${K}` : `Failed to download ${g}: ${q}` }) {
7
- super({
8
- name,
9
- message: J,
10
- cause: q
11
- }), this[_a] = !0, this.url = g, this.statusCode = G, this.statusText = K;
12
- }
13
- static isInstance(G) {
14
- return AISDKError.hasMarker(G, marker);
15
- }
16
- }, DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
17
- async function readResponseWithSizeLimit({ response: g, url: G, maxBytes: K = DEFAULT_MAX_DOWNLOAD_SIZE }) {
18
- let q = g.headers.get("content-length");
19
- if (q != null) {
20
- let g = parseInt(q, 10);
21
- if (!isNaN(g) && g > K) throw new DownloadError({
22
- url: G,
23
- message: `Download of ${G} exceeded maximum size of ${K} bytes (Content-Length: ${g}).`
24
- });
25
- }
26
- let J = g.body;
27
- if (J == null) return new Uint8Array();
28
- let Y = J.getReader(), X = [], Z = 0;
29
- try {
30
- for (;;) {
31
- let { done: g, value: q } = await Y.read();
32
- if (g) break;
33
- if (Z += q.length, Z > K) throw new DownloadError({
34
- url: G,
35
- message: `Download of ${G} exceeded maximum size of ${K} bytes.`
36
- });
37
- X.push(q);
38
- }
39
- } finally {
40
- try {
41
- await Y.cancel();
42
- } finally {
43
- Y.releaseLock();
44
- }
45
- }
46
- let Q = new Uint8Array(Z), $ = 0;
47
- for (let g of X) Q.set(g, $), $ += g.length;
48
- return Q;
49
- }
50
- var createIdGenerator = ({ prefix: g, size: K = 16, alphabet: q = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: J = "-" } = {}) => {
51
- let Y = () => {
52
- let g = q.length, G = Array(K);
53
- for (let J = 0; J < K; J++) G[J] = q[Math.random() * g | 0];
54
- return G.join("");
55
- };
56
- if (g == null) return Y;
57
- if (q.includes(J)) throw new InvalidArgumentError({
58
- argument: "separator",
59
- message: `The separator "${J}" must not be part of the alphabet "${q}".`
60
- });
61
- return () => `${g}${J}${Y()}`;
62
- };
63
- createIdGenerator();
64
- function getRuntimeEnvironmentUserAgent(g = globalThis) {
65
- return g.window ? "runtime/browser" : g.navigator?.userAgent ? `runtime/${g.navigator.userAgent.toLowerCase()}` : g.process?.versions?.node ? `runtime/node.js/${g.process.version.substring(0)}` : g.EdgeRuntime ? "runtime/vercel-edge" : "runtime/unknown";
66
- }
67
- function normalizeHeaders(g) {
68
- if (g == null) return {};
69
- let G = {};
70
- if (g instanceof Headers) g.forEach((g, K) => {
71
- G[K.toLowerCase()] = g;
72
- });
73
- else {
74
- Array.isArray(g) || (g = Object.entries(g));
75
- for (let [K, q] of g) q != null && (G[K.toLowerCase()] = q);
76
- }
77
- return G;
78
- }
79
- function withUserAgentSuffix(g, ...G) {
80
- let K = new Headers(normalizeHeaders(g)), q = K.get("user-agent") || "";
81
- return K.set("user-agent", [q, ...G].filter(Boolean).join(" ")), Object.fromEntries(K.entries());
82
- }
83
- var suspectProtoRx = /"__proto__"\s*:/, suspectConstructorRx = /"constructor"\s*:/;
84
- function _parse(g) {
85
- let G = JSON.parse(g);
86
- return typeof G != "object" || !G || suspectProtoRx.test(g) === !1 && suspectConstructorRx.test(g) === !1 ? G : filter(G);
87
- }
88
- function filter(g) {
89
- let G = [g];
90
- for (; G.length;) {
91
- let g = G;
92
- G = [];
93
- for (let K of g) {
94
- if (Object.prototype.hasOwnProperty.call(K, "__proto__") || Object.prototype.hasOwnProperty.call(K, "constructor") && Object.prototype.hasOwnProperty.call(K.constructor, "prototype")) throw SyntaxError("Object contains forbidden prototype property");
95
- for (let g in K) {
96
- let q = K[g];
97
- q && typeof q == "object" && G.push(q);
98
- }
99
- }
100
- }
101
- return g;
102
- }
103
- function secureJsonParse(g) {
104
- let { stackTraceLimit: G } = Error;
105
- try {
106
- Error.stackTraceLimit = 0;
107
- } catch {
108
- return _parse(g);
109
- }
110
- try {
111
- return _parse(g);
112
- } finally {
113
- Error.stackTraceLimit = G;
114
- }
115
- }
116
- function addAdditionalPropertiesToJsonSchema(g) {
117
- if (g.type === "object" || Array.isArray(g.type) && g.type.includes("object")) {
118
- g.additionalProperties = !1;
119
- let { properties: G } = g;
120
- if (G != null) for (let g of Object.keys(G)) G[g] = visit(G[g]);
121
- }
122
- g.items != null && (g.items = Array.isArray(g.items) ? g.items.map(visit) : visit(g.items)), g.anyOf != null && (g.anyOf = g.anyOf.map(visit)), g.allOf != null && (g.allOf = g.allOf.map(visit)), g.oneOf != null && (g.oneOf = g.oneOf.map(visit));
123
- let { definitions: G } = g;
124
- if (G != null) for (let g of Object.keys(G)) G[g] = visit(G[g]);
125
- return g;
126
- }
127
- function visit(g) {
128
- return typeof g == "boolean" ? g : addAdditionalPropertiesToJsonSchema(g);
129
- }
130
- var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use"), defaultOptions = {
131
- name: void 0,
132
- $refStrategy: "root",
133
- basePath: ["#"],
134
- effectStrategy: "input",
135
- pipeStrategy: "all",
136
- dateStrategy: "format:date-time",
137
- mapStrategy: "entries",
138
- removeAdditionalStrategy: "passthrough",
139
- allowedAdditionalProperties: !0,
140
- rejectedAdditionalProperties: !1,
141
- definitionPath: "definitions",
142
- strictUnions: !1,
143
- definitions: {},
144
- errorMessages: !1,
145
- patternStrategy: "escape",
146
- applyRegexFlags: !1,
147
- emailStrategy: "format:email",
148
- base64Strategy: "contentEncoding:base64",
149
- nameStrategy: "ref"
150
- }, getDefaultOptions = (g) => typeof g == "string" ? {
151
- ...defaultOptions,
152
- name: g
153
- } : {
154
- ...defaultOptions,
155
- ...g
156
- };
157
- function parseAnyDef() {
158
- return {};
159
- }
160
- function parseArrayDef(g, G) {
161
- let K = { type: "array" };
162
- return g.type?._def && g.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny && (K.items = parseDef(g.type._def, {
163
- ...G,
164
- currentPath: [...G.currentPath, "items"]
165
- })), g.minLength && (K.minItems = g.minLength.value), g.maxLength && (K.maxItems = g.maxLength.value), g.exactLength && (K.minItems = g.exactLength.value, K.maxItems = g.exactLength.value), K;
166
- }
167
- function parseBigintDef(g) {
168
- let G = {
169
- type: "integer",
170
- format: "int64"
171
- };
172
- if (!g.checks) return G;
173
- for (let K of g.checks) switch (K.kind) {
174
- case "min":
175
- K.inclusive ? G.minimum = K.value : G.exclusiveMinimum = K.value;
176
- break;
177
- case "max":
178
- K.inclusive ? G.maximum = K.value : G.exclusiveMaximum = K.value;
179
- break;
180
- case "multipleOf":
181
- G.multipleOf = K.value;
182
- break;
183
- }
184
- return G;
185
- }
186
- function parseBooleanDef() {
187
- return { type: "boolean" };
188
- }
189
- function parseBrandedDef(g, G) {
190
- return parseDef(g.type._def, G);
191
- }
192
- var parseCatchDef = (g, G) => parseDef(g.innerType._def, G);
193
- function parseDateDef(g, G, K) {
194
- let q = K ?? G.dateStrategy;
195
- if (Array.isArray(q)) return { anyOf: q.map((K, q) => parseDateDef(g, G, K)) };
196
- switch (q) {
197
- case "string":
198
- case "format:date-time": return {
199
- type: "string",
200
- format: "date-time"
201
- };
202
- case "format:date": return {
203
- type: "string",
204
- format: "date"
205
- };
206
- case "integer": return integerDateParser(g);
207
- }
208
- }
209
- var integerDateParser = (g) => {
210
- let G = {
211
- type: "integer",
212
- format: "unix-time"
213
- };
214
- for (let K of g.checks) switch (K.kind) {
215
- case "min":
216
- G.minimum = K.value;
217
- break;
218
- case "max":
219
- G.maximum = K.value;
220
- break;
221
- }
222
- return G;
223
- };
224
- function parseDefaultDef(g, G) {
225
- return {
226
- ...parseDef(g.innerType._def, G),
227
- default: g.defaultValue()
228
- };
229
- }
230
- function parseEffectsDef(g, G) {
231
- return G.effectStrategy === "input" ? parseDef(g.schema._def, G) : parseAnyDef();
232
- }
233
- function parseEnumDef(g) {
234
- return {
235
- type: "string",
236
- enum: Array.from(g.values)
237
- };
238
- }
239
- var isJsonSchema7AllOfType = (g) => "type" in g && g.type === "string" ? !1 : "allOf" in g;
240
- function parseIntersectionDef(g, G) {
241
- let K = [parseDef(g.left._def, {
242
- ...G,
243
- currentPath: [
244
- ...G.currentPath,
245
- "allOf",
246
- "0"
247
- ]
248
- }), parseDef(g.right._def, {
249
- ...G,
250
- currentPath: [
251
- ...G.currentPath,
252
- "allOf",
253
- "1"
254
- ]
255
- })].filter((g) => !!g), q = [];
256
- return K.forEach((g) => {
257
- if (isJsonSchema7AllOfType(g)) q.push(...g.allOf);
258
- else {
259
- let G = g;
260
- if ("additionalProperties" in g && g.additionalProperties === !1) {
261
- let { additionalProperties: K, ...q } = g;
262
- G = q;
263
- }
264
- q.push(G);
265
- }
266
- }), q.length ? { allOf: q } : void 0;
267
- }
268
- function parseLiteralDef(g) {
269
- let G = typeof g.value;
270
- return G !== "bigint" && G !== "number" && G !== "boolean" && G !== "string" ? { type: Array.isArray(g.value) ? "array" : "object" } : {
271
- type: G === "bigint" ? "integer" : G,
272
- const: g.value
273
- };
274
- }
275
- var emojiRegex = void 0, zodPatterns = {
276
- cuid: /^[cC][^\s-]{8,}$/,
277
- cuid2: /^[0-9a-z]+$/,
278
- ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
279
- email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
280
- emoji: () => (emojiRegex === void 0 && (emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), emojiRegex),
281
- uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
282
- ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
283
- ipv4Cidr: /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,
284
- ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
285
- ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
286
- base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
287
- base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
288
- nanoid: /^[a-zA-Z0-9_-]{21}$/,
289
- jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
290
- };
291
- function parseStringDef(g, G) {
292
- let K = { type: "string" };
293
- if (g.checks) for (let q of g.checks) switch (q.kind) {
294
- case "min":
295
- K.minLength = typeof K.minLength == "number" ? Math.max(K.minLength, q.value) : q.value;
296
- break;
297
- case "max":
298
- K.maxLength = typeof K.maxLength == "number" ? Math.min(K.maxLength, q.value) : q.value;
299
- break;
300
- case "email":
301
- switch (G.emailStrategy) {
302
- case "format:email":
303
- addFormat(K, "email", q.message, G);
304
- break;
305
- case "format:idn-email":
306
- addFormat(K, "idn-email", q.message, G);
307
- break;
308
- case "pattern:zod":
309
- addPattern(K, zodPatterns.email, q.message, G);
310
- break;
311
- }
312
- break;
313
- case "url":
314
- addFormat(K, "uri", q.message, G);
315
- break;
316
- case "uuid":
317
- addFormat(K, "uuid", q.message, G);
318
- break;
319
- case "regex":
320
- addPattern(K, q.regex, q.message, G);
321
- break;
322
- case "cuid":
323
- addPattern(K, zodPatterns.cuid, q.message, G);
324
- break;
325
- case "cuid2":
326
- addPattern(K, zodPatterns.cuid2, q.message, G);
327
- break;
328
- case "startsWith":
329
- addPattern(K, RegExp(`^${escapeLiteralCheckValue(q.value, G)}`), q.message, G);
330
- break;
331
- case "endsWith":
332
- addPattern(K, RegExp(`${escapeLiteralCheckValue(q.value, G)}$`), q.message, G);
333
- break;
334
- case "datetime":
335
- addFormat(K, "date-time", q.message, G);
336
- break;
337
- case "date":
338
- addFormat(K, "date", q.message, G);
339
- break;
340
- case "time":
341
- addFormat(K, "time", q.message, G);
342
- break;
343
- case "duration":
344
- addFormat(K, "duration", q.message, G);
345
- break;
346
- case "length":
347
- K.minLength = typeof K.minLength == "number" ? Math.max(K.minLength, q.value) : q.value, K.maxLength = typeof K.maxLength == "number" ? Math.min(K.maxLength, q.value) : q.value;
348
- break;
349
- case "includes":
350
- addPattern(K, RegExp(escapeLiteralCheckValue(q.value, G)), q.message, G);
351
- break;
352
- case "ip":
353
- q.version !== "v6" && addFormat(K, "ipv4", q.message, G), q.version !== "v4" && addFormat(K, "ipv6", q.message, G);
354
- break;
355
- case "base64url":
356
- addPattern(K, zodPatterns.base64url, q.message, G);
357
- break;
358
- case "jwt":
359
- addPattern(K, zodPatterns.jwt, q.message, G);
360
- break;
361
- case "cidr":
362
- q.version !== "v6" && addPattern(K, zodPatterns.ipv4Cidr, q.message, G), q.version !== "v4" && addPattern(K, zodPatterns.ipv6Cidr, q.message, G);
363
- break;
364
- case "emoji":
365
- addPattern(K, zodPatterns.emoji(), q.message, G);
366
- break;
367
- case "ulid":
368
- addPattern(K, zodPatterns.ulid, q.message, G);
369
- break;
370
- case "base64":
371
- switch (G.base64Strategy) {
372
- case "format:binary":
373
- addFormat(K, "binary", q.message, G);
374
- break;
375
- case "contentEncoding:base64":
376
- K.contentEncoding = "base64";
377
- break;
378
- case "pattern:zod":
379
- addPattern(K, zodPatterns.base64, q.message, G);
380
- break;
381
- }
382
- break;
383
- case "nanoid": addPattern(K, zodPatterns.nanoid, q.message, G);
384
- case "toLowerCase":
385
- case "toUpperCase":
386
- case "trim": break;
387
- default:
388
- }
389
- return K;
390
- }
391
- function escapeLiteralCheckValue(g, G) {
392
- return G.patternStrategy === "escape" ? escapeNonAlphaNumeric(g) : g;
393
- }
394
- var ALPHA_NUMERIC = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
395
- function escapeNonAlphaNumeric(g) {
396
- let G = "";
397
- for (let K = 0; K < g.length; K++) ALPHA_NUMERIC.has(g[K]) || (G += "\\"), G += g[K];
398
- return G;
399
- }
400
- function addFormat(g, G, K, q) {
401
- g.format || g.anyOf?.some((g) => g.format) ? (g.anyOf ||= [], g.format && (g.anyOf.push({ format: g.format }), delete g.format), g.anyOf.push({
402
- format: G,
403
- ...K && q.errorMessages && { errorMessage: { format: K } }
404
- })) : g.format = G;
405
- }
406
- function addPattern(g, G, K, q) {
407
- g.pattern || g.allOf?.some((g) => g.pattern) ? (g.allOf ||= [], g.pattern && (g.allOf.push({ pattern: g.pattern }), delete g.pattern), g.allOf.push({
408
- pattern: stringifyRegExpWithFlags(G, q),
409
- ...K && q.errorMessages && { errorMessage: { pattern: K } }
410
- })) : g.pattern = stringifyRegExpWithFlags(G, q);
411
- }
412
- function stringifyRegExpWithFlags(g, G) {
413
- if (!G.applyRegexFlags || !g.flags) return g.source;
414
- let K = {
415
- i: g.flags.includes("i"),
416
- m: g.flags.includes("m"),
417
- s: g.flags.includes("s")
418
- }, q = K.i ? g.source.toLowerCase() : g.source, J = "", Y = !1, X = !1, Z = !1;
419
- for (let g = 0; g < q.length; g++) {
420
- if (Y) {
421
- J += q[g], Y = !1;
422
- continue;
423
- }
424
- if (K.i) {
425
- if (X) {
426
- if (q[g].match(/[a-z]/)) {
427
- Z ? (J += q[g], J += `${q[g - 2]}-${q[g]}`.toUpperCase(), Z = !1) : q[g + 1] === "-" && q[g + 2]?.match(/[a-z]/) ? (J += q[g], Z = !0) : J += `${q[g]}${q[g].toUpperCase()}`;
428
- continue;
429
- }
430
- } else if (q[g].match(/[a-z]/)) {
431
- J += `[${q[g]}${q[g].toUpperCase()}]`;
432
- continue;
433
- }
434
- }
435
- if (K.m) {
436
- if (q[g] === "^") {
437
- J += "(^|(?<=[\r\n]))";
438
- continue;
439
- } else if (q[g] === "$") {
440
- J += "($|(?=[\r\n]))";
441
- continue;
442
- }
443
- }
444
- if (K.s && q[g] === ".") {
445
- J += X ? `${q[g]}\r
446
- ` : `[${q[g]}\r
447
- ]`;
448
- continue;
449
- }
450
- J += q[g], q[g] === "\\" ? Y = !0 : X && q[g] === "]" ? X = !1 : !X && q[g] === "[" && (X = !0);
451
- }
452
- try {
453
- new RegExp(J);
454
- } catch {
455
- return console.warn(`Could not convert regex pattern at ${G.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`), g.source;
456
- }
457
- return J;
458
- }
459
- function parseRecordDef(g, G) {
460
- let K = {
461
- type: "object",
462
- additionalProperties: parseDef(g.valueType._def, {
463
- ...G,
464
- currentPath: [...G.currentPath, "additionalProperties"]
465
- }) ?? G.allowedAdditionalProperties
466
- };
467
- if (g.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && g.keyType._def.checks?.length) {
468
- let { type: q, ...J } = parseStringDef(g.keyType._def, G);
469
- return {
470
- ...K,
471
- propertyNames: J
472
- };
473
- } else if (g.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) return {
474
- ...K,
475
- propertyNames: { enum: g.keyType._def.values }
476
- };
477
- else if (g.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && g.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && g.keyType._def.type._def.checks?.length) {
478
- let { type: q, ...J } = parseBrandedDef(g.keyType._def, G);
479
- return {
480
- ...K,
481
- propertyNames: J
482
- };
483
- }
484
- return K;
485
- }
486
- function parseMapDef(g, G) {
487
- return G.mapStrategy === "record" ? parseRecordDef(g, G) : {
488
- type: "array",
489
- maxItems: 125,
490
- items: {
491
- type: "array",
492
- items: [parseDef(g.keyType._def, {
493
- ...G,
494
- currentPath: [
495
- ...G.currentPath,
496
- "items",
497
- "items",
498
- "0"
499
- ]
500
- }) || parseAnyDef(), parseDef(g.valueType._def, {
501
- ...G,
502
- currentPath: [
503
- ...G.currentPath,
504
- "items",
505
- "items",
506
- "1"
507
- ]
508
- }) || parseAnyDef()],
509
- minItems: 2,
510
- maxItems: 2
511
- }
512
- };
513
- }
514
- function parseNativeEnumDef(g) {
515
- let G = g.values, K = Object.keys(g.values).filter((g) => typeof G[G[g]] != "number").map((g) => G[g]), q = Array.from(new Set(K.map((g) => typeof g)));
516
- return {
517
- type: q.length === 1 ? q[0] === "string" ? "string" : "number" : ["string", "number"],
518
- enum: K
519
- };
520
- }
521
- function parseNeverDef() {
522
- return { not: parseAnyDef() };
523
- }
524
- function parseNullDef() {
525
- return { type: "null" };
526
- }
527
- var primitiveMappings = {
528
- ZodString: "string",
529
- ZodNumber: "number",
530
- ZodBigInt: "integer",
531
- ZodBoolean: "boolean",
532
- ZodNull: "null"
533
- };
534
- function parseUnionDef(g, G) {
535
- let K = g.options instanceof Map ? Array.from(g.options.values()) : g.options;
536
- if (K.every((g) => g._def.typeName in primitiveMappings && (!g._def.checks || !g._def.checks.length))) {
537
- let g = K.reduce((g, G) => {
538
- let K = primitiveMappings[G._def.typeName];
539
- return K && !g.includes(K) ? [...g, K] : g;
540
- }, []);
541
- return { type: g.length > 1 ? g : g[0] };
542
- } else if (K.every((g) => g._def.typeName === "ZodLiteral" && !g.description)) {
543
- let g = K.reduce((g, G) => {
544
- let K = typeof G._def.value;
545
- switch (K) {
546
- case "string":
547
- case "number":
548
- case "boolean": return [...g, K];
549
- case "bigint": return [...g, "integer"];
550
- case "object": if (G._def.value === null) return [...g, "null"];
551
- case "symbol":
552
- case "undefined":
553
- case "function":
554
- default: return g;
555
- }
556
- }, []);
557
- if (g.length === K.length) {
558
- let G = g.filter((g, G, K) => K.indexOf(g) === G);
559
- return {
560
- type: G.length > 1 ? G : G[0],
561
- enum: K.reduce((g, G) => g.includes(G._def.value) ? g : [...g, G._def.value], [])
562
- };
563
- }
564
- } else if (K.every((g) => g._def.typeName === "ZodEnum")) return {
565
- type: "string",
566
- enum: K.reduce((g, G) => [...g, ...G._def.values.filter((G) => !g.includes(G))], [])
567
- };
568
- return asAnyOf(g, G);
569
- }
570
- var asAnyOf = (g, G) => {
571
- let K = (g.options instanceof Map ? Array.from(g.options.values()) : g.options).map((g, K) => parseDef(g._def, {
572
- ...G,
573
- currentPath: [
574
- ...G.currentPath,
575
- "anyOf",
576
- `${K}`
577
- ]
578
- })).filter((g) => !!g && (!G.strictUnions || typeof g == "object" && Object.keys(g).length > 0));
579
- return K.length ? { anyOf: K } : void 0;
580
- };
581
- function parseNullableDef(g, G) {
582
- if ([
583
- "ZodString",
584
- "ZodNumber",
585
- "ZodBigInt",
586
- "ZodBoolean",
587
- "ZodNull"
588
- ].includes(g.innerType._def.typeName) && (!g.innerType._def.checks || !g.innerType._def.checks.length)) return { type: [primitiveMappings[g.innerType._def.typeName], "null"] };
589
- let K = parseDef(g.innerType._def, {
590
- ...G,
591
- currentPath: [
592
- ...G.currentPath,
593
- "anyOf",
594
- "0"
595
- ]
596
- });
597
- return K && { anyOf: [K, { type: "null" }] };
598
- }
599
- function parseNumberDef(g) {
600
- let G = { type: "number" };
601
- if (!g.checks) return G;
602
- for (let K of g.checks) switch (K.kind) {
603
- case "int":
604
- G.type = "integer";
605
- break;
606
- case "min":
607
- K.inclusive ? G.minimum = K.value : G.exclusiveMinimum = K.value;
608
- break;
609
- case "max":
610
- K.inclusive ? G.maximum = K.value : G.exclusiveMaximum = K.value;
611
- break;
612
- case "multipleOf":
613
- G.multipleOf = K.value;
614
- break;
615
- }
616
- return G;
617
- }
618
- function parseObjectDef(g, G) {
619
- let K = {
620
- type: "object",
621
- properties: {}
622
- }, q = [], J = g.shape();
623
- for (let g in J) {
624
- let Y = J[g];
625
- if (Y === void 0 || Y._def === void 0) continue;
626
- let X = safeIsOptional(Y), Z = parseDef(Y._def, {
627
- ...G,
628
- currentPath: [
629
- ...G.currentPath,
630
- "properties",
631
- g
632
- ],
633
- propertyPath: [
634
- ...G.currentPath,
635
- "properties",
636
- g
637
- ]
638
- });
639
- Z !== void 0 && (K.properties[g] = Z, X || q.push(g));
640
- }
641
- q.length && (K.required = q);
642
- let Y = decideAdditionalProperties(g, G);
643
- return Y !== void 0 && (K.additionalProperties = Y), K;
644
- }
645
- function decideAdditionalProperties(g, G) {
646
- if (g.catchall._def.typeName !== "ZodNever") return parseDef(g.catchall._def, {
647
- ...G,
648
- currentPath: [...G.currentPath, "additionalProperties"]
649
- });
650
- switch (g.unknownKeys) {
651
- case "passthrough": return G.allowedAdditionalProperties;
652
- case "strict": return G.rejectedAdditionalProperties;
653
- case "strip": return G.removeAdditionalStrategy === "strict" ? G.allowedAdditionalProperties : G.rejectedAdditionalProperties;
654
- }
655
- }
656
- function safeIsOptional(g) {
657
- try {
658
- return g.isOptional();
659
- } catch {
660
- return !0;
661
- }
662
- }
663
- var parseOptionalDef = (g, G) => {
664
- if (G.currentPath.toString() === G.propertyPath?.toString()) return parseDef(g.innerType._def, G);
665
- let K = parseDef(g.innerType._def, {
666
- ...G,
667
- currentPath: [
668
- ...G.currentPath,
669
- "anyOf",
670
- "1"
671
- ]
672
- });
673
- return K ? { anyOf: [{ not: parseAnyDef() }, K] } : parseAnyDef();
674
- }, parsePipelineDef = (g, G) => {
675
- if (G.pipeStrategy === "input") return parseDef(g.in._def, G);
676
- if (G.pipeStrategy === "output") return parseDef(g.out._def, G);
677
- let K = parseDef(g.in._def, {
678
- ...G,
679
- currentPath: [
680
- ...G.currentPath,
681
- "allOf",
682
- "0"
683
- ]
684
- });
685
- return { allOf: [K, parseDef(g.out._def, {
686
- ...G,
687
- currentPath: [
688
- ...G.currentPath,
689
- "allOf",
690
- K ? "1" : "0"
691
- ]
692
- })].filter((g) => g !== void 0) };
693
- };
694
- function parsePromiseDef(g, G) {
695
- return parseDef(g.type._def, G);
696
- }
697
- function parseSetDef(g, G) {
698
- let K = {
699
- type: "array",
700
- uniqueItems: !0,
701
- items: parseDef(g.valueType._def, {
702
- ...G,
703
- currentPath: [...G.currentPath, "items"]
704
- })
705
- };
706
- return g.minSize && (K.minItems = g.minSize.value), g.maxSize && (K.maxItems = g.maxSize.value), K;
707
- }
708
- function parseTupleDef(g, G) {
709
- return g.rest ? {
710
- type: "array",
711
- minItems: g.items.length,
712
- items: g.items.map((g, K) => parseDef(g._def, {
713
- ...G,
714
- currentPath: [
715
- ...G.currentPath,
716
- "items",
717
- `${K}`
718
- ]
719
- })).reduce((g, G) => G === void 0 ? g : [...g, G], []),
720
- additionalItems: parseDef(g.rest._def, {
721
- ...G,
722
- currentPath: [...G.currentPath, "additionalItems"]
723
- })
724
- } : {
725
- type: "array",
726
- minItems: g.items.length,
727
- maxItems: g.items.length,
728
- items: g.items.map((g, K) => parseDef(g._def, {
729
- ...G,
730
- currentPath: [
731
- ...G.currentPath,
732
- "items",
733
- `${K}`
734
- ]
735
- })).reduce((g, G) => G === void 0 ? g : [...g, G], [])
736
- };
737
- }
738
- function parseUndefinedDef() {
739
- return { not: parseAnyDef() };
740
- }
741
- function parseUnknownDef() {
742
- return parseAnyDef();
743
- }
744
- var parseReadonlyDef = (g, G) => parseDef(g.innerType._def, G), selectParser = (g, G, K) => {
745
- switch (G) {
746
- case ZodFirstPartyTypeKind.ZodString: return parseStringDef(g, K);
747
- case ZodFirstPartyTypeKind.ZodNumber: return parseNumberDef(g);
748
- case ZodFirstPartyTypeKind.ZodObject: return parseObjectDef(g, K);
749
- case ZodFirstPartyTypeKind.ZodBigInt: return parseBigintDef(g);
750
- case ZodFirstPartyTypeKind.ZodBoolean: return parseBooleanDef();
751
- case ZodFirstPartyTypeKind.ZodDate: return parseDateDef(g, K);
752
- case ZodFirstPartyTypeKind.ZodUndefined: return parseUndefinedDef();
753
- case ZodFirstPartyTypeKind.ZodNull: return parseNullDef();
754
- case ZodFirstPartyTypeKind.ZodArray: return parseArrayDef(g, K);
755
- case ZodFirstPartyTypeKind.ZodUnion:
756
- case ZodFirstPartyTypeKind.ZodDiscriminatedUnion: return parseUnionDef(g, K);
757
- case ZodFirstPartyTypeKind.ZodIntersection: return parseIntersectionDef(g, K);
758
- case ZodFirstPartyTypeKind.ZodTuple: return parseTupleDef(g, K);
759
- case ZodFirstPartyTypeKind.ZodRecord: return parseRecordDef(g, K);
760
- case ZodFirstPartyTypeKind.ZodLiteral: return parseLiteralDef(g);
761
- case ZodFirstPartyTypeKind.ZodEnum: return parseEnumDef(g);
762
- case ZodFirstPartyTypeKind.ZodNativeEnum: return parseNativeEnumDef(g);
763
- case ZodFirstPartyTypeKind.ZodNullable: return parseNullableDef(g, K);
764
- case ZodFirstPartyTypeKind.ZodOptional: return parseOptionalDef(g, K);
765
- case ZodFirstPartyTypeKind.ZodMap: return parseMapDef(g, K);
766
- case ZodFirstPartyTypeKind.ZodSet: return parseSetDef(g, K);
767
- case ZodFirstPartyTypeKind.ZodLazy: return () => g.getter()._def;
768
- case ZodFirstPartyTypeKind.ZodPromise: return parsePromiseDef(g, K);
769
- case ZodFirstPartyTypeKind.ZodNaN:
770
- case ZodFirstPartyTypeKind.ZodNever: return parseNeverDef();
771
- case ZodFirstPartyTypeKind.ZodEffects: return parseEffectsDef(g, K);
772
- case ZodFirstPartyTypeKind.ZodAny: return parseAnyDef();
773
- case ZodFirstPartyTypeKind.ZodUnknown: return parseUnknownDef();
774
- case ZodFirstPartyTypeKind.ZodDefault: return parseDefaultDef(g, K);
775
- case ZodFirstPartyTypeKind.ZodBranded: return parseBrandedDef(g, K);
776
- case ZodFirstPartyTypeKind.ZodReadonly: return parseReadonlyDef(g, K);
777
- case ZodFirstPartyTypeKind.ZodCatch: return parseCatchDef(g, K);
778
- case ZodFirstPartyTypeKind.ZodPipeline: return parsePipelineDef(g, K);
779
- case ZodFirstPartyTypeKind.ZodFunction:
780
- case ZodFirstPartyTypeKind.ZodVoid:
781
- case ZodFirstPartyTypeKind.ZodSymbol: return;
782
- default: return /* @__PURE__ */ ((g) => void 0)(G);
783
- }
784
- }, getRelativePath = (g, G) => {
785
- let K = 0;
786
- for (; K < g.length && K < G.length && g[K] === G[K]; K++);
787
- return [(g.length - K).toString(), ...G.slice(K)].join("/");
788
- };
789
- function parseDef(g, G, K = !1) {
790
- let q = G.seen.get(g);
791
- if (G.override) {
792
- let J = G.override?.call(G, g, G, q, K);
793
- if (J !== ignoreOverride) return J;
794
- }
795
- if (q && !K) {
796
- let g = get$ref(q, G);
797
- if (g !== void 0) return g;
798
- }
799
- let J = {
800
- def: g,
801
- path: G.currentPath,
802
- jsonSchema: void 0
803
- };
804
- G.seen.set(g, J);
805
- let Y = selectParser(g, g.typeName, G), X = typeof Y == "function" ? parseDef(Y(), G) : Y;
806
- if (X && addMeta(g, G, X), G.postProcess) {
807
- let K = G.postProcess(X, g, G);
808
- return J.jsonSchema = X, K;
809
- }
810
- return J.jsonSchema = X, X;
811
- }
812
- var get$ref = (g, G) => {
813
- switch (G.$refStrategy) {
814
- case "root": return { $ref: g.path.join("/") };
815
- case "relative": return { $ref: getRelativePath(G.currentPath, g.path) };
816
- case "none":
817
- case "seen": return g.path.length < G.currentPath.length && g.path.every((g, K) => G.currentPath[K] === g) ? (console.warn(`Recursive reference detected at ${G.currentPath.join("/")}! Defaulting to any`), parseAnyDef()) : G.$refStrategy === "seen" ? parseAnyDef() : void 0;
818
- }
819
- }, addMeta = (g, G, K) => (g.description && (K.description = g.description), K), getRefs = (g) => {
820
- let G = getDefaultOptions(g), K = G.name === void 0 ? G.basePath : [
821
- ...G.basePath,
822
- G.definitionPath,
823
- G.name
824
- ];
825
- return {
826
- ...G,
827
- currentPath: K,
828
- propertyPath: void 0,
829
- seen: new Map(Object.entries(G.definitions).map(([g, K]) => [K._def, {
830
- def: K._def,
831
- path: [
832
- ...G.basePath,
833
- G.definitionPath,
834
- g
835
- ],
836
- jsonSchema: void 0
837
- }]))
838
- };
839
- }, zod3ToJsonSchema = (g, G) => {
840
- let K = getRefs(G), q = typeof G == "object" && G.definitions ? Object.entries(G.definitions).reduce((g, [G, q]) => ({
841
- ...g,
842
- [G]: parseDef(q._def, {
843
- ...K,
844
- currentPath: [
845
- ...K.basePath,
846
- K.definitionPath,
847
- G
848
- ]
849
- }, !0) ?? parseAnyDef()
850
- }), {}) : void 0, J = typeof G == "string" ? G : G?.nameStrategy === "title" ? void 0 : G?.name, Y = parseDef(g._def, J === void 0 ? K : {
851
- ...K,
852
- currentPath: [
853
- ...K.basePath,
854
- K.definitionPath,
855
- J
856
- ]
857
- }, !1) ?? parseAnyDef(), X = typeof G == "object" && G.name !== void 0 && G.nameStrategy === "title" ? G.name : void 0;
858
- X !== void 0 && (Y.title = X);
859
- let Z = J === void 0 ? q ? {
860
- ...Y,
861
- [K.definitionPath]: q
862
- } : Y : {
863
- $ref: [
864
- ...K.$refStrategy === "relative" ? [] : K.basePath,
865
- K.definitionPath,
866
- J
867
- ].join("/"),
868
- [K.definitionPath]: {
869
- ...q,
870
- [J]: Y
871
- }
872
- };
873
- return Z.$schema = "http://json-schema.org/draft-07/schema#", Z;
874
- }, schemaSymbol = Symbol.for("vercel.ai.schema");
875
- function lazySchema(g) {
876
- let G;
877
- return () => (G ??= g(), G);
878
- }
879
- function jsonSchema(g, { validate: G } = {}) {
880
- return {
881
- [schemaSymbol]: !0,
882
- _type: void 0,
883
- get jsonSchema() {
884
- return typeof g == "function" && (g = g()), g;
885
- },
886
- validate: G
887
- };
888
- }
889
- function isSchema(g) {
890
- return typeof g == "object" && !!g && schemaSymbol in g && g[schemaSymbol] === !0 && "jsonSchema" in g && "validate" in g;
891
- }
892
- function asSchema(g) {
893
- return g == null ? jsonSchema({
894
- properties: {},
895
- additionalProperties: !1
896
- }) : isSchema(g) ? g : "~standard" in g ? g["~standard"].vendor === "zod" ? zodSchema(g) : standardSchema(g) : g();
897
- }
898
- function standardSchema(g) {
899
- return jsonSchema(() => addAdditionalPropertiesToJsonSchema(g["~standard"].jsonSchema.input({ target: "draft-07" })), { validate: async (G) => {
900
- let K = await g["~standard"].validate(G);
901
- return "value" in K ? {
902
- success: !0,
903
- value: K.value
904
- } : {
905
- success: !1,
906
- error: new TypeValidationError({
907
- value: G,
908
- cause: K.issues
909
- })
910
- };
911
- } });
912
- }
913
- function zod3Schema(g, G) {
914
- let K = G?.useReferences ?? !1;
915
- return jsonSchema(() => zod3ToJsonSchema(g, { $refStrategy: K ? "root" : "none" }), { validate: async (G) => {
916
- let K = await g.safeParseAsync(G);
917
- return K.success ? {
918
- success: !0,
919
- value: K.data
920
- } : {
921
- success: !1,
922
- error: K.error
923
- };
924
- } });
925
- }
926
- function zod4Schema(g, G) {
927
- let K = G?.useReferences ?? !1;
928
- return jsonSchema(() => addAdditionalPropertiesToJsonSchema(toJSONSchema(g, {
929
- target: "draft-7",
930
- io: "input",
931
- reused: K ? "ref" : "inline"
932
- })), { validate: async (G) => {
933
- let K = await safeParseAsync(g, G);
934
- return K.success ? {
935
- success: !0,
936
- value: K.data
937
- } : {
938
- success: !1,
939
- error: K.error
940
- };
941
- } });
942
- }
943
- function isZod4Schema(g) {
944
- return "_zod" in g;
945
- }
946
- function zodSchema(g, G) {
947
- return isZod4Schema(g) ? zod4Schema(g, G) : zod3Schema(g, G);
948
- }
949
- async function safeValidateTypes({ value: g, schema: G, context: K }) {
950
- let J = asSchema(G);
951
- try {
952
- if (J.validate == null) return {
953
- success: !0,
954
- value: g,
955
- rawValue: g
956
- };
957
- let G = await J.validate(g);
958
- return G.success ? {
959
- success: !0,
960
- value: G.value,
961
- rawValue: g
962
- } : {
963
- success: !1,
964
- error: TypeValidationError.wrap({
965
- value: g,
966
- cause: G.error,
967
- context: K
968
- }),
969
- rawValue: g
970
- };
971
- } catch (G) {
972
- return {
973
- success: !1,
974
- error: TypeValidationError.wrap({
975
- value: g,
976
- cause: G,
977
- context: K
978
- }),
979
- rawValue: g
980
- };
981
- }
982
- }
983
- async function safeParseJSON({ text: g, schema: G }) {
984
- try {
985
- let K = secureJsonParse(g);
986
- return G == null ? {
987
- success: !0,
988
- value: K,
989
- rawValue: K
990
- } : await safeValidateTypes({
991
- value: K,
992
- schema: G
993
- });
994
- } catch (G) {
995
- return {
996
- success: !1,
997
- error: JSONParseError.isInstance(G) ? G : new JSONParseError({
998
- text: g,
999
- cause: G
1000
- }),
1001
- rawValue: void 0
1002
- };
1003
- }
1004
- }
1005
- async function resolve(g) {
1006
- return typeof g == "function" && (g = g()), Promise.resolve(g);
1007
- }
1008
- export { DEFAULT_MAX_DOWNLOAD_SIZE, DownloadError, asSchema, createIdGenerator, getRuntimeEnvironmentUserAgent, jsonSchema, lazySchema, readResponseWithSizeLimit, resolve, safeParseJSON, safeValidateTypes, withUserAgentSuffix, zodSchema };