@kubb/plugin-zod 5.0.0-beta.3 → 5.0.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.ts","../src/components/Operations.tsx","../src/components/Zod.tsx","../src/constants.ts","../src/utils.ts","../src/printers/printerZod.ts","../src/printers/printerZodMini.ts","../src/generators/zodGenerator.tsx","../src/resolvers/resolverZod.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * toRegExpString('^(?im)foo') // → 'new RegExp(\"foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // → '/foo/im'\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { stringifyObject } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport { Const, File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype Props = {\n name: string\n operations: Array<{ node: ast.OperationNode; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): KubbReactNode {\n const operationsJSON = operations.reduce<Record<string, unknown>>(\n (prev, acc) => {\n prev[`\"${acc.node.operationId}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce<Record<string, Record<string, string>>>((prev, acc) => {\n prev[`\"${acc.node.path}\"`] = {\n ...(prev[`\"${acc.node.path}\"`] ?? {}),\n [acc.node.method]: `operations[\"${acc.node.operationId}\"]`,\n }\n\n return prev\n }, {})\n\n return (\n <>\n <File.Source name=\"OperationSchema\" isExportable isIndexable>\n <Type name=\"OperationSchema\" export>{`{\n readonly request: z.ZodTypeAny | undefined;\n readonly parameters: {\n readonly path: z.ZodTypeAny | undefined;\n readonly query: z.ZodTypeAny | undefined;\n readonly header: z.ZodTypeAny | undefined;\n };\n readonly responses: {\n readonly [status: number]: z.ZodTypeAny;\n readonly default: z.ZodTypeAny;\n };\n readonly errors: {\n readonly [status: number]: z.ZodTypeAny;\n };\n}`}</Type>\n </File.Source>\n <File.Source name=\"OperationsMap\" isExportable isIndexable>\n <Type name=\"OperationsMap\" export>\n {'Record<string, OperationSchema>'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name} asConst>\n {`{${stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport { Const, File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PrinterZodFactory } from '../printers/printerZod.ts'\nimport type { PrinterZodMiniFactory } from '../printers/printerZodMini.ts'\n\ntype Props = {\n name: string\n node: ast.SchemaNode\n /**\n * Pre-configured printer instance created by the generator.\n * The generator selects `printerZod` or `printerZodMini` based on the `mini` option,\n * then merges in any user-supplied `printer.nodes` overrides.\n */\n printer: ast.Printer<PrinterZodFactory> | ast.Printer<PrinterZodMiniFactory>\n inferTypeName?: string\n}\n\nexport function Zod({ name, node, printer, inferTypeName }: Props): KubbReactNode {\n const output = printer.print(node)\n\n if (!output) {\n return\n }\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name}>\n {output}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n </File.Source>\n )}\n </>\n )\n}\n","/**\n * Import paths that use a namespace import (`import * as z from '...'`).\n * All other import paths use a named import (`import { z } from '...'`).\n */\nexport const ZOD_NAMESPACE_IMPORTS = new Set(['zod', 'zod/mini'] as const)\n","import { stringify, toRegExpString } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from './types.ts'\n\n/**\n * Returns `true` when the given coercion option enables coercion for the specified type.\n */\nexport function shouldCoerce(coercion: PluginZod['resolvedOptions']['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean {\n if (coercion === undefined || coercion === false) return false\n if (coercion === true) return true\n\n return !!coercion[type]\n}\n\n/**\n * Collects all resolved schema names for an operation's parameters and responses\n * into a single lookup object, useful for building imports and type references.\n */\nexport function buildSchemaNames(node: ast.OperationNode, { params, resolver }: { params: Array<ast.ParameterNode>; resolver: ResolverZod }) {\n const pathParam = params.find((p) => p.in === 'path')\n const queryParam = params.find((p) => p.in === 'query')\n const headerParam = params.find((p) => p.in === 'header')\n\n const responses: Record<number | string, string> = {}\n const errors: Record<number | string, string> = {}\n\n for (const res of node.responses) {\n const name = resolver.resolveResponseStatusName(node, res.statusCode)\n const statusNum = Number(res.statusCode)\n\n if (!Number.isNaN(statusNum)) {\n responses[statusNum] = name\n if (statusNum >= 400) {\n errors[statusNum] = name\n }\n }\n }\n\n responses['default'] = resolver.resolveResponseName(node)\n\n return {\n request: node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined,\n parameters: {\n path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : undefined,\n query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : undefined,\n header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : undefined,\n },\n responses,\n errors,\n }\n}\n\n/**\n * Format a default value as a code-level literal.\n * Objects become `{}`, primitives become their string representation, strings are quoted.\n */\nexport function formatDefault(value: unknown): string {\n if (typeof value === 'string') return stringify(value)\n if (typeof value === 'object' && value !== null) return '{}'\n\n return String(value ?? '')\n}\n\n/**\n * Format a primitive enum/literal value.\n * Strings are quoted; numbers and booleans are emitted raw.\n */\nexport function formatLiteral(v: string | number | boolean): string {\n if (typeof v === 'string') return stringify(v)\n\n return String(v)\n}\n\n/**\n * Numeric constraint limits for Zod schemas (min, max, and exclusive bounds).\n */\nexport type NumericConstraints = {\n min?: number\n max?: number\n exclusiveMinimum?: number\n exclusiveMaximum?: number\n multipleOf?: number\n}\n\n/**\n * Length constraint limits for string and array schemas (min, max, and regex pattern).\n */\nexport type LengthConstraints = {\n min?: number\n max?: number\n pattern?: string\n}\n\n/**\n * Modifier options for applying chainable methods to Zod schema values.\n */\nexport type ModifierOptions = {\n value: string\n nullable?: boolean\n optional?: boolean\n nullish?: boolean\n defaultValue?: unknown\n description?: string\n}\n\n/**\n * Build `.min()` / `.max()` / `.gt()` / `.lt()` constraint chains for numbers\n * using the standard chainable Zod v4 API.\n */\nexport function numberConstraints({ min, max, exclusiveMinimum, exclusiveMaximum, multipleOf }: NumericConstraints): string {\n return [\n min !== undefined ? `.min(${min})` : '',\n max !== undefined ? `.max(${max})` : '',\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : '',\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : '',\n multipleOf !== undefined ? `.multipleOf(${multipleOf})` : '',\n ].join('')\n}\n\n/**\n * Build `.min()` / `.max()` / `.regex()` chains for strings/arrays\n * using the standard chainable Zod v4 API.\n */\nexport function lengthConstraints({ min, max, pattern }: LengthConstraints): string {\n return [\n min !== undefined ? `.min(${min})` : '',\n max !== undefined ? `.max(${max})` : '',\n pattern !== undefined ? `.regex(${toRegExpString(pattern, null)})` : '',\n ].join('')\n}\n\n/**\n * Build `.check(z.minimum(), z.maximum())` for `zod/mini` numeric constraints.\n */\nexport function numberChecksMini({ min, max, exclusiveMinimum, exclusiveMaximum, multipleOf }: NumericConstraints): string {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minimum(${min})`)\n if (max !== undefined) checks.push(`z.maximum(${max})`)\n if (exclusiveMinimum !== undefined) checks.push(`z.minimum(${exclusiveMinimum}, { exclusive: true })`)\n if (exclusiveMaximum !== undefined) checks.push(`z.maximum(${exclusiveMaximum}, { exclusive: true })`)\n if (multipleOf !== undefined) checks.push(`z.multipleOf(${multipleOf})`)\n return checks.length ? `.check(${checks.join(', ')})` : ''\n}\n\n/**\n * Build `.check(z.minLength(), z.maxLength(), z.regex())` for `zod/mini` length constraints.\n */\nexport function lengthChecksMini({ min, max, pattern }: LengthConstraints): string {\n const checks: string[] = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n if (pattern !== undefined) checks.push(`z.regex(${toRegExpString(pattern, null)})`)\n return checks.length ? `.check(${checks.join(', ')})` : ''\n}\n\n/**\n * Apply nullable / optional / nullish modifiers and an optional `.describe()` call\n * to a schema value string using the chainable Zod v4 API.\n */\nexport function applyModifiers({ value, nullable, optional, nullish, defaultValue, description }: ModifierOptions): string {\n let result = value\n if (nullish || (nullable && optional)) {\n result = `${result}.nullish()`\n } else if (optional) {\n result = `${result}.optional()`\n } else if (nullable) {\n result = `${result}.nullable()`\n }\n if (defaultValue !== undefined) {\n result = `${result}.default(${formatDefault(defaultValue)})`\n }\n if (description) {\n result = `${result}.describe(${stringify(description)})`\n }\n return result\n}\n\n/**\n * Apply nullable / optional / nullish modifiers using the functional `zod/mini` API\n * (`z.nullable()`, `z.optional()`, `z.nullish()`).\n */\nexport function applyMiniModifiers({ value, nullable, optional, nullish, defaultValue }: Omit<ModifierOptions, 'description'>): string {\n let result = value\n if (nullish) {\n result = `z.nullish(${result})`\n } else {\n if (nullable) {\n result = `z.nullable(${result})`\n }\n if (optional) {\n result = `z.optional(${result})`\n }\n }\n if (defaultValue !== undefined) {\n result = `z._default(${result}, ${formatDefault(defaultValue)})`\n }\n return result\n}\n\ntype BuildGroupedParamsSchemaOptions = {\n params: Array<ast.ParameterNode>\n optional?: boolean\n}\n\n/**\n * Builds an `object` schema node grouping the given parameter nodes.\n * The `primitive: 'object'` marker ensures the Zod printer emits `z.object(…)` rather than a record.\n */\nexport function buildGroupedParamsSchema({ params, optional }: BuildGroupedParamsSchemaOptions): ast.SchemaNode {\n return ast.createSchema({\n type: 'object',\n optional,\n primitive: 'object',\n properties: params.map((param) =>\n ast.createProperty({\n name: param.name,\n required: param.required,\n schema: param.schema,\n }),\n ),\n })\n}\n","import { stringify } from '@internals/utils'\n\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyModifiers, formatLiteral, lengthConstraints, numberConstraints, shouldCoerce } from '../utils.ts'\nimport type { AdapterOas } from '@kubb/adapter-oas'\n\n/**\n * Partial map of node-type overrides for the Zod printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginZod({\n * printer: {\n * nodes: {\n * date(node) {\n * return 'z.string().date()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterZodNodes = ast.PrinterPartial<string, PrinterZodOptions>\n\nexport type PrinterZodOptions = {\n /**\n * Enable automatic type coercion for strings, numbers, and dates.\n */\n coercion?: PluginZod['resolvedOptions']['coercion']\n /**\n * Use `z.guid()` or `z.uuid()` for UUID/GUID validation.\n *\n * @default 'uuid'\n */\n guidType?: PluginZod['resolvedOptions']['guidType']\n /**\n * Date format in the OpenAPI spec (`'date'` or `'date-time'`).\n */\n dateType?: AdapterOas['resolvedOptions']['dateType']\n /**\n * Hook to transform generated Zod schema before output.\n */\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n /**\n * Transforms raw schema names into valid JavaScript identifiers.\n */\n resolver?: ResolverZod\n /**\n * Properties to exclude using `.omit({ key: true })`.\n */\n keysToOmit?: Array<string>\n /**\n * Schema names that form circular dependency chains.\n * Properties referencing these emit lazy getters wrapping refs in `z.lazy(() => …)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterZodNodes\n}\n\n/**\n * Factory options for the Zod printer, defining input/output types and configuration.\n */\nexport type PrinterZodFactory = ast.PrinterFactoryOptions<'zod', PrinterZodOptions, string, string>\n\n/**\n * Zod v4 printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST into a Zod v4 code string using the chainable API\n * (`.optional()`, `.nullable()`, `.omit()`, etc.). For improved tree-shaking, see {@link printerZodMini}.\n *\n * @example Chainable API\n * ```ts\n * const printer = printerZod({ coercion: false })\n * const code = printer.print(stringNode) // \"z.string()\"\n * ```\n */\nexport const printerZod = ast.definePrinter<PrinterZodFactory>((options) => {\n return {\n name: 'zod',\n options,\n nodes: {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n never: () => 'z.never()',\n boolean: () => 'z.boolean()',\n null: () => 'z.null()',\n string(node) {\n const base = shouldCoerce(this.options.coercion, 'strings') ? 'z.coerce.string()' : 'z.string()'\n\n return `${base}${lengthConstraints(node)}`\n },\n number(node) {\n const base = shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.number()' : 'z.number()'\n\n return `${base}${numberConstraints(node)}`\n },\n integer(node) {\n const base = shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.number().int()' : 'z.int()'\n\n return `${base}${numberConstraints(node)}`\n },\n bigint() {\n return shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.bigint()' : 'z.bigint()'\n },\n date(node) {\n if (node.representation === 'string') {\n return 'z.iso.date()'\n }\n\n return shouldCoerce(this.options.coercion, 'dates') ? 'z.coerce.date()' : 'z.date()'\n },\n datetime(node) {\n const offset = node.offset || this.options.dateType === 'stringOffset'\n const local = node.local || this.options.dateType === 'stringLocal'\n\n if (offset) return 'z.iso.datetime({ offset: true })'\n if (local) return 'z.iso.datetime({ local: true })'\n\n return 'z.iso.datetime()'\n },\n time(node) {\n if (node.representation === 'string') {\n return 'z.iso.time()'\n }\n\n return shouldCoerce(this.options.coercion, 'dates') ? 'z.coerce.date()' : 'z.date()'\n },\n uuid(node) {\n const base = this.options.guidType === 'guid' ? 'z.guid()' : 'z.uuid()'\n\n return `${base}${lengthConstraints(node)}`\n },\n email(node) {\n return `z.email()${lengthConstraints(node)}`\n },\n url(node) {\n return `z.url()${lengthConstraints(node)}`\n },\n ipv4: () => 'z.ipv4()',\n ipv6: () => 'z.ipv6()',\n blob: () => 'z.instanceof(File)',\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n const nonNullValues = values.filter((v): v is string | number | boolean => v !== null)\n\n // asConst-style enum: use z.union([z.literal(…), …])\n if (node.namedEnumValues?.length) {\n const literals = nonNullValues.map((v) => `z.literal(${formatLiteral(v)})`)\n\n if (literals.length === 1) return literals[0]!\n return `z.union([${literals.join(', ')}])`\n }\n\n // Regular enum: use z.enum([…])\n return `z.enum([${nonNullValues.map(formatLiteral).join(', ')}])`\n },\n ref(node) {\n if (!node.name) return undefined\n const refName = node.ref ? (ast.extractRefName(node.ref) ?? node.name) : node.name\n const resolvedName = node.ref ? (this.options.resolver?.default(refName, 'function') ?? refName) : node.name\n\n if (node.ref && this.options.cyclicSchemas?.has(refName)) {\n return `z.lazy(() => ${resolvedName})`\n }\n\n return resolvedName\n },\n object(node) {\n const properties = node.properties\n .map((prop) => {\n const { name: propName, schema } = prop\n\n const meta = ast.syncSchemaRef(schema)\n\n const isNullable = meta.nullable\n const isOptional = schema.optional\n const isNullish = schema.nullish\n\n const hasSelfRef = this.options.cyclicSchemas != null && ast.containsCircularRef(schema, { circularSchemas: this.options.cyclicSchemas })\n // Inside a getter the getter itself defers evaluation, so suppress\n // z.lazy() wrapping on nested refs by temporarily clearing cyclicSchemas.\n if (hasSelfRef) this.options.cyclicSchemas = undefined\n const baseOutput = this.transform(schema) ?? this.transform(ast.createSchema({ type: 'unknown' }))!\n if (hasSelfRef) this.options.cyclicSchemas = options.cyclicSchemas\n\n const wrappedOutput = this.options.wrapOutput ? this.options.wrapOutput({ output: baseOutput, schema }) || baseOutput : baseOutput\n\n // When a property schema is not a ref but the metadata is from a ref (e.g., discriminator\n // property override), skip applying the description from the ref target to avoid applying\n // metadata from a replaced schema.\n let descriptionToApply = meta.description\n if (schema.type !== 'ref' && meta.type === 'ref') {\n descriptionToApply = undefined\n }\n\n const value = applyModifiers({\n value: wrappedOutput,\n nullable: isNullable,\n optional: isOptional,\n nullish: isNullish,\n defaultValue: meta.default,\n description: descriptionToApply,\n })\n\n if (hasSelfRef) {\n return `get \"${propName}\"() { return ${value} }`\n }\n return `\"${propName}\": ${value}`\n })\n .join(',\\n ')\n\n let result = `z.object({\\n ${properties}\\n })`\n\n // Handle additionalProperties as .catchall() or .strict()\n if (node.additionalProperties && node.additionalProperties !== true) {\n const catchallType = this.transform(node.additionalProperties)\n if (catchallType) {\n result += `.catchall(${catchallType})`\n }\n } else if (node.additionalProperties === true) {\n result += `.catchall(${this.transform(ast.createSchema({ type: 'unknown' }))})`\n } else if (node.additionalProperties === false) {\n result += '.strict()'\n }\n\n return result\n },\n array(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n const inner = items.join(', ') || this.transform(ast.createSchema({ type: 'unknown' }))!\n let result = `z.array(${inner})${lengthConstraints(node)}`\n\n if (node.unique) {\n result += `.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })`\n }\n\n return result\n },\n tuple(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n\n return `z.tuple([${items.join(', ')}])`\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const members = nodeMembers.map((m) => this.transform(m)).filter(Boolean)\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n if (node.discriminatorPropertyName && !nodeMembers.some((m) => m.type === 'intersection')) {\n // z.discriminatedUnion requires ZodObject members; intersections (ZodIntersection) are not\n // assignable to $ZodDiscriminant, so fall back to z.union when any member is an intersection.\n return `z.discriminatedUnion(${stringify(node.discriminatorPropertyName)}, [${members.join(', ')}])`\n }\n\n return `z.union([${members.join(', ')}])`\n },\n intersection(node) {\n const members = node.members ?? []\n if (members.length === 0) return ''\n\n const [first, ...rest] = members\n if (!first) return ''\n\n let base = this.transform(first)\n if (!base) return ''\n\n for (const member of rest) {\n if (member.primitive === 'string') {\n const s = ast.narrowSchema(member, 'string')\n const c = lengthConstraints(s ?? {})\n if (c) {\n base += c\n continue\n }\n } else if (member.primitive === 'number' || member.primitive === 'integer') {\n const n = ast.narrowSchema(member, 'number') ?? ast.narrowSchema(member, 'integer')\n const c = numberConstraints(n ?? {})\n if (c) {\n base += c\n continue\n }\n } else if (member.primitive === 'array') {\n const a = ast.narrowSchema(member, 'array')\n const c = lengthConstraints(a ?? {})\n if (c) {\n base += c\n continue\n }\n }\n const transformed = this.transform(member)\n if (transformed) base = `${base}.and(${transformed})`\n }\n\n return base\n },\n ...options.nodes,\n },\n print(node) {\n const { keysToOmit } = this.options\n\n let base = this.transform(node)\n if (!base) return null\n\n const meta = ast.syncSchemaRef(node)\n\n if (keysToOmit?.length && meta.primitive === 'object' && !(meta.type === 'union' && meta.discriminatorPropertyName)) {\n // Mirror printerTs `nonNullable: true`: when omitting keys, the resulting\n // schema is a new non-nullable object type — skip optional/nullable/nullish.\n // Discriminated unions (z.discriminatedUnion) do not support .omit(), so skip them.\n\n // If this is a lazy reference, apply omit inside the lazy function\n const lazyMatch = base.match(/^z\\.lazy\\(\\(\\)\\s*=>\\s*(.+)\\)$/)\n if (lazyMatch) {\n base = `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} }))`\n } else {\n base = `${base}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} })`\n }\n }\n\n return applyModifiers({\n value: base,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n description: meta.description,\n })\n },\n }\n})\n","import { stringify } from '@internals/utils'\n\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyMiniModifiers, formatLiteral, lengthChecksMini, numberChecksMini } from '../utils.ts'\n\n/**\n * Partial map of node-type overrides for the Zod Mini printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginZod({\n * mini: true,\n * printer: {\n * nodes: {\n * date(node) {\n * return 'z.iso.date()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterZodMiniNodes = ast.PrinterPartial<string, PrinterZodMiniOptions>\n\nexport type PrinterZodMiniOptions = {\n /**\n * Use `z.guid()` or `z.uuid()` for UUID/GUID validation.\n *\n * @default 'uuid'\n */\n guidType?: PluginZod['resolvedOptions']['guidType']\n /**\n * Hook to transform generated Zod schema before output.\n */\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n /**\n * Transforms raw schema names into valid JavaScript identifiers.\n */\n resolver?: ResolverZod\n /**\n * Properties to exclude using `.omit({ key: true })`.\n */\n keysToOmit?: Array<string>\n /**\n * Schema names that form circular dependency chains.\n * Properties referencing these emit lazy getters wrapping refs in `z.lazy(() => …)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterZodMiniNodes\n}\n\n/**\n * Factory options for the Zod Mini printer, defining input/output types and configuration.\n */\nexport type PrinterZodMiniFactory = ast.PrinterFactoryOptions<'zod-mini', PrinterZodMiniOptions, string, string>\n/**\n * Zod v4 **Mini** printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST into a Zod v4 code string using the functional API\n * (`z.optional(z.string())`) for improved tree-shaking. See {@link printerZod} for the chainable API.\n *\n * @example Functional Mini API\n * ```ts\n * const printer = printerZodMini({})\n * const code = printer.print(optionalStringNode) // \"z.optional(z.string())\"\n * ```\n */\nexport const printerZodMini = ast.definePrinter<PrinterZodMiniFactory>((options) => {\n return {\n name: 'zod-mini',\n options,\n nodes: {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n never: () => 'z.never()',\n boolean: () => 'z.boolean()',\n null: () => 'z.null()',\n string(node) {\n return `z.string()${lengthChecksMini(node)}`\n },\n number(node) {\n return `z.number()${numberChecksMini(node)}`\n },\n integer(node) {\n return `z.int()${numberChecksMini(node)}`\n },\n bigint(node) {\n return `z.bigint()${numberChecksMini(node)}`\n },\n date(node) {\n if (node.representation === 'string') {\n return 'z.iso.date()'\n }\n\n return 'z.date()'\n },\n datetime() {\n // Mini mode: datetime validation via z.string() (z.iso.datetime not available in mini)\n return 'z.string()'\n },\n time(node) {\n if (node.representation === 'string') {\n return 'z.iso.time()'\n }\n\n return 'z.date()'\n },\n uuid(node) {\n const base = this.options.guidType === 'guid' ? 'z.guid()' : 'z.uuid()'\n\n return `${base}${lengthChecksMini(node)}`\n },\n email(node) {\n return `z.email()${lengthChecksMini(node)}`\n },\n url(node) {\n return `z.url()${lengthChecksMini(node)}`\n },\n ipv4: () => 'z.ipv4()',\n ipv6: () => 'z.ipv6()',\n blob: () => 'z.instanceof(File)',\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n const nonNullValues = values.filter((v): v is string | number | boolean => v !== null)\n\n // asConst-style enum: use z.union([z.literal(…), …])\n if (node.namedEnumValues?.length) {\n const literals = nonNullValues.map((v) => `z.literal(${formatLiteral(v)})`)\n if (literals.length === 1) return literals[0]!\n return `z.union([${literals.join(', ')}])`\n }\n\n // Regular enum: use z.enum([…])\n return `z.enum([${nonNullValues.map(formatLiteral).join(', ')}])`\n },\n\n ref(node) {\n if (!node.name) return undefined\n const refName = node.ref ? (ast.extractRefName(node.ref) ?? node.name) : node.name\n const resolvedName = node.ref ? (this.options.resolver?.default(refName, 'function') ?? refName) : node.name\n\n if (node.ref && this.options.cyclicSchemas?.has(refName)) {\n return `z.lazy(() => ${resolvedName})`\n }\n\n return resolvedName\n },\n object(node) {\n const properties = node.properties\n .map((prop) => {\n const { name: propName, schema } = prop\n\n const meta = ast.syncSchemaRef(schema)\n\n const isNullable = meta.nullable\n const isOptional = schema.optional\n const isNullish = schema.nullish\n\n const hasSelfRef = this.options.cyclicSchemas != null && ast.containsCircularRef(schema, { circularSchemas: this.options.cyclicSchemas })\n // Inside a getter the getter itself defers evaluation, so suppress\n // z.lazy() wrapping on nested refs by temporarily clearing cyclicSchemas.\n if (hasSelfRef) this.options.cyclicSchemas = undefined\n const baseOutput = this.transform(schema) ?? this.transform(ast.createSchema({ type: 'unknown' }))!\n if (hasSelfRef) this.options.cyclicSchemas = options.cyclicSchemas\n\n const wrappedOutput = this.options.wrapOutput ? this.options.wrapOutput({ output: baseOutput, schema }) || baseOutput : baseOutput\n\n const value = applyMiniModifiers({\n value: wrappedOutput,\n nullable: isNullable,\n optional: isOptional,\n nullish: isNullish,\n defaultValue: meta.default,\n })\n\n if (hasSelfRef) {\n return `get \"${propName}\"() { return ${value} }`\n }\n return `\"${propName}\": ${value}`\n })\n .join(',\\n ')\n\n return `z.object({\\n ${properties}\\n })`\n },\n array(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n const inner = items.join(', ') || this.transform(ast.createSchema({ type: 'unknown' }))!\n let result = `z.array(${inner})${lengthChecksMini(node)}`\n\n if (node.unique) {\n result += `.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })`\n }\n\n return result\n },\n tuple(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n\n return `z.tuple([${items.join(', ')}])`\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const members = nodeMembers.map((m) => this.transform(m)).filter(Boolean)\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n if (node.discriminatorPropertyName && !nodeMembers.some((m) => m.type === 'intersection')) {\n // z.discriminatedUnion requires ZodObject members; intersections (ZodIntersection) are not\n // assignable to $ZodDiscriminant, so fall back to z.union when any member is an intersection.\n return `z.discriminatedUnion(${stringify(node.discriminatorPropertyName)}, [${members.join(', ')}])`\n }\n\n return `z.union([${members.join(', ')}])`\n },\n intersection(node) {\n const members = node.members ?? []\n if (members.length === 0) return ''\n\n const [first, ...rest] = members\n if (!first) return ''\n\n let base = this.transform(first)\n if (!base) return ''\n\n for (const member of rest) {\n if (member.primitive === 'string') {\n const s = ast.narrowSchema(member, 'string')\n const c = lengthChecksMini(s ?? {})\n if (c) {\n base += c\n continue\n }\n } else if (member.primitive === 'number' || member.primitive === 'integer') {\n const n = ast.narrowSchema(member, 'number') ?? ast.narrowSchema(member, 'integer')\n const c = numberChecksMini(n ?? {})\n if (c) {\n base += c\n continue\n }\n } else if (member.primitive === 'array') {\n const a = ast.narrowSchema(member, 'array')\n const c = lengthChecksMini(a ?? {})\n if (c) {\n base += c\n continue\n }\n }\n const transformed = this.transform(member)\n if (transformed) base = `z.intersection(${base}, ${transformed})`\n }\n\n return base\n },\n ...options.nodes,\n },\n print(node) {\n const { keysToOmit } = this.options\n\n let base = this.transform(node)\n if (!base) return null\n\n const meta = ast.syncSchemaRef(node)\n\n if (keysToOmit?.length && meta.primitive === 'object' && !(meta.type === 'union' && meta.discriminatorPropertyName)) {\n // Mirror printerTs `nonNullable: true`: when omitting keys, the resulting\n // schema is a new non-nullable object type — skip optional/nullable/nullish.\n // Discriminated unions (z.discriminatedUnion) do not support .omit(), so skip them.\n\n // If this is a lazy reference, apply omit inside the lazy function\n const lazyMatch = base.match(/^z\\.lazy\\(\\(\\)\\s*=>\\s*(.+)\\)$/)\n if (lazyMatch) {\n base = `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} }))`\n } else {\n base = `${base}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} })`\n }\n }\n\n return applyMiniModifiers({\n value: base,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n })\n },\n }\n})\n","import type { Adapter } from '@kubb/core'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { AdapterOas } from '@kubb/adapter-oas'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Operations } from '../components/Operations.tsx'\nimport { Zod } from '../components/Zod.tsx'\nimport { ZOD_NAMESPACE_IMPORTS } from '../constants.ts'\nimport { printerZod } from '../printers/printerZod.ts'\nimport { printerZodMini } from '../printers/printerZodMini.ts'\nimport type { PluginZod } from '../types'\nimport { buildSchemaNames } from '../utils.ts'\n\nexport const zodGenerator = defineGenerator<PluginZod>({\n name: 'zod',\n renderer: jsxRenderer,\n schema(node, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, printer } = ctx.options\n const dateType = (adapter as Adapter<AdapterOas>).options.dateType\n\n if (!node.name) {\n return\n }\n\n const mode = ctx.getMode(output)\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const imports = adapter.getImports(node, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n\n const meta = {\n name: resolver.resolveSchemaName(node.name),\n file: resolver.resolveFile({ name: node.name, extname: '.ts' }, { root, output, group }),\n } as const\n\n const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : undefined\n\n const cyclicSchemas = adapter.inputNode ? ast.findCircularSchemas(adapter.inputNode.schemas) : undefined\n\n const schemaPrinter = mini\n ? printerZodMini({ guidType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n : printerZod({ coercion, guidType, dateType, wrapOutput, resolver, cyclicSchemas, nodes: printer?.nodes })\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(adapter.inputNode, { output, config })}\n footer={resolver.resolveFooter(adapter.inputNode, { output, config })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {mode === 'split' && imports.map((imp) => <File.Import key={[node.name, imp.path].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n\n <Zod name={meta.name} node={node} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </File>\n )\n },\n operation(node, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, printer } = ctx.options\n const dateType = (adapter as Adapter<AdapterOas>).options.dateType\n\n const mode = ctx.getMode(output)\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const params = ast.caseParams(node.parameters, paramsCasing)\n\n const meta = {\n file: resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n } as const\n\n const cyclicSchemas = adapter.inputNode ? ast.findCircularSchemas(adapter.inputNode.schemas) : undefined\n\n function renderSchemaEntry({ schema, name, keysToOmit }: { schema: ast.SchemaNode | null; name: string; keysToOmit?: Array<string> }) {\n if (!schema) return null\n\n const inferTypeName = inferred ? resolver.resolveTypeName(name) : undefined\n\n const imports = adapter.getImports(schema, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n\n const schemaPrinter = mini\n ? printerZodMini({ guidType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n : printerZod({ coercion, guidType, dateType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n <Zod name={name} node={schema} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </>\n )\n }\n\n const paramSchemas = params.map((param) => renderSchemaEntry({ schema: param.schema, name: resolver.resolveParamName(node, param) }))\n\n const responseSchemas = node.responses.map((res) =>\n renderSchemaEntry({\n schema: res.schema,\n name: resolver.resolveResponseStatusName(node, res.statusCode),\n keysToOmit: res.keysToOmit,\n }),\n )\n\n const responsesWithSchema = node.responses.filter((res) => res.schema)\n const responseUnionSchema =\n responsesWithSchema.length > 0\n ? (() => {\n const responseUnionName = resolver.resolveResponseName(node)\n\n // Collect all import names from response schemas to detect naming collisions.\n // When a response is a $ref to a component schema whose resolved name matches\n // the response union name, skip generation to avoid redeclaration errors.\n const importedNames = new Set(\n responsesWithSchema.flatMap((res) =>\n res.schema\n ? adapter\n .getImports(res.schema, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: '',\n }))\n .flatMap((imp) => (Array.isArray(imp.name) ? imp.name : [imp.name]))\n : [],\n ),\n )\n\n if (importedNames.has(responseUnionName)) {\n return null\n }\n\n const members = responsesWithSchema.map((res) => ast.createSchema({ type: 'ref', name: resolver.resolveResponseStatusName(node, res.statusCode) }))\n const unionNode = members.length === 1 ? members[0]! : ast.createSchema({ type: 'union', members })\n\n return renderSchemaEntry({\n schema: unionNode,\n name: responseUnionName,\n })\n })()\n : null\n\n const requestSchema = node.requestBody?.content?.[0]?.schema\n ? renderSchemaEntry({\n schema: {\n ...node.requestBody.content![0]!.schema!,\n description: node.requestBody.description ?? node.requestBody.content![0]!.schema!.description,\n },\n name: resolver.resolveDataName(node),\n keysToOmit: node.requestBody.content![0]!.keysToOmit,\n })\n : null\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(adapter.inputNode, { output, config })}\n footer={resolver.resolveFooter(adapter.inputNode, { output, config })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {paramSchemas}\n {responseSchemas}\n {responseUnionSchema}\n {requestSchema}\n </File>\n )\n },\n operations(nodes, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, importPath, group, operations, paramsCasing } = ctx.options\n\n if (!operations) {\n return\n }\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const meta = {\n file: resolver.resolveFile({ name: 'operations', extname: '.ts' }, { root, output, group }),\n } as const\n\n const transformedOperations = nodes.map((node) => {\n const params = ast.caseParams(node.parameters, paramsCasing)\n\n return {\n node,\n data: buildSchemaNames(node, { params, resolver }),\n }\n })\n\n const imports = transformedOperations.flatMap(({ node, data }) => {\n const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean) as string[]\n const opFile = resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group })\n\n return names.map((name) => <File.Import key={[name, opFile.path].join('-')} name={[name]} root={meta.file.path} path={opFile.path} />)\n })\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(adapter.inputNode, { output, config })}\n footer={resolver.resolveFooter(adapter.inputNode, { output, config })}\n >\n <File.Import isTypeOnly name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {imports}\n <Operations name=\"operations\" operations={transformedOperations} />\n </File>\n )\n },\n})\n","import { camelCase, pascalCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginZod } from '../types.ts'\n\n/**\n * Naming convention resolver for Zod plugin.\n *\n * Provides default naming helpers using camelCase with a `Schema` suffix for schemas.\n *\n * @example\n * `resolverZod.default('list pets', 'function') // → 'listPetsSchema'`\n */\nexport const resolverZod = defineResolver<PluginZod>((ctx) => {\n return {\n name: 'default',\n pluginName: 'plugin-zod',\n default(name, type) {\n return camelCase(name, { isFile: type === 'file', suffix: type ? 'schema' : undefined })\n },\n resolveSchemaName(name) {\n return camelCase(name, { suffix: 'schema' })\n },\n resolveSchemaTypeName(name) {\n return pascalCase(name, { suffix: 'schema' })\n },\n resolveTypeName(name) {\n return pascalCase(name)\n },\n resolvePathName(name, type) {\n return ctx.default(name, type)\n },\n resolveParamName(node, param) {\n return ctx.resolveSchemaName(`${node.operationId} ${param.in} ${param.name}`)\n },\n resolveResponseStatusName(node, statusCode) {\n return ctx.resolveSchemaName(`${node.operationId} Status ${statusCode}`)\n },\n resolveDataName(node) {\n return ctx.resolveSchemaName(`${node.operationId} Data`)\n },\n resolveResponsesName(node) {\n return ctx.resolveSchemaName(`${node.operationId} Responses`)\n },\n resolveResponseName(node) {\n return ctx.resolveSchemaName(`${node.operationId} Response`)\n },\n resolvePathParamsName(node, param) {\n return ctx.resolveParamName(node, param)\n },\n resolveQueryParamsName(node, param) {\n return ctx.resolveParamName(node, param)\n },\n resolveHeaderParamsName(node, param) {\n return ctx.resolveParamName(node, param)\n },\n }\n})\n","import { camelCase } from '@internals/utils'\nimport { definePlugin, type Group } from '@kubb/core'\nimport { zodGenerator } from './generators/zodGenerator.tsx'\nimport { resolverZod } from './resolvers/resolverZod.ts'\nimport type { PluginZod } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-zod`, used in driver lookups and warnings.\n */\nexport const pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\n/**\n * Generates Zod validation schemas from an OpenAPI specification.\n * Walks schemas and operations, delegates to generators, and writes barrel files\n * based on the configured `barrelType`.\n *\n * @example Zod schema generator\n * ```ts\n * import pluginZod from '@kubb/plugin-zod'\n * export default defineConfig({\n * plugins: [pluginZod({ output: { path: 'zod' } })]\n * })\n * ```\n */\nexport const pluginZod = definePlugin<PluginZod>((options) => {\n const {\n output = { path: 'zod', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n typed = false,\n operations = false,\n mini = false,\n guidType = 'uuid',\n importPath = mini ? 'zod/mini' : 'zod',\n coercion = false,\n inferred = false,\n wrapOutput = undefined,\n paramsCasing,\n printer,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const groupConfig = group\n ? ({\n ...group,\n name: (ctx) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n },\n } satisfies Group)\n : undefined\n\n return {\n name: pluginZodName,\n options,\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n typed,\n importPath,\n coercion,\n operations,\n inferred,\n guidType,\n mini,\n wrapOutput,\n paramsCasing,\n printer,\n })\n ctx.setResolver(userResolver ? { ...resolverZod, ...userResolver } : resolverZod)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n ctx.addGenerator(zodGenerator)\n for (const gen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,cAAc,QACf;EACC,GAAG;EACH,OAAO,QAAQ;AACb,OAAI,MAAM,SAAS,OACjB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,UAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;EAElC,GACD,KAAA;AAEJ,QAAO;EACL,MAAM;EACN;EACA,OAAO,EACL,oBAAoB,KAAK;AACvB,OAAI,WAAW;IACb;IACA;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,CAAC;AACF,OAAI,YAAY,eAAe;IAAE,GAAG;IAAa,GAAG;IAAc,GAAG,YAAY;AACjF,OAAI,gBACF,KAAI,eAAe,gBAAgB;AAErC,OAAI,aAAa,aAAa;AAC9B,QAAK,MAAM,OAAO,eAChB,KAAI,aAAa,IAAI;KAG1B;EACF;EACD"}
1
+ {"version":3,"file":"index.js","names":["strictOneOfMember"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.ts","../../../internals/utils/src/reserved.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/group.ts","../src/components/Operations.tsx","../src/components/Zod.tsx","../src/constants.ts","../src/utils.ts","../src/printers/printerZod.ts","../src/printers/printerZodMini.ts","../src/generators/zodGenerator.tsx","../src/resolvers/resolverZod.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * toRegExpString('^(?im)foo') // → 'new RegExp(\"foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // → '/foo/im'\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n","import { URLPath } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.resolveFile`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.resolveFile(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${new URLPath(node.path).URL}}` : null\n }\n\n return node.path ? `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}` : null\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type — a binary type\n * (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`, `video/*`) maps to `'blob'`\n * and other `text/*` maps to `'text'`. Otherwise `undefined`, leaving the runtime client's\n * `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n\n const baseType = contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nexport function getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = ast.caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isSuccessStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.paramsCasing ?? ''}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).\n *\n * Returns `null` when grouping is disabled, matching the per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.\n * @param options.honorName - When `true`, a user-provided `group.name` overrides the default namer.\n *\n * @example\n * ```ts\n * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-zod\n * createGroupConfig(group, { suffix: 'Controller', honorName: true }) // plugin-faker, plugin-client, …\n * createGroupConfig(group, { suffix: 'Requests', honorName: true }) // plugin-cypress, plugin-mcp\n * ```\n */\nexport function createGroupConfig(group: Group | undefined, options: { suffix: string; honorName?: boolean }): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return `${camelCase(ctx.group)}${options.suffix}`\n }\n\n return {\n ...group,\n name: options.honorName && group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { stringifyObject } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport { Const, File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype SchemaNames = {\n request: string | null\n parameters: {\n path: string | null\n query: string | null\n header: string | null\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype Props = {\n name: string\n operations: Array<{ node: ast.OperationNode; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props): KubbReactNode {\n const operationsJSON = operations.reduce<Record<string, unknown>>(\n (prev, acc) => {\n prev[`\"${acc.node.operationId}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce<Record<string, Record<string, string>>>((prev, acc) => {\n if (!ast.isHttpOperationNode(acc.node)) return prev\n prev[`\"${acc.node.path}\"`] = {\n ...(prev[`\"${acc.node.path}\"`] ?? {}),\n [acc.node.method]: `operations[\"${acc.node.operationId}\"]`,\n }\n\n return prev\n }, {})\n\n return (\n <>\n <File.Source name=\"OperationSchema\" isExportable isIndexable>\n <Type name=\"OperationSchema\" export>{`{\n readonly request: z.ZodTypeAny | undefined;\n readonly parameters: {\n readonly path: z.ZodTypeAny | undefined;\n readonly query: z.ZodTypeAny | undefined;\n readonly header: z.ZodTypeAny | undefined;\n };\n readonly responses: {\n readonly [status: number]: z.ZodTypeAny;\n readonly default: z.ZodTypeAny;\n };\n readonly errors: {\n readonly [status: number]: z.ZodTypeAny;\n };\n}`}</Type>\n </File.Source>\n <File.Source name=\"OperationsMap\" isExportable isIndexable>\n <Type name=\"OperationsMap\" export>\n {'Record<string, OperationSchema>'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name} asConst>\n {`{${stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport { Const, File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PrinterZodFactory } from '../printers/printerZod.ts'\nimport type { PrinterZodMiniFactory } from '../printers/printerZodMini.ts'\n\ntype Props = {\n name: string\n node: ast.SchemaNode\n /**\n * Pre-configured printer instance created by the generator.\n * The generator selects `printerZod` or `printerZodMini` based on the `mini` option,\n * then merges in any user-supplied `printer.nodes` overrides.\n */\n printer: ast.Printer<PrinterZodFactory> | ast.Printer<PrinterZodMiniFactory>\n inferTypeName?: string | null\n}\n\nexport function Zod({ name, node, printer, inferTypeName }: Props): KubbReactNode {\n const output = printer.print(node)\n\n if (!output) {\n return\n }\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name}>\n {output}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n </File.Source>\n )}\n </>\n )\n}\n","/**\n * Import paths that use a namespace import (`import * as z from '...'`).\n * All other import paths use a named import (`import { z } from '...'`).\n */\nexport const ZOD_NAMESPACE_IMPORTS = new Set(['zod', 'zod/mini'] as const)\n","import { stringify, toRegExpString } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from './types.ts'\n\n/**\n * Returns `true` when the given coercion option enables coercion for the specified type.\n */\nexport function shouldCoerce(coercion: PluginZod['resolvedOptions']['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean {\n if (coercion === undefined || coercion === false) return false\n if (coercion === true) return true\n\n return !!coercion[type]\n}\n\n/**\n * A codec for a schema node whose runtime type differs from its JSON wire type:\n * the output (response) schema decodes wire → runtime, and the input (request)\n * variant encodes runtime → wire.\n *\n * To support another codec type, append a `Codec` to `codecs` and route that\n * type's printer node handler through `getCodec`.\n */\nexport type Codec = {\n /**\n * Whether this node is encoded/decoded by this codec.\n */\n matches(node: ast.SchemaNode): boolean\n /**\n * Output direction (response): decode the wire value into the runtime type.\n */\n decode(node: ast.SchemaNode): string\n /**\n * Input direction (request): encode the runtime value back to the wire value.\n */\n encode(node: ast.SchemaNode): string\n}\n\n/**\n * `dateType: 'date'` fields are typed as `Date` but travel as ISO `string`s.\n * Output decodes `string → Date`; input encodes `Date → string`, preserving the\n * `date` (`YYYY-MM-DD`) vs `date-time` precision carried on `node.format`.\n */\nconst dateCodec: Codec = {\n matches(node) {\n return node.type === 'date' && node.representation === 'date'\n },\n decode(node) {\n return node.format === 'date' ? 'z.iso.date().transform((value) => new Date(value))' : 'z.iso.datetime().transform((value) => new Date(value))'\n },\n encode(node) {\n return node.format === 'date' ? 'z.date().transform((value) => value.toISOString().slice(0, 10))' : 'z.date().transform((value) => value.toISOString())'\n },\n}\n\n/**\n * Registered codecs, checked in order.\n */\nconst codecs: Array<Codec> = [dateCodec]\n\n/**\n * Returns the codec for this node, or `undefined` when the node needs no\n * encode/decode (its wire and runtime types match).\n */\nexport function getCodec(node: ast.SchemaNode | undefined): Codec | undefined {\n if (!node) return undefined\n return codecs.find((codec) => codec.matches(node))\n}\n\n/**\n * Returns `true` when the node itself is encoded/decoded by a codec.\n */\nexport function hasCodec(node: ast.SchemaNode | undefined): boolean {\n return getCodec(node) !== undefined\n}\n\n/**\n * Returns `true` when the schema transitively contains a codec node —\n * a value whose runtime type differs from its wire type (see {@link hasCodec}),\n * so it must be decoded (response) or encoded (request) at the validation boundary.\n * `$ref`s are followed via their resolved schema; a `seen` set guards cycles.\n */\nexport function containsCodec(node: ast.SchemaNode | undefined, seen: Set<string> = new Set()): boolean {\n if (!node) return false\n\n if (hasCodec(node)) return true\n\n if (node.type === 'ref') {\n if (!node.ref) return false\n const refName = ast.extractRefName(node.ref)\n if (refName) {\n if (seen.has(refName)) return false\n seen.add(refName)\n }\n const resolved = ast.syncSchemaRef(node)\n if (resolved.type === 'ref') return false\n return containsCodec(resolved, seen)\n }\n\n const children: Array<ast.SchemaNode | undefined> = []\n if ('properties' in node && node.properties) children.push(...node.properties.map((prop) => prop.schema))\n if ('items' in node && node.items) children.push(...node.items)\n if ('members' in node && node.members) children.push(...node.members)\n if ('additionalProperties' in node && node.additionalProperties && node.additionalProperties !== true) children.push(node.additionalProperties)\n\n return children.some((child) => containsCodec(child, seen))\n}\n\n/**\n * Collects all resolved schema names for an operation's parameters and responses\n * into a single lookup object, useful for building imports and type references.\n */\nexport function buildSchemaNames(node: ast.OperationNode, { params, resolver }: { params: Array<ast.ParameterNode>; resolver: ResolverZod }) {\n const pathParam = params.find((p) => p.in === 'path')\n const queryParam = params.find((p) => p.in === 'query')\n const headerParam = params.find((p) => p.in === 'header')\n\n const responses: Record<number | string, string> = {}\n const errors: Record<number | string, string> = {}\n\n for (const res of node.responses) {\n const name = resolver.resolveResponseStatusName(node, res.statusCode)\n const statusNum = Number(res.statusCode)\n\n if (!Number.isNaN(statusNum)) {\n responses[statusNum] = name\n if (statusNum >= 400) {\n errors[statusNum] = name\n }\n }\n }\n\n responses['default'] = resolver.resolveResponseName(node)\n\n return {\n request: node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null,\n parameters: {\n path: pathParam ? resolver.resolvePathParamsName(node, pathParam) : null,\n query: queryParam ? resolver.resolveQueryParamsName(node, queryParam) : null,\n header: headerParam ? resolver.resolveHeaderParamsName(node, headerParam) : null,\n },\n responses,\n errors,\n }\n}\n\n/**\n * Format a default value as a code-level literal.\n * Objects become `{}`, primitives become their string representation, strings are quoted.\n */\nexport function formatDefault(value: unknown): string {\n if (typeof value === 'string') return stringify(value)\n if (typeof value === 'object' && value !== null) return '{}'\n\n return String(value ?? '')\n}\n\n/**\n * Format a primitive enum/literal value.\n * Strings are quoted; numbers and booleans are emitted raw.\n */\nexport function formatLiteral(v: string | number | boolean): string {\n if (typeof v === 'string') return stringify(v)\n\n return String(v)\n}\n\n/**\n * Numeric constraint limits for Zod schemas (min, max, and exclusive bounds).\n */\nexport type NumericConstraints = {\n min?: number\n max?: number\n exclusiveMinimum?: number\n exclusiveMaximum?: number\n multipleOf?: number\n}\n\n/**\n * Length constraint limits for string and array schemas (min, max, and regex pattern).\n */\nexport type LengthConstraints = {\n min?: number\n max?: number\n pattern?: string\n}\n\n/**\n * Modifier options for applying chainable methods to Zod schema values.\n */\nexport type ModifierOptions = {\n value: string\n nullable?: boolean\n optional?: boolean\n nullish?: boolean\n defaultValue?: unknown\n description?: string\n}\n\n/**\n * Build `.min()` / `.max()` / `.gt()` / `.lt()` constraint chains for numbers\n * using the standard chainable Zod v4 API.\n */\nexport function numberConstraints({ min, max, exclusiveMinimum, exclusiveMaximum, multipleOf }: NumericConstraints): string {\n return [\n min !== undefined ? `.min(${min})` : '',\n max !== undefined ? `.max(${max})` : '',\n exclusiveMinimum !== undefined ? `.gt(${exclusiveMinimum})` : '',\n exclusiveMaximum !== undefined ? `.lt(${exclusiveMaximum})` : '',\n multipleOf !== undefined ? `.multipleOf(${multipleOf})` : '',\n ].join('')\n}\n\n/**\n * Build `.min()` / `.max()` / `.regex()` chains for strings/arrays\n * using the standard chainable Zod v4 API.\n */\nexport function lengthConstraints({ min, max, pattern }: LengthConstraints): string {\n return [\n min !== undefined ? `.min(${min})` : '',\n max !== undefined ? `.max(${max})` : '',\n pattern !== undefined ? `.regex(${toRegExpString(pattern, null)})` : '',\n ].join('')\n}\n\n/**\n * Build `.check(z.minimum(), z.maximum())` for `zod/mini` numeric constraints.\n */\nexport function numberChecksMini({ min, max, exclusiveMinimum, exclusiveMaximum, multipleOf }: NumericConstraints): string {\n const checks: Array<string> = []\n if (min !== undefined) checks.push(`z.minimum(${min})`)\n if (max !== undefined) checks.push(`z.maximum(${max})`)\n if (exclusiveMinimum !== undefined) checks.push(`z.minimum(${exclusiveMinimum}, { exclusive: true })`)\n if (exclusiveMaximum !== undefined) checks.push(`z.maximum(${exclusiveMaximum}, { exclusive: true })`)\n if (multipleOf !== undefined) checks.push(`z.multipleOf(${multipleOf})`)\n return checks.length ? `.check(${checks.join(', ')})` : ''\n}\n\n/**\n * Build `.check(z.minLength(), z.maxLength(), z.regex())` for `zod/mini` length constraints.\n */\nexport function lengthChecksMini({ min, max, pattern }: LengthConstraints): string {\n const checks: Array<string> = []\n if (min !== undefined) checks.push(`z.minLength(${min})`)\n if (max !== undefined) checks.push(`z.maxLength(${max})`)\n if (pattern !== undefined) checks.push(`z.regex(${toRegExpString(pattern, null)})`)\n return checks.length ? `.check(${checks.join(', ')})` : ''\n}\n\n/**\n * Apply nullable / optional / nullish modifiers and an optional `.describe()` call\n * to a schema value string using the chainable Zod v4 API.\n */\nexport function applyModifiers({ value, nullable, optional, nullish, defaultValue, description }: ModifierOptions): string {\n const withModifier = (() => {\n if (nullish || (nullable && optional)) return `${value}.nullish()`\n if (optional) return `${value}.optional()`\n if (nullable) return `${value}.nullable()`\n return value\n })()\n const withDefault = defaultValue !== undefined ? `${withModifier}.default(${formatDefault(defaultValue)})` : withModifier\n return description ? `${withDefault}.describe(${stringify(description)})` : withDefault\n}\n\n/**\n * Apply nullable / optional / nullish modifiers using the functional `zod/mini` API\n * (`z.nullable()`, `z.optional()`, `z.nullish()`).\n */\nexport function applyMiniModifiers({ value, nullable, optional, nullish, defaultValue }: Omit<ModifierOptions, 'description'>): string {\n const withModifier = (() => {\n if (nullish) return `z.nullish(${value})`\n const withNullable = nullable ? `z.nullable(${value})` : value\n return optional ? `z.optional(${withNullable})` : withNullable\n })()\n return defaultValue !== undefined ? `z._default(${withModifier}, ${formatDefault(defaultValue)})` : withModifier\n}\n\ntype BuildGroupedParamsSchemaOptions = {\n params: Array<ast.ParameterNode>\n optional?: boolean\n}\n\n/**\n * Builds an `object` schema node grouping the given parameter nodes.\n * The `primitive: 'object'` marker ensures the Zod printer emits `z.object(…)` rather than a record.\n */\nexport function buildGroupedParamsSchema({ params, optional }: BuildGroupedParamsSchemaOptions): ast.SchemaNode {\n return ast.createSchema({\n type: 'object',\n optional,\n primitive: 'object',\n properties: params.map((param) =>\n ast.createProperty({\n name: param.name,\n required: param.required,\n schema: param.schema,\n }),\n ),\n })\n}\n","import { stringify } from '@internals/utils'\n\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyModifiers, containsCodec, formatLiteral, getCodec, lengthConstraints, numberConstraints, shouldCoerce } from '../utils.ts'\nimport type { AdapterOas } from '@kubb/adapter-oas'\n\n/**\n * Partial map of node-type overrides for the Zod printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginZod({\n * printer: {\n * nodes: {\n * date(node) {\n * return 'z.string().date()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterZodNodes = ast.PrinterPartial<string, PrinterZodOptions>\n\nexport type PrinterZodOptions = {\n /**\n * Enable automatic type coercion for strings, numbers, and dates.\n */\n coercion?: PluginZod['resolvedOptions']['coercion']\n /**\n * Use `z.guid()` or `z.uuid()` for UUID/GUID validation.\n *\n * @default 'uuid'\n */\n guidType?: PluginZod['resolvedOptions']['guidType']\n /**\n * Date format in the OpenAPI spec (`'date'` or `'date-time'`).\n */\n dateType?: AdapterOas['resolvedOptions']['dateType']\n /**\n * Hook to transform generated Zod schema before output.\n */\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n /**\n * Transforms raw schema names into valid JavaScript identifiers.\n */\n resolver?: ResolverZod\n /**\n * Properties to exclude using `.omit({ key: true })`.\n */\n keysToOmit?: Array<string> | null\n /**\n * Schema names that form circular dependency chains.\n * Properties referencing these emit lazy getters wrapping refs in `z.lazy(() => …)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Print direction for `dateType: 'date'` fields (`Date` in TypeScript):\n * - `'output'` (default) — decode the wire `string` into a `Date` (response bodies).\n * - `'input'` — encode a `Date` back into the wire `string` (request bodies/params).\n *\n * Diverging the directions requires the generator to emit an `${name}InputSchema`\n * variant for each date-bearing component.\n */\n direction?: 'input' | 'output'\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterZodNodes\n}\n\n/**\n * Factory options for the Zod printer, defining input/output types and configuration.\n */\nexport type PrinterZodFactory = ast.PrinterFactoryOptions<'zod', PrinterZodOptions, string, string>\n\nfunction strictOneOfMember(member: string, node: ast.SchemaNode): string {\n if (node.type === 'object' && node.additionalProperties === undefined) {\n return `${member}.strict()`\n }\n\n if (node.type === 'ref') {\n if (member.startsWith('z.lazy(')) {\n return member\n }\n\n const schema = ast.syncSchemaRef(node)\n\n if (schema.type === 'object' && (schema.additionalProperties === undefined || schema.additionalProperties === false)) {\n return `${member}.strict()`\n }\n }\n\n return member\n}\n\nfunction getMemberConstraint(member: ast.SchemaNode): string | undefined {\n if (member.primitive === 'string') return lengthConstraints(ast.narrowSchema(member, 'string') ?? {}) || undefined\n if (member.primitive === 'number' || member.primitive === 'integer')\n return numberConstraints(ast.narrowSchema(member, 'number') ?? ast.narrowSchema(member, 'integer') ?? {}) || undefined\n if (member.primitive === 'array') return lengthConstraints(ast.narrowSchema(member, 'array') ?? {}) || undefined\n}\n\n/**\n * Zod v4 printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST into a Zod v4 code string using the chainable API\n * (`.optional()`, `.nullable()`, `.omit()`, etc.). For improved tree-shaking, see {@link printerZodMini}.\n *\n * @example Chainable API\n * ```ts\n * const printer = printerZod({ coercion: false })\n * const code = printer.print(stringNode) // \"z.string()\"\n * ```\n */\nexport const printerZod = ast.definePrinter<PrinterZodFactory>((options) => {\n return {\n name: 'zod',\n options,\n nodes: {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n never: () => 'z.never()',\n boolean: () => 'z.boolean()',\n null: () => 'z.null()',\n string(node) {\n const base = shouldCoerce(this.options.coercion, 'strings') ? 'z.coerce.string()' : 'z.string()'\n\n return `${base}${lengthConstraints(node)}`\n },\n number(node) {\n const base = shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.number()' : 'z.number()'\n\n return `${base}${numberConstraints(node)}`\n },\n integer(node) {\n const base = shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.number().int()' : 'z.int()'\n\n return `${base}${numberConstraints(node)}`\n },\n bigint() {\n return shouldCoerce(this.options.coercion, 'numbers') ? 'z.coerce.bigint()' : 'z.bigint()'\n },\n date(node) {\n // representation: 'date' → typed as `Date`; decode/encode at the boundary.\n const codec = getCodec(node)\n if (codec) {\n return this.options.direction === 'input' ? codec.encode(node) : codec.decode(node)\n }\n\n return 'z.iso.date()'\n },\n datetime(node) {\n const offset = node.offset || this.options.dateType === 'stringOffset'\n const local = node.local || this.options.dateType === 'stringLocal'\n\n if (offset) return 'z.iso.datetime({ offset: true })'\n if (local) return 'z.iso.datetime({ local: true })'\n\n return 'z.iso.datetime()'\n },\n time(node) {\n if (node.representation === 'string') {\n return 'z.iso.time()'\n }\n\n return shouldCoerce(this.options.coercion, 'dates') ? 'z.coerce.date()' : 'z.date()'\n },\n uuid(node) {\n const base = this.options.guidType === 'guid' ? 'z.guid()' : 'z.uuid()'\n\n return `${base}${lengthConstraints(node)}`\n },\n email(node) {\n return `z.email()${lengthConstraints(node)}`\n },\n url(node) {\n return `z.url()${lengthConstraints(node)}`\n },\n ipv4: () => 'z.ipv4()',\n ipv6: () => 'z.ipv6()',\n blob: () => 'z.instanceof(File)',\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n const nonNullValues = values.filter((v): v is string | number | boolean => v !== null)\n\n // asConst-style enum: use z.union([z.literal(…), …])\n if (node.namedEnumValues?.length) {\n const literals = nonNullValues.map((v) => `z.literal(${formatLiteral(v)})`)\n\n if (literals.length === 1) return literals[0]!\n return `z.union([${literals.join(', ')}])`\n }\n\n // Regular enum: use z.enum([…])\n return `z.enum([${nonNullValues.map(formatLiteral).join(', ')}])`\n },\n ref(node) {\n if (!node.name) return null\n const refName = node.ref ? (ast.extractRefName(node.ref) ?? node.name) : node.name\n\n // In the input direction, a date-bearing component resolves to its `${name}InputSchema`\n // variant so request bodies encode `Date → string` instead of decoding.\n const useInputVariant = node.ref != null && this.options.direction === 'input' && containsCodec(node)\n const resolvedName = node.ref\n ? useInputVariant\n ? (this.options.resolver?.resolveInputSchemaName(refName) ?? refName)\n : (this.options.resolver?.default(refName, 'function') ?? refName)\n : node.name\n\n if (node.ref && this.options.cyclicSchemas?.has(refName)) {\n return `z.lazy(() => ${resolvedName})`\n }\n\n return resolvedName\n },\n object(node) {\n const properties = node.properties\n .map((prop) => {\n const { name: propName, schema } = prop\n\n const meta = ast.syncSchemaRef(schema)\n\n const isNullable = meta.nullable\n const isOptional = schema.optional\n const isNullish = schema.nullish\n\n const hasSelfRef = this.options.cyclicSchemas != null && ast.containsCircularRef(schema, { circularSchemas: this.options.cyclicSchemas })\n // Inside a getter the getter itself defers evaluation, so suppress\n // z.lazy() wrapping on nested refs by temporarily clearing cyclicSchemas.\n // Save before clearing: this.options === options (same reference via definePrinter),\n // so reading options.cyclicSchemas after mutation would return undefined.\n const savedCyclicSchemas = this.options.cyclicSchemas\n if (hasSelfRef) this.options.cyclicSchemas = undefined\n const baseOutput = this.transform(schema) ?? this.transform(ast.createSchema({ type: 'unknown' }))!\n if (hasSelfRef) this.options.cyclicSchemas = savedCyclicSchemas\n\n const wrappedOutput = this.options.wrapOutput ? this.options.wrapOutput({ output: baseOutput, schema }) || baseOutput : baseOutput\n\n // When a property schema is not a ref but the metadata is from a ref (e.g., discriminator\n // property override), skip applying the description from the ref target to avoid applying\n // metadata from a replaced schema.\n const descriptionToApply = schema.type !== 'ref' && meta.type === 'ref' ? undefined : meta.description\n\n const value = applyModifiers({\n value: wrappedOutput,\n nullable: isNullable,\n optional: isOptional,\n nullish: isNullish,\n defaultValue: meta.default,\n description: descriptionToApply,\n })\n\n if (hasSelfRef) {\n return `get \"${propName}\"() { return ${value} }`\n }\n return `\"${propName}\": ${value}`\n })\n .join(',\\n ')\n\n const objectBase = `z.object({\\n ${properties}\\n })`\n\n // Handle additionalProperties as .catchall() or .strict()\n const result = (() => {\n if (node.additionalProperties && node.additionalProperties !== true) {\n const catchallType = this.transform(node.additionalProperties)\n return catchallType ? `${objectBase}.catchall(${catchallType})` : objectBase\n }\n if (node.additionalProperties === true) return `${objectBase}.catchall(${this.transform(ast.createSchema({ type: 'unknown' }))})`\n if (node.additionalProperties === false) return `${objectBase}.strict()`\n return objectBase\n })()\n\n return result\n },\n array(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n const inner = items.join(', ') || this.transform(ast.createSchema({ type: 'unknown' }))!\n const base = `z.array(${inner})${lengthConstraints(node)}`\n\n return node.unique ? `${base}.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : base\n },\n tuple(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n\n return `z.tuple([${items.join(', ')}])`\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const members = nodeMembers\n .map((memberNode) => {\n const member = this.transform(memberNode)\n\n return member && node.strategy === 'one' ? strictOneOfMember(member, memberNode) : member\n })\n .filter(Boolean)\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n if (node.discriminatorPropertyName && !nodeMembers.some((m) => m.type === 'intersection')) {\n // z.discriminatedUnion requires ZodObject members; intersections (ZodIntersection) are not\n // assignable to $ZodDiscriminant, so fall back to z.union when any member is an intersection.\n return `z.discriminatedUnion(${stringify(node.discriminatorPropertyName)}, [${members.join(', ')}])`\n }\n\n return `z.union([${members.join(', ')}])`\n },\n intersection(node) {\n const members = node.members ?? []\n if (members.length === 0) return ''\n\n const [first, ...rest] = members\n if (!first) return ''\n\n const firstBase = this.transform(first)\n if (!firstBase) return ''\n\n return rest.reduce((acc, member) => {\n const constraint = getMemberConstraint(member)\n if (constraint) return acc + constraint\n const transformed = this.transform(member)\n return transformed ? `${acc}.and(${transformed})` : acc\n }, firstBase)\n },\n ...options.nodes,\n },\n print(node) {\n const { keysToOmit } = this.options\n\n const transformed = this.transform(node)\n if (!transformed) return null\n\n const meta = ast.syncSchemaRef(node)\n\n const base = (() => {\n if (!keysToOmit?.length || meta.primitive !== 'object' || (meta.type === 'union' && meta.discriminatorPropertyName)) return transformed\n // Mirror printerTs `nonNullable: true`: when omitting keys, the resulting\n // schema is a new non-nullable object type — skip optional/nullable/nullish.\n // Discriminated unions (z.discriminatedUnion) do not support .omit(), so skip them.\n\n // If this is a lazy reference, apply omit inside the lazy function\n const lazyMatch = transformed.match(/^z\\.lazy\\(\\(\\)\\s*=>\\s*(.+)\\)$/)\n if (lazyMatch) return `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} }))`\n return `${transformed}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} })`\n })()\n\n return applyModifiers({\n value: base,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n description: meta.description,\n })\n },\n }\n})\n","import { stringify } from '@internals/utils'\n\nimport { ast } from '@kubb/core'\nimport type { PluginZod, ResolverZod } from '../types.ts'\nimport { applyMiniModifiers, formatLiteral, lengthChecksMini, numberChecksMini } from '../utils.ts'\n\n/**\n * Partial map of node-type overrides for the Zod Mini printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginZod({\n * mini: true,\n * printer: {\n * nodes: {\n * date(node) {\n * return 'z.iso.date()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterZodMiniNodes = ast.PrinterPartial<string, PrinterZodMiniOptions>\n\nexport type PrinterZodMiniOptions = {\n /**\n * Use `z.guid()` or `z.uuid()` for UUID/GUID validation.\n *\n * @default 'uuid'\n */\n guidType?: PluginZod['resolvedOptions']['guidType']\n /**\n * Hook to transform generated Zod schema before output.\n */\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n /**\n * Transforms raw schema names into valid JavaScript identifiers.\n */\n resolver?: ResolverZod\n /**\n * Properties to exclude using `.omit({ key: true })`.\n */\n keysToOmit?: Array<string> | null\n /**\n * Schema names that form circular dependency chains.\n * Properties referencing these emit lazy getters wrapping refs in `z.lazy(() => …)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterZodMiniNodes\n}\n\n/**\n * Factory options for the Zod Mini printer, defining input/output types and configuration.\n */\nexport type PrinterZodMiniFactory = ast.PrinterFactoryOptions<'zod-mini', PrinterZodMiniOptions, string, string>\n\nfunction strictOneOfMember(member: string, node: ast.SchemaNode): string {\n if (node.type === 'object' && (node.additionalProperties === undefined || node.additionalProperties === false)) {\n return member.replace(/^z\\.object\\(/, 'z.strictObject(')\n }\n\n return member\n}\n\nfunction getMemberConstraintMini(member: ast.SchemaNode): string | undefined {\n if (member.primitive === 'string') return lengthChecksMini(ast.narrowSchema(member, 'string') ?? {}) || undefined\n if (member.primitive === 'number' || member.primitive === 'integer')\n return numberChecksMini(ast.narrowSchema(member, 'number') ?? ast.narrowSchema(member, 'integer') ?? {}) || undefined\n if (member.primitive === 'array') return lengthChecksMini(ast.narrowSchema(member, 'array') ?? {}) || undefined\n}\n\n/**\n * Zod v4 **Mini** printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST into a Zod v4 code string using the functional API\n * (`z.optional(z.string())`) for improved tree-shaking. See {@link printerZod} for the chainable API.\n *\n * @example Functional Mini API\n * ```ts\n * const printer = printerZodMini({})\n * const code = printer.print(optionalStringNode) // \"z.optional(z.string())\"\n * ```\n */\nexport const printerZodMini = ast.definePrinter<PrinterZodMiniFactory>((options) => {\n return {\n name: 'zod-mini',\n options,\n nodes: {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n never: () => 'z.never()',\n boolean: () => 'z.boolean()',\n null: () => 'z.null()',\n string(node) {\n return `z.string()${lengthChecksMini(node)}`\n },\n number(node) {\n return `z.number()${numberChecksMini(node)}`\n },\n integer(node) {\n return `z.int()${numberChecksMini(node)}`\n },\n bigint(node) {\n return `z.bigint()${numberChecksMini(node)}`\n },\n date(node) {\n if (node.representation === 'string') {\n return 'z.iso.date()'\n }\n\n return 'z.date()'\n },\n datetime() {\n // Mini mode: datetime validation via z.string() (z.iso.datetime not available in mini)\n return 'z.string()'\n },\n time(node) {\n if (node.representation === 'string') {\n return 'z.iso.time()'\n }\n\n return 'z.date()'\n },\n uuid(node) {\n const base = this.options.guidType === 'guid' ? 'z.guid()' : 'z.uuid()'\n\n return `${base}${lengthChecksMini(node)}`\n },\n email(node) {\n return `z.email()${lengthChecksMini(node)}`\n },\n url(node) {\n return `z.url()${lengthChecksMini(node)}`\n },\n ipv4: () => 'z.ipv4()',\n ipv6: () => 'z.ipv6()',\n blob: () => 'z.instanceof(File)',\n enum(node) {\n const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n const nonNullValues = values.filter((v): v is string | number | boolean => v !== null)\n\n // asConst-style enum: use z.union([z.literal(…), …])\n if (node.namedEnumValues?.length) {\n const literals = nonNullValues.map((v) => `z.literal(${formatLiteral(v)})`)\n if (literals.length === 1) return literals[0]!\n return `z.union([${literals.join(', ')}])`\n }\n\n // Regular enum: use z.enum([…])\n return `z.enum([${nonNullValues.map(formatLiteral).join(', ')}])`\n },\n\n ref(node) {\n if (!node.name) return null\n const refName = node.ref ? (ast.extractRefName(node.ref) ?? node.name) : node.name\n const resolvedName = node.ref ? (this.options.resolver?.default(refName, 'function') ?? refName) : node.name\n\n if (node.ref && this.options.cyclicSchemas?.has(refName)) {\n return `z.lazy(() => ${resolvedName})`\n }\n\n return resolvedName\n },\n object(node) {\n const properties = node.properties\n .map((prop) => {\n const { name: propName, schema } = prop\n\n const meta = ast.syncSchemaRef(schema)\n\n const isNullable = meta.nullable\n const isOptional = schema.optional\n const isNullish = schema.nullish\n\n const hasSelfRef = this.options.cyclicSchemas != null && ast.containsCircularRef(schema, { circularSchemas: this.options.cyclicSchemas })\n // Inside a getter the getter itself defers evaluation, so suppress\n // z.lazy() wrapping on nested refs by temporarily clearing cyclicSchemas.\n // Save before clearing: this.options === options (same reference via definePrinter),\n // so reading options.cyclicSchemas after mutation would return undefined.\n const savedCyclicSchemas = this.options.cyclicSchemas\n if (hasSelfRef) this.options.cyclicSchemas = undefined\n const baseOutput = this.transform(schema) ?? this.transform(ast.createSchema({ type: 'unknown' }))!\n if (hasSelfRef) this.options.cyclicSchemas = savedCyclicSchemas\n\n const wrappedOutput = this.options.wrapOutput ? this.options.wrapOutput({ output: baseOutput, schema }) || baseOutput : baseOutput\n\n const value = applyMiniModifiers({\n value: wrappedOutput,\n nullable: isNullable,\n optional: isOptional,\n nullish: isNullish,\n defaultValue: meta.default,\n })\n\n if (hasSelfRef) {\n return `get \"${propName}\"() { return ${value} }`\n }\n return `\"${propName}\": ${value}`\n })\n .join(',\\n ')\n\n return `z.object({\\n ${properties}\\n })`\n },\n array(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n const inner = items.join(', ') || this.transform(ast.createSchema({ type: 'unknown' }))!\n const base = `z.array(${inner})${lengthChecksMini(node)}`\n\n return node.unique ? `${base}.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : base\n },\n tuple(node) {\n const items = (node.items ?? []).map((item) => this.transform(item)).filter(Boolean)\n\n return `z.tuple([${items.join(', ')}])`\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const members = nodeMembers\n .map((memberNode) => {\n const member = this.transform(memberNode)\n\n return member && node.strategy === 'one' ? strictOneOfMember(member, memberNode) : member\n })\n .filter(Boolean)\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n if (node.discriminatorPropertyName && !nodeMembers.some((m) => m.type === 'intersection')) {\n // z.discriminatedUnion requires ZodObject members; intersections (ZodIntersection) are not\n // assignable to $ZodDiscriminant, so fall back to z.union when any member is an intersection.\n return `z.discriminatedUnion(${stringify(node.discriminatorPropertyName)}, [${members.join(', ')}])`\n }\n\n return `z.union([${members.join(', ')}])`\n },\n intersection(node) {\n const members = node.members ?? []\n if (members.length === 0) return ''\n\n const [first, ...rest] = members\n if (!first) return ''\n\n const firstBase = this.transform(first)\n if (!firstBase) return ''\n\n return rest.reduce((acc, member) => {\n const constraint = getMemberConstraintMini(member)\n if (constraint) return acc + constraint\n const transformed = this.transform(member)\n return transformed ? `z.intersection(${acc}, ${transformed})` : acc\n }, firstBase)\n },\n ...options.nodes,\n },\n print(node) {\n const { keysToOmit } = this.options\n\n const transformed = this.transform(node)\n if (!transformed) return null\n\n const meta = ast.syncSchemaRef(node)\n\n const base = (() => {\n if (!keysToOmit?.length || meta.primitive !== 'object' || (meta.type === 'union' && meta.discriminatorPropertyName)) return transformed\n // Mirror printerTs `nonNullable: true`: when omitting keys, the resulting\n // schema is a new non-nullable object type — skip optional/nullable/nullish.\n // Discriminated unions (z.discriminatedUnion) do not support .omit(), so skip them.\n\n // If this is a lazy reference, apply omit inside the lazy function\n const lazyMatch = transformed.match(/^z\\.lazy\\(\\(\\)\\s*=>\\s*(.+)\\)$/)\n if (lazyMatch) return `z.lazy(() => ${lazyMatch[1]}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} }))`\n return `${transformed}.omit({ ${keysToOmit.map((k: string) => `\"${k}\": true`).join(', ')} })`\n })()\n\n return applyMiniModifiers({\n value: base,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n })\n },\n }\n})\n","import { resolveContentTypeVariants } from '@internals/shared'\nimport type { Adapter } from '@kubb/core'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { AdapterOas } from '@kubb/adapter-oas'\nimport { File, jsxRendererSync } from '@kubb/renderer-jsx'\nimport { Operations } from '../components/Operations.tsx'\nimport { Zod } from '../components/Zod.tsx'\nimport { ZOD_NAMESPACE_IMPORTS } from '../constants.ts'\nimport { printerZod } from '../printers/printerZod.ts'\nimport { printerZodMini } from '../printers/printerZodMini.ts'\nimport type { PluginZod, ResolverZod } from '../types'\nimport { buildSchemaNames, containsCodec } from '../utils.ts'\n\ntype StdPrinters = { output: ReturnType<typeof printerZod>; input: ReturnType<typeof printerZod> }\ntype ZodPrinterEntry = StdPrinters & { coercion: unknown; guidType: unknown; dateType: unknown }\ntype ZodMiniPrinterEntry = { printer: ReturnType<typeof printerZodMini>; guidType: unknown }\n\n// Per-build caches: keyed on resolver (unique per plugin instance per build, GC'd when released)\nconst zodPrinterCache = new WeakMap<ResolverZod, ZodPrinterEntry>()\nconst zodMiniPrinterCache = new WeakMap<ResolverZod, ZodMiniPrinterEntry>()\n\ntype StdPrinterParams = { coercion: unknown; guidType: unknown; dateType: unknown; wrapOutput: unknown; cyclicSchemas: ReadonlySet<string>; nodes: unknown }\n\n/**\n * Returns the cached `output`/`input` direction printers for a resolver, building them on\n * first use. The `input` printer encodes `Date → string` for request bodies; `output` decodes\n * `string → Date` for responses. Schemas without `dateType: 'date'` fields print identically.\n */\nfunction getStdPrinters(resolver: ResolverZod, params: StdPrinterParams): StdPrinters {\n const cached = zodPrinterCache.get(resolver)\n if (cached && cached.coercion === params.coercion && cached.guidType === params.guidType && cached.dateType === params.dateType) {\n return { output: cached.output, input: cached.input }\n }\n const base = { ...params, resolver } as Parameters<typeof printerZod>[0]\n const output = printerZod({ ...base, direction: 'output' })\n const input = printerZod({ ...base, direction: 'input' })\n zodPrinterCache.set(resolver, { output, input, coercion: params.coercion, guidType: params.guidType, dateType: params.dateType })\n return { output, input }\n}\n\nfunction getMiniPrinter(resolver: ResolverZod, params: { guidType: unknown; wrapOutput: unknown; cyclicSchemas: ReadonlySet<string>; nodes: unknown }) {\n const cached = zodMiniPrinterCache.get(resolver)\n if (cached && cached.guidType === params.guidType) return cached.printer\n const p = printerZodMini({ ...params, resolver } as Parameters<typeof printerZodMini>[0])\n zodMiniPrinterCache.set(resolver, { printer: p, guidType: params.guidType })\n return p\n}\n\n/**\n * Built-in generator for `@kubb/plugin-zod`. Emits one Zod schema per\n * schema in the spec plus per-operation request/response/parameter schemas.\n * When `mini: true`, schemas use the Zod Mini functional API instead of\n * chainable methods.\n */\nexport const zodGenerator = defineGenerator<PluginZod>({\n name: 'zod',\n renderer: jsxRendererSync,\n schema(node, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, printer } = ctx.options\n const dateType = (adapter as Adapter<AdapterOas>).options.dateType\n\n if (!node.name) {\n return\n }\n\n const mode = ctx.getMode(output)\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n const cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n // A codec component is rendered twice: the canonical (output) schema decodes\n // `string → Date`, and an `${name}InputSchema` variant encodes `Date → string` for requests.\n const hasCodec = !mini && containsCodec(node)\n\n const codecRefNames = new Set(\n hasCodec\n ? ast.collect<string>(node, {\n schema: (n) => (n.type === 'ref' && n.ref && containsCodec(n) ? (ast.extractRefName(n.ref) ?? undefined) : undefined),\n })\n : [],\n )\n const importEntries = adapter.getImports(node, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n const inputImportEntries = hasCodec\n ? [...codecRefNames].map((schemaName) => ({\n name: resolver.resolveInputSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n : []\n const seenImports = new Set<string>()\n const imports = [...importEntries, ...inputImportEntries].filter((imp) => {\n const key = `${Array.isArray(imp.name) ? imp.name.join(',') : imp.name}|${imp.path}`\n if (seenImports.has(key)) return false\n seenImports.add(key)\n return true\n })\n\n const meta = {\n name: resolver.resolveSchemaName(node.name),\n file: resolver.resolveFile({ name: node.name, extname: '.ts' }, { root, output, group: group ?? undefined }),\n } as const\n\n const inferTypeName = inferred ? resolver.resolveSchemaTypeName(node.name) : null\n\n const stdPrinters = mini ? null : getStdPrinters(resolver, { coercion, guidType, dateType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })\n const schemaPrinter = mini ? getMiniPrinter(resolver, { guidType, wrapOutput, cyclicSchemas, nodes: printer?.nodes }) : stdPrinters!.output\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[node.name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n\n <Zod name={meta.name} node={node} printer={schemaPrinter} inferTypeName={inferTypeName} />\n {hasCodec && stdPrinters && (\n <Zod\n name={resolver.resolveInputSchemaName(node.name)}\n node={node}\n printer={stdPrinters.input}\n inferTypeName={inferred ? resolver.resolveInputSchemaTypeName(node.name) : null}\n />\n )}\n </File>\n )\n },\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { adapter, config, resolver, root } = ctx\n const { output, coercion, guidType, mini, wrapOutput, inferred, importPath, group, paramsCasing, printer } = ctx.options\n const dateType = (adapter as Adapter<AdapterOas>).options.dateType\n\n const mode = ctx.getMode(output)\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const params = ast.caseParams(node.parameters, paramsCasing)\n\n const meta = {\n file: resolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output, group: group ?? undefined },\n ),\n } as const\n\n const cyclicSchemas = new Set<string>(ctx.meta.circularNames)\n\n function renderSchemaEntry({\n schema,\n name,\n keysToOmit,\n direction = 'output',\n }: {\n schema: ast.SchemaNode | null\n name: string\n keysToOmit?: Array<string> | null\n direction?: 'input' | 'output'\n }) {\n if (!schema) return null\n\n const inferTypeName = inferred ? resolver.resolveTypeName(name) : null\n\n // In the input direction, refs to codec components resolve to their input variant.\n const codecRefNames =\n direction === 'input' && !mini\n ? new Set(\n ast.collect<string>(schema, {\n schema: (n) => (n.type === 'ref' && n.ref && containsCodec(n) ? (ast.extractRefName(n.ref) ?? undefined) : undefined),\n }),\n )\n : null\n const imports = adapter.getImports(schema, (schemaName) => ({\n name: codecRefNames?.has(schemaName) ? resolver.resolveInputSchemaName(schemaName) : resolver.resolveSchemaName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group: group ?? undefined }).path,\n }))\n\n const schemaPrinter = mini\n ? keysToOmit?.length\n ? printerZodMini({ guidType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes })\n : getMiniPrinter(resolver, { guidType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })\n : keysToOmit?.length\n ? printerZod({ coercion, guidType, dateType, wrapOutput, resolver, keysToOmit, cyclicSchemas, nodes: printer?.nodes, direction })\n : getStdPrinters(resolver, { coercion, guidType, dateType, wrapOutput, cyclicSchemas, nodes: printer?.nodes })[direction]\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n <Zod name={name} node={schema} printer={schemaPrinter} inferTypeName={inferTypeName} />\n </>\n )\n }\n\n // Multiple content types for a single name — emit one schema per content type plus a union alias.\n function buildContentTypeVariants(\n entries: Array<{ contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }>,\n baseName: string,\n decorate?: (schema: ast.SchemaNode) => ast.SchemaNode,\n direction?: 'input' | 'output',\n ) {\n const variants = resolveContentTypeVariants(entries, baseName)\n const unionSchema = ast.createSchema({\n type: 'union',\n members: variants.map((variant) => ast.createSchema({ type: 'ref', name: variant.name })),\n })\n return (\n <>\n {variants.map((variant) =>\n renderSchemaEntry({\n schema: decorate ? decorate(variant.schema) : variant.schema,\n name: variant.name,\n keysToOmit: variant.keysToOmit,\n direction,\n }),\n )}\n {renderSchemaEntry({ schema: unionSchema, name: baseName, direction })}\n </>\n )\n }\n\n const paramSchemas = params.map((param) => renderSchemaEntry({ schema: param.schema, name: resolver.resolveParamName(node, param), direction: 'input' }))\n\n const responseSchemas = node.responses.map((res) => {\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length > 1) {\n return buildContentTypeVariants(res.content!, resolver.resolveResponseStatusName(node, res.statusCode))\n }\n const primary = variants[0] ?? res.content?.[0]\n return renderSchemaEntry({\n schema: primary?.schema ?? null,\n name: resolver.resolveResponseStatusName(node, res.statusCode),\n keysToOmit: primary?.keysToOmit,\n })\n })\n\n const responsesWithSchema = node.responses.filter((res) => res.content?.some((entry) => entry.schema))\n const responseUnionSchema =\n responsesWithSchema.length > 0\n ? (() => {\n const responseUnionName = resolver.resolveResponseName(node)\n\n // Collect all import names from response schemas to detect naming collisions.\n // When a response is a $ref to a component schema whose resolved name matches\n // the response union name, skip generation to avoid redeclaration errors.\n const importedNames = new Set(\n responsesWithSchema.flatMap((res) =>\n (res.content ?? []).flatMap((entry) =>\n entry.schema\n ? adapter\n .getImports(entry.schema, (schemaName) => ({\n name: resolver.resolveSchemaName(schemaName),\n path: '',\n }))\n .flatMap((imp) => (Array.isArray(imp.name) ? imp.name : [imp.name]))\n : [],\n ),\n ),\n )\n\n if (importedNames.has(responseUnionName)) {\n return null\n }\n\n const members = responsesWithSchema.map((res) => ast.createSchema({ type: 'ref', name: resolver.resolveResponseStatusName(node, res.statusCode) }))\n const unionNode = members.length === 1 ? members[0]! : ast.createSchema({ type: 'union', members })\n\n return renderSchemaEntry({\n schema: unionNode,\n name: responseUnionName,\n })\n })()\n : null\n\n const requestBodyContent = node.requestBody?.content ?? []\n const requestSchema = (() => {\n if (requestBodyContent.length === 0) return null\n if (requestBodyContent.length === 1) {\n const entry = requestBodyContent[0]!\n if (!entry.schema) return null\n return renderSchemaEntry({\n schema: { ...entry.schema, description: node.requestBody!.description ?? entry.schema.description },\n name: resolver.resolveDataName(node),\n keysToOmit: entry.keysToOmit,\n direction: 'input',\n })\n }\n return buildContentTypeVariants(\n requestBodyContent,\n resolver.resolveDataName(node),\n (schema) => ({\n ...schema,\n description: node.requestBody!.description ?? schema.description,\n }),\n 'input',\n )\n })()\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {paramSchemas}\n {responseSchemas}\n {responseUnionSchema}\n {requestSchema}\n </File>\n )\n },\n operations(nodes, ctx) {\n const { config, resolver, root } = ctx\n const { output, importPath, group, operations, paramsCasing } = ctx.options\n\n if (!operations) {\n return\n }\n const isZodImport = ZOD_NAMESPACE_IMPORTS.has(importPath as 'zod' | 'zod/mini')\n\n const meta = {\n file: resolver.resolveFile({ name: 'operations', extname: '.ts' }, { root, output, group: group ?? undefined }),\n } as const\n\n const transformedOperations = nodes.filter(ast.isHttpOperationNode).map((node) => {\n const params = ast.caseParams(node.parameters, paramsCasing)\n\n return {\n node,\n data: buildSchemaNames(node, { params, resolver }),\n }\n })\n\n const imports = transformedOperations.flatMap(({ node, data }) => {\n const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean) as Array<string>\n const opFile = resolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output, group: group ?? undefined },\n )\n\n return names.map((name) => <File.Import key={[name, opFile.path].join('-')} name={[name]} root={meta.file.path} path={opFile.path} />)\n })\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import isTypeOnly name={isZodImport ? 'z' : ['z']} path={importPath} isNameSpace={isZodImport} />\n {imports}\n <Operations name=\"operations\" operations={transformedOperations} />\n </File>\n )\n },\n})\n","import { camelCase, ensureValidVarName, pascalCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginZod } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-zod`. Decides the names and file\n * paths for every generated Zod schema. Schemas use camelCase with a\n * `Schema` suffix (`listPetsSchema`); their inferred types use PascalCase.\n *\n * @example Resolve schema and type names\n * ```ts\n * import { resolverZod } from '@kubb/plugin-zod'\n *\n * resolverZod.default('list pets', 'function') // 'listPetsSchema'\n * resolverZod.resolveSchemaTypeName('pet') // 'PetSchema'\n * ```\n */\nexport const resolverZod = defineResolver<PluginZod>(() => {\n return {\n name: 'default',\n pluginName: 'plugin-zod',\n default(name, type) {\n const resolved = camelCase(name, { isFile: type === 'file', suffix: type ? 'schema' : undefined })\n return type === 'file' ? resolved : ensureValidVarName(resolved)\n },\n resolveSchemaName(name) {\n return ensureValidVarName(camelCase(name, { suffix: 'schema' }))\n },\n resolveSchemaTypeName(name) {\n return ensureValidVarName(pascalCase(name, { suffix: 'schema' }))\n },\n resolveInputSchemaName(name) {\n return this.resolveSchemaName(`${name} input`)\n },\n resolveInputSchemaTypeName(name) {\n return this.resolveSchemaTypeName(`${name} input`)\n },\n resolveTypeName(name) {\n return ensureValidVarName(pascalCase(name))\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveParamName(node, param) {\n return this.resolveSchemaName(`${node.operationId} ${param.in} ${param.name}`)\n },\n resolveResponseStatusName(node, statusCode) {\n return this.resolveSchemaName(`${node.operationId} Status ${statusCode}`)\n },\n resolveDataName(node) {\n return this.resolveSchemaName(`${node.operationId} Data`)\n },\n resolveResponsesName(node) {\n return this.resolveSchemaName(`${node.operationId} Responses`)\n },\n resolveResponseName(node) {\n return this.resolveSchemaName(`${node.operationId} Response`)\n },\n resolvePathParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n resolveQueryParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n resolveHeaderParamsName(node, param) {\n return this.resolveParamName(node, param)\n },\n }\n})\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin } from '@kubb/core'\nimport { zodGenerator } from './generators/zodGenerator.tsx'\nimport { resolverZod } from './resolvers/resolverZod.ts'\nimport type { PluginZod } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-zod`. Used for driver lookups and\n * cross-plugin dependency references.\n */\nexport const pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\n/**\n * Generates Zod v4 schemas from an OpenAPI spec. Use them to validate API\n * responses at runtime, build form schemas, or feed back into router libraries\n * that consume Zod (tRPC, Hono, Elysia). Pair with `@kubb/plugin-client` and\n * set the client's `parser: 'zod'` to validate every response automatically.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginZod } from '@kubb/plugin-zod'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginZod({\n * output: { path: './zod' },\n * typed: true,\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginZod = definePlugin<PluginZod>((options) => {\n const {\n output = { path: 'zod', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n typed = false,\n operations = false,\n mini = false,\n guidType = 'uuid',\n importPath = mini ? 'zod/mini' : 'zod',\n coercion = false,\n inferred = false,\n wrapOutput = undefined,\n paramsCasing,\n printer,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const groupConfig = createGroupConfig(group, { suffix: 'Controller' })\n\n return {\n name: pluginZodName,\n options,\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n typed,\n importPath,\n coercion,\n operations,\n inferred,\n guidType,\n mini,\n wrapOutput,\n paramsCasing,\n printer,\n })\n ctx.setResolver(userResolver ? { ...resolverZod, ...userResolver } : resolverZod)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n ctx.addGenerator(zodGenerator)\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n },\n },\n }\n})\n\nexport default pluginZod\n"],"mappings":";;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;CAS9D,OARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAEH,CAAC,MAAM,gBAAgB,CAAC,OAAO,QAE3C,CACT,KAAK,MAAM,MAAM;EAEhB,IADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,EACjD,OAAO;EACrB,IAAI,MAAM,KAAK,CAAC,QAAQ,OAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;EAC3E,OAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;;;;AAWjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,iBAAiB;CAC1C,OAAO,MAAM,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;AAWtF,SAAgB,UAAU,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;CAClG,IAAI,QACF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