{"version":3,"file":"index.mjs","names":["basepath","upath.relativeSafe","upath.joinSafe","upath.getSchemaFileName","objectSchema","getSchema","bindingRecord","currentSchemaObject","rec","schemaRecord","getSchemaType","upath.normalizeSafe","upath.joinSafe","upath.isAbsolute","upath.resolve","upath.relativeSafe","upath.getRelativeImportPath","nodePath","basepath","upath.getRelativeImportPath","nodePath","upath.toUnix","upath.relativeSafe","upath.joinSafe","upath.relativeSafe","upath.joinSafe","upath\n    .join","nodePath","path","upath.normalizeSafe","upath.toUnix","nodePath","upath.relativeSafe","upath.joinSafe","upath.getRelativeImportPath","upath.join","upath.joinSafe","upath.getRelativeImportPath","emptyMockOutputFull","upath.getRelativeImportPath","upath.getRelativeImportPath","addDefaultTagIfEmpty","upath.getRelativeImportPath","upath.joinSafe","upath.getRelativeImportPath","upath.joinSafe","upath.getRelativeImportPath","upath.joinSafe","upath.getRelativeImportPath","upath.joinSafe"],"sources":["../src/types.ts","../src/constants.ts","../src/utils/object-schema.ts","../src/utils/assertion.ts","../src/utils/async-reduce.ts","../src/utils/file.ts","../src/utils/extension.ts","../src/utils/path.ts","../src/utils/barrel-re-exports.ts","../src/utils/case.ts","../src/utils/collection.ts","../src/utils/compare-version.ts","../src/utils/content-type.ts","../src/utils/doc.ts","../src/utils/dynamic-import.ts","../src/utils/file-extensions.ts","../src/utils/get-property-safe.ts","../src/utils/http-status.ts","../src/utils/is-body-verb.ts","../src/utils/logger.ts","../src/utils/merge-deep.ts","../src/utils/mutation-invalidates.ts","../src/utils/string.ts","../src/utils/name.ts","../src/utils/required.ts","../src/utils/resolve-version.ts","../src/utils/schemas-options.ts","../src/utils/tsconfig.ts","../src/utils/schema-import-path.ts","../src/utils/sort.ts","../src/utils/tags.ts","../src/utils/template-literal.ts","../src/getters/enum.ts","../src/getters/ref.ts","../src/getters/imports.ts","../src/getters/keys.ts","../src/getters/combine.ts","../src/getters/object.ts","../src/getters/scalar.ts","../src/resolvers/ref.ts","../src/resolvers/value.ts","../src/resolvers/object.ts","../src/getters/array.ts","../src/generators/runtime-validation.ts","../src/getters/res-req-types.ts","../src/getters/body.ts","../src/getters/discriminators.ts","../src/getters/form-data-components.ts","../src/getters/operation.ts","../src/getters/parameters.ts","../src/getters/route.ts","../src/getters/params.ts","../src/getters/props.ts","../src/getters/query-params.ts","../src/getters/response.ts","../src/generators/component-definition.ts","../src/generators/date-transform.ts","../src/generators/factory.ts","../src/generators/imports.ts","../src/generators/input-filters.ts","../src/generators/models-inline.ts","../src/generators/mutator-info.ts","../src/generators/mutator.ts","../src/generators/options.ts","../src/generators/parameter-definition.ts","../src/generators/interface.ts","../src/generators/schema-definition.ts","../src/generators/verbs-options.ts","../src/writers/barrel-collisions.ts","../src/writers/file.ts","../src/writers/mock-utils.ts","../src/writers/schema-tag-mapper.ts","../src/writers/schema-output-plan.ts","../src/writers/schemas.ts","../src/writers/schemas-tags-split.ts","../src/writers/finalize-mock-implementation.ts","../src/writers/generate-imports-for-builder.ts","../src/writers/types.ts","../src/writers/implementation-parts.ts","../src/writers/mock-imports.ts","../src/writers/mock-outputs.ts","../src/writers/typescript-version.ts","../src/writers/target.ts","../src/writers/single-mode.ts","../src/writers/split-mode.ts","../src/writers/target-tags.ts","../src/writers/split-tags-mode.ts","../src/writers/tags-mode.ts","../src/writers/target-tags-operations.ts","../src/writers/tags-operations-mode.ts","../src/writers/tags-operations-split-mode.ts"],"sourcesContent":["import type { allLocales } from '@faker-js/faker';\n\n// Type-only, so it is erased: no runtime `types` -> `writers` dependency.\nimport type { SchemaOutputPlan } from './writers/schema-output-plan';\n\nexport const SupportedFormatter = {\n  PRETTIER: 'prettier',\n  BIOME: 'biome',\n  OXFMT: 'oxfmt',\n} as const;\n\nexport type SupportedFormatter =\n  (typeof SupportedFormatter)[keyof typeof SupportedFormatter];\n\nexport interface Options {\n  output?: string | OutputOptions;\n  input?: string | string[] | InputOptions;\n  hooks?: Partial<HooksOptions>;\n}\n\n/** Structured payload delivered to an {@link OrvalReporter}. */\nexport interface OrvalReportEvent {\n  message: string;\n  packageName: string;\n  projectName?: string;\n}\n\n/**\n * Receives generation diagnostics. Selection is ambient (via `withReporter` /\n * `setProjectName`), not part of `orval.config.ts`.\n */\nexport interface OrvalReporter {\n  info(event: OrvalReportEvent): void;\n  warn(event: OrvalReportEvent): void;\n  error(event: OrvalReportEvent): void;\n  verbose(event: OrvalReportEvent): void;\n  debug(event: OrvalReportEvent): void;\n}\n\n/** Package-bound logger that emits {@link OrvalReportEvent}s. */\nexport interface OrvalLogger {\n  info(message: string): void;\n  warn(err: unknown, tag?: string): void;\n  error(err: unknown, tag?: string): void;\n  verbose(message: string): void;\n  debug(message: string): void;\n}\n\nexport type OptionsFn = () => Options | Promise<Options>;\nexport type OptionsExport = Options | Promise<Options> | OptionsFn;\n\nexport interface Config {\n  /**\n   * Log verbosity for every project in this file.\n   *\n   * Not a project name. CLI `--log-level`, `--verbose`, and `--quiet` override it.\n   */\n  logLevel?: LogLevel;\n  [projectName: string]: OptionsExport | LogLevel | undefined;\n}\nexport type ConfigFn = () => Config | Promise<Config>;\n\nexport type ConfigExternal = Config | Promise<Config> | ConfigFn;\n\nexport type NormalizedConfig = Record<string, NormalizedOptions | undefined>;\n\nexport interface NormalizedOptions {\n  output: NormalizedOutputOptions;\n  input: NormalizedInputOptions;\n  hooks: NormalizedHookOptions;\n}\n\nexport interface NormalizedOutputOptions {\n  workspace?: string;\n  workspaceExports?: WorkspaceExportsFn;\n  target: string;\n  schemas?: string | NormalizedSchemaOptions;\n  operationSchemas?: string;\n  namingConvention: NamingConvention;\n  fileExtension: string;\n  /**\n   * File extension for schema artifacts (TS types or Zod schemas) under\n   * `schemas:`. Defaults to `.zod.ts` when the output is Zod schemas\n   * (`schemas: { type: 'zod' }` or `client: 'zod'` + `generateReusableSchemas`),\n   * otherwise `.ts`. A user-set `output.fileExtension` always wins.\n   */\n  schemaFileExtension: string;\n  mode: OutputMode;\n  // Always normalized to an object form; an empty `generators` array means\n  // no mocks are emitted.\n  mock: NormalizedMocksConfig;\n  override: NormalizedOverrideOutput;\n  client: OutputClient | OutputClientFunc;\n  httpClient: OutputHttpClient;\n  clean: boolean | string[];\n  docs: boolean | OutputDocsOptions;\n  formatter?: SupportedFormatter;\n  tsconfig?: Tsconfig;\n  packageJson?: PackageJson;\n  headers: boolean;\n  indexFiles: boolean;\n  baseUrl?: string | BaseUrlFromSpec | BaseUrlFromConstant | BaseUrlRuntime;\n  allParamsOptional: boolean;\n  urlEncodeParameters: boolean;\n  unionAddMissingProperties: boolean;\n  optionsParamRequired: boolean;\n  propertySortOrder: PropertySortOrder;\n  factoryMethods?: NormalizedFactoryMethodsOptions;\n  tagsSplitDeduplication: boolean;\n  commonTypesFileName: string;\n}\n\nexport interface NormalizedParamsSerializerOptions {\n  qs?: Record<string, unknown>;\n}\n\n/**\n * Controls how readonly properties are treated when a schema is reused as a request body.\n *\n * Best practice:\n * - `strip` (default): recommended for most OpenAPI specs, because `readOnly`\n *   properties are response-oriented and generally should not constrain request\n *   payload authoring.\n * - `preserve`: use when your schema intentionally models immutable request DTOs\n *   and you want generated request-body types to keep readonly modifiers.\n *\n * Note: this applies to request bodies regardless of the generated client style\n * (`httpClient`, `httpResource`, etc.). `httpResource` still issues request\n * payloads, so the same OpenAPI guidance applies.\n *\n * If we later want a stricter OpenAPI-aligned mode that omits `readOnly`\n * properties from request bodies entirely, that should be introduced as a new\n * explicit mode rather than overloading `preserve`.\n */\nexport type ReadonlyRequestBodiesMode = 'strip' | 'preserve';\n\nexport interface NormalizedOverrideOutput {\n  title?: (title: string) => string;\n  transformer?: OutputTransformer;\n  mutator?: NormalizedMutator;\n  operations: Record<string, NormalizedOperationOptions | undefined>;\n  tags: Record<string, NormalizedOperationOptions | undefined>;\n  mock?: OverrideMockOptions;\n  contentType?: OverrideOutputContentType;\n  header: false | ((info: OpenApiInfoObject) => string[] | string);\n  formData: NormalizedFormDataType<NormalizedMutator>;\n  formUrlEncoded: boolean | NormalizedMutator;\n  paramsSerializer?: NormalizedMutator;\n  paramsSerializerOptions?: NormalizedParamsSerializerOptions;\n  paramsFilter?: NormalizedMutator;\n  namingConvention: {\n    enum?: NamingConvention;\n    properties?: NamingConvention;\n  };\n  components: {\n    schemas: {\n      prefix: string;\n      suffix: string;\n      itemPrefix: string;\n      itemSuffix: string;\n    };\n    responses: {\n      prefix: string;\n      suffix: string;\n    };\n    parameters: {\n      prefix: string;\n      suffix: string;\n    };\n    requestBodies: {\n      prefix: string;\n      suffix: string;\n    };\n  };\n  hono: NormalizedHonoOptions;\n  mcp: NormalizedMcpOptions;\n  query: NormalizedQueryOptions;\n  angular: NormalizedAngularOptions;\n  swr: SwrOptions;\n  zod: NormalizedZodOptions;\n  effect: NormalizedEffectOptions;\n  axios: NormalizedAxiosOptions;\n  fetch: NormalizedFetchOptions;\n  operationName?: (\n    operation: OpenApiOperationObject,\n    route: string,\n    verb: Verbs,\n  ) => string | [string, string];\n\n  requestOptions: Record<string, unknown> | boolean;\n  useDates?: boolean;\n  useDatesTransform?: boolean;\n  useTypeOverInterfaces?: boolean;\n  useDeprecatedOperations?: boolean;\n  useBigInt?: boolean;\n  useNamedParameters?: boolean;\n  enumGenerationType: EnumGeneration;\n  suppressReadonlyModifier?: boolean;\n  /**\n   * Controls how readonly properties are handled for generated request-body types.\n   *\n   * Prefer `strip` for most OpenAPI specs because `readOnly` fields are\n   * response-oriented. Use `preserve` only when your request DTOs are\n   * intentionally immutable and should remain readonly in generated types.\n   */\n  preserveReadonlyRequestBodies?: ReadonlyRequestBodiesMode;\n  /**\n   * When enabled, operations with multiple request body content-types\n   * (e.g. both `multipart/form-data` and `application/json`) will generate\n   * separate functions for each content type instead of a single function\n   * with a union type parameter.\n   *\n   * @example\n   * // With splitByContentType: true\n   * updateProfileWithFormData(body: FormDataType) => { ... }\n   * updateProfileWithJson(body: JsonType) => { ... }\n   *\n   * // With splitByContentType: false (default)\n   * updateProfile(body: FormDataType | JsonType) => { ... }\n   *\n   * @default false\n   */\n  splitByContentType: boolean;\n  jsDoc: NormalizedJsDocOptions;\n  aliasCombinedTypes: boolean;\n  /**\n   * When enabled, optional properties will be typed as `T | null` instead of just `T`.\n   * @default false\n   */\n  useNullForOptional?: boolean;\n  /**\n   * When enabled, the zod schema of the response is passed to the custom\n   * mutator as an extra `schema` option, so the mutator can validate the\n   * response itself.\n   *\n   * Requires `schemas: { type: 'zod' }` and runtime validation enabled for the\n   * client (e.g. `override.fetch.runtimeValidation`).\n   *\n   * @default false\n   */\n  includeZodSchemaInArguments: boolean;\n}\n\nexport interface NormalizedMutator {\n  path: string;\n  resolvedPath?: string;\n  name?: string;\n  default: boolean;\n  alias?: Record<string, string>;\n  external?: string[];\n  extension?: string;\n  useHooks?: boolean;\n  inferred?: boolean;\n}\n\nexport interface NormalizedOperationOptions {\n  transformer?: OutputTransformer;\n  mutator?: NormalizedMutator;\n  mock?: {\n    data?: MockData;\n    properties?: MockProperties;\n  };\n  contentType?: OverrideOutputContentType;\n  query?: NormalizedQueryOptions;\n  angular?: NormalizedAngularOptions;\n  swr?: SwrOptions;\n  zod?: NormalizedOperationZodOptions;\n  effect?: NormalizedEffectOptions;\n  operationName?: (\n    operation: OpenApiOperationObject,\n    route: string,\n    verb: Verbs,\n  ) => string | [string, string];\n  axios?: AxiosOptions;\n  fetch?: FetchOptions;\n  formData?: NormalizedFormDataType<NormalizedMutator>;\n  formUrlEncoded?: boolean | NormalizedMutator;\n  paramsSerializer?: NormalizedMutator;\n  paramsFilter?: NormalizedMutator;\n  requestOptions?: object | boolean;\n}\n\nexport type ExternalRefNamingStrategy = 'default' | 'always';\n\nexport interface InputParserOptions {\n  headers?: {\n    domains: string[];\n    headers: Record<string, string>;\n  }[];\n  /**\n   * Optional Scalar bundler callback used to create external document keys.\n   */\n  compress?: (value: string) => Promise<string> | string;\n  externalRefs?: {\n    /**\n     * External `$ref` document targets to allow. Each entry should be the\n     * document part of the `$ref` (without the `#/...` fragment). File paths\n     * are relative to the spec file. Use `['*']` to allow all external refs.\n     *\n     * @default []\n     */\n    allow?: string[];\n    /**\n     * Controls how schemas imported from external documents are named.\n     *\n     * @default 'default'\n     */\n    strategy?: ExternalRefNamingStrategy;\n    // TODO: add `deny?: string[]` when users need \"allow all except X\"\n  };\n}\n\nexport interface NormalizedInputOptions {\n  target: string | OpenApiDocument;\n  override: OverrideInput;\n  unsafeDisableValidation: boolean;\n  filters?: InputFiltersOptions;\n  parserOptions?: InputParserOptions;\n}\n\nexport type OutputClientFunc = (\n  clients: GeneratorClients,\n) => ClientGeneratorsBuilder;\n\n/**\n * A server URL variable whose value is a runtime JavaScript expression\n * (e.g. `process.env.API_TOKEN`) instead of a static string. The expression\n * is embedded as a `${...}` interpolation in the generated URL template\n * literal, so the value is resolved at request time (#3734).\n */\nexport interface VariableRuntimeValue {\n  runtime: string;\n}\n\nexport interface BaseUrlFromSpec {\n  getBaseUrlFromSpecification: true;\n  variables?: Record<string, string | VariableRuntimeValue>;\n  index?: number;\n  baseUrl?: never;\n}\n\nexport interface BaseUrlFromConstant {\n  getBaseUrlFromSpecification: false;\n  variables?: never;\n  index?: never;\n  baseUrl: string;\n}\n\n/**\n * Embed a runtime JavaScript expression into generated URL template literals\n * (e.g. `process.env.API_BASE_URL`) so the same build can target different hosts at runtime.\n */\nexport interface BaseUrlRuntime {\n  runtime: string;\n  /** Named imports for symbols used in `runtime` (e.g. `{ name: 'apiBase', importPath: '../config' }`). */\n  imports?: GeneratorImport[];\n  getBaseUrlFromSpecification?: never;\n  baseUrl?: never;\n}\n\n/**\n * Opt-in config for `override.angular.baseUrl`: composes a runtime base URL\n * for a generated Angular output via Angular DI (an `InjectionToken`) rather\n * than baking a static prefix into every route at generation time.\n *\n * Angular-client only; mutually exclusive with the top-level `output.baseUrl`\n * (which bakes a prefix into every generated route string for ALL clients).\n * `apiId` is required and explicit — never derived from the spec — so the\n * generated identifiers (`<API_ID>_BASE_URL`, `provide<Api>BaseUrl`, ...) are\n * stable across regenerations and collision-free when multiple outputs are\n * generated into the same app.\n */\nexport interface AngularBaseUrlOptions {\n  /** Explicit, stable identifier for this API, used to derive all generated DI token/helper names. Must match `/^[A-Za-z][A-Za-z0-9_-]*$/`. */\n  apiId: string;\n  /** Index into the specification's `servers` array to embed as the default fallback URL. Defaults to `0`. */\n  index?: number;\n  /** Values for any `{variable}` placeholders in the selected server URL. */\n  variables?: Record<string, string | VariableRuntimeValue>;\n}\n\nexport const PropertySortOrder = {\n  ALPHABETICAL: 'Alphabetical',\n  SPECIFICATION: 'Specification',\n} as const;\n\nexport type PropertySortOrder =\n  (typeof PropertySortOrder)[keyof typeof PropertySortOrder];\n\nexport const NamingConvention = {\n  CAMEL_CASE: 'camelCase',\n  PASCAL_CASE: 'PascalCase',\n  SNAKE_CASE: 'snake_case',\n  KEBAB_CASE: 'kebab-case',\n} as const;\n\nexport type NamingConvention =\n  (typeof NamingConvention)[keyof typeof NamingConvention];\n\nexport const EnumGeneration = {\n  CONST: 'const',\n  ENUM: 'enum',\n  UNION: 'union',\n} as const;\n\nexport type EnumGeneration =\n  (typeof EnumGeneration)[keyof typeof EnumGeneration];\n\nexport type SchemaGenerationType = 'typescript' | 'zod';\n\nexport type GeneratedSchemaKind = 'enum' | 'schema';\n\nexport type FactoryMethodsMode = 'single' | 'split' | 'single-split';\n\nexport interface FactoryMethodsOptions {\n  functionNamePrefix?: string;\n  mode?: FactoryMethodsMode;\n  outputDirectory?: string;\n  includeOptionalProperty?: boolean;\n}\n\nexport interface NormalizedFactoryMethodsOptions {\n  functionNamePrefix: string;\n  mode: FactoryMethodsMode;\n  outputDirectory: string;\n  includeOptionalProperty: boolean;\n}\n\nexport interface SchemaOptions {\n  /**\n   * Output path for schemas. A directory in split mode; in `mode: 'single'`\n   * the path may name the schema module file directly.\n   */\n  path: string;\n  /**\n   * `'single'` writes every schema (TypeScript types or Zod schemas) to one\n   * module — `<path>/index<schemaFileExtension>`, or `path` itself when it\n   * names a file — instead of one file per schema. Independent of\n   * `output.mode`, which only arranges client files.\n   *\n   * @default 'split'\n   */\n  mode?: 'split' | 'single';\n  type?: SchemaGenerationType;\n  importPath?: string;\n  routes?: SchemaRouteOptions;\n  /**\n   * When `true`, schemas are organized into per-tag subdirectories instead of\n   * a single flat directory. Schemas referenced by multiple tags remain at the\n   * root of the schema directory.\n   *\n   * @default false\n   */\n  splitByTags?: boolean;\n}\n\nexport interface SchemaRouteOptions {\n  default: string;\n  enum?: string;\n}\n\nexport interface NormalizedSchemaOptions {\n  path: string;\n  mode?: 'split' | 'single';\n  type: SchemaGenerationType;\n  importPath?: string;\n  splitByTags: boolean;\n  routes?: SchemaRouteOptions;\n}\n\n/**\n * Receives the relative module specifiers Orval would re-export from the\n * workspace `index.ts` (e.g. `'./endpoints'`, `'./model'`) and returns the\n * specifiers to write instead. Use it to drop generated exports or to append\n * exports for your own files.\n */\nexport type WorkspaceExportsFn = (exports: string[]) => string[];\n\nexport interface OutputOptions {\n  workspace?: string;\n  /** Filter or extend the exports written to the workspace `index.ts`. */\n  workspaceExports?: WorkspaceExportsFn;\n  target: string;\n  schemas?: string | SchemaOptions | false;\n  /**\n   * Separate path for operation-derived types (params, bodies, responses).\n   * When set, types matching operation patterns (e.g., *Params, *Body) are written here\n   * while regular schema types remain in the `schemas` path.\n   */\n  operationSchemas?: string;\n  namingConvention?: NamingConvention;\n  fileExtension?: string;\n  /**\n   * Optional file extension applied only to schema artifacts (TS types or\n   * Zod schemas), under `schemas:` or in the `<target>.schemas` file written\n   * without it. Takes precedence over `fileExtension` for schema files. Defaults to `.zod.ts` when the output is Zod schemas\n   * (`schemas: { type: 'zod' }` or `client: 'zod'` + `generateReusableSchemas`),\n   * otherwise mirrors `fileExtension`.\n   */\n  schemaFileExtension?: string;\n  mode?: OutputMode;\n  // Mocks config. Accepts:\n  // - `true` shorthand: emits both msw + faker with defaults\n  // - OutputMocksConfig object with `generators` array and optional `indexMockFiles`\n  // - ClientMockBuilder function for advanced custom generators\n  mock?: OutputMocksOption;\n  override?: OverrideOutput;\n  client?: OutputClient | OutputClientFunc;\n  httpClient?: OutputHttpClient;\n  clean?: boolean | string[];\n  docs?: boolean | OutputDocsOptions;\n  formatter?: SupportedFormatter;\n  tsconfig?: string | Tsconfig;\n  packageJson?: string;\n  headers?: boolean;\n  indexFiles?: boolean;\n  baseUrl?: string | BaseUrlFromSpec | BaseUrlFromConstant | BaseUrlRuntime;\n  allParamsOptional?: boolean;\n  urlEncodeParameters?: boolean;\n  unionAddMissingProperties?: boolean;\n  optionsParamRequired?: boolean;\n  propertySortOrder?: PropertySortOrder;\n  factoryMethods?: FactoryMethodsOptions;\n  tagsSplitDeduplication?: boolean;\n  commonTypesFileName?: string;\n}\n\nexport interface InputFiltersOptions {\n  mode?: 'include' | 'exclude';\n  tags?: (string | RegExp)[];\n  schemas?: (string | RegExp)[];\n  /**\n   * When `tags` is set, orval limits the output to only the schemas referenced\n   * by the matching operations. Set this to `true` to keep every\n   * `#/components/schemas` entry (including unreferenced ones) while still\n   * filtering endpoints by `tags`. The other component sections (`responses`,\n   * `parameters`, `requestBodies`) remain pruned to what the matching\n   * operations use. Ignored when `schemas` is set.\n   *\n   * @default false\n   */\n  includeUnreferencedSchemas?: boolean;\n}\n\nexport interface InputOptions {\n  target: string | string[] | Record<string, unknown> | OpenApiDocument;\n  override?: OverrideInput;\n  /**\n   * Disable OpenAPI spec validation.\n   *\n   * **Use at your own risk** — code generation with invalid specs is not guaranteed\n   * to work and may break in minor updates. Bug reports with validation disabled are\n   * not accepted.\n   *\n   * @default false\n   */\n  unsafeDisableValidation?: boolean;\n  filters?: InputFiltersOptions;\n  parserOptions?: InputParserOptions;\n}\n\nexport const OutputClient = {\n  ANGULAR: 'angular',\n  ANGULAR_QUERY: 'angular-query',\n  AXIOS: 'axios',\n  AXIOS_FUNCTIONS: 'axios-functions',\n  REACT_QUERY: 'react-query',\n  SOLID_START: 'solid-start',\n  SOLID_QUERY: 'solid-query',\n  SVELTE_QUERY: 'svelte-query',\n  VUE_QUERY: 'vue-query',\n  SWR: 'swr',\n  PINIA_COLADA: 'pinia-colada',\n  ZOD: 'zod',\n  EFFECT: 'effect',\n  HONO: 'hono',\n  FETCH: 'fetch',\n  MCP: 'mcp',\n} as const;\n\nexport type OutputClient = (typeof OutputClient)[keyof typeof OutputClient];\n\nexport const OutputHttpClient = {\n  AXIOS: 'axios',\n  FETCH: 'fetch',\n  ANGULAR: 'angular',\n} as const;\n\nexport type OutputHttpClient =\n  (typeof OutputHttpClient)[keyof typeof OutputHttpClient];\n\nexport const OutputMode = {\n  SINGLE: 'single',\n  SPLIT: 'split',\n  TAGS: 'tags',\n  TAGS_SPLIT: 'tags-split',\n  TAGS_OPERATIONS: 'tags-operations',\n  TAGS_OPERATIONS_SPLIT: 'tags-operations-split',\n} as const;\n\nexport type OutputMode = (typeof OutputMode)[keyof typeof OutputMode];\n\n/**\n * Options for the `docs` output. Everything but `configPath` is forwarded to\n * TypeDoc as-is, so any TypeDoc option is accepted.\n *\n * Typed structurally rather than as `Partial<TypeDocOptions>` on purpose:\n * `typedoc` is an optional peer dependency, and importing its types here would\n * leave a `typedoc` import in the published declarations, forcing every\n * consumer to install it to typecheck their config.\n *\n * @see https://typedoc.org/documents/Options.html\n */\nexport type OutputDocsOptions = {\n  /** TypeDoc config file, forwarded to TypeDoc as its `options` path. */\n  configPath?: string;\n  /** Output directory. */\n  out?: string;\n  /** TypeDoc theme. Defaults to `markdown`. */\n  theme?: string;\n  /** TypeDoc plugins. `typedoc-plugin-markdown` is always included. */\n  plugin?: string[];\n  /** Any other TypeDoc option. */\n  [option: string]: unknown;\n};\n\n// TODO: add support for other mock types (like cypress or playwright)\nexport const OutputMockType = {\n  MSW: 'msw',\n  FAKER: 'faker',\n} as const;\n\nexport type OutputMockType =\n  (typeof OutputMockType)[keyof typeof OutputMockType];\n\nexport type PreferredContentType =\n  | 'application/json'\n  | 'application/xml'\n  | 'text/plain'\n  | 'text/html'\n  | 'application/octet-stream'\n  | (string & {});\n\n// Shared by every mock generator.\nexport interface CommonMockOptions {\n  // Use OpenAPI examples to seed mock values where available\n  useExamples?: boolean;\n  // Generate response factories for every HTTP status defined in the spec\n  generateEachHttpStatus?: boolean;\n  // Faker locale (controls the `@faker-js/faker/locale/<x>` import path)\n  locale?: keyof typeof allLocales;\n  // Selects which response schema is mocked when multiple content types exist\n  preferredContentType?: string;\n  // Emit reusable mock factories for object-like array item schemas found in\n  // operation responses (e.g. `getTenantResponseModelDtoMock` for\n  // `value: TenantResponseModelDto[]`). Defaults to `false`.\n  arrayItems?: boolean;\n}\n\nexport interface MswMockOptions extends CommonMockOptions {\n  type: typeof OutputMockType.MSW;\n  // Emit faker responses in MSW handler output, defaults to true. Disable to\n  // generate handlers only which require passing in mock responses, falls back\n  // to `undefined` if no mock response passed to handler.\n  operationResponses?: boolean;\n  // Base URL prefix for the generated MSW route matchers\n  baseUrl?: string;\n  // Response delay before MSW handlers resolve (false disables delay)\n  delay?: false | number | (() => number);\n  // Execute the `delay` function at runtime rather than build time\n  delayFunctionLazyExecute?: boolean;\n  // Custom output directory for MSW mock files. Overrides the shared\n  // `OutputMocksConfig.path` when set. Only picks where deinlined mock files\n  // land; `OutputMocksConfig.inline: true` keeps mocks in the implementation\n  // file in `single`/`tags` modes even when this path is set.\n  path?: string;\n}\n\nexport interface FakerMockOptions extends CommonMockOptions {\n  type: typeof OutputMockType.FAKER;\n  // Emit a consolidated mock factory file for every entry under\n  // `components/schemas` (one `get<SchemaName>Mock` per schema). Defaults to\n  // `false` — schema factories are opt-in to preserve existing output.\n  schemas?: boolean;\n  // Package specifier for importing the schema-level faker factories (the\n  // `get<SchemaName>Mock` functions emitted when `schemas: true`). When set,\n  // it is used verbatim as the schema factory import path instead of appending\n  // `/index.faker` to `schemas.importPath`. This lets consumers expose fakers\n  // through a dedicated barrel separate from the production type barrel.\n  // Requires `schemas.importPath` or `schemasPath` to also be set.\n  schemasImportPath?: string;\n  // Output directory for the schema-level faker factories file\n  // (`index.faker.ts`). Defaults to the `schemas` directory. Set it to keep\n  // `@faker-js/faker` out of a schemas package, e.g. to a subdirectory of the\n  // faker `path`. Requires `schemas: true` and `output.schemas`.\n  schemasPath?: string;\n  // Package specifier for the faker group barrel. When set, MSW files import\n  // the `get<Op>ResponseMock` factories from it instead of a relative path\n  // into the faker directory. Only used in `split` and `tags-split` modes,\n  // where MSW and faker are written to separate files.\n  importPath?: string;\n  // Emit per-operation response mock factories (the historical behavior).\n  // Defaults to `true`. Set to `false` together with `schemas: true` to get\n  // only the consolidated schema factories.\n  operationResponses?: boolean;\n  // Custom output directory for faker mock files. Overrides the shared\n  // `OutputMocksConfig.path` when set. Only picks where deinlined mock files\n  // land; `OutputMocksConfig.inline: true` keeps mocks in the implementation\n  // file in `single`/`tags` modes even when this path is set.\n  path?: string;\n}\n\nexport type GlobalMockOptions = MswMockOptions | FakerMockOptions;\n\n// The top-level `mock` key on OutputOptions accepts this object form:\n//   mock: {\n//     indexMockFiles: true,\n//     generators: [\n//       { type: OutputMockType.MSW, ... },\n//       { type: OutputMockType.FAKER, ... },\n//     ],\n//   }\nexport interface OutputMocksConfig {\n  // When true, emits one root-level `index.<ext>.ts` per generator entry\n  // (e.g. `index.msw.ts` and/or `index.faker.ts`) in `split` and `tags-split`\n  // modes. In `tags-split` it re-exports each per-tag mock; in `split` it\n  // re-exports the single mock file. Keeps mocks in a dedicated barrel so the\n  // models/production barrels never pull them in.\n  indexMockFiles?: boolean;\n  // Shared output directory for all mock files. Individual generators can\n  // override this with their own `path` property. Only affects where the\n  // deinlined mock files land; see `inline` for whether they get deinlined\n  // at all in `single`/`tags` modes.\n  path?: string;\n  // In `single` and `tags` modes, mock code is written to separate\n  // `.msw.ts` / `.faker.ts` files next to the implementation by default, matching\n  // `split` and `tags-split`. Set `inline: true` to opt back into the\n  // layout Orval used before this option existed, where mock code is\n  // appended to the implementation file. Has no effect in\n  // `split`/`tags-split`, which always deinline.\n  inline?: boolean;\n  generators: (GlobalMockOptions | ClientMockBuilder)[];\n}\n\n// Accepts:\n//   - boolean shorthand (`mock: true` => both msw + faker with defaults)\n//   - OutputMocksConfig (full object form)\n//   - ClientMockBuilder (single function-form for advanced users)\nexport type OutputMocksOption = boolean | OutputMocksConfig | ClientMockBuilder;\n\n// Normalized result of resolving OutputMocksOption. Always an object so the\n// rest of the pipeline can iterate `generators` without branching on shape.\nexport interface NormalizedMocksConfig {\n  indexMockFiles: boolean;\n  path?: string;\n  inline: boolean;\n  generators: (GlobalMockOptions | ClientMockBuilder)[];\n}\n\nexport type OverrideMockOptions = Partial<GlobalMockOptions> & {\n  arrayMin?: number;\n  arrayMax?: number;\n  stringMin?: number;\n  stringMax?: number;\n  numberMin?: number;\n  numberMax?: number;\n  required?: boolean; // When true, all properties are required (and thus not optional) in mocks.\n  nonNullable?: boolean; // When true, nullable mock values are never wrapped in `arrayElement([value, null])`.\n  exactOptional?: boolean; // When true, optional properties are omitted instead of set to `undefined`, for `exactOptionalPropertyTypes`.\n  properties?: MockProperties;\n  // Scope property overrides to a named schema (e.g. `components/schemas/Apple`),\n  // so the same property name can mock differently per schema. Matching rules are\n  // identical to `properties` (bare name, `/regex/`, exact `#.path`).\n  schemas?: Record<string, { properties: MockProperties }>;\n  format?: Record<string, unknown>;\n  fractionDigits?: number;\n};\n\nexport type MockOptions = Omit<\n  OverrideMockOptions,\n  'properties' | 'schemas'\n> & {\n  properties?: Record<string, unknown>;\n  operations?: Record<string, { properties: Record<string, unknown> }>;\n  tags?: Record<string, { properties: Record<string, unknown> }>;\n  schemas?: Record<string, { properties: Record<string, unknown> }>;\n};\n\nexport type MockPropertiesObject = Record<string, unknown>;\nexport type MockPropertiesObjectFn = (\n  specs: OpenApiDocument,\n) => MockPropertiesObject;\n\nexport type MockProperties = MockPropertiesObject | MockPropertiesObjectFn;\n\nexport type MockDataObject = Record<string, unknown>;\n\nexport type MockDataObjectFn = (specs: OpenApiDocument) => MockDataObject;\n\nexport type MockDataArray = unknown[];\n\nexport type MockDataArrayFn = (specs: OpenApiDocument) => MockDataArray;\n\nexport type MockData =\n  | MockDataObject\n  | MockDataObjectFn\n  | MockDataArray\n  | MockDataArrayFn;\n\ntype OutputTransformerFn = (verb: GeneratorVerbOptions) => GeneratorVerbOptions;\n\ntype OutputTransformer = string | OutputTransformerFn;\n\nexport interface MutatorObject {\n  path: string;\n  name?: string;\n  default?: boolean;\n  alias?: Record<string, string>;\n  external?: string[];\n  extension?: string;\n  useHooks?: boolean;\n  inferred?: boolean;\n}\n\nexport type Mutator = string | MutatorObject;\n\nexport interface ParamsSerializerOptions {\n  qs?: Record<string, unknown>;\n}\n\nexport const FormDataArrayHandling = {\n  SERIALIZE: 'serialize',\n  EXPLODE: 'explode',\n  SERIALIZE_WITH_BRACKETS: 'serialize-with-brackets',\n} as const;\n\nexport type FormDataArrayHandling =\n  (typeof FormDataArrayHandling)[keyof typeof FormDataArrayHandling];\n\nexport type NormalizedFormDataType<TMutator> =\n  | {\n      disabled: true;\n      mutator?: never;\n      arrayHandling: FormDataArrayHandling;\n    }\n  | {\n      disabled: false;\n      mutator?: TMutator;\n      arrayHandling: FormDataArrayHandling;\n    };\nexport type FormDataType<TMutator> =\n  | {\n      mutator: TMutator;\n      arrayHandling?: FormDataArrayHandling;\n    }\n  | {\n      mutator?: TMutator;\n      arrayHandling: FormDataArrayHandling;\n    };\n\nexport interface OverrideOutput {\n  title?: (title: string) => string;\n  transformer?: OutputTransformer;\n  mutator?: Mutator;\n  operations?: Record<string, OperationOptions>;\n  tags?: Record<string, OperationOptions>;\n  mock?: OverrideMockOptions;\n  contentType?: OverrideOutputContentType;\n  /**\n   * The comment block written at the top of each generated file. This is\n   * unrelated to `output.headers`, which controls HTTP request header\n   * parameters.\n   *\n   * Pass `false` to omit the block, or a function receiving the spec's\n   * {@link OpenApiInfoObject} and returning either one string, used verbatim,\n   * or an array of strings, rendered as a JSDoc comment with one line each.\n   * Only `title` and `version` are guaranteed to be present on `info`.\n   *\n   * Any other value, including `true`, falls back to the built-in header, so\n   * passing `true` is indistinguishable from omitting the option.\n   *\n   * @example\n   * header: (info) => [\n   *   'Generated by orval',\n   *   ...(info.description ? [info.description] : []),\n   * ]\n   */\n  header?: boolean | ((info: OpenApiInfoObject) => string[] | string);\n  formData?: boolean | Mutator | FormDataType<Mutator>;\n  formUrlEncoded?: boolean | Mutator;\n  paramsSerializer?: Mutator;\n  paramsSerializerOptions?: ParamsSerializerOptions;\n  paramsFilter?: Mutator;\n  namingConvention?: {\n    enum?: NamingConvention;\n    /**\n     * Naming convention applied to schema property names in generated\n     * TypeScript types. The original spec key is still used for `required`\n     * matching and runtime serialization; only the emitted property name\n     * changes. See issue #2381.\n     *\n     * Zod schemas keep validating the original keys and rename them in a\n     * `.transform()`, so `zod.output` carries the converted names (#4226).\n     */\n    properties?: NamingConvention;\n  };\n  components?: {\n    schemas?: {\n      prefix?: string;\n      suffix?: string;\n      itemPrefix?: string;\n      itemSuffix?: string;\n    };\n    responses?: {\n      prefix?: string;\n      suffix?: string;\n    };\n    parameters?: {\n      prefix?: string;\n      suffix?: string;\n    };\n    requestBodies?: {\n      prefix?: string;\n      suffix?: string;\n    };\n  };\n  hono?: HonoOptions;\n  mcp?: McpOptions;\n  query?: QueryOptions;\n  swr?: SwrOptions;\n  angular?: AngularOptions;\n  zod?: ZodOptions;\n  effect?: EffectOptions;\n  operationName?: (\n    operation: OpenApiOperationObject,\n    route: string,\n    verb: Verbs,\n  ) => string | [string, string];\n  axios?: AxiosOptions;\n  fetch?: FetchOptions;\n\n  requestOptions?: Record<string, unknown> | boolean;\n  useDates?: boolean;\n  /**\n   * Emit per-operation response deserializers that convert schema-declared\n   * `format: date` / `format: date-time` fields to `Date` at runtime.\n   * Implies `useDates`. @default false\n   */\n  useDatesTransform?: boolean;\n  useTypeOverInterfaces?: boolean;\n  useDeprecatedOperations?: boolean;\n  useBigInt?: boolean;\n  useNamedParameters?: boolean;\n  enumGenerationType?: EnumGeneration;\n  suppressReadonlyModifier?: boolean;\n  /**\n   * Controls how readonly properties are handled for generated request-body types.\n   *\n   * Prefer `strip` for most OpenAPI specs because `readOnly` fields are\n   * response-oriented. Use `preserve` only when your request DTOs are\n   * intentionally immutable and should remain readonly in generated types.\n   */\n  preserveReadonlyRequestBodies?: ReadonlyRequestBodiesMode;\n  /**\n   * When enabled, operations with multiple request body content-types\n   * (e.g. both `multipart/form-data` and `application/json`) will generate\n   * separate functions for each content type instead of a single function\n   * with a union type parameter.\n   *\n   * @default false\n   */\n  splitByContentType?: boolean;\n  jsDoc?: JsDocOptions;\n  aliasCombinedTypes?: boolean;\n  /**\n   * When enabled, optional properties will be typed as `T | null` instead of just `T`.\n   * @default false\n   */\n  useNullForOptional?: boolean;\n  /**\n   * When enabled, the zod schema of the response is passed to the custom\n   * mutator as an extra `schema` option, so the mutator can validate the\n   * response itself.\n   *\n   * Requires `schemas: { type: 'zod' }` and runtime validation enabled for the\n   * client (e.g. `override.fetch.runtimeValidation`).\n   *\n   * @default false\n   */\n  includeZodSchemaInArguments?: boolean;\n}\n\nexport interface JsDocOptions {\n  filter?: (\n    schema: Record<string, unknown>,\n  ) => { key: string; value: string }[];\n}\n\nexport interface NormalizedJsDocOptions {\n  filter?: (\n    schema: Record<string, unknown>,\n  ) => { key: string; value: string }[];\n}\n\nexport interface OverrideOutputContentType {\n  include?: string[];\n  exclude?: string[];\n}\n\n/**\n * Strategy controlling how an existing hono handler file is treated on\n * regeneration.\n *\n * - `smart` (default): non-destructively reconcile orval-owned imports and\n *   `zValidator` arguments and append handlers for new operations, preserving\n *   all user-authored imports, middleware, bodies, and top-level code.\n * - `skip`: leave an existing handler file byte-for-byte unchanged.\n * - `full`: rebuild the preamble and validator chain from the spec, splicing\n *   back only the handler body. Drops custom imports/middleware/helpers.\n */\nexport type HonoHandlerStrategy = 'smart' | 'skip' | 'full';\n\nexport interface NormalizedHonoOptions {\n  handlers?: string;\n  handlerGenerationStrategy: HonoHandlerStrategy;\n  compositeRoute: string;\n  validator: boolean | 'hono';\n  validatorOutputPath: string;\n}\n\nexport interface ZodDateTimeOptions {\n  offset?: boolean;\n  local?: boolean;\n  precision?: number;\n}\n\nexport interface ZodTimeOptions {\n  precision?: -1 | 0 | 1 | 2 | 3;\n}\n\n/**\n * Target Zod major version for generated output.\n *\n * - `4` — always emit Zod 4-style output (`z.strictObject`, `z.looseObject`,\n *   `z.iso.datetime()`, `.meta()`, …) regardless of the installed `zod` version.\n * - `3` — always emit Zod 3-compatible output (`.strict()`/`.passthrough()`,\n *   `z.string().datetime()`, …) regardless of the installed `zod` version.\n * - `'auto'` — infer the target from the `zod` version resolved in the output\n *   project's `package.json`; when no `zod` package can be detected, fall back\n *   to Zod 4 output.\n */\nexport type ZodVersionOption = 3 | 4 | 'auto';\n\nexport type ZodVariantOption = 'classic' | 'mini';\n\ninterface BaseZodOptions {\n  strict?: {\n    param?: boolean;\n    query?: boolean;\n    header?: boolean;\n    body?: boolean;\n    response?: boolean;\n  };\n  generate?: {\n    param?: boolean;\n    query?: boolean;\n    header?: boolean;\n    body?: boolean;\n    response?: boolean;\n  };\n  coerce?: {\n    param?: boolean | ZodCoerceType[];\n    query?: boolean | ZodCoerceType[];\n    header?: boolean | ZodCoerceType[];\n    body?: boolean | ZodCoerceType[];\n    response?: boolean | ZodCoerceType[];\n  };\n  preprocess?: {\n    param?: Mutator;\n    query?: Mutator;\n    header?: Mutator;\n    body?: Mutator;\n    response?: Mutator;\n  };\n  /**\n   * Mutator referencing a function called once per emitted validator at schema\n   * construction time. It receives codegen-time context (operation, location,\n   * schema name, field path, validator name) and returns a Zod `params` object\n   * (e.g. `{ error: ... }`) that is appended as the trailing argument.\n   *\n   * The plural name follows Zod's own term for the validator's second argument\n   * (`z.string(params)`) and is unrelated to the singular `param` key used by\n   * `generate` / `coerce` / `preprocess` above, which refers to the path-parameter\n   * location.\n   */\n  params?: Mutator;\n  useBrandedTypes?: boolean;\n  /**\n   * When true, each generated `export const X = <zod schema>` is followed by\n   * `export type X = zod.input<typeof X>;` and\n   * `export type XOutput = zod.output<typeof X>;`, including the `Item`\n   * schema split out for a bounded/array body or response. Default `false`.\n   */\n  generateCompanionTypes?: boolean;\n}\n\nexport interface ZodOptions extends BaseZodOptions {\n  /**\n   * Select the generated Zod API style. `classic` imports from `zod`; `mini`\n   * imports from `zod/mini` and emits the functional/check-based Zod Mini API.\n   * Zod Mini requires a Zod 4 target.\n   */\n  variant?: ZodVariantOption;\n  /**\n   * Pin the Zod output target so generation is deterministic instead of\n   * inferred from the installed `zod` version. Defaults to `'auto'`, which\n   * infers from the detected package and otherwise falls back to Zod 4 output.\n   * See {@link ZodVersionOption}.\n   */\n  version?: ZodVersionOption;\n  dateTimeOptions?: ZodDateTimeOptions;\n  timeOptions?: ZodTimeOptions;\n  generateEachHttpStatus?: boolean;\n  /**\n   * When true, emits one reusable Zod schema per `#/components/schemas/*` `$ref`\n   * (with `namingConvention` applied to the name) and references it everywhere\n   * instead of inlining. Default `false`. See `docs/superpowers/specs/2026-05-26-reusable-zod-schemas-design.md`.\n   */\n  generateReusableSchemas?: boolean;\n  /**\n   * When true (zod v4 only), attaches registry metadata to generated\n   * **component** schemas via `.meta({ id, description?, deprecated? })`: `id` is\n   * the schema name, plus `description`/`deprecated` when the OpenAPI schema\n   * provides them. On zod v3 (which has no `.meta()`) descriptions still emit\n   * via `.describe()`. Default `false`.\n   */\n  generateMeta?: boolean;\n  /**\n   * When true, a `oneOf`/`anyOf` that carries an OpenAPI `discriminator` is\n   * emitted as `zod.discriminatedUnion(key, [...])` (better per-branch errors)\n   * instead of a plain `zod.union([...])`, but only when every branch can be\n   * represented as an object — otherwise it safely falls back to a union.\n   * Default `false` (opt-in), so existing output is unchanged.\n   */\n  generateDiscriminatedUnion?: boolean;\n  /**\n   * When true (zod v4 only), emits optional object properties with\n   * `.exactOptional()` (classic) / `zod.exactOptional()` (mini) instead of\n   * `.optional()`, so consumers with `exactOptionalPropertyTypes` infer\n   * `{ x?: T }` rather than `{ x?: T | undefined }`. On zod v3 (which has no\n   * `.exactOptional()`) this is a no-op and `.optional()` is emitted. Default\n   * `false` (opt-in), so existing output is unchanged.\n   */\n  exactOptional?: boolean;\n}\n\n/**\n * Per-operation/tag Zod overrides only include settings that are actually\n * merged into the operation-specific generator path. Output-wide target and\n * schema-layout settings belong on `override.zod`, not `override.operations.*`\n * / `override.tags.*`.\n */\nexport type OperationZodOptions = BaseZodOptions;\n\n/**\n * Runtime source of truth for the `override.zod` keys that may also be set per\n * operation or tag. `NormalizedOperationZodOptions`, the unsupported-key\n * warning, and the operation/tag normalization in `orval` are all derived from\n * this array; the `satisfies` clause plus the `Exclude` assertion below force\n * it to stay in lockstep with `OperationZodOptions`.\n */\nexport const operationZodOverrideKeys = [\n  'strict',\n  'generate',\n  'coerce',\n  'preprocess',\n  'params',\n  'useBrandedTypes',\n  'generateCompanionTypes',\n] as const satisfies readonly (keyof OperationZodOptions)[];\n\nexport type OperationZodOverrideKey = (typeof operationZodOverrideKeys)[number];\n\n// Compile-time exhaustiveness: adding a key to `BaseZodOptions` without adding\n// it to `operationZodOverrideKeys` makes this alias non-`never` and the\n// `satisfies` below fail.\ntype MissingOperationZodOverrideKey = Exclude<\n  keyof OperationZodOptions,\n  OperationZodOverrideKey\n>;\ntrue satisfies MissingOperationZodOverrideKey extends never ? true : never;\n\n/**\n * Target Effect major version for generated output.\n *\n * - `4` — always emit Effect 4 Schema output (`S.Union([...])`, `.check(...)`,\n *   `S.optionalKey`, …) regardless of the installed `effect` version.\n * - `3` — always emit Effect 3 Schema output (`S.Union(...)`, `.pipe(...)`,\n *   `S.optionalWith`, …) regardless of the installed `effect` version.\n * - `'auto'` — infer the target from the `effect` version resolved in the\n *   output project's `package.json`; when no `effect` package can be detected,\n *   fall back to Effect 4 output.\n */\nexport type EffectVersionOption = 3 | 4 | 'auto';\n\nexport interface EffectOptions {\n  strict?: ZodOptions['strict'];\n  generate?: ZodOptions['generate'];\n  generateEachHttpStatus?: boolean;\n  useBrandedTypes?: boolean;\n  /**\n   * When true, emits optional Struct properties with\n   * `S.optionalWith(schema, { exact: true })` (Effect 3) or\n   * `S.optionalKey(schema)` (Effect 4) instead of `S.optional(schema)`, so\n   * `exactOptionalPropertyTypes` consumers infer `{ x?: T }`. Default `false`.\n   */\n  exactOptional?: boolean;\n  /**\n   * Pin the Effect output target instead of inferring it from the installed\n   * `effect` version. Defaults to `'auto'`. See {@link EffectVersionOption}.\n   */\n  version?: EffectVersionOption;\n}\n\nexport type ZodCoerceType =\n  | 'string'\n  | 'number'\n  | 'boolean'\n  | 'bigint'\n  | 'date'\n  // Not a real `z.coerce.array()` — opting 'array' into `coerce.<location>`\n  // wraps array params in a single→array preprocess so a single repeated-key\n  // query value (delivered as a scalar by the server framework) still parses.\n  | 'array';\n\nexport interface NormalizedZodOptions {\n  variant: ZodVariantOption;\n  version: ZodVersionOption;\n  strict: {\n    param: boolean;\n    query: boolean;\n    header: boolean;\n    body: boolean;\n    response: boolean;\n  };\n  generate: {\n    param: boolean;\n    query: boolean;\n    header: boolean;\n    body: boolean;\n    response: boolean;\n  };\n  coerce: {\n    param: boolean | ZodCoerceType[];\n    query: boolean | ZodCoerceType[];\n    header: boolean | ZodCoerceType[];\n    body: boolean | ZodCoerceType[];\n    response: boolean | ZodCoerceType[];\n  };\n  preprocess?: {\n    param?: NormalizedMutator;\n    query?: NormalizedMutator;\n    header?: NormalizedMutator;\n    body?: NormalizedMutator;\n    response?: NormalizedMutator;\n  };\n  params?: NormalizedMutator;\n  generateEachHttpStatus: boolean;\n  useBrandedTypes: boolean;\n  generateReusableSchemas: boolean;\n  generateMeta: boolean;\n  generateDiscriminatedUnion: boolean;\n  exactOptional: boolean;\n  generateCompanionTypes: boolean;\n  dateTimeOptions: ZodDateTimeOptions;\n  timeOptions: ZodTimeOptions;\n}\n\nexport type NormalizedOperationZodOptions = Pick<\n  NormalizedZodOptions,\n  OperationZodOverrideKey\n>;\n\nexport interface NormalizedEffectOptions {\n  strict: NormalizedZodOptions['strict'];\n  generate: NormalizedZodOptions['generate'];\n  generateEachHttpStatus: boolean;\n  useBrandedTypes: boolean;\n  exactOptional: boolean;\n  version: EffectVersionOption;\n}\n\n/**\n * A single parameter value for `mutationInvalidates` params.\n *\n * - `string` – treated as a variable reference, e.g. `\"petId\"` → `variables.petId`\n * - `{ literal: string }` – emitted as a string literal, e.g. `{ literal: \"@me\" }` → `\"@me\"`\n */\nexport type InvalidateTargetParam = string | { literal: string };\n\nexport type InvalidateTarget =\n  | string\n  | {\n      query: string;\n      params?: InvalidateTargetParam[] | Record<string, InvalidateTargetParam>;\n      invalidateMode?: 'invalidate' | 'reset';\n      file?: string;\n    };\n\nexport interface MutationInvalidatesRule {\n  onMutations: string[];\n  invalidates: InvalidateTarget[];\n}\n\nexport type MutationInvalidatesConfig = MutationInvalidatesRule[];\n\nexport interface HonoOptions {\n  handlers?: string;\n  handlerGenerationStrategy?: HonoHandlerStrategy;\n  compositeRoute?: string;\n  validator?: boolean | 'hono';\n  validatorOutputPath?: string;\n}\n\nexport interface McpServerOptions {\n  path: string;\n  name?: string;\n  default?: boolean;\n}\n\nexport interface NormalizedMcpServerOptions {\n  path: string;\n  name?: string;\n  default: boolean;\n}\n\nexport interface McpHandlerOptions {\n  path: string;\n  name?: string;\n  default?: boolean;\n}\n\nexport interface NormalizedMcpHandlerOptions {\n  path: string;\n  name?: string;\n  default: boolean;\n}\n\nexport interface McpOptions {\n  server?: McpServerOptions;\n  handler?: McpHandlerOptions;\n}\n\nexport interface NormalizedMcpOptions {\n  server?: NormalizedMcpServerOptions;\n  handler?: NormalizedMcpHandlerOptions;\n}\n\n/**\n * Strategy controlling how a Zod-backed client reacts to a response that fails\n * runtime validation.\n *\n * - `throw`: call `Schema.parse(data)` and let it throw (identical to the legacy\n *   boolean `true` behaviour).\n * - `both`: `safeParse` the payload, `console.error` the raw `ZodError` for\n *   production visibility, then re-throw so the failure still surfaces through\n *   the client's native error channel.\n */\nexport type RuntimeValidationStrategy = 'throw' | 'both';\n\n/**\n * Per-client runtime-validation configuration surface.\n *\n * `true` is the canonical form of `{ strategy: 'throw' }`; `false`/omitted\n * disables validation. Both remain backward compatible with the original\n * boolean toggle.\n */\nexport type RuntimeValidation =\n  | boolean\n  | { strategy: RuntimeValidationStrategy };\n\n/**\n * Canonical, normalized runtime-validation configuration consumed by the client\n * generators.\n */\nexport interface NormalizedRuntimeValidation {\n  enabled: boolean;\n  strategy: RuntimeValidationStrategy;\n}\n\n/**\n * Angular's `runtimeValidation` surface. On top of the shared forms, the object\n * form can opt JSON request bodies into parsing before they are sent. The\n * object form enables response validation too, with `strategy` defaulting to\n * `throw`.\n */\nexport type AngularRuntimeValidation =\n  | boolean\n  | {\n      strategy?: RuntimeValidationStrategy;\n      /**\n       * Parse JSON request bodies with the generated Zod schema before the\n       * request is sent. `strategy` applies to request bodies as well.\n       *\n       * @default false\n       */\n      requestBodies?: boolean;\n    };\n\nexport interface NormalizedAngularRuntimeValidation extends NormalizedRuntimeValidation {\n  /** Omitted is the same as `false`. */\n  requestBodies?: boolean;\n}\n\nexport type InfiniteQueryParamLocation = 'query' | 'body';\n\nexport interface NormalizedQueryOptions {\n  useQuery?: boolean;\n  useSuspenseQuery?: boolean;\n  useMutation?: boolean;\n  useInfinite?: boolean;\n  useSuspenseInfiniteQuery?: boolean;\n  useInfiniteQueryParam?: string | string[];\n  /**\n   * Where the `useInfiniteQueryParam` page param lives. `'query'` pages\n   * through a URL query parameter; `'body'` pages through a property of the\n   * JSON request body, for `POST` endpoints that paginate with a filter body.\n   *\n   * @default 'query'\n   */\n  useInfiniteQueryParamLocation?: InfiniteQueryParamLocation;\n  usePrefetch?: boolean;\n  useInvalidate?: boolean;\n  useSetQueryData?: boolean;\n  useGetQueryData?: boolean;\n  /**\n   * Hold a query whose params are not resolved yet with `skipToken` instead of\n   * the generated `enabled` guard, so a caller's own `enabled` cannot replace\n   * the check and `refetch()` cannot bypass it. TanStack Query v5 only.\n   */\n  useSkipToken?: boolean;\n\n  options?: Record<string, unknown>;\n  queryKey?: NormalizedMutator;\n  queryOptions?: NormalizedMutator;\n  mutationOptions?: NormalizedMutator;\n  shouldExportMutatorHooks?: boolean;\n  shouldExportHttpClient?: boolean;\n  shouldExportKeys?: boolean;\n  shouldFilterQueryKey?: boolean;\n  queryKeyFilter?: string;\n  shouldSplitQueryKey?: boolean;\n  useOperationIdAsQueryKey?: boolean;\n  signal?: boolean;\n  version?: 3 | 4 | 5;\n  mutationInvalidates?: MutationInvalidatesConfig;\n  runtimeValidation?: NormalizedRuntimeValidation;\n}\n\nexport interface QueryOptions {\n  useQuery?: boolean;\n  useSuspenseQuery?: boolean;\n  useMutation?: boolean;\n  useInfinite?: boolean;\n  useSuspenseInfiniteQuery?: boolean;\n  useInfiniteQueryParam?: string | string[];\n  /**\n   * Where the `useInfiniteQueryParam` page param lives. `'query'` pages\n   * through a URL query parameter; `'body'` pages through a property of the\n   * JSON request body, for `POST` endpoints that paginate with a filter body.\n   *\n   * @default 'query'\n   */\n  useInfiniteQueryParamLocation?: InfiniteQueryParamLocation;\n  usePrefetch?: boolean;\n  useInvalidate?: boolean;\n  useSetQueryData?: boolean;\n  useGetQueryData?: boolean;\n  /**\n   * Hold a query whose params are not resolved yet with `skipToken` instead of\n   * the generated `enabled` guard, so a caller's own `enabled` cannot replace\n   * the check and `refetch()` cannot bypass it. TanStack Query v5 only.\n   */\n  useSkipToken?: boolean;\n\n  options?: Record<string, unknown>;\n  queryKey?: Mutator;\n  queryOptions?: Mutator;\n  mutationOptions?: Mutator;\n  shouldExportMutatorHooks?: boolean;\n  shouldExportHttpClient?: boolean;\n  shouldExportKeys?: boolean;\n  /**\n   * @deprecated Renamed to `shouldExportKeys`, since it now also exports mutation keys\n   */\n  shouldExportQueryKey?: boolean;\n  shouldFilterQueryKey?: boolean;\n  queryKeyFilter?: string;\n  shouldSplitQueryKey?: boolean;\n  useOperationIdAsQueryKey?: boolean;\n  signal?: boolean;\n  version?: 3 | 4 | 5;\n  mutationInvalidates?: MutationInvalidatesConfig;\n  runtimeValidation?: RuntimeValidation;\n}\n\nexport interface AngularOptions {\n  provideIn?: 'root' | 'any' | boolean;\n  /**\n   * Preferred name for configuring how retrieval-style operations are emitted.\n   *\n   * - `httpClient`: keep retrievals as service methods\n   * - `httpResource`: emit retrievals as Angular `httpResource` helpers\n   * - `both`: emit retrieval helpers and keep service methods where needed\n   *\n   * Mutation-style operations still use generated `HttpClient` service methods\n   * by default unless a per-operation override forces a different behavior.\n   */\n  retrievalClient?: 'httpClient' | 'httpResource' | 'both';\n  /**\n   * Backward-compatible alias for `retrievalClient`.\n   *\n   * Kept for compatibility with existing configs.\n   */\n  client?: 'httpClient' | 'httpResource' | 'both';\n  runtimeValidation?: AngularRuntimeValidation;\n  httpResource?: AngularHttpResourceOptions;\n  /**\n   * Opt-in: compose the runtime base URL for this output via Angular DI\n   * (an `InjectionToken`) instead of baking a static prefix into every\n   * route at generation time. Angular-client only; mutually exclusive with\n   * the top-level `output.baseUrl`.\n   */\n  baseUrl?: AngularBaseUrlOptions;\n  /**\n   * Controls how object-typed query parameters are serialized when no\n   * `paramsSerializer` is configured.\n   *\n   * - `spec` (default): honor the OpenAPI parameter's `style`/`explode` —\n   *   `form` + `explode: true` (the OpenAPI default) spreads the object's\n   *   properties as top-level query params, `form` + `explode: false` joins\n   *   them into a single comma-separated value, and `deepObject` emits\n   *   bracketed `name[prop]` keys.\n   * - `legacy`: restore the pre-#3705 behavior of silently dropping\n   *   object-typed query params from the generated request.\n   *\n   * Has no effect when a `paramsSerializer` or `paramsFilter` is configured\n   * for the operation — those remain in full control of the raw value. See\n   * issue #3705.\n   */\n  queryObjectSerialization?: 'spec' | 'legacy';\n}\n\nexport interface NormalizedAngularOptions {\n  provideIn: 'root' | 'any' | boolean;\n  client: 'httpClient' | 'httpResource' | 'both';\n  runtimeValidation: NormalizedAngularRuntimeValidation;\n  httpResource?: AngularHttpResourceOptions;\n  baseUrl?: AngularBaseUrlOptions;\n  queryObjectSerialization: 'spec' | 'legacy';\n}\n\nexport interface AngularHttpResourceOptions {\n  /**\n   * Value to expose while the resource is idle/loading.\n   *\n   * Serialized as a literal into generated code.\n   */\n  defaultValue?: unknown;\n  /**\n   * Debug name shown in Angular DevTools.\n   */\n  debugName?: string;\n  /**\n   * Raw code expression for HttpResourceOptions.injector.\n   * Example: `inject(Injector)`.\n   */\n  injector?: string;\n  /**\n   * Raw code expression for HttpResourceOptions.equal.\n   * Example: `(a, b) => a.id === b.id`.\n   */\n  equal?: string;\n}\n\nexport interface SwrOptions {\n  useInfinite?: boolean;\n  useSWRMutationForGet?: boolean;\n  useSuspense?: boolean;\n  generateErrorTypes?: boolean;\n  swrOptions?: unknown;\n  swrMutationOptions?: unknown;\n  swrInfiniteOptions?: unknown;\n}\n\nexport interface NormalizedAxiosOptions {\n  includeHttpResponseReturnType: boolean;\n}\n\nexport interface AxiosOptions {\n  /**\n   * Include the HTTP status in the return type so it discriminates the\n   * response data type.\n   *\n   * @default false\n   */\n  includeHttpResponseReturnType?: boolean;\n}\n\nexport interface NormalizedFetchOptions {\n  includeHttpResponseReturnType: boolean;\n  forceSuccessResponse: boolean;\n  includeHttpErrorResponse?: boolean;\n  serializeResponseHeaders: boolean;\n  jsonReviver?: Mutator;\n  runtimeValidation: NormalizedRuntimeValidation;\n  useRuntimeFetcher: boolean;\n  /**\n   * Serialization format for array query parameters that do not have an explicit\n   * `explode` setting in the OpenAPI spec.\n   *\n   * - `repeat` — repeat the key for each value: `foo=1&foo=2`\n   * - `brackets` — append `[]` to the key: `foo[]=1&foo[]=2`\n   * - `comma` — join values with a comma: `foo=1,2`\n   */\n  arrayFormat?: 'repeat' | 'brackets' | 'comma';\n}\n\nexport interface FetchOptions {\n  includeHttpResponseReturnType?: boolean;\n  forceSuccessResponse?: boolean;\n  /**\n   * Pass full error response types to a custom mutator's ErrorType and declared\n   * error statuses/media types in its third argument. Requires response envelopes,\n   * forceSuccessResponse, and a non-hook mutator accepting three arguments.\n   * Only explicit error status codes are supported after content-type filtering.\n   *\n   * @default false\n   */\n  includeHttpErrorResponse?: boolean;\n  /**\n   * Return response `headers` as a plain `Record<string, string>` instead of a\n   * `Headers` instance, so the response stays serializable. Keys are lowercased\n   * and `set-cookie` is omitted. With a `mutator` this only changes the declared\n   * type — the mutator must return headers in that shape itself.\n   *\n   * @default false\n   */\n  serializeResponseHeaders?: boolean;\n  jsonReviver?: Mutator;\n  runtimeValidation?: RuntimeValidation;\n  useRuntimeFetcher?: boolean;\n  /**\n   * Serialization format for array query parameters that do not have an explicit\n   * `explode` setting in the OpenAPI spec.\n   *\n   * - `repeat` — repeat the key for each value: `foo=1&foo=2`\n   * - `brackets` — append `[]` to the key: `foo[]=1&foo[]=2`\n   * - `comma` — join values with a comma: `foo=1,2`\n   */\n  arrayFormat?: 'repeat' | 'brackets' | 'comma';\n}\n\nexport type InputTransformerFn = (\n  spec: OpenApiDocument,\n) => OpenApiDocument | Promise<OpenApiDocument>;\n\ntype InputTransformer = string | InputTransformerFn;\n\nexport interface OverrideInput {\n  transformer?: InputTransformer;\n}\n\nexport interface OperationOptions {\n  transformer?: OutputTransformer;\n  mutator?: Mutator;\n  mock?: {\n    data?: MockData;\n    properties?: MockProperties;\n  };\n  query?: QueryOptions;\n  angular?: AngularOptions;\n  swr?: SwrOptions;\n  zod?: OperationZodOptions;\n  effect?: EffectOptions;\n  operationName?: (\n    operation: OpenApiOperationObject,\n    route: string,\n    verb: Verbs,\n  ) => string | [string, string];\n  axios?: AxiosOptions;\n  fetch?: FetchOptions;\n  formData?: boolean | Mutator | FormDataType<Mutator>;\n  formUrlEncoded?: boolean | Mutator;\n  paramsSerializer?: Mutator;\n  paramsFilter?: Mutator;\n  requestOptions?: object | boolean;\n}\n\nexport type Hook = 'afterAllFilesWrite';\n\nexport type HookFunction<TArgs extends unknown[] = unknown[]> = (\n  ...args: TArgs\n) => void | Promise<void>;\n\nexport interface HookOption {\n  command: string | HookFunction;\n  injectGeneratedDirsAndFiles?: boolean;\n}\n\nexport type HookCommand =\n  | string\n  | HookFunction\n  | HookOption\n  | (string | HookFunction | HookOption)[];\n\nexport type NormalizedHookCommand = HookCommand[];\n\nexport type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<\n  Record<Hook, T>\n>;\n\nexport type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;\n\nexport type Verbs =\n  | 'get'\n  | 'put'\n  | 'post'\n  | 'delete'\n  | 'options'\n  | 'head'\n  | 'patch'\n  | 'query';\n\nexport const Verbs = {\n  GET: 'get' as Verbs,\n  PUT: 'put' as Verbs,\n  POST: 'post' as Verbs,\n  DELETE: 'delete' as Verbs,\n  OPTIONS: 'options' as Verbs,\n  HEAD: 'head' as Verbs,\n  PATCH: 'patch' as Verbs,\n  QUERY: 'query' as Verbs,\n};\n\n/**\n * Canonical tag name used for the generated bucket that collects untagged operations.\n */\nexport const DefaultTag = 'default' as const;\n\nexport interface ImportOpenApi {\n  spec: OpenApiDocument;\n  input: NormalizedInputOptions;\n  output: NormalizedOutputOptions;\n  target: string;\n  workspace: string;\n  projectName?: string;\n}\n\nexport interface ContextSpec {\n  projectName?: string;\n  target: string;\n  workspace: string;\n  spec: OpenApiDocument;\n  parents?: string[];\n  output: NormalizedOutputOptions;\n  /**\n   * Per-schema dynamic scope mapping `$dynamicAnchor` names to concrete schema\n   * entries or generic parameter placeholders. Populated by `buildDynamicScope`.\n   */\n  dynamicScope?: Partial<Record<string, DynamicScopeEntry>>;\n  /**\n   * Lazily-built index of every `$dynamicAnchor` declared in\n   * `components.schemas`, used by the `resolveDynamicRef` fallback when an\n   * anchor is absent from {@link dynamicScope}. Memoized on first miss so the\n   * O(numSchemas) scan runs once per spec instead of once per `$dynamicRef`.\n   * Populated by `getDynamicAnchorIndex` in `resolvers/ref.ts`.\n   */\n  dynamicAnchorIndex?: Map<string, DynamicAnchorIndexEntry>;\n  /**\n   * Lazily-built set of normalized component schema names, used while naming\n   * inline object-property schemas so component name collision checks do not\n   * rescan `components.schemas` for every property.\n   */\n  normalizedComponentSchemaNames?: Set<string>;\n  /**\n   * Tracks array-item mock factory names already emitted per output file scope.\n   * Populated by `@orval/mock` when `arrayItems: true` so shared `$ref` item\n   * factories are not re-declared within the same file (single/split) or tag\n   * bucket (tags/tags-split). Scope keys include the active mock generator\n   * type so separate `.msw.ts` / `.faker.ts` files each get their own copy.\n   */\n  arrayItemMockFactories?: Map<string, Set<string>>;\n  /**\n   * Set by `@orval/mock` while generating per-operation mock output so\n   * file-scoped helpers (e.g. array-item factory dedup) can distinguish\n   * separate mock generator files.\n   */\n  activeMockOutputType?: OutputMockType;\n}\n\n/**\n * Maps a `$dynamicAnchor` name to its resolution target.\n *\n * Concrete entry (bound via `$ref`):\n *   - `name` — the generated TypeScript type name (e.g. `User`)\n *   - `schemaName` — the original key in `components.schemas` (e.g. `User`)\n *\n * Parameter entry (unbound `$defs` placeholder):\n *   - `isParameter` — `true`, signals this is a generic type parameter\n *   - `name` — the `$dynamicAnchor` name used as the type parameter (e.g. `itemType`)\n *   - `schemaName` — same as `name` for parameters\n *\n * Inline entry (anonymous subschema overriding an anchor without a `$ref`):\n *   - `inlineSchema` — the concrete schema object to resolve `$dynamicRef` against.\n *     Takes precedence over the component lookup in `resolveDynamicRef`, so an\n *     inline `$dynamicAnchor` (e.g. inside `allOf` / `items`) correctly shadows\n *     the outer/global anchor. `schemaName` is the anchor name itself.\n */\nexport interface DynamicScopeEntry {\n  name: string;\n  schemaName: string;\n  isParameter?: boolean;\n  inlineSchema?: OpenApiSchemaObject;\n}\n\n/**\n * Compact per-anchor result of the single `$dynamicAnchor` index scan.\n *\n * Reproduces the precedence in `resolveDynamicRef`'s fallback without storing\n * full match arrays:\n *   - {@link exactName} — a schema whose key equals the anchor name. Always\n *     wins when present (matches `matches.find(m => m === anchorName)`).\n *   - {@link firstName} / {@link count} — non-exact matches. Only the first is\n *     kept; `count` is capped at 2 because the resolution only distinguishes\n *     \"exactly one\" from \"ambiguous\". Recording stops once `count >= 2`, which\n *     is the safe form of \"bail early when ambiguous\" — a literal early-return\n *     at `count === 2` would regress the exact-name rule when the exact schema\n *     appears later in iteration order.\n */\nexport interface DynamicAnchorIndexEntry {\n  exactName?: string;\n  firstName?: string;\n  count: number;\n}\n\nexport const LOG_LEVELS = [\n  'error',\n  'warn',\n  'info',\n  'verbose',\n  'debug',\n] as const;\n\nexport type LogLevel = (typeof LOG_LEVELS)[number];\n\nexport interface GlobalOptions {\n  watch?: boolean | string | string[];\n  logLevel?: LogLevel;\n  clean?: boolean | string[];\n  formatter?: SupportedFormatter;\n  mock?: OutputMocksOption;\n  client?: OutputClient;\n  httpClient?: OutputHttpClient;\n  mode?: OutputMode;\n  tsconfig?: string | Tsconfig;\n  packageJson?: string;\n  input?: string | string[];\n  output?: string;\n  failOnWarnings?: boolean;\n  throwOnError?: boolean;\n}\n\nexport interface Tsconfig {\n  baseUrl?: string;\n  compilerOptions?: {\n    esModuleInterop?: boolean;\n    allowSyntheticDefaultImports?: boolean;\n    exactOptionalPropertyTypes?: boolean;\n    paths?: Record<string, string[]>;\n    target?: TsConfigTarget;\n    module?: TsConfigModule;\n    moduleResolution?: TsConfigModuleResolution;\n    allowImportingTsExtensions?: boolean;\n  };\n}\n\nexport type TsConfigTarget =\n  | 'es3'\n  | 'es5'\n  | 'es6'\n  | 'es2015'\n  | 'es2016'\n  | 'es2017'\n  | 'es2018'\n  | 'es2019'\n  | 'es2020'\n  | 'es2021'\n  | 'es2022'\n  | 'es2023'\n  | 'es2024'\n  | 'es2025'\n  | 'esnext'; // https://www.typescriptlang.org/tsconfig#target\n\n/** Accepts both the canonical casing and the all-lowercase variant of a string literal. */\ntype CaseInsensitive<T extends string> = T | Lowercase<T>;\n\n/**\n * Valid values for the TypeScript `compilerOptions.module` setting.\n *\n * Both title-case (e.g. `\"NodeNext\"`) and lower-case (e.g. `\"nodenext\"`) are\n * accepted, matching TypeScript's own case-insensitive parsing.\n *\n * @see {@link https://www.typescriptlang.org/tsconfig#module}\n */\nexport type TsConfigModule = CaseInsensitive<\n  | 'None'\n  | 'CommonJS'\n  | 'AMD'\n  | 'UMD'\n  | 'System'\n  | 'ES6'\n  | 'ES2015'\n  | 'ES2020'\n  | 'ES2022'\n  | 'ESNext'\n  | 'Node16'\n  | 'Node18'\n  | 'Node20'\n  | 'NodeNext'\n  | 'Preserve'\n>;\n\n/**\n * Valid values for the TypeScript `compilerOptions.moduleResolution` setting.\n *\n * Both title-case (e.g. `\"NodeNext\"`) and lower-case (e.g. `\"nodenext\"`) are\n * accepted, matching TypeScript's own case-insensitive parsing.\n *\n * @see https://www.typescriptlang.org/tsconfig#moduleResolution\n */\nexport type TsConfigModuleResolution = CaseInsensitive<\n  'Classic' | 'Node' | 'Node10' | 'Node16' | 'NodeNext' | 'Bundler'\n>;\n\nexport interface PackageJson {\n  dependencies?: Record<string, string>;\n  devDependencies?: Record<string, string>;\n  peerDependencies?: Record<string, string>;\n  catalog?: Record<string, string>;\n  catalogs?: Record<string, Record<string, string>>;\n  resolvedVersions?: Record<string, string>;\n}\n\nexport interface GeneratorSchema {\n  name: string;\n  model: string;\n  imports: GeneratorImport[];\n  dependencies?: string[];\n  schema?: OpenApiSchemaObject;\n  // Optional for compatibility with callers constructing GeneratorSchema;\n  // production generators set it before route-aware schema writing.\n  kind?: GeneratedSchemaKind;\n  factory?: string;\n  factoryImports?: GeneratorImport[];\n  factoryMode?: FactoryMethodsMode;\n}\n\nexport interface GeneratorImport {\n  readonly name: string;\n  readonly schemaName?: string;\n  readonly isZodSchema?: boolean;\n  readonly isConstant?: boolean;\n  readonly alias?: string;\n  readonly default?: boolean;\n  readonly values?: boolean;\n  readonly syntheticDefaultImport?: boolean;\n  readonly namespaceImport?: boolean;\n  readonly importPath?: string;\n  // True when this import points at a generated schema-level faker factory\n  // (e.g. `getPetMock`). The mock-file writer routes it to\n  // `<schemas-dir>/index.faker` instead of `<schemas-dir>/<schemaName>`.\n  readonly schemaFactory?: boolean;\n  // Zod-schemas mode: the base schema identifier whose `.zod` file declares\n  // this binding. Set on `${name}Output` type-alias imports so per-file\n  // (`indexFiles: false`) layouts route them to the base schema's file\n  // instead of a nonexistent `<name>.zod` one.\n  readonly zodBaseName?: string;\n}\n\nexport interface GeneratorDependency {\n  readonly exports: readonly GeneratorImport[];\n  readonly dependency: string;\n}\n\nexport interface GeneratorApiResponse {\n  operations: GeneratorOperations;\n  schemas: GeneratorSchema[];\n}\n\nexport type GeneratorOperations = Record<string, GeneratorOperation>;\n\n// A single generator's accumulated mock output, keyed by the generator's\n// `OutputMockType`. Writers iterate over `GeneratorTarget.mockOutputs` to\n// emit one file per entry (e.g. `<file>.msw.ts` and `<file>.faker.ts`).\nexport type StrictMockSchemaKind = 'object' | 'alias' | 'binary';\n\nexport interface GeneratorMockOutput {\n  type: OutputMockType;\n  implementation: string;\n  imports: GeneratorImport[];\n  strictMockSchemaTypeNames?: string[];\n  strictMockSchemaKinds?: Record<string, StrictMockSchemaKind>;\n}\n\nexport interface GeneratorMockOutputFull {\n  type: OutputMockType;\n  implementation: {\n    function: string;\n    handler: string;\n    handlerName: string;\n  };\n  imports: GeneratorImport[];\n  strictMockSchemaTypeNames?: string[];\n  strictMockSchemaKinds?: Record<string, StrictMockSchemaKind>;\n}\n\nexport interface GeneratorTarget {\n  imports: GeneratorImport[];\n  implementation: string;\n  mockOutputs: GeneratorMockOutput[];\n  mutators?: GeneratorMutator[];\n  clientMutators?: GeneratorMutator[];\n  formData?: GeneratorMutator[];\n  formUrlEncoded?: GeneratorMutator[];\n  paramsSerializer?: GeneratorMutator[];\n  paramsFilter?: GeneratorMutator[];\n  fetchReviver?: GeneratorMutator[];\n  sharedTypes?: SharedTypeDeclaration[];\n}\n\nexport interface GeneratorTargetFull {\n  imports: GeneratorImport[];\n  implementation: string;\n  mockOutputs: GeneratorMockOutputFull[];\n  mutators?: GeneratorMutator[];\n  clientMutators?: GeneratorMutator[];\n  formData?: GeneratorMutator[];\n  formUrlEncoded?: GeneratorMutator[];\n  paramsSerializer?: GeneratorMutator[];\n  paramsFilter?: GeneratorMutator[];\n  fetchReviver?: GeneratorMutator[];\n  sharedTypes?: SharedTypeDeclaration[];\n}\n\nexport interface GeneratorOperation {\n  imports: GeneratorImport[];\n  implementation: string;\n  mockOutputs: GeneratorMockOutputFull[];\n  tags: string[];\n  mutator?: GeneratorMutator;\n  clientMutators?: GeneratorMutator[];\n  formData?: GeneratorMutator;\n  formUrlEncoded?: GeneratorMutator;\n  paramsSerializer?: GeneratorMutator;\n  paramsFilter?: GeneratorMutator;\n  fetchReviver?: GeneratorMutator;\n  operationName: string;\n  /** Resolved Axios URL-helper name when the output client emits one. */\n  urlHelperName?: string;\n  types?: {\n    result: (title?: string) => string;\n  };\n}\n\n/**\n * One operation's slice of a tag bucket, produced by\n * `generateTargetForTagsOperations` for the `tags-operations` /\n * `tags-operations-split` modes. Unlike `GeneratorTargetFull`, the\n * implementation here is never merged with sibling operations — each\n * operation keeps its own header/footer-wrapped implementation so it can be\n * written to its own file.\n */\nexport interface GeneratorOperationTarget {\n  operationName: string;\n  imports: GeneratorImport[];\n  implementation: string;\n  mockOutputs: GeneratorMockOutput[];\n  mockOutputsFull: GeneratorMockOutputFull[];\n  mutators?: GeneratorMutator[];\n  clientMutators?: GeneratorMutator[];\n  formData?: GeneratorMutator[];\n  formUrlEncoded?: GeneratorMutator[];\n  paramsSerializer?: GeneratorMutator[];\n  paramsFilter?: GeneratorMutator[];\n  fetchReviver?: GeneratorMutator[];\n}\n\n/**\n * Shared per-tag helper block (e.g. `AwaitedInput`/`Awaited`,\n * `SecondParameter`, query-key helpers, deduplicated shared types) computed\n * once per tag so every operation file in that tag can import it instead of\n * redeclaring it.\n */\nexport interface GeneratorTagHelpers {\n  implementation: string;\n  sharedTypes?: SharedTypeDeclaration[];\n  /**\n   * Top-level `type` identifiers declared in `implementation`. Writers\n   * import these with `import type { ... }` — a side-effect import\n   * (`import './<tag>.helpers'`) never brings type names into scope.\n   */\n  typeNames: string[];\n  /**\n   * Top-level `const`/`function` identifiers declared in `implementation`\n   * (e.g. a query-key helper called at runtime). These must survive as a\n   * real value import, not `import type`.\n   */\n  valueNames: string[];\n}\n\nexport interface GeneratorTagOperationsTarget {\n  helpers: GeneratorTagHelpers;\n  operations: GeneratorOperationTarget[];\n}\n\nexport interface GeneratorVerbOptions {\n  verb: Verbs;\n  route: string;\n  pathRoute: string;\n  summary?: string;\n  doc: string;\n  tags: string[];\n  operationId: string;\n  operationName: string;\n  /** Resolved Axios URL-helper name when the output client emits one. */\n  urlHelperName?: string;\n  typeName: string;\n  response: GetterResponse;\n  body: GetterBody;\n  headers?: GetterQueryParam;\n  queryParams?: GetterQueryParam;\n  params: GetterParams;\n  props: GetterProps;\n  mutator?: GeneratorMutator;\n  formData?: GeneratorMutator;\n  formUrlEncoded?: GeneratorMutator;\n  paramsSerializer?: GeneratorMutator;\n  paramsFilter?: GeneratorMutator;\n  fetchReviver?: GeneratorMutator;\n  override: NormalizedOverrideOutput;\n  deprecated?: boolean;\n  originalOperation: OpenApiOperationObject;\n}\n\nexport type GeneratorVerbsOptions = GeneratorVerbOptions[];\n\nexport interface GeneratorOptions {\n  route: string;\n  pathRoute: string;\n  override: NormalizedOverrideOutput;\n  context: ContextSpec;\n  mock?: GlobalMockOptions | ClientMockBuilder;\n  output: string;\n}\n\nexport interface GeneratorClient {\n  implementation: string;\n  imports: GeneratorImport[];\n  mutators?: GeneratorMutator[];\n  /** When set, overrides the default verbOption.doc prepended to the implementation */\n  docComment?: string;\n  returnType?: (title?: string) => string;\n}\n\nexport interface GeneratorMutatorParsingInfo {\n  numberOfParams: number;\n  returnNumberOfParams?: number;\n}\nexport interface GeneratorMutator {\n  name: string;\n  path: string;\n  default: boolean;\n  hasErrorType: boolean;\n  errorTypeName: string;\n  hasSecondArg: boolean;\n  hasThirdArg: boolean;\n  isHook: boolean;\n  bodyTypeName?: string;\n  useHooks?: boolean;\n  inferred?: boolean;\n}\n\nexport type ClientBuilder = (\n  verbOptions: GeneratorVerbOptions,\n  options: GeneratorOptions,\n  outputClient: OutputClient | OutputClientFunc,\n  output?: NormalizedOutputOptions,\n) => GeneratorClient | Promise<GeneratorClient>;\n\n/**\n * Names that a generated file declares and that its sibling files of the same\n * kind declare identically. The barrel writer uses them to prevent TS2308.\n * See `buildBarrelReExports` for the rule.\n */\nexport interface SharedExports {\n  /**\n   * Type-only declarations. Re-exported via `export type { ... }` — kept\n   * separate from {@link SharedExports.values} because a type re-exported\n   * without the `type` modifier is an error under `verbatimModuleSyntax`,\n   * which Angular projects enable by default.\n   */\n  readonly types: readonly string[];\n  /** Value declarations, re-exported via `export { ... }`. */\n  readonly values: readonly string[];\n}\n\nexport interface ClientFileBuilder {\n  path: string;\n  content: string;\n  /**\n   * Set this to re-export the file from the `tags-split` barrel. Omit it when\n   * the file is not part of the public client surface, or when the file runs\n   * code at module level and an import must not start that code.\n   */\n  barrelExport?: boolean;\n  /**\n   * Declared by generators whose extra files repeat shared boilerplate. Omit\n   * when a file declares nothing its siblings also declare.\n   */\n  sharedExports?: SharedExports;\n}\nexport type ClientExtraFilesBuilder = (\n  verbOptions: Record<string, GeneratorVerbOptions>,\n  output: NormalizedOutputOptions,\n  context: ContextSpec,\n  // Extra files are rendered before the mode writers run, so they need this\n  // map to route schema imports into the same tag subdirectories.\n  schemaTagMap?: Map<string, string>,\n  // For the same reason they need the routed plan: without it a file falls\n  // back to the flat layout while its sibling routes, and the two disagree.\n  schemaOutputPlan?: SchemaOutputPlan,\n) => Promise<ClientFileBuilder[]>;\n\nexport interface SharedTypeDeclaration {\n  name: string;\n  exported: boolean;\n  code: string;\n}\n\nexport type HeaderResult = {\n  implementation: string;\n  sharedTypes?: SharedTypeDeclaration[];\n};\n\nexport type ClientHeaderBuilder = (params: {\n  title: string;\n  isRequestOptions: boolean;\n  isMutator: boolean;\n  noFunction?: boolean;\n  isGlobalMutator: boolean;\n  provideIn: boolean | 'root' | 'any';\n  hasAwaitedType: boolean;\n  output: NormalizedOutputOptions;\n  verbOptions: Record<string, GeneratorVerbOptions>;\n  tag?: string;\n  isDefaultTagBucket?: boolean;\n  clientImplementation: string;\n}) => string | HeaderResult;\n\nexport type ClientFooterBuilder = (params: {\n  noFunction?: boolean | undefined;\n  operationNames: string[];\n  operations?: GeneratorOperation[];\n  title?: string;\n  hasAwaitedType: boolean;\n  hasMutator: boolean;\n}) => string;\n\nexport type ClientTitleBuilder = (title: string) => string;\n\nexport type ClientDependenciesBuilder = (\n  hasGlobalMutator: boolean,\n  hasParamsSerializerOptions: boolean,\n  packageJson?: PackageJson,\n  httpClient?: OutputHttpClient,\n  hasTagsMutator?: boolean,\n  override?: NormalizedOverrideOutput,\n  /**\n   * The client implementation these imports are for, so a builder can settle a\n   * question the config cannot: whether *this file* uses an export as a value.\n   * Empty for callers that have no implementation to offer.\n   */\n  implementation?: string,\n) => GeneratorDependency[];\n\nexport interface ClientMockGeneratorImplementation {\n  function: string;\n  handlerName: string;\n  handler: string;\n}\n\nexport interface ClientMockGeneratorBuilder {\n  imports: GeneratorImport[];\n  implementation: ClientMockGeneratorImplementation;\n  strictMockSchemaTypeNames?: string[];\n  strictMockSchemaKinds?: Record<string, StrictMockSchemaKind>;\n}\n\nexport type ClientMockBuilder = (\n  verbOptions: GeneratorVerbOptions,\n  generatorOptions: GeneratorOptions,\n) => ClientMockGeneratorBuilder;\n\nexport interface ClientGeneratorsBuilder {\n  client: ClientBuilder;\n  header?: ClientHeaderBuilder;\n  dependencies?: ClientDependenciesBuilder;\n  footer?: ClientFooterBuilder;\n  title?: ClientTitleBuilder;\n  extraFiles?: ClientExtraFilesBuilder;\n}\n\nexport type GeneratorClients = Record<OutputClient, ClientGeneratorsBuilder>;\n\nexport interface GetterResponse {\n  imports: GeneratorImport[];\n  definition: {\n    success: string;\n    errors: string;\n  };\n  isBlob: boolean;\n  types: {\n    success: ResReqTypesValue[];\n    errors: ResReqTypesValue[];\n  };\n  contentTypes: string[];\n  schemas: GeneratorSchema[];\n\n  originalSchema?: OpenApiResponsesObject;\n}\n\nexport interface GetterBody {\n  originalSchema: OpenApiReferenceObject | OpenApiRequestBodyObject;\n  imports: GeneratorImport[];\n  definition: string;\n  implementation: string;\n  schemas: GeneratorSchema[];\n  formData?: string;\n  formUrlEncoded?: string;\n  contentType: string;\n  isOptional: boolean;\n  isBlob: boolean;\n}\n\nexport interface GetterParameters {\n  query: { parameter: OpenApiParameterObject; imports: GeneratorImport[] }[];\n  path: { parameter: OpenApiParameterObject; imports: GeneratorImport[] }[];\n  header: { parameter: OpenApiParameterObject; imports: GeneratorImport[] }[];\n}\n\nexport interface GetterParam {\n  name: string;\n  definition: string;\n  implementation: string;\n  default: unknown;\n  required: boolean;\n  /**\n   * True when the spec marks the path parameter `allowReserved: true`.\n   * Generators use this to skip URL-encoding the param at request time\n   * (e.g. wildcard/multi-segment `{path=**}` routes under\n   * `urlEncodeParameters`) (#3910).\n   */\n  allowReserved?: boolean;\n  imports: GeneratorImport[];\n}\n\nexport type GetterParams = GetterParam[];\nexport interface GetterQueryParam {\n  schema: GeneratorSchema;\n  deps: GeneratorSchema[];\n  isOptional: boolean;\n  paramNames?: string[];\n  originalSchema?: OpenApiSchemaObject;\n  requiredNullableKeys?: string[];\n  /**\n   * Names of query parameters whose declared schema is non-primitive\n   * (object, array of objects, or untyped). Used by Angular generators to\n   * preserve these values through the default `filterParams` helper instead\n   * of silently dropping them — the user's `paramsSerializer`, `mutator`, or\n   * `paramsFilter` is then responsible for handling them. See issue #3326.\n   */\n  nonPrimitiveKeys?: string[];\n  /**\n   * Per-parameter serialization strategy for query params whose declared\n   * schema is a plain object, derived from the OpenAPI parameter's\n   * `style`/`explode` (defaulting to `form` + `explode: true` per spec).\n   * Used by Angular generators' default `filterParams` helper to serialize\n   * these values instead of silently dropping them, when no\n   * `paramsSerializer`/`paramsFilter` is configured. See issue #3705.\n   *\n   * - `flatten`: `form` + `explode: true` — spread properties as top-level\n   *   query params.\n   * - `comma`: `form` + `explode: false` — join `prop,value` pairs with commas\n   *   into a single value.\n   * - `deepObject`: `deepObject` style — emit bracketed `name[prop]` keys.\n   */\n  objectQueryParams?: {\n    key: string;\n    strategy: 'flatten' | 'comma' | 'deepObject';\n  }[];\n}\n\nexport type GetterPropType =\n  | 'param'\n  | 'body'\n  | 'queryParam'\n  | 'header'\n  | 'namedPathParams';\n\nexport const GetterPropType = {\n  PARAM: 'param',\n  NAMED_PATH_PARAMS: 'namedPathParams',\n  BODY: 'body',\n  QUERY_PARAM: 'queryParam',\n  HEADER: 'header',\n} as const;\n\ninterface GetterPropBase {\n  name: string;\n  definition: string;\n  implementation: string;\n  default: unknown;\n  required: boolean;\n}\n\nexport type GetterProp = GetterPropBase &\n  (\n    | { type: 'namedPathParams'; destructured: string; schema: GeneratorSchema }\n    | { type: Exclude<GetterPropType, 'namedPathParams'> }\n  );\n\nexport type GetterProps = GetterProp[];\n\nexport type SchemaType =\n  | 'integer'\n  | 'number'\n  | 'string'\n  | 'boolean'\n  | 'object'\n  | 'null'\n  | 'array'\n  | 'enum'\n  | 'unknown';\n\nexport const SchemaType = {\n  integer: 'integer',\n  number: 'number',\n  string: 'string',\n  boolean: 'boolean',\n  object: 'object',\n  null: 'null',\n  array: 'array',\n  enum: 'enum',\n  unknown: 'unknown',\n};\n\nexport interface ScalarValue {\n  value: string;\n  useTypeAlias?: boolean;\n  isEnum: boolean;\n  hasReadonlyProps: boolean;\n  type: SchemaType;\n  imports: GeneratorImport[];\n  schemas: GeneratorSchema[];\n  isRef: boolean;\n  dependencies: string[];\n  example?: unknown;\n  examples?: Record<string, unknown> | unknown[];\n}\n\nexport type ResolverValue = ScalarValue & {\n  originalSchema: OpenApiSchemaObject;\n};\n\nexport type ResReqTypesValue = ScalarValue & {\n  formData?: string;\n  formUrlEncoded?: string;\n  isRef?: boolean;\n  hasReadonlyProps?: boolean;\n  key: string;\n  contentType: string;\n  originalSchema?: OpenApiSchemaObject;\n};\n\nexport interface FinalizeMockImplementationOptions {\n  mockOptions?: Pick<MockOptions, 'required' | 'nonNullable'>;\n  strictSchemaTypeNames?: readonly string[];\n  strictMockSchemaKinds?: Readonly<Record<string, StrictMockSchemaKind>>;\n}\n\nexport interface WriteSpecBuilder {\n  operations: GeneratorOperations;\n  verbOptions: Record<string, GeneratorVerbOptions>;\n  schemas: GeneratorSchema[];\n  title: GeneratorClientTitle;\n  header: GeneratorClientHeader;\n  footer: GeneratorClientFooter;\n  imports: GeneratorClientImports;\n  importsMock: GenerateMockImports;\n  /** Hoists shared strict-mock type aliases once per aggregated mock file. */\n  finalizeMockImplementation?: (\n    implementation: string,\n    options: FinalizeMockImplementationOptions,\n  ) => string;\n  extraFiles: ClientFileBuilder[];\n  info: OpenApiInfoObject;\n  target: string;\n  spec: OpenApiDocument;\n  /** Schema→tag map built during API building, when `splitByTags` is on. */\n  schemaTagMap?: Map<string, string>;\n  /** Routed schema paths built during API building, when `routes` is set. */\n  schemaOutputPlan?: SchemaOutputPlan;\n}\n\nexport interface WriteModeProps {\n  builder: WriteSpecBuilder;\n  output: NormalizedOutputOptions;\n  workspace: string;\n  projectName?: string;\n  header: string;\n  needSchema: boolean;\n  generateSchemasInline?: () => string;\n  // Schema-to-tag map computed by `getApiBuilder` when `schemas.splitByTags` is\n  // enabled. Mode writers forward it to `generateImportsForBuilder` so the\n  // `indexFiles: false` branch can route each schema import into its tag\n  // subdirectory instead of assuming a flat layout. `undefined` when\n  // `splitByTags` is disabled, in which case routing falls back to the flat\n  // layout. The `'.'` sentinel marks schemas referenced by 0 or 2+ tags\n  // (shared, kept at the schemas root).\n  schemaTagMap?: Map<string, string>;\n  /** Route-aware schema paths prepared by the top-level writer. */\n  schemaOutputPlan?: SchemaOutputPlan;\n}\n\nexport interface GeneratorApiOperations {\n  verbOptions: Record<string, GeneratorVerbOptions>;\n  operations: GeneratorOperations;\n  schemas: GeneratorSchema[];\n}\n\nexport interface GeneratorClientExtra {\n  implementation: string;\n  implementationMock: string;\n  sharedTypes?: SharedTypeDeclaration[];\n}\n\nexport type GeneratorClientTitle = (data: {\n  outputClient?: OutputClient | OutputClientFunc;\n  title: string;\n  customTitleFunc?: (title: string) => string;\n  output: NormalizedOutputOptions;\n}) => Promise<GeneratorClientExtra>;\n\nexport type GeneratorClientHeader = (data: {\n  outputClient?: OutputClient | OutputClientFunc;\n  isRequestOptions: boolean;\n  isMutator: boolean;\n  isGlobalMutator: boolean;\n  provideIn: boolean | 'root' | 'any';\n  hasAwaitedType: boolean;\n  titles: GeneratorClientExtra;\n  output: NormalizedOutputOptions;\n  verbOptions: Record<string, GeneratorVerbOptions>;\n  tag?: string;\n  isDefaultTagBucket?: boolean;\n  clientImplementation: string;\n}) => Promise<GeneratorClientExtra>;\n\nexport type GeneratorClientFooter = (data: {\n  outputClient: OutputClient | OutputClientFunc;\n  operationNames: string[];\n  operations?: GeneratorOperation[];\n  hasMutator: boolean;\n  hasAwaitedType: boolean;\n  titles: GeneratorClientExtra;\n  output: NormalizedOutputOptions;\n}) => Promise<GeneratorClientExtra>;\n\nexport type GeneratorClientImports = (data: {\n  client: OutputClient | OutputClientFunc;\n  implementation: string;\n  imports: readonly GeneratorDependency[];\n  projectName?: string;\n  hasSchemaDir: boolean;\n  isAllowSyntheticDefaultImports: boolean;\n  hasGlobalMutator: boolean;\n  hasTagsMutator: boolean;\n  hasParamsSerializerOptions: boolean;\n  packageJson?: PackageJson;\n  output: NormalizedOutputOptions;\n}) => Promise<string>;\n\nexport type GenerateMockImports = (data: {\n  implementation: string;\n  imports: readonly GeneratorDependency[];\n  projectName?: string;\n  hasSchemaDir: boolean;\n  isAllowSyntheticDefaultImports: boolean;\n  options?: GlobalMockOptions;\n}) => string;\n\nexport type GeneratorApiBuilder = GeneratorApiOperations & {\n  title: GeneratorClientTitle;\n  header: GeneratorClientHeader;\n  footer: GeneratorClientFooter;\n  imports: GeneratorClientImports;\n  importsMock: GenerateMockImports;\n  /** Hoists shared strict-mock type aliases once per aggregated mock file. */\n  finalizeMockImplementation?: (\n    implementation: string,\n    options: FinalizeMockImplementationOptions,\n  ) => string;\n  extraFiles: ClientFileBuilder[];\n  /** See {@link WriteSpecBuilder.schemaTagMap}. */\n  schemaTagMap?: Map<string, string>;\n  /** See {@link WriteSpecBuilder.schemaOutputPlan}. */\n  schemaOutputPlan?: SchemaOutputPlan;\n};\n\nexport class ErrorWithTag extends Error {\n  tag: string;\n  constructor(message: string, tag: string, options?: ErrorOptions) {\n    super(message, options);\n    this.tag = tag;\n  }\n}\n\n// OpenAPI type aliases. Intended to make it easier to swap to OpenAPI v3.2 in the future\nimport type {\n  ComponentsObject,\n  Document,\n  EncodingObject,\n  ExampleObject,\n  InfoObject,\n  MediaTypeObject,\n  MultiTypeObject,\n  OperationObject,\n  ParameterObject,\n  ParameterWithContentObject,\n  ParameterWithSchemaObject,\n  PathItemObject,\n  PathsObject,\n  PrimitiveSchemaType,\n  ReferenceObject,\n  RequestBodyObject,\n  ResponseObject,\n  ResponsesObject,\n  SchemaObject,\n  SchemaReferenceType,\n  ServerObject,\n} from '@scalar/openapi-types/3.1';\n\nexport type OpenApiDocument = Document;\nexport type OpenApiSchemaObject = SchemaObject;\n/**\n * Schema Object excluding JSON Schema boolean schemas (`true` / `false`).\n * - `true` - meaning any value allowed\n * - `false` - meaning no value allowed\n */\nexport type OpenApiNonBooleanSchemaObject = Exclude<\n  OpenApiSchemaObject,\n  boolean\n>;\nexport type OpenApiSchemasObject = Record<string, OpenApiSchemaObject>;\nexport type OpenApiReferenceObject = ReferenceObject;\nexport type OpenApiComponentsObject = ComponentsObject;\nexport type OpenApiPathsObject = PathsObject;\nexport type OpenApiPathItemObject = PathItemObject;\nexport type OpenApiResponsesObject = ResponsesObject;\nexport type OpenApiResponseObject = ResponseObject;\nexport type OpenApiParameterObject = ParameterObject;\nexport type OpenApiRequestBodyObject = RequestBodyObject;\nexport type OpenApiInfoObject = InfoObject;\nexport type OpenApiExampleObject = ExampleObject;\nexport type OpenApiOperationObject = OperationObject;\nexport type OpenApiMediaTypeObject = MediaTypeObject;\nexport type OpenApiEncodingObject = EncodingObject;\nexport type OpenApiServerObject = ServerObject;\nexport type OpenApiPrimitiveSchemaType = PrimitiveSchemaType;\nexport type OpenApiParameterWithSchemaObject = ParameterWithSchemaObject;\nexport type OpenApiParameterWithContentObject = ParameterWithContentObject;\nexport type OpenApiMultiTypeObject = MultiTypeObject;\nexport type OpenApiSchemaReference<TValue> = SchemaReferenceType<TValue>;\n","import { Verbs } from './types';\n\nexport const generalJSTypes = [\n  'number',\n  'string',\n  'null',\n  'unknown',\n  'undefined',\n  'object',\n  'blob',\n];\n\nexport const generalJSTypesWithArray = generalJSTypes.flatMap((type) => [\n  type,\n  `Array<${type}>`,\n  `${type}[]`,\n]);\n\nexport const VERBS_WITH_BODY = [\n  Verbs.POST,\n  Verbs.PUT,\n  Verbs.PATCH,\n  Verbs.DELETE,\n  Verbs.QUERY,\n];\n\n/**\n * Matches a `${thing}` tag in template-literal source.\n *\n * @deprecated Unsound on generated routes: it cannot tell an interpolation\n * from escaped static text, so it rewrites the `\\${x}` produced for a spec\n * path like `/foo${x}` and stops at the first `}` inside an expression.\n * Use {@link parseTemplateLiteral} / {@link mapTemplateExpressions} instead\n * (#3703). Kept for backwards compatibility with custom client builders.\n */\nexport const TEMPLATE_TAG_REGEX = /\\${(.+?)}/g;\n","import {\n  isBooleanJsonSchema,\n  isDereferenced,\n} from '@scalar/openapi-types/helpers';\n\nimport type {\n  OpenApiNonBooleanSchemaObject,\n  OpenApiSchemaObject,\n} from '../types';\n\n/**\n * True for an inline value, including JSON Schema booleans (`true` / `false`).\n *\n * `isDereferenced` is false for booleans because they are not objects, so\n * `!isDereferenced(true)` looks like a `$ref`. A boolean schema is inline:\n * `true` admits every instance and `false` admits none.\n */\nexport function isInlineSchema<T>(\n  value: T,\n): value is [Exclude<T, { $ref: string }>] extends [never]\n  ? T & { $ref?: undefined }\n  : Exclude<T, { $ref: string }> {\n  return isBooleanJsonSchema(value) || isDereferenced(value);\n}\n\n/**\n * JSON Schema boolean schemas as objects: `true` ≡ `{}`, `false` ≡ `{ not: {} }`.\n */\nexport function toObjectSchema(\n  schema: OpenApiSchemaObject,\n): OpenApiNonBooleanSchemaObject {\n  if (!isBooleanJsonSchema(schema)) {\n    return schema;\n  }\n  return schema ? {} : { not: {} };\n}\n","import path from 'node:path';\n\nimport {\n  isBooleanJsonSchema,\n  isMultiTypeSchema,\n  isNullSchema,\n  isStringSchema,\n  isUntypedSchema,\n} from '@scalar/openapi-types/helpers';\n\nimport {\n  type ClientMockBuilder,\n  type GlobalMockOptions,\n  type MswMockOptions,\n  type OpenApiSchemaObject,\n  OutputMockType,\n  SchemaType,\n  Verbs,\n} from '../types';\nimport { isInlineSchema } from './object-schema';\n\n/**\n * Represents an OpenAPI 3.1 schema object that contains a `$dynamicRef`\n * keyword, used for recursive or polymorphic schema references.\n *\n * @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.4\n */\nexport interface OpenApiDynamicReferenceObject {\n  $dynamicRef: string;\n  [key: string]: unknown;\n}\n\n/**\n * Discriminator helper for {@link OpenApiDynamicReferenceObject}.\n *\n * Returns `true` when `obj` has a `$dynamicRef` string property,\n * indicating it is an OpenAPI 3.1 dynamic reference rather than a\n * static `$ref`.\n *\n * @param obj - Value to test.\n *\n * @see https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.4\n */\nexport function isDynamicReference(\n  obj: object,\n): obj is OpenApiDynamicReferenceObject {\n  return (\n    !isNullish(obj) &&\n    Object.hasOwn(obj, '$dynamicRef') &&\n    typeof (obj as Record<string, unknown>).$dynamicRef === 'string'\n  );\n}\n\n/**\n * Returns `true` when `pathValue` has no file extension and is treated as a\n * directory path.\n *\n * @param pathValue - Path string to inspect.\n */\nexport function isDirectory(pathValue: string) {\n  return !path.extname(pathValue);\n}\n\n/**\n * Type guard for plain objects created with `{}` or `new Object()`.\n *\n * Excludes `null`, arrays, dates, and other non-plain object values.\n *\n * @param x - Value to test.\n */\nexport function isObject(x: unknown): x is Record<string, unknown> {\n  return Object.prototype.toString.call(x) === '[object Object]';\n}\n\n/**\n * Type guard for ES module namespace objects.\n *\n * @param x - Value to test.\n */\nexport function isModule(x: unknown): x is Record<string, unknown> {\n  return Object.prototype.toString.call(x) === '[object Module]';\n}\n\n/**\n * Type guard for integer numbers and numeric strings.\n *\n * Accepts finite integers (`42`) and strings that match `/^-?\\d+$/`\n * (`\"-1\"`, `\"0\"`). Rejects floats, empty strings, and non-numeric values.\n *\n * @param x - Value to test.\n */\nexport function isNumeric(x: unknown): x is number {\n  if (typeof x === 'number') return Number.isInteger(x);\n  return isString(x) && /^-?\\d+$/.test(x);\n}\n\n/**\n * Type guard for an inline OpenAPI {@link OpenApiSchemaObject}.\n *\n * Returns `true` when `x` looks like a schema definition: it has a known\n * `type`, composition keywords (`allOf`, `anyOf`, `oneOf`), or `properties`.\n * Does not match reference objects (`$ref`). {@link isInlineSchema} is true\n * for inline schemas, including JSON Schema booleans, and false for references.\n *\n * @param x - Value to test.\n */\nexport function isSchema(x: unknown): x is OpenApiSchemaObject {\n  if (!isObject(x)) {\n    return false;\n  }\n\n  if (isString(x.type) && Object.values(SchemaType).includes(x.type)) {\n    return true;\n  }\n\n  const combine = x.allOf ?? x.anyOf ?? x.oneOf;\n  if (Array.isArray(combine)) {\n    return true;\n  }\n\n  if (isObject(x.properties)) {\n    return true;\n  }\n\n  return false;\n}\n\n/**\n * Whether a schema is dispatched as a string by {@link getScalar}.\n *\n * True for a bare `type: 'string'` and for the OAS 3.1 nullable union\n * `['string', 'null']`, which is what `resolveSpec` produces from a 3.0\n * `{ type: 'string', nullable: true }`. A union that also admits some other\n * type is not string-like: `getScalar` renders it as a union rather than\n * through `case 'string'`, so the string-only treatments (file parts, binary\n * coercion) must not claim it.\n *\n * @param schema - Schema to test.\n */\nexport function isStringLikeSchema(schema: OpenApiSchemaObject): boolean {\n  if (isStringSchema(schema)) {\n    return true;\n  }\n\n  return (\n    isMultiTypeSchema(schema) &&\n    schema.type.includes('string') &&\n    schema.type.every((member) => member === 'string' || member === 'null')\n  );\n}\n\n/**\n * Whether a schema accepts `null`.\n *\n * Nullability can sit on the schema itself (`type: 'null'` or\n * `type: ['string', 'null']`), on a `null` member of\n * an `enum`, or in a separate `{ type: 'null' }` branch of a `oneOf`/`anyOf`,\n * which is the spelling pydantic and other 3.1 generators emit for an optional\n * field.\n *\n * References are not resolved here, so a `$ref` branch never counts as\n * nullable on its own.\n *\n * @param schema - Schema to test.\n */\nexport function isSchemaNullable(schema: OpenApiSchemaObject): boolean {\n  // `true` admits every instance, including null. `false` admits none.\n  if (isBooleanJsonSchema(schema)) {\n    return schema;\n  }\n\n  if (isNullSchema(schema)) {\n    return true;\n  }\n\n  if (isMultiTypeSchema(schema) && schema.type.includes('null')) {\n    return true;\n  }\n\n  // With no `type` at all, a `null` member of the `enum` is the whole constraint\n  // on nullability — and the only spelling available for that case\n  // (`{ enum: ['foo', null] }`). The member itself is never emitted into the\n  // generated const; it only contributes the ` | null`.\n  //\n  // A sibling `type` settles the question on its own, so this deliberately does\n  // not look at the enum when one is present. `type` and `enum` are independent\n  // assertions combined with AND: a `type` that admits null has already\n  // returned above, and one that does not makes the enum's `null` unreachable,\n  // so honoring it would emit a `| null` the schema rejects.\n  if (\n    isUntypedSchema(schema) &&\n    Array.isArray(schema.enum) &&\n    schema.enum.includes(null) &&\n    !someAllOfBranchRejectsNull(schema.allOf)\n  ) {\n    return true;\n  }\n\n  const variants = [\n    ...(Array.isArray(schema.oneOf) ? schema.oneOf : []),\n    ...(Array.isArray(schema.anyOf) ? schema.anyOf : []),\n  ] as unknown[];\n\n  return variants.some((variant) => {\n    if (!isObject(variant) || !isInlineSchema(variant)) {\n      return false;\n    }\n\n    return isSchemaNullable(variant as OpenApiSchemaObject);\n  });\n}\n\n/**\n * Whether the schema's `enum` admits only `null` — the OAS 3.0 spelling of a\n * null branch (`anyOf: [{ $ref }, { enum: [null] }]`), whatever its `type`.\n */\nexport function isNullOnlyEnum(schema: unknown): boolean {\n  if (!isObject(schema)) return false;\n  const schemaEnum = schema.enum;\n  return (\n    Array.isArray(schemaEnum) &&\n    schemaEnum.length > 0 &&\n    schemaEnum.every((member) => member === null)\n  );\n}\n\n/**\n * Whether any member of an `allOf` rules `null` out.\n *\n * `allOf` is an intersection, so one branch refusing null is enough to make an\n * enclosing enum's `null` member unreachable:\n * `{ enum: ['a', null], allOf: [{ type: 'string' }] }` admits only `'a'`.\n *\n * Only a branch that *definitely* rejects null counts. A branch constraining\n * nothing permits it, and a `$ref` is not resolved here, so neither is read as\n * rejecting — erring toward a `| null` that was not strictly needed rather than\n * dropping one the API can really return.\n *\n * @param allOf - Value of the enclosing schema's `allOf`, if it has one.\n */\nfunction someAllOfBranchRejectsNull(allOf: unknown): boolean {\n  if (!Array.isArray(allOf)) {\n    return false;\n  }\n\n  return allOf.some((branch) => {\n    if (!isObject(branch) || !isInlineSchema(branch)) {\n      return false;\n    }\n\n    const { type, enum: members } = branch as Exclude<\n      OpenApiSchemaObject,\n      boolean\n    >;\n\n    if (type !== undefined) {\n      const admitsNull = Array.isArray(type)\n        ? type.includes('null')\n        : type === 'null';\n      if (!admitsNull) {\n        return true;\n      }\n    }\n\n    return Array.isArray(members) && !members.includes(null);\n  });\n}\n\n/**\n * Type guard for HTTP methods defined in {@link Verbs}.\n *\n * @param verb - Method name to test (for example, `\"get\"`, `\"post\"`).\n */\nexport function isVerb(verb: string): verb is Verbs {\n  return Object.values(Verbs).includes(verb as Verbs);\n}\n\n/**\n * Returns `true` when `str` is a valid absolute URL with an `http:` or\n * `https:` protocol.\n *\n * Empty or whitespace-only strings are rejected.\n *\n * @param str - URL string to validate.\n */\nexport function isUrl(str: string) {\n  if (!str.trim()) return false;\n\n  try {\n    const url = new URL(str);\n    return ['http:', 'https:'].includes(url.protocol);\n  } catch {\n    return false;\n  }\n}\n\n/**\n * Type guard for the MSW mock generator. Use to narrow a\n * `GlobalMockOptions | ClientMockBuilder` value to `MswMockOptions`.\n *\n * @param mock - Mock configuration or builder to test.\n */\nexport function isMswMock(\n  mock: GlobalMockOptions | ClientMockBuilder,\n): mock is MswMockOptions {\n  return !isFunction(mock) && mock.type === OutputMockType.MSW;\n}\n\nexport function isString(x: unknown): x is string {\n  return typeof x === 'string';\n}\n\n/** A number other than `NaN`. */\nexport function isNumber(x: unknown): x is number {\n  return typeof x === 'number' && !Number.isNaN(x);\n}\n\nexport function isBoolean(x: unknown): x is boolean {\n  return typeof x === 'boolean';\n}\n\ntype AnyFunction = (...args: never) => unknown;\n\n/**\n * Narrows `x` to the function members of its own type (all of it when nothing\n * more precise is known), the way remeda's guard did.\n */\nexport function isFunction<T>(\n  x: T | AnyFunction,\n): x is 0 extends 1 & T\n  ? AnyFunction\n  : Extract<T, AnyFunction> extends never\n    ? AnyFunction\n    : Extract<T, AnyFunction> {\n  return typeof x === 'function';\n}\n\nexport function isNullish(x: unknown): x is null | undefined {\n  return x === null || x === undefined;\n}\n\n/**\n * Asserts that a spec-supplied numeric constraint really is a finite number.\n *\n * Constraints (`minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`,\n * `multipleOf`, `minLength`/`maxLength`, `minItems`/`maxItems`) are emitted\n * into generated source as bare, unquoted expressions — `.min(${min})`,\n * `S.minItems(${min})`, `faker.number.int({min: ${min}})`. There is no\n * surrounding quote, so no escaping can make an arbitrary value safe there.\n *\n * OpenAPI 3.1 documents pass validation with these fields set to arbitrary\n * strings, so the value has to be checked here rather than trusted.\n *\n * @param value Constraint value taken from the document\n * @param label Field name, used in the error message\n * @throws If `value` is not a finite number\n */\nexport function assertSafeNumericConstraint(\n  value: unknown,\n  label: string,\n): number {\n  if (!isNumber(value) || !Number.isFinite(value)) {\n    throw new Error(\n      `orval: refusing to generate code for an OpenAPI document whose \"${label}\" constraint is not a finite number (got ${String(value)}). This value would otherwise be emitted verbatim into generated source.`,\n    );\n  }\n\n  return value;\n}\n\n/**\n * {@link assertSafeNumericConstraint} for an optional constraint.\n *\n * Passes `undefined` straight through so callers keep \"absent\" distinct from\n * \"present but not a number\", which must still be rejected.\n *\n * @param value Constraint value taken from the document, possibly absent\n * @param label Field name, used in the error message\n */\nexport function safeNumericConstraint(\n  value: unknown,\n  label: string,\n): number | undefined {\n  return value === undefined\n    ? undefined\n    : assertSafeNumericConstraint(value, label);\n}\n","import { isFunction } from './assertion';\n\nexport async function asyncReduce<IterationItem, AccValue>(\n  array: IterationItem[],\n  reducer: (\n    accumulate: AccValue,\n    current: IterationItem,\n  ) => AccValue | Promise<AccValue>,\n  initValue: AccValue,\n): Promise<AccValue> {\n  const shouldClone =\n    initValue === null ||\n    (initValue === Object(initValue) && !isFunction(initValue));\n  let accumulate: AccValue = shouldClone\n    ? (Object.create(initValue as unknown as object) as AccValue)\n    : initValue;\n\n  for (const item of array) {\n    accumulate = await reducer(accumulate, item);\n  }\n\n  return accumulate;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { escapePath, glob } from 'tinyglobby';\n\nimport { isDirectory } from './assertion';\n\n/**\n * Removes the last extension from a path. A dot in a directory name stays,\n * which is why `\\` counts as a separator too: without it, `.\\v1.0\\pets` would\n * lose everything after the version dot.\n */\nexport function pathWithoutExtension(filePath: string) {\n  return filePath.replace(/\\.[^\\\\/.]+$/, '');\n}\n\n/**\n * Removes a configured file extension, which may have several parts. Stripping\n * only the last segment would leave `pets.generated.ts` as `pets.generated`,\n * and re-adding the extension then gives `pets.generated.generated`. Falls\n * back to the last segment for a path that does not carry the full extension.\n */\nexport function stripFileExtension(\n  filePath: string,\n  fileExtension: string,\n): string {\n  return filePath.endsWith(fileExtension)\n    ? filePath.slice(0, -fileExtension.length)\n    : pathWithoutExtension(filePath);\n}\n\n/**\n * Escapes glob metacharacters (`*?()[]{}!`, a leading `!`, and a literal\n * backslash) in a path segment so it can be embedded in a glob pattern and\n * only ever match itself. Re-exported from `tinyglobby`, the glob engine\n * {@link removeFilesAndEmptyFolders} runs on, so callers that build patterns\n * around a user-configured directory name (which may contain those\n * characters) stay in step with whatever engine is in use.\n */\nexport { escapePath };\n\nexport function getFileInfo(\n  target = '',\n  {\n    backupFilename = 'filename',\n    extension = '.ts',\n  }: { backupFilename?: string; extension?: string } = {},\n) {\n  const isDir = isDirectory(target);\n  const filePath = isDir\n    ? path.join(target, backupFilename + extension)\n    : target;\n  const dir = path.dirname(filePath);\n  const filename = path.basename(\n    filePath,\n    extension.startsWith('.') ? extension : `.${extension}`,\n  );\n\n  return {\n    path: filePath,\n    pathWithoutExtension: pathWithoutExtension(filePath),\n    extension,\n    isDirectory: isDir,\n    dirname: dir,\n    filename,\n  };\n}\n\nexport async function removeFilesAndEmptyFolders(\n  patterns: string[],\n  dir: string,\n  /**\n   * Set `followSymbolicLinks` to `false` in a directory that Orval shares with\n   * the user. A symlinked subdirectory would otherwise let the glob reach\n   * files outside `dir` and delete them.\n   */\n  { followSymbolicLinks = true }: { followSymbolicLinks?: boolean } = {},\n) {\n  const files = await glob(patterns, {\n    cwd: dir,\n    absolute: true,\n    followSymbolicLinks,\n  });\n\n  // Remove files\n  await Promise.all(files.map((file) => fs.promises.unlink(file)));\n\n  // Find and remove empty directories\n  const directories = await glob(['**/*'], {\n    cwd: dir,\n    absolute: true,\n    onlyDirectories: true,\n    followSymbolicLinks,\n  });\n\n  // Sort directories by depth (deepest first) to ensure we can remove nested empty folders\n  const sortedDirectories = directories.toSorted((a, b) => {\n    const depthA = a.split('/').length;\n    const depthB = b.split('/').length;\n    return depthB - depthA;\n  });\n\n  // Remove empty directories\n  for (const directory of sortedDirectories) {\n    try {\n      const contents = await fs.promises.readdir(directory);\n      if (contents.length === 0) {\n        await fs.promises.rmdir(directory);\n      }\n    } catch {\n      // Directory might have been removed already or doesn't exist\n      // Continue with next directory\n    }\n  }\n}\n","export function getExtension(path: string) {\n  return path.toLowerCase().includes('.yaml') ||\n    path.toLowerCase().includes('.yml')\n    ? 'yaml'\n    : 'json';\n}\n","import basepath from 'node:path';\n\nimport { getExtension } from './extension';\n\nexport function isAbsolute(value: string): boolean {\n  return basepath.isAbsolute(value);\n}\n\nexport function resolve(...args: string[]): string {\n  return toUnix(basepath.resolve(...args));\n}\n\nexport function toUnix(value: string): string {\n  value = value.replaceAll('\\\\', '/');\n  value = value.replaceAll(/(?<!^)\\/+/g, '/'); // deduplicate except leading for UNC paths\n  return value;\n}\n\nexport function join(...args: string[]): string {\n  return toUnix(basepath.join(...args.map((a) => toUnix(a))));\n}\n\n/**\n * Behaves exactly like `path.relative(from, to)`, but keeps the first meaningful \"./\"\n */\nexport function relativeSafe(from: string, to: string) {\n  const normalizedRelativePath = toUnix(\n    basepath.relative(toUnix(from), toUnix(to)),\n  );\n  const relativePath = normalizeSafe(`.${separator}${normalizedRelativePath}`);\n  return relativePath;\n}\n\nexport function getSchemaFileName(path: string) {\n  // Take the file name first. Stripping the extension from the whole path\n  // removes the first occurrence, which may sit in a directory name, and the\n  // slice offset was computed on the original path, so the two disagreed.\n  const fileName = path.slice(path.lastIndexOf('/') + 1);\n  const extension = `.${getExtension(fileName)}`;\n\n  return fileName.endsWith(extension)\n    ? fileName.slice(0, -extension.length)\n    : fileName;\n}\n\nexport const separator = '/';\n\nexport function normalizeSafe(value: string) {\n  let result;\n  value = toUnix(value);\n  result = toUnix(basepath.normalize(value));\n  if (\n    value.startsWith('./') &&\n    !result.startsWith('./') &&\n    !result.startsWith('..')\n  ) {\n    result = './' + result;\n  } else if (value.startsWith('//') && !result.startsWith('//')) {\n    result = value.startsWith('//./') ? '//.' + result : '/' + result;\n  }\n  return result;\n}\n\nexport function joinSafe(...values: string[]) {\n  let result = toUnix(basepath.join(...values.map((v) => toUnix(v))));\n\n  if (values.length > 0) {\n    const firstValue = toUnix(values[0]);\n    if (\n      firstValue.startsWith('./') &&\n      !result.startsWith('./') &&\n      !result.startsWith('..')\n    ) {\n      result = './' + result;\n    } else if (firstValue.startsWith('//') && !result.startsWith('//')) {\n      result = firstValue.startsWith('//./') ? '//.' + result : '/' + result;\n    }\n  }\n  return result;\n}\n\n/**\n * Given two absolute file paths, generates a valid ESM relative import path\n * from the 'importer' file to the 'exporter' file.\n *\n * @example\n * ```ts\n * getRelativeImportPath('/path/to/importer.ts', '/path/to/exporter.ts')\n * // => './exporter'\n * getRelativeImportPath('/path/to/importer.ts', '/path/to/sub/exporter.ts')\n * // => './sub/exporter'\n * getRelativeImportPath('/path/to/importer.ts', '/path/sibling/exporter.ts')\n * // => '../sibling/exporter'\n * ```\n *\n * This function handles path normalization, cross-platform separators, and\n * ensures the path is a valid ESM relative specifier (e.g., starts with './').\n *\n * @param importerFilePath - The absolute path of the file that will contain the import statement.\n * @param exporterFilePath - The absolute path of the file being imported.\n * @param [includeFileExtension=false] - Whether the import path should include the file extension, defaults to false.\n * @returns The relative import path string.\n */\nexport function getRelativeImportPath(\n  importerFilePath: string,\n  exporterFilePath: string,\n  includeFileExtension = false,\n): string {\n  if (!basepath.isAbsolute(importerFilePath))\n    throw new Error(\n      `'importerFilePath' is not an absolute path. \"${importerFilePath}\"`,\n    );\n  if (!basepath.isAbsolute(exporterFilePath))\n    throw new Error(\n      `'exporterFilePath' is not an absolute path. \"${exporterFilePath}\"`,\n    );\n\n  // Get the directory of the importer file.\n  const importerDir = basepath.dirname(importerFilePath);\n\n  // Calculate the relative path from the importer's directory to the exporter file.\n  const relativePath = basepath.relative(importerDir, exporterFilePath);\n\n  // Convert to posix path\n  let posixPath = basepath.posix.join(...relativePath.split(basepath.sep));\n\n  // Ensure the path starts with './' for same-directory imports.\n  // A relative specifier must start with './' or '../'.\n  if (!posixPath.startsWith('./') && !posixPath.startsWith('../')) {\n    posixPath = `./${posixPath}`;\n  }\n\n  if (!includeFileExtension) {\n    const ext = basepath.extname(posixPath);\n    if (ext && posixPath.endsWith(ext)) {\n      posixPath = posixPath.slice(0, -ext.length);\n    }\n  }\n\n  return posixPath;\n}\n","import type { SharedExports } from '../types';\nimport { stripFileExtension } from './file';\nimport * as upath from './path';\n\nexport interface BarrelReExportFile {\n  /** Path of the emitted file. */\n  path: string;\n  /** Declared by generators whose files repeat shared boilerplate. */\n  sharedExports?: SharedExports;\n}\n\nexport interface BarrelReExportOptions {\n  /** Directory that holds the barrel. Files outside it are ignored. */\n  dirname: string;\n  /** Extension of the emitted files, for example `.ts` or `.generated.ts`. */\n  extension: string;\n  /** Extension to write in the module specifier. Usually empty. */\n  importExtension: string;\n}\n\n/** How one file re-exports a shared name. */\ntype ExportKind = 'type' | 'value';\n\n/** `mixed` when files disagree, which leaves the name with no owner. */\ntype Kind = ExportKind | 'mixed';\n\n/**\n * Barrel lines that re-export a set of sibling files.\n *\n * @remarks\n * Wildcard-exporting two files that declare the same name makes it ambiguous\n * (TS2308). An explicit re-export shadows `export *`, so one file is picked to\n * own each repeated name.\n *\n * A name gets exactly one line. `export type { X } from './a'` beside\n * `export { X } from './b'` is TS2300, not a fix, because the `type` modifier\n * does not open a second slot — it only says how the owning file declares X.\n * `export { X }` carries the type meaning too, so a file declaring a name in\n * both categories owns it as a value.\n *\n * That leaves one case unowned: a name that is a type in one file and a value\n * in another, where either line would drop the other meaning. It stays\n * ambiguous, since a generator declaring one name as two things is a defect\n * worth failing on. So is a collision between two tags, which is why only\n * names a generator {@link SharedExports | declares} are considered.\n *\n * @param files - Sibling files, in barrel order.\n * @param alreadyExported - Names the barrel already has a line for, split by\n * category. Listed in either one, the name is taken.\n * @returns Barrel lines, named re-exports first. No trailing newlines.\n */\nexport function buildBarrelReExports(\n  files: readonly BarrelReExportFile[],\n  { dirname, extension, importExtension }: BarrelReExportOptions,\n  alreadyExported: {\n    readonly types?: readonly string[];\n    readonly values?: readonly string[];\n  } = {},\n): string[] {\n  const entries = files\n    .map((file) => ({\n      sharedExports: file.sharedExports,\n      relativePath: upath.relativeSafe(dirname, file.path),\n    }))\n    .filter(({ relativePath }) => !relativePath.startsWith('..'))\n    .toSorted((a, b) => a.relativePath.localeCompare(b.relativePath))\n    .map(({ sharedExports, relativePath }) => ({\n      sharedExports,\n      specifier: stripFileExtension(relativePath, extension) + importExtension,\n    }));\n\n  // `export { X }` re-exports the type meaning too, so a file that declares a\n  // name in both categories counts as declaring a value.\n  const declaredNames = ({ types, values }: SharedExports) =>\n    new Set([...types, ...values]);\n  const declarationKind = (\n    { values }: SharedExports,\n    name: string,\n  ): ExportKind => (values.includes(name) ? 'value' : 'type');\n\n  const declarations = new Map<string, { count: number; kind: Kind }>();\n  for (const { sharedExports } of entries) {\n    if (!sharedExports) continue;\n    for (const name of declaredNames(sharedExports)) {\n      const kind = declarationKind(sharedExports, name);\n      const seen = declarations.get(name);\n      declarations.set(name, {\n        count: (seen?.count ?? 0) + 1,\n        kind: !seen || seen.kind === kind ? kind : 'mixed',\n      });\n    }\n  }\n\n  // One slot per name, so one `claimed` set across both categories. A name\n  // preclaimed by the caller in either category is already on a line.\n  const claimed = new Set([\n    ...(alreadyExported.types ?? []),\n    ...(alreadyExported.values ?? []),\n  ]);\n\n  const lines: string[] = [];\n  for (const { specifier, sharedExports } of entries) {\n    if (!sharedExports) continue;\n\n    const owned: Record<ExportKind, string[]> = { type: [], value: [] };\n    for (const name of declaredNames(sharedExports)) {\n      const declaration = declarations.get(name);\n      if (!declaration || claimed.has(name)) continue;\n      // Declared once: the wildcard is unambiguous. Declared as two different\n      // things: no single line can own it.\n      if (declaration.count < 2 || declaration.kind === 'mixed') continue;\n      claimed.add(name);\n      owned[declaration.kind].push(name);\n    }\n\n    if (owned.type.length > 0) {\n      lines.push(\n        `export type { ${owned.type.toSorted().join(', ')} } from '${specifier}';`,\n      );\n    }\n    if (owned.value.length > 0) {\n      lines.push(\n        `export { ${owned.value.toSorted().join(', ')} } from '${specifier}';`,\n      );\n    }\n  }\n  lines.push(\n    ...entries.map(({ specifier }) => `export * from '${specifier}';`),\n  );\n\n  return lines;\n}\n","import { NamingConvention } from '../types';\n\nconst SYMBOLS = String.raw`\\u0020-\\u0026\\u0028-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E\\u00A0-\\u00BF\\u00D7\\u00F7`;\nconst LOWERS = String.raw`a-z\\u00DF-\\u00F6\\u00F8-\\u00FF`;\nconst UPPERS = String.raw`A-Z\\u00C0-\\u00D6\\u00D8-\\u00DE`;\n\nconst allUpperRe = new RegExp(`^[^${LOWERS}]+$`);\nconst hasSymbolRe = new RegExp(`[${SYMBOLS}]`);\nconst fillRe = new RegExp(`[${SYMBOLS}]+(.|$)`, 'g');\n// \"getHTTPResponse\" -> \"get HTTP Response\"; only applied when the input has\n// no separator characters at all.\nconst acronymRe = new RegExp(\n  `([^${UPPERS}])([${UPPERS}]*)([${UPPERS}])(?=[^${UPPERS}]|$)`,\n  'g',\n);\n\nconst lower = (s: string, fillWith: string) => {\n  if (allUpperRe.test(s)) s = s.toLowerCase();\n  if (!hasSymbolRe.test(s)) {\n    s = s.replace(\n      acronymRe,\n      (_, before: string, acronym: string, caps: string) =>\n        `${before} ${acronym ? `${acronym} ` : ''}${caps}`,\n    );\n  }\n  return s\n    .toLowerCase()\n    .replace(fillRe, (_, next: string) => (next ? fillWith + next : ''))\n    .replaceAll(\"'\", '');\n};\n\n// Caches the previously converted strings to improve performance.\n// A Map, not an object literal: the keys are names taken from the OpenAPI\n// document, and a schema is free to call a property `toString` or\n// `constructor`. On an object those read back off `Object.prototype`, so the\n// lookup would return a function instead of a string.\nconst pascalMemory = new Map<string, string>();\n\nexport function pascal(s = '') {\n  const cached = pascalMemory.get(s);\n  if (cached !== undefined) {\n    return cached;\n  }\n\n  const isStartWithUnderscore = s.startsWith('_');\n  const cacheKey = s;\n\n  if (allUpperRe.test(s)) {\n    s = s.toLowerCase();\n  }\n\n  const pascalString = (s.match(/[a-zA-Z0-9\\u00C0-\\u017F]+/g) ?? [])\n    .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n    .join('');\n\n  const pascalWithUnderscore = isStartWithUnderscore\n    ? `_${pascalString}`\n    : pascalString;\n\n  pascalMemory.set(cacheKey, pascalWithUnderscore);\n\n  return pascalWithUnderscore;\n}\n\nexport function camel(s = '') {\n  const isStartWithUnderscore = s.startsWith('_');\n  const at = isStartWithUnderscore ? 1 : 0;\n  const p = pascal(s);\n  const camelString = p.charAt(at).toLowerCase() + p.slice(at + 1);\n  return isStartWithUnderscore ? `_${camelString}` : camelString;\n}\n\nexport function snake(s = '') {\n  return lower(s, '_');\n}\n\nexport function kebab(s = '') {\n  return lower(s, '-');\n}\n\nexport function conventionName(name: string, convention: NamingConvention) {\n  let nameConventionTransform = camel;\n  switch (convention) {\n    case NamingConvention.PASCAL_CASE: {\n      nameConventionTransform = pascal;\n\n      break;\n    }\n    case NamingConvention.SNAKE_CASE: {\n      nameConventionTransform = snake;\n\n      break;\n    }\n    case NamingConvention.KEBAB_CASE: {\n      nameConventionTransform = kebab;\n\n      break;\n    }\n    // No default\n  }\n\n  return nameConventionTransform(name);\n}\n","/** Keeps the first occurrence of every value. */\nexport const unique = <T>(values: readonly T[]): T[] => [...new Set(values)];\n\n/** Keeps the first item for every distinct `key(item)`. */\nexport function uniqueBy<T>(\n  items: T[],\n  key: (item: T, index: number, items: T[]) => unknown,\n): T[] {\n  const seen = new Set<unknown>();\n  return items.filter((item, index, all) => {\n    const k = key(item, index, all);\n    if (seen.has(k)) return false;\n    seen.add(k);\n    return true;\n  });\n}\n\n/** Keeps the first of every run of items that `isEqual` treats as the same. */\nexport const uniqueWith = <T>(\n  items: readonly T[],\n  isEqual: (a: T, b: T) => boolean,\n): T[] =>\n  items.filter(\n    (item, index) =>\n      items.findIndex((other, j) => j === index || isEqual(item, other)) ===\n      index,\n  );\n\n/**\n * Buckets `items` by `key(item)` in first-seen order. Only keys that occur get\n * a bucket, so `get` on any other key is `undefined`.\n */\nexport const groupBy = <T>(\n  items: readonly T[],\n  key: (item: T) => string,\n): Map<string, T[]> => Map.groupBy(items, key);\n\n/** The subset of `obj` at `keys`; keys absent from `obj` are left out. */\nexport const pick = <T extends object, K extends keyof T>(\n  obj: T,\n  keys: Iterable<K>,\n): Pick<T, K> =>\n  Object.fromEntries(\n    [...keys]\n      .filter((key) => Object.hasOwn(obj, key))\n      .map((key) => [key, obj[key]]),\n  ) as Pick<T, K>;\n\n/** `obj` without the entries `drop` returns true for. */\nexport const omitBy = <T extends object>(\n  obj: T,\n  drop: (value: T[keyof T], key: string) => boolean,\n): Partial<T> =>\n  Object.fromEntries(\n    Object.entries(obj).filter(\n      ([key, value]) => !drop(value as T[keyof T], key),\n    ),\n  ) as Partial<T>;\n\n/** Walks `path` into `value`; `undefined` as soon as a step is missing. */\nexport const getAtPath = (\n  value: unknown,\n  path: readonly PropertyKey[],\n): unknown =>\n  // oxlint-disable-next-line unicorn/no-array-reduce\n  path.reduce<unknown>(\n    (current, key) =>\n      current === null || current === undefined\n        ? undefined\n        : (current as Record<PropertyKey, unknown>)[key],\n    value,\n  );\n","import { compare, type CompareOperator } from 'compare-versions';\n\nconst getComparableVersion = (version: string) => {\n  const npmAliasVersion = version.match(/^npm:(?:@[^/]+\\/)?[^@]+@(.+)$/)?.[1];\n\n  if (npmAliasVersion) {\n    return npmAliasVersion;\n  }\n\n  if (version.startsWith('npm:')) {\n    return 'latest';\n  }\n\n  return version;\n};\n\nexport function compareVersions(\n  firstVersion: string,\n  secondVersions: string,\n  operator: CompareOperator = '>=',\n) {\n  const comparableVersion = getComparableVersion(firstVersion);\n\n  if (comparableVersion === 'latest' || comparableVersion === '*') {\n    return true;\n  }\n\n  // Handle workspace catalog references (pnpm/bun)\n  // catalog: or catalog:name format - assume latest version\n  if (comparableVersion.startsWith('catalog:')) {\n    return true;\n  }\n\n  return compare(\n    comparableVersion.replace(/(\\s(.*))/, ''),\n    secondVersions,\n    operator,\n  );\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport type { OpenApiSchemaObject } from '../types';\nimport { isStringLikeSchema } from './assertion';\n\n// Known binary application/* types — add new entries here as needed\nconst binaryApplicationTypes = new Set([\n  'application/octet-stream',\n  'application/pdf',\n  'application/zip',\n]);\n\n/**\n * Determine if a content type is binary.\n * Only known binary types return true. Unknown types default to false (non-binary)\n * so that schema type information is preserved rather than being overridden with Blob.\n */\nexport function isBinaryContentType(contentType: string): boolean {\n  // Strip parameters (e.g., \"; charset=utf-8\") to get the base MIME type\n  const baseType = contentType.split(';')[0].trim();\n\n  if (baseType.startsWith('image/')) return true;\n  if (baseType.startsWith('audio/')) return true;\n  if (baseType.startsWith('video/')) return true;\n  if (baseType.startsWith('font/')) return true;\n\n  return binaryApplicationTypes.has(baseType);\n}\n\n/**\n * Determine if a form-data field should be treated as a file (binary or text).\n *\n * Precedence (per OAS 3.1): encoding.contentType > schema.contentMediaType\n *\n * Returns:\n * - 'binary': binary file (Blob)\n * - 'text': text file (Blob | string)\n * - undefined: not a file, use standard string resolution\n */\nexport function getFormDataFieldFileType(\n  resolvedSchema: OpenApiSchemaObject,\n  partContentType: string | undefined,\n): 'binary' | 'text' | undefined {\n  // Only override string fields - objects/arrays with encoding are just\n  // serialized. The OAS 3.1 nullable union ['string', 'null'] counts: that is\n  // what `resolveSpec` makes of a 3.0 `{ type: 'string', nullable: true }`\n  // part, and rejecting it left nullable file fields typed `string | null`\n  // while the zod/effect validators still emitted `instanceof Blob` (#4141).\n  if (\n    isBooleanJsonSchema(resolvedSchema) ||\n    !isStringLikeSchema(resolvedSchema)\n  ) {\n    return undefined;\n  }\n\n  // contentEncoding (e.g., base64) means the value is an encoded string, not a file\n  if (resolvedSchema.contentEncoding) {\n    return undefined;\n  }\n\n  const contentMediaType = resolvedSchema.contentMediaType;\n  const effectiveContentType = partContentType ?? contentMediaType;\n\n  if (effectiveContentType) {\n    return isBinaryContentType(effectiveContentType) ? 'binary' : 'text';\n  }\n\n  return undefined;\n}\n\n/**\n * Filter configuration for content types\n */\nexport interface ContentTypeFilter {\n  include?: string[];\n  exclude?: string[];\n}\n\n/**\n * Filters items by content type based on include/exclude rules\n *\n * @param items - Array of items with contentType property\n * @param filter - Optional filter configuration\n * @returns Filtered array\n *\n * @example\n * ```ts\n * const types = [\n *   { contentType: 'application/json', value: '...' },\n *   { contentType: 'text/xml', value: '...' }\n * ];\n *\n * // Include only JSON\n * filterByContentType(types, { include: ['application/json'] });\n *\n * // Exclude XML\n * filterByContentType(types, { exclude: ['text/xml'] });\n * ```\n */\nexport function filterByContentType<T extends { contentType: string }>(\n  items: T[],\n  filter?: ContentTypeFilter,\n): T[] {\n  if (!filter) {\n    return items;\n  }\n\n  return items.filter((item) => {\n    const shouldInclude =\n      !filter.include || filter.include.includes(item.contentType);\n\n    const shouldExclude = filter.exclude?.includes(item.contentType) ?? false;\n\n    return shouldInclude && !shouldExclude;\n  });\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport type { ContextSpec } from '../types';\n\nconst search = String.raw`\\*/`; // Find '*/'\nconst replacement = String.raw`*\\/`; // Replace With '*\\/'\n\nconst regex = new RegExp(search, 'g');\n\ninterface JsDocSchema extends Record<string, unknown> {\n  description?: string[] | string;\n  deprecated?: boolean;\n  summary?: string;\n  minLength?: number;\n  maxLength?: number;\n  minimum?: number;\n  maximum?: number;\n  exclusiveMinimum?: number;\n  exclusiveMaximum?: number;\n  minItems?: number;\n  maxItems?: number;\n  type?: string | string[];\n  pattern?: string;\n  items?: JsDocSchema;\n}\n\ninterface JsDocEntry {\n  key: string;\n  value: boolean | number | string;\n}\n\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n  let lastLineIndex = lines.length - 1;\n\n  while (lastLineIndex >= 0 && lines[lastLineIndex]?.trim() === '') {\n    lastLineIndex--;\n  }\n\n  return lines.slice(0, lastLineIndex + 1);\n}\n\nfunction escapeJsDoc(value: string): string {\n  return value.replaceAll(regex, replacement);\n}\n\nfunction getDescriptionLines(description?: string[] | string): string[] {\n  const descriptionBlocks = Array.isArray(description)\n    ? description.filter((line) => !line.includes('eslint-disable'))\n    : [description ?? ''];\n\n  return trimTrailingEmptyLines(\n    descriptionBlocks.flatMap((block) =>\n      block.split(/\\r?\\n/).map((line) => escapeJsDoc(line)),\n    ),\n  );\n}\n\nfunction getEslintDisable(description?: string[] | string): string | undefined {\n  return Array.isArray(description)\n    ? description.find((line) => line.includes('eslint-disable'))\n    : undefined;\n}\n\nconst itemValidationKeys = [\n  'minLength',\n  'maxLength',\n  'minimum',\n  'maximum',\n  'exclusiveMinimum',\n  'exclusiveMaximum',\n  'minItems',\n  'maxItems',\n  'pattern',\n] as const satisfies readonly (keyof JsDocSchema)[];\n\nfunction getItemValidationDocEntries(\n  schema?: JsDocSchema,\n  prefix = 'items',\n  visited = new WeakSet<JsDocSchema>(),\n): JsDocEntry[] {\n  if (!schema) {\n    return [];\n  }\n  if (visited.has(schema)) {\n    return [];\n  }\n  visited.add(schema);\n\n  const entries = itemValidationKeys.flatMap((key) => {\n    const value = schema[key];\n\n    return value === undefined ? [] : [{ key: `${prefix}.${key}`, value }];\n  });\n\n  return [\n    ...entries,\n    ...getItemValidationDocEntries(schema.items, `${prefix}.items`, visited),\n  ];\n}\n\nfunction toJsDocEntry(\n  key: string,\n  value?: boolean | number | string,\n): JsDocEntry[] {\n  if (value === undefined || value === false || value === '') {\n    return [];\n  }\n\n  return [{ key, value }];\n}\n\nfunction getSchemaDocEntries(\n  schema: JsDocSchema,\n  itemValidationDocEntries: JsDocEntry[],\n  isNullable: boolean,\n): JsDocEntry[] {\n  const {\n    deprecated,\n    summary,\n    minLength,\n    maxLength,\n    minimum,\n    maximum,\n    exclusiveMinimum,\n    exclusiveMaximum,\n    minItems,\n    maxItems,\n    pattern,\n  } = schema;\n\n  return [\n    ...toJsDocEntry('deprecated', deprecated),\n    ...toJsDocEntry('summary', summary),\n    ...toJsDocEntry('minLength', minLength),\n    ...toJsDocEntry('maxLength', maxLength),\n    ...toJsDocEntry('minimum', minimum),\n    ...toJsDocEntry('maximum', maximum),\n    ...toJsDocEntry('exclusiveMinimum', exclusiveMinimum),\n    ...toJsDocEntry('exclusiveMaximum', exclusiveMaximum),\n    ...toJsDocEntry('minItems', minItems),\n    ...toJsDocEntry('maxItems', maxItems),\n    ...toJsDocEntry('nullable', isNullable),\n    ...toJsDocEntry('pattern', pattern),\n    ...itemValidationDocEntries.flatMap(({ key, value }) =>\n      toJsDocEntry(key, value),\n    ),\n  ];\n}\n\nfunction formatJsDocEntry({ key, value }: JsDocEntry): string {\n  if (value === true) {\n    return `@${key}`;\n  }\n\n  return `@${key} ${escapeJsDoc(value.toString())}`;\n}\n\nfunction renderJsDocBlock(lines: string[], tryOneLine = false): string {\n  if (lines.length === 0) {\n    return '';\n  }\n\n  if (lines.length === 1 && tryOneLine) {\n    return `/** ${lines[0]} */\\n`;\n  }\n\n  const linePrefix = `${tryOneLine ? '  ' : ''} *`;\n  const closingPrefix = ` ${tryOneLine ? '  ' : ''}`;\n\n  return `/**\\n${lines\n    .map((line) => `${linePrefix}${line ? ` ${line}` : ''}`)\n    .join('\\n')}\\n${closingPrefix}*/\\n`;\n}\n\nexport function jsDoc(\n  schema: object | boolean,\n  tryOneLine = false,\n  context?: ContextSpec,\n): string {\n  if (isBooleanJsonSchema(schema)) {\n    return '';\n  }\n  const jsDocSchema = schema as JsDocSchema;\n\n  if (context?.output.override.jsDoc) {\n    const { filter } = context.output.override.jsDoc;\n    if (filter) {\n      return keyValuePairsToJsDoc(filter(jsDocSchema));\n    }\n  }\n\n  const isNullable =\n    jsDocSchema.type === 'null' ||\n    (Array.isArray(jsDocSchema.type) && jsDocSchema.type.includes('null'));\n  const itemValidationDocEntries = getItemValidationDocEntries(\n    jsDocSchema.items,\n  );\n  const lines = [\n    ...getDescriptionLines(jsDocSchema.description),\n    ...getSchemaDocEntries(\n      jsDocSchema,\n      itemValidationDocEntries,\n      isNullable,\n    ).map((entry) => formatJsDocEntry(entry)),\n  ];\n  const eslintDisable = getEslintDisable(jsDocSchema.description);\n  const doc = renderJsDocBlock(lines, tryOneLine);\n\n  return `${eslintDisable ? `/* ${escapeJsDoc(eslintDisable)} */\\n` : ''}${doc}`;\n}\n\nexport function keyValuePairsToJsDoc(\n  keyValues: {\n    key: string;\n    value: string;\n  }[],\n) {\n  return renderJsDocBlock(\n    keyValues.map(({ key, value }) => `@${key} ${value}`),\n  );\n}\n","import path from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { createJiti } from 'jiti';\n\nimport { isModule, isObject, isString } from './assertion';\n\nconst TS_MODULE_EXTENSIONS = new Set(['.ts', '.mts', '.cts', '.tsx', '.jsx']);\n\nexport async function dynamicImport<T>(\n  toImport: T | string,\n  from = process.cwd(),\n  takeDefault = true,\n): Promise<T> {\n  if (!toImport) {\n    return toImport as T;\n  }\n\n  try {\n    if (isString(toImport)) {\n      const filePath = path.resolve(from, toImport);\n      const extension = path.extname(filePath);\n\n      if (TS_MODULE_EXTENSIONS.has(extension)) {\n        const jiti = createJiti(from, {\n          interopDefault: true,\n        });\n        const data = await jiti.import(filePath);\n\n        if (takeDefault && (isObject(data) || isModule(data)) && data.default) {\n          return data.default as T;\n        }\n\n        return data as T;\n      }\n\n      // use pathToFileURL to solve issue #1332.\n      // https://github.com/nodejs/node/issues/31710\n      const fileUrl = pathToFileURL(filePath);\n      const isJson = extension === '.json';\n      const data = (\n        isJson\n          ? await import(fileUrl.href, { with: { type: 'json' } })\n          : await import(fileUrl.href)\n      ) as Record<string, unknown>;\n      if (takeDefault && (isObject(data) || isModule(data)) && data.default) {\n        return data.default as T;\n      }\n\n      return data as unknown as T;\n    }\n\n    return toImport as T;\n  } catch (error) {\n    throw new Error(\n      `Oups... 🍻. Path: ${String(toImport)} => ${String(error)}`,\n      { cause: error },\n    );\n  }\n}\n","import {\n  type ClientMockBuilder,\n  type GlobalMockOptions,\n  OutputMockType,\n} from '../types';\nimport { isFunction } from './assertion';\n\n/**\n * Returns the filename suffix for a given mock entry's output file. For\n * example a `{ type: OutputMockType.MSW }` entry produces `<file>.msw.ts` and\n * a `{ type: OutputMockType.FAKER }` entry produces `<file>.faker.ts`.\n *\n * Custom `ClientMockBuilder` functions default to the `msw` suffix to preserve\n * the historical behavior.\n */\nexport function getMockFileExtensionByTypeName(\n  mock: GlobalMockOptions | ClientMockBuilder,\n): OutputMockType {\n  if (isFunction(mock)) {\n    return OutputMockType.MSW;\n  }\n  return mock.type;\n}\n","/**\n * Type safe way to get arbitrary property from an object.\n *\n * @param obj - The object from which to retrieve the property.\n * @param propertyName - The name of the property to retrieve.\n * @returns Object with `hasProperty: true` and `value` of the property if it exists; otherwise `hasProperty: false` and undefined.\n *\n * @remarks Until TypeScript adds type-narrowing for Object.hasOwn we have to use this workaround\n */\nexport function getPropertySafe<T extends object, K extends keyof T>(\n  obj: T,\n  propertyName: K | string,\n):\n  | { hasProperty: true; value: T[K] }\n  | { hasProperty: false; value: undefined } {\n  if (Object.hasOwn(obj, propertyName)) {\n    // safe to cast here because of the above check\n    return { hasProperty: true, value: obj[propertyName as K] };\n  }\n\n  return { hasProperty: false, value: undefined };\n}\n","import type { SharedTypeDeclaration } from '../types';\n\nconst WILDCARD_STATUS_CODE_REGEX = /^[1-5]XX$/i;\nconst EXACT_STATUS_CODE_REGEX = /^[1-5]\\d{2}$/;\n\n/**\n * Refuses an OpenAPI response key that is not a status code.\n *\n * A response key reaches generated source in unquoted positions — a TypeScript\n * type (`status: <key>`) in the fetch and axios clients, and a runtime\n * expression (`response.status === <key>`) in the axios empty-response\n * normalization. There is no quote to escape in either, so a key like\n * `2 || <expression>` or `number }; <statement>; type _ = { _z: number` is\n * spliced in as live code rather than data. Parse it, and refuse the document\n * rather than emitting whatever it says.\n *\n * The spec validator rejects such keys, but `input.unsafeDisableValidation`\n * turns it off, so the check has to sit at the emission point to be worth\n * anything. This mirrors `assertSafeStatusCode` in the mock generator, which\n * guards the structurally identical sink unconditionally for the same reason.\n *\n * `default` is deliberately refused: it is a valid spec key but not a valid\n * status expression, and every caller resolves it to its own construct\n * (`Exclude<HTTPStatusCodes, …>`) before reaching an emission sink.\n *\n * @see GHSA-rw75-cc5p-q7c9 (fetch/axios type position)\n * @see GHSA-4j53-7m38-656f (axios runtime condition)\n */\nexport const assertSafeResponseStatusKey = (key: string): string => {\n  if (WILDCARD_STATUS_CODE_REGEX.test(key) || EXACT_STATUS_CODE_REGEX.test(key))\n    return key;\n\n  throw new Error(\n    `orval: refusing to generate code for an OpenAPI response key that is not a status code (got \"${key}\"). This value would otherwise be emitted verbatim into generated source.`,\n  );\n};\n\nexport const getStatusCodeType = (key: string, responseKeys: string[] = []) => {\n  if (WILDCARD_STATUS_CODE_REGEX.test(key)) {\n    const wildcardType = `HTTPStatusCode${key[0]}xx`;\n    const exactStatuses = [\n      ...new Set(\n        responseKeys.filter(\n          (responseKey) =>\n            EXACT_STATUS_CODE_REGEX.test(responseKey) &&\n            responseKey[0] === key[0],\n        ),\n      ),\n    ];\n\n    return exactStatuses.length\n      ? `Exclude<${wildcardType}, ${exactStatuses.join(' | ')}>`\n      : wildcardType;\n  }\n  return assertSafeResponseStatusKey(key);\n};\n\nexport const HTTP_STATUS_CODE_SHARED_TYPES: SharedTypeDeclaration[] = [\n  {\n    name: 'HTTPStatusCode1xx',\n    exported: true,\n    code: 'type HTTPStatusCode1xx = 100 | 101 | 102 | 103;',\n  },\n  {\n    name: 'HTTPStatusCode2xx',\n    exported: true,\n    code: 'type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;',\n  },\n  {\n    name: 'HTTPStatusCode3xx',\n    exported: true,\n    code: 'type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;',\n  },\n  {\n    name: 'HTTPStatusCode4xx',\n    exported: true,\n    code: 'type HTTPStatusCode4xx = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451;',\n  },\n  {\n    name: 'HTTPStatusCode5xx',\n    exported: true,\n    code: 'type HTTPStatusCode5xx = 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;',\n  },\n  {\n    name: 'HTTPStatusCodes',\n    exported: true,\n    code: 'type HTTPStatusCodes = HTTPStatusCode1xx | HTTPStatusCode2xx | HTTPStatusCode3xx | HTTPStatusCode4xx | HTTPStatusCode5xx;',\n  },\n];\n\nexport const needsHttpStatusCodeTypes = (implementation: string) =>\n  /HTTPStatusCode[1-5]xx|<HTTPStatusCodes,/.test(implementation);\n\n/**\n * Builds a boolean expression that is true when `accessor` holds a status\n * matching the OpenAPI response `key`, given every key the operation declares.\n *\n * A wildcard (`2XX`) excludes exact statuses declared in the same class, since\n * those have their own responses; `default` is the negation of every other\n * declared key.\n *\n * The result is emitted as live code, so no key reaches it unvalidated, but\n * the two branches get there differently: an exact key is passed through\n * `assertSafeResponseStatusKey`, while a wildcard key is matched by\n * `WILDCARD_STATUS_CODE_REGEX` and never emitted itself — only its leading\n * digit is read, to build a numeric range. The statuses a wildcard excludes\n * are the `EXACT_STATUS_CODE_REGEX` matches among `declaredKeys` that fall in\n * the wildcard's own class (same leading digit).\n */\nexport const getResponseStatusCondition = ({\n  key,\n  declaredKeys,\n  accessor,\n}: {\n  key: string;\n  declaredKeys: readonly string[];\n  accessor: string;\n}): string => {\n  const exactStatuses = declaredKeys.filter((declared) =>\n    EXACT_STATUS_CODE_REGEX.test(declared),\n  );\n\n  const conditionFor = (statusKey: string) => {\n    if (WILDCARD_STATUS_CODE_REGEX.test(statusKey)) {\n      const start = Number(statusKey[0]) * 100;\n      const exclusions = exactStatuses\n        .filter((status) => status[0] === statusKey[0])\n        .map((status) => `${accessor} !== ${status}`)\n        .join(' && ');\n      return `${accessor} >= ${start} && ${accessor} < ${start + 100}${\n        exclusions ? ` && ${exclusions}` : ''\n      }`;\n    }\n    return `${accessor} === ${assertSafeResponseStatusKey(statusKey)}`;\n  };\n\n  if (key === 'default') {\n    const declaredConditions = declaredKeys\n      .filter((declared) => declared !== 'default')\n      .map(conditionFor);\n    return declaredConditions.length\n      ? `!(${declaredConditions.join(' || ')})`\n      : 'true';\n  }\n\n  return conditionFor(key);\n};\n","import { VERBS_WITH_BODY } from '../constants';\nimport type { Verbs } from '../types';\n\nexport function getIsBodyVerb(verb: Verbs) {\n  return VERBS_WITH_BODY.includes(verb);\n}\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport { styleText } from 'node:util';\n\nimport {\n  ErrorWithTag,\n  type LogLevel,\n  type OrvalLogger,\n  type OrvalReporter,\n  type OrvalReportEvent,\n} from '../types';\nimport { isString } from './assertion';\n\ntype ReportStore = {\n  reporter: OrvalReporter;\n  projectName?: string;\n  /** True when a caller explicitly installed a reporter (including noop). */\n  reporterSet: boolean;\n};\n\nexport type ReportScope = {\n  reporter?: OrvalReporter;\n  projectName?: string;\n  /** Keep an already-active reporter (used by `generate()`). */\n  ifUnset?: boolean;\n};\n\nconst storage = new AsyncLocalStorage<ReportStore>();\n\nfunction writeConsole(event: OrvalReportEvent) {\n  console.log(event.message);\n}\n\nexport const noopReporter: OrvalReporter = {\n  // oxlint-disable-next-line eslint/no-empty-function\n  info() {},\n  // oxlint-disable-next-line eslint/no-empty-function\n  warn() {},\n  // oxlint-disable-next-line eslint/no-empty-function\n  error() {},\n  // oxlint-disable-next-line eslint/no-empty-function\n  verbose() {},\n  // oxlint-disable-next-line eslint/no-empty-function\n  debug() {},\n};\n\nexport const consoleReporter: OrvalReporter = {\n  info: writeConsole,\n  warn: writeConsole,\n  error: writeConsole,\n  verbose: writeConsole,\n  debug: writeConsole,\n};\n\nfunction run<T>(patch: ReportScope, callback: () => T): T {\n  const current = storage.getStore();\n  return storage.run(\n    {\n      reporter: patch.reporter ?? current?.reporter ?? noopReporter,\n      projectName: patch.projectName ?? current?.projectName,\n      reporterSet:\n        patch.reporter !== undefined || current?.reporterSet === true,\n    },\n    callback,\n  );\n}\n\nfunction toScope(value: OrvalReporter | ReportScope): ReportScope {\n  const maybeReporter = value as OrvalReporter;\n  const maybeScope = value as ReportScope;\n  const hasInfo = typeof maybeReporter.info === 'function';\n  const hasScopeField =\n    maybeScope.reporter !== undefined ||\n    maybeScope.ifUnset !== undefined ||\n    Object.hasOwn(maybeScope, 'projectName');\n\n  if (!hasInfo) {\n    return maybeScope;\n  }\n\n  if (hasScopeField) {\n    return {\n      reporter: maybeScope.reporter ?? maybeReporter,\n      projectName: maybeScope.projectName,\n      ifUnset: maybeScope.ifUnset,\n    };\n  }\n\n  return { reporter: maybeReporter };\n}\n\n/**\n * Run `callback` with a reporter. Unspecified fields inherit from the current\n * scope. Prefer {@link setProjectName} to set the project name.\n */\nexport function withReporter<T>(\n  reporterOrScope: OrvalReporter | ReportScope,\n  callback: () => T,\n): T {\n  const scope = toScope(reporterOrScope);\n\n  if (scope.ifUnset && storage.getStore()?.reporterSet) {\n    return callback();\n  }\n\n  return run(scope, callback);\n}\n\n/**\n * Set the ambient project name for subsequent log events. Creates a new\n * report store so earlier `bindReporter()` captures stay isolated.\n */\nexport function setProjectName(projectName?: string) {\n  const current = storage.getStore();\n  if (!current && projectName === undefined) {\n    return;\n  }\n\n  storage.enterWith({\n    reporter: current?.reporter ?? noopReporter,\n    projectName,\n    reporterSet: current?.reporterSet === true,\n  });\n}\n\n/** Re-enter the current report scope from later callbacks (watchers). */\nexport function bindReporter() {\n  const context = storage.getStore();\n  return <T>(callback: () => T): T =>\n    context ? storage.run(context, callback) : callback();\n}\n\nconst LOG_LEVEL_RANK: Record<LogLevel, number> = {\n  error: 0,\n  warn: 1,\n  info: 2,\n  verbose: 3,\n  debug: 4,\n};\n\nlet warningCount = 0;\nlet logLevel: LogLevel = 'info';\n\nexport function setLogLevel(level: LogLevel) {\n  logLevel = level;\n}\n\n/** Map CLI flags to a {@link LogLevel}. `--quiet` keeps warnings visible. */\nexport function resolveLogLevel(options: {\n  verbose?: boolean;\n  quiet?: boolean;\n  logLevel?: LogLevel;\n}): LogLevel {\n  if (options.verbose) {\n    return 'verbose';\n  }\n  if (options.quiet) {\n    return 'warn';\n  }\n  return options.logLevel ?? 'info';\n}\n\nexport function isLogLevelEnabled(level: LogLevel): boolean {\n  return LOG_LEVEL_RANK[level] <= LOG_LEVEL_RANK[logLevel];\n}\n\nfunction prefixMessage(\n  message: string,\n  {\n    projectName,\n    packageName,\n  }: { projectName?: string; packageName?: string } = {},\n): string {\n  return [\n    projectName && styleText('green', projectName),\n    packageName && `[${packageName}]`,\n    message,\n  ]\n    .filter(Boolean)\n    .join(' - ');\n}\n\nexport function createLogger(packageName: string): OrvalLogger {\n  const emit = (level: keyof OrvalReporter, message: string) => {\n    const { reporter, projectName } = storage.getStore() ?? {\n      reporter: noopReporter,\n    };\n    reporter[level]({\n      message: prefixMessage(message, {\n        projectName,\n        packageName: isLogLevelEnabled('verbose') ? packageName : undefined,\n      }),\n      packageName,\n      projectName,\n    });\n  };\n\n  return {\n    info(message) {\n      if (isLogLevelEnabled('info')) emit('info', message);\n    },\n    warn(err, tag) {\n      warningCount++;\n      if (isLogLevelEnabled('warn')) {\n        emit('warn', formatReportMessage('⚠️  ', 'yellow', err, tag));\n      }\n    },\n    error(err, tag) {\n      if (!isLogLevelEnabled('error')) return;\n      if (err instanceof ErrorWithTag && tag === undefined) {\n        emit(\n          'error',\n          formatReportMessage('🛑 ', 'red', err.cause ?? err, err.tag),\n        );\n        return;\n      }\n      emit('error', formatReportMessage('🛑 ', 'red', err, tag));\n    },\n    verbose(message) {\n      if (isLogLevelEnabled('verbose')) emit('verbose', message);\n    },\n    debug(message) {\n      if (isLogLevelEnabled('debug')) emit('debug', message);\n    },\n  };\n}\n\nexport const logger = createLogger('@orval/core');\n\nexport const getWarningCount = () => warningCount;\nexport const resetWarnings = () => {\n  warningCount = 0;\n};\n\nexport function startMessage({\n  name,\n  version,\n  description,\n}: {\n  name: string;\n  version: string;\n  description: string;\n}): string {\n  return `🍻 ${styleText(['cyan', 'bold'], name)} ${styleText('green', `v${version}`)}${\n    description ? ` - ${description}` : ''\n  }`;\n}\n\nexport function createSuccessMessage(projectTitle?: string) {\n  return `🎉 ${\n    projectTitle ? `${styleText('green', projectTitle)} - ` : ''\n  }Your OpenAPI spec has been converted into ready to use orval!`;\n}\n\nfunction formatReportMessage(\n  marker: string,\n  color: 'red' | 'yellow',\n  err: unknown,\n  tag?: string,\n): string {\n  const message = err instanceof Error ? formatError(err) : String(err);\n\n  const body = [tag ? `${tag} -` : undefined, message]\n    .filter(Boolean)\n    .join(' ');\n\n  return styleText(color, `${marker}${body}`);\n}\n\nfunction formatError(err: Error): string {\n  const message = (err.message || err.stack) ?? 'Unknown error';\n  if (!err.cause) return message;\n\n  const cause =\n    err.cause instanceof Error\n      ? err.cause.message\n      : isString(err.cause)\n        ? err.cause\n        : JSON.stringify(err.cause, undefined, 2);\n\n  return `${message}\\n  Cause: ${cause}`;\n}\n","import { isObject } from './assertion';\n\nexport function mergeDeep<T extends object, U extends object>(\n  source: T,\n  target: U,\n): T & U {\n  if (!isObject(target) || !isObject(source)) {\n    return source as T & U;\n  }\n\n  const acc = Object.assign({}, source) as Record<string, unknown>;\n  for (const [key, value] of Object.entries(target)) {\n    const sourceValue = acc[key];\n\n    if (Array.isArray(sourceValue) && Array.isArray(value)) {\n      acc[key] = [...(sourceValue as unknown[]), ...(value as unknown[])];\n    } else if (isObject(sourceValue) && isObject(value)) {\n      acc[key] = mergeDeep(sourceValue, value);\n    } else {\n      acc[key] = value;\n    }\n  }\n  return acc as T & U;\n}\n","import type { MutationInvalidatesConfig } from '../types';\nimport { isString } from './assertion';\nimport { camel } from './case';\n\n/** The query key function name an `invalidates` target resolves to. */\nconst queryKeyFnNameFor = (operationName: string) =>\n  camel(`get-${operationName}-query-key`);\n\n/**\n * The query key function name of an operation's infinite variant, shared by\n * its infinite and suspense-infinite queries. An `invalidates` target spelled\n * `<operation>Infinite` (or `<operation>_infinite`) folds to this same name, so\n * it is a working reference. See #4215.\n */\nconst infiniteQueryKeyFnNameFor = (operationName: string) =>\n  camel(`get-${operationName}-infinite-query-key`);\n\n/**\n * `mutationInvalidates` names operations as plain strings, and a name that\n * matches nothing is not an error anywhere downstream — the rule is simply\n * never applied, so the configured invalidation silently never runs. These\n * warnings close that gap. See #4166.\n *\n * The two fields do not resolve names the same way, and this mirrors each one\n * rather than inventing a third rule:\n *\n * - `onMutations` is compared with `===` against the generated operation name,\n *   so the raw `operationId` casing of the document (`PostNotes`) never\n *   matches `postNotes` and the whole rule is dead.\n * - `invalidates` is folded through `camel()` to build the query key function\n *   name, which makes `GetNotes` and `getNotes` the same reference. The\n *   infinite variant's key function (`getNotesInfinite`) resolves as well.\n *\n * Only existence is checked. A target that exists but was generated as a\n * mutation rather than a query emits a call to a `getXxxQueryKey` that was\n * never declared, which fails the consumer's build loudly; telling that apart\n * here would mean re-deriving the query package's notion of a query.\n */\nexport const getUnknownMutationInvalidatesWarnings = ({\n  mutationInvalidates,\n  operationNames,\n}: {\n  mutationInvalidates: MutationInvalidatesConfig | undefined;\n  /** Generated operation names for this output, after any filtering. */\n  operationNames: readonly string[];\n}): string[] => {\n  if (!mutationInvalidates?.length) return [];\n\n  const generated = new Set(operationNames);\n  // Keyed the way the emitted query key function name is built, so every\n  // spelling that resolves to one function collapses to a single entry.\n  const byQueryKeyFn = new Map(\n    operationNames.map((name) => [queryKeyFnNameFor(name), name]),\n  );\n  // Every query key function an `invalidates` target can resolve to. Kept apart\n  // from `byQueryKeyFn` so an `onMutations` suggestion only ever names a real\n  // operation, never its infinite variant.\n  const queryKeyFns = new Set([\n    ...byQueryKeyFn.keys(),\n    ...operationNames.map((name) => infiniteQueryKeyFnNameFor(name)),\n  ]);\n\n  const warnings: string[] = [];\n  const reported = new Set<string>();\n\n  const report = (field: 'onMutations' | 'invalidates', name: string) => {\n    const key = `${field}:${name}`;\n    if (reported.has(key)) return;\n    reported.add(key);\n\n    // A name that differs only in casing is the mistake this warning exists\n    // for, so point at it. Nothing fuzzier is attempted: a wrong suggestion\n    // costs more than none, and the message already names the bad value.\n    const suggestion = byQueryKeyFn.get(queryKeyFnNameFor(name));\n\n    warnings.push(\n      `mutationInvalidates references an unknown operation '${name}' in ` +\n        `${field}. No operation with that name is generated for this output, ` +\n        `so the rule is ignored` +\n        (suggestion && suggestion !== name\n          ? ` — did you mean '${suggestion}'?`\n          : '.'),\n    );\n  };\n\n  for (const rule of mutationInvalidates) {\n    for (const name of rule.onMutations) {\n      if (!generated.has(name)) report('onMutations', name);\n    }\n\n    for (const target of rule.invalidates) {\n      const name = isString(target) ? target : target.query;\n      if (!queryKeyFns.has(queryKeyFnNameFor(name))) {\n        report('invalidates', name);\n      }\n    }\n  }\n\n  return warnings;\n};\n","import { keyword } from 'esutils';\n\nimport {\n  isBoolean,\n  isFunction,\n  isNumber,\n  isObject,\n  isString,\n} from './assertion';\n\n/**\n * Renders a document-supplied `const` or enum member as an inert literal.\n *\n * A schema's declared `type` and the value its `const` carries both come from\n * the document and nothing makes them agree, so the branch has to be on the\n * value's own JavaScript type. Deciding from the declared type instead lets an\n * `object`-typed schema carry a string payload that is spliced in raw and then\n * evaluated as an expression when the generated module loads.\n *\n * @param value - The value to render. Any JSON-representable value.\n * @returns A literal that stays inert in both value and type position.\n * @example\n * toJsLiteral(\"it's\") // returns \"'it\\\\'s'\"\n * toJsLiteral(42) // returns \"42\"\n * toJsLiteral({ a: 1 }) // returns '{\"a\":1}'\n */\nexport function toJsLiteral(value: unknown): string {\n  if (isString(value)) {\n    return `'${jsStringLiteralEscape(value)}'`;\n  }\n\n  // `Number.isFinite` because YAML spells `NaN` and `Infinity` as scalars and\n  // neither is a legal TypeScript literal type; `JSON.stringify` renders both\n  // as `null`, which is inert and valid wherever this lands.\n  if ((isNumber(value) && Number.isFinite(value)) || isBoolean(value)) {\n    return String(value);\n  }\n\n  return toStructuralLiteral(value);\n}\n\n/**\n * `JSON.stringify` for structural values, except that `__proto__` is emitted as\n * a computed key.\n *\n * A document parsed with `JSON.parse` can carry a real own `__proto__`\n * property, and `JSON.stringify` renders it as a plain key. In an object\n * literal that key is the prototype setter, not a data property (Annex B.3.1),\n * so the constant would silently lose the property and take the document's\n * value as its prototype instead. `['__proto__']` is the only form that stays\n * an own property, and it is valid in type position as well as value position.\n *\n * Output is byte-identical to `JSON.stringify` for values without a\n * `__proto__` key, so no generated output moves.\n */\nfunction toStructuralLiteral(value: unknown): string {\n  if (Array.isArray(value)) {\n    return `[${value.map((item) => toStructuralLiteral(item)).join(',')}]`;\n  }\n\n  if (isObject(value)) {\n    const entries = Object.entries(value)\n      // `JSON.stringify` omits keys whose value is `undefined`; match it.\n      .filter(([, entryValue]) => entryValue !== undefined)\n      .map(([key, entryValue]) => {\n        const serializedKey = JSON.stringify(key);\n        const safeKey =\n          key === '__proto__' ? `[${serializedKey}]` : serializedKey;\n        return `${safeKey}:${toStructuralLiteral(entryValue)}`;\n      });\n    return `{${entries.join(',')}}`;\n  }\n\n  return JSON.stringify(value);\n}\n\n/**\n * Converts data to a string representation suitable for code generation.\n * Handles strings, numbers, booleans, functions, arrays, and objects.\n *\n * @param data - The data to stringify. Can be a string, array, object, number, boolean, function, null, or undefined.\n * @returns A string representation of the data, `null` for null, or undefined if data is undefined.\n * @example\n * stringify('hello') // returns \"'hello'\"\n * stringify(42) // returns \"42\"\n * stringify([1, 2, 3]) // returns \"[1, 2, 3]\"\n * stringify({ a: 1, b: 'test' }) // returns \"{ a: 1, b: 'test', }\"\n */\nexport function stringify(data?: unknown): string | undefined {\n  if (data === undefined) {\n    return;\n  }\n\n  if (data === null) {\n    return 'null';\n  }\n\n  if (isString(data)) {\n    return `'${jsStringLiteralEscape(data)}'`;\n  }\n\n  if (isNumber(data) || isBoolean(data) || isFunction(data)) {\n    return String(data);\n  }\n\n  if (Array.isArray(data)) {\n    return `[${data.map((item: unknown) => stringify(item as string | unknown[] | Record<string, unknown>)).join(', ')}]`;\n  }\n\n  const entries = Object.entries(data);\n  // An empty object must still be a literal: returning '' left a hole in the\n  // enclosing literal, e.g. a `{ items: {} }` default became `{ items: , }`.\n  if (entries.length === 0) {\n    return '{}';\n  }\n\n  let result = '';\n  for (const [index, [key, value]] of entries.entries()) {\n    const strValue = stringify(\n      value as string | unknown[] | Record<string, unknown>,\n    );\n    // `__proto__` must be emitted as a computed key, otherwise the object\n    // literal sets the prototype instead of creating a data property (this\n    // holds for both the bare and quoted forms, per Annex B.3.1).\n    // Non-identifier keys (dashes, spaces, quotes) must be quoted to stay valid\n    // TS, and escaped in case the key itself contains a quote or backslash.\n    const safeKey =\n      key === '__proto__'\n        ? `['${jsStringLiteralEscape(key)}']`\n        : keyword.isIdentifierNameES5(key)\n          ? key\n          : `'${jsStringLiteralEscape(key)}'`;\n    if (entries.length === 1) {\n      result = `{ ${safeKey}: ${strValue}, }`;\n    } else if (!index) {\n      result = `{ ${safeKey}: ${strValue}, `;\n    } else if (entries.length - 1 === index) {\n      result += `${safeKey}: ${strValue}, }`;\n    } else {\n      result += `${safeKey}: ${strValue}, `;\n    }\n  }\n  return result;\n}\n\n/**\n * Sanitizes a string value by removing or replacing special characters and ensuring\n * it conforms to JavaScript identifier naming rules if needed.\n *\n * @param value - The string value to sanitize.\n * @param options - Configuration options for sanitization:\n *   - `whitespace` - Replacement string for whitespace characters, or `true` to keep them.\n *   - `underscore` - Replacement string for underscores, or `true` to keep them.\n *   - `dot` - Replacement string for dots, or `true` to keep them.\n *   - `dash` - Replacement string for dashes, or `true` to keep them.\n *   - `es5keyword` - If true, prefixes the value with underscore if it's an ES5 keyword.\n *   - `es5IdentifierName` - If true, ensures the value is a valid ES5 identifier name.\n *   - `special` - If true, preserves special characters that would otherwise be removed.\n * @returns The sanitized string value.\n * @example\n * sanitize('hello-world', { dash: '_' }) // returns \"hello_world\"\n * sanitize('class', { es5keyword: true }) // returns \"_class\"\n * sanitize('123abc', { es5IdentifierName: true }) // returns \"N123abc\"\n */\nexport function sanitize(\n  value: string,\n  options?: {\n    whitespace?: string | true;\n    underscore?: string | true;\n    dot?: string | true;\n    dash?: string | true;\n    es5keyword?: boolean;\n    es5IdentifierName?: boolean;\n    special?: boolean;\n  },\n) {\n  const {\n    whitespace = '',\n    underscore = '',\n    dot = '',\n    dash = '',\n    es5keyword = false,\n    es5IdentifierName = false,\n    special = false,\n  } = options ?? {};\n  let newValue = value;\n\n  if (!special) {\n    newValue = newValue.replaceAll(/[!\"`'#%&,:;<>=@{}~$()*+/\\\\?[\\]^|]/g, '');\n  }\n\n  if (whitespace !== true) {\n    newValue = newValue.replaceAll(/[\\s]/g, whitespace);\n  }\n\n  if (underscore !== true) {\n    newValue = newValue.replaceAll(/['_']/g, underscore);\n  }\n\n  if (dot !== true) {\n    newValue = newValue.replaceAll(/[.]/g, dot);\n  }\n\n  if (dash !== true) {\n    newValue = newValue.replaceAll(/[-]/g, dash);\n  }\n\n  if (es5keyword) {\n    newValue = keyword.isKeywordES5(newValue, true) ? `_${newValue}` : newValue;\n  }\n\n  if (es5IdentifierName) {\n    if (/^[0-9]/.test(newValue)) {\n      newValue = `N${newValue}`;\n    } else {\n      newValue = keyword.isIdentifierNameES5(newValue)\n        ? newValue\n        : `_${newValue}`;\n    }\n  }\n\n  return newValue;\n}\n\n/**\n * Converts an array of objects to a comma-separated string representation.\n * Optionally extracts a nested property from each object using a dot-notation path.\n *\n * @param props - Array of objects to convert to string.\n * @param path - Optional dot-notation path to extract a property from each object (e.g., \"user.name\").\n * @returns A comma-separated string of values, with each value on a new line indented.\n * @example\n * toObjectString([{ name: 'John' }, { name: 'Jane' }], 'name')\n * // returns \"John,\\n    Jane,\"\n * toObjectString(['a', 'b', 'c'])\n * // returns \"a,\\n    b,\\n    c,\"\n */\nexport function toObjectString<T>(props: T[], path?: keyof T) {\n  if (props.length === 0) {\n    return '';\n  }\n\n  const arrayOfString = isString(path)\n    ? props.map((prop) => {\n        let obj: unknown = prop;\n        for (const key of path.split('.')) {\n          obj =\n            obj && (isObject(obj) || Array.isArray(obj))\n              ? (obj as Record<string, unknown>)[key]\n              : undefined;\n        }\n        return obj as string;\n      })\n    : props;\n\n  return arrayOfString.join(',\\n    ') + ',';\n}\n\nconst NUMBERS = {\n  '0': 'zero',\n  '1': 'one',\n  '2': 'two',\n  '3': 'three',\n  '4': 'four',\n  '5': 'five',\n  '6': 'six',\n  '7': 'seven',\n  '8': 'eight',\n  '9': 'nine',\n};\n\n/**\n * Converts a number to its word representation by translating each digit to its word form.\n *\n * @param num - The number to convert to words.\n * @returns A string containing the word representation of each digit concatenated together.\n * @example\n * getNumberWord(123) // returns \"onetwothree\"\n * getNumberWord(42) // returns \"fourtwo\"\n */\nexport function getNumberWord(num: number) {\n  // oxlint-disable-next-line typescript/no-misused-spread -- digits 0-9 only, no unicode concerns\n  const arrayOfNumber = [...num.toString()] as (keyof typeof NUMBERS)[];\n  return arrayOfNumber.reduce((acc, n) => acc + NUMBERS[n], '');\n}\n\n/**\n * Escapes a specific character in a string by prefixing all of its occurrences with a backslash.\n *\n * @param str - The string to escape, or null.\n * @param char - The character to escape. Defaults to single quote (').\n * @returns The escaped string, or null if the input is null.\n * @example\n * escape(\"don't\") // returns \"don\\'t\"\n * escape(\"it's John's\") // returns \"it\\'s John\\'s\"\n * escape('say \"hello\"', '\"') // returns 'say \\\\\"hello\\\\\"'\n * escape(\"a'''b\", \"'\") // returns \"a\\'\\'\\'b\"\n */\nexport function escape(str: string | null, char = \"'\") {\n  return str?.replaceAll(char, `\\\\${char}`);\n}\n\n/**\n * Escapes regular expression metacharacters in a string so it can be safely\n * embedded inside a RegExp pattern.\n *\n * @param value - The raw string value to escape for regex usage.\n * @returns The escaped string.\n * @example\n * escapeRegExp('foo$bar') // returns 'foo\\\\$bar'\n */\nexport function escapeRegExp(value: string) {\n  return value.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`);\n}\n\n/**\n * Escape all characters not included in SingleStringCharacters and\n * DoubleStringCharacters on\n * http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * Based on https://github.com/joliss/js-string-escape/blob/master/index.js\n *\n * @param input String to escape\n */\nexport function jsStringEscape(input: string) {\n  return input.replaceAll(/[\"'\\\\\\n\\r\\u2028\\u2029/*]/g, (character) => {\n    switch (character) {\n      case '\"':\n      case \"'\":\n      case '\\\\':\n      case '/':\n      case '*': {\n        return '\\\\' + character;\n      }\n      // Four possible LineTerminator characters need to be escaped:\n      case '\\n': {\n        return String.raw`\\n`;\n      }\n      case '\\r': {\n        return String.raw`\\r`;\n      }\n      case '\\u2028': {\n        return String.raw`\\u2028`;\n      }\n      case '\\u2029': {\n        return String.raw`\\u2029`;\n      }\n      default: {\n        return '';\n      }\n    }\n  });\n}\n\n/**\n * Escape a string for embedding inside a single-quoted JS string literal.\n *\n * Unlike {@link jsStringEscape}, this escapes only what a string literal\n * actually needs: backslashes, single quotes, and line terminators. It\n * deliberately does NOT escape `/` or `*`, which are meaningless inside a\n * string literal, so escaping them produces \"useless escapes\" that round-trip\n * to the same value but trip ESLint's `no-useless-escape` in generated code\n * (e.g. RegExp pattern literals, see #3337).\n *\n * Use {@link jsStringEscape} instead when the value is embedded in a JS comment,\n * where the comment delimiters must be neutralized.\n *\n * @param input String to escape\n */\nexport function jsStringLiteralEscape(input: string) {\n  return input.replaceAll(/['\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n    switch (character) {\n      case \"'\":\n      case '\\\\': {\n        return '\\\\' + character;\n      }\n      case '\\n': {\n        return String.raw`\\n`;\n      }\n      case '\\r': {\n        return String.raw`\\r`;\n      }\n      case '\\u2028': {\n        return String.raw`\\u2028`;\n      }\n      case '\\u2029': {\n        return String.raw`\\u2029`;\n      }\n      default: {\n        return '';\n      }\n    }\n  });\n}\n\n/**\n * Deduplicates a TypeScript union type string.\n * Handles types like \"A | B | B\" → \"A | B\" and \"null | null\" → \"null\".\n * Only splits on top-level | (not inside {} () [] <> or string literals).\n */\nexport function dedupeUnionType(unionType: string): string {\n  const parts: string[] = [];\n  let current = '';\n  let depth = 0;\n  let quote = ''; // current open quote char, or '' if outside string\n  let escaped = false; // true if previous char was unescaped \\ inside string\n\n  for (const c of unionType) {\n    if (!escaped && (c === \"'\" || c === '\"')) {\n      if (!quote) quote = c;\n      else if (quote === c) quote = '';\n    }\n\n    if (!quote) {\n      if ('{([<'.includes(c)) depth++;\n      if ('})]>'.includes(c)) depth--;\n      if (c === '|' && depth === 0) {\n        parts.push(current.trim());\n        current = '';\n        continue;\n      }\n    }\n    current += c;\n    escaped = !!quote && !escaped && c === '\\\\';\n  }\n  if (current.trim()) parts.push(current.trim());\n\n  return [...new Set(parts)].join(' | ');\n}\n","import { camel, pascal } from './case';\nimport { sanitize } from './string';\n\n/**\n * Returns `name` or the first deterministic numeric suffix not in\n * `reservedNames`.\n */\nexport function getUniqueName(\n  name: string,\n  reservedNames: ReadonlySet<string>,\n): string {\n  let candidate = name;\n  let index = 2;\n\n  while (reservedNames.has(candidate)) {\n    candidate = `${name}${index}`;\n    index += 1;\n  }\n\n  return candidate;\n}\n\n/**\n * Resolves URL helper names while reserving every generated operation name.\n * The returned names correspond to `helperOperationNames` in order.\n */\nexport function getOperationUrlHelperNames(\n  operationNames: readonly string[],\n  helperOperationNames: readonly string[],\n): string[] {\n  const reservedNames = new Set(operationNames);\n\n  return helperOperationNames.map((operationName) => {\n    const helperName = getUniqueName(\n      camel(`get-${operationName}-url`),\n      reservedNames,\n    );\n    reservedNames.add(helperName);\n    return helperName;\n  });\n}\n\nconst componentBaseNamesCache = new WeakMap<object, Map<string, string>>();\n\n/**\n * The identifier a base name ends up as once the definition/ref generators\n * sanitize it (`1Address` → `N1Address`, keyword → `_keyword`). Collisions are\n * checked on this form so two keys cannot meet only after sanitization. The\n * section's prefix/suffix are constant, so they are left out: at worst a name\n * that would only collide without an affix is disambiguated anyway.\n */\nfunction toComponentIdentifier(baseName: string): string {\n  return sanitize(baseName, {\n    underscore: true,\n    dash: true,\n    es5keyword: true,\n    es5IdentifierName: true,\n  });\n}\n\n/**\n * Resolves the PascalCase base name of every key in a `components` section\n * (e.g. `components.schemas`), so distinct keys that only differ in casing or\n * separators (`Address` and `address`) never share a generated TypeScript\n * name. Within each colliding group the key already spelled in PascalCase (or\n * else the first declared) keeps the plain name; the others get the first\n * numeric suffix whose sanitized identifier is still free (`Address2`).\n * Memoized per section object.\n */\nexport function getComponentBaseNames(\n  section: object | undefined,\n): ReadonlyMap<string, string> {\n  if (!section) {\n    return new Map();\n  }\n\n  const cached = componentBaseNamesCache.get(section);\n  if (cached) {\n    return cached;\n  }\n\n  const groups = new Map<string, string[]>();\n  for (const key of Object.keys(section)) {\n    const identifier = toComponentIdentifier(pascal(key));\n    const group = groups.get(identifier);\n    if (group) {\n      group.push(key);\n    } else {\n      groups.set(identifier, [key]);\n    }\n  }\n\n  const reservedIdentifiers = new Set(groups.keys());\n  const names = new Map<string, string>();\n  for (const keys of groups.values()) {\n    const owner = keys.find((key) => key === pascal(key)) ?? keys[0];\n    names.set(owner, pascal(owner));\n\n    for (const key of keys) {\n      if (key === owner) continue;\n      const base = pascal(key);\n      let index = 2;\n      let uniqueName = `${base}${index}`;\n      while (reservedIdentifiers.has(toComponentIdentifier(uniqueName))) {\n        index += 1;\n        uniqueName = `${base}${index}`;\n      }\n      reservedIdentifiers.add(toComponentIdentifier(uniqueName));\n      names.set(key, uniqueName);\n    }\n  }\n\n  componentBaseNamesCache.set(section, names);\n  return names;\n}\n\n/**\n * Returns the collision-free PascalCase base name of component `key` within\n * `section`. See {@link getComponentBaseNames}.\n */\nexport function getComponentBaseName(\n  section: object | undefined,\n  key: string,\n): string {\n  return getComponentBaseNames(section).get(key) ?? pascal(key);\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport type { OpenApiSchemaObject } from '../types';\n\n/**\n * Read a schema object's `required` keyword.\n *\n * Some generators emit `required: true` on a schema that carries a `$ref`,\n * borrowing the boolean that belongs on the request body object. Spreading that\n * boolean fails with `required ?? [] is not iterable`, which says nothing about\n * the document. Report the offending schema and the expected shape instead. The\n * document is not rewritten: a boolean carries no property names, so there is\n * nothing to recover from it. (#3719)\n *\n * @param schema - Schema whose `required` keyword to read.\n * @param name - Label for the offending schema, used in the error message.\n */\nexport function getRequiredKeys(schema: OpenApiSchemaObject, name: string) {\n  if (isBooleanJsonSchema(schema)) return [];\n\n  const required = schema.required as unknown;\n\n  if (required === undefined) return [];\n  // oxlint-disable-next-line typescript/no-unsafe-return\n  if (Array.isArray(required)) return required;\n\n  throw new Error(\n    `Invalid OpenAPI document: schema \"${name}\" has \\`required: ${JSON.stringify(\n      required,\n    )}\\`, but a schema object's \\`required\\` must be an array of property names. A boolean \\`required\\` belongs on the request body object or on a parameter, not on the schema it references.`,\n  );\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport type { PackageJson } from '../types';\n\nexport function resolveInstalledVersion(\n  packageName: string,\n  fromDir: string,\n): string | undefined {\n  try {\n    const require = createRequire(path.join(fromDir, 'noop.js'));\n    try {\n      const pkg = require(`${packageName}/package.json`) as {\n        version?: string;\n      };\n      return pkg.version;\n    } catch (directError: unknown) {\n      if (\n        directError instanceof Error &&\n        'code' in directError &&\n        (directError as NodeJS.ErrnoException).code ===\n          'ERR_PACKAGE_PATH_NOT_EXPORTED'\n      ) {\n        const entryPath = require.resolve(packageName);\n        let dir = path.dirname(entryPath);\n        while (dir !== path.parse(dir).root) {\n          const pkgPath = path.join(dir, 'package.json');\n          if (existsSync(pkgPath)) {\n            const pkgData = JSON.parse(readFileSync(pkgPath, 'utf8')) as {\n              name?: string;\n              version?: string;\n            };\n            if (pkgData.name === packageName) {\n              return pkgData.version;\n            }\n          }\n          dir = path.dirname(dir);\n        }\n        return undefined;\n      }\n      throw directError;\n    }\n  } catch {\n    return undefined;\n  }\n}\n\nexport function resolveInstalledVersions(\n  packageJson: PackageJson,\n  fromDir: string,\n): Record<string, string> {\n  const resolved: Record<string, string> = {};\n  const allDeps = new Set([\n    ...Object.keys(packageJson.dependencies ?? {}),\n    ...Object.keys(packageJson.devDependencies ?? {}),\n    ...Object.keys(packageJson.peerDependencies ?? {}),\n  ]);\n  for (const pkgName of allDeps) {\n    const version = resolveInstalledVersion(pkgName, fromDir);\n    if (version) {\n      resolved[pkgName] = version;\n    }\n  }\n  return resolved;\n}\n","import type { NormalizedSchemaOptions } from '../types';\nimport { isObject } from './assertion';\n\nexport interface SchemaOptionLike {\n  importPath?: string;\n}\n\n/**\n * Extracts the custom package import specifier from a normalized `schemas`\n * config. Returns `undefined` when `schemas` is a plain string, `false`,\n * `undefined`, or when `importPath` is not set.\n */\nexport function getSchemasImportPath(\n  schemas?: string | NormalizedSchemaOptions | SchemaOptionLike | false | null,\n): string | undefined {\n  if (isObject(schemas)) {\n    return (schemas as SchemaOptionLike).importPath;\n  }\n  return undefined;\n}\n","import type { Tsconfig } from '../types';\n\nexport function isSyntheticDefaultImportsAllow(config?: Tsconfig) {\n  if (!config) {\n    return true;\n  }\n\n  return !!(\n    config.compilerOptions?.allowSyntheticDefaultImports ??\n    config.compilerOptions?.esModuleInterop\n  );\n}\n\nconst NODE_NEXT_MODULES = new Set(['nodenext', 'node16']);\n\nconst NODE_NEXT_EXTENSION_MAP: readonly (readonly [string, string])[] = [\n  ['.tsx', '.jsx'],\n  ['.mts', '.mjs'],\n  ['.cts', '.cjs'],\n  ['.ts', '.js'],\n];\n\nexport function getImportExtension(\n  fileExtension: string,\n  tsconfig?: Tsconfig,\n): string {\n  const compilerOptions = tsconfig?.compilerOptions;\n\n  if (compilerOptions?.allowImportingTsExtensions) {\n    return fileExtension;\n  }\n\n  const module = compilerOptions?.module?.toLowerCase();\n  const moduleResolution = compilerOptions?.moduleResolution?.toLowerCase();\n  if (\n    (module && NODE_NEXT_MODULES.has(module)) ||\n    (moduleResolution && NODE_NEXT_MODULES.has(moduleResolution))\n  ) {\n    for (const [from, to] of NODE_NEXT_EXTENSION_MAP) {\n      if (fileExtension.endsWith(from)) {\n        return `${fileExtension.slice(0, -from.length)}${to}`;\n      }\n    }\n    return fileExtension;\n  }\n\n  return fileExtension.replace(/\\.ts$/, '') || '';\n}\n","import path from 'node:path';\n\nimport type {\n  GeneratorDependency,\n  GeneratorImport,\n  NormalizedOutputOptions,\n} from '../types';\nimport type { SchemaOutputPlan } from '../writers/schema-output-plan';\nimport { conventionName } from './case';\nimport { stripFileExtension } from './file';\nimport * as upath from './path';\nimport { getSchemasImportPath } from './schemas-options';\nimport { getImportExtension } from './tsconfig';\n\n/** Known source file extensions used to detect named single-schema files. */\nexport const SOURCE_FILE_EXTENSIONS: ReadonlySet<string> = new Set([\n  '.ts',\n  '.tsx',\n  '.mts',\n  '.cts',\n  '.js',\n  '.jsx',\n  '.mjs',\n  '.cjs',\n]);\n\n/**\n * Tag directory for a schema that more than one tag uses. Such schemas stay at\n * the schemas root rather than being duplicated into each tag directory.\n */\nexport const SHARED_DIR = '.';\n\nexport interface ResolveSchemaImportDependenciesOptions {\n  /**\n   * Schema→tag map, set when `schemas.splitByTags` is enabled. The sentinel\n   * `'.'` marks a shared schema, which stays at the schemas root.\n   */\n  schemaTagMap?: Map<string, string>;\n  /**\n   * Plan built from `schemas.routes`. When present it owns the file layout,\n   * so it supersedes both the flat layout and `schemaTagMap` routing (#3942).\n   */\n  schemaOutputPlan?: SchemaOutputPlan;\n}\n\n/**\n * Resolves schema imports to the modules that export them.\n *\n * Shared by `generateImportsForBuilder` and by client generators that emit\n * sibling files, so both refer to the emitted schemas in the same way.\n * Callers shape their own exports (aliasing, `values`, default imports).\n *\n * @param output - Normalized output options.\n * @param imports - Schema imports to resolve. The caller must first remove\n *   imports that carry their own `importPath`.\n * @param relativeSchemasPath - Module that the schemas resolve from: a package\n *   specifier when `schemas.importPath` is set, or a relative path.\n * @returns One dependency per module, each with its imports.\n */\nexport function resolveSchemaImportDependencies(\n  output: NormalizedOutputOptions,\n  imports: readonly GeneratorImport[],\n  relativeSchemasPath: string,\n  { schemaTagMap, schemaOutputPlan }: ResolveSchemaImportDependenciesOptions,\n): GeneratorDependency[] {\n  // A routed plan may fold several spec names onto one emitted schema. Import\n  // the canonical name, or the import names a binding the file never exports.\n  const resolved = schemaOutputPlan\n    ? imports.map((schemaImport) => {\n        if (!schemaOutputPlan.hasSchema(schemaImport.name)) return schemaImport;\n        const canonicalName = schemaOutputPlan.canonicalNameFor(\n          schemaImport.name,\n        );\n        return canonicalName === schemaImport.name\n          ? schemaImport\n          : { ...schemaImport, name: canonicalName };\n      })\n    : imports;\n\n  const schemasImportPath = getSchemasImportPath(output.schemas);\n  const isPackageImport = !!schemasImportPath;\n\n  if (\n    output.schemas &&\n    typeof output.schemas === 'object' &&\n    output.schemas.mode === 'single'\n  ) {\n    // `schemas.path` may name the schema module itself (#4074): a path\n    // with a source extension is written to directly, so the import must\n    // address that file, not the default `<dir>/index.zod.ts`. The stem and\n    // the import extension both derive from the *path's own* extension —\n    // `schemaFileExtension` may not even be a suffix of it (e.g.\n    // `schemas.zod.mts` with the default `.zod.ts`), and mixing the two\n    // would append the wrong tail and name a file nobody emits.\n    const namedSingleSchemaPath =\n      typeof output.schemas.path === 'string' &&\n      SOURCE_FILE_EXTENSIONS.has(\n        path.extname(output.schemas.path).toLowerCase(),\n      )\n        ? output.schemas.path\n        : undefined;\n    const namedSingleSchemaStem = namedSingleSchemaPath\n      ? path.basename(\n          stripFileExtension(\n            namedSingleSchemaPath,\n            path.extname(namedSingleSchemaPath),\n          ) +\n            getImportExtension(\n              path.extname(namedSingleSchemaPath),\n              output.tsconfig,\n            ),\n        )\n      : undefined;\n\n    // The split and tags-split writers pass the schemas path itself (#3624),\n    // which for a named module is the file, not its directory. Resolve from\n    // the directory either way, or the import points inside the file\n    // (`./model/api.ts/api`).\n    const relativeSchemasDir =\n      namedSingleSchemaPath &&\n      path.posix.basename(relativeSchemasPath) ===\n        path.basename(namedSingleSchemaPath)\n        ? path.posix.dirname(relativeSchemasPath)\n        : relativeSchemasPath;\n\n    return [\n      {\n        exports: dedupeSchemaImports(resolved),\n        dependency:\n          schemasImportPath ??\n          upath.joinSafe(\n            relativeSchemasDir === '.' ? './' : relativeSchemasDir,\n            namedSingleSchemaStem ??\n              `index${getImportExtension(output.schemaFileExtension, output.tsconfig)}`,\n          ),\n      },\n    ];\n  }\n\n  // A root barrel makes every schema available from one module.\n  if (output.indexFiles) {\n    return [\n      {\n        exports: dedupeSchemaImports(resolved),\n        dependency: schemasImportPath ?? relativeSchemasPath,\n      },\n    ];\n  }\n\n  // Without `output.schemas` there is no schemas *directory*: every mode\n  // writer folds the schemas into one `<target>.schemas` sibling file and\n  // passes that file as `relativeSchemasPath`. The per-schema layout below\n  // assumes a directory, so joining a name onto it addresses a path inside a\n  // file (`./pets.schemas/pet`), which resolves to nothing. One file means one\n  // module regardless of `indexFiles`, exactly like the barrel above.\n  if (!output.schemas) {\n    return [\n      {\n        exports: dedupeSchemaImports(resolved),\n        dependency: relativeSchemasPath,\n      },\n    ];\n  }\n\n  // Schema files, Zod (`.zod.ts` by default) and TypeScript alike, are named\n  // with `schemaFileExtension`. Derive the import tail from the same value,\n  // or the import names a file that is never emitted (#4234).\n  const { schemaFileExtension } = output;\n\n  // A package subpath resolves through the consumer's export map, which knows\n  // nothing of our tsconfig: `pet.zod.ts` is imported as\n  // `@acme/models/pet.zod`. Withholding the tsconfig drops `.ts` without the\n  // NodeNext `.ts`→`.js` rewrite, which would name a file nobody emits.\n  const importExtension = getImportExtension(\n    schemaFileExtension,\n    isPackageImport ? undefined : output.tsconfig,\n  );\n\n  const importsByDependency = new Map<string, GeneratorImport[]>();\n\n  for (const schemaImport of resolved) {\n    // `<Name>Output` aliases are emitted into their base schema's file, so\n    // they resolve through `zodBaseName` (#3927). Everything else is named\n    // after the TS identifier: the schemas writer emits each file as\n    // `schema.name` including the Response/Body/Parameter suffix, so\n    // preferring `schemaName` (the bare ref) would point at a file that is\n    // never written (#2912).\n    const baseName = schemaImport.zodBaseName ?? schemaImport.name;\n    const normalizedName = conventionName(baseName, output.namingConvention);\n\n    const tagDir = schemaTagMap?.get(baseName);\n    const tagSegment = tagDir && tagDir !== SHARED_DIR ? `${tagDir}/` : '';\n\n    const flatDependency = upath.joinSafe(\n      relativeSchemasPath,\n      `${tagSegment}${normalizedName}${importExtension}`,\n    );\n\n    // The plan owns the layout when routes are configured. For a package\n    // import it maps to an export subpath; a schema the plan does not place\n    // falls back to the flat layout.\n    const dependency = schemaOutputPlan\n      ? isPackageImport\n        ? (schemaOutputPlan.packageImportPath(baseName) ?? flatDependency)\n        : schemaOutputPlan.clientImportPath(baseName, relativeSchemasPath)\n      : flatDependency;\n\n    const existing = importsByDependency.get(dependency);\n    if (existing) {\n      existing.push(schemaImport);\n    } else {\n      importsByDependency.set(dependency, [schemaImport]);\n    }\n  }\n\n  return [...importsByDependency.entries()].map(\n    ([dependency, dependencyImports]) => ({\n      dependency,\n      exports: dedupeSchemaImports(dependencyImports),\n    }),\n  );\n}\n\n/**\n * Collapses imports that name the same binding. The key holds every field that\n * changes the binding, so one schema under two aliases stays twice.\n *\n * `values` is merged, not keyed on: `generateImports` groups by it, so keeping\n * a type-only entry beside its value twin emits `import type { Pet }` and\n * `import { Pet }` from one module — TS2300. A value import serves the type\n * position too, so it wins for the whole binding.\n */\nexport function dedupeSchemaImports(\n  imports: readonly GeneratorImport[],\n): GeneratorImport[] {\n  const byBinding = new Map<string, GeneratorImport>();\n\n  for (const entry of imports) {\n    const key = `${entry.name}|${entry.alias ?? ''}|${String(entry.default)}`;\n    const existing = byBinding.get(key);\n    if (!existing) {\n      byBinding.set(key, entry);\n    } else if (entry.values && !existing.values) {\n      byBinding.set(key, { ...existing, values: true });\n    }\n  }\n\n  return [...byBinding.values()];\n}\n","export const sortByPriority = <T>(\n  arr: (T & { default?: unknown; required?: boolean })[],\n) =>\n  arr.toSorted((a, b) => {\n    // A parameter carrying a default goes last, and `0`, `false` or an empty\n    // string is a default like any other.\n    const aHasDefault = a.default !== undefined;\n    const bHasDefault = b.default !== undefined;\n    if (aHasDefault !== bHasDefault) {\n      return aHasDefault ? 1 : -1;\n    }\n\n    if (a.required && b.required) {\n      return 0;\n    }\n\n    if (a.required) {\n      return -1;\n    }\n\n    if (b.required) {\n      return 1;\n    }\n    return 0;\n  });\n\nlet naturalCompareCollator: Intl.Collator | undefined;\n\nexport function compareNatural(a: string, b: string): number {\n  naturalCompareCollator ??= new Intl.Collator('en', { numeric: true });\n\n  return naturalCompareCollator.compare(a, b);\n}\n","import { DefaultTag } from '../types';\nimport { kebab } from './case';\n\n/**\n * Canonical bucket key for a single OpenAPI tag.\n *\n * In `tags` / `tags-split` mode operations are routed into files by their first\n * tag. This function is the **single source of truth** for turning a tag (or a\n * missing tag) into the key that identifies that file bucket. Every place that\n * groups operations by tag, derives a per-tag file/directory name, or checks\n * whether an operation belongs to a tag MUST go through here so that the\n * \"build the key\" side and the \"look the key up\" side can never disagree.\n *\n * The result is `kebab`-cased. `kebab` is idempotent\n * (`kebab(kebab(x)) === kebab(x)`), so it is always safe to call this on a value\n * that is already a canonical key. Other case functions (`camel`, `pascal`) are\n * NOT safe here: they do not round-trip through the bucket key for tags\n * containing acronyms or spaces (e.g. `\"AB Widget\"`), which is exactly the class\n * of bug this module exists to prevent.\n *\n * Missing or empty tags map to the implicit {@link DefaultTag} bucket.\n */\nexport function getTagKey(tag?: string): string {\n  const normalizedTag = tag?.trim();\n  return kebab(normalizedTag ? normalizedTag : DefaultTag);\n}\n\n/**\n * Canonical bucket key for an operation, derived from its primary (first) tag.\n *\n * Untagged operations resolve to the {@link DefaultTag} bucket.\n */\nexport function getOperationTagKey(operation: { tags: string[] }): string {\n  return getTagKey(operation.tags[0]);\n}\n\n/**\n * Whether an operation belongs to the given tag bucket.\n *\n * Both sides are normalised through {@link getTagKey}, so the comparison is\n * correct regardless of how `tagKey` was spelled or cased by the caller. An\n * absent (`undefined`) `tagKey` matches every operation (the \"no tag filter\"\n * case); an empty/whitespace `tagKey` is normalised to the {@link DefaultTag}\n * bucket like any other tag.\n *\n * Prefer this over hand-rolling `operation.tags[0] === tagKey`: a raw tag\n * compared against a canonical key silently fails for multi-word/acronym tags.\n */\nexport function isOperationInTagBucket(\n  operation: { tags: string[] },\n  tagKey?: string,\n): boolean {\n  if (tagKey == null) return true;\n  return getOperationTagKey(operation) === getTagKey(tagKey);\n}\n","/**\n * A lexer for the *source text* of a generated JavaScript template literal\n * (everything that goes between the backticks).\n *\n * Orval emits routes and URLs as template-literal source, mixing escaped\n * static text from the OpenAPI specification with `${...}` interpolations it\n * generates itself. Later passes need to rewrite only the interpolations\n * (URL-encoding a path parameter, rewriting it to an Angular signal call,\n * splitting a route into query-key segments) while leaving static text alone.\n *\n * Doing that with a regular expression is unsound: `\\${foo}` is escaped static\n * text, `${foo}` is an interpolation, and `\\\\${foo}` is an escaped backslash\n * followed by a real interpolation. Character-adjacency lookbehinds such as\n * `(?<!\\\\)` get all three wrong for at least one input, and each new escaping\n * rule adds another way to get them wrong (#3703).\n *\n * This module replaces those heuristics with an actual scanner: it walks the\n * source once, consuming backslash escapes as indivisible pairs and matching\n * `${` to its closing `}` by brace depth (skipping over string literals inside\n * the expression). The result is an exact token list, so callers never have to\n * infer intent from neighbouring characters.\n */\n\nexport type TemplateLiteralPart =\n  /** Static text, still in its escaped template-literal source form. */\n  | { kind: 'literal'; source: string }\n  /** The expression inside a `${...}` block, without the delimiters. */\n  | { kind: 'expression'; source: string };\n\n/**\n * Scans the expression that starts at `source[start]` (the `$` of a `${`) and\n * returns the index just past its closing `}`, or `-1` when the block is\n * unterminated. Nested braces and quoted strings inside the expression are\n * tracked so `${a ? '{' : '}'}` and `${ {a: 1}.a }` terminate correctly.\n */\nfunction findExpressionEnd(source: string, start: number): number {\n  let depth = 0;\n  let index = start + 1; // at the `{`\n\n  while (index < source.length) {\n    const char = source[index];\n\n    if (char === '\\\\') {\n      index += 2;\n      continue;\n    }\n\n    if (char === \"'\" || char === '\"' || char === '`') {\n      const quote = char;\n      index++;\n      while (index < source.length && source[index] !== quote) {\n        index += source[index] === '\\\\' ? 2 : 1;\n      }\n      // Skip the closing quote; if it is missing we fall out of the outer loop.\n      index++;\n      continue;\n    }\n\n    if (char === '{') {\n      depth++;\n    } else if (char === '}') {\n      depth--;\n      if (depth === 0) return index + 1;\n    }\n\n    index++;\n  }\n\n  return -1;\n}\n\n/**\n * Splits template-literal source into static and interpolated parts.\n *\n * Escapes are preserved verbatim in `literal` parts (the output is meant to be\n * spliced straight back into generated source), and an unterminated or\n * backslash-escaped `${` stays literal rather than being guessed at.\n */\nexport function parseTemplateLiteral(source: string): TemplateLiteralPart[] {\n  const parts: TemplateLiteralPart[] = [];\n  let literal = '';\n  let index = 0;\n\n  const flushLiteral = () => {\n    if (literal) {\n      parts.push({ kind: 'literal', source: literal });\n      literal = '';\n    }\n  };\n\n  while (index < source.length) {\n    const char = source[index];\n\n    // A backslash escape is one indivisible unit: `\\${x}` is static text and\n    // `\\\\${x}` is an escaped backslash followed by a real interpolation.\n    if (char === '\\\\') {\n      literal += source.slice(index, index + 2);\n      index += 2;\n      continue;\n    }\n\n    if (char === '$' && source[index + 1] === '{') {\n      const end = findExpressionEnd(source, index);\n      if (end !== -1) {\n        flushLiteral();\n        parts.push({\n          kind: 'expression',\n          source: source.slice(index + 2, end - 1),\n        });\n        index = end;\n        continue;\n      }\n    }\n\n    literal += char;\n    index++;\n  }\n\n  flushLiteral();\n  return parts;\n}\n\n/** Re-assembles parts produced by {@link parseTemplateLiteral} losslessly. */\nexport function stringifyTemplateLiteral(\n  parts: readonly TemplateLiteralPart[],\n): string {\n  return parts\n    .map((part) =>\n      part.kind === 'literal' ? part.source : `\\${${part.source}}`,\n    )\n    .join('');\n}\n\n/**\n * Rewrites every `${...}` expression in template-literal source, leaving\n * static text (including escaped `\\${...}` sequences) untouched.\n *\n * Returning the expression unchanged is a no-op, so this is the safe\n * replacement for `route.replaceAll(TEMPLATE_TAG_REGEX, ...)`.\n */\nexport function mapTemplateExpressions(\n  source: string,\n  mapper: (expression: string) => string,\n): string {\n  return stringifyTemplateLiteral(\n    parseTemplateLiteral(source).map((part) =>\n      part.kind === 'expression'\n        ? { kind: 'expression', source: mapper(part.source) }\n        : part,\n    ),\n  );\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\nimport { keyword } from 'esutils';\n\nimport type { NamingConvention } from '../types';\nimport { EnumGeneration, type OpenApiSchemaObject } from '../types';\nimport {\n  conventionName,\n  isNumeric,\n  jsStringEscape,\n  jsStringLiteralEscape,\n  sanitize,\n  toJsLiteral,\n} from '../utils';\n\ntype EnumConstBranch = {\n  const?: SchemaEnumValue;\n  enum?: SchemaEnumValue[];\n  title?: string;\n  type?: string | string[];\n  description?: string;\n  deprecated?: boolean;\n};\n\n/** Bridge type for enum values from AnyOtherAttribute-infected schema extensions */\ntype SchemaEnumValue = string | number | boolean | null;\n\n/** Represents x-enumnames,... and x-enumdescriptions,... values */\ntype EnumMetadata = string[] | Record<string, string>;\n\n/**\n * Normalized representation of an enum member, independent of how it was\n * authored in the OpenAPI schema (vendor extensions or `oneOf` + `const`).\n *\n * Used as the shared model for TypeScript and Zod code generation.\n */\nexport type EnumMember = {\n  value: SchemaEnumValue;\n  name?: string;\n  description?: string;\n  deprecated?: boolean;\n};\n\n/** An enum member whose value has not yet been checked to be a primitive. */\ntype RawEnumMember = Omit<EnumMember, 'value'> & { value: unknown };\n\n/**\n * Metadata describing the type and logical structure of an enum.\n */\nexport interface EnumValueInfo {\n  isHomogeneous: boolean;\n  isBoolean: boolean;\n}\n\ninterface CombinedEnumInput {\n  value: string;\n  isRef: boolean;\n  schema: OpenApiSchemaObject | undefined;\n  enumMembers?: EnumMember[];\n}\n\ninterface CombinedEnumValue {\n  value: string;\n  valueImports: string[];\n  hasNull: boolean;\n}\n\n/**\n * Map of special characters to semantic word replacements.\n *\n * Applied before naming convention transforms (PascalCase, camelCase, …) so\n * that characters which would otherwise be stripped still contribute a unique\n * segment to the generated key.  Without this, values like \"created_at\" and\n * \"-created_at\" both PascalCase to \"CreatedAt\", silently overwriting one\n * another in the generated const/enum object.\n *\n * Only characters that appear as leading/trailing modifiers in real-world\n * OpenAPI enums are mapped — the list is intentionally conservative to avoid\n * changing output for schemas that don't hit collisions.\n */\nconst ENUM_SPECIAL_CHARACTER_MAP: Record<string, string> = {\n  '-': 'minus',\n  '+': 'plus',\n};\n\n/**\n * Vendor extension keys used by various OpenAPI tools\n * to define custom names for enum members.\n */\nconst ENUM_NAME_EXTENSIONS = [\n  'x-enumNames',\n  'x-enumnames',\n  'x-enum-varnames',\n] as const;\n\n/**\n * Vendor extension keys used to provide explicit documentation or descriptions\n * for individual enum members in OpenAPI schemas.\n */\nconst ENUM_DESC_EXTENSIONS = [\n  'x-enumDescriptions',\n  'x-enumdescriptions',\n  'x-enum-descriptions',\n] as const;\n\nfunction getEnumNameMetadata(\n  schemaObject: OpenApiSchemaObject | undefined,\n): EnumMetadata | undefined {\n  if (!schemaObject || isBooleanJsonSchema(schemaObject)) return undefined;\n\n  // Find the first matching extension key present in the object\n  const key = ENUM_NAME_EXTENSIONS.find((ext) => ext in schemaObject);\n  return key ? (schemaObject[key] as EnumMetadata) : undefined;\n}\n\nfunction getEnumDescriptionMetadata(\n  schemaObject: OpenApiSchemaObject | undefined,\n): EnumMetadata | undefined {\n  if (!schemaObject || isBooleanJsonSchema(schemaObject)) return undefined;\n\n  const key = ENUM_DESC_EXTENSIONS.find((ext) => ext in schemaObject);\n  return key ? (schemaObject[key] as EnumMetadata) : undefined;\n}\n\nfunction applyEnumMetadata(\n  members: RawEnumMember[],\n  metadata: EnumMetadata | undefined,\n  key: 'name' | 'description',\n) {\n  if (!metadata) return;\n\n  if (Array.isArray(metadata)) {\n    metadata.forEach((value, index) => {\n      if (value && members[index]) {\n        members[index][key] = jsStringEscape(value);\n      }\n    });\n\n    return;\n  }\n\n  members.forEach((member) => {\n    const value = metadata[String(member.value)];\n\n    if (value) {\n      member[key] = jsStringEscape(value);\n    }\n  });\n}\n\nexport function getEnumMembers(\n  schemaObject: OpenApiSchemaObject | undefined,\n  metadataObject: OpenApiSchemaObject | undefined = schemaObject,\n): EnumMember[] {\n  if (!schemaObject || isBooleanJsonSchema(schemaObject)) {\n    return [];\n  }\n\n  const members = dedupeEnumMembersByValue(getRawEnumMembers(schemaObject));\n\n  // Apply metadata from the schema first as the fallback.\n  applyEnumMetadata(members, getEnumNameMetadata(schemaObject), 'name');\n\n  applyEnumMetadata(\n    members,\n    getEnumDescriptionMetadata(schemaObject),\n    'description',\n  );\n\n  // Metadata from the outer object (e.g. a query parameter) takes precedence.\n  if (metadataObject !== schemaObject) {\n    applyEnumMetadata(members, getEnumNameMetadata(metadataObject), 'name');\n\n    applyEnumMetadata(\n      members,\n      getEnumDescriptionMetadata(metadataObject),\n      'description',\n    );\n  }\n\n  return members.filter((member): member is EnumMember =>\n    isSchemaEnumValue(member.value),\n  );\n}\n\n/**\n * Generates the implementation of an enum from normalized enum members.\n */\nexport function getEnumImplementation(\n  members: EnumMember[],\n  options: {\n    enumGenerationType: EnumGeneration;\n    enumNamingConvention?: NamingConvention | undefined;\n  },\n): string {\n  if (options.enumGenerationType === EnumGeneration.UNION) {\n    return getEnumUnion(members);\n  }\n  const assignmentOperator =\n    options.enumGenerationType === EnumGeneration.CONST ? ':' : '=';\n  const membersWithoutNull = getEnumMembersWithoutNull(members);\n\n  const disambiguate =\n    !!options.enumNamingConvention &&\n    new Set(\n      membersWithoutNull.map((member) =>\n        deriveEnumKey(member.value, options.enumNamingConvention),\n      ),\n    ).size < membersWithoutNull.length;\n\n  let result = '';\n\n  // Detect keys that collide across different value types (e.g. string '1'\n  // vs number 1, or string 'true' vs boolean true — both stringify to the\n  // same key).  For collided keys, prefix with the value type (#4028).\n  const derivedKeys = membersWithoutNull.map((member) =>\n    member.name\n      ? member.name\n      : deriveEnumKey(member.value, options.enumNamingConvention, disambiguate),\n  );\n  const keyCounts = new Map<string, number>();\n  for (const k of derivedKeys) {\n    keyCounts.set(k, (keyCounts.get(k) ?? 0) + 1);\n  }\n\n  const usedKeys = new Set<string>();\n\n  for (let i = 0; i < membersWithoutNull.length; i++) {\n    const member = membersWithoutNull[i];\n    const value = stringifyEnumValue(member.value);\n\n    const comment = getEnumMemberComment(member);\n\n    let rawKey = member.name ? member.name : derivedKeys[i];\n\n    // Disambiguate type collisions by prefixing the runtime type name.\n    // Only apply when the key does NOT already carry a type prefix\n    // (e.g. NUMBER_ from toNumberKey).  For those, compute a fresh key\n    // from the raw string representation instead of stacking prefixes.\n    if (!member.name && (keyCounts.get(rawKey) ?? 0) > 1) {\n      const typePrefix =\n        typeof member.value === 'string'\n          ? 'STRING_'\n          : typeof member.value === 'boolean'\n            ? 'BOOLEAN_'\n            : '';\n      if (typePrefix) {\n        const fresh = deriveEnumKey(\n          member.value,\n          options.enumNamingConvention,\n          disambiguate,\n        );\n        // Strip any existing NUMBER_/STRING_ prefix before re-prefixing,\n        // but preserve PLUS_/MINUS_ sign modifiers to keep keys unique.\n        const stripped = fresh.replace(/^(NUMBER|BOOLEAN)_/, '');\n        rawKey = `${typePrefix}${stripped}`;\n      }\n    }\n\n    // A type-prefixed key can still collide with an explicit member name\n    // (e.g. values ['STRING_1', '1', 1]).  Append a numeric suffix until\n    // the key is unique.\n    if (!member.name) {\n      let candidate = rawKey;\n      let suffix = 2;\n      while (usedKeys.has(candidate)) {\n        candidate = `${rawKey}_${suffix++}`;\n      }\n      rawKey = candidate;\n    }\n    usedKeys.add(rawKey);\n\n    // Native enums do not allow quoted string literals as keys in standard TS syntax,\n    // but object literals do. Choose key representation safely.\n    const formattedKey = keyword.isIdentifierNameES5(rawKey)\n      ? rawKey\n      : `'${jsStringLiteralEscape(rawKey)}'`;\n\n    result += `${comment}  ${formattedKey}${assignmentOperator} ${value},\\n`;\n  }\n\n  return result;\n}\n\nexport function getEnum(\n  enumMembers: EnumMember[],\n  enumName: string,\n  nullable: boolean,\n  enumGenerationType: EnumGeneration,\n  enumNamingConvention?: NamingConvention,\n) {\n  if (enumGenerationType === EnumGeneration.CONST) {\n    return getTypeConstEnum(\n      enumMembers,\n      enumName,\n      nullable,\n      enumNamingConvention,\n    );\n  }\n\n  if (enumGenerationType === EnumGeneration.ENUM) {\n    return getNativeEnum(enumMembers, enumName, enumNamingConvention);\n  }\n\n  return getUnion(enumMembers, enumName);\n}\n\n/**\n * Whether a reference to the enum generated by `getEnum` has to add `| null`\n * itself. The const type alias already carries it, and a union carries it when\n * `null` is one of its members, but a native `enum` cannot hold `null` (#4203).\n */\nexport function isEnumReferenceMissingNull(\n  enumMembers: EnumMember[],\n  nullable: boolean,\n  enumGenerationType: EnumGeneration,\n): boolean {\n  if (!nullable || enumGenerationType === EnumGeneration.CONST) {\n    return false;\n  }\n\n  if (enumGenerationType === EnumGeneration.ENUM) {\n    return true;\n  }\n\n  return !enumMembers.some((member) => member.value === null);\n}\n\n/**\n * Checks whether any enum member has a name, description, or deprecation metadata.\n */\nexport function hasEnumMetadata(members: EnumMember[]): boolean {\n  return members.some(\n    (member) => member.name !== undefined || member.description !== undefined,\n  );\n}\n\nexport function getEnumValueInfo(members: EnumMember[]): EnumValueInfo {\n  const firstValue = members[0]?.value;\n  const firstType = typeof firstValue;\n\n  return {\n    isHomogeneous: members.every((member) => typeof member.value === firstType),\n    isBoolean:\n      members.length > 0 &&\n      members.every((member) => typeof member.value === 'boolean'),\n  };\n}\n\nexport function getEnumUnion(enumMembers: EnumMember[]) {\n  return enumMembers.map(({ value }) => stringifyEnumValue(value)).join(' | ');\n}\n\n/**\n * Builds the runtime value for a combined enum.\n *\n * Each input represents an individually resolved enum branch. Inline branches\n * are normalized into enum members so their names, descriptions, and\n * deprecation metadata can be preserved in the generated enum object.\n *\n * Referenced enum branches keep the existing spread and import behavior.\n */\nexport function getCombinedEnumValue(\n  inputs: CombinedEnumInput[],\n): CombinedEnumValue {\n  const membersByInput = inputs.map((input) => ({\n    input,\n    members: getEnumMembers(input.schema),\n  }));\n\n  const members = membersByInput.flatMap(({ input, members }) =>\n    input.isRef ? [] : members,\n  );\n\n  const hasNull = membersByInput.some(({ input, members }) => {\n    if (input.value === 'null' || input.value.includes('| null')) {\n      return true;\n    }\n\n    return members.some((member) => member.value === null);\n  });\n\n  const hasAnnotatedInlineEnum =\n    inputs.every((input) => !input.isRef) && hasEnumMetadata(members);\n\n  if (hasAnnotatedInlineEnum) {\n    return {\n      value: `{\n${getEnumImplementation(members, {\n  enumGenerationType: EnumGeneration.CONST,\n})}} as const`,\n      valueImports: [],\n      hasNull,\n    };\n  }\n\n  const valueImports: string[] = [];\n\n  const addValueImport = (name: string) => {\n    if (!valueImports.includes(name)) {\n      valueImports.push(name);\n    }\n  };\n\n  if (inputs.length === 1) {\n    const input = inputs[0];\n\n    if (input.isRef) {\n      const refName = stripNullUnion(input.value);\n\n      if (isSpreadableEnumRef(input.schema, refName)) {\n        addValueImport(refName);\n\n        return {\n          value: refName,\n          valueImports,\n          hasNull,\n        };\n      }\n\n      return {\n        value: `{${buildInlineEnum(input.schema)}} as const`,\n        valueImports,\n        hasNull,\n      };\n    }\n\n    return {\n      value: `{${buildInlineEnum(input.schema)}} as const`,\n      valueImports,\n      hasNull,\n    };\n  }\n\n  const enums = inputs\n    .map((input) => {\n      if (input.isRef) {\n        const refName = stripNullUnion(input.value);\n\n        if (isSpreadableEnumRef(input.schema, refName)) {\n          addValueImport(refName);\n          return `...${refName},`;\n        }\n\n        return buildInlineEnum(input.schema);\n      }\n\n      return buildInlineEnum(input.schema);\n    })\n    .join('');\n\n  return {\n    value: `{${enums}} as const`,\n    valueImports,\n    hasNull,\n  };\n}\n\nfunction getEnumMembersFromBranches(\n  schemaObject: OpenApiSchemaObject | undefined,\n  seen = new Set<object>(),\n): EnumMember[] {\n  // A spec cannot express a branch that contains itself, but a spec object\n  // built or mutated in memory can. Stop on a real cycle rather than at an\n  // arbitrary depth, so deeply nested acyclic compositions stay complete.\n  if (\n    !schemaObject ||\n    isBooleanJsonSchema(schemaObject) ||\n    seen.has(schemaObject)\n  ) {\n    return [];\n  }\n  seen.add(schemaObject);\n\n  const branches = [\n    ...(schemaObject.oneOf ?? []),\n    ...(schemaObject.anyOf ?? []),\n  ] as EnumConstBranch[];\n\n  const members: EnumMember[] = [];\n\n  for (const branch of branches) {\n    if (hasConst(branch)) {\n      members.push({\n        value: branch.const,\n        name: branch.title ? jsStringEscape(branch.title) : undefined,\n        description: branch.description\n          ? jsStringEscape(branch.description)\n          : undefined,\n        deprecated: branch.deprecated === true ? true : undefined,\n      });\n      continue;\n    }\n\n    const enumValues = getSchemaEnumValues(branch.enum);\n\n    members.push(\n      ...enumValues.map((value) => ({\n        value,\n      })),\n    );\n\n    const isNullBranch =\n      branch.type === 'null' ||\n      (Array.isArray(branch.type) && branch.type.includes('null'));\n\n    if (isNullBranch) {\n      members.push({\n        value: null,\n      });\n    }\n\n    // `type: 'null'` (or `type: ['null']`) admits no value but `null`, so a\n    // nested composition under it cannot contribute anything else. A branch\n    // that allows other types still can, so keep walking multi-type arrays.\n    const isNullOnlyBranch =\n      branch.type === 'null' ||\n      (Array.isArray(branch.type) &&\n        branch.type.length > 0 &&\n        branch.type.every((type) => type === 'null'));\n\n    // A branch can itself be a composition, e.g. the redundant but valid\n    // `anyOf: [{anyOf: [{enum}, {null}]}, {null}]` emitted by some generators.\n    // Without descending, only the outer `{type: 'null'}` is collected and the\n    // generated const ends up empty. Only walk branches that contributed no\n    // members of their own: an annotated `const`/`enum` branch keeps its own\n    // metadata. See #3951.\n    if (enumValues.length === 0 && !isNullOnlyBranch) {\n      const nestedBranch = branch as OpenApiSchemaObject;\n      if (\n        !isBooleanJsonSchema(nestedBranch) &&\n        (nestedBranch.oneOf || nestedBranch.anyOf)\n      ) {\n        members.push(...getEnumMembersFromBranches(nestedBranch, seen));\n      }\n    }\n  }\n\n  return dedupeEnumMembersByValue(members);\n}\n\n/**\n * `enum` and `const` accept any JSON value, but only primitives can become enum\n * members. The document is untrusted, so check the runtime type rather than\n * trusting the `SchemaEnumValue` cast: an array or object member would\n * otherwise be spliced raw into the generated module.\n */\nfunction isSchemaEnumValue(value: unknown): value is SchemaEnumValue {\n  return (\n    typeof value === 'string' ||\n    typeof value === 'number' ||\n    typeof value === 'boolean' ||\n    value === null\n  );\n}\n\nfunction getSchemaEnumValues(value: unknown): SchemaEnumValue[] {\n  return Array.isArray(value) ? value.filter(isSchemaEnumValue) : [];\n}\n\nfunction getRawEnumMembers(schemaObject: OpenApiSchemaObject): RawEnumMember[] {\n  if (isBooleanJsonSchema(schemaObject)) {\n    return [];\n  }\n  if ('const' in schemaObject) {\n    if (!isSchemaEnumValue(schemaObject.const)) {\n      return [];\n    }\n\n    return [\n      {\n        value: schemaObject.const as SchemaEnumValue,\n        name: schemaObject.title\n          ? jsStringEscape(schemaObject.title)\n          : undefined,\n        description: schemaObject.description\n          ? jsStringEscape(schemaObject.description)\n          : undefined,\n        deprecated: schemaObject.deprecated === true ? true : undefined,\n      },\n    ];\n  }\n\n  if (Array.isArray(schemaObject.enum)) {\n    // Non-primitive values are dropped by `getEnumMembers` only after\n    // positional `x-enumNames`/`x-enumDescriptions` are applied, so the\n    // metadata stays aligned with the values that survive.\n    return (schemaObject.enum as unknown[]).map((value) => ({\n      value,\n    }));\n  }\n\n  return getEnumMembersFromBranches(schemaObject);\n}\n\nfunction getEnumMembersWithoutNull(members: EnumMember[]): EnumMember[] {\n  return members.filter((member) => member.value !== null);\n}\n\nconst getEnumMemberComment = (member: EnumMember): string => {\n  if (member.description && member.deprecated) {\n    return `  /**\\n   * ${member.description}\\n   * @deprecated\\n   */\\n`;\n  }\n\n  if (member.description) {\n    return `  /** ${member.description} */\\n`;\n  }\n\n  if (member.deprecated) {\n    return `  /** @deprecated */\\n`;\n  }\n\n  return '';\n};\n\nconst getTypeConstEnum = (\n  enumMembers: EnumMember[],\n  enumName: string,\n  nullable: boolean,\n  enumNamingConvention?: NamingConvention,\n) => {\n  let enumValue = `export type ${enumName} = typeof ${enumName}[keyof typeof ${enumName}]`;\n\n  if (nullable) {\n    enumValue += ' | null';\n  }\n\n  enumValue += ';\\n';\n\n  const implementation = getEnumImplementation(enumMembers, {\n    enumGenerationType: EnumGeneration.CONST,\n    enumNamingConvention: enumNamingConvention,\n  });\n\n  enumValue += '\\n\\n';\n  enumValue += `export const ${enumName} = {\\n${implementation}} as const;\\n`;\n\n  return enumValue;\n};\n\nconst getNativeEnum = (\n  enumMembers: EnumMember[],\n  enumName: string,\n  enumNamingConvention?: NamingConvention,\n) => {\n  const membersWithoutNull = getEnumMembersWithoutNull(enumMembers);\n\n  const enumItems = getEnumImplementation(membersWithoutNull, {\n    enumNamingConvention: enumNamingConvention,\n    enumGenerationType: EnumGeneration.ENUM,\n  });\n\n  return `export enum ${enumName} {\\n${enumItems}\\n}`;\n};\n\nfunction getUnion(enumMembers: EnumMember[], enumName: string) {\n  return `export type ${enumName} = ${getEnumUnion(enumMembers)};`;\n}\n\nfunction getEnumUnionFromSchema(schema: OpenApiSchemaObject | undefined) {\n  if (!schema || isBooleanJsonSchema(schema) || !schema.enum) return '';\n  const schemaEnum = schema.enum as SchemaEnumValue[];\n  return schemaEnum\n    .filter((val): val is Exclude<SchemaEnumValue, null> => val !== null)\n    .map((val) => toJsLiteral(val))\n    .join(' | ');\n}\n\nconst stripNullUnion = (value: string) =>\n  value.replaceAll(/\\s*\\|\\s*null/g, '').trim();\n\nconst isSpreadableEnumRef = (\n  schema: OpenApiSchemaObject | undefined,\n  refName: string,\n) => {\n  if (!schema || isBooleanJsonSchema(schema) || !schema.enum || !refName)\n    return false;\n  if (!getEnumUnionFromSchema(schema)) return false;\n  const type = schema.type as string | string[] | undefined;\n  if (type === 'boolean' || (Array.isArray(type) && type.includes('boolean'))) {\n    return false;\n  }\n  return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(refName);\n};\n\nconst buildInlineEnum = (schema: OpenApiSchemaObject | undefined) => {\n  return getEnumImplementation(getEnumMembers(schema), {\n    enumGenerationType: EnumGeneration.CONST,\n  });\n};\n\n/**\n * Replace special characters with semantic words (plus an underscore separator)\n * so that naming convention transforms (PascalCase, etc.) produce unique keys.\n *\n * The trailing underscore acts as a word boundary so that PascalCase treats the\n * replacement as a separate word: \"-created_at\" → \"minus_created_at\" → \"MinusCreatedAt\".\n */\nfunction replaceSpecialCharacters(key: string): string {\n  let result = '';\n  for (const char of key) {\n    const replacement = ENUM_SPECIAL_CHARACTER_MAP[char];\n    result += replacement ? replacement + '_' : char;\n  }\n  return result;\n}\n\nfunction stringifyEnumValue(value: SchemaEnumValue): string {\n  return toJsLiteral(value);\n}\n\nconst toNumberKey = (value: string) => {\n  if (value.startsWith('-')) {\n    return `NUMBER_MINUS_${value.slice(1)}`;\n  }\n  if (value.startsWith('+')) {\n    return `NUMBER_PLUS_${value.slice(1)}`;\n  }\n  return `NUMBER_${value}`;\n};\n\n/**\n * Derive the object/enum key for a single enum value.\n *\n * Handles numeric prefixes, sanitization, and optional naming convention\n * transforms.  When `disambiguate` is true, special characters (-/+) are\n * replaced with semantic words before the convention transform to prevent\n * key collisions.\n */\nfunction deriveEnumKey(\n  val: string | number | boolean | null,\n  enumNamingConvention?: NamingConvention,\n  disambiguate = false,\n): string {\n  let key = String(val);\n\n  if (isNumeric(key)) {\n    key = toNumberKey(key);\n  }\n\n  if (key.length > 1) {\n    key = sanitize(key, {\n      whitespace: '_',\n      underscore: true,\n      dash: true,\n      special: true,\n    });\n  }\n\n  if (enumNamingConvention) {\n    if (disambiguate) {\n      key = replaceSpecialCharacters(key);\n    }\n\n    key = conventionName(key, enumNamingConvention);\n  }\n\n  return key;\n}\n\nfunction hasConst(\n  branch: EnumConstBranch,\n): branch is EnumConstBranch & { const: SchemaEnumValue } {\n  return 'const' in branch && isSchemaEnumValue(branch.const);\n}\n\nfunction dedupeEnumMembersByValue<T extends RawEnumMember>(members: T[]): T[] {\n  return members.filter(\n    (member, index, array) =>\n      array.findIndex((item) => item.value === member.value) === index,\n  );\n}\n","import type { ContextSpec, NormalizedOverrideOutput } from '../types';\nimport { getComponentBaseName, pascal, sanitize, upath } from '../utils';\n\n/**\n * `$ref`s targeting these sections under `#/components/...` are emitted as\n * named TypeScript imports (e.g. `import type { Pet } from './model'`).\n * Refs to any other location — for example `#/paths/.../schema` produced by\n * JSON-Schema-Ref-Parser `bundle()` — have no corresponding `export type`\n * and must be inlined by the resolver. See issue #398.\n */\nexport const NAMED_COMPONENT_SECTIONS = [\n  'schemas',\n  'responses',\n  'parameters',\n  'requestBodies',\n] as const;\n\ntype RefComponent = (typeof NAMED_COMPONENT_SECTIONS)[number];\n\nexport const RefComponentSuffix: Record<RefComponent, string> = {\n  schemas: '',\n  responses: 'Response',\n  parameters: 'Parameter',\n  requestBodies: 'Body',\n};\n\nconst COMPONENT_REF_PATTERN = new RegExp(\n  String.raw`^#\\/components\\/(${NAMED_COMPONENT_SECTIONS.join('|')})\\/[^/]+$`,\n);\n\n/**\n * True iff `ref` targets a named slot eligible for emission as a TypeScript\n * import. Used by `resolveValue` to decide between named import vs inlining\n * the resolved schema.\n */\nexport function isComponentRef(ref: string): boolean {\n  return COMPONENT_REF_PATTERN.test(ref);\n}\n\nconst TILDE_1 = /~1/g;\nconst TILDE_0 = /~0/g;\n\nexport interface RefInfo {\n  name: string;\n  originalName: string;\n  refPaths?: string[];\n}\n/**\n * Return the output type from the $ref\n *\n * @param $ref\n */\nexport function getRefInfo($ref: string, context: ContextSpec): RefInfo {\n  const [pathname, ref] = $ref.split('#');\n\n  const refPaths = ref\n    .slice(1)\n    .split('/')\n    .map((part) =>\n      decodeURIComponent(part)\n        .replaceAll(TILDE_1, '/')\n        .replaceAll(TILDE_0, '~'),\n    );\n\n  const getOverrideSuffix = (\n    override: NormalizedOverrideOutput,\n    paths: string[],\n  ) => {\n    const firstLevel = override[paths[0] as keyof NormalizedOverrideOutput];\n    if (!firstLevel) return '';\n\n    const secondLevel = (\n      firstLevel as Record<string, { suffix?: string } | undefined>\n    )[paths[1]];\n    return secondLevel?.suffix ?? '';\n  };\n\n  const getOverridePrefix = (\n    override: NormalizedOverrideOutput,\n    paths: string[],\n  ) => {\n    const firstLevel = override[paths[0] as keyof NormalizedOverrideOutput];\n    if (!firstLevel) return '';\n\n    const secondLevel = (\n      firstLevel as Record<string, { prefix?: string } | undefined>\n    )[paths[1]];\n    return secondLevel?.prefix ?? '';\n  };\n\n  const suffix = getOverrideSuffix(context.output.override, refPaths);\n  const prefix = getOverridePrefix(context.output.override, refPaths);\n\n  const originalName = ref\n    ? (refPaths.at(-1) ?? '')\n    : upath.getSchemaFileName(pathname);\n\n  if (!pathname) {\n    // Local component refs resolve through the per-section name map so keys\n    // that only differ in casing (`Address` / `address`) stay distinct (#4233).\n    const baseName =\n      refPaths.length === 3 && refPaths[0] === 'components'\n        ? getComponentBaseName(\n            context.spec.components?.[\n              refPaths[1] as keyof NonNullable<\n                ContextSpec['spec']['components']\n              >\n            ] as object | undefined,\n            originalName,\n          )\n        : pascal(originalName);\n\n    return {\n      name: sanitize(prefix + baseName + suffix, {\n        es5keyword: true,\n        es5IdentifierName: true,\n        underscore: true,\n        dash: true,\n      }),\n      originalName,\n      refPaths,\n    };\n  }\n\n  return {\n    name: sanitize(prefix + pascal(originalName) + suffix, {\n      es5keyword: true,\n      es5IdentifierName: true,\n      underscore: true,\n      dash: true,\n    }),\n    originalName,\n    refPaths,\n  };\n}\n\n/**\n * Extracts the anchor name from a fragment-only `$dynamicRef` (e.g. `#category` → `category`).\n *\n * Returns `undefined` for external-document `$dynamicRef` values (e.g. `other.json#anchor`)\n * which are not supported.\n */\nexport function getDynamicAnchorName(dynamicRef: string): string | undefined {\n  if (!dynamicRef.startsWith('#') || dynamicRef.length <= 1) {\n    return undefined;\n  }\n  return dynamicRef.slice(1);\n}\n","import type { ContextSpec, GeneratorImport, ResolverValue } from '../types';\n\ninterface GetAliasedImportsOptions {\n  name?: string;\n  resolvedValue: ResolverValue;\n  context: ContextSpec;\n}\n\nexport function getAliasedImports({\n  name,\n  resolvedValue,\n  context,\n}: GetAliasedImportsOptions): GeneratorImport[] {\n  return context.output.schemas && resolvedValue.isRef\n    ? resolvedValue.imports.map((imp) => {\n        if (\n          !needCreateImportAlias({\n            name,\n            imp,\n          })\n        ) {\n          return imp;\n        }\n\n        return {\n          ...imp,\n          alias: `__${imp.name}`,\n        };\n      })\n    : resolvedValue.imports;\n}\n\ninterface NeedCreateImportAliasOptions {\n  name?: string;\n  imp: GeneratorImport;\n}\n\nexport function needCreateImportAlias({\n  imp,\n  name,\n}: NeedCreateImportAliasOptions): boolean {\n  return !imp.alias && imp.name === name;\n}\n\ninterface GetImportAliasForRefOrValueOptions {\n  resolvedValue: ResolverValue;\n  imports: GeneratorImport[];\n  context: ContextSpec;\n}\n\nexport function getImportAliasForRefOrValue({\n  context,\n  imports,\n  resolvedValue,\n}: GetImportAliasForRefOrValueOptions): string {\n  if (!context.output.schemas || !resolvedValue.isRef) {\n    return resolvedValue.value;\n  }\n  const importWithSameName = imports.find(\n    (imp) => imp.name === resolvedValue.value,\n  );\n  return importWithSameName?.alias ?? resolvedValue.value;\n}\n","import { keyword } from 'esutils';\n\nimport { jsStringLiteralEscape } from '../utils';\n\nexport function getKey(key: string) {\n  return keyword.isIdentifierNameES5(key)\n    ? key\n    : `'${jsStringLiteralEscape(key)}'`;\n}\n\n/**\n * Emits a schema-derived name as a TypeScript *string literal type*\n * (`'petId'`), for the key positions of `Pick`, `Omit` and `Extract`.\n *\n * The sibling {@link getKey} covers the property-key position, where a valid\n * identifier may be emitted bare. A string literal type has no bare form —\n * `Extract<keyof T, petId>` is a type *reference*, not the literal `'petId'` —\n * so the name is always quoted, and therefore always has to be escaped. Left\n * unescaped, a `'` in a schema name closes the literal and the rest of the\n * name is emitted as sibling top-level source in `export type X = …;`, which\n * survives type erasure and runs when the generated module is imported\n * (GHSA-6h9g-hcv4-66p6).\n */\nexport function getStringLiteralType(name: string) {\n  return `'${jsStringLiteralEscape(name)}'`;\n}\n\n/**\n * Joins schema-derived names into a union of string literal types\n * (`'a' | 'b'`). See {@link getStringLiteralType}.\n */\nexport function getStringLiteralTypeUnion(names: readonly string[]) {\n  return names.map((name) => getStringLiteralType(name)).join(' | ');\n}\n\n/**\n * Whether a schema-derived name can be emitted as a local binding\n * (`const name`, a destructuring target): a valid identifier that is not a\n * reserved word in strict mode.\n */\nexport function isBindingIdentifier(name: string) {\n  return (\n    keyword.isIdentifierNameES5(name) && !keyword.isReservedWordES6(name, true)\n  );\n}\n\n/**\n * Emits a property access for a possibly non-identifier name: dot access for\n * valid identifier names (`.petId`), quoted bracket access otherwise\n * (`['scope.id']`).\n */\nexport function getPropertyAccessor(name: string) {\n  return keyword.isIdentifierNameES5(name) ? `.${name}` : `[${getKey(name)}]`;\n}\n\n/**\n * Returns a Set of property keys that, after applying `conventionName`,\n * would collide with another key (e.g. `first_name` and `firstName` both\n * convert to `firstName` under camelCase). The generator falls back to the\n * original (unique) schema key for these so the emitted type stays\n * collision-free. Returns an empty Set when no convention is configured.\n */\nexport function getPropertyNameCollisionKeys(\n  keys: string[],\n  convention?: (name: string) => string,\n): Set<string> {\n  const collisionKeys = new Set<string>();\n  if (!convention) {\n    return collisionKeys;\n  }\n  const convertedNames = new Map<string, string[]>();\n  for (const key of keys) {\n    const converted = convention(key);\n    const bucket = convertedNames.get(converted) ?? [];\n    bucket.push(key);\n    convertedNames.set(converted, bucket);\n  }\n  for (const bucket of convertedNames.values()) {\n    if (bucket.length > 1) {\n      for (const key of bucket) {\n        collisionKeys.add(key);\n      }\n    }\n  }\n  return collisionKeys;\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { resolveExampleRefs, resolveObject } from '../resolvers';\nimport type { SchemaType } from '../types';\nimport {\n  type ContextSpec,\n  EnumGeneration,\n  type GeneratorImport,\n  type GeneratorSchema,\n  type OpenApiNonBooleanSchemaObject,\n  type OpenApiReferenceObject,\n  type OpenApiSchemaObject,\n  type ScalarValue,\n} from '../types';\nimport { getAtPath, isNullish, unique } from '../utils';\nimport {\n  dedupeUnionType,\n  getNumberWord,\n  isInlineSchema,\n  isNullOnlyEnum,\n  isObject,\n  pascal,\n  toObjectSchema,\n} from '../utils';\nimport { getCombinedEnumValue, hasEnumMetadata, getEnumMembers } from './enum';\nimport { getAliasedImports, getImportAliasForRefOrValue } from './imports';\nimport { getKey, getStringLiteralTypeUnion } from './keys';\nimport type { FormDataContext } from './object';\nimport { getRefInfo, isComponentRef } from './ref';\nimport { getScalar } from './scalar';\n\ninterface CombinedData {\n  imports: GeneratorImport[];\n  schemas: GeneratorSchema[];\n  originalSchema: (OpenApiSchemaObject | undefined)[];\n  values: string[];\n  isRef: boolean[];\n  isEnum: boolean[];\n  types: string[];\n  hasReadonlyProps: boolean;\n  dependencies: string[];\n  /**\n   * List of all properties in all subschemas\n   * - used to add missing properties in subschemas to avoid TS error described in @see https://github.com/orval-labs/orval/issues/935\n   */\n  allProperties: string[];\n  requiredProperties: string[];\n  example?: unknown;\n  examples?: Record<string, unknown> | unknown[];\n}\n\ntype Separator = 'allOf' | 'anyOf' | 'oneOf';\nconst mergeableAllOfKeys = new Set(['type', 'properties', 'required']);\n\n/** A `const` value a runtime enum object can hold as a member. */\nfunction isScalarConst(value: unknown): boolean {\n  return (\n    value === null ||\n    typeof value === 'string' ||\n    typeof value === 'number' ||\n    typeof value === 'boolean'\n  );\n}\n\nfunction isMergeableAllOfObject(schema: OpenApiSchemaObject): boolean {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  // Must have properties to be worth merging\n  if (isNullish(schema.properties)) {\n    return false;\n  }\n\n  // Cannot merge if it contains nested composition\n  if (schema.allOf || schema.anyOf || schema.oneOf) {\n    return false;\n  }\n\n  // Only object types can be merged\n  if (!isNullish(schema.type) && schema.type !== 'object') {\n    return false;\n  }\n\n  // Only merge schemas with safe keys (type, properties, required)\n  return Object.keys(schema).every((key) => mergeableAllOfKeys.has(key));\n}\n\nfunction normalizeAllOfSchema(\n  schemaInput: OpenApiSchemaObject,\n): OpenApiNonBooleanSchemaObject {\n  const schema = toObjectSchema(schemaInput);\n  const schemaAllOf = schema.allOf;\n  if (!schemaAllOf) {\n    return schema;\n  }\n\n  let didMerge = false;\n  const schemaProperties = schema.properties;\n  const schemaRequired = schema.required;\n  const mergedProperties: Record<\n    string,\n    OpenApiSchemaObject | OpenApiReferenceObject\n  > = schemaProperties ? { ...schemaProperties } : {};\n  const mergedRequired = new Set(schemaRequired);\n  const remainingAllOf: (OpenApiSchemaObject | OpenApiReferenceObject)[] = [];\n\n  for (const subSchema of schemaAllOf) {\n    if (\n      isInlineSchema(subSchema) &&\n      !isBooleanJsonSchema(subSchema) &&\n      isMergeableAllOfObject(subSchema)\n    ) {\n      didMerge = true;\n      if (subSchema.properties) {\n        Object.assign(mergedProperties, subSchema.properties);\n      }\n      const subRequired = subSchema.required;\n      if (subRequired) {\n        for (const prop of subRequired) {\n          mergedRequired.add(prop);\n        }\n      }\n      continue;\n    }\n\n    remainingAllOf.push(subSchema);\n  }\n\n  if (!didMerge || remainingAllOf.length === 0) {\n    return schema;\n  }\n\n  return {\n    ...(schema as Record<string, unknown>),\n    ...(Object.keys(mergedProperties).length > 0 && {\n      properties: mergedProperties,\n    }),\n    ...(mergedRequired.size > 0 && { required: [...mergedRequired] }),\n    ...(remainingAllOf.length > 0 && { allOf: remainingAllOf }),\n  } as OpenApiNonBooleanSchemaObject;\n}\n\n/** True when the schema node itself is not a single object shape. */\nfunction directlyEmitsNonObjectType(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n): boolean {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  // `$ref` objects may still carry sibling keywords (OAS 3.1).\n  const objectSchema = schema as OpenApiNonBooleanSchemaObject;\n  if (objectSchema.enum) {\n    return true;\n  }\n  const type = objectSchema.type as string | string[] | undefined;\n  const isObjectType =\n    !type ||\n    type === 'object' ||\n    (Array.isArray(type) && type.length === 1 && type[0] === 'object');\n  if (!isObjectType) {\n    return true;\n  }\n  return false;\n}\n\nfunction isDirectlyNullable(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n): boolean {\n  if (isBooleanJsonSchema(schema)) {\n    return schema;\n  }\n  const objectSchema = schema as OpenApiNonBooleanSchemaObject;\n  const type = objectSchema.type as string | string[] | undefined;\n  return type === 'null' || (Array.isArray(type) && type.includes('null'));\n}\n\nfunction directlyEmitsOnlyObjectOrNull(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n): boolean {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  const objectSchema = schema as OpenApiNonBooleanSchemaObject;\n  if (objectSchema.enum) {\n    return false;\n  }\n  const type = objectSchema.type as string | string[] | undefined;\n  const hasObjectType =\n    !type ||\n    type === 'object' ||\n    (Array.isArray(type) && type.includes('object'));\n  const hasOnlyObjectAndNull =\n    !type ||\n    type === 'object' ||\n    (Array.isArray(type) &&\n      type.every((memberType) => ['object', 'null'].includes(memberType)));\n  return (\n    hasObjectType &&\n    hasOnlyObjectAndNull &&\n    Array.isArray(type) &&\n    type.includes('null')\n  );\n}\n\nfunction isEnumMember(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  context: ContextSpec,\n): boolean {\n  return resolveObject({ schema, combined: true, context }).isEnum;\n}\n\nfunction hasAllEnumMembers(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  context: ContextSpec,\n): boolean {\n  if (!isInlineSchema(schema) || isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  const compositions = [schema.allOf, schema.oneOf, schema.anyOf];\n  return compositions.some(\n    (members) =>\n      !!members?.length &&\n      members.every((member) => isEnumMember(member, context)),\n  );\n}\n\nfunction usesCanonicalNullableOneOfObject(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n): boolean {\n  if (!isInlineSchema(schema) || isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  const members = schema.oneOf;\n  if (!members) {\n    return false;\n  }\n  const isNullMember = (\n    member: OpenApiSchemaObject | OpenApiReferenceObject,\n  ): boolean => {\n    if (!isInlineSchema(member) || isBooleanJsonSchema(member)) {\n      return false;\n    }\n    const type = member.type as string | string[] | undefined;\n    return (\n      type === 'null' ||\n      (Array.isArray(type) && type.length === 1 && type[0] === 'null')\n    );\n  };\n  const nonNullMembers = members.filter((member) => !isNullMember(member));\n  const nonNullMember = nonNullMembers[0];\n  if (\n    !members.some(isNullMember) ||\n    nonNullMembers.length !== 1 ||\n    !nonNullMember ||\n    !isInlineSchema(nonNullMember) ||\n    isBooleanJsonSchema(nonNullMember)\n  ) {\n    return false;\n  }\n  const type = nonNullMember.type as string | string[] | undefined;\n  const properties = nonNullMember.properties as\n    | Record<string, unknown>\n    | undefined;\n  return (\n    (type === 'object' || (!type && !!properties)) &&\n    !!properties &&\n    Object.keys(properties).length > 0\n  );\n}\n\nfunction propagatesNullAcrossRef(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  crossesComponentRefBoundary: boolean,\n): boolean {\n  if (!crossesComponentRefBoundary) {\n    return false;\n  }\n  if (isDirectlyNullable(schema)) {\n    return true;\n  }\n  if (!isInlineSchema(schema) || isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  const anyOfMembers = schema.anyOf ?? [];\n  return anyOfMembers.some(\n    (member) => isInlineSchema(member) && isDirectlyNullable(member),\n  );\n}\n\n/**\n * True when this node can emit a branch that also omits keys contributed by\n * its `allOf` descendants. Direct non-object output escapes the full\n * intersection. Direct or inline-anyOf nullability can also escape when\n * `resolveValue` resolves this node through a component `$ref` and preserves\n * or appends `| null` outside the alias intersection. Canonical nullable oneOf\n * and all-enum sibling compositions only make the node's own properties\n * unsafe: `combineSchemas` still\n * intersects every `allOf` member with their emitted union. A non-null object\n * sibling or guaranteed properties on the parent also eliminate an\n * object-or-null member's null branch from the parent intersection, preserving\n * that member's object keys.\n */\nfunction cannotGuaranteeAllOfPropertyKeys(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  crossesComponentRefBoundary: boolean,\n  nullBranchesEliminated = false,\n): boolean {\n  if (\n    directlyEmitsNonObjectType(schema) &&\n    !(nullBranchesEliminated && directlyEmitsOnlyObjectOrNull(schema))\n  ) {\n    return true;\n  }\n  return (\n    !nullBranchesEliminated &&\n    propagatesNullAcrossRef(schema, crossesComponentRefBoundary)\n  );\n}\n\n/**\n * True when this node's own property keys are not guaranteed in `keyof` of the\n * referenced output. Nullable, enum, scalar, array, or mixed-type nodes fail\n * directly; a missing type and OAS 3.1 `type: ['object']` remain object-capable.\n *\n * anyOf/oneOf members otherwise remain safe because `combineSchemas`\n * intersects the node's own properties into every grouped branch. The exception\n * is nullability on a component `$ref` target or one of its direct inline anyOf\n * members: `resolveValue`/`getScalar` can propagate it outside the referenced\n * wrapper's allOf intersection. Inline allOf members, reference members,\n * non-null scalars, oneOf members, and nested unions stay inside the grouped\n * intersection. An all-enum composition is also unsafe because `combineValues`\n * emits the node's properties as a separate union branch instead. Finally, the\n * canonical nullable-oneOf object shortcut emits only its inline object and\n * `null`, dropping the node's own properties.\n */\nfunction cannotGuaranteeOwnPropertyKeys(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  context: ContextSpec,\n  crossesComponentRefBoundary: boolean,\n  nullBranchesEliminated = false,\n): boolean {\n  return (\n    cannotGuaranteeAllOfPropertyKeys(\n      schema,\n      crossesComponentRefBoundary,\n      nullBranchesEliminated,\n    ) ||\n    hasAllEnumMembers(schema, context) ||\n    usesCanonicalNullableOneOfObject(schema)\n  );\n}\n\n/**\n * Dereference a component `$ref`, following `$ref`-to-`$ref` chains. Returns\n * `undefined` (rather than throwing like `resolveRef`) for non-component,\n * cyclic, malformed, or unresolvable refs so callers can fall back to the\n * `Extract` guard. `seenRefs` records every visited hop and doubles as the\n * cycle guard across the whole walk.\n */\nfunction derefComponentSchema(\n  $ref: string | undefined,\n  context: ContextSpec,\n  seenRefs: Set<string>,\n): OpenApiSchemaObject | undefined {\n  let current = $ref;\n  while (current && !seenRefs.has(current) && isComponentRef(current)) {\n    seenRefs.add(current);\n    let target: unknown;\n    try {\n      const { refPaths } = getRefInfo(current, context);\n      target = Array.isArray(refPaths)\n        ? getAtPath(context.spec, refPaths)\n        : undefined;\n    } catch {\n      // getRefInfo decodes URI components and may throw on malformed refs\n      return undefined;\n    }\n    if (!isObject(target)) {\n      return undefined;\n    }\n    if (\n      !isInlineSchema(target as OpenApiSchemaObject | OpenApiReferenceObject)\n    ) {\n      // Intermediate chain hops can carry non-object-producing siblings too\n      if (cannotGuaranteeAllOfPropertyKeys(target, true)) {\n        return undefined;\n      }\n      current = (target as OpenApiReferenceObject).$ref;\n      continue;\n    }\n    return target as OpenApiSchemaObject;\n  }\n  return undefined;\n}\n\n/**\n * True when this member is guaranteed to emit a non-null object. Walk the\n * original `allOf` composition so object constraints hidden behind nested\n * component refs are not lost when normalization merges an inline member into\n * its parent. `seenRefs` keeps recursive component compositions cycle-safe.\n */\nfunction guaranteesNonNullableObject(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  context: ContextSpec,\n  seenRefs = new Set<string>(),\n  crossesComponentRefBoundary = !isInlineSchema(schema),\n): boolean {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  if (!isInlineSchema(schema)) {\n    // A nullable/non-object sibling at the ref site can be lifted outside the\n    // referenced intersection, so the target cannot prove this site non-null.\n    if (\n      cannotGuaranteeOwnPropertyKeys(\n        schema,\n        context,\n        crossesComponentRefBoundary,\n      )\n    ) {\n      return false;\n    }\n    const resolvedSchema = derefComponentSchema(schema.$ref, context, seenRefs);\n    return resolvedSchema\n      ? guaranteesNonNullableObject(resolvedSchema, context, seenRefs, true)\n      : false;\n  }\n\n  // resolveValue/getScalar preserve direct nullability or append nullability\n  // found in a directly referenced anyOf outside the alias intersection. That\n  // branch cannot be removed by a nested object within the referenced schema.\n  if (propagatesNullAcrossRef(schema, crossesComponentRefBoundary)) {\n    return false;\n  }\n\n  const properties = schema.properties as Record<string, unknown> | undefined;\n  const type = schema.type as string | string[] | undefined;\n  const isExplicitlyNonNullableObject =\n    type === 'object' ||\n    (Array.isArray(type) && type.length === 1 && type[0] === 'object');\n  const ownSchemaGuaranteesObject =\n    !cannotGuaranteeOwnPropertyKeys(\n      schema,\n      context,\n      crossesComponentRefBoundary,\n    ) &&\n    (isExplicitlyNonNullableObject ||\n      (!!properties && Object.keys(properties).length > 0));\n  if (ownSchemaGuaranteesObject) {\n    return true;\n  }\n\n  const members = schema.allOf ?? [];\n  return members.some((member) =>\n    guaranteesNonNullableObject(member, context, new Set(seenRefs)),\n  );\n}\n\n/**\n * Collect the property keys reachable through a schema's `allOf` composition,\n * resolving component `$ref` members against the spec. Feeds the\n * pickable/unresolved split for required-override keys: a key found here is\n * provably in `keyof` of the emitted intersection, so a plain\n * `Required<Pick<T, 'k'>>` is safe even when an `additionalProperties` index\n * signature would collapse the `Extract` guard to `never` (#3748). Union\n * members are deliberately not walked, while a node's own top-level properties\n * are collected when the generator intersects them into every anyOf/oneOf\n * branch. A node's own unsafe properties are skipped without discarding keys\n * from sibling `allOf` descendants that remain in the emitted intersection.\n * Nodes that can emit a branch outside that full intersection are skipped\n * entirely, degrading to the compile-safe `Extract` guard. The component-ref\n * boundary flag mirrors the only `resolveValue` path that lifts inline anyOf\n * nullability outside the alias intersection. Parent allOf traversal also uses\n * guaranteed properties on the parent or a sibling as proof that null cannot\n * survive the full intersection.\n */\nfunction collectDeepPropertyKeys(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  context: ContextSpec,\n  crossesComponentRefBoundary = false,\n  nullBranchesEliminated = false,\n  seenRefs = new Set<string>(),\n): string[] {\n  if (isBooleanJsonSchema(schema)) {\n    return [];\n  }\n  const resolvesComponentRef =\n    crossesComponentRefBoundary || !isInlineSchema(schema);\n  // Checked before dereferencing: `$ref`-site siblings (a `type` union\n  // admitting null, a scalar or mixed `type`) can change the emission just\n  // like inline nodes.\n  if (\n    cannotGuaranteeAllOfPropertyKeys(\n      schema,\n      resolvesComponentRef,\n      nullBranchesEliminated,\n    )\n  ) {\n    return [];\n  }\n  if (!isInlineSchema(schema)) {\n    const target = derefComponentSchema(schema.$ref, context, seenRefs);\n    return target\n      ? collectDeepPropertyKeys(\n          target,\n          context,\n          true,\n          nullBranchesEliminated,\n          seenRefs,\n        )\n      : [];\n  }\n  // Bridge assertion: properties is infected by AnyOtherAttribute\n  const properties = schema.properties as Record<string, unknown> | undefined;\n  const keys =\n    properties &&\n    !cannotGuaranteeOwnPropertyKeys(\n      schema,\n      context,\n      resolvesComponentRef,\n      nullBranchesEliminated,\n    )\n      ? Object.keys(properties)\n      : [];\n  const parentPropertiesEliminateNull = keys.length > 0;\n  const members = schema.allOf ?? [];\n  const guaranteedObjectMembers = members.map((member) =>\n    guaranteesNonNullableObject(member, context),\n  );\n  for (const [index, member] of members.entries()) {\n    const hasObjectSibling = guaranteedObjectMembers.some(\n      (isGuaranteedObject, siblingIndex) =>\n        siblingIndex !== index && isGuaranteedObject,\n    );\n    keys.push(\n      ...collectDeepPropertyKeys(\n        member,\n        context,\n        false,\n        nullBranchesEliminated ||\n          parentPropertiesEliminateNull ||\n          hasObjectSibling,\n        seenRefs,\n      ),\n    );\n  }\n  return keys;\n}\n\ninterface CombineValuesOptions {\n  resolvedData: CombinedData;\n  resolvedValue?: ScalarValue;\n  separator: Separator;\n  context: ContextSpec;\n  parentSchema?: OpenApiSchemaObject;\n  parentNullBranchesEliminated?: boolean;\n}\n\nfunction combineValues({\n  resolvedData,\n  resolvedValue,\n  separator,\n  context,\n  parentSchema,\n  parentNullBranchesEliminated = false,\n}: CombineValuesOptions) {\n  const isAllEnums = resolvedData.isEnum.every(Boolean);\n\n  if (isAllEnums) {\n    return `${resolvedData.values.join(` | `)}${\n      resolvedValue ? ` | ${resolvedValue.value}` : ''\n    }`;\n  }\n\n  if (separator === 'allOf') {\n    // Wrap values containing unions in parens to preserve precedence\n    // e.g. allOf: [A, oneOf: [B, C]] should be A & (B | C), not A & B | C\n    let resolvedDataValue = resolvedData.values\n      .map((v) => (v.includes(' | ') ? `(${v})` : v))\n      .join(` & `);\n    if (resolvedData.originalSchema.length > 0 && resolvedValue) {\n      // Bridge: discriminator is typed but AnyOtherAttribute infects access\n      interface Discriminator {\n        propertyName?: string;\n        mapping?: Record<string, string>;\n      }\n      const discriminatedPropertySchemas = resolvedData.originalSchema.filter(\n        (s): s is OpenApiNonBooleanSchemaObject =>\n          s !== undefined &&\n          !isBooleanJsonSchema(s) &&\n          Boolean(\n            (s.discriminator as Discriminator | undefined)?.propertyName &&\n            resolvedValue.value.includes(\n              ` ${(s.discriminator as Discriminator | undefined)?.propertyName}:`,\n            ),\n          ),\n      );\n      if (discriminatedPropertySchemas.length > 0) {\n        resolvedDataValue = `Omit<${resolvedDataValue}, ${getStringLiteralTypeUnion(\n          discriminatedPropertySchemas.map(\n            (s) =>\n              (s.discriminator as Discriminator | undefined)?.propertyName ??\n              '',\n          ),\n        )}>`;\n      }\n    }\n    // Also wrap resolvedValue if it contains union (sibling pattern: allOf + oneOf at same level)\n    const resolvedValueStr = resolvedValue?.value.includes(' | ')\n      ? `(${resolvedValue.value})`\n      : resolvedValue?.value;\n    const joined = `${resolvedDataValue}${\n      resolvedValue ? ` & ${resolvedValueStr}` : ''\n    }`;\n\n    // Parent object may have set required properties that only exist in child\n    // objects. Make sure the resulting object has these properties as required,\n    // but there is no need to override properties that are already required\n    const parentObject =\n      parentSchema !== undefined && !isBooleanJsonSchema(parentSchema)\n        ? parentSchema\n        : undefined;\n    const parentProperties = parentObject?.properties as\n      | Record<string, unknown>\n      | undefined;\n    const parentRequiredProperties = parentObject?.required;\n    const overrideRequiredProperties = resolvedData.requiredProperties.filter(\n      (prop) =>\n        !resolvedData.originalSchema.some((schema) => {\n          if (schema === undefined || isBooleanJsonSchema(schema)) return false;\n          const props = schema.properties;\n          const req = schema.required;\n          return Boolean(props?.[prop] && req?.includes(prop));\n        }) &&\n        !(parentProperties?.[prop] && parentRequiredProperties?.includes(prop)),\n    );\n    // `joined` intersects the parent's own object emission with every allOf\n    // member, so guaranteed own keys are just as safe to Pick as keys proven\n    // reachable through the member composition. A scalar/nullable/union parent\n    // may declare properties without emitting them on every branch, so keep\n    // those on the Extract-guarded path.\n    const pickableParentProperties =\n      parentSchema &&\n      parentProperties &&\n      !cannotGuaranteeOwnPropertyKeys(\n        parentSchema,\n        context,\n        false,\n        parentNullBranchesEliminated,\n      )\n        ? Object.keys(parentProperties)\n        : [];\n    // A nullable object parent's keys are not in `keyof joined`, but they are\n    // guaranteed on `NonNullable<joined>`. Keep the Extract fallback for the\n    // full nullable type and separately require these known keys on its object\n    // branch. Passing nullBranchesEliminated=true asks the same safety checks\n    // whether nullability is the only reason the own keys are unavailable.\n    const pickableNonNullParentProperties =\n      parentSchema &&\n      parentProperties &&\n      !cannotGuaranteeOwnPropertyKeys(parentSchema, context, false, true)\n        ? Object.keys(parentProperties)\n        : [];\n    // Keep the parent keys local to required-key handling: `allProperties`\n    // also drives unionAddMissingProperties for other separators and\n    // intentionally contains member keys only.\n    const pickableProperties = new Set([\n      ...resolvedData.allProperties,\n      ...pickableParentProperties,\n    ]);\n    const pickableRequiredProperties = overrideRequiredProperties.filter(\n      (prop) => pickableProperties.has(prop),\n    );\n    const unresolvedRequiredProperties = overrideRequiredProperties.filter(\n      (prop) => !pickableProperties.has(prop),\n    );\n    const nullableParentRequiredProperties =\n      unresolvedRequiredProperties.filter((prop) =>\n        pickableNonNullParentProperties.includes(prop),\n      );\n    let result = joined;\n    if (pickableRequiredProperties.length > 0) {\n      result = `${result} & Required<Pick<${joined}, ${getStringLiteralTypeUnion(pickableRequiredProperties)}>>`;\n    }\n    if (unresolvedRequiredProperties.length > 0) {\n      result = `${result} & Required<Pick<${joined}, Extract<keyof (${joined}), ${getStringLiteralTypeUnion(unresolvedRequiredProperties)}>>>`;\n    }\n    if (nullableParentRequiredProperties.length > 0) {\n      result = `${result} & (Required<Pick<NonNullable<${joined}>, ${getStringLiteralTypeUnion(nullableParentRequiredProperties)}>> | null)`;\n    }\n    if (\n      pickableRequiredProperties.length > 0 ||\n      unresolvedRequiredProperties.length > 0\n    ) {\n      return result;\n    }\n    return joined;\n  }\n\n  let values = resolvedData.values;\n  const hasObjectSubschemas = resolvedData.allProperties.length;\n  if (hasObjectSubschemas && context.output.unionAddMissingProperties) {\n    values = []; // the list of values will be rebuilt to add missing properties (if exist) in subschemas\n    for (let i = 0; i < resolvedData.values.length; i += 1) {\n      const subSchema = resolvedData.originalSchema[i];\n      if (\n        subSchema === undefined ||\n        isBooleanJsonSchema(subSchema) ||\n        subSchema.type !== 'object' ||\n        !subSchema.properties\n      ) {\n        values.push(resolvedData.values[i]);\n        continue;\n      }\n\n      const subSchemaProps = subSchema.properties as Record<string, unknown>;\n      const missingProperties = unique(\n        resolvedData.allProperties.filter(\n          (p) => !Object.keys(subSchemaProps).includes(p),\n        ),\n      );\n      values.push(\n        `${resolvedData.values[i]}${\n          missingProperties.length > 0\n            ? ` & {${missingProperties.map((p) => `${getKey(p)}?: never`).join('; ')}}`\n            : ''\n        }`,\n      );\n    }\n  }\n\n  if (resolvedValue) {\n    const resolvedValueStr = resolvedValue.value.includes(' | ')\n      ? `(${resolvedValue.value})`\n      : resolvedValue.value;\n    return values\n      .map((value) => {\n        const valueStr = value.includes(' | ') ? `(${value})` : value;\n        return `(${valueStr} & ${resolvedValueStr})`;\n      })\n      .join(' | ');\n  }\n\n  return values.join(' | ');\n}\n\nexport function combineSchemas({\n  name,\n  schema: schemaInput,\n  separator,\n  context,\n  nullable,\n  formDataContext,\n}: {\n  name?: string;\n  schema: OpenApiSchemaObject;\n  separator: Separator;\n  context: ContextSpec;\n  nullable: string;\n  formDataContext?: FormDataContext;\n}): ScalarValue {\n  const schema = toObjectSchema(schemaInput);\n  const originalAllOfMembers = schema.allOf ?? [];\n  const parentNullBranchesEliminated =\n    separator === 'allOf' &&\n    originalAllOfMembers.some((member) =>\n      guaranteesNonNullableObject(member, context),\n    );\n\n  // Normalize allOf schemas by merging inline objects into parent (fixes #2458)\n  // Only applies when: using allOf, not in v7 compat mode, no sibling oneOf/anyOf\n  const canMergeInlineAllOf =\n    separator === 'allOf' &&\n    !context.output.override.aliasCombinedTypes &&\n    !schema.oneOf &&\n    !schema.anyOf;\n\n  const normalizedSchema = canMergeInlineAllOf\n    ? normalizeAllOfSchema(schema)\n    : schema;\n\n  // Bridge assertions: AnyOtherAttribute infects all schema property access\n  const items = normalizedSchema[separator] ?? [];\n\n  const resolvedData: CombinedData = {\n    values: [],\n    imports: [],\n    schemas: [],\n    isEnum: [], // check if only enums\n    isRef: [],\n    types: [],\n    dependencies: [],\n    originalSchema: [],\n    allProperties: [],\n    hasReadonlyProps: false,\n    example: schema.example as unknown,\n    examples: resolveExampleRefs(\n      schema.examples as\n        | Record<string, OpenApiReferenceObject | { value?: unknown }>\n        | undefined,\n      context,\n    ),\n    requiredProperties:\n      separator === 'allOf' ? [...(normalizedSchema.required ?? [])] : [],\n  };\n  for (const subSchema of items) {\n    // aliasCombinedTypes (v7 compat): create intermediate types like ResponseAnyOf\n    // v8 default: propName stays undefined so combined types are inlined directly\n    let propName: string | undefined;\n    if (context.output.override.aliasCombinedTypes) {\n      propName = name ? name + pascal(separator) : undefined;\n      if (propName && resolvedData.schemas.length > 0) {\n        propName =\n          propName + pascal(getNumberWord(resolvedData.schemas.length + 1));\n      }\n    }\n\n    const resolvedValue = resolveObject({\n      schema: subSchema,\n      propName,\n      combined: true,\n      context,\n      formDataContext,\n    });\n\n    // Collect `required` from each allOf member's resolved schema. A member may\n    // carry only `required` (a constraint-only overlay) and contribute those\n    // keys to properties defined in a sibling member — including when the\n    // overlay is itself a `$ref` whose `required` lives in the referenced\n    // schema. Reading `resolvedValue.originalSchema` (the dereferenced target\n    // for component refs) covers both inline and `$ref` overlays, unlike the\n    // raw member which hides `required` behind an unresolved `$ref` or fails\n    // the `isSchema` gate when it has no `type`/`properties`. See #3663.\n    if (separator === 'allOf') {\n      const memberRequired =\n        !isBooleanJsonSchema(resolvedValue.originalSchema) &&\n        resolvedValue.originalSchema.required;\n      if (Array.isArray(memberRequired)) {\n        resolvedData.requiredProperties.push(...memberRequired);\n      }\n    }\n\n    const aliasedImports = getAliasedImports({\n      context,\n      name,\n      resolvedValue,\n    });\n\n    const value = getImportAliasForRefOrValue({\n      context,\n      resolvedValue,\n      imports: aliasedImports,\n    });\n\n    resolvedData.values.push(value);\n    resolvedData.imports.push(...aliasedImports);\n    resolvedData.schemas.push(...resolvedValue.schemas);\n    resolvedData.dependencies.push(...resolvedValue.dependencies);\n    resolvedData.isEnum.push(resolvedValue.isEnum);\n    resolvedData.types.push(resolvedValue.type);\n    resolvedData.isRef.push(resolvedValue.isRef);\n    resolvedData.originalSchema.push(resolvedValue.originalSchema);\n    if (resolvedValue.hasReadonlyProps) {\n      resolvedData.hasReadonlyProps = true;\n    }\n\n    if (resolvedValue.type === 'object') {\n      if (\n        separator === 'allOf' &&\n        typeof resolvedValue.originalSchema !== 'boolean' &&\n        isInlineSchema(resolvedValue.originalSchema)\n      ) {\n        // Walk the member's allOf composition so required keys living behind\n        // a nested `$ref` count as resolvable (#3748). Union separators keep\n        // the shallow collection: their `allProperties` also feeds\n        // unionAddMissingProperties (#935), which must only see each member's\n        // own top-level keys.\n        resolvedData.allProperties.push(\n          ...collectDeepPropertyKeys(\n            resolvedValue.originalSchema,\n            context,\n            !isInlineSchema(subSchema),\n          ),\n        );\n      } else {\n        // Bridge: originalSchema.properties is infected by AnyOtherAttribute\n        const originalProps = !isBooleanJsonSchema(resolvedValue.originalSchema)\n          ? resolvedValue.originalSchema.properties\n          : undefined;\n        if (originalProps) {\n          resolvedData.allProperties.push(...Object.keys(originalProps));\n        }\n      }\n    }\n  }\n\n  const isAllEnums = resolvedData.isEnum.every(\n    (isEnum, index) =>\n      isEnum || isNullOnlyEnum(resolvedData.originalSchema[index]),\n  );\n  // OAS 3.1 spells a nullable enum as `anyOf: [{enum: [...]}, {type: 'null'}]`.\n  // Without this, the {type: 'null'} variant flips `isEnum` to false and the\n  // enum gets inlined instead of extracted as a named type — the\n  // {type: ['string','null'], enum: [...]} spelling already extracts. Treat\n  // null-only variants as transparent so the caller's `isEnum && !isRef`\n  // branch (query-params, schema-definition, resolvers/object) extracts via\n  // getEnum, whose `stripNullUnion` handling already preserves the trailing\n  // ` | null`. See issue #2710.\n  //\n  // Guards:\n  // - `allOf` semantics are intersection, not union — `allOf: [{enum}, {null}]`\n  //   does not describe a nullable enum, so restrict to `anyOf`/`oneOf`.\n  // - Non-null branches must be inline enums (`!isRef`). For `$ref + null`\n  //   the existing referenced enum should be reused; routing through\n  //   `getEnum` would emit a parallel const that nests the original ref\n  //   (e.g. `{Status: Status}`) instead of spreading or aliasing it.\n  const isUnionLikeSeparator = separator === 'anyOf' || separator === 'oneOf';\n  const isNullableEnumComposition =\n    isUnionLikeSeparator &&\n    !isAllEnums &&\n    resolvedData.isEnum.some(Boolean) &&\n    resolvedData.isEnum.every(\n      (isEnum, index) =>\n        (isEnum && !resolvedData.isRef[index]) ||\n        resolvedData.types[index] === 'null',\n    );\n\n  const enumMembers = getEnumMembers(schema);\n  const hasAnnotatedEnum = hasEnumMetadata(enumMembers);\n  // An annotated `const` branch is not flagged `isEnum`, so the metadata path\n  // cannot require `isAllEnums`. It still needs every branch to be a value the\n  // runtime enum object can hold (`enum`, scalar `const` or `null`): any other\n  // branch, such as an array, would be dropped from the merged enum (#4239),\n  // and an object or array `const` would be stringified into invalid code.\n  const isEveryBranchEnumLike = resolvedData.isEnum.every((isEnum, index) => {\n    const branch = resolvedData.originalSchema[index];\n    return (\n      isEnum ||\n      isNullOnlyEnum(branch) ||\n      resolvedData.types[index] === 'null' ||\n      (isObject(branch) && 'const' in branch && isScalarConst(branch.const))\n    );\n  });\n  // Annotated enum compositions need a runtime enum object to preserve member\n  // metadata. Unannotated compositions keep their existing union behavior.\n  const isAvailableToGenerateCombinedEnum =\n    (isAllEnums || (hasAnnotatedEnum && isEveryBranchEnumLike)) &&\n    name &&\n    items.length > 1 &&\n    context.output.override.enumGenerationType !== EnumGeneration.UNION;\n\n  // Only generate a combined const when enum values exist at runtime.\n  if (isAvailableToGenerateCombinedEnum) {\n    const {\n      value: combinedEnumValue,\n      valueImports,\n      hasNull,\n    } = getCombinedEnumValue(\n      resolvedData.values.map((value, index) => ({\n        value,\n        isRef: resolvedData.isRef[index],\n        schema: resolvedData.originalSchema[index],\n      })),\n    );\n\n    const newEnum = `export const ${pascal(name)} = ${combinedEnumValue}`;\n    const valueImportSet = new Set(valueImports);\n    const enumNullSuffix =\n      hasNull && !nullable.includes('null') ? ' | null' : '';\n    const typeSuffix = `${nullable}${enumNullSuffix}`;\n\n    return {\n      value: `typeof ${pascal(name)}[keyof typeof ${pascal(name)}]${typeSuffix}`,\n      imports: [\n        {\n          name: pascal(name),\n        },\n      ],\n      schemas: [\n        ...resolvedData.schemas,\n        {\n          imports: resolvedData.imports\n            .filter((toImport) =>\n              valueImportSet.has(toImport.alias ?? toImport.name),\n            )\n            .map<GeneratorImport>((toImport) => ({\n              ...toImport,\n              values: true,\n            })),\n          model: newEnum,\n          name: name,\n          kind: 'enum',\n        },\n      ],\n      isEnum: false,\n      type: 'object' as SchemaType,\n      isRef: false,\n      hasReadonlyProps: resolvedData.hasReadonlyProps,\n      dependencies: resolvedData.dependencies,\n      example: schema.example as unknown,\n      examples: resolveExampleRefs(\n        schema.examples as\n          | Record<string, OpenApiReferenceObject | { value?: unknown }>\n          | undefined,\n        context,\n      ),\n    };\n  }\n\n  let resolvedValue: ScalarValue | undefined;\n\n  const normalizedProperties = normalizedSchema.properties;\n  const schemaOneOf = schema.oneOf;\n  const schemaAnyOf = schema.anyOf;\n\n  // A discriminator parent whose oneOf/anyOf members inherit the parent via\n  // allOf already carries the parent's own properties in every variant\n  // (resolveDiscriminators pushes them down). Intersecting the parent's\n  // property type onto each variant again just repeats those fields in every\n  // union branch. Detect the cycle by checking whether any resolved allOf\n  // entry in a variant overlaps with the parent's own property keys — the\n  // $ref is already dereferenced at this point so we match on property names.\n  // Plain discriminator unions where variants do NOT inherit the parent still\n  // need the parent fields intersected. See #3826.\n  const unionMembers =\n    (separator === 'oneOf'\n      ? schemaOneOf\n      : separator === 'anyOf'\n        ? schemaAnyOf\n        : undefined) ?? [];\n  const parentPropKeys = new Set(Object.keys(normalizedProperties ?? {}));\n  const isDiscriminatedRefCycle =\n    !!schema.discriminator &&\n    unionMembers.length > 0 &&\n    unionMembers.every(\n      (member) =>\n        /* oxlint-disable typescript/no-unnecessary-condition */\n        typeof member === 'object' && member !== null && '$ref' in member,\n      /* oxlint-enable typescript/no-unnecessary-condition */\n    ) &&\n    unionMembers.some((member) => {\n      if (\n        /* oxlint-disable typescript/no-unnecessary-condition */\n        typeof member !== 'object' ||\n        member === null ||\n        !('$ref' in member)\n        /* oxlint-enable typescript/no-unnecessary-condition */\n      ) {\n        return false;\n      }\n      const ref = (member as OpenApiReferenceObject).$ref;\n      if (!ref) return false;\n      const refName = ref.split('/').pop();\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      const refSchema = context.spec?.components?.schemas?.[refName ?? ''];\n      const allOf =\n        refSchema !== undefined && !isBooleanJsonSchema(refSchema)\n          ? refSchema.allOf\n          : undefined;\n      return (allOf ?? []).some((entry) => {\n        if (isBooleanJsonSchema(entry)) {\n          return false;\n        }\n        if ('$ref' in entry) {\n          return !!entry.$ref && entry.$ref.endsWith('/' + name);\n        }\n        const entryProps = Object.keys(\n          (entry as OpenApiNonBooleanSchemaObject).properties ?? {},\n        );\n        return entryProps.some((key) => parentPropKeys.has(key));\n      });\n    });\n\n  if (normalizedProperties && !isDiscriminatedRefCycle) {\n    resolvedValue = getScalar({\n      item: Object.fromEntries(\n        Object.entries(normalizedSchema).filter(([key]) => key !== separator),\n      ),\n      name,\n      context,\n      formDataContext,\n    });\n  } else if (separator === 'allOf' && (schemaOneOf || schemaAnyOf)) {\n    // Handle sibling pattern: allOf + oneOf/anyOf at same level\n    // e.g. { allOf: [A], oneOf: [B, C] } should produce A & (B | C)\n    const siblingCombiner = schemaOneOf ? 'oneOf' : 'anyOf';\n    const siblingSchemas = schemaOneOf ?? schemaAnyOf;\n    resolvedValue = combineSchemas({\n      schema: { [siblingCombiner]: siblingSchemas },\n      name,\n      separator: siblingCombiner,\n      context,\n      nullable: '',\n    });\n  }\n\n  const value = combineValues({\n    resolvedData,\n    separator,\n    resolvedValue,\n    context,\n    parentSchema: normalizedSchema,\n    parentNullBranchesEliminated,\n  });\n\n  return {\n    value: dedupeUnionType(value + nullable),\n    imports: resolvedValue\n      ? [...resolvedData.imports, ...resolvedValue.imports]\n      : resolvedData.imports,\n    schemas: resolvedValue\n      ? [...resolvedData.schemas, ...resolvedValue.schemas]\n      : resolvedData.schemas,\n    dependencies: resolvedValue\n      ? [...resolvedData.dependencies, ...resolvedValue.dependencies]\n      : resolvedData.dependencies,\n    isEnum: isNullableEnumComposition,\n    type: 'object' as SchemaType,\n    isRef: false,\n    hasReadonlyProps:\n      resolvedData.hasReadonlyProps ||\n      (resolvedValue?.hasReadonlyProps ?? false),\n    example: schema.example as unknown,\n    examples: resolveExampleRefs(\n      schema.examples as\n        | Record<string, OpenApiReferenceObject | { value?: unknown }>\n        | undefined,\n      context,\n    ),\n  };\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { resolveExampleRefs, resolveValue } from '../resolvers';\nimport { resolveObject } from '../resolvers/object';\nimport type { SchemaType } from '../types';\nimport {\n  type ContextSpec,\n  type GeneratorImport,\n  type OpenApiNonBooleanSchemaObject,\n  type OpenApiReferenceObject,\n  type OpenApiSchemaObject,\n  PropertySortOrder,\n  type ScalarValue,\n} from '../types';\nimport {\n  compareNatural,\n  getComponentBaseNames,\n  isInlineSchema,\n  isString,\n  jsDoc,\n  jsStringLiteralEscape,\n  pascal,\n  toJsLiteral,\n  toObjectSchema,\n} from '../utils';\nimport { conventionName } from '../utils/case';\nimport { combineSchemas } from './combine';\nimport { getAliasedImports, getImportAliasForRefOrValue } from './imports';\nimport { getKey, getPropertyNameCollisionKeys } from './keys';\nimport { getRefInfo } from './ref';\n\ninterface PropertyNamesKeyType {\n  value: string;\n  imports: GeneratorImport[];\n  dependencies: string[];\n}\n\nfunction getPropertyNamesEnumKeyType(\n  item: OpenApiSchemaObject,\n): PropertyNamesKeyType | undefined {\n  if (\n    isBooleanJsonSchema(item) ||\n    !('propertyNames' in item) ||\n    !item.propertyNames\n  ) {\n    return undefined;\n  }\n\n  const propertyNames = item.propertyNames as {\n    enum?: unknown[];\n    const?: unknown;\n  };\n\n  if (Array.isArray(propertyNames.enum)) {\n    const enumValues = propertyNames.enum.filter((val): val is string =>\n      isString(val),\n    );\n\n    if (enumValues.length > 0) {\n      return {\n        value: enumValues\n          .map((val) => `'${jsStringLiteralEscape(val)}'`)\n          .join(' | '),\n        imports: [],\n        dependencies: [],\n      };\n    }\n  }\n\n  if (isString(propertyNames.const)) {\n    return {\n      value: `'${jsStringLiteralEscape(propertyNames.const)}'`,\n      imports: [],\n      dependencies: [],\n    };\n  }\n\n  return undefined;\n}\n\n/**\n * Resolve a narrowed key type from OpenAPI 3.1 propertyNames.\n * Supports inline enum/const and $ref string enums.\n */\nfunction getPropertyNamesKeyType(\n  item: OpenApiSchemaObject,\n  context: ContextSpec,\n): PropertyNamesKeyType | undefined {\n  if (isBooleanJsonSchema(item)) {\n    return undefined;\n  }\n  const inlineKeyType = getPropertyNamesEnumKeyType(item);\n  if (inlineKeyType) {\n    return inlineKeyType;\n  }\n\n  const propertyNames = item.propertyNames;\n  if (!propertyNames || isInlineSchema(propertyNames)) {\n    return undefined;\n  }\n\n  const resolvedValue = resolveValue({\n    schema: propertyNames,\n    context,\n  });\n\n  const originalSchema = resolvedValue.originalSchema;\n  if (isBooleanJsonSchema(originalSchema)) {\n    return undefined;\n  }\n  const resolvedConst = originalSchema.const;\n  const isStringConst =\n    resolvedValue.type === 'string' && isString(resolvedConst);\n\n  if (!resolvedValue.isEnum && !isStringConst) {\n    return undefined;\n  }\n\n  return {\n    value: resolvedValue.value,\n    imports: resolvedValue.imports,\n    dependencies: resolvedValue.dependencies,\n  };\n}\n\n/**\n * True when `propertyNames` narrows the key type to a finite set of literals\n * — an inline `enum`/`const`, or a `$ref` to a string enum/const — the only\n * cases `getObject` types as `Partial<Record<K, V>>` rather than a plain\n * index signature. Anything else under `propertyNames` (`format`, `pattern`,\n * `minLength`, or its absence) types as `[key: string]: V`, which an\n * `Object.keys` loop can index without a compile error. Callers outside this\n * module (the date transform's map-traversal gate) should use this instead\n * of re-deriving the predicate, so both stay in lockstep with `getObject`.\n */\nexport function hasNarrowedPropertyNames(\n  item: OpenApiSchemaObject,\n  context: ContextSpec,\n): boolean {\n  return getPropertyNamesKeyType(item, context) !== undefined;\n}\n\n/**\n * Generate index signature key type based on propertyNames enum or const\n * Returns union type string like \"'foo' | 'bar'\", \"'x'\", or 'string' if neither\n */\nfunction getIndexSignatureKey(item: OpenApiSchemaObject): string {\n  return getPropertyNamesEnumKeyType(item)?.value ?? 'string';\n}\n\nfunction getPropertyNamesRecordType(\n  item: OpenApiSchemaObject,\n  valueType: string,\n  context: ContextSpec,\n): (PropertyNamesKeyType & { value: string }) | undefined {\n  const keyType = getPropertyNamesKeyType(item, context);\n  if (!keyType) {\n    return undefined;\n  }\n\n  return {\n    ...keyType,\n    value: `Partial<Record<${keyType.value}, ${valueType}>>`,\n  };\n}\n\n/**\n * Context for form request body (multipart/form-data and\n * application/x-www-form-urlencoded) type generation.\n * Discriminated union with two states:\n *\n * 1. `{ atPart: false, encoding }` - At form root, before property iteration\n *    - May traverse through allOf/anyOf/oneOf to reach properties\n *    - Carries encoding map so getObject can look up `encoding[key]`\n *\n * 2. `{ atPart: true, partContentType }` - At a multipart part (top-level property)\n *    - `partContentType` = Encoding Object's `contentType` for this part\n *    - Used by getScalar for file type detection (precedence over contentMediaType)\n *    - Arrays pass this through to items; combiners inside arrays also get context\n *\n * `urlEncoded` marks an application/x-www-form-urlencoded body. Such bodies are\n * built with URLSearchParams, whose values are always strings, so getScalar\n * keeps file/binary fields as `string` instead of `Blob` (#1624).\n *\n * `undefined` means not in form context (or nested inside plain object field = JSON)\n */\nexport type FormDataContext =\n  | {\n      atPart: false;\n      encoding: Record<string, { contentType?: string }>;\n      urlEncoded?: boolean;\n    }\n  | { atPart: true; partContentType?: string; urlEncoded?: boolean };\n\ninterface GetObjectOptions {\n  item: OpenApiSchemaObject;\n  name?: string;\n  context: ContextSpec;\n  nullable: string;\n  /**\n   * Multipart/form-data context for file type handling.\n   * @see FormDataContext\n   */\n  formDataContext?: FormDataContext;\n}\n\nfunction getNormalizedComponentSchemaNames(context: ContextSpec): Set<string> {\n  context.normalizedComponentSchemaNames ??= new Set(\n    getComponentBaseNames(context.spec.components?.schemas).values(),\n  );\n\n  return context.normalizedComponentSchemaNames;\n}\n\n/**\n * Return the output type from an object\n *\n * @param item item with type === \"object\"\n */\nexport function getObject({\n  item,\n  name,\n  context,\n  nullable,\n  formDataContext,\n}: GetObjectOptions): ScalarValue {\n  if (!isInlineSchema(item)) {\n    const { name } = getRefInfo((item as OpenApiReferenceObject).$ref, context);\n    return {\n      value: name + nullable,\n      imports: [{ name }],\n      schemas: [],\n      isEnum: false,\n      type: 'object',\n      isRef: true,\n      hasReadonlyProps: Boolean((item as Record<string, unknown>).readOnly),\n      dependencies: [name],\n      example: (item as Record<string, unknown>).example,\n      examples: resolveExampleRefs(\n        (item as Record<string, unknown>).examples as\n          | Record<string, OpenApiReferenceObject | { value?: unknown }>\n          | undefined,\n        context,\n      ),\n    };\n  }\n\n  const objectItem = toObjectSchema(item);\n  const schemaItem = objectItem as OpenApiNonBooleanSchemaObject &\n    Record<string, unknown>;\n  const itemAllOf = schemaItem.allOf;\n  const itemOneOf = schemaItem.oneOf;\n  const itemAnyOf = schemaItem.anyOf;\n  const itemType = schemaItem.type as string | string[] | undefined;\n\n  if (itemAllOf || itemOneOf || itemAnyOf) {\n    const separator = itemAllOf ? 'allOf' : itemOneOf ? 'oneOf' : 'anyOf';\n\n    // A nullable object spelled as the explicit OAS 3.1 composition\n    // `anyOf|oneOf: [{ inline object with properties }, { type: 'null' }]` must\n    // keep its `name` so nested enum properties are extracted into named\n    // `as const` consts. Routing it through combineSchemas resolves the object\n    // member with `combined: true` and an undefined propName, which drops the\n    // name and inlines those enums. Divert the single object member to the\n    // property-iteration path instead — the same fix #3340 applied one level\n    // down for the `type: ['object', 'null']` shape. See issue #3563.\n    // Real unions, `$ref` object members, primitive members, and empty objects\n    // keep the combineSchemas behavior via the guard below.\n    //\n    // Read members from the active `separator` (not `itemAnyOf ?? itemOneOf`)\n    // so this check and the combineSchemas fallback below operate on the same\n    // composition. `allOf` is intersection, not a nullable union, so it yields\n    // no members here and always falls through to combineSchemas.\n    const members =\n      separator === 'anyOf'\n        ? itemAnyOf\n        : separator === 'oneOf'\n          ? itemOneOf\n          : undefined;\n    if (members) {\n      const isNullMember = (\n        member: OpenApiSchemaObject | OpenApiReferenceObject,\n      ): boolean => {\n        if (!isInlineSchema(member) || isBooleanJsonSchema(member)) {\n          return false;\n        }\n        const memberType = member.type as string | string[] | undefined;\n        return (\n          memberType === 'null' ||\n          (Array.isArray(memberType) &&\n            memberType.length === 1 &&\n            memberType[0] === 'null')\n        );\n      };\n\n      const nonNullMembers = members.filter((member) => !isNullMember(member));\n      const nonNullMember = nonNullMembers[0];\n      // Bridge assertion: AnyOtherAttribute infects member property access to\n      // `any`; cast to the documented shapes after excluding `$ref` members.\n      const nonNullMemberType =\n        nonNullMember &&\n        isInlineSchema(nonNullMember) &&\n        !isBooleanJsonSchema(nonNullMember)\n          ? (nonNullMember.type as string | string[] | undefined)\n          : undefined;\n      const nonNullMemberProperties =\n        nonNullMember &&\n        isInlineSchema(nonNullMember) &&\n        !isBooleanJsonSchema(nonNullMember)\n          ? nonNullMember.properties\n          : undefined;\n\n      const isNullableObjectComposition =\n        members.some(isNullMember) &&\n        /* oxlint-disable typescript/no-unnecessary-condition */\n        nonNullMembers.length === 1 &&\n        nonNullMember !== undefined &&\n        isInlineSchema(nonNullMember) &&\n        (nonNullMemberType === 'object' ||\n          (nonNullMemberType === undefined &&\n            nonNullMemberProperties !== undefined)) &&\n        nonNullMemberProperties !== undefined &&\n        Object.keys(nonNullMemberProperties).length > 0;\n      /* oxlint-enable typescript/no-unnecessary-condition */\n\n      if (isNullableObjectComposition) {\n        // `nullable` is empty for the composition form (the null lives in a\n        // member, not on the parent), so synthesize ` | null`; the\n        // property-iteration path appends it to the rendered object.\n        return getObject({\n          item: nonNullMember,\n          name,\n          context,\n          nullable: nullable || ' | null',\n          formDataContext,\n        });\n      }\n    }\n\n    return combineSchemas({\n      schema: schemaItem,\n      name,\n      separator,\n      context,\n      nullable,\n      formDataContext,\n    });\n  }\n\n  if (Array.isArray(itemType)) {\n    const typeArray = itemType;\n    // A nullable object (`type: ['object', 'null']`, e.g. OAS 3.0 `nullable: true`\n    // after the @scalar upgrade) must stay on the object property-iteration path\n    // below so its `name` is preserved and nested enum properties keep being\n    // extracted into named consts. Routing it through combineSchemas resolves the\n    // object variant with an undefined propName, which drops the name and inlines\n    // those enums instead. See issue #3340. Real unions (e.g. `['string', 'number']`)\n    // keep the combineSchemas path.\n    const nonNullTypes = typeArray.filter((type) => type !== 'null');\n    const typeArrayProperties = schemaItem.properties;\n    // Only divert when there are properties to walk — an empty nullable object\n    // has no nested enums to extract, and routing it through the property path\n    // would render it as `unknown` instead of `{ [key: string]: unknown }`.\n    const isNullableObject =\n      nonNullTypes.length === 1 &&\n      nonNullTypes[0] === 'object' &&\n      typeArrayProperties !== undefined &&\n      Object.keys(typeArrayProperties).length > 0;\n\n    if (!isNullableObject) {\n      // Bridge: item is OpenApiSchemaObject which includes AnyOtherAttribute index signature.\n      // Spreading it directly would carry `any` into the result. Cast to break the chain.\n      const baseItem = schemaItem as Record<string, unknown>;\n      return combineSchemas({\n        schema: {\n          anyOf: typeArray.map(\n            (type) => ({ ...baseItem, type }) as OpenApiSchemaObject,\n          ),\n        },\n        name,\n        separator: 'anyOf',\n        context,\n        nullable,\n      });\n    }\n    // Fall through to the property-iteration path; `nullable` already carries\n    // the ` | null` computed by getScalar for this type array.\n  }\n\n  const itemProperties = schemaItem.properties;\n\n  if (itemProperties && Object.entries(itemProperties).length > 0) {\n    const entries = Object.entries(itemProperties);\n    if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {\n      entries.sort((a, b) => {\n        return compareNatural(a[0], b[0]);\n      });\n    }\n\n    // Phase 1: detect property-name collisions from namingConvention\n    const propertyConvention =\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      context.output.override.namingConvention?.properties;\n    const collisionKeys = getPropertyNameCollisionKeys(\n      entries.map(([key]) => key),\n      propertyConvention\n        ? (name) => conventionName(name, propertyConvention)\n        : undefined,\n    );\n\n    const acc: ScalarValue = {\n      imports: [],\n      schemas: [],\n      value: '',\n      isEnum: false,\n      type: 'object' as SchemaType,\n      isRef: false,\n      hasReadonlyProps: false,\n      useTypeAlias: false,\n      dependencies: [],\n      example: schemaItem.example,\n      examples: resolveExampleRefs(\n        schemaItem.examples as\n          | Record<string, OpenApiReferenceObject | { value?: unknown }>\n          | undefined,\n        context,\n      ),\n    };\n    const itemRequired = schemaItem.required;\n    for (const [index, [key, schema]] of entries.entries()) {\n      const isRequired = (\n        Array.isArray(itemRequired) ? itemRequired : []\n      ).includes(key);\n\n      let propName = '';\n\n      if (name) {\n        const isKeyStartWithUnderscore = key.startsWith('_');\n\n        propName += pascal(\n          `${isKeyStartWithUnderscore ? '_' : ''}${name}_${key}`,\n        );\n      }\n\n      const isNameAlreadyTaken =\n        getNormalizedComponentSchemaNames(context).has(propName);\n\n      if (isNameAlreadyTaken) {\n        propName = propName + 'Property';\n      }\n\n      // Transition form context: atPart: false → atPart: true\n      // Look up encoding[key].contentType and pass to property resolution.\n      // The urlEncoded flag is carried through so nested scalars stay strings.\n      const propertyFormDataContext: FormDataContext | undefined =\n        formDataContext && !formDataContext.atPart\n          ? {\n              atPart: true,\n              partContentType: formDataContext.encoding[key]?.contentType,\n              urlEncoded: formDataContext.urlEncoded,\n            }\n          : undefined;\n\n      const resolvedValue = resolveObject({\n        schema,\n        propName,\n        context,\n        formDataContext: propertyFormDataContext,\n      });\n\n      const isReadOnly =\n        Boolean(schemaItem.readOnly) ||\n        Boolean(\n          /* oxlint-disable typescript/no-unnecessary-condition */\n          typeof schema === 'object' &&\n          schema !== null &&\n          (schema as OpenApiNonBooleanSchemaObject).readOnly,\n          /* oxlint-enable typescript/no-unnecessary-condition */\n        );\n      if (!index) {\n        acc.value += '{';\n      }\n\n      const doc = jsDoc(schema, true, context);\n      const propertyDoc = doc\n        ? `${doc\n            .trimEnd()\n            .split('\\n')\n            .map((line) => `  ${line}`)\n            .join('\\n')}\\n`\n        : '';\n\n      // Propagate readonly state from nested schemas ($ref targets or inline\n      // objects), not just this property's own readOnly flag. Otherwise an\n      // object whose readonly props come solely from nested schemas is never\n      // wrapped in `NonReadonly<>`, leaking the readonly modifier into request\n      // body types. See issue #826.\n      if (isReadOnly || resolvedValue.hasReadonlyProps) {\n        acc.hasReadonlyProps = true;\n      }\n\n      const constValue =\n        // oxlint-disable-next-line typescript/no-unnecessary-condition\n        typeof schema === 'object' && schema !== null && 'const' in schema\n          ? schema.const\n          : undefined;\n      const hasConst = constValue !== undefined;\n      const constLiteral = hasConst ? toJsLiteral(constValue) : undefined;\n\n      const needsValueImport =\n        hasConst && (resolvedValue.isEnum || resolvedValue.type === 'enum');\n      const usedResolvedValue = !hasConst || needsValueImport;\n\n      const aliasedImports: GeneratorImport[] = needsValueImport\n        ? resolvedValue.imports.map((imp) => ({ ...imp, isConstant: true }))\n        : hasConst\n          ? []\n          : getAliasedImports({ name, context, resolvedValue });\n\n      if (aliasedImports.length > 0) {\n        acc.imports.push(...aliasedImports);\n      }\n\n      const alias = getImportAliasForRefOrValue({\n        context,\n        resolvedValue,\n        imports: aliasedImports,\n      });\n\n      const propValue = needsValueImport ? alias : (constLiteral ?? alias);\n\n      const finalPropValue = isRequired\n        ? propValue\n        : context.output.override.useNullForOptional === true\n          ? `${propValue} | null`\n          : propValue;\n\n      acc.value += `\\n${propertyDoc}${\n        isReadOnly && !context.output.override.suppressReadonlyModifier\n          ? '  readonly '\n          : '  '\n      }${getKey(\n        propertyConvention\n          ? collisionKeys.has(key)\n            ? key // collision: fall back to the original (unique) schema key\n            : conventionName(key, propertyConvention)\n          : key,\n      )}${isRequired ? '' : '?'}: ${finalPropValue};`;\n      if (usedResolvedValue) {\n        acc.schemas.push(...resolvedValue.schemas);\n        acc.dependencies.push(...resolvedValue.dependencies);\n      }\n\n      if (entries.length - 1 === index) {\n        // OpenAPI 3.1: `unevaluatedProperties` supersedes `additionalProperties`\n        // in composed schemas. Both carry boolean | SchemaObject | ReferenceObject\n        // and both mean \"extra keys are allowed with this value type\", so they\n        // render identically as an index signature / Record intersection.\n        // See issue #2156.\n        const additionalProps =\n          schemaItem.additionalProperties ?? schemaItem.unevaluatedProperties;\n        if (additionalProps) {\n          if (additionalProps === true) {\n            const recordType = getPropertyNamesRecordType(\n              schemaItem,\n              'unknown',\n              context,\n            );\n            if (recordType) {\n              acc.value += '\\n}';\n              acc.value += ` & ${recordType.value}`;\n              acc.useTypeAlias = true;\n              acc.imports.push(...recordType.imports);\n              acc.dependencies.push(...recordType.dependencies);\n            } else {\n              const keyType = getIndexSignatureKey(schemaItem);\n              acc.value += `\\n  [key: ${keyType}]: unknown;\\n }`;\n            }\n          } else {\n            const resolvedValue = resolveValue({\n              schema: additionalProps,\n              name,\n              context,\n            });\n            const recordType = getPropertyNamesRecordType(\n              schemaItem,\n              resolvedValue.value,\n              context,\n            );\n            if (recordType) {\n              // `propertyNames` constrains the keys to a literal union, so this\n              // emits `Partial<Record<'a' | 'b', T>>` — specific optional keys,\n              // not a string index signature. Named properties never collide\n              // with it, so keep the precise additionalProperties value type.\n              acc.value += '\\n}';\n              acc.value += ` & ${recordType.value}`;\n              acc.useTypeAlias = true;\n              acc.imports.push(...recordType.imports);\n              acc.dependencies.push(...recordType.dependencies);\n              acc.imports.push(...resolvedValue.imports);\n              acc.schemas.push(...resolvedValue.schemas);\n              acc.dependencies.push(...resolvedValue.dependencies);\n            } else {\n              // A bare `[key: string]: T` index signature also covers the named\n              // keys, so any named property whose type differs from T makes the\n              // object unrepresentable (TS2411) — or unconstructable if T is\n              // pushed into an intersection, since the index still constrains\n              // the named keys. Fall back to `unknown`, matching\n              // `additionalProperties: true`, so the generated type stays valid\n              // and assignable regardless of the named property types. The\n              // additionalProperties value type (and its imports) is dropped\n              // here, so it is intentionally not pushed. See issues #3321 / #3255.\n              const keyType = getIndexSignatureKey(schemaItem);\n              acc.value += `\\n  [key: ${keyType}]: unknown;\\n}`;\n            }\n          }\n        } else {\n          acc.value += '\\n}';\n        }\n\n        acc.value += nullable;\n      }\n    }\n    return acc;\n  }\n\n  // Unevaluated fallback mirrors the first spot above (see issue #2156).\n  const outerAdditionalProps =\n    schemaItem.additionalProperties ?? schemaItem.unevaluatedProperties;\n  const readOnlyFlag = schemaItem.readOnly;\n  if (outerAdditionalProps) {\n    if (outerAdditionalProps === true) {\n      const recordType = getPropertyNamesRecordType(\n        schemaItem,\n        'unknown',\n        context,\n      );\n      if (recordType) {\n        return {\n          value: recordType.value + nullable,\n          imports: recordType.imports,\n          schemas: [],\n          isEnum: false,\n          type: 'object',\n          isRef: false,\n          hasReadonlyProps: readOnlyFlag ?? false,\n          useTypeAlias: true,\n          dependencies: recordType.dependencies,\n        };\n      }\n      const keyType = getIndexSignatureKey(schemaItem);\n      return {\n        value: `{ [key: ${keyType}]: unknown }` + nullable,\n        imports: [],\n        schemas: [],\n        isEnum: false,\n        type: 'object',\n        isRef: false,\n        hasReadonlyProps: readOnlyFlag ?? false,\n        useTypeAlias: false,\n        dependencies: [],\n      };\n    }\n    const resolvedValue = resolveValue({\n      schema: outerAdditionalProps,\n      name,\n      context,\n    });\n    const recordType = getPropertyNamesRecordType(\n      schemaItem,\n      resolvedValue.value,\n      context,\n    );\n    if (recordType) {\n      return {\n        value: recordType.value + nullable,\n        imports: [...recordType.imports, ...resolvedValue.imports],\n        schemas: resolvedValue.schemas,\n        isEnum: false,\n        type: 'object',\n        isRef: false,\n        hasReadonlyProps: resolvedValue.hasReadonlyProps,\n        useTypeAlias: true,\n        dependencies: [\n          ...recordType.dependencies,\n          ...resolvedValue.dependencies,\n        ],\n      };\n    }\n    const keyType = getIndexSignatureKey(schemaItem);\n    return {\n      value: `{[key: ${keyType}]: ${resolvedValue.value}}` + nullable,\n      imports: resolvedValue.imports,\n      schemas: resolvedValue.schemas,\n      isEnum: false,\n      type: 'object',\n      isRef: false,\n      hasReadonlyProps: resolvedValue.hasReadonlyProps,\n      useTypeAlias: false,\n      dependencies: resolvedValue.dependencies,\n    };\n  }\n\n  const constValue = schemaItem.const;\n  if (constValue !== undefined) {\n    let type: SchemaType;\n    if (Array.isArray(constValue)) {\n      type = 'array';\n    } else if (constValue === null) {\n      type = 'null';\n    } else if (typeof constValue === 'string') {\n      type = 'string';\n    } else if (typeof constValue === 'number') {\n      type = 'number';\n    } else if (typeof constValue === 'boolean') {\n      type = 'boolean';\n    } else {\n      type = 'object';\n    }\n\n    return {\n      value: toJsLiteral(constValue),\n      imports: [],\n      schemas: [],\n      isEnum: false,\n      type,\n      isRef: false,\n      hasReadonlyProps: readOnlyFlag ?? false,\n      dependencies: [],\n    };\n  }\n\n  const keyType =\n    itemType === 'object' ? getIndexSignatureKey(schemaItem) : 'string';\n  const recordType = getPropertyNamesRecordType(schemaItem, 'unknown', context);\n  if (itemType === 'object' && recordType) {\n    return {\n      value: recordType.value + nullable,\n      imports: recordType.imports,\n      schemas: [],\n      isEnum: false,\n      type: 'object',\n      isRef: false,\n      hasReadonlyProps: readOnlyFlag ?? false,\n      useTypeAlias: true,\n      dependencies: recordType.dependencies,\n    };\n  }\n  return {\n    value:\n      (itemType === 'object' ? `{ [key: ${keyType}]: unknown }` : 'unknown') +\n      nullable,\n    imports: [],\n    schemas: [],\n    isEnum: false,\n    type: 'object',\n    isRef: false,\n    hasReadonlyProps: readOnlyFlag ?? false,\n    useTypeAlias: false,\n    dependencies: [],\n  };\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { resolveExampleRefs } from '../resolvers';\nimport type {\n  ContextSpec,\n  OpenApiPrimitiveSchemaType,\n  OpenApiSchemaObject,\n  ScalarValue,\n} from '../types';\nimport { toJsLiteral } from '../utils';\nimport { isNullOnlyEnum, isStringLikeSchema } from '../utils/assertion';\nimport { getFormDataFieldFileType } from '../utils/content-type';\nimport { getArray } from './array';\nimport { combineSchemas } from './combine';\nimport type { FormDataContext } from './object';\nimport { getObject } from './object';\n\n/** Bridge type for enum values extracted from OpenAPI schemas infected by AnyOtherAttribute */\ntype SchemaEnumValue = string | number | boolean | null;\n\n/**\n * Returns true when a schema describes a raw binary string scalar — i.e. one\n * that getScalar's `case 'string':` branch would coerce to `Blob` outside a\n * url-encoded context (see the formDataContext.urlEncoded gate below). Shared\n * with resolveValue so the component-`$ref` urlEncoded short-circuit and the\n * inline scalar path stay in lockstep when new binary shapes are added\n * (#1624 / #3395 / #2410).\n *\n * Accepts OAS 3.1 nullable unions (`type: ['string', 'null']`) since getScalar\n * normalizes those into `case 'string':` before invoking this predicate.\n */\nexport function isBinaryScalarSchema(schema: OpenApiSchemaObject): boolean {\n  if (isBooleanJsonSchema(schema) || !isStringLikeSchema(schema)) {\n    return false;\n  }\n  if (schema.format === 'binary') {\n    return true;\n  }\n  // The @scalar/openapi-parser upgrader rewrites format: binary to\n  // contentMediaType: application/octet-stream during Swagger 2.0 / OAS 3.0 →\n  // OAS 3.1 upgrades; treat the upgraded shape the same. A non-empty\n  // contentEncoding signals an encoded string payload (e.g. base64), not raw\n  // binary.\n  const contentMediaType = schema.contentMediaType;\n  const contentEncoding = schema.contentEncoding;\n  return contentMediaType === 'application/octet-stream' && !contentEncoding;\n}\n\ninterface GetScalarOptions {\n  item: OpenApiSchemaObject;\n  name?: string;\n  context: ContextSpec;\n  formDataContext?: FormDataContext;\n}\n\n/**\n * Return the typescript equivalent of open-api data type\n *\n * @param item\n * @ref https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#data-types\n */\nconst booleanSchemaScalar = (value: 'unknown' | 'never'): ScalarValue => ({\n  value,\n  isEnum: false,\n  hasReadonlyProps: false,\n  type: 'unknown',\n  imports: [],\n  schemas: [],\n  isRef: false,\n  dependencies: [],\n});\n\nexport function getScalar({\n  item,\n  name,\n  context,\n  formDataContext,\n}: GetScalarOptions): ScalarValue {\n  if (item === true) {\n    return booleanSchemaScalar('unknown');\n  }\n  if (item === false) {\n    return booleanSchemaScalar('never');\n  }\n\n  // Bridge assertions: extract typed values from AnyOtherAttribute-infected schema\n  const schemaEnum = item.enum as SchemaEnumValue[] | undefined;\n  const schemaType = item.type as\n    | OpenApiPrimitiveSchemaType\n    | OpenApiPrimitiveSchemaType[]\n    | undefined;\n  const schemaReadOnly = item.readOnly;\n  const schemaExample = item.example as unknown;\n  const schemaExamples = item.examples as Parameters<\n    typeof resolveExampleRefs\n  >[0];\n  const schemaConst = item.const as unknown;\n  const schemaFormat = item.format as string | undefined;\n\n  const nullable =\n    Array.isArray(schemaType) && schemaType.includes('null') ? ' | null' : '';\n\n  const enumItems = schemaEnum?.filter(\n    (enumItem): enumItem is Exclude<SchemaEnumValue, null> => enumItem !== null,\n  );\n\n  let itemType:\n    | OpenApiPrimitiveSchemaType\n    | OpenApiPrimitiveSchemaType[]\n    | undefined = schemaType;\n  if (!itemType && item.items) {\n    item.type = 'array';\n    itemType = 'array';\n  }\n  if (Array.isArray(schemaType) && schemaType.includes('null')) {\n    const typesWithoutNull = schemaType.filter(\n      (x): x is OpenApiPrimitiveSchemaType => x !== 'null',\n    );\n    itemType =\n      typesWithoutNull.length === 1 ? typesWithoutNull[0] : typesWithoutNull;\n  }\n  if (isNullOnlyEnum(item)) {\n    itemType = 'null';\n  }\n\n  switch (itemType) {\n    case 'number':\n    case 'integer': {\n      let value =\n        context.output.override.useBigInt &&\n        (schemaFormat === 'int64' || schemaFormat === 'uint64')\n          ? 'bigint'\n          : 'number';\n      let isEnum = false;\n\n      if (enumItems) {\n        value = enumItems.map((enumItem) => toJsLiteral(enumItem)).join(' | ');\n        isEnum = true;\n      }\n\n      value += nullable;\n\n      // Keep the type value a string. Numeric `const` values (common from\n      // FastAPI/Pydantic Literal[int] fields that also emit `enum`) must not\n      // replace the union with a raw number, or getTypeConstEnum crashes on\n      // `value.endsWith(...)` (#3758).\n      if (schemaConst !== undefined) {\n        value = `${toJsLiteral(schemaConst)}${nullable}`;\n      }\n\n      return {\n        value,\n        isEnum,\n        type: 'number',\n        schemas: [],\n        imports: [],\n        isRef: false,\n        hasReadonlyProps: schemaReadOnly ?? false,\n        dependencies: [],\n        example: schemaExample,\n        examples: resolveExampleRefs(schemaExamples, context),\n      };\n    }\n\n    case 'boolean': {\n      let value = 'boolean';\n\n      if (\n        enumItems &&\n        !(enumItems.includes(true) && enumItems.includes(false))\n      ) {\n        value = enumItems.map((enumItem) => toJsLiteral(enumItem)).join(' | ');\n      }\n\n      value += nullable;\n\n      // Same string-coercion as integer/number so const never becomes a\n      // non-string type-value for downstream enum helpers (#3758).\n      if (schemaConst !== undefined) {\n        value = `${toJsLiteral(schemaConst)}${nullable}`;\n      }\n\n      return {\n        value: value,\n        type: 'boolean',\n        isEnum: false,\n        schemas: [],\n        imports: [],\n        isRef: false,\n        hasReadonlyProps: schemaReadOnly ?? false,\n        dependencies: [],\n        example: schemaExample,\n        examples: resolveExampleRefs(schemaExamples, context),\n      };\n    }\n\n    case 'array': {\n      const { value, ...rest } = getArray({\n        schema: item,\n        name,\n        context,\n        formDataContext,\n      });\n      return {\n        value: value + nullable,\n        ...rest,\n        dependencies: rest.dependencies,\n      };\n    }\n\n    case 'string': {\n      let value = 'string';\n      let isEnum = false;\n\n      if (enumItems) {\n        value = enumItems\n          .map((enumItem) => toJsLiteral(enumItem))\n          .filter(Boolean)\n          .join(` | `);\n\n        isEnum = true;\n      }\n\n      // application/x-www-form-urlencoded bodies are built with URLSearchParams,\n      // whose values are always strings. Skip Blob/file coercion so file/binary\n      // fields stay `string`; enum unions computed above are left intact (#1624).\n      if (!formDataContext?.urlEncoded) {\n        if (schemaFormat === 'binary') {\n          // In multipart/form-data context, accept both Blob and File so the\n          // filename is preserved in the Content-Disposition header (#3662).\n          // Blob | File is wider than the original Blob, so existing callers\n          // keep compiling (#3915).\n          value = formDataContext ? 'Blob | File' : 'Blob';\n        } else if (formDataContext?.atPart) {\n          const fileType = getFormDataFieldFileType(\n            item,\n            formDataContext.partContentType,\n          );\n          if (fileType) {\n            value =\n              fileType === 'binary' ? 'Blob | File' : 'Blob | File | string';\n          }\n        } else if (isBinaryScalarSchema(item)) {\n          // The previous arm caught format: binary directly; this matches the\n          // OAS 3.1 contentMediaType: application/octet-stream variant via the\n          // shared predicate so any future binary shapes added there flow\n          // through here too (#2410). In multipart context accept both Blob and\n          // File so existing callers keep compiling (#3915).\n          value = formDataContext ? 'Blob | File' : 'Blob';\n        }\n      }\n\n      if (\n        context.output.override.useDates &&\n        (schemaFormat === 'date' || schemaFormat === 'date-time')\n      ) {\n        value = 'Date';\n      }\n\n      value += nullable;\n\n      // Presence, not truthiness: `const: ''` / `0` / `false` are all real\n      // constants, and a truthiness check dropped them back to the wide type.\n      // The nullable suffix has to be re-applied because this overwrites the\n      // value assigned above, which is how the number and boolean branches do\n      // it too.\n      if (schemaConst !== undefined) {\n        // A non-string `const` under `type: string` is another mismatch; the\n        // helper renders whichever literal the value actually is. Previously\n        // this reached the string escaper with a non-string and threw.\n        value = `${toJsLiteral(schemaConst)}${nullable}`;\n      }\n\n      return {\n        value: value,\n        isEnum,\n        type: 'string',\n        imports: [],\n        schemas: [],\n        isRef: false,\n        hasReadonlyProps: schemaReadOnly ?? false,\n        dependencies: [],\n        example: schemaExample,\n        examples: resolveExampleRefs(schemaExamples, context),\n      };\n    }\n\n    case 'null': {\n      // Some OAS 3.1 generators emit a nullable composition in the\n      // non-canonical form `{ type: 'null', allOf|oneOf|anyOf: [...] }`\n      // (e.g. Swashbuckle with UseAllOfToExtendReferenceSchemas; passed\n      // through by @scalar/openapi-upgrader) rather than the canonical\n      // `{ anyOf: [...], type: 'null' }` member form. Treat the composition as\n      // the value and `null` as a union member so this yields `T | null`\n      // instead of collapsing to `null` and dropping the refs.\n      const itemAllOf = item.allOf as unknown[] | undefined;\n      const itemOneOf = item.oneOf as unknown[] | undefined;\n      const itemAnyOf = item.anyOf as unknown[] | undefined;\n      let separator: 'allOf' | 'oneOf' | 'anyOf' | undefined;\n      if (itemAllOf?.length) {\n        separator = 'allOf';\n      } else if (itemOneOf?.length) {\n        separator = 'oneOf';\n      } else if (itemAnyOf?.length) {\n        separator = 'anyOf';\n      }\n      if (separator) {\n        // Drop the consumed `type: 'null'` before delegating: its nullability\n        // is carried by `nullable` below, and leaving it on the schema makes\n        // combineSchemas' merged-properties recursion re-enter this `case` and\n        // collapse the object part back to `null`.\n        const schemaWithoutNull = Object.fromEntries(\n          Object.entries(item as Record<string, unknown>).filter(\n            ([key]) => key !== 'type',\n          ),\n        ) as OpenApiSchemaObject;\n        return combineSchemas({\n          schema: schemaWithoutNull,\n          name,\n          separator,\n          context,\n          nullable: nullable || ' | null',\n          formDataContext,\n        });\n      }\n\n      return {\n        value: 'null',\n        isEnum: false,\n        type: 'null',\n        imports: [],\n        schemas: [],\n        isRef: false,\n        hasReadonlyProps: schemaReadOnly ?? false,\n        dependencies: [],\n      };\n    }\n\n    default: {\n      if (Array.isArray(itemType)) {\n        const anyOfVariants = itemType.map((type) =>\n          Object.assign({}, item, { type }),\n        ) as OpenApiSchemaObject[];\n        return combineSchemas({\n          schema: { anyOf: anyOfVariants } as OpenApiSchemaObject,\n          name,\n          separator: 'anyOf',\n          context,\n          nullable,\n        });\n      }\n\n      if (enumItems) {\n        const value = enumItems\n          .map((enumItem) => toJsLiteral(enumItem))\n          .filter(Boolean)\n          .join(` | `);\n\n        return {\n          value: value + nullable,\n          isEnum: true,\n          type: 'string',\n          imports: [],\n          schemas: [],\n          isRef: false,\n          hasReadonlyProps: schemaReadOnly ?? false,\n          dependencies: [],\n          example: schemaExample,\n          examples: resolveExampleRefs(schemaExamples, context),\n        };\n      }\n\n      // Determine if we should pass form-data context:\n      // - atPart: false -> always pass (navigating to properties)\n      // - atPart: true + combiner -> pass (combiner members are still the same part)\n      // - atPart: true + plain object -> don't pass (nested properties are JSON)\n      const hasCombiners = (item.allOf ?? item.anyOf ?? item.oneOf) as\n        | unknown[]\n        | undefined;\n      const shouldPassContext =\n        formDataContext?.atPart === false ||\n        (formDataContext?.atPart && hasCombiners);\n\n      const { value, ...rest } = getObject({\n        item,\n        name,\n        context,\n        nullable,\n        formDataContext: shouldPassContext ? formDataContext : undefined,\n      });\n      return { value: value, ...rest };\n    }\n  }\n}\n","import { getRefInfo, isComponentRef, type RefInfo } from '../getters/ref';\nimport type {\n  ContextSpec,\n  DynamicAnchorIndexEntry,\n  DynamicScopeEntry,\n  GeneratorImport,\n  OpenApiComponentsObject,\n  OpenApiExampleObject,\n  OpenApiNonBooleanSchemaObject,\n  OpenApiReferenceObject,\n  OpenApiSchemaObject,\n} from '../types';\nimport { getAtPath } from '../utils';\nimport { isInlineSchema, isObject, sanitize } from '../utils';\n\n/** Convert a `$dynamicAnchor` name to a valid TypeScript generic parameter identifier. */\nexport function dynamicAnchorToParamName(anchor: string): string {\n  return sanitize(anchor, {\n    underscore: '_',\n    whitespace: '_',\n    dash: '_',\n    es5keyword: true,\n    es5IdentifierName: true,\n  });\n}\n\nexport function dynamicAnchorsToUniqueParamNames(\n  anchors: string[],\n): Map<string, string> {\n  const result = new Map<string, string>();\n  const usedNames = new Map<string, number>();\n  for (const anchor of anchors) {\n    const base = dynamicAnchorToParamName(anchor);\n    const count = usedNames.get(base) ?? 0;\n    usedNames.set(base, count + 1);\n    const paramName = count === 0 ? base : `${base}${count + 1}`;\n    result.set(anchor, paramName);\n  }\n  return result;\n}\n\ntype Example = OpenApiExampleObject | OpenApiReferenceObject;\ntype ResolvedExample = unknown;\ntype Examples =\n  | Example[]\n  | Record<string, Example>\n  | ResolvedExample[]\n  | Record<string, ResolvedExample>\n  | undefined;\n\ninterface WithOptionalExamples {\n  examples?: Examples;\n}\n\nconst REF_NOT_FOUND_PREFIX = 'Oops... 🍻. Ref not found';\n\n/* oxlint-disable typescript/no-unnecessary-type-parameters -- TSchema constrains return type for callers (e.g. resolveRef<OpenApiExampleObject>) */\n\n/**\n * Recursively resolves a `$ref` in an OpenAPI document, following\n * nested schema refs and collecting imports along the way.\n *\n * Handles type-array hints on direct refs.\n *\n * @see https://spec.openapis.org/oas/v3.1.0#reference-object\n */\nexport function resolveRef<\n  TSchema extends object | boolean = OpenApiComponentsObject,\n>(\n  schema: OpenApiComponentsObject | OpenApiReferenceObject,\n  context: ContextSpec,\n  imports: GeneratorImport[] = [],\n): {\n  schema: TSchema;\n  imports: GeneratorImport[];\n} {\n  const refPath = '$ref' in schema ? schema.$ref : undefined;\n  const nestedSchema = 'schema' in schema ? schema.schema : undefined;\n\n  // the schema is referring to another object\n  if (isObject(nestedSchema) && !isInlineSchema(nestedSchema)) {\n    const resolvedRef = resolveRef<TSchema>(nestedSchema, context, imports);\n\n    if ('examples' in schema) {\n      const schemaWithExamples = schema as WithOptionalExamples;\n      schemaWithExamples.examples = resolveExampleRefs(\n        schemaWithExamples.examples,\n        context,\n      );\n    }\n\n    if (\n      /* oxlint-disable typescript/no-unnecessary-condition */\n      typeof resolvedRef.schema === 'object' &&\n      resolvedRef.schema !== null &&\n      'examples' in resolvedRef.schema\n      /* oxlint-enable typescript/no-unnecessary-condition */\n    ) {\n      const resolvedWithExamples = resolvedRef.schema as WithOptionalExamples;\n      resolvedWithExamples.examples = resolveExampleRefs(\n        resolvedWithExamples.examples,\n        context,\n      );\n    }\n\n    return {\n      schema: {\n        ...schema,\n        schema: resolvedRef.schema,\n      } as TSchema,\n      imports: resolvedRef.imports,\n    };\n  }\n\n  if (isInlineSchema(schema)) {\n    if ('examples' in schema) {\n      const schemaWithExamples = schema as WithOptionalExamples;\n      schemaWithExamples.examples = resolveExampleRefs(\n        schemaWithExamples.examples,\n        context,\n      );\n    }\n    return { schema: schema as TSchema, imports };\n  }\n\n  if (!refPath) {\n    throw new Error(`${REF_NOT_FOUND_PREFIX}: missing $ref`);\n  }\n\n  const {\n    currentSchema,\n    refInfo: { name, originalName },\n  } = getSchema(schema, context);\n\n  if (!currentSchema) {\n    throw new Error(`${REF_NOT_FOUND_PREFIX}: ${refPath}`);\n  }\n\n  return resolveRef<TSchema>(currentSchema, { ...context }, [\n    ...imports,\n    { name, schemaName: originalName },\n  ]);\n}\n\n/**\n * Describes a resolved generic alias binding — the concrete type arguments\n * that fill the template's `$dynamicAnchor` slots for a given `$ref` with\n * `$defs` overrides.\n *\n * Produced by {@link extractBoundAliasInfo} and consumed by `resolveValue`\n * to emit instantiated generic type expressions (e.g. `Paginated<User>`).\n */\nexport interface BoundAliasInfo {\n  genericName: string;\n  genericParams: string[];\n  typeArgs: string[];\n  imports: { name: string; schemaName: string }[];\n  extraSchemas?: (OpenApiSchemaObject | OpenApiReferenceObject)[];\n}\n\n/** Check whether a schema reference has at least one `$defs` entry with both `$dynamicAnchor` and `$ref`. */\nfunction isBoundAlias(\n  schema: OpenApiReferenceObject | OpenApiNonBooleanSchemaObject,\n): boolean {\n  // `$defs` is a schema keyword. A `$ref` with `$defs` siblings is a Schema Object in OAS 3.1.\n  if (!('$defs' in schema)) return false;\n  const defs = schema.$defs;\n  if (!defs || typeof defs !== 'object') return false;\n  for (const defSchema of Object.values(defs)) {\n    if (!defSchema || typeof defSchema !== 'object') continue;\n    if (\n      typeof defSchema.$dynamicAnchor === 'string' &&\n      typeof defSchema.$ref === 'string'\n    ) {\n      return true;\n    }\n  }\n  return false;\n}\n\n/**\n * Extract bound-alias information from a schema that references a generic template\n * and binds `$dynamicAnchor` entries to concrete types via `$defs`.\n */\nexport function extractBoundAliasInfo(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  context: ContextSpec,\n): BoundAliasInfo | undefined {\n  let bindingElement: OpenApiReferenceObject | undefined;\n  let extraSchemas:\n    | (OpenApiSchemaObject | OpenApiReferenceObject)[]\n    | undefined;\n\n  if (!isInlineSchema(schema) && isBoundAlias(schema)) {\n    bindingElement = schema;\n  } else {\n    const allOf = (schema as { allOf?: unknown[] }).allOf;\n    if (Array.isArray(allOf)) {\n      for (let i = 0; i < allOf.length; i++) {\n        const element = allOf[i] as\n          | OpenApiSchemaObject\n          | OpenApiReferenceObject;\n        if (!isInlineSchema(element) && isBoundAlias(element)) {\n          bindingElement = element;\n          extraSchemas = allOf.filter((_: unknown, j: number) => j !== i) as (\n            | OpenApiSchemaObject\n            | OpenApiReferenceObject\n          )[];\n          break;\n        }\n      }\n    }\n  }\n\n  if (!bindingElement) return undefined;\n\n  const bindingRecord = bindingElement as Record<string, unknown>;\n  const defs = bindingRecord.$defs as Record<string, unknown> | undefined;\n  if (!defs || typeof defs !== 'object') return undefined;\n\n  const bindingByAnchor = new Map<\n    string,\n    { typeName: string; originalName: string }\n  >();\n\n  for (const defSchema of Object.values(defs)) {\n    if (!defSchema || typeof defSchema !== 'object') continue;\n    const rec = defSchema as Record<string, unknown>;\n    if (rec.$dynamicAnchor === undefined) continue;\n\n    const ref = rec.$ref as string | undefined;\n    if (!ref || !isComponentRef(ref)) continue;\n\n    const anchor = rec.$dynamicAnchor as string;\n    const { name, originalName } = getRefInfo(ref, context);\n    bindingByAnchor.set(anchor, { typeName: name, originalName });\n  }\n\n  if (bindingByAnchor.size === 0) return undefined;\n\n  const refPath = bindingElement.$ref;\n  if (typeof refPath !== 'string') return undefined;\n\n  const { name: genericName, refPaths: templateRefPaths } = getRefInfo(\n    refPath,\n    context,\n  );\n\n  const templateSchema = templateRefPaths\n    ? (getAtPath(context.spec, templateRefPaths) as\n        | Record<string, unknown>\n        | undefined)\n    : undefined;\n\n  const templateDefs = templateSchema?.$defs as\n    | Record<string, unknown>\n    | undefined;\n\n  const typeArgs: string[] = [];\n  const genericParams: string[] = [];\n  const imports: { name: string; schemaName: string }[] = [];\n\n  if (templateDefs && typeof templateDefs === 'object') {\n    const templateAnchors: string[] = [];\n    for (const defSchema of Object.values(templateDefs)) {\n      if (!defSchema || typeof defSchema !== 'object') continue;\n      const rec = defSchema as Record<string, unknown>;\n      if (rec.$dynamicAnchor === undefined || rec.$ref !== undefined) continue;\n      templateAnchors.push(rec.$dynamicAnchor as string);\n    }\n\n    const uniqueNames = dynamicAnchorsToUniqueParamNames(templateAnchors);\n    for (const anchor of templateAnchors) {\n      const binding = bindingByAnchor.get(anchor);\n      if (binding) {\n        typeArgs.push(binding.typeName);\n        imports.push({\n          name: binding.typeName,\n          schemaName: binding.originalName,\n        });\n      } else {\n        const paramName =\n          uniqueNames.get(anchor) ?? dynamicAnchorToParamName(anchor);\n        typeArgs.push(paramName);\n        genericParams.push(paramName);\n      }\n    }\n  }\n\n  if (typeArgs.length === 0) {\n    for (const { typeName, originalName } of bindingByAnchor.values()) {\n      typeArgs.push(typeName);\n      imports.push({ name: typeName, schemaName: originalName });\n    }\n  }\n\n  return { genericName, genericParams, typeArgs, imports, extraSchemas };\n}\n\nfunction getSchema<TSchema extends object = OpenApiComponentsObject>(\n  schema: OpenApiReferenceObject,\n  context: ContextSpec,\n): {\n  refInfo: RefInfo;\n  currentSchema: TSchema | undefined;\n} {\n  if (!schema.$ref) {\n    throw new Error(`${REF_NOT_FOUND_PREFIX}: missing $ref`);\n  }\n\n  const refInfo = getRefInfo(schema.$ref, context);\n\n  const { refPaths } = refInfo;\n\n  const schemaByRefPaths:\n    | OpenApiSchemaObject\n    | OpenApiReferenceObject\n    | undefined = Array.isArray(refPaths)\n    ? (getAtPath(context.spec, refPaths) as\n        | OpenApiSchemaObject\n        | OpenApiReferenceObject\n        | undefined)\n    : undefined;\n\n  // Don't tail-recurse through an intermediate that is itself a bound alias:\n  // it is emitted as its own named, specialized type (e.g. `ObjectArray`),\n  // so callers must reference it by name. Recursing drops that name and emits\n  // the unspecialized template instead (#3746).\n  if (\n    isObject(schemaByRefPaths) &&\n    !isInlineSchema(schemaByRefPaths) &&\n    !isBoundAlias(schemaByRefPaths)\n  ) {\n    return getSchema(schemaByRefPaths, context);\n  }\n\n  let currentSchema: OpenApiSchemaObject | OpenApiReferenceObject | undefined =\n    schemaByRefPaths;\n\n  // Handle OpenAPI 3.1 type array (e.g., type: [\"object\", \"null\"])\n  // This preserves nullable information when using direct $ref with types array\n  if (\n    isObject(currentSchema) &&\n    'type' in schema &&\n    Array.isArray(schema.type)\n  ) {\n    const type = schema.type as string[];\n    const currentSchemaObject = currentSchema as Record<string, unknown>;\n    currentSchema = {\n      ...currentSchemaObject,\n      type,\n    } as OpenApiSchemaObject | OpenApiReferenceObject;\n  }\n\n  return {\n    currentSchema: currentSchema as TSchema | undefined,\n    refInfo,\n  };\n}\n\n/* oxlint-enable typescript/no-unnecessary-type-parameters */\n\nfunction encodeJsonPointerSegment(segment: string): string {\n  return segment.replaceAll('~', '~0').replaceAll('/', '~1');\n}\n\n/**\n * Build the dynamic scope for a schema: maps `$dynamicAnchor` names to concrete\n * type entries for self-referential resolution, `$defs` bindings, and sibling anchors.\n */\nexport function buildDynamicScope(\n  schemaName: string,\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n): Record<string, DynamicScopeEntry> {\n  const scope: Record<string, DynamicScopeEntry> = {};\n\n  const getSchemaScopeEntry = (name: string): DynamicScopeEntry => {\n    const refInfo = getRefInfo(\n      `#/components/schemas/${encodeJsonPointerSegment(name)}`,\n      context,\n    );\n\n    return {\n      name: refInfo.name,\n      schemaName: refInfo.originalName,\n    };\n  };\n\n  const schemaRecord = schema as Record<string, unknown>;\n\n  if (typeof schemaRecord.$dynamicAnchor === 'string') {\n    scope[schemaRecord.$dynamicAnchor] = getSchemaScopeEntry(schemaName);\n  }\n\n  const defs = schemaRecord.$defs as\n    | Record<string, OpenApiSchemaObject | OpenApiReferenceObject>\n    | undefined;\n  if (defs && typeof defs === 'object') {\n    const unboundAnchors: string[] = [];\n    for (const [, defSchema] of Object.entries(defs)) {\n      if (!defSchema || typeof defSchema !== 'object') continue;\n      const defRecord = defSchema as Record<string, unknown>;\n      if (typeof defRecord.$dynamicAnchor === 'string') {\n        const anchorName = defRecord.$dynamicAnchor;\n        const refInDef = (defSchema as OpenApiReferenceObject).$ref;\n        // oxlint-disable-next-line typescript/no-unnecessary-condition\n        if (refInDef?.startsWith('#/components/schemas/')) {\n          const { name, originalName } = getRefInfo(refInDef, context);\n          scope[anchorName] = { name, schemaName: originalName };\n        } else if (!refInDef) {\n          unboundAnchors.push(anchorName);\n        }\n      }\n    }\n    if (unboundAnchors.length > 0) {\n      const uniqueNames = dynamicAnchorsToUniqueParamNames(unboundAnchors);\n      for (const anchor of unboundAnchors) {\n        const paramName = uniqueNames.get(anchor);\n        if (paramName === undefined) continue;\n        scope[anchor] = {\n          name: paramName,\n          schemaName: paramName,\n          isParameter: true,\n        };\n      }\n    }\n  }\n\n  return scope;\n}\n\n/**\n * Build dynamic scope entries for an **anonymous inline** subschema that declares\n * `$dynamicAnchor` without a `$ref` (e.g. inside `allOf`, `items`, nested props).\n *\n * Unlike {@link buildDynamicScope}, entries carry the concrete `inlineSchema` so\n * that a descendant `$dynamicRef` resolves to the inline override rather than the\n * outer/global component. Used when `dereference` enters a subschema without a\n * named component `$ref`.\n *\n * Scope of handling (deliberate, see #3492):\n *   - Direct `$dynamicAnchor` on the subschema → inline entry.\n *   - `$defs` `$dynamicAnchor` *without* a `$ref` → inline entry. Note this\n *     differs from `buildDynamicScope`, which treats unbound `$defs` anchors as\n *     generic parameters (`isParameter`); inline subschemas are concrete\n *     instances, so the anchor resolves to the inline schema object itself.\n *   - `$defs` `$dynamicAnchor` *with* a `$ref` → intentionally NOT collected\n *     here. Such anchors rely on `resolveDynamicRef`'s global fallback (which\n *     finds them when the `$ref` target declares the same anchor). Fully\n *     resolving them would duplicate `buildDynamicScope`'s `$defs` logic.\n */\nexport function buildInlineDynamicScope(\n  schema: OpenApiSchemaObject,\n): Record<string, DynamicScopeEntry> {\n  const scope: Record<string, DynamicScopeEntry> = {};\n  const schemaRecord = schema as Record<string, unknown>;\n\n  if (typeof schemaRecord.$dynamicAnchor === 'string') {\n    const anchor = schemaRecord.$dynamicAnchor;\n    scope[anchor] = {\n      name: anchor,\n      schemaName: anchor,\n      inlineSchema: schema,\n    };\n  }\n\n  const defs = schemaRecord.$defs as\n    | Record<string, OpenApiSchemaObject | OpenApiReferenceObject>\n    | undefined;\n  if (defs && typeof defs === 'object') {\n    for (const defSchema of Object.values(defs)) {\n      if (!defSchema || typeof defSchema !== 'object') continue;\n      const defRecord = defSchema as Record<string, unknown>;\n      if (\n        typeof defRecord.$dynamicAnchor === 'string' &&\n        !(defSchema as OpenApiReferenceObject).$ref\n      ) {\n        const anchor = defRecord.$dynamicAnchor;\n        scope[anchor] = {\n          name: anchor,\n          schemaName: anchor,\n          inlineSchema: defSchema as OpenApiSchemaObject,\n        };\n      }\n    }\n  }\n\n  return scope;\n}\n\n/**\n * Lazily build and memoize the `$dynamicAnchor` index on the context.\n *\n * Scans `components.schemas` once per spec and stores, per anchor name, the\n * compact match info required by the {@link resolveDynamicRef} fallback (see\n * {@link DynamicAnchorIndexEntry}). Subsequent fallback lookups are O(1)\n * instead of re-scanning every schema per `$dynamicRef`.\n *\n * Recording of non-exact matches stops once `count >= 2` — the fallback only\n * distinguishes \"exactly one non-exact\" from \"ambiguous\", so further non-exact\n * names are irrelevant. Iteration continues regardless because a later schema\n * whose key equals the anchor name is still the definitive (`exactName`)\n * winner. This is the safe form of \"bail early when ambiguous\": a literal\n * early-return at `count === 2` would regress the exact-name rule when the\n * exact schema appears later in iteration order.\n */\nexport function getDynamicAnchorIndex(\n  context: ContextSpec,\n): Map<string, DynamicAnchorIndexEntry> {\n  const cached = context.dynamicAnchorIndex;\n  if (cached) return cached;\n\n  const index = new Map<string, DynamicAnchorIndexEntry>();\n  const schemas = (\n    (context.spec as Record<string, unknown>).components as\n      | Record<string, unknown>\n      | undefined\n  )?.schemas as Record<string, unknown> | undefined;\n\n  if (schemas && typeof schemas === 'object') {\n    for (const [schemaName, schemaObj] of Object.entries(schemas)) {\n      if (!schemaObj || typeof schemaObj !== 'object') continue;\n      const rec = schemaObj as Record<string, unknown>;\n      const anchor = rec.$dynamicAnchor;\n      if (typeof anchor !== 'string') continue;\n\n      let entry = index.get(anchor);\n      if (!entry) {\n        entry = { count: 0 };\n        index.set(anchor, entry);\n      }\n\n      if (schemaName === anchor) {\n        entry.exactName = schemaName;\n      } else if (entry.count < 2) {\n        entry.count += 1;\n        if (!entry.firstName) entry.firstName = schemaName;\n      }\n    }\n  }\n\n  context.dynamicAnchorIndex = index;\n  return index;\n}\n\n/**\n * Resolve a `$dynamicRef` anchor to its concrete type using the current dynamic scope.\n * Returns `{ schema: {}, resolvedTypeName: 'unknown' }` when no scope override exists.\n */\nexport function resolveDynamicRef(\n  anchorName: string,\n  context: ContextSpec,\n  imports: GeneratorImport[] = [],\n): {\n  schema: OpenApiSchemaObject;\n  imports: GeneratorImport[];\n  resolvedTypeName: string;\n  schemaName: string | undefined;\n} {\n  const scope = context.dynamicScope ?? {};\n  let scopeEntry = scope[anchorName];\n\n  if (!scopeEntry) {\n    const entry = getDynamicAnchorIndex(context).get(anchorName);\n    const match =\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      entry?.exactName ?? (entry?.count === 1 ? entry?.firstName : undefined);\n    if (match) {\n      const refInfo = getRefInfo(\n        `#/components/schemas/${encodeJsonPointerSegment(match)}`,\n        context,\n      );\n      scopeEntry = {\n        name: refInfo.name,\n        schemaName: refInfo.originalName,\n      };\n    }\n  }\n\n  if (!scopeEntry) {\n    return {\n      schema: {},\n      imports,\n      resolvedTypeName: 'unknown',\n      schemaName: undefined,\n    };\n  }\n\n  if (scopeEntry.isParameter) {\n    return {\n      schema: {},\n      imports,\n      resolvedTypeName: scopeEntry.name,\n      schemaName: undefined,\n    };\n  }\n\n  if (scopeEntry.inlineSchema) {\n    return {\n      schema: scopeEntry.inlineSchema,\n      imports,\n      resolvedTypeName: scopeEntry.name,\n      schemaName: undefined,\n    };\n  }\n\n  const resolvedTypeName = scopeEntry.name;\n  const schemaRef = `#/components/schemas/${encodeJsonPointerSegment(scopeEntry.schemaName)}`;\n\n  try {\n    const { schema: resolvedSchema, imports: resolvedImports } =\n      resolveRef<OpenApiSchemaObject>({ $ref: schemaRef }, context, imports);\n    return {\n      schema: resolvedSchema,\n      imports: resolvedImports,\n      resolvedTypeName,\n      schemaName: scopeEntry.schemaName,\n    };\n  } catch {\n    return {\n      schema: {},\n      imports,\n      resolvedTypeName: 'unknown',\n      schemaName: undefined,\n    };\n  }\n}\n\n/** Recursively resolves `$ref` entries in an examples array or record. */\nexport function resolveExampleRefs(\n  examples: Examples,\n  context: ContextSpec,\n): ResolvedExample[] | Record<string, ResolvedExample> | undefined {\n  if (!examples) {\n    return undefined;\n  }\n  return Array.isArray(examples)\n    ? examples.map((example) => {\n        if (isObject(example) && !isInlineSchema(example)) {\n          const { schema }: { schema: OpenApiExampleObject } = resolveRef(\n            example,\n            context,\n          );\n          // Bridge assertion: ExampleObject.value is typed as `any`\n          return schema.value;\n        }\n        return example;\n      })\n    : (() => {\n        const result: Record<string, ResolvedExample> = {};\n        for (const [key, example] of Object.entries(examples)) {\n          // Bridge assertion: ExampleObject.value is typed as `any`\n          result[key] =\n            isObject(example) && !isInlineSchema(example)\n              ? (\n                  resolveRef(example, context) as {\n                    schema: OpenApiExampleObject;\n                  }\n                ).schema.value\n              : example;\n        }\n        return result;\n      })();\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { getScalar } from '../getters';\nimport type { FormDataContext } from '../getters/object';\nimport {\n  getDynamicAnchorName,\n  getRefInfo,\n  isComponentRef,\n} from '../getters/ref';\nimport { isBinaryScalarSchema } from '../getters/scalar';\nimport type {\n  ContextSpec,\n  GeneratorImport,\n  OpenApiPrimitiveSchemaType,\n  OpenApiReferenceObject,\n  OpenApiSchemaObject,\n  ResolverValue,\n  SchemaType,\n} from '../types';\nimport { isDynamicReference, isInlineSchema } from '../utils';\nimport { extractBoundAliasInfo, resolveDynamicRef, resolveRef } from './ref';\n\ninterface ResolveValueOptions {\n  schema: OpenApiSchemaObject | OpenApiReferenceObject;\n  name?: string;\n  context: ContextSpec;\n  formDataContext?: FormDataContext;\n}\n\nconst schemaArrayKeys = ['allOf', 'anyOf', 'oneOf', 'prefixItems'] as const;\nconst schemaObjectKeys = [\n  'additionalProperties',\n  'contains',\n  'else',\n  'if',\n  'items',\n  'not',\n  'propertyNames',\n  'then',\n  'unevaluatedItems',\n  'unevaluatedProperties',\n] as const;\nconst schemaMapKeys = [\n  '$defs',\n  'dependentSchemas',\n  'patternProperties',\n  'properties',\n] as const;\n\n/**\n * Recursively walks a schema value and returns `true` if any nested\n * `$dynamicRef` resolves — via the current `context.dynamicScope` — to a\n * schema *other* than `refName`.\n *\n * Used by `resolveValue` to decide whether a `$ref`'d schema must be\n * instantiated with its bound type arguments rather than referenced by name.\n *\n * @param value   - The schema node (or sub-node) to inspect.\n * @param context - Current resolution context, including the dynamic scope.\n * @param refName - The resolved name of the enclosing `$ref` schema; dynamic\n *                  refs that resolve to this same name are considered\n *                  self-references and do not count as \"scope-affected\".\n * @param seen    - Cycle-guard; tracks already-visited objects.\n */\nfunction hasScopeAffectedDynamicRef(\n  value: unknown,\n  context: ContextSpec,\n  refName: string,\n  seen = new WeakSet<object>(),\n): boolean {\n  if (!value || typeof value !== 'object') {\n    return false;\n  }\n\n  if (!context.dynamicScope || Object.keys(context.dynamicScope).length === 0) {\n    return false;\n  }\n\n  if (seen.has(value)) {\n    return false;\n  }\n  seen.add(value);\n\n  if (isDynamicReference(value) && value.$dynamicRef.startsWith('#')) {\n    const anchorName = getDynamicAnchorName(value.$dynamicRef);\n    if (anchorName) {\n      const scopeEntry = context.dynamicScope[anchorName];\n      if (scopeEntry && scopeEntry.name !== refName) {\n        return true;\n      }\n    }\n  }\n\n  const schema = value as Record<string, unknown>;\n\n  for (const key of schemaArrayKeys) {\n    const items = schema[key];\n    if (\n      Array.isArray(items) &&\n      items.some((item) =>\n        hasScopeAffectedDynamicRef(item, context, refName, seen),\n      )\n    ) {\n      return true;\n    }\n  }\n\n  for (const key of schemaObjectKeys) {\n    if (hasScopeAffectedDynamicRef(schema[key], context, refName, seen)) {\n      return true;\n    }\n  }\n\n  for (const key of schemaMapKeys) {\n    const schemaMap = schema[key];\n    if (\n      schemaMap &&\n      typeof schemaMap === 'object' &&\n      Object.values(schemaMap).some((item) =>\n        hasScopeAffectedDynamicRef(item, context, refName, seen),\n      )\n    ) {\n      return true;\n    }\n  }\n\n  return false;\n}\n\n/**\n * Metadata `type` for a resolved component schema.\n *\n * A single non-null member of an array `type` is kept (`['string', 'null']`\n * is `string`, `['object', 'null']` is `object`). A mixed array such as\n * `['string', 'number']` is `unknown`, so composition does not treat it as\n * an object and pull its keys into `unionAddMissingProperties`.\n */\nfunction toResolverSchemaType(\n  type: OpenApiPrimitiveSchemaType | OpenApiPrimitiveSchemaType[] | undefined,\n): SchemaType {\n  if (!Array.isArray(type)) {\n    return type ?? 'object';\n  }\n\n  const nonNull = type.filter((member) => member !== 'null');\n  if (nonNull.length === 1) {\n    return nonNull[0];\n  }\n  if (nonNull.length === 0) {\n    return 'null';\n  }\n  return 'unknown';\n}\n\nfunction makeUnknownValue(\n  originalSchema: OpenApiSchemaObject | OpenApiReferenceObject,\n): ResolverValue {\n  return {\n    value: 'unknown',\n    imports: [],\n    type: 'unknown',\n    isEnum: false,\n    schemas: [],\n    isRef: false,\n    hasReadonlyProps: false,\n    originalSchema,\n    dependencies: [],\n  };\n}\n\n/**\n * Resolves an OpenAPI schema or reference object to a {@link ResolverValue}\n * that carries the TypeScript type string, required imports, and metadata.\n *\n * Handles all schema forms in priority order:\n * 1. **Bound generic alias** — a `$ref` with `$defs` overrides; emits an\n *    instantiated generic expression such as `Paginated<User>`.\n * 2. **Component `$ref`** — a named `$ref` pointing to `#/components/…`;\n *    emits the schema name as a reference import.\n * 3. **Non-component `$ref`** — an anonymous or path-level ref; inlines the\n *    resolved schema via {@link getScalar} (cycle-safe).\n * 4. **`$dynamicRef`** — resolved via the active dynamic scope; falls back to\n *    `unknown` when the anchor is absent or the ref is a bare `#`.\n * 5. **Plain schema** — delegates to {@link getScalar} for all other cases\n *    (primitives, objects, arrays, enums, …).\n */\nexport function resolveValue({\n  schema,\n  name,\n  context,\n  formDataContext,\n}: ResolveValueOptions): ResolverValue {\n  if (isBooleanJsonSchema(schema)) {\n    return {\n      ...getScalar({ item: schema, name, context, formDataContext }),\n      originalSchema: schema,\n      isRef: false,\n    };\n  }\n\n  if (!isInlineSchema(schema)) {\n    const alias = extractBoundAliasInfo(schema, context);\n    if (alias) {\n      const value = `${alias.genericName}<${alias.typeArgs.join(', ')}>`;\n      const allImports: { name: string; schemaName: string }[] = [\n        { name: alias.genericName, schemaName: alias.genericName },\n        ...alias.imports,\n      ];\n      return {\n        value,\n        imports: allImports,\n        type: 'object',\n        schemas: [],\n        isEnum: false,\n        originalSchema: schema as OpenApiSchemaObject,\n        hasReadonlyProps: false,\n        isRef: true,\n        dependencies: allImports.map((i) => i.name),\n      };\n    }\n\n    const refValue = schema.$ref;\n    const {\n      schema: schemaObject,\n      imports,\n    }: {\n      schema: OpenApiSchemaObject;\n      imports: GeneratorImport[];\n    } = resolveRef(schema, context);\n\n    if (isBooleanJsonSchema(schemaObject)) {\n      return {\n        ...getScalar({ item: schemaObject, name, context, formDataContext }),\n        originalSchema: schemaObject,\n        isRef: true,\n      };\n    }\n\n    // Refs that don't target a named component slot (e.g. bundler-emitted\n    // `#/paths/.../schema`) have no corresponding `export type`, so emitting\n    // a named import would dangle. Inline the resolved schema instead.\n    // See issue #398.\n    if (refValue && !isComponentRef(refValue)) {\n      // Inlining walks nested $refs via getScalar -> resolveValue. A\n      // self-referential path-ref would recurse forever because the named-ref\n      // cycle guard below tracks `resolvedImport.name`, not the ref string.\n      // Fall back to `unknown` to break the chain — anonymous recursive types\n      // can't be expressed in TypeScript anyway.\n      if (context.parents?.includes(refValue)) {\n        return {\n          value: 'unknown',\n          imports: [],\n          schemas: [],\n          type: 'unknown',\n          isEnum: false,\n          originalSchema: schemaObject,\n          hasReadonlyProps: false,\n          isRef: false,\n          dependencies: [],\n        };\n      }\n      const scalar = getScalar({\n        item: schemaObject,\n        name,\n        context: {\n          ...context,\n          parents: [...(context.parents ?? []), refValue],\n        },\n        formDataContext,\n      });\n      return { ...scalar, originalSchema: schemaObject, isRef: false };\n    }\n\n    // application/x-www-form-urlencoded bodies are serialized via\n    // URLSearchParams.append(), which only accepts strings. Inline binary\n    // properties already skip the Blob coercion via formDataContext.urlEncoded\n    // inside scalar.ts (#1624 / #3395), but the component-$ref path below\n    // returns the imported type name unconditionally — so e.g. C#'s\n    // `IFormFile` (= Blob) leaks into the body type and fails to type-check.\n    // When the resolved component schema is a binary scalar that scalar.ts\n    // would coerce to Blob, fall back to the inlined scalar (which becomes\n    // `string` under formDataContext.urlEncoded) instead of the import.\n    // The standalone IFormFile model is intentionally left as Blob — it may\n    // still be referenced by a multipart/form-data endpoint where Blob is\n    // correct. Fixes #2410.\n    if (formDataContext?.urlEncoded && isBinaryScalarSchema(schemaObject)) {\n      // Pass the resolveValue input `name` (the property name) so this branch\n      // truly behaves like an inline property schema. Using the component\n      // import name here would leak component-based naming into downstream\n      // scalar paths (validators/docs/naming) even though the resulting type\n      // is plain `string`.\n      const scalar = getScalar({\n        item: schemaObject,\n        name,\n        context,\n        formDataContext,\n      });\n      return { ...scalar, originalSchema: schemaObject, isRef: false };\n    }\n\n    const resolvedImport = imports[0];\n\n    let hasReadonlyProps = false;\n\n    // Avoid infinite loop - use resolvedImport.name for tracking since name may be undefined\n    const refName = resolvedImport.name;\n\n    // Keep the dynamic scope from the original wrapper schema: its $defs\n    // provide the dynamic-anchor bindings, and scopedContext captured them\n    // before materialization. Resolving the wrapper $ref here gives us the\n    // concrete instantiation of the referenced template to generate.\n    let effectiveContext = context;\n\n    const schemaRecord = schemaObject as Record<string, unknown>;\n    const refAnchor = schemaRecord.$dynamicAnchor as string | undefined;\n\n    if (\n      typeof refAnchor === 'string' &&\n      context.dynamicScope?.[refAnchor] &&\n      context.dynamicScope[refAnchor].name !== refName &&\n      !context.dynamicScope[refAnchor].isParameter &&\n      // Inline overrides have no component source (`schemaName` is the anchor\n      // name, not a component key), so the allOf-derivation below does not\n      // apply to them.\n      !context.dynamicScope[refAnchor].inlineSchema\n    ) {\n      const scopeEntry = context.dynamicScope[refAnchor];\n      const specSchemas = (\n        (context.spec as Record<string, unknown>).components as\n          | Record<string, unknown>\n          | undefined\n      )?.schemas as Record<string, unknown> | undefined;\n\n      const scopeSource = specSchemas?.[scopeEntry.schemaName] as\n        | Record<string, unknown>\n        | undefined;\n\n      const allOf = scopeSource?.allOf as unknown[] | undefined;\n\n      const isInAllOf =\n        Array.isArray(allOf) &&\n        allOf.some((el) => {\n          if (!el || typeof el !== 'object') return false;\n          const rec = el as Record<string, unknown>;\n          if (typeof rec.$ref !== 'string' || !isComponentRef(rec.$ref))\n            return false;\n          const { name } = getRefInfo(rec.$ref, context);\n          return name === refName;\n        });\n\n      if (!isInAllOf) {\n        const filteredScope = Object.fromEntries(\n          Object.entries(context.dynamicScope).filter(\n            ([key]) => key !== refAnchor,\n          ),\n        );\n        effectiveContext = { ...context, dynamicScope: filteredScope };\n      }\n    }\n\n    if (\n      !effectiveContext.parents?.includes(refName) &&\n      hasScopeAffectedDynamicRef(schemaObject, effectiveContext, refName)\n    ) {\n      const scalar = getScalar({\n        item: schemaObject,\n        name: name ?? refName,\n        context: {\n          ...effectiveContext,\n          parents: [...(effectiveContext.parents ?? []), refName],\n        },\n        formDataContext,\n      });\n\n      return {\n        ...scalar,\n        originalSchema: schemaObject,\n        isRef: false,\n      };\n    }\n\n    if (!effectiveContext.parents?.includes(refName)) {\n      const scalar = getScalar({\n        item: schemaObject,\n        name: refName,\n        context: {\n          ...effectiveContext,\n          parents: [...(effectiveContext.parents ?? []), refName],\n        },\n      });\n\n      hasReadonlyProps = scalar.hasReadonlyProps;\n    }\n\n    const isAnyOfNullable = schemaObject.anyOf?.some((anyOfItem) => {\n      if (!isInlineSchema(anyOfItem) || isBooleanJsonSchema(anyOfItem)) {\n        return false;\n      }\n      return (\n        anyOfItem.type === 'null' ||\n        (Array.isArray(anyOfItem.type) && anyOfItem.type.includes('null'))\n      );\n    });\n\n    const schemaType = schemaObject.type;\n    const nullable =\n      (Array.isArray(schemaType) && schemaType.includes('null')) ||\n      isAnyOfNullable\n        ? ' | null'\n        : '';\n\n    return {\n      value: resolvedImport.name + nullable,\n      imports: [\n        {\n          name: resolvedImport.name,\n          schemaName: resolvedImport.schemaName,\n        },\n      ],\n      type: toResolverSchemaType(schemaObject.type),\n      schemas: [],\n      isEnum: !!schemaObject.enum,\n      originalSchema: schemaObject,\n      hasReadonlyProps,\n      isRef: true,\n      dependencies: [resolvedImport.name],\n    };\n  }\n\n  if (isDynamicReference(schema)) {\n    const dynamicRef = schema.$dynamicRef;\n\n    if (!dynamicRef.startsWith('#')) {\n      return makeUnknownValue(schema);\n    }\n\n    const anchorName = getDynamicAnchorName(dynamicRef);\n    if (!anchorName) {\n      return makeUnknownValue(schema);\n    }\n\n    const { imports: resolvedImports, resolvedTypeName } = resolveDynamicRef(\n      anchorName,\n      context,\n    );\n\n    if (resolvedTypeName === 'unknown') {\n      return makeUnknownValue(schema);\n    }\n\n    return {\n      value: resolvedTypeName,\n      imports: resolvedImports,\n      type: 'object',\n      isEnum: false,\n      schemas: [],\n      isRef: true,\n      hasReadonlyProps: false,\n      originalSchema: schema,\n      dependencies: [resolvedTypeName],\n    };\n  }\n\n  const scalar = getScalar({\n    item: schema,\n    name,\n    context,\n    formDataContext,\n  });\n\n  return {\n    ...scalar,\n    originalSchema: schema,\n    isRef: false,\n  };\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport {\n  getEnum,\n  getEnumMembers,\n  isEnumReferenceMissingNull,\n} from '../getters/enum';\nimport type { FormDataContext } from '../getters/object';\nimport type {\n  ContextSpec,\n  OpenApiReferenceObject,\n  OpenApiSchemaObject,\n  ResolverValue,\n  ScalarValue,\n} from '../types';\nimport { isSchemaNullable, jsDoc, toJsLiteral } from '../utils';\nimport { resolveValue } from './value';\n\ninterface ResolveOptions {\n  schema: OpenApiSchemaObject | OpenApiReferenceObject;\n  propName?: string;\n  combined?: boolean;\n  context: ContextSpec;\n  formDataContext?: FormDataContext;\n}\n\ninterface CreateTypeAliasOptions {\n  resolvedValue: ResolverValue;\n  propName: string | undefined;\n  context: ContextSpec;\n}\n\n/**\n * Wraps inline object type in a type alias.\n * E.g. `{ foo: string }` → value becomes `FooBody`, schema gets `export type FooBody = { foo: string };`\n */\nexport function createTypeAliasIfNeeded({\n  resolvedValue,\n  propName,\n  context,\n}: CreateTypeAliasOptions): ScalarValue | undefined {\n  if (!propName) {\n    return undefined;\n  }\n\n  if (resolvedValue.isEnum || resolvedValue.type !== 'object') {\n    return undefined;\n  }\n\n  // aliasCombinedTypes (v7 compat): match '|' and '&' so 'string | number' creates named type\n  // v8 default: only match '{' so combined primitives are inlined\n  const aliasPattern = context.output.override.aliasCombinedTypes\n    ? String.raw`{|&|\\|`\n    : '{';\n  if (!new RegExp(aliasPattern).test(resolvedValue.value)) {\n    return undefined;\n  }\n\n  const { originalSchema } = resolvedValue;\n  if (isBooleanJsonSchema(originalSchema)) {\n    return undefined;\n  }\n  const doc = jsDoc(originalSchema);\n  const isConstant = 'const' in originalSchema;\n\n  // The constant lands in value position (`export const X = <here> as const`),\n  // so it has to be serialized from what it actually is. Quoting off the\n  // declared `type` left every non-string schema — an inline object being the\n  // reachable case, via an array component's `items` — emitting the document's\n  // text raw, which runs as an expression on import.\n  const model = isConstant\n    ? `${doc}export const ${propName} = ${toJsLiteral(originalSchema.const)} as const;\\n`\n    : `${doc}export type ${propName} = ${resolvedValue.value};\\n`;\n\n  return {\n    value: propName,\n    imports: [{ name: propName, isConstant }],\n    schemas: [\n      ...resolvedValue.schemas,\n      {\n        name: propName,\n        model,\n        imports: resolvedValue.imports,\n        dependencies: resolvedValue.dependencies,\n        kind: 'schema',\n      },\n    ],\n    isEnum: false,\n    type: 'object',\n    isRef: resolvedValue.isRef,\n    hasReadonlyProps: resolvedValue.hasReadonlyProps,\n    dependencies: resolvedValue.dependencies,\n  };\n}\n\nfunction resolveObjectOriginal({\n  schema,\n  propName,\n  combined = false,\n  context,\n  formDataContext,\n}: ResolveOptions): ResolverValue {\n  const resolvedValue = resolveValue({\n    schema,\n    name: propName,\n    context,\n    formDataContext,\n  });\n\n  // Try to create a type alias for object types\n  const aliased = createTypeAliasIfNeeded({\n    resolvedValue,\n    propName,\n    context,\n  });\n  if (aliased) {\n    return {\n      ...aliased,\n      originalSchema: resolvedValue.originalSchema,\n    };\n  }\n\n  if (propName && resolvedValue.isEnum && !combined && !resolvedValue.isRef) {\n    const doc = jsDoc(resolvedValue.originalSchema);\n    const enumMembers = getEnumMembers(resolvedValue.originalSchema);\n    const nullable = isSchemaNullable(resolvedValue.originalSchema);\n    const { enumGenerationType } = context.output.override;\n    const enumValue = getEnum(\n      enumMembers,\n      propName,\n      nullable,\n      enumGenerationType,\n      context.output.override.namingConvention.enum,\n    );\n\n    return {\n      value: isEnumReferenceMissingNull(\n        enumMembers,\n        nullable,\n        enumGenerationType,\n      )\n        ? `${propName} | null`\n        : propName,\n      imports: [{ name: propName }],\n      schemas: [\n        ...resolvedValue.schemas,\n        {\n          name: propName,\n          model: doc + enumValue,\n          imports: resolvedValue.imports,\n          dependencies: resolvedValue.dependencies,\n          kind: 'enum',\n        },\n      ],\n      isEnum: false,\n      type: 'enum',\n      originalSchema: resolvedValue.originalSchema,\n      isRef: resolvedValue.isRef,\n      hasReadonlyProps: resolvedValue.hasReadonlyProps,\n      dependencies: [...resolvedValue.dependencies, propName],\n    };\n  }\n\n  return resolvedValue;\n}\n\nconst resolveObjectCacheMap = new Map<string, ResolverValue>();\n\nexport function resolveObject({\n  schema,\n  propName,\n  combined = false,\n  context,\n  formDataContext,\n}: ResolveOptions): ResolverValue {\n  const hashKey = JSON.stringify({\n    schema,\n    propName,\n    combined,\n    projectName: context.projectName ?? context.output.target,\n    formDataContext,\n    dynamicScope: context.dynamicScope,\n  });\n\n  if (resolveObjectCacheMap.has(hashKey)) {\n    // .has(...) guarantees existence\n    // oxlint-disable-next-line typescript/no-non-null-assertion\n    return resolveObjectCacheMap.get(hashKey)!;\n  }\n\n  const result = resolveObjectOriginal({\n    schema,\n    propName,\n    combined,\n    context,\n    formDataContext,\n  });\n\n  resolveObjectCacheMap.set(hashKey, result);\n\n  return result;\n}\n","import { resolveExampleRefs } from '../resolvers';\nimport { resolveObject } from '../resolvers/object';\nimport type {\n  ContextSpec,\n  OpenApiSchemaObject,\n  ResolverValue,\n  ScalarValue,\n} from '../types';\nimport { compareVersions, toObjectSchema } from '../utils';\nimport type { FormDataContext } from './object';\n\ninterface GetArrayOptions {\n  schema: OpenApiSchemaObject;\n  name?: string;\n  context: ContextSpec;\n  formDataContext?: FormDataContext;\n}\n\n/**\n * Return the output type from an array\n *\n * @param item item with type === \"array\"\n */\nexport function getArray({\n  schema,\n  name,\n  context,\n  formDataContext,\n}: GetArrayOptions): ScalarValue {\n  schema = toObjectSchema(schema);\n  const schemaPrefixItems = schema.prefixItems;\n  const schemaItems = schema.items;\n  const schemaExample = schema.example as unknown;\n  const schemaExamples = schema.examples as Parameters<\n    typeof resolveExampleRefs\n  >[0];\n\n  const itemPrefix =\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    context.output.override.components.schemas.itemPrefix ?? '';\n  const itemSuffix =\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    context.output.override.components.schemas.itemSuffix ?? '';\n  if (schemaPrefixItems) {\n    const resolvedObjects: ResolverValue[] = schemaPrefixItems.map(\n      (item, index) =>\n        resolveObject({\n          schema: item,\n          propName: name\n            ? itemPrefix + name + itemSuffix + String(index)\n            : undefined,\n          context,\n        }),\n    );\n    if (schemaItems) {\n      const additional = resolveObject({\n        schema: schemaItems,\n        propName: name\n          ? itemPrefix + name + itemSuffix + 'Additional'\n          : undefined,\n        context,\n      });\n      resolvedObjects.push({\n        ...additional,\n        value: `...${additional.value}[]`,\n      });\n    }\n    return {\n      type: 'array',\n      isEnum: false,\n      isRef: false,\n      value: `[${resolvedObjects.map((o) => o.value).join(', ')}]`,\n      imports: resolvedObjects.flatMap((o) => o.imports),\n      schemas: resolvedObjects.flatMap((o) => o.schemas),\n      dependencies: resolvedObjects.flatMap((o) => o.dependencies),\n      hasReadonlyProps: resolvedObjects.some((o) => o.hasReadonlyProps),\n      example: schemaExample,\n      examples: resolveExampleRefs(schemaExamples, context),\n    };\n  }\n  if (schemaItems) {\n    const resolvedObject = resolveObject({\n      schema: schemaItems,\n      propName: name ? itemPrefix + name + itemSuffix : undefined,\n      context,\n      formDataContext,\n    });\n    return {\n      value: `${\n        schema.readOnly === true &&\n        !context.output.override.suppressReadonlyModifier\n          ? 'readonly '\n          : ''\n      }${\n        resolvedObject.value.includes('|') || resolvedObject.value.includes('&')\n          ? `(${resolvedObject.value})[]`\n          : `${resolvedObject.value}[]`\n      }`,\n      imports: resolvedObject.imports,\n      schemas: resolvedObject.schemas,\n      dependencies: resolvedObject.dependencies,\n      isEnum: false,\n      type: 'array',\n      isRef: false,\n      hasReadonlyProps: resolvedObject.hasReadonlyProps,\n      example: schemaExample,\n      examples: resolveExampleRefs(schemaExamples, context),\n    };\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n  } else if (compareVersions(context.spec.openapi ?? '3.0.0', '3.1', '>=')) {\n    return {\n      value: 'unknown[]',\n      imports: [],\n      schemas: [],\n      dependencies: [],\n      isEnum: false,\n      type: 'array',\n      isRef: false,\n      hasReadonlyProps: false,\n    };\n  } else {\n    throw new Error(\n      `All arrays must have an \\`items\\` key defined (name=${name}, schema=${JSON.stringify(schema)})`,\n    );\n  }\n}\n","import type {\n  AngularRuntimeValidation,\n  GeneratorImport,\n  NormalizedAngularRuntimeValidation,\n  NormalizedOverrideOutput,\n  NormalizedRuntimeValidation,\n  OpenApiSchemaObject,\n  RuntimeValidation,\n  RuntimeValidationStrategy,\n} from '../types';\n\n/**\n * The syntactic shape a validation snippet has to take at the call site it is\n * spliced into. Each generator emits validation at one of these four shapes:\n *\n * - `rxjs-map`: a trailing `.pipe(map(...))` operator chained onto an observable\n *   (Angular `HttpClient`, `angular-query`). The mapped value is named `data`.\n * - `clone-expression`: a value expression injected into a larger expression\n *   such as `response.clone({ body: <here> })`. Multi-statement `both` bodies\n *   are IIFE-wrapped so they stay expressions.\n * - `fetch-assign`: a value expression assigned to `const data = <here>` inside\n *   the generated `fetch` function. Also IIFE-wrapped for `both`.\n * - `parse-fn`: the value of Angular `httpResource`'s native `parse:` option —\n *   `throw` emits a bare `Schema.parse` reference, `both` an arrow function.\n */\nexport type RuntimeValidationEmitContext =\n  | 'rxjs-map'\n  | 'clone-expression'\n  | 'fetch-assign'\n  | 'parse-fn';\n\nexport interface EmitResponseValidationOptions {\n  /** Reference to the Zod schema value, e.g. `PetsSchema`. */\n  schemaRef: string;\n  /** Operation name, surfaced in the `both` strategy's `console.error` message. */\n  operationName: string;\n  strategy: RuntimeValidationStrategy;\n  context: RuntimeValidationEmitContext;\n  /**\n   * Source expression to validate. Required for `clone-expression` and\n   * `fetch-assign`; ignored for `rxjs-map` (always `data`) and `parse-fn`\n   * (always the arrow's `raw` parameter).\n   */\n  inputExpression?: string;\n}\n\n/**\n * Builds the statement body shared by every `both` emission: `safeParse`, log\n * the raw `ZodError` for production visibility, then re-throw so the failure\n * still propagates through the client's native error channel.\n *\n * The raw `ZodError` is passed to `console.error` (no `prettifyError`/`flatten`)\n * to stay agnostic across Zod 3 and Zod 4.\n *\n * `operationName` is interpolated into a single-quoted string literal. The\n * default is a sanitized camelCase identifier, but `override.operationName` can\n * return arbitrary strings, so backslashes and single quotes are escaped to\n * keep the generated literal syntactically valid. Sanitized identifiers contain\n * neither character, so common output is unchanged.\n */\nconst escapeSingleQuoted = (value: string): string =>\n  value.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\");\n\nconst buildGuardBody = (\n  schemaRef: string,\n  operationName: string,\n  input: string,\n  subject: 'response' | 'request body' = 'response',\n): string =>\n  `const result = ${schemaRef}.safeParse(${input}); ` +\n  `if (!result.success) { ` +\n  `console.error('[orval] ${escapeSingleQuoted(operationName)} ${subject} validation failed', result.error); ` +\n  `throw result.error; ` +\n  `} ` +\n  `return result.data;`;\n\n/**\n * Emits the response-validation snippet for a single call site.\n *\n * The `throw` strategy is byte-identical to the historical inline\n * `Schema.parse(...)` emission, which keeps existing snapshots unchanged.\n */\nexport const emitResponseValidation = ({\n  schemaRef,\n  operationName,\n  strategy,\n  context,\n  inputExpression,\n}: EmitResponseValidationOptions): string => {\n  switch (context) {\n    case 'rxjs-map':\n      return strategy === 'both'\n        ? `.pipe(map(data => { ${buildGuardBody(schemaRef, operationName, 'data')} }))`\n        : `.pipe(map(data => ${schemaRef}.parse(data)))`;\n\n    case 'clone-expression':\n    case 'fetch-assign': {\n      if (inputExpression === undefined) {\n        throw new Error(\n          `emitResponseValidation: \"${context}\" requires an inputExpression`,\n        );\n      }\n      return strategy === 'both'\n        ? `(() => { ${buildGuardBody(schemaRef, operationName, inputExpression)} })()`\n        : `${schemaRef}.parse(${inputExpression})`;\n    }\n\n    case 'parse-fn':\n      return strategy === 'both'\n        ? `(raw) => { ${buildGuardBody(schemaRef, operationName, 'raw')} }`\n        : `${schemaRef}.parse`;\n  }\n};\n\nexport interface EmitRequestBodyValidationOptions {\n  /** Reference to the Zod schema value, e.g. `CreatePetsBody`. */\n  schemaRef: string;\n  /** Operation name, surfaced in the `both` strategy's `console.error` message. */\n  operationName: string;\n  strategy: RuntimeValidationStrategy;\n  /** The body argument to parse, e.g. `createPetsBody`. */\n  inputExpression: string;\n  /** An omitted optional body is passed through instead of parsed. */\n  isOptional?: boolean;\n}\n\n/**\n * Emits an expression that parses a request body before it is sent. `throw`\n * is a bare `Schema.parse(...)`; `both` logs the raw `ZodError` and re-throws,\n * like its response counterpart.\n */\nexport const emitRequestBodyValidation = ({\n  schemaRef,\n  operationName,\n  strategy,\n  inputExpression,\n  isOptional = false,\n}: EmitRequestBodyValidationOptions): string => {\n  const parse =\n    strategy === 'both'\n      ? `(() => { ${buildGuardBody(schemaRef, operationName, inputExpression, 'request body')} })()`\n      : `${schemaRef}.parse(${inputExpression})`;\n\n  return isOptional\n    ? `${inputExpression} === undefined ? undefined : ${parse}`\n    : parse;\n};\n\n/**\n * Normalizes the user-facing `runtimeValidation` config surface\n * (`boolean | { strategy }`) into the canonical `{ enabled, strategy }` object\n * consumed by the generators.\n *\n * Idempotent: an already-normalized value is returned unchanged, so it is safe\n * to call on an inherited (already-normalized) value — e.g. when a per-operation\n * `query` override inherits the normalized global default.\n */\nexport const normalizeRuntimeValidation = (\n  value: RuntimeValidation | NormalizedRuntimeValidation | undefined,\n): NormalizedRuntimeValidation => {\n  if (!value) {\n    return { enabled: false, strategy: 'throw' };\n  }\n  if (value === true) {\n    return { enabled: true, strategy: 'throw' };\n  }\n  // Already-normalized canonical object — return as-is (idempotent).\n  if ('enabled' in value) {\n    return value;\n  }\n  // oxlint-disable-next-line typescript/no-unnecessary-condition\n  return { enabled: true, strategy: value.strategy ?? 'throw' };\n};\n\n/**\n * Angular variant of {@link normalizeRuntimeValidation}: also resolves the\n * `requestBodies` opt-in, which only the object form can switch on.\n * Idempotent, like the shared normalizer.\n */\nexport const normalizeAngularRuntimeValidation = (\n  value:\n    | AngularRuntimeValidation\n    | NormalizedAngularRuntimeValidation\n    | undefined,\n): NormalizedAngularRuntimeValidation => {\n  if (typeof value !== 'object') {\n    return { ...normalizeRuntimeValidation(value), requestBodies: false };\n  }\n  if ('enabled' in value) {\n    return value;\n  }\n  return {\n    ...normalizeRuntimeValidation({ strategy: value.strategy ?? 'throw' }),\n    requestBodies: value.requestBodies ?? false,\n  };\n};\n\n/**\n * Bare TypeScript definitions without a schema binding. When enabled, inline\n * scalar responses get named schemas before reaching the client generators;\n * `void`/`unknown` still have no schema to parse against.\n */\nconst RESPONSE_PRIMITIVE_TYPES = new Set([\n  'string',\n  'number',\n  'boolean',\n  'void',\n  'unknown',\n]);\n\n/**\n * Indicates whether a response definition names a primitive (non-schema) type,\n * which runtime validation skips.\n */\nexport const isPrimitiveResponseType = (t: string | undefined): boolean =>\n  t !== undefined && RESPONSE_PRIMITIVE_TYPES.has(t);\n\nconst RESPONSE_SCALAR_SCHEMA_TYPES = new Set([\n  'string',\n  'number',\n  'integer',\n  'boolean',\n  'null',\n]);\n\n/**\n * Whether an inline response describes scalar JSON data. Inspect the source\n * schema rather than its TypeScript definition: `integer` and `number` both\n * become `number`, while nullable scalars and enums need their full schema.\n * Missing/unconstrained schemas and arrays are deliberately left alone.\n */\nexport const isPrimitiveResponseSchema = (\n  schema: OpenApiSchemaObject,\n): boolean => {\n  if (typeof schema !== 'object' || '$ref' in schema) return false;\n\n  if (schema.type) {\n    const types = Array.isArray(schema.type) ? schema.type : [schema.type];\n    return (\n      types.length > 0 &&\n      types.every((type) => RESPONSE_SCALAR_SCHEMA_TYPES.has(type))\n    );\n  }\n\n  const combined = schema.anyOf ?? schema.oneOf ?? schema.allOf;\n  if (combined) {\n    return combined.length > 0 && combined.every(isPrimitiveResponseSchema);\n  }\n\n  const isScalar = (value: unknown) =>\n    value === null || ['string', 'number', 'boolean'].includes(typeof value);\n  if (schema.enum) {\n    return schema.enum.length > 0 && schema.enum.every(isScalar);\n  }\n  return 'const' in schema && isScalar(schema.const);\n};\n\n/**\n * Indicates whether the response imports carry a schema for the given type\n * name — the precondition for emitting a `Schema.parse`/`safeParse` call.\n */\nexport const hasSchemaImport = (\n  imports: readonly { name: string }[],\n  typeName: string | undefined,\n): boolean =>\n  typeName !== undefined && imports.some((imp) => imp.name === typeName);\n\n/**\n * Maps a response type name to the identifier its Zod schema value is bound to\n * at the call site. `Error` collides with the global constructor, so validated\n * call sites reference that schema as `ErrorSchema`.\n */\nexport const getSchemaValueRef = (typeName: string): string =>\n  typeName === 'Error' ? 'ErrorSchema' : typeName;\n\n/**\n * Maps a schema type name to its Zod output-type alias (`${typeName}Output`),\n * emitted next to every schema in zod-schemas mode. A validated response\n * returns `zod.output` at runtime, so its declared type must reference this\n * alias — the bare schema name aliases `zod.input`, which diverges under\n * `coerce`, `useDates`, defaults and transforms.\n */\nexport const getSchemaOutputTypeRef = (typeName: string): string =>\n  `${typeName}Output`;\n\n/**\n * Rewrites a verb's response imports for a runtime-validated response: the\n * schema import becomes a value import (the generated code calls\n * `parse`/`safeParse` on it), and the schema's `Output` type alias is imported\n * for the declared response type. `zodBaseName` routes the alias import to the\n * base schema's `.zod` file in per-file (`indexFiles: false`) layouts.\n *\n * `includeOutputType: false` keeps the value-import flip but skips the alias —\n * for call sites where validation is delegated (e.g. a custom mutator handed\n * the schema via `includeZodSchemaInArguments`) and the declared type is\n * intentionally left as the schema (input) name.\n */\nexport const rewriteImportsForResponseValidation = (\n  imports: readonly GeneratorImport[],\n  responseType: string,\n  { includeOutputType = true }: { includeOutputType?: boolean } = {},\n): GeneratorImport[] => [\n  ...imports.map((imp) =>\n    imp.name === responseType ? { ...imp, values: true } : imp,\n  ),\n  ...(includeOutputType\n    ? [\n        {\n          name: getSchemaOutputTypeRef(responseType),\n          zodBaseName: responseType,\n        },\n      ]\n    : []),\n];\n\n/**\n * How a validated array response is composed from its element schema.\n *\n * An inline `type: array` response resolves to the definition `Item[]`, and\n * every gate into Zod runtime validation compares that definition to the\n * response import names verbatim. `Item[]` never equals `Item`, so the whole\n * validation branch is skipped while a `$ref` to a *named* array component\n * validates normally (#3718, #4106). The element carries the generated schema;\n * the array wrapper is composed at the use site.\n */\nexport interface ArrayResponseSchema {\n  /** Element schema name, e.g. `Item` — the import to promote to a value. */\n  elementName: string;\n  /** Expression to call `.parse` on, e.g. `zod.array(Item)`. */\n  schemaRef: string;\n  /** Declared type of the parsed value, e.g. `ItemOutput[]`. */\n  outputTypeRef: string;\n}\n\n/** A definition that is exactly one `[]` level over a bare identifier. */\nconst ARRAY_DEFINITION_PATTERN = /^([A-Za-z_$][\\w$]*)\\[]$/;\n\n/**\n * Resolves the array-response shape described by {@link ArrayResponseSchema},\n * or `undefined` when the definition is not a validatable array.\n *\n * Deliberately narrow. A primitive element (`string[]`) has no generated schema\n * to compose from, and a nested array (`Item[][]`) is left alone rather than\n * guessed at — both keep their current unvalidated output.\n *\n * @param toValueRef Maps the element name to the identifier its schema value is\n *   bound to at the call site (`Error` is emitted as `ErrorSchema`).\n */\nexport const getArrayResponseSchema = (\n  imports: readonly { name: string }[],\n  definition: string | undefined,\n  toValueRef: (typeName: string) => string = (typeName) => typeName,\n): ArrayResponseSchema | undefined => {\n  if (definition === undefined) return undefined;\n\n  const elementName = ARRAY_DEFINITION_PATTERN.exec(definition)?.[1];\n  if (elementName === undefined || isPrimitiveResponseType(elementName)) {\n    return undefined;\n  }\n  if (!imports.some((imp) => imp.name === elementName)) return undefined;\n\n  return {\n    elementName,\n    schemaRef: `zod.array(${toValueRef(elementName)})`,\n    outputTypeRef: `${getSchemaOutputTypeRef(elementName)}[]`,\n  };\n};\n\n/**\n * Module specifier for the `zod` namespace import that composed array\n * expressions reference. Mini ships its constructors from a separate entry\n * point, and only the functional `zod.array(...)` form exists there — which is\n * why the composed expression is built that way rather than as `Item.array()`.\n */\nexport const getZodNamespaceImportSource = (\n  override?: NormalizedOverrideOutput,\n): string => (override?.zod.variant === 'mini' ? 'zod/mini' : 'zod');\n\n/** The namespace import a composed `zod.array(...)` expression requires. */\nexport const getZodNamespaceImport = (override?: NormalizedOverrideOutput) => ({\n  name: 'zod',\n  values: true,\n  namespaceImport: true,\n  importPath: getZodNamespaceImportSource(override),\n});\n","import {\n  isBooleanJsonSchema,\n  isNullSchema,\n} from '@scalar/openapi-types/helpers';\nimport { keyword } from 'esutils';\n\nimport { isPrimitiveResponseSchema } from '../generators/runtime-validation';\nimport { resolveObject } from '../resolvers/object';\nimport { resolveExampleRefs, resolveRef } from '../resolvers/ref';\nimport {\n  type ContextSpec,\n  FormDataArrayHandling,\n  type GeneratorImport,\n  type GetterResponse,\n  type OpenApiEncodingObject,\n  type OpenApiMediaTypeObject,\n  type OpenApiReferenceObject,\n  type OpenApiRequestBodyObject,\n  type OpenApiResponseObject,\n  type OpenApiSchemaObject,\n  type ResReqTypesValue,\n} from '../types';\nimport { uniqueBy } from '../utils';\nimport { camel, isInlineSchema, isSchemaNullable, sanitize } from '../utils';\nimport { pascal, conventionName } from '../utils/case';\nimport {\n  getFormDataFieldFileType,\n  isBinaryContentType,\n} from '../utils/content-type';\nimport { getNumberWord, jsStringLiteralEscape } from '../utils/string';\nimport { getKey, getPropertyNameCollisionKeys } from './keys';\nimport type { FormDataContext } from './object';\n\nconst getSchemaType = (s: OpenApiSchemaObject) =>\n  isBooleanJsonSchema(s)\n    ? undefined\n    : (s.type as string | string[] | undefined);\nconst getSchemaCombined = (s: OpenApiSchemaObject) =>\n  isBooleanJsonSchema(s) ? undefined : (s.oneOf ?? s.anyOf ?? s.allOf);\nconst getSchemaOneOf = (s: OpenApiSchemaObject) =>\n  isBooleanJsonSchema(s) ? undefined : s.oneOf;\nconst getSchemaAnyOf = (s: OpenApiSchemaObject) =>\n  isBooleanJsonSchema(s) ? undefined : s.anyOf;\nconst getSchemaItems = (s: OpenApiSchemaObject) =>\n  isBooleanJsonSchema(s) ? undefined : s.items;\nconst getSchemaRequired = (s: OpenApiSchemaObject) =>\n  isBooleanJsonSchema(s) ? undefined : s.required;\nconst getSchemaProperties = (s: OpenApiSchemaObject) =>\n  isBooleanJsonSchema(s) ? undefined : s.properties;\nconst resolveSchemaRef = (\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  context: ContextSpec,\n) =>\n  resolveRef(schema as OpenApiReferenceObject, context) as {\n    schema: OpenApiSchemaObject;\n    imports: GeneratorImport[];\n  };\nconst resolveResponseOrRequestRef = (\n  schema: OpenApiReferenceObject,\n  context: ContextSpec,\n) =>\n  resolveRef(schema, context) as {\n    schema: OpenApiResponseObject | OpenApiRequestBodyObject;\n    imports: GeneratorImport[];\n  };\n\nconst formDataContentTypes = new Set(['multipart/form-data']);\n\nconst formUrlEncodedContentTypes = new Set([\n  'application/x-www-form-urlencoded',\n]);\n\ninterface GetResReqContentTypesOptions {\n  mediaType: OpenApiMediaTypeObject;\n  propName?: string;\n  context: ContextSpec;\n  isFormData?: boolean;\n  contentType: string;\n  generatePrimitiveSchema?: boolean;\n}\n\nfunction getResReqContentTypes({\n  mediaType,\n  propName,\n  context,\n  isFormData,\n  contentType,\n  generatePrimitiveSchema,\n}: GetResReqContentTypesOptions) {\n  // `false` is a JSON Schema that admits nothing (`never`). Only a missing\n  // schema means this media type has no type to emit.\n  // oxlint-disable-next-line typescript/no-unnecessary-condition\n  if (mediaType.schema === undefined || mediaType.schema === null) {\n    return;\n  }\n\n  // For form bodies, pass context that tracks encoding for file type\n  // detection. url-encoded bodies additionally flag `urlEncoded` so file/binary\n  // fields are typed as `string` rather than `Blob` (#1624).\n  const isFormUrlEncoded = formUrlEncodedContentTypes.has(contentType);\n  const formDataContext: FormDataContext | undefined = isFormData\n    ? { atPart: false, encoding: mediaType.encoding ?? {} }\n    : isFormUrlEncoded\n      ? { atPart: false, encoding: mediaType.encoding ?? {}, urlEncoded: true }\n      : undefined;\n\n  const resolvedObject = resolveObject({\n    schema: mediaType.schema,\n    propName,\n    context,\n    formDataContext,\n  });\n\n  // Known binary content type → Blob (overrides schema)\n  // This ensures correct responseType ('blob') even when schema lacks format: binary.\n  if (!isFormData && isBinaryContentType(contentType)) {\n    return {\n      ...resolvedObject,\n      value: 'Blob',\n    };\n  }\n\n  if (\n    generatePrimitiveSchema &&\n    propName &&\n    isPrimitiveResponseSchema(mediaType.schema) &&\n    resolvedObject.value !== 'Blob'\n  ) {\n    // Use the normal schema writers, so Zod version/variant, integer checks,\n    // formats, enums and nullability follow the same rules as components.\n    const existingSchema = resolvedObject.schemas.find(\n      ({ name }) => name === propName,\n    );\n    return {\n      ...resolvedObject,\n      value: propName,\n      imports: [{ name: propName }],\n      schemas: [\n        ...resolvedObject.schemas.filter(({ name }) => name !== propName),\n        {\n          name: propName,\n          model:\n            existingSchema?.model ??\n            `export type ${propName} = ${resolvedObject.value};\\n`,\n          imports: existingSchema?.imports ?? resolvedObject.imports,\n          dependencies:\n            existingSchema?.dependencies ?? resolvedObject.dependencies,\n          kind: existingSchema?.kind ?? ('schema' as const),\n          schema: resolvedObject.originalSchema,\n        },\n      ],\n    };\n  }\n\n  return resolvedObject;\n}\n\nexport function getResReqTypes(\n  responsesOrRequests: [\n    string,\n    OpenApiReferenceObject | OpenApiResponseObject | OpenApiRequestBodyObject,\n  ][],\n  name: string,\n  context: ContextSpec,\n  defaultType = 'unknown',\n  uniqueKey: (\n    item: ResReqTypesValue,\n    index: number,\n    data: ResReqTypesValue[],\n  ) => unknown = (item) => item.value,\n  generatePrimitiveSchemas = false,\n): ResReqTypesValue[] {\n  const typesArray = responsesOrRequests\n    .filter(([, res]) => Boolean(res))\n    .map(([key, res]) => {\n      if (!isInlineSchema(res)) {\n        const {\n          schema: bodySchema,\n          imports: [{ name, schemaName }],\n        } = resolveResponseOrRequestRef(res, context);\n\n        const firstEntry = Object.entries(bodySchema.content ?? {}).at(0);\n\n        if (!firstEntry) {\n          return [\n            {\n              value: name,\n              imports: [{ name, schemaName }],\n              schemas: [],\n              type: 'unknown',\n              isEnum: false,\n              isRef: true,\n              hasReadonlyProps: false,\n              dependencies: [name],\n              originalSchema: undefined,\n              example: undefined,\n              examples: undefined,\n              key,\n              contentType: '',\n            },\n          ] as ResReqTypesValue[];\n        }\n\n        const [contentType, mediaType] = firstEntry;\n\n        const isFormData = formDataContentTypes.has(contentType);\n        const isFormUrlEncoded = formUrlEncodedContentTypes.has(contentType);\n\n        if ((!isFormData && !isFormUrlEncoded) || !mediaType.schema) {\n          return [\n            {\n              value: name,\n              imports: [{ name, schemaName }],\n              schemas: [],\n              type: 'unknown',\n              isEnum: false,\n              isRef: true,\n              hasReadonlyProps: false,\n              dependencies: [name],\n              originalSchema: mediaType.schema,\n              example: mediaType.example,\n              examples: resolveExampleRefs(\n                mediaType.examples as\n                  | Record<string, OpenApiReferenceObject | { value?: unknown }>\n                  | undefined,\n                context,\n              ),\n              key,\n              contentType,\n            },\n          ] as ResReqTypesValue[];\n        }\n\n        // OpenAPI defaults requestBody.required to false when the key is absent.\n        const isRequestBodyOptional =\n          !('required' in bodySchema) || bodySchema.required !== true;\n\n        const formData = isFormData\n          ? getSchemaFormDataAndUrlEncoded({\n              name,\n              schemaObject: mediaType.schema,\n              context,\n              isRequestBodyOptional,\n              isRef: true,\n              encoding: mediaType.encoding,\n            })\n          : undefined;\n\n        const formUrlEncoded = isFormUrlEncoded\n          ? getSchemaFormDataAndUrlEncoded({\n              name,\n              schemaObject: mediaType.schema,\n              context,\n              isRequestBodyOptional,\n              isUrlEncoded: true,\n              isRef: true,\n              encoding: mediaType.encoding,\n            })\n          : undefined;\n\n        const additionalImports = getFormDataAdditionalImports({\n          schemaObject: mediaType.schema,\n          context,\n        });\n\n        return [\n          {\n            value: name,\n            imports: [{ name, schemaName }, ...additionalImports],\n            schemas: [],\n            type: 'unknown',\n            isEnum: false,\n            hasReadonlyProps: false,\n            dependencies: [name],\n            formData,\n            formUrlEncoded,\n            isRef: true,\n            originalSchema: mediaType.schema,\n            example: mediaType.example,\n            examples: resolveExampleRefs(mediaType.examples, context),\n            key,\n            contentType,\n          },\n        ] as ResReqTypesValue[];\n      }\n\n      if (res.content) {\n        const contents = Object.entries(res.content).map(\n          ([contentType, mediaType], index, arr) => {\n            let propName = key\n              ? sanitize(pascal(name) + pascal(key), {\n                  underscore: '_',\n                  whitespace: '_',\n                  dash: true,\n                  es5keyword: true,\n                  es5IdentifierName: true,\n                })\n              : undefined;\n\n            if (propName && arr.length > 1) {\n              propName = propName + pascal(getNumberWord(index + 1));\n            }\n\n            const isFormData = formDataContentTypes.has(contentType);\n            const isFormUrlEncoded =\n              formUrlEncodedContentTypes.has(contentType);\n\n            // When schema is a $ref, use schema name for consistent param naming\n            let effectivePropName = propName;\n            if (mediaType.schema && !isInlineSchema(mediaType.schema)) {\n              const { imports } = resolveSchemaRef(mediaType.schema, context);\n              if (imports[0]?.name) {\n                effectivePropName = imports[0].name;\n              }\n            } else if ((isFormData || isFormUrlEncoded) && mediaType.schema) {\n              // For form-data and url-encoded, the param name is also the\n              // runtime variable iterated by the FormData/URLSearchParams code.\n              // Derive it from the inner DTO names so it matches the function\n              // parameter (#3242). Scoped to these content types: forcing the\n              // schema name elsewhere aliases the import to `Foo as __Foo` in\n              // split mode and broke the MSW mock filter (#3269).\n              const combinedRefs =\n                getSchemaOneOf(mediaType.schema) ??\n                getSchemaAnyOf(mediaType.schema);\n              if (combinedRefs) {\n                const names: string[] = [];\n                for (const ref of combinedRefs) {\n                  if (isInlineSchema(ref)) continue;\n                  const refName = resolveSchemaRef(ref, context).imports[0]\n                    ?.name;\n                  if (refName) {\n                    names.push(refName);\n                  }\n                }\n                if (names.length > 0) {\n                  effectivePropName = names.join('');\n                }\n              }\n            }\n\n            const resolvedValue = getResReqContentTypes({\n              mediaType,\n              propName: effectivePropName,\n              context,\n              isFormData,\n              contentType,\n              generatePrimitiveSchema:\n                generatePrimitiveSchemas &&\n                key.startsWith('2') &&\n                contentType.includes('json') &&\n                !contentType.includes('ndjson') &&\n                !contentType.includes('nd-json'),\n            });\n\n            if (!resolvedValue) {\n              // openapi spec 3.1 allows describing binary responses with only a content type\n              if (isBinaryContentType(contentType)) {\n                return {\n                  value: 'Blob',\n                  imports: [],\n                  schemas: [],\n                  type: 'Blob',\n                  isEnum: false,\n                  key,\n                  isRef: false,\n                  hasReadonlyProps: false,\n                  contentType,\n                };\n              }\n\n              return;\n            }\n\n            if (\n              (!isFormData && !isFormUrlEncoded) ||\n              !effectivePropName ||\n              !mediaType.schema\n            ) {\n              return {\n                ...resolvedValue,\n                imports: resolvedValue.imports,\n                dependencies: resolvedValue.dependencies,\n                contentType,\n                example: mediaType.example,\n                examples: resolveExampleRefs(mediaType.examples, context),\n              };\n            }\n\n            const formData = isFormData\n              ? getSchemaFormDataAndUrlEncoded({\n                  name: effectivePropName,\n                  schemaObject: mediaType.schema,\n                  context,\n                  isRequestBodyOptional:\n                    !('required' in res) || res.required !== true,\n                  isRef: true,\n                  encoding: mediaType.encoding,\n                })\n              : undefined;\n\n            const formUrlEncoded = isFormUrlEncoded\n              ? getSchemaFormDataAndUrlEncoded({\n                  name: effectivePropName,\n                  schemaObject: mediaType.schema,\n                  context,\n                  isUrlEncoded: true,\n                  isRequestBodyOptional:\n                    !('required' in res) || res.required !== true,\n                  isRef: true,\n                  encoding: mediaType.encoding,\n                })\n              : undefined;\n\n            const additionalImports = getFormDataAdditionalImports({\n              schemaObject: mediaType.schema,\n              context,\n            });\n            return {\n              ...resolvedValue,\n              imports: [...resolvedValue.imports, ...additionalImports],\n              formData,\n              formUrlEncoded,\n              contentType,\n              example: mediaType.example,\n              examples: resolveExampleRefs(\n                mediaType.examples as\n                  | Record<string, OpenApiReferenceObject | { value?: unknown }>\n                  | undefined,\n                context,\n              ),\n            };\n          },\n        );\n\n        return contents\n          .filter(Boolean)\n          .map((x) => ({ ...x, key })) as ResReqTypesValue[];\n      }\n      const swaggerSchema =\n        'schema' in res\n          ? (\n              res as {\n                schema?: OpenApiSchemaObject | OpenApiReferenceObject;\n              }\n            ).schema\n          : undefined;\n\n      if (swaggerSchema) {\n        const propName = key\n          ? sanitize(pascal(name) + pascal(key), {\n              underscore: '_',\n              whitespace: '_',\n              dash: true,\n              es5keyword: true,\n              es5IdentifierName: true,\n            })\n          : undefined;\n        const resolvedValue = resolveObject({\n          schema: swaggerSchema,\n          propName,\n          context,\n        });\n\n        return [\n          {\n            ...resolvedValue,\n            contentType: 'application/json',\n            key,\n          },\n        ] as ResReqTypesValue[];\n      }\n\n      return [\n        {\n          value: defaultType,\n          imports: [],\n          schemas: [],\n          type: defaultType,\n          isEnum: false,\n          dependencies: [],\n          key,\n          isRef: false,\n          hasReadonlyProps: false,\n          contentType: 'application/json',\n        },\n      ] as ResReqTypesValue[];\n    });\n\n  return uniqueBy(typesArray.flat(), uniqueKey);\n}\n\n/**\n * Determine the responseType option based on success content types only.\n * This avoids error-response content types influencing the responseType.\n */\nexport function getSuccessResponseType(\n  response: GetterResponse,\n): 'blob' | 'text' | undefined {\n  const successContentTypes = response.types.success\n    .map((t) => t.contentType)\n    .filter(Boolean);\n\n  if (response.isBlob) {\n    return 'blob' as const;\n  }\n\n  const hasJsonResponse = successContentTypes.some(\n    (contentType) =>\n      contentType.includes('json') || contentType.includes('+json'),\n  );\n  const hasTextResponse = successContentTypes.some(\n    (contentType) =>\n      contentType.startsWith('text/') || contentType.includes('xml'),\n  );\n\n  if (!hasJsonResponse && hasTextResponse) {\n    return 'text' as const;\n  }\n\n  return undefined;\n}\n\n/**\n * Get the default content type from a list of content types.\n * Priority: application/json > any JSON-like type > first in list\n *\n * @param contentTypes - Array of content types from OpenAPI spec\n * @returns The default content type to use\n */\nexport function getDefaultContentType(contentTypes: string[]): string {\n  if (contentTypes.length === 0) {\n    return 'application/json';\n  }\n\n  // Prefer application/json\n  if (contentTypes.includes('application/json')) {\n    return 'application/json';\n  }\n\n  // Prefer any JSON-like type\n  const jsonType = contentTypes.find(\n    (ct) => ct.includes('+json') || ct.includes('-json'),\n  );\n  if (jsonType) {\n    return jsonType;\n  }\n\n  // Default to first\n  return contentTypes[0];\n}\n\ninterface GetFormDataAdditionalImportsOptions {\n  schemaObject: OpenApiSchemaObject | OpenApiReferenceObject;\n  context: ContextSpec;\n}\n\nfunction getFormDataAdditionalImports({\n  schemaObject,\n  context,\n}: GetFormDataAdditionalImportsOptions): GeneratorImport[] {\n  const { schema } = resolveSchemaRef(schemaObject, context);\n\n  if (getSchemaType(schema) !== 'object') {\n    return [];\n  }\n\n  const combinedSchemas = getSchemaOneOf(schema) ?? getSchemaAnyOf(schema);\n\n  if (!combinedSchemas) {\n    return [];\n  }\n\n  return combinedSchemas\n    .map((subSchema) => resolveSchemaRef(subSchema, context).imports[0])\n    .filter(Boolean);\n}\n\ninterface GetSchemaFormDataAndUrlEncodedOptions {\n  name: string;\n  schemaObject: OpenApiSchemaObject | OpenApiReferenceObject;\n  context: ContextSpec;\n  isRequestBodyOptional: boolean;\n  isUrlEncoded?: boolean;\n  isRef?: boolean;\n  encoding?: Record<string, OpenApiEncodingObject>;\n}\n\nfunction getSchemaFormDataAndUrlEncoded({\n  name,\n  schemaObject,\n  context,\n  isRequestBodyOptional,\n  isUrlEncoded,\n  isRef,\n  encoding,\n}: GetSchemaFormDataAndUrlEncodedOptions): string {\n  const { schema, imports } = resolveSchemaRef(schemaObject, context);\n  const propName = camel(\n    !isRef && !isInlineSchema(schemaObject) ? imports[0].name : name,\n  );\n\n  const variableName = isUrlEncoded ? 'formUrlEncoded' : 'formData';\n  let form = isUrlEncoded\n    ? `const ${variableName} = new URLSearchParams();\\n`\n    : `const ${variableName} = new FormData();\\n`;\n\n  const combinedSchemas = getSchemaCombined(schema);\n  const schemaType = getSchemaType(schema);\n  if (\n    schemaType === 'object' ||\n    (schemaType === undefined && combinedSchemas)\n  ) {\n    if (combinedSchemas) {\n      const shouldCast = !!getSchemaOneOf(schema) || !!getSchemaAnyOf(schema);\n\n      if (shouldCast) {\n        // If the outer schema also has direct properties, those are handled\n        // below by the dedicated properties branch. Skip them here to avoid\n        // appending the same key twice. Exclude readOnly direct properties\n        // so they can still flow through the runtime loop if a variant\n        // declares the same key as writable.\n        const directProperties = getSchemaProperties(schema);\n        const directKeys = directProperties\n          ? Object.entries(directProperties)\n              .filter(([, value]) => {\n                const resolved = resolveSchemaRef(value, context).schema;\n                return isBooleanJsonSchema(resolved) || !resolved.readOnly;\n              })\n              .map(([key]) => key)\n          : [];\n        const skipLine =\n          directKeys.length > 0\n            ? `  if ([${directKeys.map((k) => JSON.stringify(k)).join(', ')}].includes(key)) return;\\n`\n            : '';\n\n        form += `Object.entries(${propName} ?? {}).forEach(([key, value]) => {\\n`;\n        form += skipLine;\n        form += `  if (value !== undefined && value !== null) {\\n`;\n        if (isUrlEncoded) {\n          // url-encoded: URLSearchParams holds strings only, so File/Blob/\n          // Buffer handling does not apply — coerce every value to string (#1624)\n          form += `    if (Array.isArray(value)) {\\n`;\n          form += `      value.forEach(v => {\\n`;\n          form += `        ${variableName}.append(key, typeof v === 'object' ? JSON.stringify(v) : String(v));\\n`;\n          form += `      });\\n`;\n          form += `    } else if (typeof value === 'object') {\\n`;\n          form += `      ${variableName}.append(key, JSON.stringify(value));\\n`;\n          form += `    } else {\\n`;\n          form += `      ${variableName}.append(key, String(value));\\n`;\n          form += `    }\\n`;\n        } else {\n          form += `    if ((typeof File !== 'undefined' && value instanceof File) || value instanceof Blob) {\\n`;\n          form += `      ${variableName}.append(key, value);\\n`;\n          form += `    } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\\n`;\n          form += `      ${variableName}.append(key, new Blob([Uint8Array.from(value)]));\\n`;\n          form += `    } else if (Array.isArray(value)) {\\n`;\n          form += `      value.forEach(v => {\\n`;\n          form += `        if ((typeof File !== 'undefined' && v instanceof File) || v instanceof Blob) {\\n`;\n          form += `          ${variableName}.append(key, v);\\n`;\n          form += `        } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(v)) {\\n`;\n          form += `          ${variableName}.append(key, new Blob([Uint8Array.from(v)]));\\n`;\n          form += `        } else {\\n`;\n          form += `          ${variableName}.append(key, typeof v === 'object' ? JSON.stringify(v) : String(v));\\n`;\n          form += `        }\\n`;\n          form += `      });\\n`;\n          form += `    } else if (typeof value === 'object') {\\n`;\n          form += `      ${variableName}.append(key, JSON.stringify(value));\\n`;\n          form += `    } else {\\n`;\n          form += `      ${variableName}.append(key, String(value));\\n`;\n          form += `    }\\n`;\n        }\n        form += `  }\\n`;\n        form += `});\\n`;\n      } else {\n        const combinedSchemasFormData = combinedSchemas\n          .map((subSchema) => {\n            const { schema: combinedSchema } = resolveSchemaRef(\n              subSchema,\n              context,\n            );\n            return resolveSchemaPropertiesToFormData({\n              schema: combinedSchema,\n              variableName,\n              propName,\n              context,\n              isRequestBodyOptional,\n              encoding,\n            });\n          })\n          .filter(Boolean)\n          .join('\\n');\n\n        form += combinedSchemasFormData;\n      }\n    }\n\n    if (getSchemaProperties(schema)) {\n      const formDataValues = resolveSchemaPropertiesToFormData({\n        schema,\n        variableName,\n        propName,\n        context,\n        isRequestBodyOptional,\n        encoding,\n      });\n\n      form += formDataValues;\n    }\n\n    return form;\n  }\n\n  if (getSchemaType(schema) === 'array') {\n    let valueStr = 'value';\n    const schemaItems = getSchemaItems(schema);\n    if (schemaItems) {\n      const { schema: resolvedItem } = resolveSchemaRef(schemaItems, context);\n      const itemSchema = unwrapNullableSchema(resolvedItem, context);\n      const itemType = getSchemaType(resolvedItem);\n      if (\n        isEffectivelyObjectSchema(itemSchema, context) ||\n        isEffectivelyArraySchema(itemSchema, context)\n      ) {\n        valueStr = 'JSON.stringify(value)';\n      } else if (\n        itemType === 'number' ||\n        itemType === 'integer' ||\n        itemType === 'boolean'\n      ) {\n        valueStr = 'value.toString()';\n      }\n    }\n\n    return `${form}${propName}.forEach(value => ${variableName}.append('data', ${valueStr}))\\n`;\n  }\n\n  const scalarType = getSchemaType(schema);\n  if (\n    scalarType === 'number' ||\n    scalarType === 'integer' ||\n    scalarType === 'boolean'\n  ) {\n    return `${form}${variableName}.append('data', ${propName}.toString())\\n`;\n  }\n\n  return `${form}${variableName}.append('data', ${propName})\\n`;\n}\n\n/**\n * Determines whether a schema is object-shaped once `allOf` composition is\n * resolved, without assuming \"has allOf\" implies \"is an object\" (allOf is a\n * generic AND-combinator in JSON Schema and can just as validly compose a\n * constrained string or number). Classifies as object-like only when a\n * resolved branch positively establishes an object shape (own `type:\n * object`, `properties`, `additionalProperties`, or a nested allOf member\n * that itself resolves to an object) — an inconclusive/scalar result never\n * defaults to \"object\".\n */\nexport function isEffectivelyObjectSchema(\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n  seen: Set<OpenApiSchemaObject> = new Set(),\n): boolean {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  if (seen.has(schema)) {\n    // Recursive schema (e.g. a self-referential allOf chain) — bail out\n    // rather than looping; nothing further down this branch can add new\n    // information anyway.\n    return false;\n  }\n  seen.add(schema);\n\n  if (\n    schema.type === 'object' ||\n    (Array.isArray(schema.type) && schema.type.includes('object'))\n  ) {\n    return true;\n  }\n  if (schema.properties || schema.additionalProperties) {\n    return true;\n  }\n\n  const schemaAllOf = schema.allOf;\n  if (Array.isArray(schemaAllOf)) {\n    return schemaAllOf.some((member) => {\n      const { schema: resolved } = resolveSchemaRef(member, context);\n      return isEffectivelyObjectSchema(resolved, context, seen);\n    });\n  }\n\n  return false;\n}\n\n/**\n * Array counterpart of {@link isEffectivelyObjectSchema}: `type: array`\n * either on the schema itself or behind its `allOf` members.\n */\nfunction isEffectivelyArraySchema(\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n  seen: Set<OpenApiSchemaObject> = new Set(),\n): boolean {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  if (seen.has(schema)) {\n    return false;\n  }\n  seen.add(schema);\n\n  if (schema.type === 'array') {\n    return true;\n  }\n\n  const schemaAllOf = schema.allOf;\n  return (\n    Array.isArray(schemaAllOf) &&\n    schemaAllOf.some((member) => {\n      const { schema: resolved } = resolveSchemaRef(member, context);\n      return isEffectivelyArraySchema(resolved, context, seen);\n    })\n  );\n}\n\n/**\n * The only non-null branch of an `anyOf`/`oneOf` wrapper, e.g.\n * `anyOf: [{ $ref }, { type: 'null' }]`, which is how an OAS 3.0\n * `nullable: true` next to a `$ref` or `allOf` arrives after the upgrade.\n * A schema that is typed or object-shaped on its own is returned as is.\n */\nfunction unwrapNullableSchema(\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n): OpenApiSchemaObject {\n  if (\n    isBooleanJsonSchema(schema) ||\n    schema.type !== undefined ||\n    isEffectivelyObjectSchema(schema, context)\n  ) {\n    return schema;\n  }\n\n  const branches = (schema.anyOf ?? schema.oneOf ?? [])\n    .map((branch) => resolveSchemaRef(branch, context).schema)\n    .filter((branch) => !isNullSchema(branch));\n\n  return branches.length === 1 ? branches[0] : schema;\n}\n\n/**\n * Collects a schema's own `properties`, merged with any `properties`\n * reachable through `allOf` composition (recursively, following `$ref`s).\n * A pure wrapper schema (`{ allOf: [{ $ref: ... }] }`) has no `properties`\n * of its own — its fields only exist behind the allOf member — so a plain\n * `schema.properties` read misses them entirely.\n */\nexport function collectPropertiesThroughAllOf(\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n  seen: Set<OpenApiSchemaObject> = new Set(),\n): Record<string, OpenApiSchemaObject | OpenApiReferenceObject> {\n  if (isBooleanJsonSchema(schema)) {\n    return {};\n  }\n  if (seen.has(schema)) {\n    return {};\n  }\n  seen.add(schema);\n\n  const ownProps = getSchemaProperties(schema) ?? {};\n  const schemaAllOf = schema.allOf;\n\n  if (!Array.isArray(schemaAllOf)) {\n    return ownProps;\n  }\n\n  let merged: Record<string, OpenApiSchemaObject | OpenApiReferenceObject> = {};\n  for (const member of schemaAllOf) {\n    const { schema: resolved } = resolveSchemaRef(member, context);\n    merged = {\n      ...merged,\n      ...collectPropertiesThroughAllOf(resolved, context, seen),\n    };\n  }\n  // Own properties (if any) take precedence over allOf-inherited ones,\n  // matching how allOf member conflicts are resolved elsewhere.\n  return { ...merged, ...ownProps };\n}\n\n/**\n * Same reasoning as {@link collectPropertiesThroughAllOf}, but for\n * `required`: a pure `allOf` wrapper schema has no `required` array of its\n * own, so a plain `schema.required` read loses required-ness for every\n * field that only exists behind the allOf composition.\n */\nexport function collectRequiredThroughAllOf(\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n  seen: Set<OpenApiSchemaObject> = new Set(),\n): string[] {\n  if (isBooleanJsonSchema(schema)) {\n    return [];\n  }\n  if (seen.has(schema)) {\n    return [];\n  }\n  seen.add(schema);\n\n  const ownRequired = getSchemaRequired(schema) ?? [];\n  const schemaAllOf = schema.allOf;\n\n  if (!Array.isArray(schemaAllOf)) {\n    return ownRequired;\n  }\n\n  const inherited = schemaAllOf.flatMap((member) => {\n    const { schema: resolved } = resolveSchemaRef(member, context);\n    return collectRequiredThroughAllOf(resolved, context, seen);\n  });\n\n  return [...inherited, ...ownRequired];\n}\n\ninterface ResolveSchemaPropertiesToFormDataOptions {\n  schema: OpenApiSchemaObject;\n  variableName: string;\n  propName: string;\n  context: ContextSpec;\n  isRequestBodyOptional: boolean;\n  keyPrefix?: string;\n  depth?: number;\n  encoding?: Record<string, OpenApiEncodingObject>;\n  // Schemas already being exploded further up, to stop on recursive models.\n  ancestors?: Set<OpenApiSchemaObject>;\n}\n\nfunction resolveSchemaPropertiesToFormData({\n  schema,\n  variableName,\n  propName,\n  context,\n  isRequestBodyOptional,\n  keyPrefix = '',\n  depth = 0,\n  encoding,\n  ancestors = new Set(),\n}: ResolveSchemaPropertiesToFormDataOptions): string {\n  let formDataValues = '';\n  const nestedAncestors = new Set(ancestors).add(schema);\n  // url-encoded bodies use URLSearchParams (string values only), so file/binary\n  // fields are appended as plain strings rather than wrapped in a Blob (#1624).\n  const isUrlEncoded = variableName === 'formUrlEncoded';\n  const schemaProps = collectPropertiesThroughAllOf(schema, context);\n  const propertyConvention =\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    context.output.override.namingConvention?.properties;\n  // Same collision set the type renderer computes: keys that would collide\n  // after conversion keep their original schema key in the TS type, so the\n  // serializer must read those from the original key too (#2381).\n  const collisionKeys = getPropertyNameCollisionKeys(\n    Object.keys(schemaProps),\n    propertyConvention\n      ? (name) => conventionName(name, propertyConvention)\n      : undefined,\n  );\n  for (const [key, value] of Object.entries(schemaProps)) {\n    const { schema: property } = resolveSchemaRef(value, context);\n    if (isBooleanJsonSchema(property)) {\n      continue;\n    }\n    const escapedKey = key\n      .replace(/\\\\/g, '\\\\\\\\')\n      .replace(/`/g, '\\\\`')\n      .replace(/\\$\\{/g, '\\\\${');\n\n    // Skip readOnly properties for formData\n    if (property.readOnly) {\n      continue;\n    }\n\n    let formDataValue = '';\n\n    // Get encoding.contentType for this field (only at top level, depth === 0)\n    const fieldEncoding = depth === 0 ? encoding?.[key] : undefined;\n    const partContentType = fieldEncoding?.contentType;\n\n    // The TS type emits the namingConvention-converted property name, so the\n    // runtime serializer must read the same converted name from the body while\n    // still appending the ORIGINAL schema key on the wire (#2381). Colliding\n    // keys (e.g. first_name + firstName) keep the original key in the type,\n    // so read the original key too.\n    const propertyConvention =\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      context.output.override.namingConvention?.properties;\n    const accessorKey =\n      propertyConvention && !collisionKeys.has(key)\n        ? conventionName(key, propertyConvention)\n        : key;\n    const formattedConvertedKeyPrefix = isRequestBodyOptional\n      ? keyword.isIdentifierNameES5(accessorKey)\n        ? '?'\n        : '?.'\n      : '';\n    const formattedConvertedKey = keyword.isIdentifierNameES5(accessorKey)\n      ? `.${accessorKey}`\n      : `[${getKey(accessorKey)}]`;\n\n    const valueKey = `${propName}${formattedConvertedKeyPrefix}${formattedConvertedKey}`;\n    const nonOptionalValueKey = `${propName}${formattedConvertedKey}`;\n\n    // Use shared file type detection (same logic as type generation)\n    const fileType = getFormDataFieldFileType(property, partContentType);\n    const effectiveContentType = partContentType ?? property.contentMediaType;\n    // A nullable wrapper is serialized like its non-null branch; the null\n    // case is guarded below.\n    const valueSchema = unwrapNullableSchema(property, context);\n    const valueType = getSchemaType(valueSchema);\n\n    if (isUrlEncoded && (fileType || property.format === 'binary')) {\n      // url-encoded: file/binary fields are plain strings (URLSearchParams)\n      formDataValue = `${variableName}.append(\\`${keyPrefix}${escapedKey}\\`, ${nonOptionalValueKey});\\n`;\n    } else if (fileType === 'binary' || property.format === 'binary') {\n      // Binary: append directly (value is Blob)\n      formDataValue = `${variableName}.append(\\`${keyPrefix}${escapedKey}\\`, ${nonOptionalValueKey});\\n`;\n    } else if (fileType === 'text') {\n      // Text file: value is Blob | string, check at runtime\n      formDataValue = `${variableName}.append(\\`${keyPrefix}${escapedKey}\\`, ${nonOptionalValueKey} instanceof Blob ? ${nonOptionalValueKey} : new Blob([${nonOptionalValueKey}], { type: '${jsStringLiteralEscape(\n        effectiveContentType ?? '',\n      )}' }));\\n`;\n    } else if (isEffectivelyObjectSchema(valueSchema, context)) {\n      // `style: deepObject` + `explode: true` encodes each property as a\n      // bracketed key on the parent, e.g. `metadata[order_id]=6735`. This is\n      // the default for `deepObject` and is how Swagger/OpenAPI serializers\n      // (and the generated runtime) represent nested objects in url-encoded\n      // bodies. See orval issue #3803.\n      const isDeepObject =\n        isUrlEncoded && fieldEncoding?.style === 'deepObject';\n\n      if (isDeepObject) {\n        // style: deepObject — emit each property as `key[subkey]=value`\n        const inner = `${nonOptionalValueKey} && Object.entries(${nonOptionalValueKey}).forEach(([k, v]) => {\n          if (v !== undefined && v !== null) {\n            ${variableName}.append(\\`${keyPrefix}${escapedKey}[\\${k}]\\`, typeof v === 'object' ? JSON.stringify(v) : String(v));\n          }\n        });\\n`;\n        formDataValue = inner;\n      } else {\n        formDataValue =\n          context.output.override.formData.arrayHandling ===\n            FormDataArrayHandling.EXPLODE && !nestedAncestors.has(valueSchema)\n            ? resolveSchemaPropertiesToFormData({\n                schema: valueSchema,\n                variableName,\n                propName: nonOptionalValueKey,\n                context,\n                isRequestBodyOptional,\n                keyPrefix: `${keyPrefix}${escapedKey}.`,\n                depth: depth + 1,\n                encoding,\n                ancestors: nestedAncestors,\n              })\n            : `${variableName}.append(\\`${keyPrefix}${escapedKey}\\`, JSON.stringify(${nonOptionalValueKey}));\\n`;\n      }\n    } else if (\n      valueType === 'array' ||\n      (Array.isArray(valueType) && valueType.includes('array'))\n    ) {\n      let valueStr = 'value';\n      let hasNonPrimitiveChild = false;\n      const propertyItems = getSchemaItems(valueSchema);\n      if (propertyItems) {\n        const { schema: resolvedItem } = resolveSchemaRef(\n          propertyItems,\n          context,\n        );\n        const itemSchema = unwrapNullableSchema(resolvedItem, context);\n        if (\n          isEffectivelyObjectSchema(itemSchema, context) ||\n          isEffectivelyArraySchema(itemSchema, context)\n        ) {\n          // Without fields to explode (maps, nested arrays) or on a recursive\n          // model, fall back to appending the whole item as JSON.\n          const resolvedValue =\n            context.output.override.formData.arrayHandling ===\n              FormDataArrayHandling.EXPLODE && !nestedAncestors.has(itemSchema)\n              ? resolveSchemaPropertiesToFormData({\n                  schema: itemSchema,\n                  variableName,\n                  propName: 'value',\n                  context,\n                  isRequestBodyOptional,\n                  keyPrefix: `${keyPrefix}${escapedKey}[\\${index${depth > 0 ? depth : ''}}].`,\n                  depth: depth + 1,\n                  ancestors: nestedAncestors,\n                })\n              : '';\n          if (resolvedValue) {\n            hasNonPrimitiveChild = true;\n            const body = isSchemaNullable(resolvedItem)\n              ? `if (value !== null && value !== undefined) {\\n ${resolvedValue} }\\n`\n              : resolvedValue;\n            formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ''}) => {\n    ${body}});\\n`;\n          } else {\n            valueStr = 'JSON.stringify(value)';\n          }\n        } else {\n          const itemType = getSchemaType(resolvedItem);\n          if (\n            itemType === 'number' ||\n            (Array.isArray(itemType) && itemType.includes('number')) ||\n            itemType === 'integer' ||\n            (Array.isArray(itemType) && itemType.includes('integer')) ||\n            itemType === 'boolean' ||\n            (Array.isArray(itemType) && itemType.includes('boolean'))\n          ) {\n            valueStr = 'value.toString()';\n          }\n        }\n      }\n      if (\n        context.output.override.formData.arrayHandling ===\n        FormDataArrayHandling.EXPLODE\n      ) {\n        if (!hasNonPrimitiveChild) {\n          formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ''}) => ${variableName}.append(\\`${keyPrefix}${escapedKey}[\\${index${depth > 0 ? depth : ''}}]\\`, ${valueStr}));\\n`;\n        }\n      } else {\n        formDataValue = `${valueKey}.forEach(value => ${variableName}.append(\\`${keyPrefix}${escapedKey}${context.output.override.formData.arrayHandling === FormDataArrayHandling.SERIALIZE_WITH_BRACKETS ? '[]' : ''}\\`, ${valueStr}));\\n`;\n      }\n    } else if (\n      (() => {\n        const propType = getSchemaType(property);\n        return (\n          propType === 'number' ||\n          (Array.isArray(propType) && propType.includes('number')) ||\n          propType === 'integer' ||\n          (Array.isArray(propType) && propType.includes('integer')) ||\n          propType === 'boolean' ||\n          (Array.isArray(propType) && propType.includes('boolean'))\n        );\n      })()\n    ) {\n      formDataValue = `${variableName}.append(\\`${keyPrefix}${escapedKey}\\`, ${nonOptionalValueKey}.toString())\\n`;\n    } else {\n      formDataValue = `${variableName}.append(\\`${keyPrefix}${escapedKey}\\`, ${nonOptionalValueKey});\\n`;\n    }\n\n    let existSubSchemaNullable = false;\n    const combine = getSchemaCombined(property);\n    if (combine) {\n      const subSchemas = combine.map((c) =>\n        resolveObject({ schema: c, combined: true, context: context }),\n      );\n      if (\n        subSchemas.some((subSchema) => {\n          return ['number', 'integer', 'boolean'].includes(subSchema.type);\n        })\n      ) {\n        formDataValue = `${variableName}.append(\\`${escapedKey}\\`, ${nonOptionalValueKey}.toString())\\n`;\n      }\n\n      if (\n        subSchemas.some((subSchema) => {\n          return subSchema.type === 'null';\n        })\n      ) {\n        existSubSchemaNullable = true;\n      }\n    }\n\n    const schemaRequired = collectRequiredThroughAllOf(schema, context);\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    const isRequired = schemaRequired?.includes(key) && !isRequestBodyOptional;\n\n    const propType = getSchemaType(property);\n    if (\n      (Array.isArray(propType) && propType.includes('null')) ||\n      existSubSchemaNullable\n    ) {\n      if (isRequired) {\n        formDataValues += `if(${valueKey} !== null) {\\n ${formDataValue} }\\n`;\n        continue;\n      }\n\n      formDataValues += `if(${valueKey} !== undefined && ${nonOptionalValueKey} !== null) {\\n ${formDataValue} }\\n`;\n      continue;\n    }\n\n    if (isRequired) {\n      formDataValues += formDataValue;\n      continue;\n    }\n\n    formDataValues += `if(${valueKey} !== undefined) {\\n ${formDataValue} }\\n`;\n  }\n\n  return formDataValues;\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { generalJSTypesWithArray } from '../constants';\nimport { resolveRef } from '../resolvers';\nimport type {\n  ContextSpec,\n  GetterBody,\n  OpenApiReferenceObject,\n  OpenApiRequestBodyObject,\n  OverrideOutputContentType,\n  ResReqTypesValue,\n} from '../types';\nimport {\n  camel,\n  filterByContentType,\n  isBinaryContentType,\n  isInlineSchema,\n  sanitize,\n} from '../utils';\nimport { getResReqTypes } from './res-req-types';\n\ninterface GetBodyOptions {\n  requestBody: OpenApiReferenceObject | OpenApiRequestBodyObject;\n  operationName: string;\n  context: ContextSpec;\n  contentType?: OverrideOutputContentType;\n}\n\nfunction buildBody(\n  filteredBodyTypes: ResReqTypesValue[],\n  requestBody: OpenApiReferenceObject | OpenApiRequestBodyObject,\n  operationName: string,\n  context: ContextSpec,\n): GetterBody {\n  const imports = filteredBodyTypes.flatMap(({ imports }) => imports);\n  const schemas = filteredBodyTypes.flatMap(({ schemas }) => schemas);\n\n  const definition = filteredBodyTypes.map(({ value }) => value).join(' | ');\n  const hasReadonlyProps = filteredBodyTypes.some((x) => x.hasReadonlyProps);\n  const nonReadonlyDefinition =\n    hasReadonlyProps &&\n    definition &&\n    context.output.override.preserveReadonlyRequestBodies !== 'preserve'\n      ? `NonReadonly<${definition}>`\n      : definition;\n\n  let implementation =\n    generalJSTypesWithArray.includes(definition.toLowerCase()) ||\n    filteredBodyTypes.length > 1\n      ? camel(operationName) +\n        context.output.override.components.requestBodies.suffix\n      : camel(definition);\n\n  const overrideName = getRequestBodyExtensionName(requestBody, context);\n  if (overrideName) {\n    implementation = camel(overrideName);\n  }\n\n  let isOptional = false;\n  if (implementation) {\n    implementation = sanitize(implementation, {\n      underscore: '_',\n      whitespace: '_',\n      dash: true,\n      es5keyword: true,\n      es5IdentifierName: true,\n    });\n    if (isInlineSchema(requestBody)) {\n      isOptional = requestBody.required !== true;\n    } else {\n      const { schema: bodySchema }: { schema: OpenApiRequestBodyObject } =\n        resolveRef(requestBody, context);\n      isOptional = bodySchema.required !== true;\n    }\n  }\n\n  return {\n    originalSchema: requestBody,\n    definition: nonReadonlyDefinition,\n    isBlob: filteredBodyTypes.some(\n      (t) =>\n        (!!t.contentType && isBinaryContentType(t.contentType)) ||\n        (t.originalSchema !== undefined &&\n          !isBooleanJsonSchema(t.originalSchema) &&\n          (t.originalSchema.format === 'binary' ||\n            (t.originalSchema.contentMediaType === 'application/octet-stream' &&\n              !t.originalSchema.contentEncoding))),\n    ),\n    implementation,\n    imports,\n    schemas,\n    isOptional,\n    ...(filteredBodyTypes.length === 1\n      ? {\n          formData: filteredBodyTypes[0].formData,\n          formUrlEncoded: filteredBodyTypes[0].formUrlEncoded,\n          contentType: filteredBodyTypes[0].contentType,\n        }\n      : {\n          formData: '',\n          formUrlEncoded: '',\n          contentType: '',\n        }),\n  };\n}\n\nexport function getBody({\n  requestBody,\n  operationName,\n  context,\n  contentType,\n}: GetBodyOptions): GetterBody {\n  const allBodyTypes = getResReqTypes(\n    [[context.output.override.components.requestBodies.suffix, requestBody]],\n    operationName,\n    context,\n  );\n\n  const filteredBodyTypes = filterByContentType(allBodyTypes, contentType);\n\n  return buildBody(filteredBodyTypes, requestBody, operationName, context);\n}\n\n/**\n * Returns per-content-type bodies when `splitByContentType` is enabled.\n * Each entry includes a `contentTypeSuffix` for generating distinct function names.\n */\nexport function getBodiesByContentType({\n  requestBody,\n  operationName,\n  context,\n  contentType,\n}: GetBodyOptions): (GetterBody & { contentTypeSuffix: string })[] {\n  const allBodyTypes = getResReqTypes(\n    [[context.output.override.components.requestBodies.suffix, requestBody]],\n    operationName,\n    context,\n    undefined,\n    (item) => `${item.value}::${item.contentType}`,\n  );\n\n  const filteredBodyTypes = filterByContentType(allBodyTypes, contentType);\n\n  // If there's only one content type, no need to split\n  if (filteredBodyTypes.length <= 1) {\n    return [\n      {\n        ...buildBody(filteredBodyTypes, requestBody, operationName, context),\n        contentTypeSuffix: '',\n      },\n    ];\n  }\n\n  // Distinct media types can share a suffix: `application/a-b` and\n  // `application/a+b` both reduce to `AB`, and any two types made only of\n  // stripped characters both reduce to `Content`. Two bodies would then emit\n  // the same `${operationName}With${suffix}` declaration and the generated\n  // file would not compile, so number the repeats.\n  //\n  // The number has to be checked against what was actually handed out, not\n  // against a per-base counter: `application/a-b`, `application/a+b` and\n  // `application/a-b2` reduce to `AB`, `AB` and `AB2`, so a counter would give\n  // the second and third the same `AB2`. The first occurrence still keeps the\n  // plain suffix, which leaves every non-colliding name unchanged.\n  const usedSuffixes = new Set<string>();\n\n  return filteredBodyTypes.map((bodyType) => {\n    const baseSuffix = getContentTypeSuffix(bodyType.contentType);\n    let suffix = baseSuffix;\n    for (let n = 2; usedSuffixes.has(suffix); n++) {\n      suffix = `${baseSuffix}${n}`;\n    }\n    usedSuffixes.add(suffix);\n\n    const body = buildBody([bodyType], requestBody, operationName, context);\n    return {\n      ...body,\n      contentTypeSuffix: suffix,\n    };\n  });\n}\n\nfunction getRequestBodyExtensionName(\n  requestBody: OpenApiReferenceObject | OpenApiRequestBodyObject,\n  context: ContextSpec,\n): string | undefined {\n  let value: unknown;\n  if (!isInlineSchema(requestBody)) {\n    const { schema } = resolveRef(requestBody, context);\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    value = (schema as Record<string, unknown>)?.[\n      'x-codegen-request-body-name'\n    ];\n  } else {\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    value = (requestBody as Record<string, unknown>)?.[\n      'x-codegen-request-body-name'\n    ];\n  }\n  return typeof value === 'string' ? value : undefined;\n}\n\nconst CONTENT_TYPE_SUFFIX_MAP: Record<string, string> = {\n  'application/json': 'Json',\n  'multipart/form-data': 'FormData',\n  'application/x-www-form-urlencoded': 'UrlEncoded',\n  'text/plain': 'Text',\n  'application/xml': 'Xml',\n  'text/xml': 'Xml',\n  'application/octet-stream': 'Blob',\n};\n\nfunction getContentTypeSuffix(contentType: string): string {\n  // `contentType` is a raw spec key, so a plain index would resolve inherited\n  // members: a media type named `toString` would otherwise return the function\n  // itself and splice its source into the generated identifier.\n  if (Object.hasOwn(CONTENT_TYPE_SUFFIX_MAP, contentType)) {\n    return CONTENT_TYPE_SUFFIX_MAP[contentType];\n  }\n  // For unknown content types, derive a PascalCase suffix from the subtype.\n  //\n  // The media type is a raw key from the spec's `content` object and is not\n  // validated anywhere upstream, while this suffix is concatenated straight\n  // into generated identifiers (`${operationName}With${suffix}`). Anything\n  // that is not an identifier character has to be dropped, or a crafted media\n  // type breaks out of the declaration and injects arbitrary top-level code.\n  // `$` is kept: it is legal both in a JS identifier and in an RFC 6838\n  // subtype, so dropping it would needlessly merge distinct media types.\n  const subtype = contentType.split('/')[1] ?? contentType;\n  const suffix = subtype\n    .split(/[-+.]/)\n    .map((part) => part.replaceAll(/[^A-Za-z0-9_$]/g, ''))\n    .filter(Boolean)\n    .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n    .join('');\n\n  // A media type made up entirely of stripped characters would otherwise\n  // collapse to `${operationName}With`. Callers still have to disambiguate\n  // repeats — see `getBodiesByContentType`.\n  return suffix || 'Content';\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport type {\n  ContextSpec,\n  OpenApiNonBooleanSchemaObject,\n  OpenApiReferenceObject,\n  OpenApiSchemaObject,\n  OpenApiSchemasObject,\n} from '../types';\nimport { getPropertySafe, isInlineSchema, pascal } from '../utils';\nimport { getRefInfo } from './ref';\n\nexport function resolveDiscriminators(\n  schemas: OpenApiSchemasObject,\n  context: ContextSpec,\n): OpenApiSchemasObject {\n  const transformedSchemas = schemas;\n  for (const schema of Object.values(transformedSchemas)) {\n    if (isBooleanJsonSchema(schema)) {\n      continue; // skip boolean schemas as we can't do anything meaningful with them\n    }\n\n    // Some specs incorrectly nest `oneOf` under `discriminator`.\n    // hoist it to the schema level so union generation still works.\n    const discriminator = schema.discriminator as\n      | { oneOf?: OpenApiSchemasObject[string][] }\n      | undefined;\n\n    if (!schema.oneOf && Array.isArray(discriminator?.oneOf)) {\n      schema.oneOf = discriminator.oneOf;\n    }\n\n    if (schema.discriminator?.mapping) {\n      const { mapping, propertyName } = schema.discriminator;\n\n      for (const [mappingKey, mappingValue] of Object.entries(mapping)) {\n        let subTypeSchema;\n\n        try {\n          // oxlint-disable-next-line typescript/no-unsafe-argument\n          const { originalName } = getRefInfo(mappingValue, context);\n          // name from getRefInfo may contain a suffix, which we don't want\n          const name = pascal(originalName);\n          subTypeSchema =\n            transformedSchemas[originalName] ?? transformedSchemas[name];\n        } catch {\n          // oxlint-disable-next-line typescript/no-unsafe-member-access\n          subTypeSchema = transformedSchemas[mappingValue];\n        }\n\n        // The mapped subtype may be missing from the schema set — e.g. a\n        // subtype removed by `filters.tags`, or absent in a malformed spec — in\n        // which case indexing yields `undefined` at runtime. `!subTypeSchema`\n        // skips that (and the `false` boolean-schema case) before we dereference\n        // it; an explicit `=== undefined` check isn't possible here because the\n        // project does not enable `noUncheckedIndexedAccess`, so indexed access\n        // is typed as always-present. This mirrors the `!variantSchema` guard in\n        // the second loop below.\n        if (\n          typeof propertyName !== 'string' ||\n          !subTypeSchema ||\n          isBooleanJsonSchema(subTypeSchema)\n        ) {\n          continue;\n        }\n\n        const property = subTypeSchema.properties?.[propertyName];\n        if (isBooleanJsonSchema(property)) {\n          continue;\n        }\n\n        // When the discriminator property is an `allOf` wrapping a single\n        // `$ref` to a shared enum, the referenced schema already carries the\n        // full set of valid values. Merging mapping keys into the `allOf`\n        // wrapper itself produces a chimera (e.g. `EventTypeEnum.enum([...])`\n        // where `.enum` on ZodEnum is the values object, not callable —\n        // #3991). Leave the property as declared so the generator emits a\n        // plain reference to the shared schema.\n        const isAllOfRef =\n          property &&\n          Array.isArray(property.allOf) &&\n          property.allOf.length === 1 &&\n          !isInlineSchema(property.allOf[0]);\n        if (isAllOfRef) {\n          continue;\n        }\n\n        const schemaProperty =\n          property && isInlineSchema(property) ? property : undefined;\n\n        const enumProperty = schemaProperty\n          ? getPropertySafe(schemaProperty, 'enum')\n          : { hasProperty: false as const, value: undefined };\n\n        const enumValues: unknown[] | undefined =\n          enumProperty.hasProperty && Array.isArray(enumProperty.value)\n            ? enumProperty.value\n            : undefined;\n\n        const propertyType =\n          (schemaProperty?.type as string | undefined) ?? 'string';\n\n        let typedMappingKey: string | number | boolean = mappingKey;\n        if (propertyType === 'boolean') {\n          typedMappingKey = mappingKey === 'true';\n        } else if (propertyType === 'number' || propertyType === 'integer') {\n          const parsed = Number(mappingKey);\n          if (!Number.isNaN(parsed)) {\n            typedMappingKey = parsed;\n          }\n        }\n\n        const mergedEnumValues = [\n          ...(enumValues ?? []).filter((value) => value !== typedMappingKey),\n          typedMappingKey,\n        ];\n\n        // @see https://github.com/orval-labs/orval/issues/3139\n        // `propertyType` is a widened string, so the object is not a SchemaObject\n        // until asserted. The value is always a single primitive schema type.\n        const mergedProperty = {\n          ...schemaProperty,\n          type: propertyType,\n          enum: mergedEnumValues,\n        } as OpenApiNonBooleanSchemaObject;\n        delete (mergedProperty as Record<string, unknown>).const;\n\n        subTypeSchema.properties = {\n          ...subTypeSchema.properties,\n          [propertyName]: mergedProperty,\n        };\n        subTypeSchema.required = [\n          ...new Set([...(subTypeSchema.required ?? []), propertyName]),\n        ];\n      }\n    }\n  }\n\n  // Break the circular type-alias that forms when a discriminator parent has\n  // top-level `oneOf` listing variants that inherit via `allOf: [$ref: parent, ...]`.\n  // The parent emits as `type Parent = (Variant1 & {...}) | ...` and each variant\n  // would emit as `type VariantN = Omit<Parent, key> & {...}`, producing TS2456.\n  // Rewrite each variant's `$ref` back to the parent by inlining the parent's\n  // non-discriminator properties (or dropping the entry entirely when the parent\n  // contributes nothing beyond the discriminator key). See issue #3432.\n  for (const [parentName, parentSchema] of Object.entries(transformedSchemas)) {\n    if (isBooleanJsonSchema(parentSchema)) {\n      continue;\n    }\n    const variants = parentSchema.oneOf ?? parentSchema.anyOf;\n    if (!variants || !parentSchema.discriminator) {\n      continue;\n    }\n    const { propertyName, mapping } = parentSchema.discriminator;\n    if (!propertyName) {\n      continue;\n    }\n    const mappedRefs = mapping ? Object.values(mapping) : [];\n    const variantArrayRefs = variants\n      .filter(\n        (item): item is OpenApiNonBooleanSchemaObject & { $ref: string } =>\n          !isBooleanJsonSchema(item) && typeof item.$ref === 'string',\n      )\n      .map((item) => item.$ref);\n    // oxlint-disable-next-line typescript/no-unsafe-assignment\n    const variantRefs = [...new Set([...mappedRefs, ...variantArrayRefs])];\n\n    const parentProperties = parentSchema.properties;\n    const parentRequired = parentSchema.required;\n    const inheritableProps: Record<\n      string,\n      OpenApiSchemaObject | OpenApiReferenceObject\n    > = {};\n    if (parentProperties) {\n      for (const [key, value] of Object.entries(parentProperties)) {\n        if (key !== propertyName) {\n          inheritableProps[key] = value;\n        }\n      }\n    }\n    const inheritableRequired = parentRequired?.filter(\n      (key) => key !== propertyName,\n    );\n    const hasInheritableProps = Object.keys(inheritableProps).length > 0;\n\n    for (const mappingValue of variantRefs) {\n      let variantSchema;\n      try {\n        // oxlint-disable-next-line typescript/no-unsafe-argument\n        const { originalName } = getRefInfo(mappingValue, context);\n        const name = pascal(originalName);\n        variantSchema =\n          transformedSchemas[originalName] ?? transformedSchemas[name];\n      } catch {\n        // oxlint-disable-next-line typescript/no-unsafe-member-access\n        variantSchema = transformedSchemas[mappingValue];\n      }\n      if (!variantSchema || isBooleanJsonSchema(variantSchema)) {\n        continue;\n      }\n      const variantAllOf = variantSchema.allOf as\n        | (OpenApiSchemaObject | OpenApiReferenceObject)[]\n        | undefined;\n      if (!variantAllOf) {\n        continue;\n      }\n\n      const rewritten: (OpenApiSchemaObject | OpenApiReferenceObject)[] = [];\n      for (const item of variantAllOf) {\n        if (isInlineSchema(item) || !item.$ref) {\n          rewritten.push(item);\n          continue;\n        }\n        let refOriginalName: string | undefined;\n        try {\n          refOriginalName = getRefInfo(item.$ref, context).originalName;\n        } catch {\n          refOriginalName = undefined;\n        }\n        const refMatchesParent =\n          refOriginalName === parentName ||\n          (refOriginalName !== undefined &&\n            pascal(refOriginalName) === pascal(parentName));\n        if (!refMatchesParent) {\n          rewritten.push(item);\n          continue;\n        }\n        // Preserve the parent's other object-level constraints\n        // (additionalProperties, minProperties, description, etc.) by shallow-\n        // cloning the parent and only stripping the parts that would re-create\n        // the cycle or are now meaningless on the variant.\n        const inlinedParent = {\n          ...(parentSchema as Record<string, unknown>),\n        } as OpenApiNonBooleanSchemaObject;\n        delete (inlinedParent as Record<string, unknown>).oneOf;\n        delete (inlinedParent as Record<string, unknown>).discriminator;\n        delete (inlinedParent as Record<string, unknown>).allOf;\n        delete (inlinedParent as Record<string, unknown>).anyOf;\n\n        if (hasInheritableProps) {\n          // Fresh per-variant clone so downstream in-place mutations on one\n          // variant don't leak across siblings.\n          inlinedParent.properties = { ...inheritableProps };\n        } else {\n          delete (inlinedParent as Record<string, unknown>).properties;\n        }\n        if (inheritableRequired && inheritableRequired.length > 0) {\n          inlinedParent.required = [...inheritableRequired];\n        } else {\n          delete (inlinedParent as Record<string, unknown>).required;\n        }\n\n        // Drop the entry entirely when the parent contributed nothing beyond\n        // a bare `type: 'object'` — the second allOf member (the variant's\n        // own inline object) already asserts object-ness.\n        const meaningfulKeys = Object.keys(\n          inlinedParent as Record<string, unknown>,\n        ).filter((key) => key !== 'type');\n        if (meaningfulKeys.length > 0) {\n          rewritten.push(inlinedParent);\n        }\n      }\n\n      if (rewritten.length === 0) {\n        delete (variantSchema as Record<string, unknown>).allOf;\n      } else {\n        variantSchema.allOf = rewritten;\n      }\n    }\n  }\n\n  return transformedSchemas;\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport type {\n  ContextSpec,\n  OpenApiOperationObject,\n  OpenApiReferenceObject,\n  OpenApiRequestBodyObject,\n} from '../types';\nimport { Verbs } from '../types';\nimport { isInlineSchema } from '../utils';\nimport type { FormDataContext } from './object';\nimport { getRefInfo, isComponentRef } from './ref';\n\nconst MULTIPART_CONTENT_TYPE = 'multipart/form-data';\n\nconst SCHEMA_REF_PREFIX = '#/components/schemas/';\n\nconst VERBS = new Set<string>(Object.values(Verbs));\n\n/**\n * The `encoding` map of a `multipart/form-data` media type, keyed by part name.\n */\ntype PartEncodings = Record<string, { contentType?: string }>;\n\n/**\n * The {@link FormDataContext} each shared `components.schemas` entry should be\n * generated with, keyed by component name. A schema missing from the map is\n * never used as a `multipart/form-data` request body.\n *\n * Inline multipart bodies get their context from `getResReqContentTypes`,\n * which is what types their binary parts as `Blob | File` and applies the\n * media type `encoding`. A body aliased behind\n * `$ref: '#/components/schemas/upload'` is instead emitted once by\n * `generateSchemasDefinition`, far away from the operation that gives it its\n * media type — so it used to fall back to the context-free `Blob`. This index\n * carries the missing media-type information over to the shared model (#4177).\n *\n * Only multipart is indexed. `application/x-www-form-urlencoded` deliberately\n * stays out: its context narrows binary fields to `string`, and the shared\n * model may well be referenced by a multipart endpoint too, where `Blob` is\n * the correct type (#2410).\n *\n * Built once per `generateSchemasDefinition` run and passed down, rather than\n * memoized per spec: the document is free to change between runs, and a cache\n * keyed on its identity would hand back an index describing the old paths.\n */\nexport function getFormDataComponentContexts(\n  context: ContextSpec,\n): Map<string, FormDataContext> {\n  const encodings = new Map<string, PartEncodings>();\n\n  const requestBodies = context.spec.components?.requestBodies ?? {};\n\n  for (const requestBody of Object.values(requestBodies)) {\n    indexRequestBody(requestBody, context, encodings);\n  }\n\n  for (const pathItem of Object.values(context.spec.paths ?? {})) {\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    if (!pathItem) {\n      continue;\n    }\n\n    for (const [verb, operation] of Object.entries(\n      pathItem as Record<string, unknown>,\n    )) {\n      if (!VERBS.has(verb)) {\n        continue;\n      }\n\n      const requestBody = (operation as OpenApiOperationObject | undefined)\n        ?.requestBody;\n\n      if (requestBody) {\n        indexRequestBody(requestBody, context, encodings);\n      }\n    }\n  }\n\n  return new Map(\n    [...encodings].map(([schemaName, encoding]) => [\n      schemaName,\n      { atPart: false, encoding },\n    ]),\n  );\n}\n\nfunction indexRequestBody(\n  requestBody: OpenApiReferenceObject | OpenApiRequestBodyObject,\n  context: ContextSpec,\n  encodings: Map<string, PartEncodings>,\n): void {\n  // Request bodies referencing `#/components/requestBodies/...` are already\n  // covered by the components sweep above; anything else (a bundler-emitted\n  // path ref, an external document) has no named slot to look up here.\n  if (!isInlineSchema(requestBody)) {\n    return;\n  }\n\n  const mediaType = requestBody.content[MULTIPART_CONTENT_TYPE];\n\n  // oxlint-disable-next-line typescript/no-unnecessary-condition\n  const schema = mediaType?.schema;\n\n  // `isComponentRef` is what rejects a ref that only *starts* at a component,\n  // such as `#/components/schemas/Wrapper/properties/upload`: `getRefInfo`\n  // names it after its last token, which would hand the form-data context to\n  // an unrelated `components.schemas.upload`.\n  // A `$ref` with siblings is a Schema Object in OAS 3.1, so this is a string\n  // `$ref` check rather than a Reference Object guard. Boolean schemas have no `$ref`.\n  if (\n    !schema ||\n    isBooleanJsonSchema(schema) ||\n    typeof schema.$ref !== 'string' ||\n    !schema.$ref.startsWith(SCHEMA_REF_PREFIX) ||\n    !isComponentRef(schema.$ref)\n  ) {\n    return;\n  }\n\n  const { originalName } = getRefInfo(schema.$ref, context);\n  const encoding = (mediaType.encoding ?? {}) as PartEncodings;\n  const indexed = encodings.get(originalName);\n\n  if (!indexed) {\n    encodings.set(originalName, { ...encoding });\n    return;\n  }\n\n  // A schema shared by several multipart endpoints can be described by\n  // conflicting `encoding` entries; there is a single emitted model, so the\n  // first declaration of a part wins.\n  for (const [part, partEncoding] of Object.entries(encoding)) {\n    indexed[part] ??= partEncoding;\n  }\n}\n","import type { OpenApiOperationObject, Verbs } from '../types';\nimport { isString, pascal, sanitize } from '../utils';\n\nexport function getOperationId(\n  operation: OpenApiOperationObject,\n  route: string,\n  verb: Verbs,\n): string {\n  if (isString(operation.operationId)) {\n    return operation.operationId;\n  }\n\n  return pascal(\n    [\n      verb,\n      ...route.split('/').map((p) =>\n        sanitize(p, {\n          dash: true,\n          underscore: '-',\n          dot: '-',\n          whitespace: '-',\n        }),\n      ),\n    ].join('-'),\n  );\n}\n","import { resolveRef } from '../resolvers/ref';\nimport type {\n  ContextSpec,\n  GetterParameters,\n  OpenApiParameterObject,\n  OpenApiReferenceObject,\n} from '../types';\nimport { isInlineSchema } from '../utils';\nimport { getRefInfo, isComponentRef } from './ref';\n\ninterface GetParametersOptions {\n  parameters: (OpenApiReferenceObject | OpenApiParameterObject)[];\n  context: ContextSpec;\n}\n\nexport function getParameters({\n  parameters,\n  context,\n}: GetParametersOptions): GetterParameters {\n  const result: GetterParameters = { path: [], query: [], header: [] };\n  for (const p of parameters) {\n    if (!isInlineSchema(p)) {\n      const { schema } = resolveRef(p, context);\n      const parameter = schema as OpenApiParameterObject;\n\n      const location = parameter.in;\n      if (\n        location === 'path' ||\n        location === 'query' ||\n        location === 'header'\n      ) {\n        // Refs that don't target a named component slot (e.g. bundler-emitted\n        // `#/paths/.../parameters/0`) have no corresponding `export type` from\n        // `generateParameterDefinition`, so emitting a named import would\n        // dangle. Inline the resolved parameter's schema instead. Mirrors the\n        // #398 fix in `resolvers/value.ts`. See issue #1879.\n        // Operation params reference the reusable parameter alias itself. Any\n        // schema refs nested inside that parameter are imported by the generated\n        // `components.parameters` alias, so they must not be forwarded here.\n        const componentRefInfo =\n          p.$ref && isComponentRef(p.$ref)\n            ? getRefInfo(p.$ref, context)\n            : undefined;\n        const safeImports = componentRefInfo\n          ? [\n              {\n                name: componentRefInfo.name,\n                schemaName: componentRefInfo.originalName,\n              },\n            ]\n          : [];\n        result[location].push({ parameter, imports: safeImports });\n      }\n    } else if (p.in === 'query' || p.in === 'path' || p.in === 'header') {\n      result[p.in].push({ parameter: p, imports: [] });\n    }\n  }\n\n  // Parameters are unique by their name and location. Callers provide\n  // path-level parameters first and operation-level parameters last, so\n  // replacing an existing entry applies the operation-level override. HTTP\n  // header names are case-insensitive, unlike names in the other locations.\n  for (const location of ['path', 'query', 'header'] as const) {\n    result[location] = [\n      ...new Map(\n        result[location].map((entry) => [\n          location === 'header'\n            ? // oxlint-disable-next-line typescript/no-unnecessary-condition\n              entry.parameter.name?.toLowerCase()\n            : entry.parameter.name,\n          entry,\n        ]),\n      ).values(),\n    ];\n  }\n\n  return result;\n}\n","import jsesc from 'jsesc';\n\nimport type {\n  BaseUrlFromConstant,\n  BaseUrlFromSpec,\n  BaseUrlRuntime,\n  GeneratorImport,\n  NormalizedOutputOptions,\n  OpenApiServerObject,\n  VariableRuntimeValue,\n} from '../types';\nimport {\n  camel,\n  isObject,\n  isString,\n  mapTemplateExpressions,\n  parseTemplateLiteral,\n  sanitize,\n} from '../utils';\n\nfunction isBaseUrlRuntime(\n  baseUrl: string | BaseUrlFromConstant | BaseUrlFromSpec | BaseUrlRuntime,\n): baseUrl is BaseUrlRuntime {\n  return (\n    isObject(baseUrl) &&\n    'runtime' in baseUrl &&\n    typeof baseUrl.runtime === 'string'\n  );\n}\n\nfunction isVariableRuntimeValue(\n  value: string | VariableRuntimeValue | undefined,\n): value is VariableRuntimeValue {\n  return isObject(value) && 'runtime' in value;\n}\n\n/**\n * Wraps a runtime expression for generated URL template literals.\n * Pass the expression only (e.g. `process.env.API_BASE_URL`), not a `${...}` fragment.\n */\nfunction runtimeExpressionToUrlPrefix(expression: string): string {\n  const t = expression.trim();\n  if (!t) return '';\n  return '${' + t + '}';\n}\n\n/**\n * One piece of an OpenAPI path, in the spec's own vocabulary: either static\n * text (raw and unescaped) or a `{name}` path parameter. Every route emitted\n * by orval is built from these tokens, so the decision \"is this a parameter?\"\n * is made exactly once, against the spec path, and never re-derived from the\n * generated source afterwards (#3703).\n */\nexport type RouteToken =\n  | { kind: 'literal'; value: string }\n  | { kind: 'param'; name: string };\n\n// Matches a `{name}` path-parameter template and captures the name\n// (`{petId}`, `{user_id}`, `{scope.id}`, `{kebab-case}`, `{path*}`). Sticky:\n// it is only ever applied at a known `{`.\nconst PATH_PARAM_NAME_REGEX = /\\{([\\w.*-]+)\\}/y;\n\n/**\n * Tokenizes an OpenAPI path into static text and `{name}` parameters.\n *\n * Two lexing rules keep spec content from turning into generated syntax:\n *\n * - A `$` immediately followed by `{` consumes both characters as static text,\n *   so a `${...}` block written in a spec path is never read as a parameter.\n *   This is shared policy for every consumer (template-literal, Hono and MSW\n *   routes) and the reason `/v1/some${petId}/path` cannot smuggle an\n *   interpolation into the generated client.\n * - A `{` that is not followed by a non-empty `[\\w.*-]+}` name is static text,\n *   so a malformed `{}` stays literal instead of emitting an invalid `${}`.\n */\nexport const parseRoutePath = (path: string): RouteToken[] => {\n  const tokens: RouteToken[] = [];\n  let literal = '';\n  let index = 0;\n\n  const flushLiteral = () => {\n    if (literal) {\n      tokens.push({ kind: 'literal', value: literal });\n      literal = '';\n    }\n  };\n\n  while (index < path.length) {\n    const char = path[index];\n\n    // `${` is static text, never a parameter: consume both characters so the\n    // `{` cannot start a parameter on the next iteration.\n    if (char === '$' && path[index + 1] === '{') {\n      literal += '${';\n      index += 2;\n      continue;\n    }\n\n    if (char === '{') {\n      PATH_PARAM_NAME_REGEX.lastIndex = index;\n      const match = PATH_PARAM_NAME_REGEX.exec(path);\n      if (match) {\n        flushLiteral();\n        tokens.push({ kind: 'param', name: match[1] });\n        index += match[0].length;\n        continue;\n      }\n    }\n\n    literal += char;\n    index++;\n  }\n\n  flushLiteral();\n  return tokens;\n};\n\n// Spec paths are required to start with `/`, but malformed specs without it\n// are tolerated by normalizing here.\nconst ensureLeadingSlash = (path: string): string =>\n  path && !path.startsWith('/') ? `/${path}` : path;\n\n/**\n * Sanitizes an OpenAPI path-parameter name while preserving the spec's\n * spelling: keeps word characters, underscores, dashes and dots, strips\n * everything else, and prefixes ES5 keywords with an underscore. Use this\n * when the emitted name must match the spec (e.g. Hono routes).\n */\nexport const sanitizePathParamName = (name: string): string =>\n  sanitize(name, { es5keyword: true, underscore: true, dash: true, dot: true });\n\n/**\n * Derives the generated JS identifier for an OpenAPI path-parameter name\n * (`scope.id` → `scopeId`, `_id` → `id`, `class` → `_class`). This is the\n * single source of truth for param variable names: the emitted route\n * interpolations, the generated function arguments and the spec-parameter\n * matching must all agree on it.\n */\nexport const camelPathParamName = (name: string): string =>\n  sanitize(camel(name), { es5keyword: true });\n\n/**\n * Converts every `{param}` in an OpenAPI path to `:param` (Hono/MSW style\n * routes). `formatParamName` maps the raw OpenAPI parameter name to the\n * emitted one (`sanitizePathParamName` or `camelPathParamName`).\n */\nexport const toColonRoutePath = (\n  path: string,\n  formatParamName: (rawName: string) => string,\n): string =>\n  parseRoutePath(ensureLeadingSlash(path))\n    .map((token) =>\n      token.kind === 'param' ? `:${formatParamName(token.name)}` : token.value,\n    )\n    .join('');\n\nconst esc = (str: string) => jsesc(str, { quotes: 'backtick', wrap: false });\n\n/**\n * Re-escape a route fragment that {@link getRoute} already escaped for a\n * backtick template literal so it is safe inside a *single-quoted* literal.\n *\n * `jsesc(..., { quotes: 'backtick' })` neutralizes backslashes, line\n * terminators, backticks and `${`, but deliberately leaves `'` alone — it is\n * not special in a backtick context. Any consumer that drops that output into\n * a single-quoted literal has to escape the quote itself, or a `'` in the spec\n * path closes the literal and the remainder of the path is emitted as\n * executable code (GHSA-5g7p-r63h-5vfw).\n *\n * Only `'` is escaped here: the backslashes jsesc already emitted must not be\n * doubled a second time, which is why `jsStringLiteralEscape` is the wrong\n * tool for an already-escaped route — use that one when the input is raw spec\n * text.\n */\nexport const escapeRouteForSingleQuotes = (route: string): string =>\n  route.replaceAll(\"'\", String.raw`\\'`);\n\n/**\n * Converts an OpenAPI path (`{param}`) to a template-literal route (`${param}`),\n * escaping static text with jsesc for safe embedding in backtick strings.\n * The `route` arg must be a raw OpenAPI path; a non-empty route always emits\n * with a leading `/`.\n */\nexport function getRoute(route: string) {\n  // Serialize the token stream: static text is escaped for a backtick string,\n  // parameters become interpolations. Because the two are produced from\n  // separate tokens, escaped static text can never be mistaken for an\n  // interpolation (or vice versa) by a later pass.\n  return parseRoutePath(ensureLeadingSlash(route))\n    .map((token) =>\n      token.kind === 'param'\n        ? `\\${${camelPathParamName(token.name)}}`\n        : esc(token.value),\n    )\n    .join('');\n}\n\n/**\n * Resolves a concrete base URL from an OpenAPI specification's `servers`\n * field, applying the same `index`/`variables` selection semantics as\n * `BaseUrlFromSpec`.\n *\n * Unlike `getFullRoute`'s `BaseUrlFromSpec` handling, this returns `''` when\n * `servers` is missing or empty instead of throwing — callers that want a\n * relative-URL fallback (e.g. the Angular DI base-url token) can use this\n * directly, while `getFullRoute` still throws for its own\n * `getBaseUrlFromSpecification` path to preserve existing behavior.\n *\n * The returned value is NOT escaped for embedding in a template literal —\n * callers that splice it into generated backtick source (e.g. `getFullRoute`)\n * must escape it themselves; callers that embed it via `JSON.stringify`\n * (e.g. the Angular DI base-url token file) should use the raw value as-is.\n */\nconst VARIABLE_MARKER_PREFIX = '__ORVAL_RT_';\n\n/** Deterministic djb2 hash so markers are opaque yet stable across runs. */\nfunction hashString(value: string): string {\n  let hash = 5381;\n  for (let i = 0; i < value.length; i++) {\n    hash = ((hash << 5) + hash + value.charCodeAt(i)) | 0;\n  }\n  return (hash >>> 0).toString(36);\n}\n\n/**\n * Collision-resistant opaque marker for a runtime server variable. The hash\n * of the full server URL plus the variable key makes accidental matches with\n * literal URL text practically impossible, while staying deterministic so\n * generated output (and snapshots) never churn between runs.\n */\nfunction runtimeVariableMarker(serverUrl: string, variableKey: string): string {\n  return `${VARIABLE_MARKER_PREFIX}${hashString(serverUrl + variableKey)}__`;\n}\n\nexport function resolveServerUrl(\n  servers: OpenApiServerObject[] | undefined,\n  options: {\n    index?: number;\n    variables?: Record<string, string | VariableRuntimeValue>;\n  },\n): string {\n  if (!servers || servers.length === 0) return '';\n\n  const server = servers.at(Math.min(options.index ?? 0, servers.length - 1));\n  if (!server) return '';\n  // oxlint-disable-next-line typescript/no-unnecessary-condition\n  const serverUrl = server.url ?? '';\n  if (!server.variables) return serverUrl;\n\n  let url = serverUrl;\n  const variables = options.variables;\n\n  // Phase 1: replace ALL `{key}` placeholders with opaque collision-resistant\n  // markers so later variable substitutions cannot interfere with one another,\n  // and literal marker-like text in static values cannot collide (#3916).\n  const staticMarkers = new Map<string, string>();\n  for (const variableKey of Object.keys(server.variables)) {\n    const variable = server.variables[variableKey];\n    const raw = variables?.[variableKey];\n    const marker = runtimeVariableMarker(serverUrl, variableKey);\n    if (isVariableRuntimeValue(raw)) {\n      url = url.replaceAll(`{${variableKey}}`, marker);\n    } else {\n      if (\n        raw !== undefined &&\n        variable.enum &&\n        !variable.enum.some((e) => e == raw)\n      ) {\n        throw new Error(\n          `Invalid variable value '${raw}' for variable '${variableKey}' when resolving ${serverUrl}. Valid values are: ${variable.enum.join(', ')}.`,\n        );\n      }\n      const resolved =\n        raw !== undefined ? String(raw) : String(variable.default);\n      url = url.replaceAll(`{${variableKey}}`, marker);\n      staticMarkers.set(marker, resolved);\n    }\n  }\n\n  // Phase 2: substitute static markers with actual values. Runtime markers\n  // remain in the URL; callers restore them as `${expr}` after escaping.\n  for (const [marker, value] of staticMarkers) {\n    url = url.replaceAll(marker, value);\n  }\n\n  return url;\n}\n\n/**\n * Prepends a base URL to an already-processed route.\n *\n * `route` must be the output of {@link getRoute} (already escaped for template\n * literals). This function does NOT re-escape it — jsesc is not idempotent, so\n * escaping twice would double the backslashes. Only the server URL from\n * `getBaseUrlFromSpecification` is escaped here, after variable substitution.\n */\nexport function getFullRoute(\n  route: string,\n  servers: OpenApiServerObject[] | undefined,\n  baseUrl:\n    | string\n    | BaseUrlFromConstant\n    | BaseUrlFromSpec\n    | BaseUrlRuntime\n    | undefined,\n): string {\n  const getBaseUrl = (): string => {\n    if (!baseUrl) return '';\n    if (isString(baseUrl)) return baseUrl;\n    if (isBaseUrlRuntime(baseUrl)) {\n      return runtimeExpressionToUrlPrefix(baseUrl.runtime);\n    }\n    if (baseUrl.getBaseUrlFromSpecification) {\n      if (!servers) {\n        throw new Error(\n          \"Orval is configured to use baseUrl from the specifications 'servers' field, but there exist no servers in the specification.\",\n        );\n      }\n      const selectedServer =\n        servers.at(Math.min(baseUrl.index ?? 0, servers.length - 1)) ??\n        servers[0];\n      // `resolveServerUrl` returns the raw (unescaped) URL; escape it here\n      // for safe embedding in the generated backtick template literal.\n      let base = esc(\n        resolveServerUrl(servers, {\n          index: baseUrl.index,\n          variables: baseUrl.variables,\n        }),\n      );\n      // `{ runtime: ... }` variables were replaced with opaque markers by\n      // `resolveServerUrl`; restore them as `${expr}` interpolations now,\n      // after escaping, so the expression itself is never escaped (#3734).\n      // Markers are deterministic (hash of server URL + key), so recompute\n      // them here to restore only what `resolveServerUrl` actually emitted.\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      if (baseUrl.variables && selectedServer?.url) {\n        for (const [key, value] of Object.entries(baseUrl.variables)) {\n          if (isVariableRuntimeValue(value)) {\n            base = base.replaceAll(\n              runtimeVariableMarker(selectedServer.url, key),\n              `\\${${value.runtime}}`,\n            );\n          }\n        }\n      }\n      return base;\n    }\n    return baseUrl.baseUrl;\n  };\n\n  let fullRoute = route;\n  const base = getBaseUrl();\n  if (base) {\n    if (base.endsWith('/') && route.startsWith('/')) {\n      fullRoute = route.slice(1);\n    }\n    fullRoute = `${base}${fullRoute}`;\n  }\n  return fullRoute;\n}\n\n/**\n * Returns `GeneratorImport` entries for {@link BaseUrlRuntime.imports} when `baseUrl` is a runtime config.\n *\n * Defaults `values` to true so symbols in `runtime` emit as value imports in the\n * generated client. Set `values: false` explicitly only for unusual cases (e.g.\n * type-only symbols referenced from the expression).\n */\nexport function getBaseUrlRuntimeImports(\n  baseUrl?: NormalizedOutputOptions['baseUrl'],\n): GeneratorImport[] {\n  if (!baseUrl) return [];\n  if (!isBaseUrlRuntime(baseUrl)) return [];\n  return (baseUrl.imports ?? []).map((imp) => ({\n    ...imp,\n    values: imp.values ?? true,\n  }));\n}\n\n// Emits a codegen string: wraps each `${param}` segment of a template-literal\n// route so the generated client encodes path parameters at request time.\n// `skip` lists param names to leave unwrapped (e.g. `allowReserved: true`\n// wildcard params that must keep their `/`). `only`, when given, restricts\n// wrapping to those names, so an interpolation that is not a path parameter\n// (a runtime `baseUrl`, a runtime server variable) is left as it is.\nexport const wrapRouteParameters = (\n  route: string,\n  prepend: string,\n  append: string,\n  skip: Set<string> = new Set(),\n  only?: Set<string>,\n): string =>\n  mapTemplateExpressions(route, (name) => {\n    // Angular's httpResource rewrites `${param}` to `${param()}`,\n    // `${param?.() ?? default}`, `${pathParams().param}` or\n    // `${pathParams()?.param ?? default}` before this runs; normalize the\n    // expression to the bare param name so the skip set (keyed on the bare\n    // name) still matches.\n    const key = name\n      .replace(/^pathParams\\(\\)\\?\\./, '')\n      .replace(/^pathParams\\(\\)\\./, '')\n      .replace(/\\?\\.\\(\\)\\s*\\?\\?.*$/, '')\n      .replace(/\\s*\\?\\?.*$/, '')\n      .replace(/\\(\\)$/, '')\n      .replace(/[()?]/g, '')\n      .trim();\n    return skip.has(key) || (only && !only.has(key))\n      ? name\n      : `${prepend}${name}${append}`;\n  });\n\nexport const makeRouteSafe = (\n  route: string,\n  skip: Set<string> = new Set(),\n  only?: Set<string>,\n): string =>\n  wrapRouteParameters(route, 'encodeURIComponent(String(', '))', skip, only);\n\n/**\n * Turns a template-literal route into the comma-separated query-key segments\n * used by the Vue/split-query-key generators: `/pets/${petId}/tags` becomes\n * `'pets',petId,'tags'`.\n *\n * The route is tokenized first and split on `/` only inside static text, so a\n * `/` appearing inside an interpolation (a runtime `baseUrl` expression such as\n * `${process.env.API ?? 'http://localhost'}`) does not tear the expression\n * apart, and an escaped `\\${...}` stays a literal segment.\n */\nexport function getRouteAsArray(route: string): string {\n  const entries: string[] = [];\n\n  // Static text is kept in its escaped backtick-source form and re-wrapped in\n  // single quotes, so it goes through `escapeRouteForSingleQuotes` — the one\n  // escape jsesc's backtick mode does not already cover. Empty chunks\n  // (leading, trailing or doubled slashes) contribute no segment.\n  const pushLiteral = (value: string) => {\n    if (value) entries.push(`'${escapeRouteForSingleQuotes(value)}'`);\n  };\n\n  for (const part of parseTemplateLiteral(route)) {\n    if (part.kind === 'expression') {\n      entries.push(part.source);\n      continue;\n    }\n\n    let chunk = '';\n    let index = 0;\n    while (index < part.source.length) {\n      const char = part.source[index];\n      // Consume escapes as a unit so a `\\/` (were jsesc ever to emit one)\n      // is not mistaken for a segment separator.\n      if (char === '\\\\') {\n        chunk += part.source.slice(index, index + 2);\n        index += 2;\n        continue;\n      }\n      if (char === '/') {\n        pushLiteral(chunk);\n        chunk = '';\n        index++;\n        continue;\n      }\n      chunk += char;\n      index++;\n    }\n    pushLiteral(chunk);\n  }\n\n  return entries.join(',');\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { resolveValue } from '../resolvers';\nimport type {\n  ContextSpec,\n  GetterParameters,\n  GetterParams,\n  NormalizedOutputOptions,\n} from '../types';\nimport { stringify } from '../utils';\nimport { camelPathParamName, parseRoutePath } from './route';\n\n/**\n * Return the name of every `{param}` in an OpenAPI path, in spec spelling.\n *\n * Uses the same tokenizer as the route generators ({@link parseRoutePath}), so\n * a placeholder is reported here if and only if it becomes an interpolation in\n * the generated route. Text that only looks like a placeholder — `{a+b}`,\n * `{}`, or a `${...}` block written in the spec — is static text and is not\n * reported (#3703).\n *\n * @example\n * ```\n * getParamsInPath(\"/pet/{category}/{name}/\");\n * // => [\"category\", \"name\"]\n * ```\n * @param path an OpenAPI path, not a generated route\n */\nexport function getParamsInPath(path: string): string[] {\n  return parseRoutePath(path)\n    .filter((token) => token.kind === 'param')\n    .map((token) => token.name);\n}\n\ninterface GetParamsOptions {\n  /** The OpenAPI path (`/pets/{petId}`), not the generated route. */\n  pathRoute: string;\n  pathParams?: GetterParameters['query'];\n  operationId: string;\n  context: ContextSpec;\n  output: NormalizedOutputOptions;\n}\n\n/**\n * Resolves a route placeholder to its single matching spec path parameter.\n * `identifier` already is the generated JS identifier (it comes from the\n * processed route), so we re-derive the same identifier from each spec name via\n * `camelPathParamName` to match. Throws when two spec names collapse onto the\n * same identifier, or when none match.\n */\nfunction resolvePathParam(\n  identifier: string,\n  pathParams: GetterParameters['query'],\n  operationId: string,\n): GetterParameters['query'][number] {\n  const matching = pathParams.filter(\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    ({ parameter }) => camelPathParamName(parameter.name ?? '') === identifier,\n  );\n\n  if (matching.length > 1) {\n    const names = matching\n      .map(({ parameter }) => `'${parameter.name}'`)\n      .join(', ');\n    throw new Error(\n      `Path parameters ${names} all map to the same generated identifier '${identifier}' (${operationId}). Rename them so they don't collide.`,\n    );\n  }\n\n  const pathParam = matching[0];\n  // oxlint-disable-next-line typescript/no-unnecessary-condition\n  if (!pathParam) {\n    throw new Error(\n      `The path params ${identifier} can't be found in parameters (${operationId})`,\n    );\n  }\n\n  return pathParam;\n}\n\nexport function getParams({\n  pathRoute,\n  pathParams = [],\n  operationId,\n  context,\n  output,\n}: GetParamsOptions): GetterParams {\n  // Derived from the spec path through the same tokenizer the route generator\n  // uses, so the generated function arguments and the route interpolations\n  // can never disagree about what is a parameter (#3703).\n  return getParamsInPath(pathRoute).map((specName) => {\n    const pathParam = resolvePathParam(\n      camelPathParamName(specName),\n      pathParams,\n      operationId,\n    );\n\n    const parameter = pathParam.parameter;\n    const nameWithoutSanitize = parameter.name;\n    const required = parameter.required ?? false;\n    const schema = 'schema' in parameter ? parameter.schema : undefined;\n    const allowReserved =\n      'allowReserved' in parameter ? parameter.allowReserved : false;\n\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    const name = camelPathParamName(nameWithoutSanitize ?? '');\n\n    if (!schema) {\n      return {\n        name,\n        definition: `${name}${required ? '' : '?'}: unknown`,\n        implementation: `${name}${required ? '' : '?'}: unknown`,\n        default: undefined,\n        required,\n        allowReserved,\n        imports: [],\n      };\n    }\n\n    const resolvedValue = resolveValue({\n      schema,\n      context,\n    });\n\n    const originalSchema = resolvedValue.originalSchema;\n\n    // Bridge assertion: .default returns any due to AnyOtherAttribute on OpenApiSchemaObject\n    const schemaDefault = !isBooleanJsonSchema(originalSchema)\n      ? (originalSchema.default as\n          | string\n          | Record<string, unknown>\n          | unknown[]\n          | undefined)\n      : undefined;\n\n    let paramType = resolvedValue.value;\n    if (output.allParamsOptional) {\n      paramType = `${paramType} | undefined | null`; // TODO: maybe check that `paramType` isn't already undefined or null\n    }\n\n    // `0`, `false` and `''` are defaults like any other, so the presence of one\n    // is a check against `undefined` rather than a truthiness test.\n    const hasSchemaDefault = schemaDefault !== undefined;\n\n    const definition = `${name}${\n      !required || hasSchemaDefault ? '?' : ''\n    }: ${paramType}`;\n\n    const implementation = `${name}${!required && !hasSchemaDefault ? '?' : ''}${\n      hasSchemaDefault\n        ? `: ${paramType} = ${stringify(schemaDefault)}`\n        : `: ${paramType}`\n    }`; // FIXME: in Vue if we have `version: MaybeRef<number | undefined | null> = 1` and we don't pass version, the unref(version) will be `undefined` and not `1`, so we need to handle default value somewhere in implementation and not in the definition\n\n    return {\n      name,\n      definition,\n      implementation,\n      default: schemaDefault,\n      required,\n      allowReserved,\n      imports: resolvedValue.imports,\n      originalSchema,\n    };\n  });\n}\n","import {\n  type ContextSpec,\n  type GetterBody,\n  type GetterParams,\n  type GetterProps,\n  GetterPropType,\n  type GetterQueryParam,\n} from '../types';\nimport { isNullish, pascal, sortByPriority, stringify } from '../utils';\n\ninterface GetPropsOptions {\n  body: GetterBody;\n  queryParams?: GetterQueryParam;\n  params: GetterParams;\n  operationName: string;\n  headers?: GetterQueryParam;\n  context: ContextSpec;\n}\n\nexport function getProps({\n  body,\n  queryParams,\n  params,\n  operationName,\n  headers,\n  context,\n}: GetPropsOptions): GetterProps {\n  const bodyProp = {\n    name: body.implementation,\n    definition: `${body.implementation}${body.isOptional && !context.output.optionsParamRequired ? '?' : ''}: ${body.definition}`,\n    implementation: `${body.implementation}${body.isOptional && !context.output.optionsParamRequired ? '?' : ''}: ${body.definition}`,\n    default: undefined,\n    required: !body.isOptional || context.output.optionsParamRequired,\n    type: GetterPropType.BODY,\n  };\n\n  const queryParamsProp = {\n    name: 'params',\n    definition: getQueryParamDefinition(queryParams, context),\n    implementation: getQueryParamDefinition(queryParams, context),\n    default: undefined,\n    required: isNullish(queryParams?.isOptional)\n      ? !context.output.allParamsOptional || context.output.optionsParamRequired\n      : (!queryParams.isOptional && !context.output.allParamsOptional) ||\n        context.output.optionsParamRequired,\n    type: GetterPropType.QUERY_PARAM,\n  };\n\n  const headersProp = {\n    name: 'headers',\n    definition: `headers${headers?.isOptional && !context.output.optionsParamRequired ? '?' : ''}: ${\n      headers?.schema.name\n    }`,\n    implementation: `headers${headers?.isOptional && !context.output.optionsParamRequired ? '?' : ''}: ${\n      headers?.schema.name\n    }`,\n    default: undefined,\n    required: isNullish(headers?.isOptional)\n      ? false\n      : !headers.isOptional || context.output.optionsParamRequired,\n    type: GetterPropType.HEADER,\n  };\n\n  let paramGetterProps: GetterProps;\n  if (context.output.override.useNamedParameters && params.length > 0) {\n    const parameterTypeName = `${pascal(operationName)}PathParameters`;\n\n    const name = 'pathParams';\n\n    // needs a special model\n    const namedParametersTypeDefinition = `export type ${parameterTypeName} = {\\n ${params\n      .map((property) => property.definition)\n      .join(',\\n    ')},\\n }`;\n\n    const isOptional =\n      context.output.optionsParamRequired ||\n      params.every((param) => param.default !== undefined);\n\n    const implementation = `{ ${params\n      .map(\n        (property) =>\n          property.default === undefined\n            ? property.name\n            : `${property.name} = ${stringify(property.default)}`, // if we use property.implementation, we will get `{ version: number = 1 }: ListPetsPathParameters = {}` which isn't valid\n      )\n      .join(', ')} }: ${parameterTypeName}${isOptional ? ' = {}' : ''}`;\n\n    const destructured = `{ ${params\n      .map((property) => property.name)\n      .join(', ')} }`;\n\n    paramGetterProps = [\n      {\n        type: GetterPropType.NAMED_PATH_PARAMS,\n        name,\n        definition: `${name}: ${parameterTypeName}`,\n        implementation,\n        default: undefined,\n        destructured,\n        required: true,\n        schema: {\n          name: parameterTypeName,\n          model: namedParametersTypeDefinition,\n          imports: params.flatMap((property) => property.imports),\n        },\n      },\n    ];\n  } else {\n    paramGetterProps = params.map((param) => ({\n      ...param,\n      type: GetterPropType.PARAM,\n    }));\n  }\n\n  const props = [\n    ...paramGetterProps,\n    ...(body.definition ? [bodyProp] : []),\n    ...(queryParams ? [queryParamsProp] : []),\n    ...(headers ? [headersProp] : []),\n  ];\n\n  const sortedProps = sortByPriority(props);\n\n  return sortedProps;\n}\n\nfunction getQueryParamDefinition(\n  queryParams: GetterQueryParam | undefined,\n  context: ContextSpec,\n): string {\n  const paramType = queryParams?.schema.name;\n  return `params${(queryParams?.isOptional || context.output.allParamsOptional) && !context.output.optionsParamRequired ? '?' : ''}: ${paramType}`;\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { resolveValue } from '../resolvers';\nimport type {\n  ContextSpec,\n  GeneratorImport,\n  GeneratorSchema,\n  GetterParameters,\n  GetterQueryParam,\n  OpenApiParameterObject,\n  OpenApiParameterWithContentObject,\n  OpenApiSchemaObject,\n} from '../types';\nimport { isSchemaNullable, jsDoc, pascal, sanitize } from '../utils';\nimport { getEnum, getEnumMembers, isEnumReferenceMissingNull } from './enum';\nimport { getKey } from './keys';\n\ninterface QueryParamsType {\n  name: string;\n  required: boolean;\n  definition: string;\n  imports: GeneratorImport[];\n  schemas: GeneratorSchema[];\n  originalSchema: OpenApiSchemaObject;\n  objectStrategy?: 'flatten' | 'comma' | 'deepObject';\n}\n\nconst isOpenApiSchemaObject = (\n  value: unknown,\n): value is OpenApiSchemaObject => {\n  if (!value || typeof value !== 'object') {\n    return false;\n  }\n\n  return !('$ref' in value);\n};\n\n/**\n * A `$ref` schema object (e.g. array `items` or a oneOf/anyOf/allOf variant\n * pointing at a component). We don't resolve the reference here, but a query\n * parameter behind a `$ref` is virtually always a complex (object-like) type,\n * so it must be treated as non-primitive. Over-flagging is harmless: the only\n * consumer (the Angular `nonPrimitiveKeys` passthrough) is gated on a\n * configured `paramsSerializer`, which is precisely what handles raw values.\n */\nconst isRefObject = (value: unknown): boolean =>\n  !!value && typeof value === 'object' && '$ref' in value;\n\nconst getSchemaType = (\n  schema: OpenApiSchemaObject,\n): string | string[] | undefined => {\n  const type = (schema as { type?: unknown }).type;\n\n  if (typeof type === 'string') {\n    return type;\n  }\n\n  if (\n    Array.isArray(type) &&\n    type.every((variant): variant is string => typeof variant === 'string')\n  ) {\n    return type;\n  }\n\n  return undefined;\n};\n/**\n * Detects whether a query parameter's resolved schema is non-primitive — i.e.\n * an object, an array of objects, or a composition (oneOf/anyOf/allOf) that\n * resolves to a non-primitive shape.\n *\n * Used by Angular generators so the default `filterParams` helper preserves\n * such values instead of silently dropping them. Angular's `HttpParams` only\n * accepts primitives, but a user-provided `paramsSerializer`, `mutator`, or\n * `paramsFilter` may need the raw object to flatten or stringify it.\n */\nconst isSchemaNonPrimitive = (schema: OpenApiSchemaObject): boolean => {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  const schemaType = getSchemaType(schema);\n  const type = Array.isArray(schemaType)\n    ? schemaType.filter((variant) => variant !== 'null')\n    : schemaType;\n  const additionalProperties = (schema as { additionalProperties?: unknown })\n    .additionalProperties;\n\n  if (type === 'object') {\n    return true;\n  }\n  if (Array.isArray(type) && type.includes('object')) {\n    return true;\n  }\n  if (type === 'array' || (Array.isArray(type) && type.includes('array'))) {\n    const items = (schema as { items?: unknown }).items;\n    if (isOpenApiSchemaObject(items)) {\n      return isSchemaNonPrimitive(items);\n    }\n    // Arrays with missing/unknown `items` are still non-primitive for our\n    // Angular passthrough purposes: without a serializer/filter, HttpParams\n    // cannot safely represent them. `$ref` items also land here because\n    // isOpenApiSchemaObject rejects references.\n    return true;\n  }\n\n  const compositions = [\n    ...(Array.isArray(schema.oneOf) ? (schema.oneOf as unknown[]) : []),\n    ...(Array.isArray(schema.anyOf) ? (schema.anyOf as unknown[]) : []),\n    ...(Array.isArray(schema.allOf) ? (schema.allOf as unknown[]) : []),\n  ];\n  if (compositions.length > 0) {\n    return compositions.some((variant) =>\n      isOpenApiSchemaObject(variant)\n        ? isSchemaNonPrimitive(variant)\n        : isRefObject(variant),\n    );\n  }\n\n  if (\n    !type &&\n    ((schema as { properties?: unknown }).properties !== undefined ||\n      (additionalProperties !== undefined && additionalProperties !== false))\n  ) {\n    return true;\n  }\n  return false;\n};\n\n/**\n * Detects whether a query parameter's resolved schema is a plain object —\n * i.e. serializable per OpenAPI's `style`/`explode` object rules (form/\n * deepObject). Unlike {@link isSchemaNonPrimitive}, arrays (including arrays\n * of objects) are explicitly excluded: OpenAPI defines no style/explode\n * object-serialization for them, so they stay on the existing\n * passthrough/drop path.\n *\n * Used to compute {@link GetterQueryParam.objectQueryParams}. See issue #3705.\n */\nconst isPlainObjectSchema = (schema: OpenApiSchemaObject): boolean => {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  const schemaType = getSchemaType(schema);\n  const type = Array.isArray(schemaType)\n    ? schemaType.filter((variant) => variant !== 'null')\n    : schemaType;\n  const additionalProperties = (schema as { additionalProperties?: unknown })\n    .additionalProperties;\n\n  if (type === 'object') {\n    return true;\n  }\n  if (Array.isArray(type) && type.includes('object')) {\n    return true;\n  }\n  if (type === 'array' || (Array.isArray(type) && type.includes('array'))) {\n    return false;\n  }\n\n  const compositions = [\n    ...(Array.isArray(schema.oneOf) ? (schema.oneOf as unknown[]) : []),\n    ...(Array.isArray(schema.anyOf) ? (schema.anyOf as unknown[]) : []),\n    ...(Array.isArray(schema.allOf) ? (schema.allOf as unknown[]) : []),\n  ];\n  if (compositions.length > 0) {\n    return compositions.some(\n      (variant) =>\n        isOpenApiSchemaObject(variant) && isPlainObjectSchema(variant),\n    );\n  }\n\n  if (\n    !type &&\n    ((schema as { properties?: unknown }).properties !== undefined ||\n      (additionalProperties !== undefined && additionalProperties !== false))\n  ) {\n    return true;\n  }\n  return false;\n};\n\n/**\n * Derives the object-serialization strategy for a query parameter from its\n * declared `style`/`explode`, following the OpenAPI defaults (`style: form`,\n * `explode: true` for `form`). Returns `undefined` for parameters that are\n * not plain-object schemas or that are defined via `content:` (their\n * spec-correct encoding is a JSON string — a separate follow-up). See issue\n * #3705.\n */\nconst getObjectQueryParamStrategy = (\n  parameter: OpenApiParameterObject,\n  schema: OpenApiSchemaObject | undefined,\n  isContentBased: boolean,\n): 'flatten' | 'comma' | 'deepObject' | undefined => {\n  if (isContentBased || !schema || !isPlainObjectSchema(schema)) {\n    return undefined;\n  }\n\n  const { style, explode } = parameter as {\n    style?: string;\n    explode?: boolean;\n  };\n\n  if (style === 'deepObject') {\n    return 'deepObject';\n  }\n\n  const resolvedStyle = style ?? 'form';\n  const resolvedExplode = explode ?? resolvedStyle === 'form';\n\n  return resolvedExplode ? 'flatten' : 'comma';\n};\n\nfunction getQueryParamsTypes(\n  queryParams: GetterParameters['query'],\n  operationName: string,\n  context: ContextSpec,\n): QueryParamsType[] {\n  return queryParams.map(({ parameter, imports: parameterImports }) => {\n    const {\n      name,\n      required,\n      schema: schemaParam,\n      content,\n    } = parameter as unknown as {\n      name: string;\n      required: boolean;\n      schema: OpenApiSchemaObject | undefined;\n      content: OpenApiParameterWithContentObject['content'];\n    };\n\n    const queryName = sanitize(`${pascal(operationName)}${pascal(name)}`, {\n      underscore: '_',\n      whitespace: '_',\n      dash: true,\n      es5keyword: true,\n      es5IdentifierName: true,\n    });\n\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    const schema = schemaParam ?? content?.['application/json']?.schema;\n    if (!schema) {\n      throw new Error(\n        `Query parameter \"${name}\" has no schema or content definition`,\n      );\n    }\n\n    const hasSchemaDefault =\n      !isBooleanJsonSchema(schema) && schema.default !== undefined;\n\n    const resolvedValue = resolveValue({\n      schema,\n      context,\n      name: queryName,\n    });\n\n    const objectStrategy = getObjectQueryParamStrategy(\n      parameter,\n      resolvedValue.originalSchema,\n      schemaParam === undefined,\n    );\n\n    const key = getKey(name);\n    // Bridge assertion: cast schema to jsDoc's expected parameter shape\n    // to avoid AnyOtherAttribute spreading error type\n    const schemaForDoc = schema as {\n      description?: string | string[];\n      deprecated?: boolean;\n      summary?: string;\n      minLength?: number;\n      maxLength?: number;\n      minimum?: number;\n      maximum?: number;\n      exclusiveMinimum?: number;\n      exclusiveMaximum?: number;\n      minItems?: number;\n      maxItems?: number;\n      type?: string | string[];\n      pattern?: string;\n    };\n    const doc = jsDoc(\n      {\n        description: parameter.description,\n        ...schemaForDoc,\n      },\n      void 0,\n      context,\n    );\n\n    if (parameterImports.length > 0) {\n      return {\n        name,\n        required,\n        definition: `${doc}${key}${!required || hasSchemaDefault ? '?' : ''}: ${\n          parameterImports[0].name\n        };`,\n        imports: parameterImports,\n        schemas: [],\n        originalSchema: resolvedValue.originalSchema,\n        objectStrategy,\n      };\n    }\n\n    if (resolvedValue.isEnum && !resolvedValue.isRef) {\n      const enumName = queryName;\n      // Vendor extensions like `x-enum-varnames` may live on the parameter\n      // itself rather than inside `schema` — notably after a Swagger 2 → OAS 3\n      // upgrade, which moves standard schema fields into `schema` but leaves\n      // vendor extensions at the parameter level.\n      const parameterAsSchema = parameter as OpenApiSchemaObject;\n      const enumMembers = getEnumMembers(\n        resolvedValue.originalSchema,\n        parameterAsSchema,\n      );\n\n      const isNullable =\n        isSchemaNullable(resolvedValue.originalSchema) ||\n        isSchemaNullable(parameterAsSchema);\n\n      const enumValue = getEnum(\n        enumMembers,\n        enumName,\n        isNullable,\n        context.output.override.enumGenerationType,\n        context.output.override.namingConvention.enum,\n      );\n      const enumType = isEnumReferenceMissingNull(\n        enumMembers,\n        isNullable,\n        context.output.override.enumGenerationType,\n      )\n        ? `${enumName} | null`\n        : enumName;\n\n      return {\n        name,\n        required,\n        definition: `${doc}${key}${\n          !required || hasSchemaDefault ? '?' : ''\n        }: ${enumType};`,\n        imports: [{ name: enumName }],\n        schemas: [\n          ...resolvedValue.schemas,\n          {\n            name: enumName,\n            model: enumValue,\n            imports: resolvedValue.imports,\n            kind: 'enum',\n          },\n        ],\n        originalSchema: resolvedValue.originalSchema,\n        objectStrategy,\n      };\n    }\n\n    const definition = `${doc}${key}${\n      !required || hasSchemaDefault ? '?' : ''\n    }: ${resolvedValue.value};`;\n\n    return {\n      name,\n      required,\n      definition,\n      imports: resolvedValue.imports,\n      schemas: resolvedValue.schemas,\n      originalSchema: resolvedValue.originalSchema,\n      objectStrategy,\n    };\n  });\n}\n\ninterface GetQueryParamsOptions {\n  queryParams: GetterParameters['query'];\n  operationName: string;\n  context: ContextSpec;\n  suffix?: string;\n}\n\nexport function getQueryParams({\n  queryParams,\n  operationName,\n  context,\n  suffix = 'params',\n}: GetQueryParamsOptions): GetterQueryParam | undefined {\n  if (queryParams.length === 0) {\n    return;\n  }\n  const types = getQueryParamsTypes(queryParams, operationName, context);\n  const imports = types.flatMap(({ imports }) => imports);\n  const schemas = types.flatMap(({ schemas }) => schemas);\n  const name = `${pascal(operationName)}${pascal(suffix)}`;\n\n  const type = types.map(({ definition }) => definition).join('\\n');\n  const allOptional = queryParams.every(({ parameter }) => !parameter.required);\n  const requiredNullableKeys = types\n    .filter(\n      ({ required, originalSchema }) =>\n        required && isSchemaNullable(originalSchema),\n    )\n    .map(({ name }) => name);\n  const nonPrimitiveKeys = types\n    .filter(({ originalSchema }) => isSchemaNonPrimitive(originalSchema))\n    .map(({ name }) => name);\n  const objectQueryParams = types\n    .filter(\n      (\n        type,\n      ): type is QueryParamsType & {\n        objectStrategy: 'flatten' | 'comma' | 'deepObject';\n      } => type.objectStrategy !== undefined,\n    )\n    .map(({ name, objectStrategy }) => ({\n      key: name,\n      strategy: objectStrategy,\n    }));\n\n  const schema = {\n    name,\n    model: `export type ${name} = {\\n${type}\\n};\\n`,\n    imports,\n  };\n\n  return {\n    schema,\n    deps: schemas,\n    isOptional: allOptional,\n    paramNames: types.map(({ name }) => name),\n    requiredNullableKeys,\n    ...(nonPrimitiveKeys.length > 0 ? { nonPrimitiveKeys } : {}),\n    ...(objectQueryParams.length > 0 ? { objectQueryParams } : {}),\n  };\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport type {\n  ContextSpec,\n  GetterResponse,\n  OpenApiReferenceObject,\n  OpenApiRequestBodyObject,\n  OpenApiResponseObject,\n  OpenApiResponsesObject,\n  OverrideOutputContentType,\n  ResReqTypesValue,\n} from '../types';\nimport {\n  dedupeUnionType,\n  filterByContentType,\n  isBinaryContentType,\n} from '../utils';\nimport { getResReqTypes } from './res-req-types';\n\ninterface GetResponseOptions {\n  responses: OpenApiResponsesObject;\n  operationName: string;\n  context: ContextSpec;\n  contentType?: OverrideOutputContentType;\n  generatePrimitiveSchemas?: boolean;\n}\n\nexport function getResponse({\n  responses,\n  operationName,\n  context,\n  contentType,\n  generatePrimitiveSchemas = false,\n}: GetResponseOptions): GetterResponse {\n  const types = getResReqTypes(\n    Object.entries(responses) as [\n      string,\n      OpenApiReferenceObject | OpenApiResponseObject | OpenApiRequestBodyObject,\n    ][],\n    operationName,\n    context,\n    'void',\n    (type) => `${type.key}-${type.value}-${type.contentType}`,\n    generatePrimitiveSchemas,\n  );\n\n  const filteredTypes = filterByContentType(types, contentType);\n\n  const imports = filteredTypes.flatMap(({ imports }) => imports);\n  const schemas = filteredTypes.flatMap(({ schemas }) => schemas);\n\n  const contentTypes = [\n    ...new Set(filteredTypes.map(({ contentType }) => contentType)),\n  ];\n\n  const groupedByStatus: {\n    success: ResReqTypesValue[];\n    errors: ResReqTypesValue[];\n  } = { success: [], errors: [] };\n  for (const type of filteredTypes) {\n    if (type.key.startsWith('2')) {\n      groupedByStatus.success.push(type);\n    } else {\n      groupedByStatus.errors.push(type);\n    }\n  }\n\n  const success = dedupeUnionType(\n    groupedByStatus.success\n      .map(({ value, formData }) => (formData ? 'Blob' : value))\n      .join(' | '),\n  );\n  const errors = dedupeUnionType(\n    groupedByStatus.errors.map(({ value }) => value).join(' | '),\n  );\n\n  const defaultType = filteredTypes.find(({ key }) => key === 'default')?.value;\n\n  return {\n    imports,\n    definition: {\n      success: success || (defaultType ?? 'unknown'),\n      errors: errors || (defaultType ?? 'unknown'),\n    },\n    isBlob: groupedByStatus.success.some(\n      (t) =>\n        (!!t.contentType && isBinaryContentType(t.contentType)) ||\n        (t.originalSchema !== undefined &&\n          !isBooleanJsonSchema(t.originalSchema) &&\n          (t.originalSchema.format === 'binary' ||\n            (t.originalSchema.contentMediaType === 'application/octet-stream' &&\n              !t.originalSchema.contentEncoding))),\n    ),\n    types: groupedByStatus,\n    contentTypes,\n    schemas,\n    originalSchema: responses,\n  };\n}\n","import { getResReqTypes } from '../getters';\nimport type {\n  ContextSpec,\n  GeneratorSchema,\n  OpenApiComponentsObject,\n} from '../types';\nimport { getComponentBaseName, jsDoc, sanitize } from '../utils';\n\nexport function generateComponentDefinition(\n  responses:\n    | OpenApiComponentsObject['responses']\n    | OpenApiComponentsObject['requestBodies'] = {},\n  context: ContextSpec,\n  suffix: string,\n  prefix = '',\n): GeneratorSchema[] {\n  if (Object.keys(responses).length === 0) {\n    return [];\n  }\n\n  const generatorSchemas: GeneratorSchema[] = [];\n  for (const [name, response] of Object.entries(responses)) {\n    // Inline content types are named after the component too, so they must use\n    // the collision-aware name (`Error` / `error` → `Error` / `Error2`).\n    const baseName = getComponentBaseName(responses, name);\n    const allResponseTypes = getResReqTypes(\n      // oxlint-disable-next-line typescript/no-unsafe-argument\n      [[suffix, response]],\n      baseName,\n      context,\n      'void',\n    );\n\n    const imports = allResponseTypes.flatMap(({ imports }) => imports);\n    const schemas = allResponseTypes.flatMap(({ schemas }) => schemas);\n\n    const type = allResponseTypes.map(({ value }) => value).join(' | ');\n\n    const modelName = sanitize(`${prefix}${baseName}${suffix}`, {\n      underscore: '_',\n      whitespace: '_',\n      dash: true,\n      es5keyword: true,\n      es5IdentifierName: true,\n    });\n    // oxlint-disable-next-line typescript/no-unsafe-argument\n    const doc = jsDoc(response);\n    const model = `${doc}export type ${modelName} = ${type || 'unknown'};\\n`;\n\n    generatorSchemas.push(...schemas);\n\n    if (modelName !== type) {\n      generatorSchemas.push({\n        name: modelName,\n        model,\n        imports,\n        kind: 'schema',\n      });\n    }\n  }\n\n  return generatorSchemas;\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { hasNarrowedPropertyNames } from '../getters';\nimport { resolveRef } from '../resolvers/ref';\nimport type {\n  ContextSpec,\n  GetterBody,\n  GetterResponse,\n  OpenApiNonBooleanSchemaObject,\n  OpenApiReferenceObject,\n  OpenApiRequestBodyObject,\n  OpenApiSchemaObject,\n} from '../types';\nimport { isInlineSchema, pascal, toObjectSchema } from '../utils';\n\ntype SchemaOrRef = OpenApiSchemaObject | OpenApiReferenceObject;\n\ninterface NormalizedSchema {\n  schema: OpenApiNonBooleanSchemaObject;\n  /** Set when the schema was reached through a `$ref`; drives cycle detection. */\n  ref?: string;\n  /** True when the schema admits `null`, in either OAS 3.0 or 3.1 spelling. */\n  nullable: boolean;\n}\n\nconst isDateSchema = (schema: OpenApiSchemaObject): boolean =>\n  !isBooleanJsonSchema(schema) &&\n  (schema.format === 'date' || schema.format === 'date-time');\n\nconst isNullTypeSchema = (schemaOrRef: SchemaOrRef): boolean => {\n  if (!isInlineSchema(schemaOrRef) || isBooleanJsonSchema(schemaOrRef))\n    return false;\n  const { type } = schemaOrRef;\n  return (\n    type === 'null' ||\n    (Array.isArray(type) && type.length > 0 && type.every((t) => t === 'null'))\n  );\n};\n\nconst hasNullableType = (schema: OpenApiSchemaObject): boolean =>\n  !isBooleanJsonSchema(schema) &&\n  Array.isArray(schema.type) &&\n  schema.type.includes('null');\n\n/**\n * True when the schema itself names at least one property. An empty\n * `properties: {}` names none: the object getter types it — alongside a\n * schema-valued `additionalProperties` — as the same index signature as a bare\n * map, so it must not count as declaring keys or as needing an object copy.\n */\nconst hasOwnProperties = (schema: OpenApiSchemaObject): boolean =>\n  !isBooleanJsonSchema(schema) &&\n  schema.properties !== undefined &&\n  Object.keys(schema.properties).length > 0;\n\n/**\n * True when this schema, or any of its `allOf` branches (recursively,\n * through `$ref`s), declares its own `properties` — or is itself a `oneOf`/\n * `anyOf` union whose variants declare theirs. Mirrors `needsObjectCopy`'s\n * `allOf` recursion, but is asked before that function exists in the file, so\n * it stays a narrower, standalone check.\n *\n * Exists so Rule 1 (below) can mean \"does this level declare any keys at\n * all\" rather than \"does this exact schema object have a `properties` key\"\n * — an intersection built from `allOf` merges every branch's properties into\n * the same object, and a discriminated (or undiscriminated) union's variants\n * are merged into the same level's type by the getter just as surely, so\n * either is just as unsafe to combine with a map loop as a literal\n * `properties` block on the schema being asked about directly. A `oneOf`/\n * `anyOf` reaching this point is a genuine union, not a nullable wrapper:\n * `normalizeSchema` (called first, below) already unwraps the nullable\n * spellings (`anyOf: [T, null]`, `type: [T, 'null']`) to the bare\n * schema before this check ever sees them, so a nullable map or a nullable\n * map value is unaffected.\n */\nconst declaresProperties = (\n  schemaOrRef: SchemaOrRef,\n  context: ContextSpec,\n  seenRefs: Set<string> = new Set(),\n): boolean => {\n  const { schema, ref } = normalizeSchema(schemaOrRef, context);\n  if (ref) {\n    if (seenRefs.has(ref)) return false;\n    seenRefs.add(ref);\n  }\n  if (isBooleanJsonSchema(schema)) return false;\n  if (hasOwnProperties(schema)) return true;\n  if (schema.oneOf || schema.anyOf) return true;\n  return (schema.allOf ?? []).some((branch: SchemaOrRef) =>\n    declaresProperties(branch, context, seenRefs),\n  );\n};\n\n/**\n * The `additionalProperties` schema when this level of the object is a map\n * of same-shaped values, or undefined when it is not.\n *\n * Several shapes contribute nothing (Rule 2): `additionalProperties: true`\n * and `additionalProperties: false` are a permissive/forbidding flag, not a\n * value schema, and an absent `additionalProperties` obviously isn't one\n * either. An array (`additionalProperties: []`, invalid JSON Schema but seen\n * in the wild) and a keyless object (`additionalProperties: {}`, the common\n * \"extra keys are allowed, of any shape\" idiom) are rejected too: neither\n * has a format, a `$ref`, or any nested shape this walk could ever turn into\n * a statement, so treating either as a real map value schema would only\n * make the items/map conflict check in `buildResolvedStatements` fire on a\n * purely syntactic `!= null` and silently drop an array walk that used to\n * run. Only a non-empty object (a schema, possibly a `$ref` to one) counts\n * as a map's value type.\n *\n * A schema that also declares `properties` — directly, via an `allOf`\n * branch (Rule 1), or as a `oneOf`/`anyOf` union sitting beside\n * `additionalProperties` — is never walked as a map, full stop:\n * `additionalProperties` only governs the keys `properties` doesn't name,\n * and a blind loop over every key would revisit — and, since not every\n * declared property holds a date, potentially corrupt — the composition's\n * own declared properties (or, for a union, whichever variant's properties\n * the discriminator switch just converted). The `allOf` check here only sees\n * branches nested inside *this* schema's own `allOf` array (`{ allOf: [Base],\n * additionalProperties }`); the sibling spelling, where this schema is\n * itself one of a *parent's* `allOf` branches (`allOf: [Base,\n * { additionalProperties }]`), is caught separately in\n * `buildResolvedStatements`, which has visibility into the parent's other\n * branches that this function does not. Distinguishing \"the extra keys\" from\n * the named ones would need the full set of sibling property names threaded\n * through the walk for no real-world payoff, so a schema declaring both is\n * left to its `properties` statements only. A `oneOf`/`anyOf` whose values\n * are the map's *value* type (`additionalProperties: { oneOf: [...] }`) is\n * unaffected — that union lives one object level down, on the schema\n * `mapValueSchema` returns, not on the schema it's asked about.\n *\n * A `propertyNames` that narrows the key type to a finite set of literals\n * (`enum`, `const`, or a `$ref` to a string enum/const) also disqualifies a\n * schema from map traversal: `getters/object.ts` (`hasNarrowedPropertyNames`)\n * types that combination as `Partial<Record<K, V>>`, not an index signature,\n * so `Object.keys()` (typed `string`) can't index it without a `TS7053`, and\n * even a correctly-typed key would read a value typed `V | undefined` that\n * this walk has no way to narrow. Emit nothing rather than code that doesn't\n * compile. Any other `propertyNames` constraint — `format`, `pattern`,\n * `minLength`, or none at all — still types as a plain index signature\n * (`[key: string]: V`), which a blind `Object.keys` loop indexes fine, so\n * those cases fall through to the traversal below.\n */\nconst mapValueSchema = (\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n): SchemaOrRef | undefined => {\n  if (isBooleanJsonSchema(schema)) return undefined;\n  if (declaresProperties(schema, context)) return undefined;\n  if (schema.propertyNames && hasNarrowedPropertyNames(schema, context)) {\n    return undefined;\n  }\n  const { additionalProperties } = schema;\n  if (!additionalProperties || typeof additionalProperties !== 'object') {\n    return undefined;\n  }\n  if (Array.isArray(additionalProperties)) return undefined;\n  if (Object.keys(additionalProperties).length === 0) return undefined;\n  return additionalProperties as SchemaOrRef;\n};\n\n/**\n * Resolves `$ref`s and unwraps the OAS 3.1 spelling of a nullable schema\n * (`anyOf: [<schema>, { type: 'null' }]`) so a nullable date is recognised\n * whichever spelling the document uses, instead of being skipped as an\n * undiscriminated union.\n */\nconst normalizeSchema = (\n  schemaOrRef: SchemaOrRef,\n  context: ContextSpec,\n  nullable = false,\n  seenRefs: Set<string> = new Set(),\n): NormalizedSchema => {\n  if (isBooleanJsonSchema(schemaOrRef)) {\n    return {\n      schema: toObjectSchema(schemaOrRef),\n      nullable: schemaOrRef,\n    };\n  }\n\n  if (!isInlineSchema(schemaOrRef) && schemaOrRef.$ref) {\n    const ref: string = schemaOrRef.$ref;\n    // Guard against a self-referential nullable wrapper (`A: anyOf [A, null]`)\n    // sending this resolution loop infinite.\n    if (seenRefs.has(ref)) {\n      return { schema: {}, ref, nullable };\n    }\n    seenRefs.add(ref);\n    const { schema } = resolveRef<OpenApiSchemaObject>(schemaOrRef, context);\n    return {\n      ...normalizeSchema(schema, context, nullable, seenRefs),\n      ref,\n    };\n  }\n\n  const schema = schemaOrRef as OpenApiNonBooleanSchemaObject;\n  const variants = schema.oneOf ?? schema.anyOf;\n\n  if (\n    variants &&\n    !schema.discriminator &&\n    !schema.properties &&\n    !schema.allOf\n  ) {\n    const nonNullVariants = variants.filter(\n      (variant: SchemaOrRef) => !isNullTypeSchema(variant),\n    );\n    if (\n      nonNullVariants.length === 1 &&\n      nonNullVariants.length < variants.length\n    ) {\n      return normalizeSchema(nonNullVariants[0], context, true, seenRefs);\n    }\n  }\n\n  return { schema, nullable: nullable || hasNullableType(schema) };\n};\n\nconst IDENTIFIER_REGEX = /^[A-Za-z_$][\\w$]*$/;\n\nconst propertyAccessor = (parent: string, key: string): string =>\n  IDENTIFIER_REGEX.test(key)\n    ? `${parent}.${key}`\n    : `${parent}[${JSON.stringify(key)}]`;\n\n/**\n * `readOnly` schema properties are generated with a `readonly` modifier, so\n * the deserializer cannot assign to them directly. Casting the container to\n * its mutable twin keeps the assignment type-checked — the assigned value\n * must still be a `Date` — without widening anything to `any`.\n */\nconst mutableCast = (accessor: string): string =>\n  `(${accessor} as { -readonly [K in keyof typeof ${accessor}]: (typeof ${accessor})[K] })`;\n\nconst indent = (statements: string[]): string[] =>\n  statements.map((statement) => `  ${statement}`);\n\n/**\n * A discriminator mapping value is either a `$ref` or a bare component schema\n * name (OpenAPI allows both); bare names are expanded to the component ref.\n */\nconst discriminatorMappingRef = (value: string): string =>\n  value.startsWith('#') || value.includes('/')\n    ? value\n    : `#/components/schemas/${value}`;\n\ninterface BuildResult {\n  statements: string[];\n  /**\n   * Refs whose expansion re-entered themselves. Propagated up so the schema\n   * that closes a cycle can drop its statements entirely — see buildStatements.\n   */\n  cyclicRefs: Set<string>;\n}\n\nconst emptyResult = (): BuildResult => ({\n  statements: [],\n  cyclicRefs: new Set(),\n});\n\nconst mergeResults = (results: BuildResult[]): BuildResult => ({\n  statements: results.flatMap((result) => result.statements),\n  cyclicRefs: new Set(results.flatMap((result) => [...result.cyclicRefs])),\n});\n\ninterface BuildParams {\n  schema: SchemaOrRef;\n  /** Expression the statements read from, e.g. `data.log` */\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  /** Assignment target when it differs from `accessor` (readOnly properties). */\n  writeAccessor?: string;\n  mode: DateTransformMode;\n  /**\n   * True when an ancestor's `allOf` composition already declares\n   * `properties` somewhere in it, so this schema's own `additionalProperties`\n   * (if it has one) must not be walked as a map even though, examined in\n   * isolation, it looks like a plain map — see the sibling-`allOf` note on\n   * `mapValueSchema`. Set when recursing into an `allOf` branch, and also\n   * when recursing into a discriminated-union variant: unlike `items`, map\n   * values and object properties (which do start a fresh object level and\n   * leave this unset), a variant is resolved against the very same accessor\n   * as the `switch` itself — that level is guaranteed at runtime to carry\n   * the discriminator property, so a variant that is a bare map is exactly\n   * as unsafe to walk with a blind `Object.keys` loop as an `allOf` branch\n   * sitting beside a properties-declaring sibling is.\n   */\n  mapSuppressed?: boolean;\n}\n\nconst buildStatements = ({\n  schema: schemaOrRef,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  writeAccessor,\n  mode,\n  mapSuppressed,\n}: BuildParams): BuildResult => {\n  const { schema, ref } = normalizeSchema(schemaOrRef, context);\n  if (ref) {\n    if (visitedRefs.has(ref)) {\n      return { statements: [], cyclicRefs: new Set([ref]) };\n    }\n    visitedRefs.add(ref);\n  }\n\n  // `finally` (rather than a delete on the success path) keeps the shared\n  // visitedRefs set consistent even when a nested resolution throws — a\n  // leaked entry would make a later, non-cyclic branch look cyclic and\n  // silently drop its conversions.\n  try {\n    return buildResolvedStatements({\n      schema,\n      ref,\n      accessor,\n      context,\n      visitedRefs,\n      depth,\n      writeAccessor,\n      mode,\n      mapSuppressed,\n    });\n  } finally {\n    if (ref) visitedRefs.delete(ref);\n  }\n};\n\nconst buildResolvedStatements = ({\n  schema,\n  ref,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  writeAccessor,\n  mode,\n  mapSuppressed,\n}: {\n  schema: OpenApiSchemaObject;\n  ref?: string;\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  writeAccessor?: string;\n  mode: DateTransformMode;\n  mapSuppressed?: boolean;\n}): BuildResult => {\n  if (isBooleanJsonSchema(schema)) return emptyResult();\n\n  let result: BuildResult;\n  // An ancestor allOf branch declaring `properties` makes a map loop unsafe\n  // at every branch of the composition, including one — like this schema —\n  // that has no properties/allOf of its own to show that on its own account\n  // (the \"idiomatic spelling\" bypass: `allOf: [Base, { additionalProperties }]`,\n  // where Base is a *sibling* array element, invisible to `mapValueSchema`\n  // when it only looks at the schema it's given). Recomputing it here (rather\n  // than only trusting the inherited flag) also makes this schema's own\n  // `allOf` branches (nested one level deeper) covered without relying on\n  // `mapValueSchema`'s own narrower check.\n  const mapSuppressedHere =\n    mapSuppressed || declaresProperties(schema, context);\n  const mapValue = mapSuppressedHere\n    ? undefined\n    : mapValueSchema(schema, context);\n\n  if (mode.isLeaf(schema)) {\n    result = {\n      statements: [mode.leafStatement(accessor, writeAccessor ?? accessor)],\n      cyclicRefs: new Set(),\n    };\n  } else if (\n    isArrayShaped(schema, context) &&\n    ((mode.dropArrayObjectConflict && needsObjectCopy(schema, context)) ||\n      mapValue != null)\n  ) {\n    // An array-shaped schema (`items`, directly or through `allOf`) that is\n    // also object-shaped cannot be walked as both, so it emits nothing:\n    // - with `properties`, only the request direction drops it — its copy\n    //   would spread the value as an object and then reassign it via `.map()`\n    //   (a runtime TypeError, or a `const` reassignment at the body root),\n    //   whereas the response walk's in-place loops merely coexist;\n    // - with a map-valued `additionalProperties`, both directions drop it —\n    //   an index-based loop and a key-based loop over the same value cannot\n    //   be combined, and the request copy would turn the array into a plain\n    //   object at runtime.\n    // `needsObjectCopy` is coarse on purpose (see its own docstring), so an\n    // array-shaped schema carrying a sibling `oneOf`/`anyOf`/`discriminator`\n    // that itself ends up emitting nothing still trips this drop in the\n    // request direction — an exotic spelling, and no worse than the\n    // pre-existing `schema.discriminator` arm already being just as coarse.\n    result = emptyResult();\n  } else {\n    // allOf, items and properties are siblings in JSON Schema, not\n    // mutually-exclusive branches — a schema can combine `allOf` with its\n    // own `properties` (or, less commonly, `items`), and every one of them\n    // must contribute its date statements.\n    const allOfResults = (schema.allOf ?? []).map((branch: SchemaOrRef) =>\n      buildStatements({\n        schema: branch,\n        accessor,\n        context,\n        visitedRefs,\n        depth,\n        writeAccessor,\n        mode,\n        mapSuppressed: mapSuppressedHere,\n      }),\n    );\n\n    const unionResult = buildUnionStatements({\n      schema,\n      accessor,\n      context,\n      visitedRefs,\n      depth,\n      mode,\n    });\n\n    const itemsResult = schema.items\n      ? mode.arrayStatements({\n          items: schema.items,\n          accessor,\n          context,\n          visitedRefs,\n          depth,\n          mode,\n        })\n      : emptyResult();\n\n    const mapResult = mapValue\n      ? mode.mapStatements({\n          values: mapValue,\n          accessor,\n          context,\n          visitedRefs,\n          depth,\n          mode,\n        })\n      : emptyResult();\n\n    const propertiesResult = schema.properties\n      ? buildPropertiesStatements({\n          properties: schema.properties,\n          required: schema.required,\n          accessor,\n          context,\n          visitedRefs,\n          depth,\n          mode,\n        })\n      : emptyResult();\n\n    result = mergeResults([\n      ...allOfResults,\n      unionResult,\n      itemsResult,\n      mapResult,\n      propertiesResult,\n    ]);\n  }\n\n  if (ref) {\n    if (result.cyclicRefs.has(ref)) {\n      // Recursive schema. Converting only the levels reached before the cycle\n      // closes would leave deeper dates as strings while the generated types\n      // claim `Date`, so emit nothing for the whole subtree instead. Sibling\n      // (non-recursive) fields are unaffected.\n      const cyclicRefs = new Set(result.cyclicRefs);\n      cyclicRefs.delete(ref);\n      result = { statements: [], cyclicRefs };\n    }\n  }\n\n  return result;\n};\n\n/**\n * True when the subtree assigns to the accessor itself (a date, possibly\n * wrapped in `allOf` or a nullable union) rather than into its properties or\n * elements.\n *\n * Callers: the response direction's in-place array and map builders, where\n * such elements must be written back through the array or map slot (a\n * hoisted `const` would make the generated assignment reassign a const); and\n * the shared property builder (both directions), where it distinguishes a\n * required date leaf (unguarded — a response's `new Date(undefined)` degrades\n * to `Invalid Date` rather than throwing, and a request's\n * `x instanceof Date ? … : x` already tolerates `undefined`) from a required\n * container (object copy or shallow mutation, array `.map` or in-place loop,\n * map copy or key loop, or union dispatch), which must be null-guarded in\n * both directions so an omitted container isn't turned into `{}`, thrown on,\n * or dereferenced before the caller can handle it. Every use asks the same\n * question — \"does this write straight to the accessor, or into something\n * reached through it?\" — regardless of which formats a given direction\n * converts, so it checks `isDateSchema` directly rather than taking a `mode`\n * parameter.\n */\nconst writesToAccessorItself = (\n  schemaOrRef: SchemaOrRef,\n  context: ContextSpec,\n  seenRefs: Set<string> = new Set(),\n): boolean => {\n  const { schema, ref } = normalizeSchema(schemaOrRef, context);\n  if (ref) {\n    if (seenRefs.has(ref)) return false;\n    seenRefs.add(ref);\n  }\n  if (isDateSchema(schema)) return true;\n  return (schema.allOf ?? []).some((branch: SchemaOrRef) =>\n    writesToAccessorItself(branch, context, seenRefs),\n  );\n};\n\n/**\n * Responses and requests walk the same schema: ref resolution, cycle guards,\n * `allOf` merging, property iteration and discriminated-union dispatch are\n * identical in both directions. They differ in which formats convert, what a\n * leaf converts to, and how containers are traversed — a response mutates the\n * payload it just parsed, a request must copy what it touches because the\n * object belongs to the caller.\n */\ninterface DateTransformMode {\n  /** Schemas this direction converts. */\n  isLeaf: (schema: OpenApiSchemaObject) => boolean;\n  /** Conversion statement. `write` differs from `read` only for readOnly props. */\n  leafStatement: (read: string, write: string) => string;\n  /**\n   * Statements emitted once per property whose subtree produced statements,\n   * immediately before those statements. Never invoked for the root\n   * accessor (the caller's own copy is handled outside this walk), for\n   * array elements (handled by `arrayStatements`), or for discriminated-\n   * union variants (covered by the parent property's own prelude).\n   */\n  objectPrelude: (\n    accessor: string,\n    schema: SchemaOrRef,\n    context: ContextSpec,\n  ) => string[];\n  /** Traversal of an array container. */\n  arrayStatements: (params: ArrayStatementsParams) => BuildResult;\n  /** Traversal of an `additionalProperties` map container. */\n  mapStatements: (params: MapStatementsParams) => BuildResult;\n  /** Assignment target for a property when it differs from the read accessor. */\n  propertyWriteAccessor: (\n    accessor: string,\n    key: string,\n    propertySchema: OpenApiSchemaObject,\n  ) => string | undefined;\n  /**\n   * Properties this direction must not touch. The two directions disagree on\n   * purpose: a response is the server's own payload, so a `readOnly`\n   * property is exactly the kind of field it must convert (through its\n   * mutable cast); a request body is written by the client, and OpenAPI\n   * `readOnly` means the field is server-populated and response-only, so\n   * writing it into a request is semantically wrong, not merely untypeable.\n   */\n  skipProperty: (schema: OpenApiSchemaObject) => boolean;\n  /**\n   * When true, a schema that is both array-shaped (`items`) and\n   * object-shaped (own `properties`, a discriminator, or an `allOf` branch\n   * that is either) emits no statements at all, rather than combining an\n   * array walk with an object walk. The response direction can freely\n   * combine the two — `items` becomes a for-loop over the array in place and\n   * `properties` becomes plain field writes, and neither touches the\n   * other's code. The request direction cannot: it reassigns the container\n   * itself to build the transformed array (`copy = copy.map(...)`), which\n   * cannot also be the object the object branch shallow-copies and writes\n   * into. Emitting both breaks compilation at the root (`copy` is declared\n   * `const`) and crashes at runtime when nested under a property (an array\n   * spread into `{ ...copy.x }`, then `.map` called on the result). Emitting\n   * nothing instead follows the same rule already applied to recursive\n   * schemas: emit nothing rather than wrong code.\n   */\n  dropArrayObjectConflict: boolean;\n}\n\ninterface ArrayStatementsParams {\n  items: SchemaOrRef;\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  mode: DateTransformMode;\n}\n\ninterface MapStatementsParams {\n  /** The `additionalProperties` value schema. */\n  values: SchemaOrRef;\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  mode: DateTransformMode;\n}\n\nconst buildInPlaceItemsStatements = ({\n  items,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  mode,\n}: ArrayStatementsParams): BuildResult => {\n  const index = `i${depth}`;\n  const { nullable } = normalizeSchema(items, context);\n  const loopHeader = `for (let ${index} = 0; ${index} < ${accessor}.length; ${index}++) {`;\n\n  if (writesToAccessorItself(items, context)) {\n    const element = `${accessor}[${index}]`;\n    const inner = buildStatements({\n      schema: items,\n      // The loop bound keeps the index in range, so the read is asserted\n      // non-null for `noUncheckedIndexedAccess`; the write stays unasserted.\n      accessor: `${element}!`,\n      writeAccessor: element,\n      context,\n      visitedRefs,\n      depth: depth + 1,\n      mode,\n    });\n    if (inner.statements.length === 0) return inner;\n\n    const body = nullable\n      ? [`if (${element} != null) {`, ...indent(inner.statements), '}']\n      : inner.statements;\n\n    return {\n      statements: [loopHeader, ...indent(body), '}'],\n      cyclicRefs: inner.cyclicRefs,\n    };\n  }\n\n  // Object/array elements are hoisted into a const: TypeScript does not\n  // carry `!= null` narrowing across statements for variable-indexed\n  // accesses (`data[i0].at`), but does for a hoisted local. Mutating the\n  // local's properties mutates the same object, so in-place semantics\n  // are unchanged.\n  const item = `item${depth}`;\n  const inner = buildStatements({\n    schema: items,\n    accessor: item,\n    context,\n    visitedRefs,\n    depth: depth + 1,\n    mode,\n  });\n  if (inner.statements.length === 0) return inner;\n\n  const body = nullable\n    ? [`if (${item} != null) {`, ...indent(inner.statements), '}']\n    : inner.statements;\n\n  return {\n    statements: [\n      loopHeader,\n      `  const ${item} = ${accessor}[${index}]!;`,\n      ...indent(body),\n      '}',\n    ],\n    cyclicRefs: inner.cyclicRefs,\n  };\n};\n\n/**\n * The response direction's map traversal: an in-place `for...of` loop over\n * `Object.keys(accessor)`, mirroring `buildInPlaceItemsStatements` with a\n * key lookup in place of an index. A value that writes to the accessor\n * itself (a date leaf, or an `allOf`-wrapped one) is written back through\n * the key slot directly; anything else is hoisted into a `const` so\n * `!= null` narrowing survives, exactly as the array builder hoists an\n * object element.\n */\nconst buildInPlaceMapStatements = ({\n  values,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  mode,\n}: MapStatementsParams): BuildResult => {\n  const key = `key${depth}`;\n  const { nullable } = normalizeSchema(values, context);\n  const loopHeader = `for (const ${key} of Object.keys(${accessor})) {`;\n\n  if (writesToAccessorItself(values, context)) {\n    const element = `${accessor}[${key}]`;\n    const inner = buildStatements({\n      schema: values,\n      // `key` comes from `Object.keys`, so the read is asserted non-null for\n      // `noUncheckedIndexedAccess`; the write stays unasserted.\n      accessor: `${element}!`,\n      writeAccessor: element,\n      context,\n      visitedRefs,\n      depth: depth + 1,\n      mode,\n    });\n    if (inner.statements.length === 0) return inner;\n\n    const body = nullable\n      ? [`if (${element} != null) {`, ...indent(inner.statements), '}']\n      : inner.statements;\n\n    return {\n      statements: [loopHeader, ...indent(body), '}'],\n      cyclicRefs: inner.cyclicRefs,\n    };\n  }\n\n  const item = `item${depth}`;\n  const inner = buildStatements({\n    schema: values,\n    accessor: item,\n    context,\n    visitedRefs,\n    depth: depth + 1,\n    mode,\n  });\n  if (inner.statements.length === 0) return inner;\n\n  const body = nullable\n    ? [`if (${item} != null) {`, ...indent(inner.statements), '}']\n    : inner.statements;\n\n  return {\n    statements: [\n      loopHeader,\n      `  const ${item} = ${accessor}[${key}]!;`,\n      ...indent(body),\n      '}',\n    ],\n    cyclicRefs: inner.cyclicRefs,\n  };\n};\n\nconst responseMode: DateTransformMode = {\n  isLeaf: isDateSchema,\n  leafStatement: (read, write) => `${write} = new Date(${read});`,\n  objectPrelude: () => [],\n  arrayStatements: buildInPlaceItemsStatements,\n  mapStatements: buildInPlaceMapStatements,\n  propertyWriteAccessor: (accessor, key, propertySchema) =>\n    !isBooleanJsonSchema(propertySchema) && propertySchema.readOnly\n      ? propertyAccessor(mutableCast(accessor), key)\n      : undefined,\n  skipProperty: () => false,\n  dropArrayObjectConflict: false,\n};\n\nconst buildPropertiesStatements = ({\n  properties,\n  required,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  mode,\n  presenceGuarded,\n}: {\n  properties: Record<string, SchemaOrRef>;\n  required: string[] | undefined;\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  mode: DateTransformMode;\n  /**\n   * Set when the accessor is typed as a whole undiscriminated union, so each\n   * property must first narrow it with `'key' in accessor` (see the guard\n   * below).\n   */\n  presenceGuarded?: boolean;\n}): BuildResult => {\n  const requiredSet = new Set(required ?? []);\n  return mergeResults(\n    Object.entries(properties).map(([key, property]) => {\n      const target = propertyAccessor(accessor, key);\n      const { schema: propertySchema, nullable } = normalizeSchema(\n        property,\n        context,\n      );\n      if (mode.skipProperty(propertySchema)) return emptyResult();\n\n      const inner = buildStatements({\n        schema: property,\n        accessor: target,\n        context,\n        visitedRefs,\n        depth,\n        writeAccessor: mode.propertyWriteAccessor(\n          accessor,\n          key,\n          propertySchema,\n        ),\n        mode,\n      });\n      if (inner.statements.length === 0) return inner;\n\n      const statements = [\n        ...mode.objectPrelude(target, property, context),\n        ...inner.statements,\n      ];\n\n      // Under an undiscriminated union the accessor's type is the whole\n      // union, so a property only some variants declare cannot be read\n      // without narrowing first. `'key' in accessor` is what narrows it,\n      // and it is needed even for a required, non-nullable leaf — required\n      // in one variant says nothing about the others.\n      const needsGuard =\n        presenceGuarded ||\n        !requiredSet.has(key) ||\n        nullable ||\n        !writesToAccessorItself(property, context);\n      if (!needsGuard) return { ...inner, statements };\n\n      const condition = presenceGuarded\n        ? `${JSON.stringify(key)} in ${accessor} && ${target} != null`\n        : `${target} != null`;\n\n      return {\n        statements: [`if (${condition}) {`, ...indent(statements), '}'],\n        cyclicRefs: inner.cyclicRefs,\n      };\n    }),\n  );\n};\n\n/**\n * Emits a `switch` on the discriminator property for a `oneOf`/`anyOf` that\n * carries an OpenAPI `discriminator` with an explicit `mapping`.\n */\nconst buildMappedUnionStatements = ({\n  schema,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  mode,\n}: {\n  schema: OpenApiSchemaObject;\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  mode: DateTransformMode;\n}): BuildResult => {\n  if (isBooleanJsonSchema(schema)) return emptyResult();\n\n  const variants = schema.oneOf ?? schema.anyOf;\n  const discriminator = schema.discriminator as\n    | { propertyName?: unknown; mapping?: Record<string, unknown> }\n    | undefined;\n  const propertyName = discriminator?.propertyName;\n  const mapping = discriminator?.mapping;\n  if (\n    !variants ||\n    typeof propertyName !== 'string' ||\n    !mapping ||\n    typeof mapping !== 'object'\n  ) {\n    return emptyResult();\n  }\n\n  const caseResults = Object.entries(mapping).map(\n    ([value, target]): BuildResult => {\n      let inner: BuildResult;\n      try {\n        inner = buildStatements({\n          schema: {\n            $ref: discriminatorMappingRef(target as string),\n          } as OpenApiReferenceObject,\n          accessor,\n          context,\n          visitedRefs,\n          depth,\n          mode,\n          // A variant is resolved against the SAME accessor as the switch\n          // itself, not a fresh one — that accessor is guaranteed at runtime\n          // to carry the discriminator property, exactly like an `allOf`\n          // branch shares its parent's accessor. A variant that is a bare\n          // map (`additionalProperties`, no `properties` of its own) must\n          // not get a blind `Object.keys` loop over that level: it would\n          // revisit, and on the response side overwrite, the discriminator\n          // key the switch just read.\n          mapSuppressed: true,\n        });\n      } catch {\n        // An unresolvable mapping target must not abort generation of the\n        // whole spec; skip the case and leave that variant unconverted.\n        return emptyResult();\n      }\n      if (inner.statements.length === 0) return inner;\n\n      return {\n        statements: [\n          `case ${JSON.stringify(value)}: {`,\n          ...indent(inner.statements),\n          '  break;',\n          '}',\n        ],\n        cyclicRefs: inner.cyclicRefs,\n      };\n    },\n  );\n\n  const merged = mergeResults(caseResults);\n  if (merged.statements.length === 0) return merged;\n\n  return {\n    statements: [\n      `switch (${propertyAccessor(accessor, propertyName)}) {`,\n      ...indent(merged.statements),\n      '}',\n    ],\n    cyclicRefs: merged.cyclicRefs,\n  };\n};\n\n/**\n * A union's variant must declare its own `properties` for the structural\n * walk: it reads properties off the union accessor, which an array or\n * scalar variant has none of, and an `allOf` variant's inherited properties\n * are never merged into `.properties` by the key-collection step below. An\n * `allOf` variant admitted here would therefore be silently under-converted:\n * its inherited properties contribute no keys at all, so a plain string\n * re-declared at this level could get converted while a real nested date is\n * never reached. Requiring own `properties` disqualifies the whole union\n * instead, which is exactly today's (pre-structural-walk) behaviour for a\n * union with an `allOf` variant, so this is not a regression.\n *\n * `items` (or `type: 'array'`) is checked first and disqualifies the variant\n * outright, even when it also declares `properties`: `needsObjectCopy`\n * treats any union as needing a shallow-object copy, and a hybrid\n * array-and-object variant spread as `{ ...value }` in the request direction\n * would silently drop its array-ness at runtime.\n *\n * A `type: 'null'` variant does reach here — whenever the union has more\n * than one non-null variant, `normalizeSchema` does not collapse it (that\n * collapse only applies to the single-non-null-variant `T | null` spelling)\n * — and it's correctly rejected too, since a null schema declares no\n * properties of its own.\n */\nconst isObjectVariant = (schema: OpenApiNonBooleanSchemaObject): boolean => {\n  if (schema.items || schema.type === 'array') return false;\n  return hasOwnProperties(schema);\n};\n\n/**\n * How a variant was judged *before* any variant of the union was walked.\n * Only a `walkable` variant is resolvable and not already being expanded by\n * an ancestor; `objectShaped` says whether it also qualifies the union for\n * the structural walk, and a variant that fails it is still walked (for what\n * it can teach about cycles) while disqualifying the union's statements.\n */\ntype ClassifiedVariant =\n  | {\n      kind: 'walkable';\n      schema: OpenApiNonBooleanSchemaObject;\n      ref?: string;\n      objectShaped: boolean;\n    }\n  | { kind: 'unresolvable' }\n  | { kind: 'cyclic'; ref: string };\n\n/**\n * Judges one variant without walking it.\n *\n * Asking `visitedRefs` here, before the walk, reads the same answer the walk\n * would: no variant's ref is registered during classification, and the walk\n * registers a variant's ref only for the duration of that one variant\n * (released in a `finally` before the next), so no variant can hide a\n * sibling's ref from another.\n */\nconst classifyUnionVariant = (\n  variant: SchemaOrRef,\n  context: ContextSpec,\n  visitedRefs: Set<string>,\n): ClassifiedVariant => {\n  let variantSchema: OpenApiNonBooleanSchemaObject;\n  let ref: string | undefined;\n  try {\n    ({ schema: variantSchema, ref } = normalizeSchema(variant, context));\n  } catch {\n    // An unresolvable $ref target: not a cycle, just a broken variant.\n    return { kind: 'unresolvable' };\n  }\n\n  if (ref && visitedRefs.has(ref)) return { kind: 'cyclic', ref };\n\n  return {\n    kind: 'walkable',\n    schema: variantSchema,\n    ref,\n    objectShaped: isObjectVariant(variantSchema),\n  };\n};\n\n/**\n * Walks a variant for the sole purpose of learning which refs it sees close\n * a cycle, and throws its statements away.\n *\n * The structural walk reads a variant's `properties` and nothing else, so a\n * cycle reachable only through the parts it ignores — most concretely a\n * disqualifying variant's `items` — is invisible to it, while the\n * discriminated spelling of the same schema, which resolves every variant\n * through `buildStatements`, finds it and drops the whole subtree. Running\n * that very call (with the same `mapSuppressed: true` the mapped path\n * passes, so the two also agree about a bare-map variant, whose values\n * neither of them walks) and keeping only its `cyclicRefs` leaves \"is this\n * schema recursive?\" answered identically in both spellings, whatever each\n * then chooses to convert.\n *\n * ## Two callers, with different stakes\n *\n * The first caller is a union that is *already disqualified* and so emits no\n * statements of its own. There, nothing learned can change what that union\n * converts — it converts nothing either way — and the refs only travel\n * upwards, where at most they make a recursive ancestor drop its subtree,\n * which is this file's standing rule.\n *\n * The second caller is an *admitted* variant of a *qualified* union, walked\n * for the branches the per-property walk never reads (`hasUnwalkedBranches`:\n * an `allOf`, or a nested union beside the variant's own `properties`).\n * There what is learned very much does change what converts: the returned\n * refs become that variant's `branchRefs`, and `branchRefs.has(variantRef)`\n * is half of the variant's own cycle-closing check — a hit wipes every\n * statement the variant contributed. The statements this function throws\n * away are still never emitted; it is the *refs* that carry weight on that\n * path.\n *\n * A throw — an unresolvable `$ref` nested somewhere inside the variant —\n * yields an empty set, so the caller proceeds as if the walk found no cycle.\n * `buildStatements` restores `visitedRefs` through its own `finally` before\n * the throw gets here, so the caller's bookkeeping is intact either way.\n * That choice matches how the rest of the file treats a broken corner of a\n * spec — `buildMappedUnionStatements` around a mapping target,\n * `classifyUnionVariant` around a variant's own `$ref` — rather than turning\n * it into a failed generation of the whole document. It is not free on the\n * second caller: a cycle reachable only *past* the unresolvable ref goes\n * unreported, and the variant keeps converting its own properties. It is the\n * same trade the other two catches already make, over a spec that cannot be\n * resolved as written.\n */\nconst discoverVariantCycles = ({\n  variant,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  mode,\n}: {\n  variant: SchemaOrRef;\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  mode: DateTransformMode;\n}): Set<string> => {\n  try {\n    return buildStatements({\n      schema: variant,\n      accessor,\n      context,\n      visitedRefs,\n      depth,\n      mode,\n      mapSuppressed: true,\n    }).cyclicRefs;\n  } catch {\n    return new Set<string>();\n  }\n};\n\n/**\n * True when an admitted variant carries branches the per-property walk does\n * not read, and which therefore have to be walked separately for what they\n * can say about cycles: an `allOf`, or a `oneOf`/`anyOf` sitting beside the\n * variant's own `properties`.\n *\n * Two shapes are deliberately absent. `items` never reaches here — it\n * disqualifies the variant outright, and a disqualified union already takes\n * the statement-free walk. And `additionalProperties` beside `properties` is\n * suppressed for *every* path in this file by Rule 1 (`mapValueSchema`\n * returns nothing for a properties-declaring schema), the mapped spelling\n * included: a cycle hiding under such a map is invisible to both spellings,\n * which agree by converting the variant's declared properties and leaving\n * the map's values alone, cycle or no cycle. Walking it here would make this\n * spelling alone drop the schema — a disagreement where there is currently\n * none, over a branch neither spelling ever converts.\n */\nconst hasUnwalkedBranches = (schema: OpenApiNonBooleanSchemaObject): boolean =>\n  (schema.allOf ?? []).length > 0 ||\n  schema.oneOf != null ||\n  schema.anyOf != null;\n\n/**\n * Walks a union that carries no usable `discriminator.mapping` by property\n * presence instead of by discriminator value.\n *\n * For each property name any variant declares, the shared property builder\n * runs once per variant declaring it, against the same accessor, and the\n * resulting statements are compared. Identical statements mean the variants\n * agree on what that property is, so one block is emitted, guarded by\n * `'key' in accessor` — which is also what lets TypeScript narrow the union\n * so the generated assignment type-checks. Statements that differ mean the\n * variants disagree (a scalar against an array, an object against a string,\n * or any nested divergence that changes what gets emitted), and that\n * property is skipped while the rest of the union still converts. Comparing\n * generated statements rather than schemas makes the check semantic: two\n * spellings of the same shape agree, and no schema comparator has to exist.\n *\n * ## Two passes, and why they cannot be one\n *\n * Every variant is classified before any variant is walked, and then every\n * classification that *can* be walked is walked — including the ones that\n * already disqualified the union. Only afterwards is it decided whether the\n * collected statements are emitted at all.\n *\n * Deciding and walking in a single interleaved pass would make the union's\n * answer depend on the order the spec happens to list its variants in: a\n * disqualifying variant (unresolvable, not object-shaped, or one an ancestor\n * is already expanding) would abandon the loop, so a cycle reachable only\n * through a *later* variant would never be discovered, and an ancestor\n * holding the cyclic ref would convert its own levels while everything under\n * the union silently stayed a string. The discriminated spelling of that same\n * schema walks every mapping target regardless, finds the cycle and drops the\n * whole subtree — so the two spellings would disagree on whether a schema is\n * safe to convert. Splitting classification from walking is what makes the\n * two passes independent of variant order.\n *\n * ## What each variant contributes\n *\n * Three classifications disqualify the union's *statements* — an\n * unresolvable `$ref` target (the whole spec's generation must not abort\n * over one bad variant, mirroring `buildMappedUnionStatements`'s own\n * try/catch around a mapping target), a variant that is not object-shaped,\n * and a variant whose ref an ancestor is already expanding. None of the\n * three excuses discarding what the *other* variants learned: every\n * `cyclicRefs` collected by any variant is merged into the union's result\n * whatever becomes of its statements, because a cycle is no less real for\n * having been found beside a variant that disqualified the union.\n *\n * A ref that is already registered when a variant is classified can only be\n * an ancestor cycle (this same union nested inside a schema one of its own\n * variants refers back to, directly or transitively) — a *sibling* variant's\n * ref (`anyOf: [Cat, Dog]` where `Cat.pal: { $ref: Dog }`) is never\n * registered while a different variant is being walked, so referring to a\n * sibling is ordinary, not cyclic. It is reported the way every other\n * recursive shape in this file reports one, `cyclicRefs: new Set([ref])`,\n * and that ref is *added* to what propagates rather than consumed here: the\n * ancestor that registered it is the one that closes the cycle and drops its\n * subtree.\n *\n * A cycle can also surface without ever hitting that check — not at a\n * variant's own ref, but deeper inside one of its properties (a variant\n * referring to a *different* schema that itself, transitively, refers back\n * to an ancestor, or back to this same variant through another path). Two\n * things make that case work, mirroring what\n * `buildStatements`/`buildResolvedStatements` already do for every non-union\n * shape:\n *\n * - Every declaring variant's `cyclicRefs` for a key are always merged into\n *   that key's result, even when the property contributes no statements or\n *   the variants disagree — dropping them there would silently swallow a\n *   cycle detected below a variant rather than at its own ref, leaving an\n *   ancestor with no way to learn its own subtree needs to close.\n * - After a variant's own properties are all walked, if its *own* ref shows\n *   back up among the `cyclicRefs` they collected, the cycle closes right\n *   here — the same `if (result.cyclicRefs.has(ref))` check\n *   `buildResolvedStatements` runs for every ref-reached schema, just run by\n *   hand here since a union manages its variants' ref bookkeeping itself\n *   rather than going through `buildStatements`. That variant's contribution\n *   is wiped (its subtree is exactly as internally inconsistent as any other\n *   recursive schema reaching this point) and its own ref is removed from\n *   what propagates further, while any other refs survive.\n */\nconst buildUndiscriminatedUnionStatements = ({\n  schema,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  mode,\n}: {\n  schema: OpenApiNonBooleanSchemaObject;\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  mode: DateTransformMode;\n}): BuildResult => {\n  const variants = schema.oneOf ?? schema.anyOf;\n  if (!variants || variants.length === 0) return emptyResult();\n\n  // Pass 1: judge every variant, walk none of them.\n  const classified = variants.map((variant: SchemaOrRef) =>\n    classifyUnionVariant(variant, context, visitedRefs),\n  );\n\n  const disqualified = classified.some(\n    (variant: ClassifiedVariant) =>\n      variant.kind !== 'walkable' || !variant.objectShaped,\n  );\n\n  // Pass 2: walk everything that can be walked, disqualified or not — a\n  // variant that cannot contribute statements can still be the only place a\n  // cycle is visible from, and that is exactly what the ancestor above needs\n  // to hear about. A disqualified union walks its variants only for that:\n  // it emits nothing either way, so it takes the wider, statement-free walk\n  // (`discoverVariantCycles`) instead of the property-by-property one.\n  const perVariant: {\n    schema: OpenApiNonBooleanSchemaObject;\n    perKey: Map<string, BuildResult>;\n    /** Refs seen only in branches this walk reads for cycles, never converts. */\n    branchRefs: Set<string>;\n  }[] = [];\n  const discoveredRefs = new Set<string>();\n\n  for (const [index, variant] of classified.entries()) {\n    if (variant.kind !== 'walkable') continue;\n\n    if (disqualified) {\n      for (const cyclicRef of discoverVariantCycles({\n        variant: variants[index],\n        accessor,\n        context,\n        visitedRefs,\n        depth,\n        mode,\n      })) {\n        discoveredRefs.add(cyclicRef);\n      }\n      continue;\n    }\n\n    const { schema: variantSchema, ref } = variant;\n\n    if (ref) visitedRefs.add(ref);\n    try {\n      const perKey = new Map<string, BuildResult>();\n      for (const key of Object.keys(variantSchema.properties ?? {})) {\n        perKey.set(\n          key,\n          buildPropertiesStatements({\n            properties: { [key]: (variantSchema.properties ?? {})[key] },\n            required: variantSchema.required,\n            accessor,\n            context,\n            visitedRefs,\n            depth,\n            mode,\n            presenceGuarded: true,\n          }),\n        );\n      }\n      // The walk above reads `variantSchema.properties` and nothing else, so\n      // a cycle reachable only through an `allOf` branch or a nested union\n      // beside them is invisible to it, while the mapped spelling of the\n      // same schema walks those branches, finds the cycle and drops the\n      // subtree. Walk them the way the mapped path walks a mapping target\n      // and keep only the refs: detect without converting. No statement\n      // from those branches is emitted, so nothing new converts and the\n      // ruling that an `allOf` variant's properties are not merged stands —\n      // the union simply stops converting when a cycle is reachable through\n      // a branch it is not allowed to convert, and keeps converting its own\n      // properties when there is none.\n      let branchRefs = hasUnwalkedBranches(variantSchema)\n        ? discoverVariantCycles({\n            variant: variantSchema,\n            accessor,\n            context,\n            visitedRefs,\n            depth,\n            mode,\n          })\n        : new Set<string>();\n\n      // Mirror buildResolvedStatements's own cycle-closing check\n      // (`if (result.cyclicRefs.has(ref))`), by hand, per variant: if this\n      // variant's own ref shows back up among the cyclicRefs its own\n      // properties or its unwalked branches collected — directly, or\n      // transitively through some other schema that refers back to it — the\n      // cycle closes exactly here. The variant is as internally\n      // inconsistent as any other recursive schema reaching this point, so\n      // it contributes nothing, and its own ref is consumed rather than\n      // propagated further (other refs, if any, are left untouched).\n      if (ref) {\n        const variantRef = ref;\n        const closesHere =\n          branchRefs.has(variantRef) ||\n          [...perKey.values()].some((result) =>\n            result.cyclicRefs.has(variantRef),\n          );\n        if (closesHere) {\n          for (const [key, result] of perKey) {\n            const cyclicRefs = new Set(result.cyclicRefs);\n            cyclicRefs.delete(variantRef);\n            perKey.set(key, { statements: [], cyclicRefs });\n          }\n          branchRefs = new Set(branchRefs);\n          branchRefs.delete(variantRef);\n        }\n      }\n\n      perVariant.push({ schema: variantSchema, perKey, branchRefs });\n    } finally {\n      // Release this variant's ref before moving on to the next one, so a\n      // sibling variant's own (unrelated) reference to it is never mistaken\n      // for a cycle.\n      if (ref) visitedRefs.delete(ref);\n    }\n  }\n\n  // Everything the two passes learned about cycles, whatever becomes of the\n  // statements below: the refs an ancestor is already expanding (added to,\n  // never consumed here — the ancestor that registered one is the one that\n  // closes it), every ref a disqualified union's statement-free walk\n  // uncovered, and, for each walked variant, every ref that survived its\n  // cycle-closing check — from its properties and from the branches read\n  // for cycles alone.\n  const learned: BuildResult = {\n    statements: [],\n    cyclicRefs: new Set<string>([\n      ...classified.flatMap((variant: ClassifiedVariant) =>\n        variant.kind === 'cyclic' ? [variant.ref] : [],\n      ),\n      ...discoveredRefs,\n      ...perVariant.flatMap(({ perKey, branchRefs }) => [\n        ...branchRefs,\n        ...[...perKey.values()].flatMap((result) => [...result.cyclicRefs]),\n      ]),\n    ]),\n  };\n\n  if (disqualified) return learned;\n\n  // Property order follows the spec's own declaration order: each variant's\n  // own properties, in the order the variants themselves appear in the\n  // `oneOf`/`anyOf` array.\n  //\n  // A property named after an `Object.prototype` member (`constructor`,\n  // `toString`, `valueOf`, `hasOwnProperty`, `__proto__`, …) is dropped\n  // outright. The emitted guard has to be `'key' in accessor` — that is the\n  // only form TypeScript narrows the union by, and `Object.hasOwn`, which\n  // would answer correctly at runtime, narrows nothing — but `in` walks the\n  // prototype chain, so `'constructor' in payload` is true for every object\n  // alive. Emitting a block for such a key would run the conversion on a\n  // payload of a variant that never declared it and overwrite the inherited\n  // member with `Invalid Date`. There is no guard that both narrows and\n  // tells the truth here, so the union converts nothing for that name and\n  // every other property still converts.\n  const keys: string[] = [];\n  for (const { schema: variantSchema } of perVariant) {\n    for (const key of Object.keys(variantSchema.properties ?? {})) {\n      if (Object.hasOwn(Object.prototype, key)) continue;\n      if (!keys.includes(key)) keys.push(key);\n    }\n  }\n\n  const results = keys.map((key): BuildResult => {\n    // Which variants declared this key is read from `perKey` itself, never\n    // re-derived from `variantSchema.properties[key]`: that lookup walks the\n    // prototype chain, so for an `Object.prototype`-named key a variant that\n    // never declared it would answer as though it had, and `perKey` — keyed\n    // by `Object.keys`, own keys only — would then hand back `undefined`.\n    // One source of truth, and no unsound non-null assertion.\n    const declaringResults = perVariant.flatMap(({ perKey }) => {\n      const result = perKey.get(key);\n      return result ? [result] : [];\n    });\n\n    // Every declaring variant's cyclicRefs propagate regardless of whether\n    // this property ends up converting: a cycle detected below a variant's\n    // own ref (rather than at it) must still reach whatever ancestor is\n    // holding that ref, even when this property contributes no statements\n    // or the variants disagree on it.\n    const cyclicRefs = new Set(\n      declaringResults.flatMap((result) => [...result.cyclicRefs]),\n    );\n\n    const [first, ...rest] = declaringResults;\n    // oxlint-disable-next-line typescript/no-unnecessary-condition\n    if (!first || first.statements.length === 0) {\n      return { statements: [], cyclicRefs };\n    }\n    const agreed = rest.every(\n      (result: BuildResult) =>\n        result.statements.join('\\n') === first.statements.join('\\n'),\n    );\n    return { statements: agreed ? first.statements : [], cyclicRefs };\n  });\n\n  // `learned` is required on this exit, not merely symmetrical with the\n  // disqualified one. `results` is built from `perKey` alone, so the refs a\n  // variant's unwalked branches uncovered (`branchRefs`) reach the caller\n  // through `learned` and through nothing else — as do the refs of a key\n  // dropped above for being named after an `Object.prototype` member.\n  // Returning `results` by itself would hide a recursive schema from the\n  // ancestor holding its ref, which would then convert its own levels while\n  // this subtree stayed a string: exactly the partial conversion the\n  // two-pass walk exists to prevent.\n  return mergeResults([learned, ...results]);\n};\n\n/**\n * Emits the statements for a `oneOf`/`anyOf`. With an explicit\n * `discriminator.mapping` the variant is known from the discriminator value,\n * so a `switch` dispatches precisely; without one, the variants are walked\n * structurally by property presence. A union that carries a `discriminator`\n * but no `mapping` takes the structural path too — the mapping is what the\n * `switch` needs, not the property name.\n */\nconst buildUnionStatements = (params: {\n  schema: OpenApiNonBooleanSchemaObject;\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs: Set<string>;\n  depth: number;\n  mode: DateTransformMode;\n}): BuildResult =>\n  params.schema.discriminator?.propertyName &&\n  // oxlint-disable-next-line typescript/no-unnecessary-condition\n  params.schema.discriminator?.mapping\n    ? buildMappedUnionStatements(params)\n    : buildUndiscriminatedUnionStatements(params);\n\nexport interface BuildDateTransformParams {\n  schema: SchemaOrRef;\n  /** Expression the statements mutate in place, e.g. `data.log` */\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs?: Set<string>;\n  /** Nesting level, used for unique loop index names (i0, i1, …) */\n  depth?: number;\n}\n\nexport const buildDateTransformStatements = ({\n  schema,\n  accessor,\n  context,\n  visitedRefs = new Set(),\n  depth = 0,\n}: BuildDateTransformParams): string[] =>\n  buildStatements({\n    schema,\n    accessor,\n    context,\n    visitedRefs,\n    depth,\n    mode: responseMode,\n  }).statements;\n\nconst isDateOnlySchema = (schema: OpenApiSchemaObject): boolean =>\n  !isBooleanJsonSchema(schema) && schema.format === 'date';\n\n/**\n * OpenAPI `format: date` is a calendar day, but JavaScript has no date-only\n * type and `Date.prototype.toJSON()` always renders an instant. The value is\n * read as its UTC calendar day, matching what the mock generator emits for the\n * same format (mock/src/faker/constants.ts).\n *\n * Guarded on `instanceof Date`: the same accessor can be reached twice (an\n * `allOf` branch re-declaring a property its base already declares, or a\n * discriminated-union variant re-declaring one its parent schema's own\n * `properties` also converts), and unlike the response leaf's `new Date(...)`\n * — a clone, harmless to repeat — this conversion produces a string. Running\n * it twice without the guard would call `.toISOString()` on that string and\n * throw at runtime. The guard makes a second pass a no-op instead.\n */\nconst serializeLeafStatement = (read: string, write: string): string =>\n  `${write} = ${read} instanceof Date ? (${read}.toISOString().slice(0, 10) as unknown as Date) : ${read};`;\n\n/**\n * True when the subtree writes into the accessor's own properties, so the\n * accessor must be shallow-copied before those writes. A bare array (`items`\n * with no sibling `properties`/`allOf` contributing any) is excluded: `.map`\n * already produces a new array, and spreading one would turn it into an\n * object. `items`, `properties` and `allOf` are siblings in JSON Schema (see\n * buildResolvedStatements), so `items` being present must not short-circuit\n * before `allOf` is checked — a schema combining the two still needs a copy\n * for whichever branch writes properties.\n *\n * A `oneOf`/`anyOf` counts too, mapped or not: a discriminated union's own\n * `switch` writes into the accessor's properties exactly like a plain\n * `properties` block does (hence `schema.discriminator` below), and the\n * structural walk (`buildUndiscriminatedUnionStatements`) does the same\n * for an undiscriminated one — it has no `properties` of its own for\n * `hasOwnProperties` to see, so without this it would go uncopied and the\n * generated request serializer would write straight into the caller's\n * object. This is deliberately coarse, matching the existing\n * `schema.discriminator` check: it doesn't ask whether the union actually\n * ends up emitting a write, only whether it structurally could, since a\n * copy nobody ends up needing is harmless where a missing one is a\n * mutation bug.\n */\nconst needsObjectCopy = (\n  schemaOrRef: SchemaOrRef,\n  context: ContextSpec,\n  seenRefs: Set<string> = new Set(),\n): boolean => {\n  const { schema, ref } = normalizeSchema(schemaOrRef, context);\n  if (ref) {\n    if (seenRefs.has(ref)) return false;\n    seenRefs.add(ref);\n  }\n  if (isDateOnlySchema(schema)) return false;\n  if (\n    hasOwnProperties(schema) ||\n    schema.discriminator ||\n    schema.oneOf ||\n    schema.anyOf\n  ) {\n    return true;\n  }\n  return (schema.allOf ?? []).some((branch: SchemaOrRef) =>\n    needsObjectCopy(branch, context, seenRefs),\n  );\n};\n\n/**\n * True when the schema is array-shaped — carries `items`, either directly or\n * through an `allOf` branch. Mirrors `needsObjectCopy`'s own `allOf`\n * recursion (and its `seenRefs` cycle guard) so the two predicates agree on\n * shape: `needsObjectCopy` already looks through `allOf` to find an object\n * shape, and the array/object conflict guard above must see an array shape\n * the same way, or a schema combining an array `allOf` branch with an object\n * `allOf` branch (rather than a sibling `items` and `properties`) slips past\n * the guard and emits both an array reassignment and an object-copy\n * property write, which crashes at runtime.\n */\nconst isArrayShaped = (\n  schemaOrRef: SchemaOrRef,\n  context: ContextSpec,\n  seenRefs: Set<string> = new Set(),\n): boolean => {\n  const { schema, ref } = normalizeSchema(schemaOrRef, context);\n  if (ref) {\n    if (seenRefs.has(ref)) return false;\n    seenRefs.add(ref);\n  }\n  if (schema.items) return true;\n  return (schema.allOf ?? []).some((branch: SchemaOrRef) =>\n    isArrayShaped(branch, context, seenRefs),\n  );\n};\n\nconst buildCopyingItemsStatements = ({\n  items,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  mode,\n}: ArrayStatementsParams): BuildResult => {\n  const element = `item${depth}`;\n  const value = `value${depth}`;\n  const { nullable } = normalizeSchema(items, context);\n\n  const inner = buildStatements({\n    schema: items,\n    accessor: value,\n    context,\n    visitedRefs,\n    depth: depth + 1,\n    mode,\n  });\n  if (inner.statements.length === 0) return inner;\n\n  // A `let` alias lets the recursion reassign the element itself (a date\n  // leaf, or a nested array's `.map` result) as well as write into a copy\n  // of it.\n  const body = [\n    ...(nullable ? [`if (${element} == null) return ${element};`] : []),\n    `let ${value} = ${element};`,\n    ...(needsObjectCopy(items, context) ? [`${value} = { ...${value} };`] : []),\n    ...inner.statements,\n    `return ${value};`,\n  ];\n\n  return {\n    statements: [\n      `${accessor} = ${accessor}.map((${element}) => {`,\n      ...indent(body),\n      '});',\n    ],\n    cyclicRefs: inner.cyclicRefs,\n  };\n};\n\n/**\n * The request direction's map traversal. Unlike the response direction, a\n * request-mode map never needs the `writesToAccessorItself` distinction:\n * every value is bound to a `let`, so a date leaf reassigns that `let`\n * exactly the way `buildCopyingItemsStatements` reassigns its own `value`\n * binding — no in-place key write is ever required.\n *\n * The map itself is shallow-copied unconditionally, up front, before the\n * loop — mirroring the array builder's copy-on-path discipline, but on the\n * container itself rather than inside a `.map()` callback, since a map has\n * no built-in traversal that already produces a fresh copy the way `.map`\n * does for arrays. Each value is then read into its own `let`, optionally\n * spread-copied when it needs its own writable copy (an object, exactly the\n * same `needsObjectCopy` check the array builder makes for its elements),\n * mutated by the recursive walk, and written back through the key.\n *\n * A nullable value is skipped with `continue` rather than wrapped in an\n * `if`: the map has already been copied, so the original (possibly null)\n * value is already sitting at that key and needs no rewrite.\n */\nconst buildCopyingMapStatements = ({\n  values,\n  accessor,\n  context,\n  visitedRefs,\n  depth,\n  mode,\n}: MapStatementsParams): BuildResult => {\n  const key = `key${depth}`;\n  const value = `value${depth}`;\n  const { nullable } = normalizeSchema(values, context);\n\n  const inner = buildStatements({\n    schema: values,\n    accessor: value,\n    context,\n    visitedRefs,\n    depth: depth + 1,\n    mode,\n  });\n  if (inner.statements.length === 0) return inner;\n\n  const body = [\n    `let ${value} = ${accessor}[${key}]!;`,\n    ...(nullable ? [`if (${value} == null) continue;`] : []),\n    ...(needsObjectCopy(values, context)\n      ? [`${value} = { ...${value} };`]\n      : []),\n    ...inner.statements,\n    `${accessor}[${key}] = ${value};`,\n  ];\n\n  return {\n    statements: [\n      `${accessor} = { ...${accessor} };`,\n      `for (const ${key} of Object.keys(${accessor})) {`,\n      ...indent(body),\n      '}',\n    ],\n    cyclicRefs: inner.cyclicRefs,\n  };\n};\n\nconst requestMode: DateTransformMode = {\n  isLeaf: isDateOnlySchema,\n  leafStatement: serializeLeafStatement,\n  objectPrelude: (accessor, schema, context) =>\n    needsObjectCopy(schema, context)\n      ? [`${accessor} = { ...${accessor} };`]\n      : [],\n  arrayStatements: buildCopyingItemsStatements,\n  mapStatements: buildCopyingMapStatements,\n  // No write accessor is needed in this direction: readOnly properties are\n  // skipped outright (see skipProperty below), and every property that is\n  // still walked is written into a fresh copy the caller already owns, so a\n  // plain assignment through `accessor` is always writable.\n  propertyWriteAccessor: () => undefined,\n  skipProperty: (schema) =>\n    !isBooleanJsonSchema(schema) && schema.readOnly === true,\n  dropArrayObjectConflict: true,\n};\n\nexport interface BuildRequestDateSerializeParams {\n  schema: SchemaOrRef;\n  /** Expression the statements mutate; must already be a copy the caller owns. */\n  accessor: string;\n  context: ContextSpec;\n  visitedRefs?: Set<string>;\n  depth?: number;\n}\n\nexport const buildRequestDateSerializeStatements = ({\n  schema,\n  accessor,\n  context,\n  visitedRefs = new Set(),\n  depth = 0,\n}: BuildRequestDateSerializeParams): string[] =>\n  buildStatements({\n    schema,\n    accessor,\n    context,\n    visitedRefs,\n    depth,\n    mode: requestMode,\n  }).statements;\n\n/**\n * Resolves a request body down to its single JSON content schema. Returns\n * undefined for non-JSON bodies and for bodies offering several JSON media\n * types, where there is no one schema to walk.\n */\nconst resolveJsonBodySchema = (\n  body: GetterBody,\n  context: ContextSpec,\n): OpenApiSchemaObject | undefined => {\n  const requestBody = !isInlineSchema(body.originalSchema)\n    ? resolveRef<OpenApiRequestBodyObject>(body.originalSchema, context).schema\n    : body.originalSchema;\n\n  const content = requestBody.content;\n  // oxlint-disable-next-line typescript/no-unnecessary-condition\n  if (!content) return undefined;\n\n  const jsonEntries = Object.entries(content).filter(([mediaType]) =>\n    mediaType.toLowerCase().includes('json'),\n  );\n  if (jsonEntries.length !== 1) return undefined;\n\n  return jsonEntries[0][1].schema;\n};\n\nexport interface GeneratedDateSerializer {\n  name: string;\n  implementation: string;\n}\n\n/**\n * Builds a `serialize{Op}Request` function rendering schema-declared\n * `format: date` fields of a JSON request body as `YYYY-MM-DD`. `format:\n * date-time` is left alone — `Date.prototype.toJSON()` already produces the\n * right thing for an instant. Returns undefined when there is nothing to\n * serialize, so callers emit no code.\n *\n * The returned value is still typed as the model type (`Date` fields and\n * all), but at runtime those `format: date` fields hold `YYYY-MM-DD`\n * strings, not `Date` instances — a wire-level lie that is harmless when the\n * result is passed straight to `data:`, but a caller that reads the result\n * back (rather than only forwarding it) must know the type does not match\n * the value.\n */\nexport const generateRequestDateSerializer = ({\n  operationName,\n  body,\n  context,\n}: {\n  operationName: string;\n  body: GetterBody;\n  context: ContextSpec;\n}): GeneratedDateSerializer | undefined => {\n  if (body.isBlob || !body.definition || !body.implementation) return undefined;\n\n  // A body offering several media types (e.g. `application/json` alongside\n  // `multipart/form-data`) is typed against the union of every surviving\n  // type's TS value — `GetterBody.contentType` is only populated when\n  // exactly one body type survived, and is `''` otherwise. A JSON-shaped\n  // walk cannot be typed against that union, so bail out symmetrically with\n  // `generateResponseDateDeserializer`'s single-success-type guard below.\n  // oxlint-disable-next-line typescript/no-unnecessary-condition\n  if (!body.contentType?.toLowerCase().includes('json')) return undefined;\n\n  const schema = resolveJsonBodySchema(body, context);\n  if (!schema) return undefined;\n\n  const statements = buildRequestDateSerializeStatements({\n    schema,\n    accessor: 'copy',\n    context,\n  });\n  if (statements.length === 0) return undefined;\n\n  const dataType = body.definition;\n\n  // A body type carrying any readOnly property is emitted as `NonReadonly<T>`,\n  // whose mapped type recurses through `T[P] extends object` — which `Date`\n  // satisfies — replacing every Date with a structural twin whose methods are\n  // typed `{}`, so `.toISOString()` and `.map()` stop compiling. Casting the\n  // copy back to the model type once keeps the conversions type-checked.\n  // readOnly properties are skipped by the walk, so nothing writes to a key\n  // `NonReadonly` dropped.\n  const modelType = /^NonReadonly<(.+)>$/s.exec(dataType)?.[1];\n  const workingType = modelType ? ` as unknown as ${modelType}` : '';\n  const returnValue = modelType ? `copy as unknown as ${dataType}` : 'copy';\n\n  // The root is reassigned rather than spread when the body is an array or a\n  // bare date: `.map` builds the new array itself, and spreading either would\n  // be wrong.\n  const declaration = needsObjectCopy(schema, context)\n    ? `const copy = { ...data }${workingType};`\n    : `let copy = data${workingType};`;\n\n  const name = `serialize${pascal(operationName)}Request`;\n\n  // An operation prop generated from a `requestBody` that isn't `required: true`\n  // (the OpenAPI default) is typed `T | undefined` at the call site\n  // (`getProps` in `getters/props.ts`). Mirroring that in the serializer's own\n  // signature keeps the emitted call `serializeXRequest(<possibly undefined\n  // body>)` type-checking, while `if (data == null) return data;` above already\n  // makes this correct at runtime and gives TypeScript the narrowing it needs\n  // for the rest of the body.\n  const optionalSuffix = body.isOptional ? ' | undefined' : '';\n\n  const implementation = `const ${name} = (data: ${dataType}${optionalSuffix}): ${dataType}${optionalSuffix} => {\n  if (data == null) return data;\n  ${declaration}\n${indent(statements).join('\\n')}\n  return ${returnValue};\n};\n`;\n\n  return { name, implementation };\n};\n\nexport interface GeneratedDateDeserializer {\n  name: string;\n  implementation: string;\n}\n\n/**\n * Builds a `deserialize{Op}Response` function converting schema-declared\n * date fields of the (single) JSON success response in place. Returns\n * undefined when there is nothing to transform, so callers emit no code.\n */\nexport const generateResponseDateDeserializer = ({\n  operationName,\n  response,\n  context,\n}: {\n  operationName: string;\n  response: GetterResponse;\n  context: ContextSpec;\n}): GeneratedDateDeserializer | undefined => {\n  if (response.isBlob) return undefined;\n\n  // MVP: a single success shape only — mixed 2xx types would need\n  // status-aware dispatch, and the deserializer's parameter type would not\n  // match the operation's return type union.\n  if (response.types.success.length !== 1) return undefined;\n\n  const [successType] = response.types.success;\n  if (\n    !successType.originalSchema ||\n    !successType.contentType.toLowerCase().includes('json')\n  ) {\n    return undefined;\n  }\n\n  const statements = buildDateTransformStatements({\n    schema: successType.originalSchema,\n    accessor: 'data',\n    context,\n  });\n  if (statements.length === 0) return undefined;\n\n  const dataType = response.definition.success || 'unknown';\n  const name = `deserialize${pascal(operationName)}Response`;\n  const implementation = `const ${name} = (data: ${dataType}): ${dataType} => {\n  if (data == null) return data;\n${indent(statements).join('\\n')}\n  return data;\n};\n`;\n\n  return { name, implementation };\n};\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { resolveRef } from '../resolvers/ref';\nimport type {\n  ContextSpec,\n  GeneratorImport,\n  OpenApiReferenceObject,\n  OpenApiSchemaObject,\n} from '../types';\nimport { PropertySortOrder } from '../types';\nimport {\n  conventionName,\n  getFileInfo,\n  isInlineSchema,\n  getSchemasImportPath,\n  isString,\n  jsStringLiteralEscape,\n  logger,\n  pascal,\n  upath,\n} from '../utils';\n\nconst circularRefCache = new WeakMap<ContextSpec, Map<string, boolean>>();\n\nfunction getSchemasPath(context: ContextSpec): string {\n  const { schemas, target } = context.output;\n  if (schemas) {\n    const schemasPath = isString(schemas) ? schemas : schemas.path;\n    return upath.normalizeSafe(schemasPath);\n  }\n  const { dirname, filename } = getFileInfo(target);\n  return upath.joinSafe(dirname, filename + '.schemas');\n}\n\nfunction getSchemaImportPath(\n  refName: string,\n  context: ContextSpec,\n): string | undefined {\n  if (context.output.factoryMethods?.mode === 'single') {\n    return undefined;\n  }\n\n  const importPathBase = getSchemasImportPath(context.output.schemas);\n  if (importPathBase) {\n    const baseName = conventionName(refName, context.output.namingConvention);\n    return upath.joinSafe(importPathBase, baseName);\n  }\n\n  let outputDir = context.output.factoryMethods?.outputDirectory;\n  let schemasPath = getSchemasPath(context);\n\n  if (context.output.workspace) {\n    if (outputDir && !upath.isAbsolute(outputDir)) {\n      outputDir = upath.resolve(context.output.workspace, outputDir);\n    }\n    if (schemasPath && !upath.isAbsolute(schemasPath)) {\n      schemasPath = upath.resolve(context.output.workspace, schemasPath);\n    }\n  }\n\n  const relativePath = outputDir\n    ? upath.relativeSafe(outputDir, schemasPath)\n    : './';\n  const baseName = conventionName(refName, context.output.namingConvention);\n  return upath.joinSafe(relativePath, baseName);\n}\n\ntype SchemaArray = (OpenApiSchemaObject | OpenApiReferenceObject)[];\n\ninterface ResolvedRef {\n  imports: GeneratorImport[];\n  schema: OpenApiSchemaObject;\n}\n\nfunction getResolvedRef(\n  schema: OpenApiReferenceObject,\n  context: ContextSpec,\n): ResolvedRef {\n  return resolveRef(schema, context) as ResolvedRef;\n}\n\nfunction hasSchemaFlag(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n  key: 'readOnly' | 'writeOnly',\n): boolean {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n  return Boolean((schema as Record<string, unknown>)[key]);\n}\n\nfunction getProperties(\n  schema: OpenApiSchemaObject,\n): Record<string, OpenApiSchemaObject | OpenApiReferenceObject> {\n  if (isBooleanJsonSchema(schema)) return {};\n  return schema.properties ?? {};\n}\n\nfunction getItems(\n  schema: OpenApiSchemaObject,\n): OpenApiSchemaObject | OpenApiReferenceObject | undefined {\n  if (isBooleanJsonSchema(schema)) return undefined;\n  return schema.items;\n}\n\nfunction getAdditionalProperties(\n  schema: OpenApiSchemaObject,\n): OpenApiSchemaObject | OpenApiReferenceObject | undefined {\n  if (isBooleanJsonSchema(schema)) return undefined;\n  // `unevaluatedProperties` (OAS 3.1) has the same shape and circularity\n  // implications as `additionalProperties`. See issue #2156.\n  return schema.additionalProperties ?? schema.unevaluatedProperties;\n}\n\nfunction getSchemas(schemas: unknown): SchemaArray | undefined {\n  return schemas as SchemaArray | undefined;\n}\n\nfunction getExtendedProps(schema: OpenApiSchemaObject): {\n  constValue: unknown;\n  prefixItems: SchemaArray | undefined;\n  minItems: number | undefined;\n} {\n  const extended = schema as OpenApiSchemaObject & {\n    const?: unknown;\n    prefixItems?: SchemaArray;\n    minItems?: number;\n  };\n  return {\n    constValue: extended.const,\n    prefixItems: extended.prefixItems,\n    minItems: extended.minItems,\n  };\n}\n\nexport function generateFactory(\n  schema: OpenApiSchemaObject,\n  name: string,\n  context: ContextSpec,\n): { model: string; imports: GeneratorImport[] } | undefined {\n  if (\n    isBooleanJsonSchema(schema) ||\n    !canGenerateSchema(schema) ||\n    !context.output.factoryMethods\n  )\n    return undefined;\n\n  const { functionNamePrefix, mode } = context.output.factoryMethods;\n  const factoryName = `${functionNamePrefix}${pascal(name)}`;\n  const imports: GeneratorImport[] = [];\n  const payload = buildPayload(schema, context, [name], imports);\n\n  if (mode !== 'single') {\n    const schemaImportPath = getSchemaImportPath(name, context);\n    imports.push({ name, importPath: schemaImportPath });\n  }\n\n  return {\n    model: `export function ${factoryName}(): ${name} {\\n  return ${payload};\\n}\\n`,\n    imports,\n  };\n}\n\nfunction canGenerateSchema(schema: OpenApiSchemaObject): boolean {\n  if (isBooleanJsonSchema(schema)) return false;\n  return (\n    schema.type === 'object' ||\n    schema.type === 'array' ||\n    !!schema.properties ||\n    !!schema.allOf ||\n    !!schema.oneOf ||\n    !!schema.anyOf ||\n    !!schema.items ||\n    !!schema.enum\n  );\n}\n\nfunction hasCircularReference(\n  target: OpenApiSchemaObject | OpenApiReferenceObject,\n  sourceName: string,\n  context: ContextSpec,\n  visited = new Set<string>(),\n): boolean {\n  if (!isInlineSchema(target)) {\n    const { imports, schema } = getResolvedRef(target, context);\n    const refName = imports[0]?.name;\n    if (refName === sourceName) return true;\n    if (refName && visited.has(refName)) return false;\n    if (refName) visited.add(refName);\n\n    let cache = circularRefCache.get(context);\n    if (!cache) {\n      cache = new Map<string, boolean>();\n      circularRefCache.set(context, cache);\n    }\n    const cacheKey = refName ? `${sourceName}::${refName}` : undefined;\n    if (cacheKey) {\n      const cached = cache.get(cacheKey);\n      if (cached !== undefined) {\n        return cached;\n      }\n    }\n\n    const result = hasCircularReference(schema, sourceName, context, visited);\n\n    if (cacheKey) {\n      cache.set(cacheKey, result);\n    }\n    return result;\n  }\n\n  if (isBooleanJsonSchema(target)) return false;\n\n  const check = (schemas?: SchemaArray): boolean =>\n    schemas?.some((s) =>\n      hasCircularReference(s, sourceName, context, visited),\n    ) ?? false;\n\n  const items = getItems(target);\n  const additionalProperties = getAdditionalProperties(target);\n\n  return (\n    check(getSchemas(target.allOf)) ||\n    check(getSchemas(target.oneOf)) ||\n    check(getSchemas(target.anyOf)) ||\n    Object.values(getProperties(target)).some((s) =>\n      hasCircularReference(s, sourceName, context, visited),\n    ) ||\n    (!!items && hasCircularReference(items, sourceName, context, visited)) ||\n    (typeof additionalProperties === 'object' &&\n      hasCircularReference(additionalProperties, sourceName, context, visited))\n  );\n}\n\nfunction buildPayload(\n  target: OpenApiSchemaObject | OpenApiReferenceObject,\n  context: ContextSpec,\n  parents: string[],\n  imports: GeneratorImport[],\n): string {\n  if (!isInlineSchema(target)) {\n    return buildRefPayload(target, context, parents, imports);\n  }\n\n  if (isBooleanJsonSchema(target)) {\n    return '{}';\n  }\n\n  const schema = target;\n  const payloads: string[] = [];\n\n  if (schema.allOf) {\n    payloads.push(\n      buildAllOfPayload(\n        getSchemas(schema.allOf) ?? [],\n        context,\n        parents,\n        imports,\n      ),\n    );\n  } else if (schema.oneOf) {\n    payloads.push(\n      buildFirstOfPayload(\n        getSchemas(schema.oneOf) ?? [],\n        context,\n        parents,\n        imports,\n      ),\n    );\n  } else if (schema.anyOf) {\n    payloads.push(\n      buildFirstOfPayload(\n        getSchemas(schema.anyOf) ?? [],\n        context,\n        parents,\n        imports,\n      ),\n    );\n  }\n\n  if (Object.keys(getProperties(schema)).length > 0) {\n    payloads.push(buildObjectPayload(schema, context, parents, imports));\n  }\n\n  if (payloads.length > 0) {\n    return payloads.length === 1\n      ? payloads[0]\n      : `Object.assign({}, ${payloads.join(', ')})`;\n  }\n\n  const { constValue } = getExtendedProps(schema);\n  if (constValue !== undefined) return formatValue(constValue);\n  if (schema.default !== undefined) return buildDefaultPayload(schema, context);\n\n  const schemaType = inferSchemaType(schema);\n\n  if (schemaType === 'object') return '{}';\n  if (schemaType === 'array')\n    return buildArrayPayload(schema, context, parents, imports);\n\n  return buildPrimitivePayload(schema, schemaType, context);\n}\n\nfunction buildRefPayload(\n  schema: OpenApiReferenceObject,\n  context: ContextSpec,\n  parents: string[],\n  imports: GeneratorImport[],\n): string {\n  const { schema: resolved, imports: refImports } = getResolvedRef(\n    schema,\n    context,\n  );\n  const refName = refImports[0]?.name;\n\n  if (!refName) return '{}';\n\n  if (\n    parents.includes(refName) ||\n    hasCircularReference(resolved, parents[0], context)\n  ) {\n    imports.push({\n      name: refName,\n      importPath: getSchemaImportPath(refName, context),\n    });\n    return `{} as ${refName}`;\n  }\n\n  const { functionNamePrefix = 'create', mode = 'single' } =\n    context.output.factoryMethods ?? {};\n  const refFactoryName = `${functionNamePrefix}${pascal(refName)}`;\n\n  if (mode !== 'single-split') {\n    const importPath = resolveImportPath(mode, refName, context);\n    imports.push({ name: refFactoryName, importPath, isConstant: true });\n  }\n\n  imports.push({\n    name: refName,\n    importPath: getSchemaImportPath(refName, context),\n  });\n\n  return `${refFactoryName}()`;\n}\n\nfunction resolveImportPath(\n  mode: string,\n  refName: string,\n  context: ContextSpec,\n): string | undefined {\n  const baseName = conventionName(refName, context.output.namingConvention);\n  const pkgBase = getSchemasImportPath(context.output.schemas);\n\n  switch (mode) {\n    case 'split': {\n      return pkgBase\n        ? upath.joinSafe(pkgBase, `${baseName}.factory`)\n        : `./${baseName}.factory`;\n    }\n    case 'single-split': {\n      return pkgBase\n        ? upath.joinSafe(\n            pkgBase,\n            conventionName('factoryMethods', context.output.namingConvention),\n          )\n        : `./${conventionName('factoryMethods', context.output.namingConvention)}`;\n    }\n    case 'single': {\n      return pkgBase ? upath.joinSafe(pkgBase, baseName) : `./${baseName}`;\n    }\n  }\n}\n\nfunction buildAllOfPayload(\n  allOf: SchemaArray,\n  context: ContextSpec,\n  parents: string[],\n  imports: GeneratorImport[],\n): string {\n  const payloads = allOf.map((s) => buildPayload(s, context, parents, imports));\n  return payloads.length > 0\n    ? `Object.assign({}, ${payloads.join(', ')})`\n    : '{}';\n}\n\nfunction buildFirstOfPayload(\n  schemas: SchemaArray,\n  context: ContextSpec,\n  parents: string[],\n  imports: GeneratorImport[],\n): string {\n  const first = schemas[0];\n  return first ? buildPayload(first, context, parents, imports) : '{}';\n}\n\nfunction buildObjectPayload(\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n  parents: string[],\n  imports: GeneratorImport[],\n): string {\n  if (isBooleanJsonSchema(schema)) return '{}';\n  const { includeOptionalProperty = false } =\n    context.output.factoryMethods ?? {};\n  const props = getProperties(schema);\n  const requiredProps: string[] = schema.required ?? [];\n  const entries = Object.entries(props);\n\n  if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {\n    entries.sort(([a], [b]) => a.localeCompare(b));\n  }\n\n  const includeOptional = includeOptionalProperty;\n  const lines: string[] = [];\n\n  for (const [key, prop] of entries) {\n    const isRequired = requiredProps.includes(key);\n    const resolved = isInlineSchema(prop)\n      ? prop\n      : getResolvedRef(prop, context).schema;\n\n    const isReadOnly =\n      hasSchemaFlag(prop, 'readOnly') || hasSchemaFlag(resolved, 'readOnly');\n    const isWriteOnly =\n      hasSchemaFlag(prop, 'writeOnly') || hasSchemaFlag(resolved, 'writeOnly');\n\n    if (!isRequired) {\n      if (isReadOnly) continue;\n      if (!isWriteOnly && !includeOptional) continue;\n    }\n\n    const payload = buildPayload(prop, context, parents, imports);\n    const safeKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key)\n      ? key\n      : JSON.stringify(key);\n    lines.push(`${safeKey}: ${payload}`);\n  }\n\n  return `{\\n    ${lines.join(',\\n    ')}\\n  }`;\n}\n\nfunction buildArrayPayload(\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n  parents: string[],\n  imports: GeneratorImport[],\n): string {\n  if (isBooleanJsonSchema(schema)) return '[]';\n  const { prefixItems, minItems } = getExtendedProps(schema);\n  const items = getItems(schema);\n\n  if (prefixItems && prefixItems.length > 0) {\n    const payloads = prefixItems.map((item) =>\n      buildPayload(item, context, parents, imports),\n    );\n    return `[${payloads.join(', ')}]`;\n  }\n\n  if (minItems && items) {\n    const MAX_MIN_ITEMS = 50;\n    if (minItems > MAX_MIN_ITEMS) {\n      logger.warn(\n        `minItems is ${minItems}, capping at ${MAX_MIN_ITEMS} to prevent massive payload.`,\n      );\n    }\n    const count = Math.min(minItems, MAX_MIN_ITEMS);\n    const itemPayload = buildPayload(items, context, parents, imports);\n    return `[${Array.from<string>({ length: count })\n      .fill(itemPayload)\n      .join(', ')}]`;\n  }\n\n  return '[]';\n}\n\nfunction inferSchemaType(schema: OpenApiSchemaObject): string | undefined {\n  if (isBooleanJsonSchema(schema)) return undefined;\n  let type = schema.type as string | string[] | undefined;\n\n  if (Array.isArray(type)) {\n    const nonNull = type.filter((t) => t !== 'null');\n    type = nonNull.length > 0 ? nonNull[0] : 'null';\n  }\n\n  if (!type && schema.items) return 'array';\n\n  if (!type && schema.enum) {\n    const first = schema.enum[0];\n    if (typeof first === 'number') return 'number';\n    if (typeof first === 'boolean') return 'boolean';\n    return 'string';\n  }\n\n  return type;\n}\n\nfunction buildDefaultPayload(\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n): string {\n  if (isBooleanJsonSchema(schema)) return formatValue(undefined);\n  if (\n    context.output.override.useDates &&\n    typeof schema.default === 'string' &&\n    (schema.format === 'date' || schema.format === 'date-time')\n  ) {\n    // The default is document text, and this builds a single-quoted literal by\n    // hand: an unescaped `'` closed it and appended expressions to the\n    // `new Date(...)` argument, which the factory then evaluated on every call.\n    return `new Date('${jsStringLiteralEscape(schema.default)}')`;\n  }\n  return formatValue(schema.default);\n}\n\nfunction buildPrimitivePayload(\n  schema: OpenApiSchemaObject,\n  schemaType: string | undefined,\n  context: ContextSpec,\n): string {\n  if (isBooleanJsonSchema(schema)) return '{}';\n  if (schemaType === 'null') return 'null';\n\n  const enumValues = schema.enum;\n\n  // The enum member is document text, and OpenAPI does not make it agree with\n  // the declared `type`: `{ type: number, enum: [\"<code>\"] }` validates. So the\n  // member is serialized from its runtime value rather than trusted as a\n  // literal of the declared type — `String()` spliced a string in verbatim.\n  if (schemaType === 'boolean') {\n    return enumValues && enumValues.length > 0\n      ? formatValue(enumValues[0])\n      : 'false';\n  }\n\n  if (schemaType === 'number' || schemaType === 'integer') {\n    return enumValues && enumValues.length > 0\n      ? formatValue(enumValues[0])\n      : '0';\n  }\n\n  if (schemaType === 'string') {\n    if (enumValues && enumValues.length > 0) {\n      return formatValue(enumValues[0]);\n    }\n    if (schema.format === 'date' || schema.format === 'date-time') {\n      return context.output.override.useDates\n        ? 'new Date(0)'\n        : `'${new Date(0).toISOString()}'`;\n    }\n    return \"''\";\n  }\n\n  return 'undefined as unknown';\n}\n\nfunction formatValue(val: unknown): string {\n  if (val === null) return 'null';\n  if (typeof val === 'string') return JSON.stringify(val);\n  if (typeof val === 'object') return JSON.stringify(val);\n  return String(val as number | boolean);\n}\n","import {\n  type GeneratorImport,\n  type GeneratorMutator,\n  type GeneratorVerbOptions,\n  GetterPropType,\n  NamingConvention,\n} from '../types';\nimport { groupBy, unique, uniqueWith } from '../utils';\nimport { compareNatural, conventionName } from '../utils';\n\ninterface GenerateImportsOptions {\n  imports: readonly GeneratorImport[];\n  namingConvention?: NamingConvention;\n  importExtension?: string;\n}\n\nexport function generateImports({\n  imports,\n  namingConvention = NamingConvention.CAMEL_CASE,\n  importExtension = '',\n}: GenerateImportsOptions) {\n  if (imports.length === 0) {\n    return '';\n  }\n\n  const normalized = uniqueWith(\n    imports,\n    (a, b) =>\n      a.name === b.name &&\n      a.default === b.default &&\n      a.alias === b.alias &&\n      a.values === b.values &&\n      a.isConstant === b.isConstant &&\n      a.namespaceImport === b.namespaceImport &&\n      a.syntheticDefaultImport === b.syntheticDefaultImport &&\n      a.importPath === b.importPath,\n  ).map((imp) => ({\n    ...imp,\n    importPath:\n      imp.importPath ??\n      `./${conventionName(imp.name, namingConvention)}${importExtension}`,\n  }));\n\n  const grouped = groupBy(normalized, (imp) =>\n    !imp.default &&\n    !imp.namespaceImport &&\n    !imp.syntheticDefaultImport &&\n    !imp.values &&\n    !imp.isConstant\n      ? `aggregate|${imp.importPath}`\n      : `single|${imp.importPath}|${imp.name}|${imp.alias ?? ''}|${String(\n          imp.default,\n        )}|${String(imp.namespaceImport)}|${String(imp.syntheticDefaultImport)}|${String(\n          imp.values,\n        )}|${String(imp.isConstant)}`,\n  );\n\n  return [...grouped]\n    .toSorted(([a], [b]) => compareNatural(a, b))\n    .map(([, group]) => {\n      const sample = group[0];\n      const canAggregate =\n        !sample.default &&\n        !sample.namespaceImport &&\n        !sample.syntheticDefaultImport &&\n        !sample.values &&\n        !sample.isConstant;\n\n      if (canAggregate) {\n        const names = [\n          ...new Set(\n            group.map(\n              ({ name, alias }) => `${name}${alias ? ` as ${alias}` : ''}`,\n            ),\n          ),\n        ]\n          .toSorted()\n          .join(', ');\n\n        return `import type { ${names} } from '${sample.importPath}';`;\n      }\n\n      const { name, values, alias, isConstant, importPath } = sample;\n      return `import ${!values && !isConstant ? 'type ' : ''}{ ${name}${\n        alias ? ` as ${alias}` : ''\n      } } from '${importPath}';`;\n    })\n    .join('\\n');\n}\n\ninterface GenerateMutatorImportsOptions {\n  mutators: GeneratorMutator[];\n  implementation?: string;\n  oneMore?: boolean;\n}\n\nexport function generateMutatorImports({\n  mutators,\n  implementation,\n  oneMore,\n}: GenerateMutatorImportsOptions) {\n  let imports = '';\n  for (const mutator of uniqueWith(\n    mutators,\n    (a, b) => a.name === b.name && a.default === b.default,\n  )) {\n    if (\n      implementation &&\n      !implementation.split(/[^\\w$]+/).includes(mutator.name)\n    ) {\n      continue;\n    }\n    // Relative mutator paths are written relative to the output root, so in\n    // tags-split mode (`oneMore`) they need an extra `../` to reach the file\n    // from the deeper per-tag directory. Bare specifiers (e.g. `@scope/axios`)\n    // and absolute paths do not depend on the importer's location and must be\n    // left untouched.\n    const isRelativeImport = mutator.path.startsWith('.');\n    const path = `${oneMore && isRelativeImport ? '../' : ''}${mutator.path}`;\n    const importDefault = mutator.default\n      ? mutator.name\n      : `{ ${mutator.name} }`;\n\n    imports += `import ${importDefault} from '${path}';`;\n    imports += '\\n';\n\n    if (implementation && (mutator.hasErrorType || mutator.bodyTypeName)) {\n      let errorImportName = '';\n      const targetErrorImportName = mutator.default\n        ? `ErrorType as ${mutator.errorTypeName}`\n        : mutator.errorTypeName;\n      if (\n        mutator.hasErrorType &&\n        implementation.includes(mutator.errorTypeName) &&\n        !imports.includes(`{ ${targetErrorImportName} `)\n      ) {\n        errorImportName = targetErrorImportName;\n      }\n\n      let bodyImportName = '';\n      const targetBodyImportName = mutator.default\n        ? `BodyType as ${mutator.bodyTypeName}`\n        : mutator.bodyTypeName;\n      if (\n        mutator.bodyTypeName &&\n        implementation.includes(mutator.bodyTypeName) &&\n        !imports.includes(` ${targetBodyImportName} }`)\n      ) {\n        bodyImportName = targetBodyImportName ?? '';\n      }\n\n      if (bodyImportName || errorImportName) {\n        imports += `import type { ${errorImportName}${\n          errorImportName && bodyImportName ? ' , ' : ''\n        }${bodyImportName} } from '${path}';`;\n        imports += '\\n';\n      }\n    }\n  }\n\n  return imports;\n}\n\ninterface GenerateDependencyOptions {\n  key: string;\n  deps: readonly GeneratorImport[];\n  dependency: string;\n  projectName?: string;\n  isAllowSyntheticDefaultImports: boolean;\n  onlyTypes: boolean;\n}\n\nfunction generateDependency({\n  deps,\n  isAllowSyntheticDefaultImports,\n  dependency,\n  projectName,\n  key,\n  onlyTypes,\n}: GenerateDependencyOptions) {\n  // find default import if dependency either is not a synthetic import or synthetic imports are allowed\n  const defaultDep = deps.find(\n    (e) =>\n      e.default &&\n      (isAllowSyntheticDefaultImports || !e.syntheticDefaultImport),\n  );\n\n  // if default dependency could not be created, check for namespace import or a synthetic import that is not allowed\n  const namespaceImportDep = defaultDep\n    ? undefined\n    : deps.find(\n        (e) =>\n          !!e.namespaceImport ||\n          (!isAllowSyntheticDefaultImports && e.syntheticDefaultImport),\n      );\n\n  // find all named imports\n  const depsString = unique(\n    deps\n      .filter(\n        (e) => !e.default && !e.syntheticDefaultImport && !e.namespaceImport,\n      )\n      .map(({ name, alias }) => (alias ? `${name} as ${alias}` : name)),\n  )\n    .toSorted()\n    .join(',\\n  ');\n\n  let importString = '';\n\n  // generate namespace import string\n  const namespaceImportString = namespaceImportDep\n    ? `import * as ${namespaceImportDep.name} from '${dependency}';`\n    : '';\n\n  if (namespaceImportString) {\n    if (deps.length === 1) {\n      // only namespace import, return it directly\n      return namespaceImportString;\n    }\n    importString += `${namespaceImportString}\\n`;\n  }\n\n  importString += `import ${onlyTypes ? 'type ' : ''}${\n    defaultDep ? `${defaultDep.name}${depsString ? ',' : ''}` : ''\n  }${depsString ? `{\\n  ${depsString}\\n}` : ''} from '${dependency}${\n    key !== 'default' && projectName ? `/${projectName}` : ''\n  }';`;\n\n  return importString;\n}\n\ninterface AddDependencyOptions {\n  implementation: string;\n  exports: readonly GeneratorImport[];\n  dependency: string;\n  projectName?: string;\n  hasSchemaDir: boolean;\n  isAllowSyntheticDefaultImports: boolean;\n}\n\ntype AddDependencyFromIdentifiersOptions = Omit<\n  AddDependencyOptions,\n  'implementation'\n> & {\n  referencedIdentifiers: ReadonlySet<string>;\n};\n\nconst IDENTIFIER_PATTERN = /[$_\\p{ID_Start}][$\\u200c\\u200d\\p{ID_Continue}]*/gu;\n\n/**\n * Whether the identifier starting at `start` is a member name — the `map` of\n * `value.map(...)` — rather than a reference to a binding in scope.\n *\n * A member name is never the import: an imported binding that the code really\n * uses has to appear bare somewhere (`map(...)`, `{ map }`, `Pet`), because a\n * name after a dot is a property of the object on its left. Reading one as a\n * reference kept imports alive that nothing used — the rxjs `map` that every\n * generated Angular `httpResource` file carried came from the `.map((item) =>`\n * in its own query-param serializer (#4143).\n *\n * `...spread` is not a member access even though a `.` sits in front of it, so\n * the third dot of a spread token does not count. Two dots are not enough to\n * recognize one: `1..map` is valid, where the first dot ends the numeric\n * literal `1.` and the second is the member access. Optional chaining\n * (`value?.map`) is a member access like any other.\n */\nfunction isMemberName(source: string, start: number): boolean {\n  let index = start - 1;\n\n  while (index >= 0 && /\\s/.test(source[index])) {\n    index--;\n  }\n\n  if (index < 0 || source[index] !== '.') {\n    return false;\n  }\n\n  const isSpread = source[index - 1] === '.' && source[index - 2] === '.';\n\n  return !isSpread;\n}\n\nfunction getReferencedIdentifiers(implementation: string): Set<string> {\n  const identifiers = new Set<string>();\n\n  for (const match of implementation.matchAll(IDENTIFIER_PATTERN)) {\n    /* oxlint-disable typescript/no-unnecessary-condition */\n    if (\n      match.index !== undefined &&\n      !isMemberName(implementation, match.index)\n    ) {\n      identifiers.add(match[0]);\n    }\n    /* oxlint-enable typescript/no-unnecessary-condition */\n  }\n\n  return identifiers;\n}\n\nfunction addDependencyFromIdentifiers({\n  referencedIdentifiers,\n  exports,\n  dependency,\n  projectName,\n  isAllowSyntheticDefaultImports,\n}: AddDependencyFromIdentifiersOptions) {\n  const toAdds = exports.filter((e) => {\n    // An aliased import is rendered as `name as alias`, so the alias is the only\n    // binding in scope; the pre-alias name never appears as a reference. Match on\n    // the alias when present (otherwise the name) to avoid false positives such as\n    // a path param `z` colliding with `z as zod` (#3695).\n    const identifier = e.alias?.length ? e.alias : e.name;\n\n    if (!identifier) {\n      return false;\n    }\n\n    return referencedIdentifiers.has(identifier);\n  });\n\n  if (toAdds.length === 0) {\n    return;\n  }\n\n  const groupedBySpecKey: Record<\n    string,\n    { types: GeneratorImport[]; values: GeneratorImport[] }\n  > = { default: { types: [], values: [] } };\n  for (const dep of toAdds) {\n    const key = 'default';\n\n    if (\n      dep.values &&\n      (isAllowSyntheticDefaultImports || !dep.syntheticDefaultImport)\n    ) {\n      groupedBySpecKey[key].values.push(dep);\n    } else {\n      groupedBySpecKey[key].types.push(dep);\n    }\n  }\n\n  return (\n    Object.entries(groupedBySpecKey)\n      .map(([key, { values, types }]) => {\n        let dep = '';\n\n        if (values.length > 0) {\n          dep += generateDependency({\n            deps: values,\n            isAllowSyntheticDefaultImports,\n            dependency,\n            projectName,\n            key,\n            onlyTypes: false,\n          });\n        }\n\n        if (types.length > 0) {\n          let uniqueTypes = types;\n          if (values.length > 0) {\n            uniqueTypes = types.filter(\n              (t) =>\n                !values.some(\n                  (v) =>\n                    v.name === t.name && (v.alias ?? '') === (t.alias ?? ''),\n                ),\n            );\n          }\n          if (uniqueTypes.length > 0) {\n            if (values.length > 0) {\n              dep += '\\n';\n            }\n            dep += generateDependency({\n              deps: uniqueTypes,\n              isAllowSyntheticDefaultImports,\n              dependency,\n              projectName,\n              key,\n              onlyTypes: true,\n            });\n          }\n        }\n\n        return dep;\n      })\n      .join('\\n') + '\\n'\n  );\n}\n\nexport function addDependency({\n  implementation,\n  ...options\n}: AddDependencyOptions) {\n  return addDependencyFromIdentifiers({\n    ...options,\n    referencedIdentifiers: getReferencedIdentifiers(implementation),\n  });\n}\n\nfunction getLibName(code: string) {\n  const splitString = code.split(' from ');\n  return (splitString.at(-1) ?? '').split(';')[0].trim();\n}\n\nexport function generateDependencyImports(\n  implementation: string,\n  imports: {\n    exports: readonly GeneratorImport[];\n    dependency: string;\n  }[],\n  projectName: string | undefined,\n  hasSchemaDir: boolean,\n  isAllowSyntheticDefaultImports: boolean,\n): string {\n  if (imports.length === 0) {\n    return '';\n  }\n\n  const referencedIdentifiers = getReferencedIdentifiers(implementation);\n  const dependencies = imports\n    .map((dep) =>\n      addDependencyFromIdentifiers({\n        ...dep,\n        referencedIdentifiers,\n        projectName,\n        hasSchemaDir,\n        isAllowSyntheticDefaultImports,\n      }),\n    )\n    .filter((x): x is string => Boolean(x))\n    .toSorted((a, b) => {\n      const aLib = getLibName(a);\n      const bLib = getLibName(b);\n\n      if (aLib === bLib) {\n        return 0;\n      }\n\n      if (aLib.startsWith(\"'.\") && !bLib.startsWith(\"'.\")) {\n        return 1;\n      }\n      return aLib < bLib ? -1 : 1;\n    })\n    .join('\\n');\n\n  return dependencies ? dependencies + '\\n' : '';\n}\n\nexport function generateVerbImports({\n  response,\n  body,\n  queryParams,\n  props,\n  headers,\n  params,\n}: GeneratorVerbOptions): GeneratorImport[] {\n  const imports: GeneratorImport[] = [\n    ...response.imports,\n    ...body.imports,\n    ...props.flatMap((prop) =>\n      prop.type === GetterPropType.NAMED_PATH_PARAMS\n        ? [{ name: prop.schema.name }]\n        : [],\n    ),\n    ...(queryParams ? [{ name: queryParams.schema.name }] : []),\n    ...(headers ? [{ name: headers.schema.name }] : []),\n    ...params.flatMap<GeneratorImport>(({ imports }) => imports),\n  ];\n\n  // Zod schema named `Error` is a common collision with the global `Error` value.\n  // If we need it as a runtime value (e.g. `.parse()`), alias the value import to\n  // `ErrorSchema` while keeping the `Error` type available.\n  return imports.flatMap((imp) => {\n    if (imp.name !== 'Error' || !imp.values || imp.alias) {\n      return [imp];\n    }\n\n    return [\n      // Type-only import keeps `Error` usable as a type.\n      { ...imp, values: undefined },\n      // Value import is aliased to avoid shadowing `globalThis.Error`.\n      { ...imp, alias: 'ErrorSchema', values: true },\n    ];\n  });\n}\n","import { resolveRef } from '../resolvers/ref';\nimport type {\n  ContextSpec,\n  InputFiltersOptions,\n  NormalizedInputOptions,\n  OpenApiDocument,\n  OpenApiOperationObject,\n  OpenApiPathItemObject,\n} from '../types';\nimport { isInlineSchema, isString } from '../utils';\n\nconst COMPONENT_TYPES = [\n  'schemas',\n  'responses',\n  'parameters',\n  'requestBodies',\n] as const;\n\ntype ComponentType = (typeof COMPONENT_TYPES)[number];\n\nexport function filteredVerbs(\n  verbs: OpenApiPathItemObject,\n  filters: NormalizedInputOptions['filters'],\n): [string, OpenApiOperationObject][] {\n  if (filters?.tags === undefined) {\n    return Object.entries(verbs) as [string, OpenApiOperationObject][];\n  }\n\n  const filterTags = filters.tags;\n  const filterMode = filters.mode ?? 'include';\n\n  return (Object.entries(verbs) as [string, OpenApiOperationObject][]).filter(\n    ([, operation]) => {\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      if (!operation || typeof operation !== 'object') {\n        return false;\n      }\n      const operationTags = operation.tags ?? [];\n\n      const isMatch = operationTags.some((tag) =>\n        filterTags.some((filterTag) =>\n          filterTag instanceof RegExp ? filterTag.test(tag) : filterTag === tag,\n        ),\n      );\n\n      return filterMode === 'exclude' ? !isMatch : isMatch;\n    },\n  );\n}\n\nfunction findRefs(value: unknown): string[] {\n  if (!value || typeof value !== 'object') return [];\n  if (Array.isArray(value)) return value.flatMap((item) => findRefs(item));\n\n  const obj = value as Record<string, unknown>;\n\n  const refs: string[] = [];\n  if (typeof obj.$ref === 'string') {\n    refs.push(obj.$ref);\n  }\n  return refs.concat(Object.values(obj).flatMap((val) => findRefs(val)));\n}\n\nfunction parseComponentRef(\n  ref: string,\n): { type: ComponentType; name: string } | undefined {\n  const parts = ref.split('/');\n\n  if (parts[0] !== '#' || parts[1] !== 'components' || parts.length < 4) {\n    return undefined;\n  }\n\n  const type = parts[2];\n  const name = parts[3];\n\n  if (!COMPONENT_TYPES.includes(type as ComponentType)) {\n    return undefined;\n  }\n\n  return { type: type as ComponentType, name };\n}\n\nfunction getComponentNames(\n  refs: string[],\n  spec: OpenApiDocument,\n): { type: ComponentType; name: string }[] {\n  return refs\n    .map((ref) => parseComponentRef(ref))\n    .filter(\n      (parsed): parsed is { type: ComponentType; name: string } =>\n        !!parsed && !!spec.components?.[parsed.type]?.[parsed.name],\n    );\n}\n\nfunction resolveReferencedComponents(\n  refs: string[],\n  spec: OpenApiDocument,\n  resolved: Record<ComponentType, string[]>,\n): Record<ComponentType, string[]> {\n  const newComponents = getComponentNames(refs, spec).filter(\n    ({ type, name }) => !resolved[type].includes(name),\n  );\n\n  if (newComponents.length === 0) return resolved;\n\n  const nextResolved: Record<ComponentType, string[]> = {\n    schemas: [...resolved.schemas],\n    responses: [...resolved.responses],\n    parameters: [...resolved.parameters],\n    requestBodies: [...resolved.requestBodies],\n  };\n\n  for (const { type, name } of newComponents) {\n    nextResolved[type].push(name);\n  }\n\n  const nextRefs = newComponents.flatMap(({ type, name }) =>\n    findRefs(spec.components?.[type]?.[name]),\n  );\n\n  return resolveReferencedComponents(nextRefs, spec, nextResolved);\n}\n\nexport const collectReferencedComponents = (\n  spec: OpenApiDocument,\n  tags: (string | RegExp)[],\n  mode: InputFiltersOptions['mode'],\n): Record<ComponentType, string[]> => {\n  const filters = { tags, mode };\n  const refs = Object.values(spec.paths ?? {})\n    .filter((pathItem): pathItem is OpenApiPathItemObject => !!pathItem)\n    .flatMap((pathItem) => {\n      const verbs = filteredVerbs(pathItem, filters);\n      return [\n        ...verbs.flatMap(([, operation]) => findRefs(operation)),\n        ...findRefs(pathItem.parameters),\n      ];\n    });\n\n  return resolveReferencedComponents(refs, spec, {\n    schemas: [],\n    responses: [],\n    parameters: [],\n    requestBodies: [],\n  });\n};\n\n/**\n * Prune operations that do not reference any of the kept schemas, so only\n * artifacts related to the requested schemas are generated (#3689).\n *\n * An operation is kept when at least one of its (transitively resolved)\n * component references points at a schema matching the include/exclude\n * filters. Operations without any schema references cannot be attributed to\n * the filter and are kept as-is.\n */\nexport function filterPathsBySchemas(\n  spec: OpenApiDocument,\n  schemas: NonNullable<InputFiltersOptions['schemas']>,\n  mode: InputFiltersOptions['mode'] = 'include',\n): OpenApiDocument {\n  const keepSchemaName = (name: string): boolean => {\n    const isMatch = schemas.some((filter) => {\n      if (isString(filter)) return filter === name;\n      // Reset lastIndex so stateful flags (`g`, `y`) cannot leak between\n      // operations and wrongly reject a schema that matches.\n      filter.lastIndex = 0;\n      return filter.test(name);\n    });\n    return mode === 'exclude' ? !isMatch : isMatch;\n  };\n\n  const schemasOfRefs = (\n    refs: string[],\n    visited: Set<string> = new Set(),\n  ): { type: ComponentType; name: string }[] => {\n    const components = getComponentNames(refs, spec).filter(\n      ({ type, name }) => !visited.has(`${type}/${name}`),\n    );\n    components.forEach(({ type, name }) => visited.add(`${type}/${name}`));\n\n    return components.flatMap(({ type, name }) => {\n      if (type === 'schemas') return [{ type, name }];\n      // Resolve transitive schema references through other component\n      // sections (responses, requestBodies, parameters).\n      return schemasOfRefs(\n        findRefs(spec.components?.[type]?.[name]),\n        new Set(visited),\n      );\n    });\n  };\n\n  return {\n    ...spec,\n    paths: Object.fromEntries(\n      Object.entries(spec.paths ?? {})\n        .map(([pathRoute, pathItem]) => {\n          // oxlint-disable-next-line typescript/no-unnecessary-condition\n          if (!pathItem || typeof pathItem !== 'object') {\n            return [pathRoute, pathItem] as const;\n          }\n\n          const resolvedPathItem = !isInlineSchema(pathItem)\n            ? resolveRef<OpenApiPathItemObject>(pathItem, {\n                spec,\n              } as unknown as ContextSpec).schema\n            : pathItem;\n\n          const httpMethods = new Set([\n            'get',\n            'put',\n            'post',\n            'delete',\n            'options',\n            'head',\n            'patch',\n            'trace',\n          ]);\n\n          const keptVerbs: Record<string, unknown> = {};\n          const pathMetadata: Record<string, unknown> = {};\n          for (const [key, operation] of Object.entries(resolvedPathItem)) {\n            if (!httpMethods.has(key.toLowerCase())) {\n              // Path-item metadata (summary, description, parameters,\n              // servers, ...) is preserved as-is.\n              pathMetadata[key] = operation;\n              continue;\n            }\n            if (\n              !operation ||\n              typeof operation !== 'object' ||\n              !isInlineSchema(operation)\n            ) {\n              keptVerbs[key] = operation;\n              continue;\n            }\n            const referencedSchemas = schemasOfRefs([\n              ...findRefs(operation),\n              ...findRefs(resolvedPathItem.parameters),\n            ])\n              .filter((c) => c.type === 'schemas')\n              .map((c) => c.name);\n            if (\n              referencedSchemas.length === 0 ||\n              referencedSchemas.some(keepSchemaName)\n            ) {\n              keptVerbs[key] = operation;\n            }\n          }\n\n          if (Object.keys(keptVerbs).length === 0) {\n            return [pathRoute, undefined] as const;\n          }\n\n          return [pathRoute, { ...pathMetadata, ...keptVerbs }] as const;\n        })\n        .filter((entry): entry is [string, OpenApiPathItemObject] =>\n          Boolean(entry[1]),\n        ),\n    ),\n  };\n}\n","import type { GeneratorSchema } from '../types';\n\nexport function generateModelInline(acc: string, model: string): string {\n  return acc + `${model}\\n`;\n}\n\nexport function generateModelsInline(\n  obj: Record<string, GeneratorSchema[]> | GeneratorSchema[],\n): string {\n  const schemas = Array.isArray(obj) ? obj : Object.values(obj).flat();\n\n  let result = '';\n  for (const { model } of schemas) {\n    result = generateModelInline(result, model);\n  }\n  return result;\n}\n","import { createHash } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { Parser, type Program } from 'acorn';\nimport { build, type BuildOptions } from 'esbuild';\n\nimport type { GeneratorMutatorParsingInfo } from '../types';\n\n/**\n * `generateMutator` runs once per operation, and every operation usually shares\n * the same mutator, so without this each one re-bundled the same file (#4222).\n * Holding promises lets concurrent callers share one in-flight bundle.\n */\nconst mutatorInfoCache = new Map<\n  string,\n  Promise<GeneratorMutatorParsingInfo | undefined>\n>();\n\nexport async function getMutatorInfo(\n  filePath: string,\n  options?: {\n    root?: string;\n    namedExport?: string;\n    alias?: Record<string, string>;\n    external?: string[];\n  },\n): Promise<GeneratorMutatorParsingInfo | undefined> {\n  const {\n    root = process.cwd(),\n    namedExport = 'default',\n    alias,\n    external,\n  } = options ?? {};\n\n  // The default `external: ['*']` keeps every import, relative ones included,\n  // out of the bundle, so the entry file is its only input. A custom `external`\n  // can inline other files the key below does not track, so it is not cached.\n  if (external !== undefined) {\n    const code = await bundleFile(root, filePath, alias, external);\n    return parseFile(code, namedExport);\n  }\n\n  // Keyed on the entry file's contents, so watch mode picks up any edit, even\n  // one that leaves its mtime and size unchanged.\n  const resolvedPath = path.resolve(root, filePath);\n  const key = JSON.stringify([\n    root,\n    resolvedPath,\n    namedExport,\n    alias ?? null,\n    hashFile(resolvedPath),\n  ]);\n\n  let info = mutatorInfoCache.get(key);\n  if (!info) {\n    info = bundleFile(root, filePath, alias).then((code) =>\n      parseFile(code, namedExport),\n    );\n    mutatorInfoCache.set(key, info);\n    // Evict a failed bundle so the next call retries instead of replaying it.\n    info.catch(() => mutatorInfoCache.delete(key));\n  }\n\n  return info;\n}\n\n/** `null` for a missing file, which lets esbuild report the error. */\nfunction hashFile(filePath: string): string | null {\n  try {\n    return createHash('sha256').update(fs.readFileSync(filePath)).digest('hex');\n  } catch {\n    return null;\n  }\n}\n\n/**\n * Bundles the mutator purely so its exported function can be parsed for arity —\n * `write: false`, and the only thing read back out is `numberOfParams` /\n * `returnNumberOfParams`. None of this output reaches the generated client.\n *\n * That is why no `target` is set: esbuild defaults to `esnext`, and downleveling\n * a throwaway bundle to the project's TypeScript target has no upside and three\n * failure modes. It emitted `\"import.meta\" is not available in the configured\n * target environment` for the `es6` fallback that applied whenever\n * `compilerOptions.target` was absent — which covers a TypeScript 6+ project\n * (where an omitted `target` means *latest*, not ES2015) and a solution-style\n * `tsconfig.json` that only carries `references`. It failed outright on a low\n * target, since esbuild cannot transform `const`, `async` or default arguments\n * to `es5`. And rewriting default or rest parameters into the function body\n * changes the very arity this parse exists to measure.\n *\n * `parseFile` reads the result with `ecmaVersion: 'latest'`, so a modern bundle\n * is the safe input here, not a risky one.\n *\n * @see https://github.com/orval-labs/orval/issues/4093\n * @see https://github.com/orval-labs/orval/issues/1185\n */\nasync function bundleFile(\n  root: string,\n  fileName: string,\n  alias?: Record<string, string>,\n  external?: string[],\n): Promise<string> {\n  const result = await build({\n    absWorkingDir: root,\n    entryPoints: [fileName],\n    write: false,\n    platform: 'node',\n    bundle: true,\n    format: 'esm',\n    metafile: false,\n    minify: false,\n    minifyIdentifiers: false,\n    minifySyntax: false,\n    minifyWhitespace: false,\n    treeShaking: false,\n    keepNames: false,\n    alias,\n    external: external ?? ['*'],\n  } satisfies BuildOptions);\n  const { text } = result.outputFiles[0];\n\n  return text;\n}\n\nfunction parseFile(\n  file: string,\n  name: string,\n): GeneratorMutatorParsingInfo | undefined {\n  try {\n    // `file` is esbuild's bundled output, not the user's source. esbuild may\n    // emit any modern syntax (notably dynamic `import()`, which it preserves\n    // even when targeting es6 in ESM mode), so we parse with the latest\n    // ecmaVersion to avoid spurious SyntaxErrors that would mask the export\n    // we are looking for. See https://github.com/orval-labs/orval/issues/1634.\n    const ast = Parser.parse(file, {\n      ecmaVersion: 'latest',\n      sourceType: 'module',\n    });\n\n    const foundExport = ast.body\n      .filter((x) => x.type === 'ExportNamedDeclaration')\n      .map((declaration) => ({\n        declaration,\n        specifier: declaration.specifiers.find(\n          (specifier) =>\n            specifier.exported.type === 'Identifier' &&\n            specifier.exported.name === name &&\n            specifier.local.type === 'Identifier',\n        ),\n      }))\n      .find((item) => item.specifier);\n\n    const foundSpecifier = foundExport?.specifier;\n\n    if (foundExport && foundSpecifier && 'name' in foundSpecifier.local) {\n      const exportedFuncName = foundSpecifier.local.name;\n\n      const mutatorInfo = parseFunction(ast, exportedFuncName);\n      if (mutatorInfo) {\n        return mutatorInfo;\n      }\n\n      if (\n        foundExport.declaration.source ||\n        isImportedBinding(ast, exportedFuncName)\n      ) {\n        return standardMutatorInfo();\n      }\n    }\n  } catch {\n    return;\n  }\n}\n\nfunction isImportedBinding(ast: Program, name: string): boolean {\n  return ast.body.some((node) => {\n    if (node.type !== 'ImportDeclaration') {\n      return false;\n    }\n\n    return node.specifiers.some(\n      (specifier) => 'name' in specifier.local && specifier.local.name === name,\n    );\n  });\n}\n\n// Default for mutator exports where arity cannot be inspected:\n// factory-pattern CallExpression initializers (e.g. `axios.create({...})`)\n// and external re-exports. In both cases, the AST cannot reveal the returned\n// callable's arity, so we assume the orval standard contract:\n// a single-arg mutator invoked as `customInstance({ url, method, data, ... })`.\n// See https://github.com/orval-labs/orval/issues/3402 and\n// https://github.com/orval-labs/orval/issues/2342.\nfunction standardMutatorInfo(): GeneratorMutatorParsingInfo {\n  return { numberOfParams: 1 };\n}\n\nfunction parseFunction(\n  ast: Program,\n  funcName: string,\n): GeneratorMutatorParsingInfo | undefined {\n  const node = ast.body.find((childNode) => {\n    if (childNode.type === 'VariableDeclaration') {\n      return childNode.declarations.find(\n        (d) => d.id.type === 'Identifier' && d.id.name === funcName,\n      );\n    }\n    if (\n      childNode.type === 'FunctionDeclaration' &&\n      childNode.id.name === funcName\n    ) {\n      return childNode;\n    }\n  });\n\n  if (!node) {\n    return;\n  }\n\n  if (node.type === 'FunctionDeclaration') {\n    const returnStatement = node.body.body.find(\n      (b) => b.type === 'ReturnStatement',\n    );\n\n    // If the function directly returns an arrow function\n    if (returnStatement?.argument && 'params' in returnStatement.argument) {\n      return {\n        numberOfParams: node.params.length,\n        returnNumberOfParams: returnStatement.argument.params.length,\n      };\n      // If the function returns a CallExpression (e.g., return useCallback(...))\n    } else if (returnStatement?.argument?.type === 'CallExpression') {\n      const arrowFn = returnStatement.argument.arguments.at(0);\n      if (arrowFn?.type === 'ArrowFunctionExpression') {\n        return {\n          numberOfParams: node.params.length,\n          returnNumberOfParams: arrowFn.params.length,\n        };\n      }\n    }\n    return {\n      numberOfParams: node.params.length,\n    };\n  }\n\n  const declaration =\n    'declarations' in node\n      ? node.declarations.find(\n          (d) => d.id.type === 'Identifier' && d.id.name === funcName,\n        )\n      : undefined;\n\n  if (declaration?.init) {\n    if ('name' in declaration.init) {\n      return parseFunction(ast, declaration.init.name);\n    }\n\n    // Init is a factory CallExpression — see standardMutatorInfo() above.\n    if (declaration.init.type === 'CallExpression') {\n      return standardMutatorInfo();\n    }\n\n    if (\n      'body' in declaration.init &&\n      'params' in declaration.init &&\n      declaration.init.body.type === 'ArrowFunctionExpression'\n    ) {\n      return {\n        numberOfParams: declaration.init.params.length,\n        returnNumberOfParams: declaration.init.body.params.length,\n      };\n    }\n\n    const returnStatement =\n      'body' in declaration.init &&\n      'body' in declaration.init.body &&\n      Array.isArray(declaration.init.body.body)\n        ? declaration.init.body.body.find((b) => b.type === 'ReturnStatement')\n        : undefined;\n\n    if ('params' in declaration.init) {\n      if (returnStatement?.argument && 'params' in returnStatement.argument) {\n        return {\n          numberOfParams: declaration.init.params.length,\n          returnNumberOfParams: returnStatement.argument.params.length,\n        };\n      } else if (\n        returnStatement?.argument?.type === 'CallExpression' &&\n        returnStatement.argument.arguments[0]?.type ===\n          'ArrowFunctionExpression'\n      ) {\n        const arrowFn = returnStatement.argument.arguments[0];\n        return {\n          numberOfParams: declaration.init.params.length,\n          returnNumberOfParams: arrowFn.params.length,\n        };\n      }\n\n      return {\n        numberOfParams: declaration.init.params.length,\n      };\n    }\n  }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { styleText } from 'node:util';\n\nimport type { GeneratorMutator, NormalizedMutator, Tsconfig } from '../types';\nimport { getFileInfo, getImportExtension, pascal, upath } from '../utils';\nimport { getMutatorInfo } from './mutator-info';\n\nexport const BODY_TYPE_NAME = 'BodyType';\n\nconst getImport = (\n  output: string,\n  mutator: NormalizedMutator,\n  tsconfig?: Tsconfig,\n) => {\n  if (mutator.resolvedPath || !path.isAbsolute(mutator.path)) {\n    return mutator.path;\n  }\n\n  const outputFile = getFileInfo(output).path;\n  // When the user hasn't pinned `mutator.extension`, derive it from the\n  // mutator file's own extension so NodeNext / Node16 projects get the\n  // required `.js` (`.mjs`/`.cjs`/`.jsx`) suffix on the relative import.\n  // `path.extname` reads the real extension; `getFileInfo().extension` only\n  // echoes its (`.ts`-defaulting) input parameter.\n  const ext =\n    mutator.extension ??\n    getImportExtension(path.extname(mutator.path), tsconfig);\n  return `${upath.getRelativeImportPath(outputFile, mutator.path)}${ext}`;\n};\n\ninterface GenerateMutatorOptions {\n  output?: string;\n  mutator?: NormalizedMutator;\n  name: string;\n  workspace: string;\n  tsconfig?: Tsconfig;\n}\n\nexport async function generateMutator({\n  output,\n  mutator,\n  name,\n  workspace,\n  tsconfig,\n}: GenerateMutatorOptions): Promise<GeneratorMutator | undefined> {\n  if (!mutator || !output) {\n    return;\n  }\n  const isDefault = mutator.default;\n  const importName = mutator.name ?? `${name}Mutator`;\n  const importPath = mutator.path;\n  const inspectionPath = mutator.resolvedPath ?? mutator.path;\n  const mutatorInfoName = isDefault ? 'default' : mutator.name;\n\n  if (mutatorInfoName === undefined) {\n    throw new Error(\n      styleText(\n        'red',\n        `Mutator ${importPath} must have a named or default export.`,\n      ),\n    );\n  }\n\n  let rawFile = path.isAbsolute(inspectionPath)\n    ? await fs.promises.readFile(inspectionPath, 'utf8')\n    : '';\n  rawFile = removeComments(rawFile);\n\n  const hasErrorType =\n    !!rawFile &&\n    (rawFile.includes('export type ErrorType') ||\n      rawFile.includes('export interface ErrorType'));\n\n  const hasBodyType =\n    !!rawFile &&\n    (rawFile.includes(`export type ${BODY_TYPE_NAME}`) ||\n      rawFile.includes(`export interface ${BODY_TYPE_NAME}`));\n\n  const errorTypeName = mutator.default\n    ? `${pascal(name)}ErrorType`\n    : 'ErrorType';\n\n  const bodyTypeName = mutator.default\n    ? `${pascal(name)}${BODY_TYPE_NAME}`\n    : BODY_TYPE_NAME;\n\n  // No `tsconfig` here: the inspection bundle is discarded after its arity is\n  // read, so it is built at esbuild's default target rather than the project's.\n  // See the note on `bundleFile`.\n  const mutatorInfo = await getMutatorInfo(inspectionPath, {\n    root: workspace,\n    namedExport: mutatorInfoName,\n    alias: mutator.alias,\n    external: mutator.external,\n  });\n\n  if (!mutatorInfo) {\n    throw new Error(\n      styleText(\n        'red',\n        `Your mutator file doesn't have the ${mutatorInfoName} exported function`,\n      ),\n    );\n  }\n\n  const importStatementPath = getImport(output, mutator, tsconfig);\n\n  const isHook = mutator.name\n    ? mutator.name.startsWith('use') && !mutatorInfo.numberOfParams\n    : !mutatorInfo.numberOfParams;\n\n  return {\n    name: mutator.name || !isHook ? importName : `use${pascal(importName)}`,\n    path: importStatementPath,\n    default: isDefault,\n    hasErrorType,\n    errorTypeName,\n    hasSecondArg: isHook\n      ? (mutatorInfo.returnNumberOfParams ?? 0) > 1\n      : mutatorInfo.numberOfParams > 1,\n    hasThirdArg: mutatorInfo.numberOfParams > 2,\n    isHook,\n    useHooks: mutator.useHooks,\n    inferred: mutator.inferred,\n    ...(hasBodyType ? { bodyTypeName } : {}),\n  };\n}\n\nfunction removeComments(file: string) {\n  // Regular expression to match single-line and multi-line comments\n  const commentRegex = /\\/\\/.*|\\/\\*[\\s\\S]*?\\*\\//g;\n\n  // Remove comments from the rawFile string\n  const cleanedFile = file.replaceAll(commentRegex, '');\n\n  return cleanedFile;\n}\n","import { getSuccessResponseType } from '../getters/res-req-types';\nimport {\n  type GeneratorMutator,\n  type GeneratorSchema,\n  type GetterBody,\n  type GetterQueryParam,\n  type GetterResponse,\n  type ParamsSerializerOptions,\n  Verbs,\n} from '../types';\nimport {\n  getIsBodyVerb,\n  isObject,\n  jsStringLiteralEscape,\n  stringify,\n} from '../utils';\n\n/**\n * Per-parameter Angular query-object serialization strategy, mirroring\n * {@link GetterQueryParam.objectQueryParams}. See issue #3705.\n */\nexport type AngularObjectParamStrategy = 'flatten' | 'comma' | 'deepObject';\n\n/**\n * Filters query params for Angular's HttpClient.\n *\n * Why: Angular's HttpParams / HttpClient `params` type does not accept `null` or\n * `undefined` values, and arrays must only contain string/number/boolean.\n * Orval models often include nullable query params, so we remove nullish values\n * (including nulls inside arrays) before passing params to HttpClient or a\n * paramsSerializer to avoid runtime and type issues.\n *\n * Required-nullable params (spec `required: true` + `nullable: true`) are the\n * exception: dropping them silently would violate the OpenAPI contract. When a\n * `paramsSerializer` is configured (preserveRequiredNullables), a `null` value\n * is preserved for the serializer to encode. Without a serializer, `null` is\n * instead emitted as an empty string (`''`, wire form `?key=`) so the key\n * still reaches the request. See #3712.\n *\n * Returns an inline IIFE expression. For paths that benefit from a shared helper\n * (e.g. observe-mode branches), prefer getAngularFilteredParamsCallExpression +\n * getAngularFilteredParamsHelperBody instead.\n */\nexport const getAngularFilteredParamsExpression = (\n  paramsExpression: string,\n  requiredNullableParamKeys: string[] = [],\n  preserveRequiredNullables = false,\n  nonPrimitiveKeys: string[] = [],\n  objectParamStrategies: Readonly<\n    Record<string, AngularObjectParamStrategy>\n  > = {},\n): string => {\n  const hasPassthrough = nonPrimitiveKeys.length > 0;\n  const hasObjectStrategies = Object.keys(objectParamStrategies).length > 0;\n  const filteredParamValueType = hasPassthrough\n    ? 'unknown'\n    : `string | number | boolean${preserveRequiredNullables ? ' | null' : ''} | Array<string | number | boolean>`;\n  const passthroughBranch = hasPassthrough\n    ? `    if (passthroughKeys.has(key)) {\n      if (value !== undefined) {\n        filteredParams[key] = value;\n      }\n      continue;\n    }\n`\n    : '';\n\n  const objectStrategyBranch = hasObjectStrategies\n    ? `    if (\n      value != null &&\n      typeof value === 'object' &&\n      !Array.isArray(value) &&\n      Object.prototype.hasOwnProperty.call(objectParamStrategies, key)\n    ) {\n      const objectStrategy = objectParamStrategies[key];\n      const entries = Object.entries(value as Record<string, unknown>);\n      if (objectStrategy === 'comma') {\n        const commaParts: string[] = [];\n        for (const [prop, propValue] of entries) {\n          if (Array.isArray(propValue)) {\n            const filteredItems = propValue.filter(\n              (item) =>\n                item != null &&\n                (typeof item === 'string' ||\n                  typeof item === 'number' ||\n                  typeof item === 'boolean'),\n            ) as Array<string | number | boolean>;\n            if (filteredItems.length) {\n              commaParts.push(prop, ...filteredItems.map(String));\n            }\n          } else if (\n            propValue != null &&\n            (typeof propValue === 'string' ||\n              typeof propValue === 'number' ||\n              typeof propValue === 'boolean')\n          ) {\n            commaParts.push(prop, String(propValue));\n          } else if (\n            propValue instanceof Date &&\n            !Number.isNaN(propValue.getTime())\n          ) {\n            commaParts.push(prop, propValue.toISOString());\n          }\n        }\n        if (commaParts.length) {\n          filteredParams[key] = commaParts.join(',');\n        }\n      } else {\n        for (const [prop, propValue] of entries) {\n          const targetKey =\n            objectStrategy === 'deepObject' ? key + '[' + prop + ']' : prop;\n          if (Array.isArray(propValue)) {\n            const filteredProp = propValue.filter(\n              (item) =>\n                item != null &&\n                (typeof item === 'string' ||\n                  typeof item === 'number' ||\n                  typeof item === 'boolean'),\n            ) as Array<string | number | boolean>;\n            if (filteredProp.length) {\n              filteredParams[targetKey] = filteredProp;\n            }\n          } else if (\n            propValue != null &&\n            (typeof propValue === 'string' ||\n              typeof propValue === 'number' ||\n              typeof propValue === 'boolean')\n          ) {\n            filteredParams[targetKey] = propValue;\n          } else if (\n            propValue instanceof Date &&\n            !Number.isNaN(propValue.getTime())\n          ) {\n            filteredParams[targetKey] = propValue.toISOString();\n          }\n        }\n      }\n      continue;\n    }\n`\n    : '';\n\n  // With a downstream paramsSerializer (preserveRequiredNullables) the\n  // literal `null` is preserved for it to consume; without one, `null`\n  // becomes an empty string so the required key still reaches the wire as\n  // `?key=` instead of being silently dropped (#3712). The Set declaration\n  // is only emitted when the branch that reads it is emitted, otherwise\n  // TypeScript reports TS6133 (see #3593).\n  const emitRequiredNullableBranch =\n    preserveRequiredNullables || requiredNullableParamKeys.length > 0;\n  const preserveNullableBranch = emitRequiredNullableBranch\n    ? `    } else if (value === null && requiredNullableParamKeys.has(key)) {\n      filteredParams[key] = ${preserveRequiredNullables ? 'null' : \"''\"};\n`\n    : '';\n  const requiredNullableParamKeysBranch = emitRequiredNullableBranch\n    ? `const requiredNullableParamKeys = new Set<string>(${JSON.stringify(requiredNullableParamKeys)});`\n    : '';\n\n  const scalarBranch = `    } else if (\n      (value as unknown) instanceof Date &&\n      !Number.isNaN((value as unknown as Date).getTime())\n    ) {\n      // useDates produces Date query params; serialize to ISO so they reach\n      // the wire instead of being dropped by the primitive check below. See #3856.\n      filteredParams[key] = (value as unknown as Date).toISOString();\n    } else if (\n      value != null &&\n      (typeof value === 'string' ||\n        typeof value === 'number' ||\n        typeof value === 'boolean')\n    ) {\n      filteredParams[key] = value;\n    }\n`;\n  const passthroughDecl = hasPassthrough\n    ? `  const passthroughKeys = new Set<string>(${JSON.stringify(nonPrimitiveKeys)});\\n`\n    : '';\n  const objectStrategiesDecl = hasObjectStrategies\n    ? `  const objectParamStrategies: Readonly<Record<string, 'flatten' | 'comma' | 'deepObject'>> = ${JSON.stringify(objectParamStrategies)};\\n`\n    : '';\n\n  return `(() => {\n${passthroughDecl}${objectStrategiesDecl}  ${requiredNullableParamKeysBranch}\n  const filteredParams: Record<string, ${filteredParamValueType}> = {};\n  for (const [key, value] of Object.entries(${paramsExpression})) {\n${passthroughBranch}${objectStrategyBranch}    if (Array.isArray(value)) {\n      const filtered = value\n        .filter(\n          (item) =>\n            item != null &&\n            (typeof item === 'string' ||\n              typeof item === 'number' ||\n              typeof item === 'boolean' ||\n              ((item as unknown) instanceof Date &&\n                !Number.isNaN((item as unknown as Date).getTime()))),\n        )\n        .map((item) =>\n          (item as unknown) instanceof Date\n            ? (item as unknown as Date).toISOString()\n            : item,\n        ) as Array<string | number | boolean>;\n      if (filtered.length) {\n        filteredParams[key] = filtered;\n      }\n${preserveNullableBranch}${scalarBranch}  }\n  return filteredParams;\n})()`;\n};\n\n/**\n * Returns the body of a standalone `filterParams` helper function\n * to be emitted once in the generated file header, replacing the\n * inline IIFE that was previously duplicated in every method.\n *\n * Pass `{ hasObjectParams: true }` only when at least one operation in the\n * file actually needs the object-serialization overload (issue #3705) —\n * with the flag omitted/false this returns the exact same string as before\n * that feature existed, so files without object query params see zero\n * helper churn.\n *\n * Required-nullable handling: a query param that the spec marks both\n * `required` and `nullable` must still reach the wire when its runtime\n * value is `null`, or the request violates the OpenAPI contract. When a\n * `paramsSerializer` is configured (preserveRequiredNullables), the literal\n * `null` is preserved for the serializer to encode. Without a serializer,\n * `null` is instead emitted as an empty string (`''`, wire form `?key=`) so\n * the key is not silently dropped. See #3712.\n */\nexport const getAngularFilteredParamsHelperBody = ({\n  hasObjectParams = false,\n}: { hasObjectParams?: boolean } = {}): string => {\n  if (!hasObjectParams) {\n    return `type AngularHttpParamValue = string | number | boolean | Array<string | number | boolean>;\ntype AngularHttpParamValueWithNullable = AngularHttpParamValue | null;\n\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys?: ReadonlySet<string>,\n  preserveRequiredNullables?: false,\n  passthroughKeys?: undefined,\n): Record<string, AngularHttpParamValue>;\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys: ReadonlySet<string> | undefined,\n  preserveRequiredNullables: true,\n  passthroughKeys?: undefined,\n): Record<string, AngularHttpParamValueWithNullable>;\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys: ReadonlySet<string> | undefined,\n  preserveRequiredNullables: boolean | undefined,\n  passthroughKeys: ReadonlySet<string>,\n): Record<string, unknown>;\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys: ReadonlySet<string> = new Set(),\n  preserveRequiredNullables = false,\n  passthroughKeys: ReadonlySet<string> = new Set(),\n): Record<string, unknown> {\n  const filteredParams: Record<string, unknown> = {};\n  for (const [key, value] of Object.entries(params)) {\n    if (passthroughKeys.has(key)) {\n      if (value !== undefined) {\n        filteredParams[key] = value;\n      }\n      continue;\n    }\n    if (Array.isArray(value)) {\n      const filtered = value\n        .filter(\n          (item) =>\n            item != null &&\n            (typeof item === 'string' ||\n              typeof item === 'number' ||\n              typeof item === 'boolean' ||\n              (item instanceof Date && !Number.isNaN(item.getTime()))),\n        )\n        .map((item) =>\n          item instanceof Date ? item.toISOString() : item,\n        ) as Array<string | number | boolean>;\n      if (filtered.length) {\n        filteredParams[key] = filtered;\n      }\n    } else if (value === null && requiredNullableKeys.has(key)) {\n      // With a paramsSerializer (preserveRequiredNullables) the literal null\n      // is passed through for it to consume; without one, emit an empty\n      // string so the required key still reaches the wire as \\`?key=\\`\n      // instead of being silently dropped. See #3712.\n      filteredParams[key] = preserveRequiredNullables ? null : '';\n    } else if (value instanceof Date && !Number.isNaN(value.getTime())) {\n      // useDates produces Date query params; serialize to ISO so they reach\n      // the wire instead of being dropped by the primitive check below. See #3856.\n      filteredParams[key] = value.toISOString();\n    } else if (\n      value != null &&\n      (typeof value === 'string' ||\n        typeof value === 'number' ||\n        typeof value === 'boolean')\n    ) {\n      filteredParams[key] = value;\n    }\n  }\n  return filteredParams;\n}`;\n  }\n\n  return `type AngularHttpParamValue = string | number | boolean | Array<string | number | boolean>;\ntype AngularHttpParamValueWithNullable = AngularHttpParamValue | null;\ntype AngularObjectParamStrategy = 'flatten' | 'comma' | 'deepObject';\n\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys?: ReadonlySet<string>,\n  preserveRequiredNullables?: false,\n  passthroughKeys?: undefined,\n): Record<string, AngularHttpParamValue>;\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys: ReadonlySet<string> | undefined,\n  preserveRequiredNullables: true,\n  passthroughKeys?: undefined,\n): Record<string, AngularHttpParamValueWithNullable>;\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys: ReadonlySet<string> | undefined,\n  preserveRequiredNullables: boolean | undefined,\n  passthroughKeys: ReadonlySet<string>,\n): Record<string, unknown>;\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys: ReadonlySet<string> | undefined,\n  preserveRequiredNullables: boolean | undefined,\n  passthroughKeys: ReadonlySet<string> | undefined,\n  objectParamStrategies: Readonly<Record<string, AngularObjectParamStrategy>>,\n): Record<string, AngularHttpParamValue>;\nfunction filterParams(\n  params: Record<string, unknown>,\n  requiredNullableKeys: ReadonlySet<string> = new Set(),\n  preserveRequiredNullables = false,\n  passthroughKeys: ReadonlySet<string> = new Set(),\n  objectParamStrategies: Readonly<Record<string, AngularObjectParamStrategy>> = {},\n): Record<string, unknown> {\n  const filteredParams: Record<string, unknown> = {};\n  const filterPrimitiveArray = (\n    value: unknown[],\n  ): Array<string | number | boolean> =>\n    value\n      .filter(\n        (item) =>\n          item != null &&\n          (typeof item === 'string' ||\n            typeof item === 'number' ||\n            typeof item === 'boolean' ||\n            (item instanceof Date && !Number.isNaN(item.getTime()))),\n      )\n      .map((item) => (item instanceof Date ? item.toISOString() : item)) as Array<\n      string | number | boolean\n    >;\n  for (const [key, value] of Object.entries(params)) {\n    if (passthroughKeys.has(key)) {\n      if (value !== undefined) {\n        filteredParams[key] = value;\n      }\n      continue;\n    }\n    if (\n      value != null &&\n      typeof value === 'object' &&\n      !Array.isArray(value) &&\n      Object.prototype.hasOwnProperty.call(objectParamStrategies, key)\n    ) {\n      const objectStrategy = objectParamStrategies[key];\n      const entries = Object.entries(value as Record<string, unknown>);\n      if (objectStrategy === 'comma') {\n        const commaParts: string[] = [];\n        for (const [prop, propValue] of entries) {\n          if (Array.isArray(propValue)) {\n            const filteredItems = filterPrimitiveArray(propValue);\n            if (filteredItems.length) {\n              commaParts.push(prop, ...filteredItems.map(String));\n            }\n          } else if (\n            propValue != null &&\n            (typeof propValue === 'string' ||\n              typeof propValue === 'number' ||\n              typeof propValue === 'boolean')\n          ) {\n            commaParts.push(prop, String(propValue));\n          } else if (\n            propValue instanceof Date &&\n            !Number.isNaN(propValue.getTime())\n          ) {\n            commaParts.push(prop, propValue.toISOString());\n          }\n        }\n        if (commaParts.length) {\n          filteredParams[key] = commaParts.join(',');\n        }\n      } else {\n        for (const [prop, propValue] of entries) {\n          const targetKey =\n            objectStrategy === 'deepObject' ? key + '[' + prop + ']' : prop;\n          if (Array.isArray(propValue)) {\n            const filteredProp = filterPrimitiveArray(propValue);\n            if (filteredProp.length) {\n              filteredParams[targetKey] = filteredProp;\n            }\n          } else if (\n            propValue != null &&\n            (typeof propValue === 'string' ||\n              typeof propValue === 'number' ||\n              typeof propValue === 'boolean')\n          ) {\n            filteredParams[targetKey] = propValue;\n          } else if (\n            propValue instanceof Date &&\n            !Number.isNaN(propValue.getTime())\n          ) {\n            filteredParams[targetKey] = propValue.toISOString();\n          }\n        }\n      }\n      continue;\n    }\n    if (Array.isArray(value)) {\n      const filtered = filterPrimitiveArray(value);\n      if (filtered.length) {\n        filteredParams[key] = filtered;\n      }\n    } else if (value === null && requiredNullableKeys.has(key)) {\n      // With a paramsSerializer (preserveRequiredNullables) the literal null\n      // is passed through for it to consume; without one, emit an empty\n      // string so the required key still reaches the wire as \\`?key=\\`\n      // instead of being silently dropped. See #3712.\n      filteredParams[key] = preserveRequiredNullables ? null : '';\n    } else if (value instanceof Date && !Number.isNaN(value.getTime())) {\n      // useDates produces Date query params; serialize to ISO so they reach\n      // the wire instead of being dropped by the primitive check below. See #3856.\n      filteredParams[key] = value.toISOString();\n    } else if (\n      value != null &&\n      (typeof value === 'string' ||\n        typeof value === 'number' ||\n        typeof value === 'boolean')\n    ) {\n      filteredParams[key] = value;\n    }\n  }\n  return filteredParams;\n}`;\n};\n\n/**\n * Returns a call expression to the `filterParams` helper function.\n */\nexport const getAngularFilteredParamsCallExpression = (\n  paramsExpression: string,\n  requiredNullableParamKeys: string[] = [],\n  preserveRequiredNullables = false,\n  nonPrimitiveKeys: string[] = [],\n  objectParamStrategies: Readonly<\n    Record<string, AngularObjectParamStrategy>\n  > = {},\n): string => {\n  const baseArgs = `${paramsExpression}, new Set<string>(${JSON.stringify(requiredNullableParamKeys)})`;\n  const hasObjectStrategies = Object.keys(objectParamStrategies).length > 0;\n  if (hasObjectStrategies) {\n    return `filterParams(${baseArgs}, ${preserveRequiredNullables}, new Set<string>(${JSON.stringify(nonPrimitiveKeys)}), ${JSON.stringify(objectParamStrategies)} as const)`;\n  }\n  if (nonPrimitiveKeys.length > 0) {\n    return `filterParams(${baseArgs}, ${preserveRequiredNullables}, new Set<string>(${JSON.stringify(nonPrimitiveKeys)}))`;\n  }\n  return `filterParams(${baseArgs}${preserveRequiredNullables ? ', true' : ''})`;\n};\n\n/**\n * Returns the filter call/IIFE used to massage query params before passing\n * them to Angular's HttpParams. When the user supplied a `paramsFilter`\n * mutator, the built-in `filterParams` is bypassed entirely and the user's\n * function is called with the raw params — they own nullish-stripping and\n * any object/array handling. Otherwise the built-in filter is used (either\n * the shared helper or an inline IIFE), and callers should only pass\n * `nonPrimitiveKeys` when a downstream serializer or custom consumer can\n * legally handle raw object/array values.\n */\nexport const buildAngularParamsFilterExpression = ({\n  paramsExpression,\n  requiredNullableParamKeys = [],\n  preserveRequiredNullables = false,\n  nonPrimitiveKeys = [],\n  objectParamStrategies = {},\n  paramsFilter,\n  useSharedHelper,\n}: {\n  paramsExpression: string;\n  requiredNullableParamKeys?: string[];\n  preserveRequiredNullables?: boolean;\n  nonPrimitiveKeys?: string[];\n  objectParamStrategies?: Readonly<Record<string, AngularObjectParamStrategy>>;\n  paramsFilter?: GeneratorMutator;\n  useSharedHelper: boolean;\n}): string => {\n  if (paramsFilter) {\n    return `${paramsFilter.name}(${paramsExpression})`;\n  }\n  if (useSharedHelper) {\n    return getAngularFilteredParamsCallExpression(\n      paramsExpression,\n      requiredNullableParamKeys,\n      preserveRequiredNullables,\n      nonPrimitiveKeys,\n      objectParamStrategies,\n    );\n  }\n  return getAngularFilteredParamsExpression(\n    paramsExpression,\n    requiredNullableParamKeys,\n    preserveRequiredNullables,\n    nonPrimitiveKeys,\n    objectParamStrategies,\n  );\n};\n\n/**\n * Computes the gated object-serialization strategy map for a single\n * operation's query params (issue #3705).\n *\n * Strategies are suppressed — returning `{}`, restoring the pre-#3705\n * dropping behavior — whenever:\n * - a `paramsFilter` mutator is configured (it bypasses the built-in filter\n *   entirely and owns raw object/array handling itself), or\n * - a `paramsSerializer` mutator is configured (it receives the raw object\n *   via the existing `nonPrimitiveKeys` passthrough instead), or\n * - `override.angular.queryObjectSerialization` is `'legacy'`.\n */\nexport const getAngularObjectParamStrategies = ({\n  queryParams,\n  paramsSerializer,\n  paramsFilter,\n  queryObjectSerialization,\n}: {\n  queryParams?: GetterQueryParam;\n  paramsSerializer?: GeneratorMutator;\n  paramsFilter?: GeneratorMutator;\n  queryObjectSerialization: 'spec' | 'legacy';\n}): Readonly<Record<string, AngularObjectParamStrategy>> => {\n  if (\n    paramsFilter ||\n    paramsSerializer ||\n    queryObjectSerialization === 'legacy' ||\n    !queryParams?.objectQueryParams?.length\n  ) {\n    return {};\n  }\n  return Object.fromEntries(\n    queryParams.objectQueryParams.map(({ key, strategy }) => [key, strategy]),\n  );\n};\n\ninterface GenerateFormDataAndUrlEncodedFunctionOptions {\n  body: GetterBody;\n  formData?: GeneratorMutator;\n  formUrlEncoded?: GeneratorMutator;\n  isFormData: boolean;\n  isFormUrlEncoded: boolean;\n}\n\nexport function generateBodyOptions(\n  body: GetterBody,\n  isFormData: boolean,\n  isFormUrlEncoded: boolean,\n): string | undefined {\n  if (isFormData && body.formData) {\n    return 'formData';\n  }\n\n  if (isFormUrlEncoded && body.formUrlEncoded) {\n    return 'formUrlEncoded';\n  }\n\n  if (body.implementation) {\n    return body.implementation;\n  }\n\n  return undefined;\n}\n\ninterface GenerateAxiosOptions {\n  response: GetterResponse;\n  isExactOptionalPropertyTypes: boolean;\n  angularObserve?: 'body' | 'events' | 'response';\n  angularParamsRef?: string;\n  requiredNullableQueryParamKeys?: string[];\n  nonPrimitiveQueryParamKeys?: string[];\n  objectQueryParamStrategies?: Readonly<\n    Record<string, AngularObjectParamStrategy>\n  >;\n  queryParams?: GeneratorSchema;\n  headers?: GeneratorSchema;\n  requestOptions?: object | boolean;\n  hasSignal: boolean;\n  hasSignalParam?: boolean;\n  isAngular: boolean;\n  paramsSerializer?: GeneratorMutator;\n  paramsSerializerOptions?: ParamsSerializerOptions;\n  paramsFilter?: GeneratorMutator;\n}\n\ninterface GenerateAxiosUrlOptions {\n  functionName: string;\n  propsImplementation: string;\n  route: string;\n  axiosRef: string;\n  hasQueryParams: boolean;\n  beforeReturn?: string;\n  paramsSerializer?: string;\n  paramsSerializerOptions?: ParamsSerializerOptions;\n}\n\n/**\n * Generates an Axios URL helper without applying runtime request options.\n *\n * Axios owns query-string serialization, so getUri is used to keep the helper\n * aligned with the request's paramsSerializer and Axios defaults. A derived\n * instance clears default params while retaining the configured serializer;\n * an empty baseURL keeps the helper's result at the generated OpenAPI route\n * instead of turning it into the final transport URL for a configured Axios\n * instance.\n */\nexport function generateAxiosUrl({\n  functionName,\n  propsImplementation,\n  route,\n  axiosRef,\n  hasQueryParams,\n  beforeReturn,\n  paramsSerializer,\n  paramsSerializerOptions,\n}: GenerateAxiosUrlOptions) {\n  const serializer = paramsSerializer\n    ? `paramsSerializer: ${paramsSerializer},`\n    : paramsSerializerOptions?.qs\n      ? `paramsSerializer: (params) => qs.stringify(params, ${JSON.stringify(paramsSerializerOptions.qs)}),`\n      : '';\n\n  return `export const ${functionName} = (${propsImplementation}) => {\n    ${beforeReturn ?? ''}\n  return ${axiosRef}.create({\n    baseURL: '',\n    params: null,\n  }).getUri({\n    url: \\`${route}\\`,\n    baseURL: '',\n    ${hasQueryParams ? 'params,' : ''}\n    ${serializer}\n  });\n}\n`;\n}\n\nexport function generateAxiosOptions({\n  response,\n  isExactOptionalPropertyTypes,\n  angularObserve,\n  angularParamsRef,\n  requiredNullableQueryParamKeys,\n  nonPrimitiveQueryParamKeys,\n  objectQueryParamStrategies,\n  queryParams,\n  headers,\n  requestOptions,\n  hasSignal,\n  hasSignalParam = false,\n  isAngular,\n  paramsSerializer,\n  paramsSerializerOptions,\n  paramsFilter,\n}: GenerateAxiosOptions) {\n  const isRequestOptions = requestOptions !== false;\n  const angularPassthroughQueryParamKeys = paramsSerializer\n    ? nonPrimitiveQueryParamKeys\n    : [];\n  // Object-serialization strategies (issue #3705) are, like the passthrough\n  // keys above, only meaningful when there's no downstream `paramsSerializer`\n  // to hand the raw object to — a configured serializer always wins and\n  // receives the untouched value instead.\n  const angularObjectParamStrategies = paramsSerializer\n    ? {}\n    : (objectQueryParamStrategies ?? {});\n  // Use querySignal if API has a param named \"signal\" to avoid conflict\n  const signalVar = hasSignalParam ? 'querySignal' : 'signal';\n  const signalProp = hasSignalParam ? `signal: ${signalVar}` : 'signal';\n\n  if (\n    !queryParams &&\n    !headers &&\n    !response.isBlob &&\n    response.definition.success !== 'string'\n  ) {\n    if (isRequestOptions) {\n      return isAngular\n        ? angularObserve\n          ? `{\n        ...(options as Omit<NonNullable<typeof options>, 'observe'>),\n        observe: '${angularObserve}',\n      }`\n          : \"(options as Omit<NonNullable<typeof options>, 'observe'>)\"\n        : 'options';\n    }\n    if (hasSignal) {\n      return isExactOptionalPropertyTypes\n        ? `...(${signalVar} ? { ${signalProp} } : {})`\n        : signalProp;\n    }\n    return '';\n  }\n\n  let value = '';\n\n  if (!isRequestOptions) {\n    if (queryParams) {\n      if (isAngular) {\n        const iifeExpr = buildAngularParamsFilterExpression({\n          paramsExpression: 'params ?? {}',\n          requiredNullableParamKeys: requiredNullableQueryParamKeys,\n          preserveRequiredNullables: !!paramsSerializer,\n          nonPrimitiveKeys: angularPassthroughQueryParamKeys,\n          objectParamStrategies: angularObjectParamStrategies,\n          paramsFilter,\n          useSharedHelper: false,\n        });\n        value += paramsSerializer\n          ? `\\n        params: ${paramsSerializer.name}(${iifeExpr}),`\n          : `\\n        params: ${iifeExpr},`;\n      } else {\n        value += '\\n        params,';\n      }\n    }\n\n    if (headers) {\n      value += '\\n        headers,';\n    }\n\n    if (hasSignal) {\n      value += isExactOptionalPropertyTypes\n        ? `\\n        ...(${signalVar} ? { ${signalProp} } : {}),`\n        : `\\n        ${signalProp},`;\n    }\n  }\n\n  if (\n    !isObject(requestOptions) ||\n    !Object.hasOwn(requestOptions, 'responseType')\n  ) {\n    const successResponseType = getSuccessResponseType(response);\n    if (successResponseType) {\n      value += `\\n        responseType: '${successResponseType}',`;\n    }\n  }\n\n  if (isObject(requestOptions)) {\n    value += `\\n ${stringify(requestOptions)?.slice(1, -1)}`;\n  }\n\n  if (isRequestOptions) {\n    value += isAngular\n      ? \"\\n    ...(options as Omit<NonNullable<typeof options>, 'observe'>),\"\n      : '\\n    ...options,';\n\n    if (isAngular && angularObserve) {\n      value += `\\n        observe: '${angularObserve}',`;\n    }\n\n    if (queryParams) {\n      if (isAngular && angularParamsRef) {\n        value += `\\n        params: ${angularParamsRef},`;\n      } else if (isAngular && paramsSerializer) {\n        const callExpr = buildAngularParamsFilterExpression({\n          paramsExpression: '{...params, ...options?.params}',\n          requiredNullableParamKeys: requiredNullableQueryParamKeys,\n          preserveRequiredNullables: true,\n          nonPrimitiveKeys: angularPassthroughQueryParamKeys,\n          objectParamStrategies: angularObjectParamStrategies,\n          paramsFilter,\n          useSharedHelper: true,\n        });\n        value += `\\n        params: ${paramsSerializer.name}(${callExpr}),`;\n      } else if (isAngular) {\n        const callExpr = buildAngularParamsFilterExpression({\n          paramsExpression: '{...params, ...options?.params}',\n          requiredNullableParamKeys: requiredNullableQueryParamKeys,\n          nonPrimitiveKeys: angularPassthroughQueryParamKeys,\n          objectParamStrategies: angularObjectParamStrategies,\n          paramsFilter,\n          useSharedHelper: true,\n        });\n        value += `\\n        params: ${callExpr},`;\n      } else {\n        value += '\\n        params: {...params, ...options?.params},';\n      }\n    }\n\n    if (headers) {\n      value += '\\n        headers: {...headers, ...options?.headers},';\n    }\n  }\n\n  if (\n    !isAngular &&\n    queryParams &&\n    (paramsSerializer || paramsSerializerOptions?.qs)\n  ) {\n    const qsOptions = paramsSerializerOptions?.qs;\n    value += paramsSerializer\n      ? `\\n        paramsSerializer: ${paramsSerializer.name},`\n      : `\\n        paramsSerializer: (params) => qs.stringify(params, ${JSON.stringify(\n          qsOptions,\n        )}),`;\n  }\n\n  return value;\n}\n\ninterface GenerateOptionsOptions {\n  route: string;\n  body: GetterBody;\n  angularObserve?: 'body' | 'events' | 'response';\n  angularParamsRef?: string;\n  headers?: GetterQueryParam;\n  queryParams?: GetterQueryParam;\n  /**\n   * Per-parameter object-serialization strategies (issue #3705), already\n   * gated by the caller for `override.angular.queryObjectSerialization` and\n   * any configured `paramsFilter`/`paramsSerializer`.\n   */\n  objectQueryParamStrategies?: Readonly<\n    Record<string, AngularObjectParamStrategy>\n  >;\n  response: GetterResponse;\n  verb: Verbs;\n  requestOptions?: object | boolean;\n  isFormData: boolean;\n  isFormUrlEncoded: boolean;\n  isAngular?: boolean;\n  isExactOptionalPropertyTypes: boolean;\n  hasSignal: boolean;\n  hasSignalParam?: boolean;\n  paramsSerializer?: GeneratorMutator;\n  paramsSerializerOptions?: ParamsSerializerOptions;\n  paramsFilter?: GeneratorMutator;\n}\n\nexport function generateOptions({\n  route,\n  body,\n  angularObserve,\n  angularParamsRef,\n  headers,\n  queryParams,\n  objectQueryParamStrategies,\n  response,\n  verb,\n  requestOptions,\n  isFormData,\n  isFormUrlEncoded,\n  isAngular,\n  isExactOptionalPropertyTypes,\n  hasSignal,\n  hasSignalParam,\n  paramsSerializer,\n  paramsSerializerOptions,\n  paramsFilter,\n}: GenerateOptionsOptions) {\n  const bodyIdentifier = getIsBodyVerb(verb)\n    ? generateBodyOptions(body, isFormData, isFormUrlEncoded)\n    : undefined;\n\n  const axiosOptions = generateAxiosOptions({\n    response,\n    angularObserve,\n    angularParamsRef,\n    requiredNullableQueryParamKeys: queryParams?.requiredNullableKeys,\n    nonPrimitiveQueryParamKeys: queryParams?.nonPrimitiveKeys,\n    objectQueryParamStrategies,\n    queryParams: queryParams?.schema,\n    headers: headers?.schema,\n    requestOptions,\n    isExactOptionalPropertyTypes,\n    hasSignal,\n    hasSignalParam,\n    isAngular: isAngular ?? false,\n    paramsSerializer,\n    paramsSerializerOptions,\n    paramsFilter,\n  });\n\n  const trimmedAxiosOptions = axiosOptions.trim();\n  const isRawOptionsArgument =\n    trimmedAxiosOptions === 'options' ||\n    (trimmedAxiosOptions.startsWith('(') &&\n      trimmedAxiosOptions.endsWith(')')) ||\n    (trimmedAxiosOptions.startsWith('{') && trimmedAxiosOptions.endsWith('}'));\n\n  const optionsArgument = axiosOptions\n    ? isRawOptionsArgument\n      ? axiosOptions\n      : `{${axiosOptions}}`\n    : '';\n\n  if (verb === Verbs.DELETE) {\n    if (!bodyIdentifier) {\n      return `\\n      \\`${route}\\`${optionsArgument ? `,${optionsArgument}` : ''}\\n    `;\n    }\n\n    const deleteBodyOptions = isRawOptionsArgument\n      ? `...${optionsArgument}`\n      : axiosOptions;\n    const deleteBodyField = `${isAngular ? 'body' : 'data'}: ${bodyIdentifier}`;\n\n    return `\\n      \\`${route}\\`,{${deleteBodyField}${axiosOptions ? `,${deleteBodyOptions}` : ''}}\\n    `;\n  }\n\n  const bodyOrOptions = getIsBodyVerb(verb)\n    ? `\\n      ${bodyIdentifier ?? 'undefined'},`\n    : '';\n  const separator = bodyOrOptions || optionsArgument ? ',' : '';\n\n  return `\\n      \\`${route}\\`${separator}${bodyOrOptions}${optionsArgument}\\n    `;\n}\n\nexport function generateBodyMutatorConfig(\n  body: GetterBody,\n  isFormData: boolean,\n  isFormUrlEncoded: boolean,\n) {\n  if (isFormData && body.formData) {\n    return ',\\n       data: formData';\n  }\n\n  if (isFormUrlEncoded && body.formUrlEncoded) {\n    return ',\\n       data: formUrlEncoded';\n  }\n\n  if (body.implementation) {\n    return `,\\n      data: ${body.implementation}`;\n  }\n\n  return '';\n}\n\nexport function generateQueryParamsAxiosConfig(\n  response: GetterResponse,\n  isAngular: boolean,\n  requiredNullableQueryParamKeys?: string[],\n  queryParams?: GetterQueryParam,\n  paramsFilter?: GeneratorMutator,\n) {\n  if (!queryParams && !response.isBlob) {\n    return '';\n  }\n\n  let value = '';\n\n  if (queryParams) {\n    if (isAngular) {\n      const paramsExpr = buildAngularParamsFilterExpression({\n        paramsExpression: 'params ?? {}',\n        requiredNullableParamKeys: requiredNullableQueryParamKeys,\n        nonPrimitiveKeys: queryParams.nonPrimitiveKeys,\n        paramsFilter,\n        useSharedHelper: false,\n      });\n      value += `,\\n        params: ${paramsExpr}`;\n    } else {\n      value += ',\\n        params';\n    }\n  }\n\n  if (response.isBlob) {\n    value += `,\\n        responseType: 'blob'`;\n  }\n\n  return value;\n}\n\ninterface GenerateMutatorConfigOptions {\n  route: string;\n  body: GetterBody;\n  headers?: GetterQueryParam;\n  queryParams?: GetterQueryParam;\n  response: GetterResponse;\n  verb: Verbs;\n  isFormData: boolean;\n  isFormUrlEncoded: boolean;\n  hasSignal: boolean;\n  hasSignalParam?: boolean;\n  isExactOptionalPropertyTypes: boolean;\n  isAngular?: boolean;\n  paramsFilter?: GeneratorMutator;\n}\n\nexport function generateMutatorConfig({\n  route,\n  body,\n  headers,\n  queryParams,\n  response,\n  verb,\n  isFormData,\n  isFormUrlEncoded,\n  hasSignal,\n  hasSignalParam = false,\n  isExactOptionalPropertyTypes,\n  isAngular,\n  paramsFilter,\n}: GenerateMutatorConfigOptions) {\n  const bodyOptions = getIsBodyVerb(verb)\n    ? generateBodyMutatorConfig(body, isFormData, isFormUrlEncoded)\n    : '';\n\n  const queryParamsOptions = generateQueryParamsAxiosConfig(\n    response,\n    isAngular ?? false,\n    queryParams?.requiredNullableKeys,\n    queryParams,\n    paramsFilter,\n  );\n\n  const ignoreContentTypes = isAngular ? ['multipart/form-data'] : [];\n  const shouldSetContentType =\n    body.contentType && !ignoreContentTypes.includes(body.contentType);\n\n  const headerOptions = shouldSetContentType\n    ? `,\\n      headers: {'Content-Type': '${jsStringLiteralEscape(\n        body.contentType,\n      )}', ${headers ? '...headers' : ''}}`\n    : headers\n      ? ',\\n      headers'\n      : '';\n\n  // Use querySignal if API has a param named \"signal\" to avoid conflict\n  const signalVar = hasSignalParam ? 'querySignal' : 'signal';\n  const signalProp = hasSignalParam ? `signal: ${signalVar}` : 'signal';\n\n  return `{url: \\`${route}\\`, method: '${verb.toUpperCase()}'${headerOptions}${bodyOptions}${queryParamsOptions}${\n    hasSignal\n      ? `, ${\n          isExactOptionalPropertyTypes\n            ? `...(${signalVar} ? { ${signalProp} }: {})`\n            : signalProp\n        }`\n      : ''\n  }\\n    }`;\n}\n\nexport function generateMutatorRequestOptions(\n  requestOptions: boolean | object | undefined,\n  hasSecondArgument: boolean,\n) {\n  if (!hasSecondArgument) {\n    return isObject(requestOptions)\n      ? `{${stringify(requestOptions)?.slice(1, -1)}}`\n      : '';\n  }\n\n  if (isObject(requestOptions)) {\n    return `{${stringify(requestOptions)?.slice(1, -1)} ...options}`;\n  }\n\n  return 'options';\n}\n\nexport function generateFormDataAndUrlEncodedFunction({\n  body,\n  formData,\n  formUrlEncoded,\n  isFormData,\n  isFormUrlEncoded,\n}: GenerateFormDataAndUrlEncodedFunctionOptions) {\n  if (isFormData && body.formData) {\n    if (formData) {\n      return `const formData = ${formData.name}(${body.implementation})`;\n    }\n\n    return body.formData;\n  }\n\n  if (isFormUrlEncoded && body.formUrlEncoded) {\n    if (formUrlEncoded) {\n      return `const formUrlEncoded = ${formUrlEncoded.name}(${body.implementation})`;\n    }\n\n    return body.formUrlEncoded;\n  }\n\n  return '';\n}\n","import { resolveObject, resolveRef } from '../resolvers';\nimport type {\n  ContextSpec,\n  GeneratorImport,\n  GeneratorSchema,\n  OpenApiComponentsObject,\n  OpenApiParameterObject,\n} from '../types';\nimport { getComponentBaseName, jsDoc, sanitize } from '../utils';\n\nexport function generateParameterDefinition(\n  parameters: OpenApiComponentsObject['parameters'] = {},\n  context: ContextSpec,\n  suffix: string,\n  prefix = '',\n): GeneratorSchema[] {\n  if (Object.keys(parameters).length === 0) {\n    return [];\n  }\n\n  const generatorSchemas: GeneratorSchema[] = [];\n  for (const [parameterName, parameter] of Object.entries(parameters)) {\n    const modelName = sanitize(\n      `${prefix}${getComponentBaseName(parameters, parameterName)}${suffix}`,\n      {\n        underscore: '_',\n        whitespace: '_',\n        dash: true,\n        es5keyword: true,\n        es5IdentifierName: true,\n      },\n    );\n    const {\n      schema,\n      imports,\n    }: {\n      schema: OpenApiParameterObject;\n      imports: GeneratorImport[];\n    } = resolveRef(parameter, context);\n\n    if (schema.in !== 'query' && schema.in !== 'header') {\n      continue;\n    }\n\n    if (!('schema' in schema) || !schema.schema || imports.length > 0) {\n      generatorSchemas.push({\n        name: modelName,\n        imports:\n          imports.length > 0\n            ? [\n                {\n                  name: imports[0].name,\n                  schemaName: imports[0].schemaName,\n                },\n              ]\n            : [],\n        model: `export type ${modelName} = ${\n          imports.length > 0 ? imports[0].name : 'unknown'\n        };\\n`,\n        dependencies: imports.length > 0 ? [imports[0].name] : [],\n        kind: 'schema',\n      });\n\n      continue;\n    }\n\n    const resolvedObject = resolveObject({\n      schema: schema.schema,\n      propName: modelName,\n      context,\n    });\n\n    const doc = jsDoc(schema);\n\n    const model = `${doc}export type ${modelName} = ${\n      resolvedObject.value || 'unknown'\n    };\\n`;\n\n    generatorSchemas.push(...resolvedObject.schemas);\n\n    if (modelName !== resolvedObject.value) {\n      generatorSchemas.push({\n        name: modelName,\n        model,\n        imports: resolvedObject.imports,\n        dependencies: resolvedObject.dependencies,\n        kind: 'schema',\n      });\n    }\n  }\n\n  return generatorSchemas;\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport { getScalar } from '../getters';\nimport type { FormDataContext } from '../getters/object';\nimport type {\n  ContextSpec,\n  GeneratorSchema,\n  OpenApiSchemaObject,\n} from '../types';\nimport { jsDoc } from '../utils';\n\ninterface GenerateInterfaceOptions {\n  name: string;\n  schema: OpenApiSchemaObject;\n  context: ContextSpec;\n  /**\n   * Multipart/form-data context, set when the schema is used as a shared\n   * `multipart/form-data` request body (#4177).\n   *\n   * @see FormDataContext\n   */\n  formDataContext?: FormDataContext;\n  genericParams?: string[];\n}\n\n/**\n * Generate the interface string\n * An eslint comment is insert if the resulted object is empty\n *\n * @param name interface name\n * @param schema\n */\nexport function generateInterface({\n  name,\n  schema,\n  context,\n  formDataContext,\n  genericParams,\n}: GenerateInterfaceOptions): GeneratorSchema[] {\n  const scalar = getScalar({\n    item: schema,\n    name,\n    context,\n    formDataContext,\n  });\n  const isEmptyObject = scalar.value === '{}';\n  const shouldUseTypeAlias =\n    context.output.override.useTypeOverInterfaces ?? scalar.useTypeAlias;\n  const genericSuffix =\n    genericParams && genericParams.length > 0\n      ? `<${genericParams.join(', ')}>`\n      : '';\n\n  let model = '';\n\n  if (!isBooleanJsonSchema(schema)) {\n    model += jsDoc(schema);\n  }\n\n  if (isEmptyObject) {\n    model +=\n      '// eslint-disable-next-line @typescript-eslint/no-empty-interface\\n';\n  }\n\n  if (\n    scalar.type === 'object' &&\n    !shouldUseTypeAlias &&\n    !isBooleanJsonSchema(schema)\n  ) {\n    const properties = schema.properties;\n    if (\n      properties &&\n      Object.values(properties).length > 0 &&\n      Object.values(properties).every(\n        (item) => !isBooleanJsonSchema(item) && 'const' in item,\n      )\n    ) {\n      const mappedScalarValue = scalar.value\n        .replaceAll(';', ',')\n        .replaceAll('?:', ':');\n\n      model += `export const ${name}Value = ${mappedScalarValue} as const;\\nexport type ${name}${genericSuffix} = typeof ${name}Value;\\n`;\n    } else {\n      const blankInterfaceValue =\n        scalar.value === 'unknown' ? '{}' : scalar.value;\n\n      model += `export interface ${name}${genericSuffix} ${blankInterfaceValue}\\n`;\n    }\n  } else {\n    model += `export type ${name}${genericSuffix} = ${scalar.value};\\n`;\n  }\n\n  // Filter out imports that refer to the type defined in current file (OpenAPI recursive schema definitions)\n  const externalModulesImportsOnly = scalar.imports.filter((importName) =>\n    importName.alias ? importName.alias !== name : importName.name !== name,\n  );\n\n  return [\n    ...scalar.schemas,\n    {\n      name,\n      model,\n      imports: externalModulesImportsOnly,\n      dependencies: scalar.dependencies,\n      schema,\n      kind: 'schema',\n    },\n  ];\n}\n","import { isBooleanJsonSchema } from '@scalar/openapi-types/helpers';\n\nimport {\n  getEnum,\n  getEnumMembers,\n  getFormDataComponentContexts,\n  resolveDiscriminators,\n} from '../getters';\nimport type { FormDataContext } from '../getters/object';\nimport {\n  buildDynamicScope,\n  dynamicAnchorsToUniqueParamNames,\n  dynamicAnchorToParamName,\n  extractBoundAliasInfo,\n  resolveRef,\n  resolveValue,\n} from '../resolvers';\nimport type {\n  ContextSpec,\n  GeneratorSchema,\n  InputFiltersOptions,\n  OpenApiReferenceObject,\n  OpenApiSchemaObject,\n  OpenApiSchemasObject,\n} from '../types';\nimport {\n  conventionName,\n  getComponentBaseName,\n  isBoolean,\n  isInlineSchema,\n  isSchemaNullable,\n  isString,\n  jsDoc,\n  sanitize,\n  toObjectSchema,\n} from '../utils';\nimport { generateFactory } from './factory';\nimport { generateInterface } from './interface';\n\n/**\n * Extract all types from #/components/schemas\n */\nexport function generateSchemasDefinition(\n  schemas: OpenApiSchemasObject = {},\n  context: ContextSpec,\n  suffix: string,\n  filters?: InputFiltersOptions,\n  prefix = '',\n): GeneratorSchema[] {\n  if (Object.keys(schemas).length === 0) {\n    return [];\n  }\n\n  const transformedSchemas = resolveDiscriminators(schemas, context);\n\n  let generateSchemas = Object.entries(transformedSchemas);\n  if (filters?.schemas) {\n    const schemasFilters = filters.schemas;\n    const mode = filters.mode ?? 'include';\n\n    generateSchemas = generateSchemas.filter(([schemaName]) => {\n      const isMatch = schemasFilters.some((filter) =>\n        isString(filter) ? filter === schemaName : filter.test(schemaName),\n      );\n\n      return mode === 'include' ? isMatch : !isMatch;\n    });\n  }\n\n  // A component schema used as a `multipart/form-data` request body is emitted\n  // here, detached from the operation that declares its media type, so its\n  // binary parts would otherwise fall back to the context-free `Blob` that\n  // inline bodies avoid (#4177). Scanned once for the whole run.\n  const formDataContexts = getFormDataComponentContexts(context);\n\n  const models = generateSchemas.flatMap(([schemaName, schema]) =>\n    generateSchemaDefinitions(\n      schemaName,\n      schema,\n      context,\n      suffix,\n      prefix,\n      formDataContexts.get(schemaName),\n    ),\n  );\n\n  // Deduplicate schemas by normalized name to prevent duplicate exports\n  // This handles cases where different source schemas produce the same normalized name\n  const seenNames = new Set<string>();\n  const deduplicatedModels: GeneratorSchema[] = [];\n  for (const schema of models) {\n    const normalizedName = conventionName(\n      schema.name,\n      context.output.namingConvention,\n    );\n    if (!seenNames.has(normalizedName)) {\n      seenNames.add(normalizedName);\n\n      if (context.output.factoryMethods && schema.schema) {\n        const factoryData = generateFactory(\n          schema.schema,\n          schema.name,\n          context,\n        );\n        if (factoryData) {\n          if (context.output.factoryMethods.mode === 'single') {\n            schema.model += `\\n${factoryData.model}`;\n            for (const imp of factoryData.imports) {\n              if (\n                !schema.imports.some((existing) => existing.name === imp.name)\n              ) {\n                schema.imports.push(imp);\n              }\n            }\n          } else {\n            schema.factory = factoryData.model;\n            schema.factoryImports = factoryData.imports;\n            schema.factoryMode = context.output.factoryMethods.mode;\n          }\n        }\n      }\n\n      deduplicatedModels.push(schema);\n    }\n  }\n\n  return sortSchemasByDependencies(deduplicatedModels);\n}\n\nfunction sortSchemasByDependencies(\n  schemas: GeneratorSchema[],\n): GeneratorSchema[] {\n  if (schemas.length === 0) {\n    return schemas;\n  }\n\n  const schemaNames = new Set(schemas.map((schema) => schema.name));\n  const dependencyMap = new Map<string, Set<string>>();\n\n  for (const schema of schemas) {\n    const dependencies = new Set<string>();\n\n    if (schema.dependencies)\n      for (const dependencyName of schema.dependencies) {\n        if (dependencyName && schemaNames.has(dependencyName)) {\n          dependencies.add(dependencyName);\n        }\n      }\n\n    for (const imp of schema.imports) {\n      const dependencyName = imp.alias ?? imp.name;\n      if (dependencyName && schemaNames.has(dependencyName)) {\n        dependencies.add(dependencyName);\n      }\n    }\n\n    dependencyMap.set(schema.name, dependencies);\n  }\n\n  const sorted: GeneratorSchema[] = [];\n  const temporary = new Set<string>();\n  const permanent = new Set<string>();\n  const schemaMap = new Map(schemas.map((schema) => [schema.name, schema]));\n\n  const visit = (name: string) => {\n    if (permanent.has(name)) {\n      return;\n    }\n\n    if (temporary.has(name)) {\n      // Circular dependency detected; retain current DFS order for this cycle\n      return;\n    }\n\n    temporary.add(name);\n\n    const dependencies = dependencyMap.get(name);\n    if (dependencies)\n      for (const dep of dependencies) {\n        if (dep !== name) {\n          visit(dep);\n        }\n      }\n\n    temporary.delete(name);\n    permanent.add(name);\n\n    const schema = schemaMap.get(name);\n    if (schema) {\n      sorted.push(schema);\n    }\n  };\n\n  for (const schema of schemas) visit(schema.name);\n\n  return sorted;\n}\n\nfunction shouldCreateInterface(schema: OpenApiSchemaObject) {\n  if (isBooleanJsonSchema(schema)) {\n    return false;\n  }\n\n  const isNullable = Array.isArray(schema.type) && schema.type.includes('null');\n\n  return (\n    (!schema.type || schema.type === 'object') &&\n    !schema.allOf &&\n    !schema.oneOf &&\n    !schema.anyOf &&\n    isInlineSchema(schema) &&\n    !schema.enum &&\n    !isNullable\n  );\n}\n\nfunction collectGenericParams(\n  schema: OpenApiSchemaObject | OpenApiReferenceObject,\n): { anchorName: string; paramName: string }[] {\n  const defs = (schema as Record<string, unknown>).$defs as\n    | Record<string, OpenApiSchemaObject>\n    | undefined;\n  if (!defs || typeof defs !== 'object') return [];\n  const anchors: string[] = [];\n  for (const defSchema of Object.values(defs)) {\n    if (!defSchema || typeof defSchema !== 'object') {\n      continue;\n    }\n    const rec = defSchema as Record<string, unknown>;\n    if (rec.$dynamicAnchor !== undefined && rec.$ref === undefined) {\n      anchors.push(rec.$dynamicAnchor as string);\n    }\n  }\n  const uniqueNames = dynamicAnchorsToUniqueParamNames(anchors);\n  return anchors.map((anchor) => ({\n    anchorName: anchor,\n    paramName: uniqueNames.get(anchor) ?? dynamicAnchorToParamName(anchor),\n  }));\n}\n\nfunction generateSchemaDefinitions(\n  schemaName: string,\n  schema: OpenApiSchemaObject,\n  context: ContextSpec,\n  suffix: string,\n  prefix = '',\n  formDataContext?: FormDataContext,\n): GeneratorSchema[] {\n  const sanitizedSchemaName = sanitize(\n    `${prefix}${getComponentBaseName(context.spec.components?.schemas, schemaName)}${suffix}`,\n    {\n      underscore: '_',\n      whitespace: '_',\n      dash: true,\n      es5keyword: true,\n      es5IdentifierName: true,\n    },\n  );\n\n  if (isBooleanJsonSchema(schema)) {\n    return [\n      {\n        name: sanitizedSchemaName,\n        model: `export type ${sanitizedSchemaName} = ${schema ? 'unknown' : 'never'};\\n`,\n        imports: [],\n        schema: schema as OpenApiSchemaObject,\n        kind: 'schema',\n      },\n    ];\n  }\n\n  const schemaType = schema.type as string | string[] | undefined;\n  const nullable =\n    Array.isArray(schemaType) && schemaType.includes('null') ? ' | null' : '';\n\n  const alias = extractBoundAliasInfo(schema, context);\n  if (alias) {\n    const genericParams = alias.genericParams.map((paramName) => ({\n      anchorName: paramName,\n      paramName,\n    }));\n    const genericSuffix =\n      genericParams.length > 0\n        ? `<${genericParams.map((p) => p.paramName).join(', ')}>`\n        : '';\n\n    const typeArgsStr = alias.typeArgs.join(', ');\n    const genericPart = `${alias.genericName}<${typeArgsStr}>`;\n\n    let model: string;\n    const allImports: { name: string; schemaName: string }[] = [\n      { name: alias.genericName, schemaName: alias.genericName },\n      ...alias.imports,\n    ];\n\n    if (alias.extraSchemas && alias.extraSchemas.length > 0) {\n      const aliasScopedContext = {\n        ...context,\n        dynamicScope: buildDynamicScope(\n          schemaName,\n          toObjectSchema(schema),\n          context,\n        ),\n      };\n      const subSchemas: GeneratorSchema[] = [];\n      const extraParts = alias.extraSchemas.map((extraSchema) => {\n        const resolved = resolveValue({\n          schema: extraSchema,\n          name: sanitizedSchemaName,\n          // The extra `allOf` members are intersected into the alias, so their\n          // properties are top-level parts of the same multipart body.\n          context: aliasScopedContext,\n          formDataContext,\n        });\n        for (const imp of resolved.imports) {\n          const impSchemaName = imp.schemaName ?? imp.name;\n          if (\n            !allImports.some(\n              (a) => a.name === imp.name && a.schemaName === impSchemaName,\n            )\n          ) {\n            allImports.push({ name: imp.name, schemaName: impSchemaName });\n          }\n        }\n        for (const sub of resolved.schemas) {\n          if (sub.name !== sanitizedSchemaName) {\n            subSchemas.push(sub);\n          }\n        }\n        return resolved.value;\n      });\n      model = `export type ${sanitizedSchemaName}${genericSuffix} = (${[genericPart, ...extraParts].join(' & ')})${nullable};\\n`;\n      return [\n        ...subSchemas,\n        {\n          name: sanitizedSchemaName,\n          model,\n          imports: allImports,\n          dependencies: allImports.map((i) => i.name),\n          schema,\n          kind: 'schema',\n        },\n      ];\n    } else {\n      model = `export type ${sanitizedSchemaName}${genericSuffix} = ${genericPart}${nullable};\\n`;\n    }\n\n    return [\n      {\n        name: sanitizedSchemaName,\n        model,\n        imports: allImports,\n        dependencies: allImports.map((i) => i.name),\n        schema,\n        kind: 'schema',\n      },\n    ];\n  }\n\n  const scopedContext = isBoolean(schema)\n    ? context\n    : {\n        ...context,\n        dynamicScope: buildDynamicScope(\n          schemaName,\n          toObjectSchema(schema),\n          context,\n        ),\n      };\n\n  const genericParams = collectGenericParams(schema);\n\n  if (shouldCreateInterface(schema)) {\n    return generateInterface({\n      name: sanitizedSchemaName,\n      schema,\n      context: scopedContext,\n      formDataContext,\n      genericParams:\n        genericParams.length > 0\n          ? genericParams.map((p) => p.paramName)\n          : undefined,\n    });\n  }\n\n  const resolvedValue = resolveValue({\n    schema,\n    name: sanitizedSchemaName,\n    context: scopedContext,\n    formDataContext,\n  });\n\n  let output = '';\n\n  let imports = resolvedValue.imports;\n  let kind: 'enum' | 'schema' =\n    resolvedValue.isEnum && !resolvedValue.isRef ? 'enum' : 'schema';\n\n  output += jsDoc(schema);\n\n  if (resolvedValue.isEnum && !resolvedValue.isRef) {\n    output += getEnum(\n      getEnumMembers(resolvedValue.originalSchema),\n      sanitizedSchemaName,\n      !!nullable || isSchemaNullable(resolvedValue.originalSchema),\n      context.output.override.enumGenerationType,\n      context.output.override.namingConvention.enum,\n    );\n  } else if (\n    sanitizedSchemaName === resolvedValue.value &&\n    resolvedValue.isRef\n  ) {\n    if (isInlineSchema(schema)) {\n      throw new Error(\n        `Expected a reference schema for ${sanitizedSchemaName}, but received an inline schema`,\n      );\n    }\n    // Don't add type if schema has same name and the referred schema will be an interface\n    const { schema: referredSchema } = resolveRef(schema, scopedContext);\n    if (!shouldCreateInterface(referredSchema as OpenApiSchemaObject)) {\n      const imp = resolvedValue.imports.find(\n        (imp) => imp.name === sanitizedSchemaName,\n      );\n\n      if (imp) {\n        const alias = `${resolvedValue.value}Bis`;\n\n        output += `export type ${sanitizedSchemaName} = ${alias};\\n`;\n\n        imports = imports.map((imp) =>\n          imp.name === sanitizedSchemaName ? { ...imp, alias } : imp,\n        );\n        resolvedValue.dependencies = [imp.name];\n      } else {\n        output += `export type ${sanitizedSchemaName} = ${resolvedValue.value};\\n`;\n      }\n    }\n  } else {\n    resolvedValue.schemas = resolvedValue.schemas.filter((schema) => {\n      if (schema.name !== sanitizedSchemaName) {\n        return true;\n      }\n\n      output += `${schema.model}\\n`;\n      imports = [...imports, ...schema.imports];\n      resolvedValue.dependencies.push(...(schema.dependencies ?? []));\n      kind = schema.kind ?? kind;\n\n      return false;\n    });\n    const genericSuffix =\n      genericParams.length > 0\n        ? `<${genericParams.map((p) => p.paramName).join(', ')}>`\n        : '';\n    output += `export type ${sanitizedSchemaName}${genericSuffix} = ${resolvedValue.value};\\n`;\n  }\n\n  return [\n    ...resolvedValue.schemas,\n    {\n      name: sanitizedSchemaName,\n      model: output,\n      imports,\n      dependencies: resolvedValue.dependencies,\n      schema,\n      kind,\n    },\n  ];\n}\n","import {\n  getBodiesByContentType,\n  getBody,\n  getOperationId,\n  getParameters,\n  getParams,\n  getProps,\n  getQueryParams,\n  getResponse,\n} from '../getters';\nimport type {\n  ContextSpec,\n  GeneratorVerbOptions,\n  GeneratorVerbsOptions,\n  GetterBody,\n  GetterParams,\n  NormalizedInputOptions,\n  NormalizedMutator,\n  NormalizedOperationOptions,\n  NormalizedOutputOptions,\n  NormalizedOverrideOutput,\n  OpenApiComponentsObject,\n  OpenApiOperationObject,\n  OpenApiPathItemObject,\n  OpenApiRequestBodyObject,\n  Verbs,\n} from '../types';\nimport {\n  asyncReduce,\n  camel,\n  dynamicImport,\n  escapeRegExp,\n  getUniqueName,\n  isObject,\n  isString,\n  isVerb,\n  jsDoc,\n  mergeDeep,\n  sanitize,\n} from '../utils';\nimport { filteredVerbs } from './input-filters';\nimport { generateMutator } from './mutator';\n\nexport interface GenerateVerbOptionsParams {\n  verb: Verbs;\n  output: NormalizedOutputOptions;\n  operation: OpenApiOperationObject;\n  route: string;\n  pathRoute: string;\n  verbParameters?: OpenApiPathItemObject['parameters'];\n  components?: OpenApiComponentsObject;\n  context: ContextSpec;\n  // Names already taken by another operation of the same output. Colliding\n  // names used to be emitted verbatim, which produces uncompilable output\n  // (TS2451/TS2300 within a file, TS2308 through a barrel). #2685\n  reservedOperationNames?: Set<string>;\n  reservedTypeNames?: Set<string>;\n}\n\nconst renameFormIdentifier = (form: string, from: string, to: string) =>\n  form.replace(\n    new RegExp(`(?<![.\\\\w$'\"\\`])${escapeRegExp(from)}(?![\\\\w$])`, 'g'),\n    to,\n  );\n\n// A body parameter named like the generated function shadows it inside hooks\n// that reference `typeof <operationName>`.\nconst resolveBodyNameShadowing = (\n  body: GetterBody,\n  operationName: string,\n  params: GetterParams,\n): GetterBody => {\n  if (!body.implementation || body.implementation !== operationName) {\n    return body;\n  }\n\n  const reservedNames = new Set([\n    operationName,\n    'params',\n    'headers',\n    ...params.map(({ name }) => name),\n  ]);\n  let implementation = camel(`${operationName}-body`);\n  let index = 2;\n  while (reservedNames.has(implementation)) {\n    implementation = camel(`${operationName}-body-${index}`);\n    index += 1;\n  }\n\n  return {\n    ...body,\n    implementation,\n    formData:\n      body.formData &&\n      renameFormIdentifier(body.formData, body.implementation, implementation),\n    formUrlEncoded:\n      body.formUrlEncoded &&\n      renameFormIdentifier(\n        body.formUrlEncoded,\n        body.implementation,\n        implementation,\n      ),\n  };\n};\n\nasync function buildVerbOption({\n  verb,\n  output,\n  operation,\n  route,\n  pathRoute,\n  verbParameters = [],\n  context,\n  body: rawBody,\n  operationName,\n  typeName,\n  operationId,\n  override,\n  tags,\n  deprecated,\n  description,\n  summary,\n}: {\n  verb: Verbs;\n  output: NormalizedOutputOptions;\n  operation: OpenApiOperationObject;\n  route: string;\n  pathRoute: string;\n  verbParameters: OpenApiPathItemObject['parameters'];\n  context: ContextSpec;\n  body: GetterBody;\n  operationName: string;\n  typeName: string;\n  operationId: string;\n  override: NormalizedOverrideOutput;\n  tags: string[];\n  deprecated: boolean | undefined;\n  description: string | undefined;\n  summary: string | undefined;\n}): Promise<GeneratorVerbOptions> {\n  const response = getResponse({\n    responses: operation.responses ?? {},\n    operationName: typeName,\n    context,\n    contentType: override.contentType,\n    generatePrimitiveSchemas:\n      !override.mutator &&\n      isObject(output.schemas) &&\n      output.schemas.type === 'zod' &&\n      (output.client === 'angular'\n        ? override.angular.runtimeValidation.enabled\n        : output.client === 'angular-query'\n          ? override.query.runtimeValidation?.enabled\n          : (output.client === 'fetch' || output.httpClient === 'fetch') &&\n            override.fetch.runtimeValidation.enabled),\n  });\n\n  const parameters = getParameters({\n    parameters: [...verbParameters, ...(operation.parameters ?? [])],\n    context,\n  });\n\n  const queryParams = getQueryParams({\n    queryParams: parameters.query,\n    operationName: typeName,\n    context,\n  });\n\n  const headers = output.headers\n    ? getQueryParams({\n        queryParams: parameters.header,\n        operationName: typeName,\n        context,\n        suffix: 'headers',\n      })\n    : undefined;\n\n  const params = getParams({\n    pathRoute,\n    pathParams: parameters.path,\n    operationId,\n    context,\n    output,\n  });\n\n  const body = resolveBodyNameShadowing(rawBody, operationName, params);\n\n  const props = getProps({\n    body,\n    queryParams,\n    params,\n    headers,\n    operationName: typeName,\n    context,\n  });\n\n  const mutator = await generateMutator({\n    output: output.target,\n    name: typeName,\n    mutator: override.mutator,\n    workspace: context.workspace,\n    tsconfig: context.output.tsconfig,\n  });\n\n  const formData =\n    !override.formData.disabled && body.formData\n      ? await generateMutator({\n          output: output.target,\n          name: typeName,\n          mutator: override.formData.mutator,\n          workspace: context.workspace,\n          tsconfig: context.output.tsconfig,\n        })\n      : undefined;\n\n  const formUrlEncoded =\n    isString(override.formUrlEncoded) || isObject(override.formUrlEncoded)\n      ? await generateMutator({\n          output: output.target,\n          name: typeName,\n          mutator: override.formUrlEncoded as NormalizedMutator,\n          workspace: context.workspace,\n          tsconfig: context.output.tsconfig,\n        })\n      : undefined;\n\n  const paramsSerializer =\n    isString(override.paramsSerializer) || isObject(override.paramsSerializer)\n      ? await generateMutator({\n          output: output.target,\n          name: 'paramsSerializer',\n          mutator: override.paramsSerializer as NormalizedMutator,\n          workspace: context.workspace,\n          tsconfig: context.output.tsconfig,\n        })\n      : undefined;\n\n  const paramsFilter =\n    isString(override.paramsFilter) || isObject(override.paramsFilter)\n      ? await generateMutator({\n          output: output.target,\n          name: 'paramsFilter',\n          mutator: override.paramsFilter as NormalizedMutator,\n          workspace: context.workspace,\n          tsconfig: context.output.tsconfig,\n        })\n      : undefined;\n\n  const fetchReviver =\n    isString(override.fetch.jsonReviver) || isObject(override.fetch.jsonReviver)\n      ? await generateMutator({\n          output: output.target,\n          name: 'fetchReviver',\n          mutator: override.fetch.jsonReviver as NormalizedMutator,\n          workspace: context.workspace,\n          tsconfig: context.output.tsconfig,\n        })\n      : undefined;\n  const doc = jsDoc({ description, deprecated, summary });\n\n  const verbOption: GeneratorVerbOptions = {\n    verb,\n    tags,\n    route,\n    pathRoute,\n    summary,\n    operationId,\n    operationName,\n    typeName,\n    response,\n    body,\n    headers,\n    queryParams,\n    params,\n    props,\n    mutator,\n    formData,\n    formUrlEncoded,\n    paramsSerializer,\n    paramsFilter,\n    fetchReviver,\n    override,\n    doc,\n    deprecated,\n    originalOperation: operation,\n  };\n\n  const transformer = await dynamicImport(\n    override.transformer,\n    context.workspace,\n  );\n\n  return transformer ? transformer(verbOption) : verbOption;\n}\n\nexport async function generateVerbOptions({\n  verb,\n  output,\n  operation,\n  route,\n  pathRoute,\n  verbParameters = [],\n  context,\n  reservedOperationNames,\n  reservedTypeNames,\n}: GenerateVerbOptionsParams): Promise<GeneratorVerbOptions[]> {\n  const {\n    requestBody,\n    tags: rawTags,\n    deprecated: rawDeprecated,\n    description: rawDescription,\n    summary: rawSummary,\n  } = operation;\n\n  const tags = rawTags ?? [];\n  const deprecated = rawDeprecated;\n  const description = rawDescription;\n  const summary = rawSummary;\n  const operationId = getOperationId(operation, route, verb);\n  const overrideOperation = output.override.operations[operationId];\n  let overrideTag: NormalizedOperationOptions = {};\n  for (const [tag, options] of Object.entries(output.override.tags)) {\n    if (tags.includes(tag) && options) {\n      overrideTag = mergeDeep(overrideTag, options);\n    }\n  }\n\n  const override = mergeDeep(\n    mergeDeep(output.override, overrideTag),\n    overrideOperation ?? {},\n  ) as NormalizedOverrideOutput;\n\n  const overrideOperationName =\n    overrideOperation?.operationName ?? output.override.operationName;\n  let operationName: string;\n  let typeName: string;\n  if (overrideOperationName) {\n    // ponytail: user-provided override is authoritative; sanitize would strip\n    // intentional `_` and `$` (regression introduced in #3693, fixed per #3775).\n    const result = overrideOperationName(operation, route, verb);\n    if (Array.isArray(result)) {\n      operationName = result[0];\n      typeName = result[1];\n    } else {\n      operationName = result;\n      typeName = operationName;\n    }\n  } else {\n    operationName = sanitize(camel(operationId), { es5keyword: true });\n    typeName = operationName;\n  }\n\n  // Two operations can resolve to the same name (a `operationName` override\n  // returning a constant, or ids that sanitize together). They used to be\n  // emitted verbatim, so a file got two `export const update` declarations\n  // (TS2451) and a barrel re-exported the same name twice (TS2308). Reserve\n  // the first spelling and suffix the rest. The base name is reserved before\n  // the `splitByContentType` fan-out so a suffixed base stays consistent\n  // across its variants, and each emitted variant name is reserved as well so\n  // a later operation cannot reuse it. An operation that\n  // `useDeprecatedOperations: false` drops afterwards reserves nothing, so it\n  // cannot push a suffix onto an active one. #2685\n  const shouldReserve =\n    !deprecated || output.override.useDeprecatedOperations !== false;\n  const reserve = (name: string, reservedNames?: Set<string>) => {\n    if (!shouldReserve || !reservedNames) {\n      return name;\n    }\n    const uniqueName = getUniqueName(name, reservedNames);\n    reservedNames.add(uniqueName);\n    return uniqueName;\n  };\n\n  operationName = reserve(operationName, reservedOperationNames);\n  typeName = reserve(typeName, reservedTypeNames);\n\n  const splitByContentType = override.splitByContentType;\n\n  if (splitByContentType && requestBody) {\n    const bodies = getBodiesByContentType({\n      requestBody,\n      operationName: typeName,\n      context,\n      contentType: override.contentType,\n    });\n\n    const results: GeneratorVerbOptions[] = [];\n    for (const bodyEntry of bodies) {\n      const { contentTypeSuffix, ...body } = bodyEntry;\n      const suffixedName = contentTypeSuffix\n        ? reserve(\n            `${operationName}With${contentTypeSuffix}`,\n            reservedOperationNames,\n          )\n        : operationName;\n      const suffixedTypeName = contentTypeSuffix\n        ? reserve(`${typeName}With${contentTypeSuffix}`, reservedTypeNames)\n        : typeName;\n\n      const verbOption = await buildVerbOption({\n        verb,\n        output,\n        operation,\n        route,\n        pathRoute,\n        verbParameters,\n        context,\n        body,\n        operationName: suffixedName,\n        typeName: suffixedTypeName,\n        operationId,\n        override,\n        tags,\n        deprecated,\n        description,\n        summary,\n      });\n      results.push(verbOption);\n    }\n    return results;\n  }\n\n  const body = requestBody\n    ? getBody({\n        requestBody,\n        operationName: typeName,\n        context,\n        contentType: override.contentType,\n      })\n    : {\n        originalSchema: {} as OpenApiRequestBodyObject,\n        definition: '',\n        implementation: '',\n        imports: [],\n        schemas: [],\n        formData: '',\n        formUrlEncoded: '',\n        contentType: '',\n        isOptional: false,\n        isBlob: false,\n      };\n\n  const verbOption = await buildVerbOption({\n    verb,\n    output,\n    operation,\n    route,\n    pathRoute,\n    verbParameters,\n    context,\n    body,\n    operationName,\n    typeName,\n    operationId,\n    override,\n    tags,\n    deprecated,\n    description,\n    summary,\n  });\n\n  return [verbOption];\n}\n\nexport interface GenerateVerbsOptionsParams {\n  verbs: OpenApiPathItemObject;\n  input: NormalizedInputOptions;\n  output: NormalizedOutputOptions;\n  route: string;\n  pathRoute: string;\n  context: ContextSpec;\n  /** See {@link GenerateVerbOptionsParams.reservedOperationNames}. */\n  reservedOperationNames?: Set<string>;\n  /** See {@link GenerateVerbOptionsParams.reservedTypeNames}. */\n  reservedTypeNames?: Set<string>;\n}\n\nexport function generateVerbsOptions({\n  verbs,\n  input,\n  output,\n  route,\n  pathRoute,\n  context,\n  reservedOperationNames,\n  reservedTypeNames,\n}: GenerateVerbsOptionsParams): Promise<GeneratorVerbsOptions> {\n  return asyncReduce(\n    filteredVerbs(verbs, input.filters),\n    async (acc, [verb, operation]) => {\n      if (isVerb(verb)) {\n        const verbOptions = await generateVerbOptions({\n          verb,\n          output,\n          verbParameters: verbs.parameters,\n          route,\n          pathRoute,\n          operation,\n          context,\n          reservedOperationNames,\n          reservedTypeNames,\n        });\n\n        acc.push(...verbOptions);\n      }\n\n      return acc;\n    },\n    [] as GeneratorVerbsOptions,\n  );\n}\n","import fs from 'node:fs';\nimport nodePath from 'node:path';\n\nimport { logger } from '../utils';\n\nconst RE_EXPORT_STAR = /^\\s*export\\s+\\*\\s+from\\s*['\"](\\.[^'\"]*)['\"]\\s*;?\\s*$/gm;\n\n// Generated modules declare every export at the top level, so a line-anchored\n// scan finds them without parsing. A miss only drops a warning, never output.\nconst RE_EXPORTED_DECLARATION =\n  /^export\\s+(?:declare\\s+)?(?:const|let|var|function|abstract\\s+class|class|interface|type|enum)\\s+([A-Za-z_$][\\w$]*)/gm;\n\nconst resolveModuleFile = (indexPath: string, specifier: string) => {\n  const resolved = nodePath.resolve(nodePath.dirname(indexPath), specifier);\n  const candidates = [\n    `${resolved}.ts`,\n    resolved.replace(/\\.[cm]?js$/, '.ts'),\n    resolved,\n  ];\n  return candidates.find(\n    (candidate) => fs.existsSync(candidate) && fs.statSync(candidate).isFile(),\n  );\n};\n\n/**\n * Names that more than one module of a barrel exports. TypeScript cannot\n * resolve an ambiguous `export *` (TS2308), so each such name is unusable\n * through the barrel. Nested barrels (directory re-exports) are skipped.\n */\nexport const getAmbiguousBarrelExports = async (\n  indexPath: string,\n): Promise<Map<string, string[]>> => {\n  if (!fs.existsSync(indexPath)) return new Map();\n\n  const content = await fs.promises.readFile(indexPath, 'utf8');\n  const modulesByName = new Map<string, string[]>();\n  // Specifiers that resolve to one file (`./cat`, `./cat.js`) re-export the\n  // same declarations, which TypeScript does not treat as ambiguous.\n  const scannedFiles = new Set<string>();\n\n  for (const [, specifier] of content.matchAll(RE_EXPORT_STAR)) {\n    const file = resolveModuleFile(indexPath, specifier);\n    if (!file || scannedFiles.has(file)) continue;\n    scannedFiles.add(file);\n\n    const source = await fs.promises.readFile(file, 'utf8');\n    // A value and its companion type (`const Cat` + `type Cat`) share a name\n    // within one module, which is not ambiguous.\n    const names = new Set(\n      [...source.matchAll(RE_EXPORTED_DECLARATION)].map(([, name]) => name),\n    );\n    for (const name of names) {\n      const modules = modulesByName.get(name);\n      if (modules) modules.push(specifier);\n      else modulesByName.set(name, [specifier]);\n    }\n  }\n\n  return new Map(\n    [...modulesByName].filter(([, modules]) => modules.length > 1),\n  );\n};\n\n/**\n * Two outputs whose `schemas` point at one directory share its `index.ts`,\n * and each merges the other's exports into it. When both generate a schema\n * of the same name (a TypeScript model and a reusable Zod schema, say), the\n * barrel re-exports it twice and consumers can import neither. Which one is\n * meant cannot be decided here, so this only reports it. See #4217.\n */\nexport const warnAmbiguousBarrelExports = async (indexPath: string) => {\n  const ambiguous = await getAmbiguousBarrelExports(indexPath);\n  if (ambiguous.size === 0) return;\n\n  const details = [...ambiguous]\n    .map(\n      ([name, modules]) =>\n        `'${name}' (${modules.map((m) => `'${m}'`).join(', ')})`,\n    )\n    .join(', ');\n\n  logger.warn(\n    `Schemas index ${indexPath} re-exports the same name from more than one ` +\n      `module: ${details}. TypeScript treats these as ambiguous, so they ` +\n      `cannot be imported from the index. This usually means several outputs ` +\n      `share one \\`schemas\\` directory; give each its own.`,\n  );\n};\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst TRAILING_WHITESPACE_RE = /[^\\S\\r\\n]+$/gm;\n\nexport type GeneratedFileTransform = (\n  filePath: string,\n  content: string,\n) => Promise<string>;\n\nconst generatedFileTransform = new AsyncLocalStorage<GeneratedFileTransform>();\n\nexport function withGeneratedFileTransform<T>(\n  transform: GeneratedFileTransform,\n  callback: () => Promise<T>,\n): Promise<T> {\n  return generatedFileTransform.run(transform, callback);\n}\n\nfunction isMissingFileError(error: unknown): error is NodeJS.ErrnoException {\n  return (\n    typeof error === 'object' &&\n    error !== null &&\n    'code' in error &&\n    error.code === 'ENOENT'\n  );\n}\n\n/**\n * Write generated code to a file, stripping trailing whitespace from each line.\n *\n * Template literals in code generators can produce lines with only whitespace\n * when conditional expressions evaluate to empty strings. This function\n * ensures the output is always clean regardless of generator implementation.\n */\nexport async function writeGeneratedFile(\n  filePath: string,\n  content: string,\n): Promise<void> {\n  let nextContent = content.replaceAll(TRAILING_WHITESPACE_RE, '');\n  const transform = generatedFileTransform.getStore();\n  if (transform) {\n    nextContent = (await transform(filePath, nextContent)).replaceAll(\n      TRAILING_WHITESPACE_RE,\n      '',\n    );\n  }\n\n  // Skip the write when the file already holds this exact output, so a no-op\n  // regeneration does not churn mtime and wake every downstream watcher. Same\n  // reasoning as the barrel writers (#3756), applied to generated artifacts\n  // as well. (#3787)\n  try {\n    const existingContent = await fs.promises.readFile(filePath, 'utf8');\n    if (existingContent === nextContent) {\n      return;\n    }\n  } catch (error) {\n    if (!isMissingFileError(error)) {\n      throw error;\n    }\n  }\n\n  await fs.promises.mkdir(path.dirname(filePath), { recursive: true });\n  await fs.promises.writeFile(filePath, nextContent);\n}\n","import basepath from 'node:path';\n\nimport {\n  type ClientMockBuilder,\n  type FakerMockOptions,\n  type GlobalMockOptions,\n  OutputMockType,\n  type WriteModeProps,\n} from '../types';\nimport { isFunction, SOURCE_FILE_EXTENSIONS, upath } from '../utils';\n\nexport function getMockDir(\n  entry: GlobalMockOptions | ClientMockBuilder,\n  mockConfig: WriteModeProps['output']['mock'],\n): string | undefined {\n  if (!isFunction(entry) && entry.path) {\n    return entry.path;\n  }\n  return mockConfig.path;\n}\n\n/** The faker generator entry, when one is configured. */\nexport function getFakerEntry(\n  mockConfig: WriteModeProps['output']['mock'],\n): FakerMockOptions | undefined {\n  return mockConfig.generators.find(\n    (g): g is FakerMockOptions =>\n      !isFunction(g) && g.type === OutputMockType.FAKER,\n  );\n}\n\n/**\n * Lists the directories that mock files are written to.\n *\n * The paths come from {@link getMockDir}, the helper the mode writers use to\n * decide where to write. `mockConfig.path` is listed even when no generator\n * resolves to it, so a configuration that lost its last generator still knows\n * where earlier runs wrote.\n *\n * The faker generator's `schemasPath` is listed as well, since the schema\n * factories file is a mock file.\n *\n * @returns The configured mock output directories. Empty when no mock path is\n * configured, in which case mock files land beside the implementation files.\n */\nexport function getConfiguredMockDirectories(\n  mockConfig: WriteModeProps['output']['mock'],\n): string[] {\n  const directories = new Set<string>();\n\n  if (mockConfig.path) {\n    directories.add(mockConfig.path);\n  }\n  for (const generator of mockConfig.generators) {\n    const directory = getMockDir(generator, mockConfig);\n    if (directory) {\n      directories.add(directory);\n    }\n  }\n  // The faker generator's `schemasPath` holds a mock file too, and can sit\n  // outside every other output directory.\n  const schemasPath = getFakerEntry(mockConfig)?.schemasPath;\n  if (schemasPath) {\n    directories.add(schemasPath);\n  }\n\n  return [...directories];\n}\n\nexport function resolveMockSchemasPath(\n  mockFilePath: string,\n  schemasTarget: string,\n): string {\n  // `upath.getRelativeImportPath` strips `basepath.extname`, which would\n  // treat any dotted tail on `schemasTarget` as a file extension and drop\n  // it: the `.schemas` marker of the implicit `<filename>.schemas` file used\n  // when `output.schemas` is unset, or the custom part of a\n  // `schemaFileExtension` such as `.types.ts` (`<filename>.schemas.types`,\n  // #4234). Only strip a real source-file extension; keep everything else.\n  const targetExt = basepath.extname(schemasTarget);\n  return upath.getRelativeImportPath(\n    mockFilePath,\n    schemasTarget,\n    !SOURCE_FILE_EXTENSIONS.has(targetExt),\n  );\n}\n","import {\n  type GeneratorImport,\n  type GeneratorOperation,\n  type GeneratorSchema,\n  DefaultTag,\n} from '../types';\nimport { kebab, SHARED_DIR } from '../utils';\n\nexport function buildSchemaTagMap(\n  operations: ReadonlyArray<Pick<GeneratorOperation, 'imports' | 'tags'>>,\n  schemas: GeneratorSchema[],\n): Map<string, string> {\n  const schemaNames = new Set(schemas.map((s) => s.name));\n\n  const schemaToTags = new Map<string, Set<string>>();\n\n  for (const schema of schemas) {\n    if (!schemaToTags.has(schema.name)) {\n      schemaToTags.set(schema.name, new Set());\n    }\n  }\n\n  for (const operation of operations) {\n    const tag = kebab(operation.tags[0] ?? DefaultTag);\n    for (const imp of operation.imports) {\n      if (!imp.importPath && schemaNames.has(imp.name)) {\n        addTag(schemaToTags, imp.name, tag);\n      }\n    }\n  }\n\n  const schemaByName = new Map(schemas.map((s) => [s.name, s]));\n  propagateTransitiveTags(schemaToTags, schemaByName);\n\n  const result = new Map<string, string>();\n  for (const [name, tags] of schemaToTags) {\n    if (tags.size === 0 || tags.size > 1) {\n      result.set(name, SHARED_DIR);\n    } else {\n      result.set(name, [...tags][0]);\n    }\n  }\n\n  return result;\n}\n\nfunction addTag(\n  schemaToTags: Map<string, Set<string>>,\n  schemaName: string,\n  tag: string,\n) {\n  if (!schemaToTags.has(schemaName)) {\n    schemaToTags.set(schemaName, new Set());\n  }\n  // oxlint-disable-next-line typescript/no-non-null-assertion\n  schemaToTags.get(schemaName)!.add(tag);\n}\n\nfunction propagateTransitiveTags(\n  schemaToTags: Map<string, Set<string>>,\n  schemaByName: Map<string, GeneratorSchema>,\n) {\n  let changed = true;\n  while (changed) {\n    changed = false;\n    for (const [name, tags] of schemaToTags) {\n      const schema = schemaByName.get(name);\n      if (!schema) continue;\n\n      for (const imp of schema.imports) {\n        if (!isSchemaImport(imp)) continue;\n        if (!schemaByName.has(imp.name)) continue;\n\n        const targetTags = schemaToTags.get(imp.name);\n        if (!targetTags) continue;\n\n        for (const tag of tags) {\n          if (!targetTags.has(tag)) {\n            targetTags.add(tag);\n            changed = true;\n          }\n        }\n      }\n    }\n  }\n}\n\nfunction isSchemaImport(imp: GeneratorImport): boolean {\n  return !imp.importPath;\n}\n","import nodePath from 'node:path';\n\nimport type {\n  GeneratedSchemaKind,\n  GeneratorSchema,\n  NormalizedOutputOptions,\n  NormalizedSchemaOptions,\n  NamingConvention,\n  Tsconfig,\n} from '../types';\nimport { conventionName, getImportExtension, isString, upath } from '../utils';\n\n/** Detects enum definitions used to select the configured schema route. */\nfunction isOpenApiEnumSchema(schema: GeneratorSchema['schema']): boolean {\n  return (\n    !!schema &&\n    typeof schema === 'object' &&\n    Array.isArray((schema as { enum?: unknown }).enum)\n  );\n}\n\nexport type SchemaRouteKey = 'default' | 'enum';\n\nexport interface SchemaOutputPlanOptions {\n  basePath: string;\n  schemas: GeneratorSchema[];\n  routes: NonNullable<NormalizedSchemaOptions['routes']>;\n  namingConvention: NamingConvention;\n  fileExtension: string;\n  indexFiles: boolean;\n  importPath?: string;\n  tsconfig?: Tsconfig;\n  schemaTagMap?: ReadonlyMap<string, string>;\n}\n\n// Shared by schema writers and client import generation.\nexport interface SchemaOutputPlan {\n  basePath: string;\n  canonicalSchemas: GeneratorSchema[];\n  canonicalNameByAlias: Map<string, string>;\n  routeKeyByName: Map<string, SchemaRouteKey>;\n  routePathByName: Map<string, string>;\n  scopePathByName: Map<string, string>;\n  filePathByName: Map<string, string>;\n  importPathByName: Map<string, string>;\n  routePathByKey: Record<SchemaRouteKey, string>;\n  routeDirectories: string[];\n  usesTagRouting: boolean;\n  rootIndexPath?: string;\n  /** Registers a schema path that is discovered after the initial plan. */\n  registerSchema(\n    name: string,\n    route: SchemaRouteKey,\n    scopePath?: string,\n  ): string;\n  /** Returns the canonical generated identifier for a schema alias. */\n  canonicalNameFor(name: string): string;\n  /** Computes a relative import from one planned schema to another. */\n  importPathFor(importerName: string, targetName: string): string;\n  /** Computes a client import path for a planned schema. */\n  clientImportPath(name: string, relativeSchemasPath: string): string;\n  /** Computes a package import path for a planned schema when applicable. */\n  packageImportPath(name: string): string | undefined;\n  /** Reports whether a name or alias is present in the plan. */\n  hasSchema(name: string): boolean;\n}\n\n/** Normalizes a schema name for grouping names that generate the same file. */\nfunction schemaNameKey(name: string, namingConvention: NamingConvention) {\n  return conventionName(name, namingConvention).toLowerCase();\n}\n\n/** Converts a schema name to the configured output naming convention. */\nfunction canonicalName(name: string, namingConvention: NamingConvention) {\n  return conventionName(name, namingConvention);\n}\n\n/** Merges generated schemas that share the same original name. */\nfunction mergeSchemas(schemas: GeneratorSchema[]): GeneratorSchema {\n  const first = schemas[0];\n  const kinds = new Set(schemas.map((schema) => requireSchemaKind(schema)));\n  if (kinds.size > 1) {\n    throw new Error(\n      `Conflicting generated schema kinds for canonical schema \"${first.name}\".`,\n    );\n  }\n\n  return {\n    ...first,\n    model: schemas.map((schema) => schema.model).join('\\n'),\n    imports: [\n      ...new Map(\n        schemas\n          .flatMap((schema) => schema.imports)\n          .map((imp) => [JSON.stringify(imp), imp]),\n      ).values(),\n    ],\n    dependencies: [\n      ...new Set(schemas.flatMap((schema) => schema.dependencies ?? [])),\n    ],\n    kind: requireSchemaKind(first),\n  };\n}\n\n/** Returns schema kind metadata or fails when route planning lacks it. */\nfunction requireSchemaKind(schema: GeneratorSchema): GeneratedSchemaKind {\n  if (!schema.kind) {\n    throw new Error(\n      `Generated schema \"${schema.name}\" is missing its kind metadata.`,\n    );\n  }\n  return schema.kind;\n}\n\n/** Serializes schema values with sorted keys for order-independent comparison. */\nfunction stableSerialize(value: unknown): string {\n  if (value === null) return 'null';\n  if (value === undefined) return 'undefined';\n  if (Array.isArray(value)) {\n    return `[${value.map(stableSerialize).join(',')}]`;\n  }\n  if (typeof value !== 'object') return JSON.stringify(value);\n\n  return `{${Object.entries(value as Record<string, unknown>)\n    .toSorted(([left], [right]) => left.localeCompare(right))\n    .map(([key, entry]) => `${JSON.stringify(key)}:${stableSerialize(entry)}`)\n    .join(',')}}`;\n}\n\n/** Checks whether two generated schemas have the same kind and definition. */\nfunction hasSameSchemaDefinition(\n  left: GeneratorSchema,\n  right: GeneratorSchema,\n): boolean {\n  return (\n    left.kind === right.kind &&\n    left.schema !== undefined &&\n    right.schema !== undefined &&\n    stableSerialize(left.schema) === stableSerialize(right.schema)\n  );\n}\n\n/** Rejects generated-file collisions between incompatible schema definitions. */\nfunction assertNoConflictingCanonicalSchema(\n  schemas: GeneratorSchema[],\n  namingConvention: NamingConvention,\n): void {\n  const canonical = schemas[0];\n  const aliases = schemas.filter((schema) => schema.name !== canonical.name);\n  const conflictingAlias = aliases.find(\n    (schema) => !hasSameSchemaDefinition(canonical, schema),\n  );\n  if (aliases.length > 0 && conflictingAlias) {\n    const generatedName = conventionName(canonical.name, namingConvention);\n    throw new Error(\n      `Schemas \"${canonical.name}\" and \"${conflictingAlias.name}\" produce the same generated file \"${generatedName}\" but have different definitions. Rename one schema or change the naming convention.`,\n    );\n  }\n}\n\n/** Removes the configured extension from a generated file name. */\nfunction stripExtension(fileName: string, fileExtension: string) {\n  return fileName.endsWith(fileExtension)\n    ? fileName.slice(0, -fileExtension.length)\n    : fileName;\n}\n\n/** Builds the output plan used to route generated schemas and their imports. */\nexport function createSchemaOutputPlan({\n  basePath,\n  schemas,\n  routes,\n  namingConvention,\n  fileExtension,\n  indexFiles,\n  importPath,\n  tsconfig,\n  schemaTagMap,\n}: SchemaOutputPlanOptions): SchemaOutputPlan {\n  const grouped = new Map<string, GeneratorSchema[]>();\n  for (const schema of schemas) {\n    const key = schemaNameKey(schema.name, namingConvention);\n    const group = grouped.get(key);\n    if (group) group.push(schema);\n    else grouped.set(key, [schema]);\n  }\n\n  const canonicalNameByAlias = new Map<string, string>();\n  const canonicalSchemas = [...grouped.values()].map((group) => {\n    assertNoConflictingCanonicalSchema(group, namingConvention);\n\n    const canonical = group[0];\n    for (const schema of group) {\n      canonicalNameByAlias.set(schema.name, canonical.name);\n    }\n\n    // Keep one definition for equivalent aliases and resolve imports to it.\n    return group.length === 1 ||\n      group.some((schema) => schema.name !== canonical.name)\n      ? { ...canonical, kind: requireSchemaKind(canonical) }\n      : mergeSchemas(group);\n  });\n  const routeKeyByName = new Map<string, SchemaRouteKey>();\n  const routePathByName = new Map<string, string>();\n  const scopePathByName = new Map<string, string>();\n  const filePathByName = new Map<string, string>();\n  const importPathByName = new Map<string, string>();\n  const routePathByKey: Record<SchemaRouteKey, string> = {\n    default: nodePath.join(basePath, routes.default),\n    enum: nodePath.join(basePath, routes.enum ?? routes.default),\n  };\n  const routeDirectories = [\n    ...new Set(\n      canonicalSchemas.map((schema) => {\n        const routeKey: SchemaRouteKey =\n          schema.kind === 'enum' && routes.enum ? 'enum' : 'default';\n        const routePath = routePathByKey[routeKey];\n        // '.' marks schemas shared across tag scopes.\n        const tag = schemaTagMap?.get(schema.name);\n        const directory = schemaTagMap\n          ? nodePath.join(routePath, tag === '.' ? 'shared' : (tag ?? 'shared'))\n          : routePath;\n        const key = schema.name;\n        const fileName = `${conventionName(schema.name, namingConvention)}${fileExtension}`;\n        const filePath = nodePath.join(directory, fileName);\n        routeKeyByName.set(key, routeKey);\n        routePathByName.set(key, directory);\n        scopePathByName.set(key, directory);\n        filePathByName.set(key, filePath);\n        importPathByName.set(\n          key,\n          `./${upath.toUnix(\n            stripExtension(\n              nodePath.relative(basePath, filePath),\n              fileExtension,\n            ),\n          )}`,\n        );\n        return directory;\n      }),\n    ),\n  ];\n\n  const findKey = (name: string) => {\n    const alias = canonicalNameByAlias.get(name);\n    if (alias && filePathByName.has(alias)) return alias;\n    if (filePathByName.has(name)) return name;\n    const converted = canonicalName(name, namingConvention);\n    if (filePathByName.has(converted)) return converted;\n    return (\n      [...filePathByName.keys()].find(\n        (key) => key.toLowerCase() === name.toLowerCase(),\n      ) ?? name\n    );\n  };\n\n  return {\n    basePath,\n    canonicalSchemas,\n    canonicalNameByAlias,\n    routeKeyByName,\n    routePathByName,\n    scopePathByName,\n    filePathByName,\n    importPathByName,\n    routePathByKey,\n    routeDirectories,\n    usesTagRouting: !!schemaTagMap,\n    rootIndexPath: indexFiles ? nodePath.join(basePath, 'index.ts') : undefined,\n    registerSchema(name, route, scopePath = routePathByKey[route]) {\n      const existing = filePathByName.get(name);\n      if (existing) return existing;\n\n      const filePath = nodePath.join(\n        scopePath,\n        `${conventionName(name, namingConvention)}${fileExtension}`,\n      );\n      routeKeyByName.set(name, route);\n      routePathByName.set(name, scopePath);\n      scopePathByName.set(name, scopePath);\n      filePathByName.set(name, filePath);\n      importPathByName.set(\n        name,\n        `./${upath.toUnix(\n          stripExtension(nodePath.relative(basePath, filePath), fileExtension),\n        )}`,\n      );\n      if (!routeDirectories.includes(scopePath)) {\n        routeDirectories.push(scopePath);\n      }\n      return filePath;\n    },\n    canonicalNameFor(name) {\n      return canonicalNameByAlias.get(name) ?? name;\n    },\n    importPathFor(importerName, targetName) {\n      const importerPath = filePathByName.get(findKey(importerName));\n      const targetPath = filePathByName.get(findKey(targetName));\n      if (!importerPath || !targetPath) return `./${targetName}`;\n\n      const extension = getImportExtension(fileExtension, tsconfig);\n      const relative = upath.relativeSafe(\n        nodePath.dirname(importerPath),\n        stripExtension(targetPath, fileExtension),\n      );\n      return `${relative}${extension}`;\n    },\n    clientImportPath(name, relativeSchemasPath) {\n      if (indexFiles) return relativeSchemasPath;\n      const key = findKey(name);\n      const importPath = key ? importPathByName.get(key) : undefined;\n      if (!importPath) return upath.joinSafe(relativeSchemasPath, name);\n      const extension = getImportExtension(fileExtension, tsconfig);\n      return `${upath.joinSafe(relativeSchemasPath, importPath.slice(2))}${extension}`;\n    },\n    packageImportPath(name) {\n      if (!importPath || indexFiles) return importPath;\n      const key = findKey(name);\n      const routeImportPath = key ? importPathByName.get(key) : undefined;\n      if (!routeImportPath) return undefined;\n      // A package subpath resolves through the consumer's export map, which\n      // knows nothing of our tsconfig: keep the custom part of the extension\n      // the way the flat rule does (getImportExtension with no tsconfig, #3966).\n      const importExtension = getImportExtension(fileExtension, undefined);\n      return `${upath.joinSafe(importPath, routeImportPath.slice(2))}${importExtension}`;\n    },\n    hasSchema(name) {\n      return filePathByName.has(findKey(name));\n    },\n  };\n}\n\n/**\n * The plan for an output, or `undefined` when `schemas.routes` is not set.\n *\n * @remarks\n * Built once during API building and carried on `WriteSpecBuilder`, because\n * client extra files (Angular's `*.resource.ts`) are rendered before any mode\n * writer runs. Both sides therefore read one plan instead of deriving the\n * layout twice — a rule derived twice is a rule that can drift.\n *\n * Files are named from `schemaFileExtension`, like every other schema writer.\n */\nexport function createSchemaOutputPlanForOutput(\n  schemas: GeneratorSchema[],\n  output: NormalizedOutputOptions,\n  schemaTagMap?: ReadonlyMap<string, string>,\n): SchemaOutputPlan | undefined {\n  const schemaOptions = output.schemas;\n  if (!schemaOptions || isString(schemaOptions) || !schemaOptions.routes) {\n    return undefined;\n  }\n\n  return createSchemaOutputPlan({\n    basePath: schemaOptions.path,\n    schemas: schemas.map((schema) => ({\n      ...schema,\n      kind:\n        schema.kind ?? (isOpenApiEnumSchema(schema.schema) ? 'enum' : 'schema'),\n    })),\n    routes: schemaOptions.routes,\n    namingConvention: output.namingConvention,\n    fileExtension: output.schemaFileExtension || '.ts',\n    indexFiles: output.indexFiles,\n    importPath: schemaOptions.importPath,\n    tsconfig: output.tsconfig,\n    schemaTagMap,\n  });\n}\n","import fs from 'node:fs';\nimport nodePath from 'node:path';\n\nimport { generateImports } from '../generators';\nimport {\n  type GeneratorImport,\n  type GeneratorSchema,\n  NamingConvention,\n  type Tsconfig,\n} from '../types';\nimport { groupBy } from '../utils';\nimport {\n  compareNatural,\n  conventionName,\n  getImportExtension,\n  upath,\n} from '../utils';\nimport { warnAmbiguousBarrelExports } from './barrel-collisions';\nimport { writeGeneratedFile } from './file';\nimport type { SchemaOutputPlan, SchemaRouteKey } from './schema-output-plan';\n\ntype CanonicalInfo = Pick<GeneratorImport, 'importPath' | 'name'>;\n\n/**\n * Patterns to detect operation-derived types (params, bodies, responses).\n * These types are auto-generated from OpenAPI operations, not from component schemas.\n */\nconst OPERATION_TYPE_PATTERNS = [\n  /Params$/i, // GetUserParams, ListUsersParams\n  /Body$/, // CreateUserBody, UpdatePostBody (case-sensitive to avoid \"Antibody\")\n  /Body(One|Two|Three|Four|Five|Item)$/, // BodyOne, BodyTwo (union body types)\n  /Parameter$/i, // PageParameter, LimitParameter\n  /Query$/i, // GetUserQuery\n  /Header$/i, // AuthHeader\n  /Response\\d*$/i, // GetUser200Response, NotFoundResponse\n  /^[1-5]\\d{2}$/, // 200, 201, 404 (valid HTTP status codes: 1xx-5xx)\n  /\\d{3}(One|Two|Three|Four|Five|Item)$/i, // 200One, 200Two (union response types)\n  /^(get|post|put|patch|delete|head|options)[A-Z].*\\d{3}$/, // operation types with status codes (get...200, post...404)\n];\n\n/**\n * Check if a schema name matches operation type patterns.\n */\nfunction isOperationType(schemaName: string): boolean {\n  return OPERATION_TYPE_PATTERNS.some((pattern) => pattern.test(schemaName));\n}\n\n/**\n * Split schemas into regular and operation types.\n */\nexport function splitSchemasByType(schemas: GeneratorSchema[]): {\n  regularSchemas: GeneratorSchema[];\n  operationSchemas: GeneratorSchema[];\n} {\n  const regularSchemas: GeneratorSchema[] = [];\n  const operationSchemas: GeneratorSchema[] = [];\n\n  for (const schema of schemas) {\n    if (isOperationType(schema.name)) {\n      operationSchemas.push(schema);\n    } else {\n      regularSchemas.push(schema);\n    }\n  }\n\n  return { regularSchemas, operationSchemas };\n}\n\n/**\n * Fix cross-directory imports when schemas reference other schemas in a different directory.\n * Updates import paths to use correct relative paths between directories.\n */\nfunction fixSchemaImports(\n  schemas: GeneratorSchema[],\n  targetSchemaNames: Set<string>,\n  fromPath: string,\n  toPath: string,\n  namingConvention: NamingConvention,\n  fileExtension: string,\n  tsconfig?: Tsconfig,\n): void {\n  const relativePath = upath.relativeSafe(fromPath, toPath);\n  const importExtension = getImportExtension(fileExtension, tsconfig);\n\n  for (const schema of schemas) {\n    schema.imports = schema.imports.map((imp) => {\n      if (targetSchemaNames.has(imp.name)) {\n        const fileName = conventionName(imp.name, namingConvention);\n        return {\n          ...imp,\n          importPath: upath.joinSafe(relativePath, fileName) + importExtension,\n        };\n      }\n      return imp;\n    });\n  }\n}\n\n/**\n * Fix imports in operation schemas that reference regular schemas.\n */\nexport function fixCrossDirectoryImports(\n  operationSchemas: GeneratorSchema[],\n  regularSchemaNames: Set<string>,\n  schemaPath: string,\n  operationSchemaPath: string,\n  namingConvention: NamingConvention,\n  fileExtension: string,\n  tsconfig?: Tsconfig,\n): void {\n  fixSchemaImports(\n    operationSchemas,\n    regularSchemaNames,\n    operationSchemaPath,\n    schemaPath,\n    namingConvention,\n    fileExtension,\n    tsconfig,\n  );\n}\n\n/**\n * Fix imports in regular schemas that reference operation schemas.\n */\nexport function fixRegularSchemaImports(\n  regularSchemas: GeneratorSchema[],\n  operationSchemaNames: Set<string>,\n  schemaPath: string,\n  operationSchemaPath: string,\n  namingConvention: NamingConvention,\n  fileExtension: string,\n  tsconfig?: Tsconfig,\n): void {\n  fixSchemaImports(\n    regularSchemas,\n    operationSchemaNames,\n    schemaPath,\n    operationSchemaPath,\n    namingConvention,\n    fileExtension,\n    tsconfig,\n  );\n}\n\nfunction getSchemaKey(\n  schemaPath: string,\n  schemaName: string,\n  namingConvention: NamingConvention,\n  fileExtension: string,\n) {\n  return getPath(\n    schemaPath,\n    conventionName(schemaName, namingConvention),\n    fileExtension,\n  )\n    .toLowerCase()\n    .replaceAll('\\\\', '/');\n}\n\nfunction getSchemaGroups(\n  schemaPath: string,\n  schemas: GeneratorSchema[],\n  namingConvention: NamingConvention,\n  fileExtension: string,\n) {\n  return groupBy(schemas, (schema) =>\n    getSchemaKey(schemaPath, schema.name, namingConvention, fileExtension),\n  );\n}\n\nfunction getCanonicalMap(\n  schemaGroups: Map<string, GeneratorSchema[]>,\n  schemaPath: string,\n  namingConvention: NamingConvention,\n  fileExtension: string,\n) {\n  const canonicalPathMap = new Map<string, CanonicalInfo>();\n  const canonicalNameMap = new Map<string, CanonicalInfo>();\n\n  for (const [key, groupSchemas] of schemaGroups) {\n    const canonicalPath = getPath(\n      schemaPath,\n      conventionName(groupSchemas[0].name, namingConvention),\n      fileExtension,\n    );\n\n    const canonicalInfo = {\n      importPath: canonicalPath,\n      name: groupSchemas[0].name,\n    };\n\n    canonicalPathMap.set(key, canonicalInfo);\n    for (const schema of groupSchemas) {\n      canonicalNameMap.set(schema.name, canonicalInfo);\n    }\n  }\n\n  return {\n    canonicalPathMap,\n    canonicalNameMap,\n  };\n}\n\nfunction normalizeCanonicalImportPaths(\n  schemas: GeneratorSchema[],\n  canonicalPathMap: Map<string, CanonicalInfo>,\n  canonicalNameMap: Map<string, CanonicalInfo>,\n  schemaPath: string,\n  namingConvention: NamingConvention,\n  fileExtension: string,\n  tsconfig?: Tsconfig,\n  factoryOutputDirectory?: string,\n) {\n  const importExtension = getImportExtension(fileExtension, tsconfig);\n  const factoryDir = factoryOutputDirectory ?? schemaPath;\n\n  for (const schema of schemas) {\n    schema.imports = schema.imports.map((imp) => {\n      const canonicalByName = canonicalNameMap.get(imp.name);\n\n      const resolvedImportKey = resolveImportKey(\n        schemaPath,\n        imp.importPath ?? `./${conventionName(imp.name, namingConvention)}`,\n        fileExtension,\n      );\n      const canonicalByPath = canonicalPathMap.get(resolvedImportKey);\n      const canonical = canonicalByName ?? canonicalByPath;\n      if (!canonical?.importPath) return imp;\n\n      const relative = upath.relativeSafe(\n        schemaPath,\n        canonical.importPath.replaceAll('\\\\', '/'),\n      );\n      // `relative` derives from canonical.importPath (built via getPath) so it\n      // normally ends with `fileExtension`; the `.ts$` branch is a defensive\n      // fallback for legacy/hardcoded `.ts` paths that don't match the\n      // configured fileExtension (e.g. `.gen.ts`).\n      const withoutFileExtension = relative.endsWith(fileExtension)\n        ? relative.slice(0, -fileExtension.length)\n        : relative.replace(/\\.ts$/, '');\n      const importPath = `${withoutFileExtension}${importExtension}`;\n\n      return { ...imp, importPath };\n    });\n\n    if (schema.factoryImports) {\n      schema.factoryImports = schema.factoryImports.map((imp) => {\n        const canonicalByName = canonicalNameMap.get(imp.name);\n\n        const resolvedImportKey = resolveImportKey(\n          factoryDir,\n          imp.importPath ?? `./${conventionName(imp.name, namingConvention)}`,\n          fileExtension,\n        );\n        const canonicalByPath = canonicalPathMap.get(resolvedImportKey);\n        const canonical = canonicalByName ?? canonicalByPath;\n        if (!canonical?.importPath) return imp;\n\n        const relative = upath.relativeSafe(\n          factoryDir,\n          canonical.importPath.replaceAll('\\\\', '/'),\n        );\n        const withoutFileExtension = relative.endsWith(fileExtension)\n          ? relative.slice(0, -fileExtension.length)\n          : relative.replace(/\\.ts$/, '');\n        const importPath = `${withoutFileExtension}${importExtension}`;\n\n        return { ...imp, importPath };\n      });\n    }\n  }\n}\n\nfunction mergeSchemaGroup(schemas: GeneratorSchema[]): GeneratorSchema {\n  const baseSchemaName = schemas[0].name;\n  const baseSchema = schemas[0].schema;\n  const mergedImports = [\n    ...new Map(\n      schemas\n        .flatMap((schema) => schema.imports)\n        .map((imp) => [JSON.stringify(imp), imp]),\n    ).values(),\n  ];\n  const mergedDependencies = [\n    ...new Set(schemas.flatMap((schema) => schema.dependencies ?? [])),\n  ];\n\n  const mergedFactory = schemas\n    .map((s) => s.factory)\n    .filter(Boolean)\n    .join('\\n');\n  const mergedFactoryImports = [\n    ...new Map(\n      schemas\n        .flatMap((schema) => schema.factoryImports ?? [])\n        .map((imp) => [JSON.stringify(imp), imp] as [string, GeneratorImport]),\n    ).values(),\n  ];\n\n  return {\n    name: baseSchemaName,\n    schema: baseSchema,\n    model: schemas.map((schema) => schema.model).join('\\n'),\n    imports: mergedImports,\n    dependencies: mergedDependencies,\n    factory: mergedFactory || undefined,\n    factoryImports: mergedFactoryImports,\n    factoryMode: schemas[0].factoryMode,\n  };\n}\n\nfunction resolveImportKey(\n  schemaPath: string,\n  importPath: string,\n  fileExtension: string,\n) {\n  return upath\n    .join(schemaPath, `${importPath}${fileExtension}`)\n    .toLowerCase()\n    .replaceAll('\\\\', '/');\n}\n\ninterface GetSchemaOptions {\n  schema: GeneratorSchema;\n  target: string;\n  header: string;\n  namingConvention?: NamingConvention;\n  importExtension?: string;\n}\n\nfunction getSchema({\n  schema: { imports, model },\n  header,\n  namingConvention = NamingConvention.CAMEL_CASE,\n  importExtension,\n}: GetSchemaOptions): string {\n  let file = header;\n  file += generateImports({\n    imports: imports.filter(\n      (imp) =>\n        !model.includes(`type ${imp.alias ?? imp.name} =`) &&\n        !model.includes(`interface ${imp.alias ?? imp.name} {`),\n    ),\n    namingConvention,\n    importExtension,\n  });\n  file += imports.length > 0 ? '\\n\\n' : '\\n';\n  file += model;\n  return file;\n}\n\nfunction getPath(path: string, name: string, fileExtension: string): string {\n  return nodePath.join(path, `${name}${fileExtension}`);\n}\n\ninterface WriteSchemaOptions {\n  path: string;\n  schema: GeneratorSchema;\n  target: string;\n  namingConvention: NamingConvention;\n  fileExtension: string;\n  header: string;\n  tsconfig?: Tsconfig;\n}\n\nexport async function writeSchema({\n  path,\n  schema,\n  target,\n  namingConvention,\n  fileExtension,\n  header,\n  tsconfig,\n}: WriteSchemaOptions) {\n  const name = conventionName(schema.name, namingConvention);\n\n  try {\n    await writeGeneratedFile(\n      getPath(path, name, fileExtension),\n      getSchema({\n        schema,\n        target,\n        header,\n        namingConvention,\n        importExtension: getImportExtension(fileExtension, tsconfig),\n      }),\n    );\n  } catch (error) {\n    throw new Error(\n      `Oups... 🍻. An Error occurred while writing schema ${name} => ${String(error)}`,\n      { cause: error },\n    );\n  }\n}\n\ninterface WriteSchemasOptions {\n  schemaPath: string;\n  schemas: GeneratorSchema[];\n  target: string;\n  namingConvention: NamingConvention;\n  fileExtension: string;\n  header: string;\n  indexFiles: boolean;\n  tsconfig?: Tsconfig;\n  factoryOutputDirectory?: string;\n}\n\nasync function emitFactoryForSchema(\n  schema: GeneratorSchema,\n  namingConvention: NamingConvention,\n  header: string,\n  factoryDir: string,\n  fileExtension: string,\n  helpers: {\n    separateFactoryNames: string[];\n    combinedFactoryContent: { value: string };\n    combinedFactoryImports: GeneratorImport[];\n    isCombined: { value: boolean };\n  },\n) {\n  if (schema.factory && schema.factoryMode) {\n    const mode = schema.factoryMode;\n    if (mode === 'split') {\n      const baseName = conventionName(schema.name, namingConvention);\n      const factoryName = `${baseName}.factory`;\n      helpers.separateFactoryNames.push(factoryName);\n      const factoryImportsStr = generateImports({\n        imports: schema.factoryImports ?? [],\n        namingConvention,\n      });\n      const factoryFile = `${header}\\n${factoryImportsStr}\\n\\n${schema.factory}`;\n      await writeGeneratedFile(\n        getPath(factoryDir, factoryName, fileExtension),\n        factoryFile,\n      );\n    } else if (mode === 'single-split') {\n      helpers.isCombined.value = true;\n      helpers.combinedFactoryContent.value += `${schema.factory}\\n`;\n      helpers.combinedFactoryImports.push(...(schema.factoryImports ?? []));\n    }\n  }\n}\n\nexport async function writeSchemas({\n  schemaPath,\n  schemas,\n  target,\n  namingConvention,\n  fileExtension,\n  header,\n  indexFiles,\n  tsconfig,\n  factoryOutputDirectory,\n}: WriteSchemasOptions) {\n  const schemaGroups = getSchemaGroups(\n    schemaPath,\n    schemas,\n    namingConvention,\n    fileExtension,\n  );\n\n  const { canonicalPathMap, canonicalNameMap } = getCanonicalMap(\n    schemaGroups,\n    schemaPath,\n    namingConvention,\n    fileExtension,\n  );\n\n  normalizeCanonicalImportPaths(\n    schemas,\n    canonicalPathMap,\n    canonicalNameMap,\n    schemaPath,\n    namingConvention,\n    fileExtension,\n    tsconfig,\n    factoryOutputDirectory,\n  );\n\n  const factoryDir = factoryOutputDirectory ?? schemaPath;\n\n  const combinedFactoryContent = { value: '' };\n  const combinedFactoryImports: GeneratorImport[] = [];\n  const isCombined = { value: false };\n  const separateFactoryNames: string[] = [];\n\n  const factoryHelpers = {\n    separateFactoryNames,\n    combinedFactoryContent,\n    combinedFactoryImports,\n    isCombined,\n  };\n\n  for (const groupSchemas of schemaGroups.values()) {\n    if (groupSchemas.length === 1) {\n      await writeSchema({\n        path: schemaPath,\n        schema: groupSchemas[0],\n        target,\n        namingConvention,\n        fileExtension,\n        header,\n        tsconfig,\n      });\n\n      const singleSchema = groupSchemas[0];\n      await emitFactoryForSchema(\n        singleSchema,\n        namingConvention,\n        header,\n        factoryDir,\n        fileExtension,\n        factoryHelpers,\n      );\n      continue;\n    }\n\n    const mergedSchema = mergeSchemaGroup(groupSchemas);\n\n    await writeSchema({\n      path: schemaPath,\n      schema: mergedSchema,\n      target,\n      namingConvention,\n      fileExtension,\n      header,\n      tsconfig,\n    });\n\n    await emitFactoryForSchema(\n      mergedSchema,\n      namingConvention,\n      header,\n      factoryDir,\n      fileExtension,\n      factoryHelpers,\n    );\n  }\n\n  if (isCombined.value) {\n    const factoryFileName = conventionName('factoryMethods', namingConvention);\n    const factoryFileImports = generateImports({\n      imports: combinedFactoryImports,\n      namingConvention,\n    });\n    const factoryFile = `${header}\\n${factoryFileImports}\\n\\n${combinedFactoryContent.value}`;\n    await writeGeneratedFile(\n      getPath(factoryDir, factoryFileName, fileExtension),\n      factoryFile,\n    );\n  }\n\n  if (indexFiles) {\n    const schemaFilePath = nodePath.join(schemaPath, `index.ts`);\n\n    // Ensure separate files are used for parallel schema writing.\n    // Throw an exception if duplicates are detected (using convention names)\n    const ext = getImportExtension(fileExtension, tsconfig);\n    const conventionNamesSet = new Set(\n      [...schemaGroups.values()].map((group) =>\n        conventionName(group[0].name, namingConvention),\n      ),\n    );\n\n    try {\n      // Create unique export statements from schemas (deduplicate by schema name)\n      const uniqueSchemaNames = [...conventionNamesSet];\n\n      // Create export statements\n      const currentExports = uniqueSchemaNames.map(\n        (schemaName) => `export * from './${schemaName}${ext}';`,\n      );\n\n      if (\n        factoryOutputDirectory &&\n        upath.normalizeSafe(factoryOutputDirectory) !==\n          upath.normalizeSafe(schemaPath) &&\n        (isCombined.value || separateFactoryNames.length > 0)\n      ) {\n        const factoryIndexFilePath = nodePath.join(\n          factoryOutputDirectory,\n          `index.ts`,\n        );\n        const factoryExports: string[] = [];\n        if (isCombined.value) {\n          const factoryFileName = conventionName(\n            'factoryMethods',\n            namingConvention,\n          );\n          factoryExports.push(`export * from './${factoryFileName}${ext}';`);\n        }\n        for (const fName of separateFactoryNames) {\n          factoryExports.push(`export * from './${fName}${ext}';`);\n        }\n        const content = `${header}\\n${factoryExports.join('\\n')}\\n`;\n        await writeGeneratedFile(factoryIndexFilePath, content);\n      } else {\n        if (isCombined.value) {\n          const factoryFileName = conventionName(\n            'factoryMethods',\n            namingConvention,\n          );\n          currentExports.push(`export * from './${factoryFileName}${ext}';`);\n        }\n        for (const fName of separateFactoryNames) {\n          currentExports.push(`export * from './${fName}${ext}';`);\n        }\n      }\n\n      const existingContent = fs.existsSync(schemaFilePath)\n        ? await fs.promises.readFile(schemaFilePath, 'utf8')\n        : '';\n      const existingExports = [\n        ...existingContent.matchAll(\n          /^\\s*export\\s+\\*\\s+from\\s+['\"]([^'\"]+)['\"]\\s*;?\\s*$/gm,\n        ),\n      ].map(([, specifier]) => `export * from '${specifier}';`);\n\n      const exports = [...new Set([...existingExports, ...currentExports])]\n        .toSorted((a, b) => compareNatural(a, b))\n        .join('\\n');\n\n      const fileContent = `${header}\\n${exports}\\n`;\n\n      await writeGeneratedFile(schemaFilePath, fileContent);\n\n      // Exports merged in from another output, or a split factory named like\n      // another schema, can collide.\n      await warnAmbiguousBarrelExports(schemaFilePath);\n    } catch (error) {\n      throw new Error(\n        `Oups... 🍻. An Error occurred while writing schema index file ${schemaFilePath} => ${String(error)}`,\n        { cause: error },\n      );\n    }\n  }\n}\n\ninterface WriteRoutedSchemasOptions {\n  plan: SchemaOutputPlan;\n  target: string;\n  namingConvention: NamingConvention;\n  fileExtension: string;\n  header: string;\n  indexFiles: boolean;\n  tsconfig?: Tsconfig;\n}\n\n/** Writes planned schemas and the route barrels that expose them. */\nexport async function writeRoutedSchemas({\n  plan,\n  target,\n  namingConvention,\n  fileExtension,\n  header,\n  indexFiles,\n  tsconfig,\n}: WriteRoutedSchemasOptions) {\n  // Write each planned schema in its route and tag scope.\n  const grouped = new Map<\n    string,\n    { route: SchemaRouteKey; schemas: GeneratorSchema[] }\n  >();\n\n  for (const schema of plan.canonicalSchemas) {\n    const route = plan.routeKeyByName.get(schema.name) ?? 'default';\n    const directory =\n      plan.scopePathByName.get(schema.name) ??\n      plan.routePathByName.get(schema.name);\n    if (!directory) continue;\n    const group = grouped.get(directory);\n    if (group) group.schemas.push(schema);\n    else grouped.set(directory, { route, schemas: [schema] });\n  }\n\n  for (const [schemaPath, { schemas }] of grouped) {\n    await fs.promises.mkdir(schemaPath, { recursive: true });\n\n    for (const schema of schemas) {\n      const imports = schema.imports.map((imp) => ({\n        ...imp,\n        name: plan.canonicalNameFor(imp.name),\n        ...(plan.hasSchema(imp.name)\n          ? {\n              importPath: plan.importPathFor(schema.name, imp.name),\n            }\n          : {}),\n      }));\n      await writeSchema({\n        path: schemaPath,\n        schema: { ...schema, imports },\n        target,\n        namingConvention,\n        fileExtension,\n        header,\n        tsconfig,\n      });\n    }\n\n    if (indexFiles) {\n      const extension = getImportExtension(fileExtension, tsconfig);\n      const exports = schemas\n        .map(\n          (schema) =>\n            `export * from './${conventionName(schema.name, namingConvention)}${extension}';`,\n        )\n        .toSorted((a, b) => compareNatural(a, b));\n      await writeGeneratedFile(\n        nodePath.join(schemaPath, 'index.ts'),\n        `${header}\\n${exports.join('\\n')}\\n`,\n      );\n    }\n  }\n\n  if (indexFiles && plan.rootIndexPath) {\n    const extension = getImportExtension(fileExtension, tsconfig);\n    const indexExtension = getImportExtension('.ts', tsconfig);\n    const routeDirectories = new Map<SchemaRouteKey, Set<string>>();\n\n    for (const [schemaPath, { route }] of grouped) {\n      const directories = routeDirectories.get(route) ?? new Set<string>();\n      directories.add(schemaPath);\n      routeDirectories.set(route, directories);\n    }\n\n    if (plan.usesTagRouting) {\n      for (const [route, directories] of routeDirectories) {\n        const routePath = plan.routePathByKey[route];\n        const routeIndexPath = nodePath.join(routePath, 'index.ts');\n        const existingContent = fs.existsSync(routeIndexPath)\n          ? await fs.promises.readFile(routeIndexPath, 'utf8')\n          : '';\n        const existingExports = [\n          ...existingContent.matchAll(\n            /^\\s*export\\s+\\*\\s+from\\s+['\"]([^'\"]+)['\"]\\s*;?\\s*$/gm,\n          ),\n        ].map(([, specifier]) => `export * from '${upath.toUnix(specifier)}';`);\n        const childExports = [...directories]\n          .map((directory) => {\n            const relative = upath.toUnix(\n              nodePath.relative(routePath, directory),\n            );\n            if (!relative) return undefined;\n            return `export * from './${relative}/index${indexExtension}';`;\n          })\n          .filter((entry): entry is string => !!entry);\n        const exports = [...new Set([...existingExports, ...childExports])]\n          .toSorted((a, b) => compareNatural(a, b))\n          .join('\\n');\n        await writeGeneratedFile(routeIndexPath, `${header}\\n${exports}\\n`);\n      }\n    }\n\n    const routeExports = [...routeDirectories.keys()]\n      .map((route) => {\n        const routePath = upath.toUnix(\n          nodePath.relative(plan.basePath, plan.routePathByKey[route]),\n        );\n        const routeIndex =\n          plan.usesTagRouting || extension ? `/index${indexExtension}` : '';\n        return `export * from './${routePath}${routeIndex}';`;\n      })\n      .toSorted((a, b) => compareNatural(a, b));\n    await writeGeneratedFile(\n      plan.rootIndexPath,\n      `${header}\\n${routeExports.join('\\n')}\\n`,\n    );\n  }\n}\n","import nodePath from 'node:path';\n\nimport {\n  type GeneratorImport,\n  type GeneratorSchema,\n  type NamingConvention,\n  type Tsconfig,\n} from '../types';\nimport {\n  compareNatural,\n  conventionName,\n  getImportExtension,\n  SHARED_DIR,\n  upath,\n} from '../utils';\nimport { writeGeneratedFile } from './file';\nimport { writeSchemas } from './schemas';\n\ninterface WriteSchemasTagsSplitOptions {\n  schemaPath: string;\n  schemas: GeneratorSchema[];\n  target: string;\n  namingConvention: NamingConvention;\n  fileExtension: string;\n  header: string;\n  indexFiles: boolean;\n  tsconfig?: Tsconfig;\n  factoryOutputDirectory?: string;\n  /**\n   * Schema→tag map from `buildSchemaTagMap`. It sets the directory of each\n   * written file, so the caller supplies the same map that resolves imports.\n   */\n  schemaTagMap: Map<string, string>;\n}\n\nexport async function writeSchemasTagsSplit({\n  schemaPath,\n  schemas,\n  target,\n  namingConvention,\n  fileExtension,\n  header,\n  indexFiles,\n  tsconfig,\n  factoryOutputDirectory,\n  schemaTagMap,\n}: WriteSchemasTagsSplitOptions) {\n  const importExtension = getImportExtension(fileExtension, tsconfig);\n\n  const groups = new Map<string, GeneratorSchema[]>();\n  for (const schema of schemas) {\n    const group = schemaTagMap.get(schema.name) ?? SHARED_DIR;\n    if (!groups.has(group)) {\n      groups.set(group, []);\n    }\n    // oxlint-disable-next-line typescript/no-non-null-assertion\n    groups.get(group)!.push(schema);\n  }\n\n  for (const [groupDir, groupSchemas] of groups) {\n    const isRoot = groupDir === SHARED_DIR;\n    const groupPath = isRoot ? schemaPath : nodePath.join(schemaPath, groupDir);\n\n    fixCrossTagImports(\n      groupSchemas,\n      schemaTagMap,\n      schemaPath,\n      groupDir,\n      namingConvention,\n      importExtension,\n    );\n\n    const groupFactoryDir = factoryOutputDirectory\n      ? isRoot\n        ? factoryOutputDirectory\n        : nodePath.join(factoryOutputDirectory, groupDir)\n      : undefined;\n\n    await writeSchemas({\n      schemaPath: groupPath,\n      schemas: groupSchemas,\n      target,\n      namingConvention,\n      fileExtension,\n      header,\n      indexFiles: !isRoot && indexFiles,\n      tsconfig,\n      factoryOutputDirectory: groupFactoryDir,\n    });\n  }\n\n  if (indexFiles && groups.size > 0) {\n    const rootIndexPath = nodePath.join(schemaPath, 'index.ts');\n\n    const rootSchemas = groups.get(SHARED_DIR) ?? [];\n    const rootExports = rootSchemas.map((s) => {\n      const fileName = conventionName(s.name, namingConvention);\n      return `export * from './${fileName}${importExtension}';`;\n    });\n\n    const tagDirs = [...groups.keys()]\n      .filter((dir) => dir !== SHARED_DIR)\n      .toSorted((a: string, b: string) => compareNatural(a, b));\n    const tagExports = tagDirs.map((dir) => {\n      const dirPath = importExtension\n        ? `./${dir}/index${importExtension}`\n        : `./${dir}`;\n      return `export * from '${dirPath}';`;\n    });\n\n    const allExports = [...rootExports, ...tagExports];\n    const content = `${header}\\n${allExports.join('\\n')}\\n`;\n    await writeGeneratedFile(rootIndexPath, content);\n  }\n}\n\nfunction fixCrossTagImports(\n  schemas: GeneratorSchema[],\n  schemaTagMap: Map<string, string>,\n  schemaPath: string,\n  currentGroupDir: string,\n  namingConvention: NamingConvention,\n  importExtension: string,\n): void {\n  const isRoot = currentGroupDir === SHARED_DIR;\n  const fromPath = isRoot\n    ? schemaPath\n    : nodePath.join(schemaPath, currentGroupDir);\n\n  for (const schema of schemas) {\n    const fixImports = (imports: GeneratorImport[]) =>\n      imports.map((imp) => {\n        const targetGroup = schemaTagMap.get(imp.name);\n        if (targetGroup === undefined || targetGroup === currentGroupDir) {\n          return imp;\n        }\n\n        const toPath =\n          targetGroup === SHARED_DIR\n            ? schemaPath\n            : nodePath.join(schemaPath, targetGroup);\n        const relativePath = upath.relativeSafe(fromPath, toPath);\n        const fileName = conventionName(imp.name, namingConvention);\n        const importPath =\n          upath.joinSafe(relativePath, fileName) + importExtension;\n\n        return { ...imp, importPath };\n      });\n\n    schema.imports = fixImports(schema.imports);\n    if (schema.factoryImports) {\n      schema.factoryImports = fixImports(schema.factoryImports);\n    }\n  }\n}\n","import type {\n  FinalizeMockImplementationOptions,\n  GeneratorImport,\n  GeneratorMockOutput,\n  NormalizedOutputOptions,\n  StrictMockSchemaKind,\n} from '../types';\n\ntype MockOutputWithStrictNames = Pick<\n  GeneratorMockOutput,\n  'strictMockSchemaTypeNames' | 'strictMockSchemaKinds'\n>;\n\nexport function getFinalizeMockImplementationOptions(\n  output: NormalizedOutputOptions,\n  mockOutputs: MockOutputWithStrictNames | readonly MockOutputWithStrictNames[],\n): FinalizeMockImplementationOptions {\n  const outputs: readonly MockOutputWithStrictNames[] = Array.isArray(\n    mockOutputs,\n  )\n    ? mockOutputs\n    : [mockOutputs];\n  const strictSchemaTypeNames = [\n    ...new Set(\n      outputs.flatMap(\n        (mockOutput) => mockOutput.strictMockSchemaTypeNames ?? [],\n      ),\n    ),\n  ];\n  // oxlint-disable-next-line unicorn/no-array-reduce\n  const strictMockSchemaKinds = outputs.reduce<\n    Record<string, StrictMockSchemaKind>\n  >((acc, mockOutput) => {\n    if (!mockOutput.strictMockSchemaKinds) {\n      return acc;\n    }\n    for (const [name, kind] of Object.entries(\n      mockOutput.strictMockSchemaKinds,\n    )) {\n      acc[name] ??= kind;\n    }\n    return acc;\n  }, {});\n\n  return {\n    mockOptions: output.override.mock,\n    strictSchemaTypeNames:\n      strictSchemaTypeNames.length > 0 ? strictSchemaTypeNames : undefined,\n    strictMockSchemaKinds:\n      Object.keys(strictMockSchemaKinds).length > 0\n        ? strictMockSchemaKinds\n        : undefined,\n  };\n}\n\n/** Drop schema-factory `{Schema}Mock` type imports that are declared locally. */\nexport function filterLocalStrictMockTypeImports(\n  imports: readonly GeneratorImport[],\n  strictSchemaTypeNames?: readonly string[],\n): GeneratorImport[] {\n  if (!strictSchemaTypeNames?.length) {\n    return [...imports];\n  }\n\n  const localMockTypeNames = new Set(\n    strictSchemaTypeNames.map((name) => `${name}Mock`),\n  );\n\n  return imports.filter(\n    (imp) =>\n      !(imp.schemaFactory && !imp.values && localMockTypeNames.has(imp.name)),\n  );\n}\n","import {\n  type FakerMockOptions,\n  type GeneratorDependency,\n  type GeneratorImport,\n  OutputMockType,\n  type NormalizedMocksConfig,\n  type NormalizedOutputOptions,\n} from '../types';\nimport { uniqueBy } from '../utils';\nimport {\n  getImportExtension,\n  getSchemasImportPath,\n  isFunction,\n  resolveSchemaImportDependencies,\n  upath,\n} from '../utils';\nimport type { SchemaOutputPlan } from './schema-output-plan';\n\n/** Builds client dependencies using tag routing or the planned schema paths. */\nexport function generateImportsForBuilder(\n  output: NormalizedOutputOptions,\n  imports: readonly GeneratorImport[],\n  relativeSchemasPath: string,\n  // Schema→tag map computed by `getApiBuilder` when `schemas.splitByTags` is\n  // enabled. Used only in the `indexFiles: false` branch to insert each\n  // schema's tag subdirectory into the import path. `'.'` is the sentinel\n  // for shared schemas (referenced by 0 or 2+ tags).\n  schemaTagMap?: Map<string, string>,\n  schemaOutputPlan?: SchemaOutputPlan,\n  // Path of the file being written. Needed to reach the schema factories when\n  // the faker generator's `schemasPath` moves them out of the schemas dir.\n  filePath?: string,\n): GeneratorDependency[] {\n  const isPackageImport = !!getSchemasImportPath(output.schemas);\n\n  // Schema-factory imports (`getPetMock` and friends) always resolve to the\n  // consolidated `<schemas-dir>/index.faker` file emitted by the faker\n  // schemas option. They bypass the per-schema convention naming below.\n  // Append `getImportExtension` so NodeNext / Node16 module resolution\n  // gets the required local-file extension (e.g. `.js`).\n  const schemaFactoryImports = imports.filter((i) => i.schemaFactory);\n  const schemaFactoryImportExtension = isPackageImport\n    ? ''\n    : getImportExtension(output.fileExtension, output.tsconfig);\n\n  // When the faker generator configures a dedicated `schemasImportPath`, use\n  // it verbatim. This is needed because `schemas.importPath` is a package\n  // barrel specifier (e.g. `@acme/models`) that may resolve to a single file\n  // via tsconfig path mappings — appending `/index.faker` produces an\n  // unresolvable sub-path in that case.\n  const schemaFactories = getSchemaFactoriesEntry(output.mock);\n  const fakerSchemasPath = schemaFactories?.schemasPath;\n  const schemaFactoryDependency =\n    schemaFactories?.schemasImportPath ??\n    (fakerSchemasPath && filePath\n      ? upath.getRelativeImportPath(\n          filePath,\n          upath.join(fakerSchemasPath, 'index.faker.ts'),\n        ) + getImportExtension(output.fileExtension, output.tsconfig)\n      : upath.joinSafe(\n          relativeSchemasPath,\n          `index.faker${schemaFactoryImportExtension}`,\n        ));\n\n  const schemaFactoryDeps: GeneratorDependency[] =\n    schemaFactoryImports.length > 0\n      ? [\n          {\n            exports: uniqueBy(\n              schemaFactoryImports,\n              (entry) => `${entry.name}|${entry.alias ?? ''}`,\n            ),\n            dependency: schemaFactoryDependency,\n          },\n        ]\n      : [];\n\n  // The rest of the schema-import bucket is for types emitted alongside\n  // each schema (`Pet`, `PetWithTag`, ...). They're routed below.\n  imports = imports.filter((i) => !i.schemaFactory);\n\n  const schemaImports = resolveSchemaImportDependencies(\n    output,\n    imports.filter((i) => !i.importPath),\n    relativeSchemasPath,\n    { schemaTagMap, schemaOutputPlan },\n  );\n\n  // Operations contribute these independently, so the same binding can\n  // arrive once as a type and once as a value (e.g. `HttpHeaders` from an\n  // operation that only types it and one that narrows with `instanceof`).\n  // A single file needs one import per binding, and a value import satisfies\n  // both uses, so the value flag wins.\n  const otherImportsMap = new Map<string, Map<string, GeneratorImport>>();\n  for (const imp of imports.filter(\n    (i): i is GeneratorImport & { importPath: string } => !!i.importPath,\n  )) {\n    const byBinding =\n      otherImportsMap.get(imp.importPath) ?? new Map<string, GeneratorImport>();\n    otherImportsMap.set(imp.importPath, byBinding);\n    const key = `${imp.name}|${imp.alias ?? ''}`;\n    const existing = byBinding.get(key);\n    if (!existing) {\n      byBinding.set(key, imp);\n    } else if (imp.values && !existing.values) {\n      byBinding.set(key, { ...existing, values: true });\n    }\n  }\n  const otherImports = [...otherImportsMap.entries()].map<GeneratorDependency>(\n    ([dependency, byBinding]) => ({\n      exports: [...byBinding.values()],\n      dependency,\n    }),\n  );\n\n  return [...schemaImports, ...schemaFactoryDeps, ...otherImports];\n}\n\n/** The faker generator entry that emits schema factories (`schemas: true`). */\nfunction getSchemaFactoriesEntry(\n  mock: NormalizedMocksConfig | undefined,\n): FakerMockOptions | undefined {\n  return mock?.generators.find(\n    (g): g is FakerMockOptions =>\n      !isFunction(g) && g.type === OutputMockType.FAKER && g.schemas === true,\n  );\n}\n","export function getOrvalGeneratedTypes() {\n  return `\n// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497\ntype IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <\nT,\n>() => T extends Y ? 1 : 2\n? A\n: B;\n\ntype WritableKeys<T> = {\n[P in keyof T]-?: IfEquals<\n  { [Q in P]: T[P] },\n  { -readonly [Q in P]: T[P] },\n  P\n>;\n}[keyof T];\n\ntype UnionToIntersection<U> =\n  (U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;\ntype DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;\n\ntype Writable<T> = Pick<T, WritableKeys<T>>;\ntype NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {\n  [P in keyof Writable<T>]: T[P] extends object\n    ? NonReadonly<NonNullable<T[P]>>\n    : T[P];\n} : DistributeReadOnlyOverUnions<T>;\n`;\n}\n\nexport function getTypedResponse() {\n  return `\ninterface TypedResponse<T> extends Response {\n  json(): Promise<T>;\n}\n`;\n}\n","import { generateMutatorImports } from '../generators';\nimport type {\n  GeneratorDependency,\n  GeneratorImport,\n  GeneratorMutator,\n  NormalizedOutputOptions,\n  WriteSpecBuilder,\n} from '../types';\nimport { escapeRegExp } from '../utils/string';\nimport { getOrvalGeneratedTypes, getTypedResponse } from './types';\n\n/**\n * Keeps only the imports whose name or alias appears in `implementation`, so\n * an import pulled in by another tag or operation does not leak into a file\n * that never references it.\n */\nexport function filterImportsUsedInImplementation(\n  imports: GeneratorImport[],\n  implementation: string,\n): GeneratorImport[] {\n  return imports.filter((imp) => {\n    const searchWords = [imp.alias, imp.name]\n      .filter((part): part is string => Boolean(part?.length))\n      .map((part) => escapeRegExp(part))\n      .join('|');\n    if (!searchWords) {\n      return false;\n    }\n\n    return new RegExp(String.raw`\\b(${searchWords})\\b`, 'g').test(\n      implementation,\n    );\n  });\n}\n\n/** The client's import header for one implementation file. */\nexport async function generateClientImports({\n  builder,\n  output,\n  implementation,\n  imports,\n  projectName,\n  isAllowSyntheticDefaultImports,\n}: {\n  builder: Pick<WriteSpecBuilder, 'imports'>;\n  output: NormalizedOutputOptions;\n  implementation: string;\n  imports: readonly GeneratorDependency[];\n  projectName?: string;\n  isAllowSyntheticDefaultImports: boolean;\n}): Promise<string> {\n  return await builder.imports({\n    client: output.client,\n    implementation,\n    imports,\n    projectName,\n    hasSchemaDir: !!output.schemas,\n    isAllowSyntheticDefaultImports,\n    hasGlobalMutator: !!output.override.mutator,\n    hasTagsMutator: Object.values(output.override.tags).some(\n      (tag) => !!tag?.mutator,\n    ),\n    hasParamsSerializerOptions: !!output.override.paramsSerializerOptions,\n    packageJson: output.packageJson,\n    output,\n  });\n}\n\nexport interface TargetMutators {\n  mutators?: GeneratorMutator[];\n  clientMutators?: GeneratorMutator[];\n  formData?: GeneratorMutator[];\n  formUrlEncoded?: GeneratorMutator[];\n  paramsSerializer?: GeneratorMutator[];\n  paramsFilter?: GeneratorMutator[];\n  fetchReviver?: GeneratorMutator[];\n}\n\n/**\n * Import statements for every mutator kind a target carries, in the order\n * the generated file declares them. Only the plain `mutators` are matched\n * against `implementation`; the other kinds are always imported.\n */\nexport function generateTargetMutatorImports(\n  target: TargetMutators,\n  implementation: string,\n  oneMore?: boolean,\n): string {\n  let data = '';\n\n  if (target.mutators) {\n    data += generateMutatorImports({\n      mutators: target.mutators,\n      implementation,\n      oneMore,\n    });\n  }\n\n  for (const mutators of [\n    target.clientMutators,\n    target.formData,\n    target.formUrlEncoded,\n    target.paramsSerializer,\n    target.paramsFilter,\n    target.fetchReviver,\n  ]) {\n    if (mutators) {\n      data += generateMutatorImports({ mutators, oneMore });\n    }\n  }\n\n  return data;\n}\n\n/**\n * Local type declarations an implementation relies on (`NonReadonly<>`,\n * `TypedResponse<>`), emitted only when the implementation uses them.\n */\nexport function generateOrvalHelperTypes(implementation: string): string {\n  let data = '';\n\n  if (implementation.includes('NonReadonly<')) {\n    data += getOrvalGeneratedTypes();\n    data += '\\n';\n  }\n\n  if (implementation.includes('TypedResponse<')) {\n    data += getTypedResponse();\n    data += '\\n';\n  }\n\n  return data;\n}\n","import type { GeneratorImport } from '../types';\nimport { pascal } from '../utils';\n\nexport interface KnownSchemaFactoryImportSets {\n  factoryNames: ReadonlySet<string>;\n  typeNames: ReadonlySet<string>;\n}\n\n/** Maps `components/schemas` names to consolidated index.faker import symbols. */\nexport function buildKnownSchemaFactoryImportSets(\n  schemaNames: readonly string[],\n): KnownSchemaFactoryImportSets {\n  const factoryNames = new Set<string>();\n  const typeNames = new Set<string>();\n\n  for (const name of schemaNames) {\n    const typeName = pascal(name);\n    factoryNames.add(`get${typeName}Mock`);\n    typeNames.add(`${typeName}Mock`);\n  }\n\n  return { factoryNames, typeNames };\n}\n\n/**\n * Recover schema-factory imports referenced in generated mock bodies but\n * missing from the collected import list (e.g. after shared-array import\n * aggregation on large specs). Scans for `get<Schema>Mock()` calls and\n * `as <Schema>Mock` casts emitted by strict schema delegation (#3590).\n *\n * When `knownSets` is provided, only symbols that exist in the consolidated\n * schemas faker file are recovered — this avoids importing one-off split\n * response helper factories that live in the tag file itself.\n */\nexport function collectSchemaFactoryImportsFromImplementation(\n  implementation: string,\n  knownSets?: KnownSchemaFactoryImportSets,\n): GeneratorImport[] {\n  const imports: GeneratorImport[] = [];\n  const seen = new Set<string>();\n\n  for (const match of implementation.matchAll(/\\b(get[A-Za-z0-9]+Mock)\\(\\)/g)) {\n    const factoryName = match[1];\n    if (knownSets && !knownSets.factoryNames.has(factoryName)) {\n      continue;\n    }\n    const key = `value::${factoryName}`;\n    if (seen.has(key)) continue;\n    seen.add(key);\n    imports.push({\n      name: factoryName,\n      values: true,\n      schemaFactory: true,\n    });\n  }\n\n  for (const match of implementation.matchAll(/\\bas ([A-Za-z0-9]+Mock)\\b/g)) {\n    const typeName = match[1];\n    if (knownSets && !knownSets.typeNames.has(typeName)) {\n      continue;\n    }\n    const key = `type::${typeName}`;\n    if (seen.has(key)) continue;\n    seen.add(key);\n    imports.push({\n      name: typeName,\n      values: false,\n      schemaFactory: true,\n    });\n  }\n\n  return imports;\n}\n\nexport function mergeGeneratorImports(\n  ...groups: readonly (readonly GeneratorImport[])[]\n): GeneratorImport[] {\n  const merged = new Map<string, GeneratorImport>();\n\n  for (const group of groups) {\n    for (const imp of group) {\n      const key = `${imp.name}::${imp.alias ?? ''}`;\n      const existing = merged.get(key);\n      if (!existing) {\n        merged.set(key, imp);\n        continue;\n      }\n      if (!existing.values && imp.values) {\n        merged.set(key, imp);\n      }\n    }\n  }\n\n  return [...merged.values()];\n}\n\n/** Recover missing index.faker imports when `schemas: true` is enabled. */\nexport function collectRecoveredSchemaFactoryImports(\n  implementation: string,\n  componentSchemaNames: readonly string[],\n): GeneratorImport[] {\n  return collectSchemaFactoryImportsFromImplementation(\n    implementation,\n    buildKnownSchemaFactoryImportSets(componentSchemaNames),\n  );\n}\n","import {\n  type GeneratorImport,\n  type GeneratorMockOutput,\n  type GeneratorMockOutputFull,\n  OutputMockType,\n} from '../types';\nimport { upath } from '../utils';\n\n/**\n * Collapses the per-generator mock outputs for \"inline\" writer modes\n * (`single`, `tags`) where every mock generator's content is concatenated\n * into the implementation file. The MSW generator already emits the\n * response-factory functions (`get<Op>ResponseMock`) that Faker would emit,\n * so when both generators are configured we keep MSW and drop Faker to\n * avoid duplicate function declarations and re-imported faker bindings.\n */\nexport function collapseInlineMockOutputs<\n  T extends GeneratorMockOutput | GeneratorMockOutputFull,\n>(mockOutputs: T[]): T[] {\n  const hasMsw = mockOutputs.some((m) => m.type === OutputMockType.MSW);\n  if (!hasMsw) return mockOutputs;\n  return mockOutputs.filter((m) => m.type !== OutputMockType.FAKER);\n}\n\n/**\n * Flattens a `GeneratorMockOutputFull` (which keeps `function` and `handler`\n * separate) into a `GeneratorMockOutput` by concatenating the two portions.\n */\nexport function flattenMockOutput(\n  full: GeneratorMockOutputFull,\n): GeneratorMockOutput {\n  return {\n    type: full.type,\n    implementation: full.implementation.function + full.implementation.handler,\n    imports: full.imports,\n    strictMockSchemaTypeNames: full.strictMockSchemaTypeNames,\n    strictMockSchemaKinds: full.strictMockSchemaKinds,\n  };\n}\n\n// Handler fallback calls are always emitted argument-less, so match an\n// empty `()` exactly.\nconst RESPONSE_MOCK_CALL_RE = /:\\s*(get\\w+ResponseMock\\w*)\\(\\)/g;\n\nexport interface CollapseMswFakerOptions {\n  // The msw generator's `operationResponses` flag. When false and no faker\n  // output provides the factories, the handlers fall back to `undefined`\n  // instead of calling the response factories.\n  mswOperationResponses?: boolean;\n}\n\n/**\n * Decides where the `get<Op>ResponseMock` factories live so `.msw.ts` never\n * duplicates them:\n *\n * - The faker output declares every factory the handlers call: strip them\n *   from the MSW output, the writer imports them from the faker file instead.\n * - `mswOperationResponses` is false: strip the factories and replace the\n *   handler fallbacks with `undefined`.\n * - Otherwise leave the output unchanged, factories stay inline in `.msw.ts`.\n *\n * No need to remove the `faker` import when stripping, it is only added\n * during import generation while the implementation still uses `faker.*`.\n */\nexport function collapseMswFakerFullOutputs(\n  mockOutputs: GeneratorMockOutputFull[],\n  options: CollapseMswFakerOptions = {},\n): GeneratorMockOutputFull[] {\n  const mswEntry = mockOutputs.find((m) => m.type === OutputMockType.MSW);\n  if (!mswEntry || mswEntry.implementation.function.trim().length === 0)\n    return mockOutputs;\n\n  const fakerEntry = mockOutputs.find((m) => m.type === OutputMockType.FAKER);\n\n  // Factories can only move if the faker output declares every factory the\n  // handlers call, otherwise the handlers would call names that don't exist\n  // (e.g. faker configured with operationResponses: false).\n  let fakerDeclaresAllReferenced = false;\n  if (fakerEntry) {\n    const declared = new Set(\n      extractResponseMockNames(fakerEntry.implementation.function),\n    );\n    fakerDeclaresAllReferenced = extractResponseMockNames(\n      mswEntry.implementation.handler,\n    ).every((name) => declared.has(name));\n  }\n\n  if (fakerDeclaresAllReferenced) {\n    return mockOutputs.map((m) =>\n      m.type === OutputMockType.MSW\n        ? { ...m, implementation: { ...m.implementation, function: '' } }\n        : m,\n    );\n  }\n\n  if (options.mswOperationResponses === false) {\n    const strippedHandler = mswEntry.implementation.handler.replaceAll(\n      RESPONSE_MOCK_CALL_RE,\n      ': undefined',\n    );\n\n    return mockOutputs.map((m) =>\n      m.type === OutputMockType.MSW\n        ? {\n            ...m,\n            implementation: {\n              ...m.implementation,\n              function: '',\n              handler: strippedHandler,\n            },\n          }\n        : m,\n    );\n  }\n\n  return mockOutputs;\n}\n\nconst RESPONSE_MOCK_NAME_RE = /\\bget\\w+ResponseMock\\w*\\b/g;\n\n/**\n * Collects the unique `get<Op>ResponseMock` names in a mock implementation,\n * including the status-suffixed ones from `generateEachHttpStatus`\n * (e.g. `getListPetsResponseMock200`).\n */\nexport function extractResponseMockNames(implementation: string): string[] {\n  return [\n    ...new Set(\n      [...implementation.matchAll(RESPONSE_MOCK_NAME_RE)].map((m) => m[0]),\n    ),\n  ];\n}\n\n/**\n * Builds the imports that let a `.msw.ts` file call the response factories\n * declared in its `.faker.ts` file. Only imports names the handlers actually\n * call and the faker file actually declares, so the import list can't drift\n * out of sync with either file. `packageImportPath` (the faker generator's\n * `importPath`) replaces the relative path when set.\n */\nexport function buildCrossFileFakerImports(\n  mswFilePath: string,\n  fakerFilePath: string,\n  mswImplementation: string,\n  fakerImplementation: string,\n  importExtension = '',\n  packageImportPath?: string,\n): GeneratorImport[] {\n  const referencedNames = extractResponseMockNames(mswImplementation);\n  if (referencedNames.length === 0) return [];\n\n  const declaredNames = new Set(extractResponseMockNames(fakerImplementation));\n  const responseMockNames = referencedNames.filter((name) =>\n    declaredNames.has(name),\n  );\n  if (responseMockNames.length === 0) return [];\n\n  const fakerImportPath =\n    packageImportPath ??\n    upath.getRelativeImportPath(mswFilePath, fakerFilePath) + importExtension;\n\n  return responseMockNames.map((name): GeneratorImport => ({\n    name,\n    values: true,\n    importPath: fakerImportPath,\n  }));\n}\n\n/**\n * Re-export statement for the factories a `.msw.ts` file imports from its\n * faker file, so importing them from the msw file keeps working like before\n * the split.\n */\nexport function buildFakerReexportStatement(\n  imports: readonly GeneratorImport[],\n): string {\n  if (imports.length === 0) return '';\n  const names = imports.map((imp) => imp.name).join(', ');\n  return `export { ${names} } from '${imports[0].importPath}';\\n`;\n}\n","import type { PackageJson } from '../types';\nimport { compareVersions } from '../utils';\n\nconst getTypeScriptVersion = (packageJson?: PackageJson): string => {\n  return (\n    packageJson?.resolvedVersions?.typescript ??\n    packageJson?.dependencies?.typescript ??\n    packageJson?.devDependencies?.typescript ??\n    packageJson?.peerDependencies?.typescript ??\n    '4.4.0'\n  );\n};\n\nexport const hasTypeScriptAwaitedType = (packageJson?: PackageJson) =>\n  compareVersions(getTypeScriptVersion(packageJson), '4.5.0');\n","import {\n  type GeneratorMockOutputFull,\n  type GeneratorTarget,\n  type GeneratorTargetFull,\n  type NormalizedOutputOptions,\n  OutputClient,\n  type WriteSpecBuilder,\n} from '../types';\nimport { pascal } from '../utils';\nimport { flattenMockOutput } from './mock-outputs';\nimport { hasTypeScriptAwaitedType } from './typescript-version';\n\nfunction emptyMockOutputFull(\n  type: GeneratorMockOutputFull['type'],\n): GeneratorMockOutputFull {\n  return {\n    type,\n    implementation: { function: '', handler: '', handlerName: '' },\n    imports: [],\n  };\n}\n\n/**\n * `mockOutputsFull` keeps `function` and `handler` separate so the split\n * writers can strip factories from the MSW output before flattening.\n */\nexport interface GeneratorTargetWithFull extends GeneratorTarget {\n  mockOutputsFull: GeneratorMockOutputFull[];\n}\n\nexport async function generateTarget(\n  builder: WriteSpecBuilder,\n  options: NormalizedOutputOptions,\n): Promise<GeneratorTargetWithFull> {\n  const operationNames = Object.values(builder.operations).map(\n    ({ operationName }) => operationName,\n  );\n  const isAngularClient = options.client === OutputClient.ANGULAR;\n\n  const titles = await builder.title({\n    outputClient: options.client,\n    title: pascal(builder.info.title),\n    customTitleFunc: options.override.title,\n    output: options,\n  });\n\n  const target: Required<Omit<GeneratorTargetFull, 'mockOutputs'>> & {\n    mockOutputs: GeneratorMockOutputFull[];\n  } = {\n    imports: [],\n    implementation: '',\n    mockOutputs: [],\n    mutators: [],\n    clientMutators: [],\n    formData: [],\n    formUrlEncoded: [],\n    paramsSerializer: [],\n    paramsFilter: [],\n    fetchReviver: [],\n    sharedTypes: [],\n  };\n  const operations = Object.values(builder.operations);\n  for (const [index, operation] of operations.entries()) {\n    target.imports.push(...operation.imports);\n    target.implementation += operation.implementation + '\\n';\n\n    // Merge per-mock-type outputs from this operation into the accumulator.\n    for (const opMock of operation.mockOutputs) {\n      let acc = target.mockOutputs.find((m) => m.type === opMock.type);\n      if (!acc) {\n        acc = emptyMockOutputFull(opMock.type);\n        target.mockOutputs.push(acc);\n      }\n      acc.imports.push(...opMock.imports);\n      if (opMock.strictMockSchemaTypeNames?.length) {\n        acc.strictMockSchemaTypeNames = [\n          ...new Set([\n            ...(acc.strictMockSchemaTypeNames ?? []),\n            ...opMock.strictMockSchemaTypeNames,\n          ]),\n        ];\n      }\n      if (opMock.strictMockSchemaKinds) {\n        acc.strictMockSchemaKinds = {\n          ...acc.strictMockSchemaKinds,\n          ...opMock.strictMockSchemaKinds,\n        };\n      }\n      acc.implementation.function += opMock.implementation.function;\n      acc.implementation.handler += opMock.implementation.handler;\n      if (opMock.implementation.handlerName) {\n        const separator =\n          acc.implementation.handlerName.length > 0 ? ',\\n  ' : '  ';\n        acc.implementation.handlerName +=\n          separator + opMock.implementation.handlerName + '()';\n      }\n    }\n\n    if (operation.mutator) {\n      target.mutators.push(operation.mutator);\n    }\n\n    if (operation.formData) {\n      target.formData.push(operation.formData);\n    }\n    if (operation.formUrlEncoded) {\n      target.formUrlEncoded.push(operation.formUrlEncoded);\n    }\n    if (operation.paramsSerializer) {\n      target.paramsSerializer.push(operation.paramsSerializer);\n    }\n    if (operation.paramsFilter) {\n      target.paramsFilter.push(operation.paramsFilter);\n    }\n\n    if (operation.clientMutators) {\n      target.clientMutators.push(...operation.clientMutators);\n    }\n\n    if (operation.fetchReviver) {\n      target.fetchReviver.push(operation.fetchReviver);\n    }\n\n    if (index === operations.length - 1) {\n      const isMutator = target.mutators.some((mutator) =>\n        isAngularClient ? mutator.hasThirdArg : mutator.hasSecondArg,\n      );\n\n      const hasAwaitedType = hasTypeScriptAwaitedType(options.packageJson);\n\n      const header = await builder.header({\n        outputClient: options.client,\n        isRequestOptions: options.override.requestOptions !== false,\n        isMutator,\n        isGlobalMutator: !!options.override.mutator,\n        provideIn: options.override.angular.provideIn,\n        hasAwaitedType,\n        titles,\n        output: options,\n        verbOptions: builder.verbOptions,\n        clientImplementation: target.implementation,\n      });\n\n      const inlinedSharedTypes =\n        header.sharedTypes && header.sharedTypes.length > 0\n          ? header.sharedTypes\n              .map((t) => `${t.exported ? 'export ' : ''}${t.code}`)\n              .join('\\n') + '\\n\\n'\n          : '';\n\n      target.implementation =\n        inlinedSharedTypes + header.implementation + target.implementation;\n\n      const footer = await builder.footer({\n        outputClient: options.client,\n        operationNames,\n        operations,\n        hasMutator: target.mutators.length > 0,\n        hasAwaitedType,\n        titles,\n        output: options,\n      });\n      target.implementation += footer.implementation;\n\n      // Append the aggregated handler array (header + footer wrap) to every\n      // mock output that has at least one handler. Faker-only outputs (no\n      // handlerName) do not get the wrapper.\n      for (const acc of target.mockOutputs) {\n        if (acc.implementation.handlerName) {\n          acc.implementation.handler =\n            acc.implementation.handler +\n            header.implementationMock +\n            acc.implementation.handlerName +\n            footer.implementationMock;\n        }\n      }\n    }\n  }\n\n  return {\n    imports: target.imports,\n    implementation: target.implementation,\n    mockOutputs: target.mockOutputs.map((m) => flattenMockOutput(m)),\n    mockOutputsFull: target.mockOutputs,\n    mutators: target.mutators,\n    clientMutators: target.clientMutators,\n    formData: target.formData,\n    formUrlEncoded: target.formUrlEncoded,\n    paramsSerializer: target.paramsSerializer,\n    paramsFilter: target.paramsFilter,\n    fetchReviver: target.fetchReviver,\n  };\n}\n","import path from 'node:path';\n\nimport { generateModelsInline } from '../generators';\nimport { OutputMockType, type WriteModeProps } from '../types';\nimport {\n  conventionName,\n  getFileInfo,\n  getImportExtension,\n  getSchemasImportPath,\n  isFunction,\n  isString,\n  isSyntheticDefaultImportsAllow,\n  upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { writeGeneratedFile } from './file';\nimport {\n  getFinalizeMockImplementationOptions,\n  filterLocalStrictMockTypeImports,\n} from './finalize-mock-implementation';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport {\n  filterImportsUsedInImplementation,\n  generateClientImports,\n  generateOrvalHelperTypes,\n  generateTargetMutatorImports,\n} from './implementation-parts';\nimport {\n  collectRecoveredSchemaFactoryImports,\n  mergeGeneratorImports,\n} from './mock-imports';\nimport { collapseInlineMockOutputs } from './mock-outputs';\nimport { getMockDir, resolveMockSchemasPath } from './mock-utils';\nimport { generateTarget } from './target';\n\nexport async function writeSingleMode({\n  builder,\n  output,\n  projectName,\n  header,\n  needSchema,\n  generateSchemasInline,\n  schemaTagMap,\n  schemaOutputPlan,\n}: WriteModeProps): Promise<string[]> {\n  try {\n    const {\n      path: targetPath,\n      filename,\n      dirname,\n      extension,\n    } = getFileInfo(output.target, {\n      backupFilename: conventionName(\n        // oxlint-disable-next-line typescript/no-unnecessary-condition\n        builder.info.title ?? 'filename',\n        output.namingConvention,\n      ),\n      extension: output.fileExtension,\n    });\n\n    const target = await generateTarget(builder, output);\n\n    const { imports, mockOutputs: rawMockOutputs, implementation } = target;\n\n    const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n      output.tsconfig,\n    );\n\n    // Mock code lands in sibling `<target>.msw.ts` / `<target>.faker.ts`\n    // files by default, matching `split`/`tags-split`. `mock.inline: true`\n    // opts back into appending mock code to the implementation file.\n    const shouldDeinlineMocks = !output.mock.inline;\n\n    const schemaCustomImportPath = getSchemasImportPath(output.schemas);\n    const schemasPath = output.schemas\n      ? (schemaCustomImportPath ??\n        upath.getRelativeImportPath(\n          targetPath,\n          getFileInfo(\n            isString(output.schemas) ? output.schemas : output.schemas.path,\n            { extension: output.fileExtension },\n          ).dirname,\n        ))\n      : undefined;\n\n    const relativeSchemasPath =\n      schemasPath ??\n      './' + filename + '.schemas' + extension.replace(/\\.ts$/, '');\n\n    const schemasTarget = output.schemas\n      ? getFileInfo(\n          isString(output.schemas) ? output.schemas : output.schemas.path,\n          { extension: output.fileExtension },\n        ).dirname\n      : targetPath;\n\n    const implementationImports = filterImportsUsedInImplementation(\n      imports,\n      implementation,\n    );\n\n    const normalizedImports = implementationImports.map((imp) => ({ ...imp }));\n\n    const collapsedMockOutputs = shouldDeinlineMocks\n      ? []\n      : collapseInlineMockOutputs(rawMockOutputs);\n\n    if (!shouldDeinlineMocks) {\n      const importsMock = collapsedMockOutputs.flatMap((m) => m.imports);\n\n      for (const mockImport of importsMock) {\n        const matchingImport = normalizedImports.find(\n          (imp) =>\n            imp.name === mockImport.name &&\n            (imp.alias ?? '') === (mockImport.alias ?? ''),\n        );\n        if (!matchingImport) continue;\n\n        const mockNeedsRuntimeValue =\n          !!mockImport.values ||\n          !!mockImport.isConstant ||\n          !!mockImport.default ||\n          !!mockImport.namespaceImport ||\n          !!mockImport.syntheticDefaultImport;\n        if (mockNeedsRuntimeValue) {\n          matchingImport.values = true;\n        }\n      }\n    }\n\n    let data = header;\n\n    const importsForBuilder = schemasPath\n      ? generateImportsForBuilder(\n          output,\n          normalizedImports,\n          relativeSchemasPath,\n          schemaTagMap,\n          schemaOutputPlan,\n        )\n      : generateImportsForBuilder(\n          output,\n          normalizedImports.filter((imp) => !!imp.importPath),\n          '.',\n        );\n\n    data += await generateClientImports({\n      builder,\n      output,\n      implementation,\n      imports: importsForBuilder,\n      projectName,\n      isAllowSyntheticDefaultImports,\n    });\n\n    if (!shouldDeinlineMocks) {\n      for (const mockOutput of collapsedMockOutputs) {\n        const entry = output.mock.generators.find(\n          (g) => !isFunction(g) && g.type === mockOutput.type,\n        );\n        const finalizeMockOptions = getFinalizeMockImplementationOptions(\n          output,\n          mockOutput,\n        );\n        const finalizedMockImplementation = builder.finalizeMockImplementation\n          ? builder.finalizeMockImplementation(\n              mockOutput.implementation,\n              finalizeMockOptions,\n            )\n          : mockOutput.implementation;\n        const usesSchemaFactories =\n          !!entry &&\n          !isFunction(entry) &&\n          entry.type === OutputMockType.FAKER &&\n          entry.schemas === true;\n        const recoveredSchemaFactoryImports =\n          usesSchemaFactories && output.schemas\n            ? collectRecoveredSchemaFactoryImports(\n                finalizedMockImplementation,\n                builder.schemas.filter((s) => s.schema).map((s) => s.name),\n              )\n            : [];\n        const filteredMockImports = filterLocalStrictMockTypeImports(\n          mergeGeneratorImports(\n            mockOutput.imports,\n            recoveredSchemaFactoryImports,\n          ).filter(\n            (impMock) =>\n              !normalizedImports.some(\n                (imp) =>\n                  imp.name === impMock.name &&\n                  (imp.alias ?? '') === (impMock.alias ?? ''),\n              ),\n          ),\n          finalizeMockOptions.strictSchemaTypeNames,\n        );\n        const importsMockForBuilder = schemasPath\n          ? generateImportsForBuilder(\n              output,\n              filteredMockImports,\n              relativeSchemasPath,\n              schemaTagMap,\n              schemaOutputPlan,\n              targetPath,\n            )\n          : generateImportsForBuilder(\n              output,\n              filteredMockImports.filter((imp) => !!imp.importPath),\n              '.',\n            );\n        data += builder.importsMock({\n          implementation: finalizedMockImplementation,\n          imports: importsMockForBuilder,\n          projectName,\n          hasSchemaDir: !!output.schemas,\n          isAllowSyntheticDefaultImports,\n          options: entry && !isFunction(entry) ? entry : undefined,\n        });\n      }\n    }\n\n    data += generateTargetMutatorImports(target, implementation);\n\n    data += generateOrvalHelperTypes(implementation);\n\n    if (!output.schemas && needSchema) {\n      data += generateSchemasInline\n        ? generateSchemasInline()\n        : generateModelsInline(builder.schemas);\n    }\n\n    data += `${implementation.trim()}\\n`;\n\n    if (!shouldDeinlineMocks) {\n      const implementationMock = collapsedMockOutputs\n        .map((m) => m.implementation)\n        .join('\\n\\n');\n      const finalizedImplementationMock = builder.finalizeMockImplementation\n        ? builder.finalizeMockImplementation(\n            implementationMock,\n            getFinalizeMockImplementationOptions(output, collapsedMockOutputs),\n          )\n        : implementationMock;\n\n      if (collapsedMockOutputs.length > 0) {\n        data += '\\n\\n';\n        data += finalizedImplementationMock;\n      }\n    }\n\n    await writeGeneratedFile(targetPath, data);\n\n    const extraPaths: string[] = [];\n\n    if (shouldDeinlineMocks) {\n      const seenMockIndexKeys = new Set<string>();\n      const writtenMockEntries: {\n        extension: OutputMockType;\n        mockDir: string;\n      }[] = [];\n\n      for (const mockOutput of rawMockOutputs) {\n        const rawEntry = output.mock.generators.find((g) => {\n          if (isFunction(g)) return mockOutput.type === OutputMockType.MSW;\n          return g.type === mockOutput.type;\n        });\n        if (!rawEntry) continue;\n\n        const mockExtension = isFunction(rawEntry)\n          ? OutputMockType.MSW\n          : getMockFileExtensionByTypeName(rawEntry);\n        const mockDir = getMockDir(rawEntry, output.mock) ?? dirname;\n\n        const mockFilePath = path.join(\n          mockDir,\n          filename + '.' + mockExtension + extension,\n        );\n\n        const mockRelativeSchemasPath =\n          schemaCustomImportPath ??\n          resolveMockSchemasPath(mockFilePath, schemasTarget);\n\n        const finalizeMockOptions = getFinalizeMockImplementationOptions(\n          output,\n          mockOutput,\n        );\n\n        const finalizedMockImplementation = builder.finalizeMockImplementation\n          ? builder.finalizeMockImplementation(\n              mockOutput.implementation,\n              finalizeMockOptions,\n            )\n          : mockOutput.implementation;\n\n        const usesSchemaFactories =\n          !isFunction(rawEntry) &&\n          rawEntry.type === OutputMockType.FAKER &&\n          rawEntry.schemas === true;\n        const recoveredSchemaFactoryImports =\n          usesSchemaFactories && output.schemas\n            ? collectRecoveredSchemaFactoryImports(\n                finalizedMockImplementation,\n                builder.schemas.filter((s) => s.schema).map((s) => s.name),\n              )\n            : [];\n\n        const importsMockForBuilder = generateImportsForBuilder(\n          output,\n          filterLocalStrictMockTypeImports(\n            mergeGeneratorImports(\n              mockOutput.imports,\n              recoveredSchemaFactoryImports,\n            ),\n            finalizeMockOptions.strictSchemaTypeNames,\n          ),\n          mockRelativeSchemasPath,\n          schemaTagMap,\n          schemaOutputPlan,\n          mockFilePath,\n        );\n\n        let mockData = header;\n        mockData += builder.importsMock({\n          implementation: finalizedMockImplementation,\n          imports: importsMockForBuilder,\n          projectName,\n          hasSchemaDir: !!output.schemas,\n          isAllowSyntheticDefaultImports,\n          options: isFunction(rawEntry) ? undefined : rawEntry,\n        });\n        mockData += `\\n${finalizedMockImplementation}`;\n\n        await writeGeneratedFile(mockFilePath, mockData);\n        extraPaths.push(mockFilePath);\n\n        const indexKey = `${mockExtension}::${mockDir}`;\n        if (!seenMockIndexKeys.has(indexKey)) {\n          seenMockIndexKeys.add(indexKey);\n          writtenMockEntries.push({ extension: mockExtension, mockDir });\n        }\n      }\n\n      if (output.mock.indexMockFiles) {\n        const importExtension = getImportExtension(\n          output.fileExtension,\n          output.tsconfig,\n        );\n        for (const { extension: mockExt, mockDir } of writtenMockEntries) {\n          const indexMockPath = path.join(\n            mockDir,\n            `index.${mockExt}${extension}`,\n          );\n          await writeGeneratedFile(\n            indexMockPath,\n            `export * from './${filename}.${mockExt}${importExtension}'\\n`,\n          );\n          extraPaths.push(indexMockPath);\n        }\n      }\n    }\n\n    return [targetPath, ...extraPaths];\n  } catch (error) {\n    const errorMsg = error instanceof Error ? error.message : 'unknown error';\n    throw new Error(\n      `Oups... 🍻. An Error occurred while writing file => ${errorMsg}`,\n      { cause: error },\n    );\n  }\n}\n","import path from 'node:path';\n\nimport { generateModelsInline } from '../generators';\nimport {\n  type MswMockOptions,\n  OutputClient,\n  OutputMockType,\n  type WriteModeProps,\n} from '../types';\nimport {\n  conventionName,\n  getFileInfo,\n  getImportExtension,\n  getSchemasImportPath,\n  isFunction,\n  isString,\n  isSyntheticDefaultImportsAllow,\n  upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { writeGeneratedFile } from './file';\nimport {\n  filterLocalStrictMockTypeImports,\n  getFinalizeMockImplementationOptions,\n} from './finalize-mock-implementation';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport {\n  generateClientImports,\n  generateOrvalHelperTypes,\n  generateTargetMutatorImports,\n} from './implementation-parts';\nimport {\n  collectRecoveredSchemaFactoryImports,\n  mergeGeneratorImports,\n} from './mock-imports';\nimport {\n  buildCrossFileFakerImports,\n  buildFakerReexportStatement,\n  collapseMswFakerFullOutputs,\n  flattenMockOutput,\n} from './mock-outputs';\nimport {\n  getFakerEntry,\n  getMockDir,\n  resolveMockSchemasPath,\n} from './mock-utils';\nimport { generateTarget } from './target';\n\nexport async function writeSplitMode({\n  builder,\n  output,\n  projectName,\n  header,\n  needSchema,\n  generateSchemasInline,\n  schemaTagMap,\n  schemaOutputPlan,\n}: WriteModeProps): Promise<string[]> {\n  try {\n    const {\n      path: targetPath,\n      filename,\n      dirname,\n      extension,\n    } = getFileInfo(output.target, {\n      backupFilename: conventionName(\n        // oxlint-disable-next-line typescript/no-unnecessary-condition\n        builder.info.title ?? 'filename',\n        output.namingConvention,\n      ),\n      extension: output.fileExtension,\n    });\n\n    const target = await generateTarget(builder, output);\n\n    const { imports, implementation, mockOutputsFull } = target;\n\n    const mswGeneratorEntry = output.mock.generators.find(\n      (g): g is MswMockOptions =>\n        !isFunction(g) && g.type === OutputMockType.MSW,\n    );\n    const collapsedFull = collapseMswFakerFullOutputs(mockOutputsFull, {\n      mswOperationResponses: mswGeneratorEntry?.operationResponses,\n    });\n    const mockOutputs = collapsedFull.map((m) => flattenMockOutput(m));\n\n    let implementationData = header;\n\n    const schemaCustomImportPath = getSchemasImportPath(output.schemas);\n    const relativeSchemasPath = output.schemas\n      ? (schemaCustomImportPath ??\n        // `output.schemas(.path)` is a directory. Resolve the relative import\n        // to it directly (with the file extension kept) so the path stays\n        // correct even when the directory does not exist on disk yet and when\n        // its name contains a dot, e.g. `*.schemas` (#3624). Deriving it from\n        // `getFileInfo(...).dirname` collapsed to `./.` in those cases.\n        upath.getRelativeImportPath(\n          targetPath,\n          isString(output.schemas) ? output.schemas : output.schemas.path,\n          true,\n        ))\n      : './' +\n        filename +\n        '.schemas' +\n        getImportExtension(output.schemaFileExtension, output.tsconfig);\n\n    const schemasTarget = output.schemas\n      ? // `output.schemas(.path)` already *is* the schemas directory. Use it\n        // directly rather than `getFileInfo(...).dirname`, which collapses to\n        // the parent directory when the name contains a dot, e.g. `*.schemas`\n        // (#3624) — that broke the mock files' schema imports derived from\n        // `schemasTarget` via `resolveMockSchemasPath`. For a dot-free name\n        // `getFileInfo(...).dirname` returns the same directory, so existing\n        // output is unchanged.\n        isString(output.schemas)\n        ? output.schemas\n        : output.schemas.path\n      : path.join(\n          dirname,\n          filename +\n            '.schemas' +\n            getImportExtension(output.schemaFileExtension, output.tsconfig),\n        );\n\n    const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n      output.tsconfig,\n    );\n\n    const importsForBuilder = generateImportsForBuilder(\n      output,\n      imports,\n      relativeSchemasPath,\n      schemaTagMap,\n      schemaOutputPlan,\n    );\n\n    implementationData += await generateClientImports({\n      builder,\n      output,\n      implementation,\n      imports: importsForBuilder,\n      projectName,\n      isAllowSyntheticDefaultImports,\n    });\n\n    const schemasPath =\n      !output.schemas && needSchema\n        ? path.join(dirname, filename + '.schemas' + output.schemaFileExtension)\n        : undefined;\n\n    if (schemasPath) {\n      const schemasData = generateSchemasInline\n        ? header + generateSchemasInline()\n        : header + generateModelsInline(builder.schemas);\n\n      await writeGeneratedFile(schemasPath, schemasData);\n    }\n\n    implementationData += generateTargetMutatorImports(target, implementation);\n\n    implementationData += generateOrvalHelperTypes(implementation);\n\n    implementationData += `\\n${implementation}`;\n\n    const implementationFilename =\n      filename +\n      (OutputClient.ANGULAR === output.client ? '.service' : '') +\n      extension;\n\n    const implementationPath = path.join(dirname, implementationFilename);\n    await writeGeneratedFile(implementationPath, implementationData);\n\n    const mockPaths: string[] = [];\n\n    const hasFaker = mockOutputs.some((m) => m.type === OutputMockType.FAKER);\n    // Only import from the faker file when the collapse actually moved the\n    // factories there, importing names that are still declared locally would\n    // clash.\n    const mswFactoriesMoved =\n      hasFaker &&\n      collapsedFull.some(\n        (m) =>\n          m.type === OutputMockType.MSW &&\n          m.implementation.function.trim().length === 0,\n      );\n    const fakerImplementation =\n      mockOutputs.find((m) => m.type === OutputMockType.FAKER)\n        ?.implementation ?? '';\n    const fakerEntry = getFakerEntry(output.mock);\n    const fakerDir = fakerEntry\n      ? (getMockDir(fakerEntry, output.mock) ?? dirname)\n      : dirname;\n    const fakerFilePath = path.join(fakerDir, filename + '.faker' + extension);\n    const fakerImportExtension = getImportExtension(extension, output.tsconfig);\n\n    const seenMockIndexKeys = new Set<string>();\n    const writtenMockEntries: {\n      extension: OutputMockType;\n      mockDir: string;\n    }[] = [];\n    for (const mockOutput of mockOutputs) {\n      const rawEntry = output.mock.generators.find((g) => {\n        if (isFunction(g)) return mockOutput.type === OutputMockType.MSW;\n        return g.type === mockOutput.type;\n      });\n      if (!rawEntry) continue;\n\n      const mockExtension = isFunction(rawEntry)\n        ? OutputMockType.MSW\n        : getMockFileExtensionByTypeName(rawEntry);\n      const mockDir = getMockDir(rawEntry, output.mock) ?? dirname;\n\n      const mockFilePath = path.join(\n        mockDir,\n        filename + '.' + mockExtension + extension,\n      );\n\n      const mockRelativeSchemasPath =\n        schemaCustomImportPath ??\n        resolveMockSchemasPath(mockFilePath, schemasTarget);\n\n      const finalizeMockOptions = getFinalizeMockImplementationOptions(\n        output,\n        mockOutput,\n      );\n\n      const finalizedMockImplementation = builder.finalizeMockImplementation\n        ? builder.finalizeMockImplementation(\n            mockOutput.implementation,\n            finalizeMockOptions,\n          )\n        : mockOutput.implementation;\n\n      const usesSchemaFactories =\n        !isFunction(rawEntry) &&\n        rawEntry.type === OutputMockType.FAKER &&\n        rawEntry.schemas === true;\n      const recoveredSchemaFactoryImports =\n        usesSchemaFactories && output.schemas\n          ? collectRecoveredSchemaFactoryImports(\n              finalizedMockImplementation,\n              builder.schemas.filter((s) => s.schema).map((s) => s.name),\n            )\n          : [];\n\n      const crossFileFakerImports =\n        mswFactoriesMoved && mockOutput.type === OutputMockType.MSW\n          ? buildCrossFileFakerImports(\n              mockFilePath,\n              fakerFilePath,\n              mockOutput.implementation,\n              fakerImplementation,\n              fakerImportExtension,\n              fakerEntry?.importPath,\n            )\n          : [];\n\n      const importsMockForBuilder = generateImportsForBuilder(\n        output,\n        filterLocalStrictMockTypeImports(\n          mergeGeneratorImports(\n            mockOutput.imports,\n            recoveredSchemaFactoryImports,\n            crossFileFakerImports,\n          ),\n          finalizeMockOptions.strictSchemaTypeNames,\n        ),\n        mockRelativeSchemasPath,\n        schemaTagMap,\n        schemaOutputPlan,\n        mockFilePath,\n      );\n      let mockData = header;\n      mockData += builder.importsMock({\n        implementation: finalizedMockImplementation,\n        imports: importsMockForBuilder,\n        projectName,\n        hasSchemaDir: !!output.schemas,\n        isAllowSyntheticDefaultImports,\n        options: isFunction(rawEntry) ? undefined : rawEntry,\n      });\n      // Re-export the factories so importing them from the msw file keeps\n      // working.\n      mockData += buildFakerReexportStatement(crossFileFakerImports);\n      mockData += `\\n${finalizedMockImplementation}`;\n\n      await writeGeneratedFile(mockFilePath, mockData);\n      mockPaths.push(mockFilePath);\n\n      const indexKey = `${mockExtension}::${mockDir}`;\n      if (!seenMockIndexKeys.has(indexKey)) {\n        seenMockIndexKeys.add(indexKey);\n        writtenMockEntries.push({ extension: mockExtension, mockDir });\n      }\n    }\n\n    const indexMockPaths: string[] = [];\n    if (output.mock.indexMockFiles) {\n      const importExtension = getImportExtension(\n        output.fileExtension,\n        output.tsconfig,\n      );\n      for (const { extension: mockExt, mockDir } of writtenMockEntries) {\n        const indexMockPath = path.join(\n          mockDir,\n          `index.${mockExt}${extension}`,\n        );\n        await writeGeneratedFile(\n          indexMockPath,\n          `export * from './${filename}.${mockExt}${importExtension}'\\n`,\n        );\n        indexMockPaths.push(indexMockPath);\n      }\n    }\n\n    return [\n      implementationPath,\n      ...(schemasPath ? [schemasPath] : []),\n      ...mockPaths,\n      ...indexMockPaths,\n    ];\n  } catch (error) {\n    throw new Error(\n      `Oups... 🍻. An Error occurred while splitting => ${String(error)}`,\n      { cause: error },\n    );\n  }\n}\n","import {\n  DefaultTag,\n  type GeneratorMockOutputFull,\n  type GeneratorOperation,\n  type GeneratorTargetFull,\n  type NormalizedOutputOptions,\n  OutputClient,\n  type WriteSpecBuilder,\n} from '../types';\nimport {\n  escapeRegExp,\n  getOperationTagKey,\n  isOperationInTagBucket,\n  pascal,\n} from '../utils';\nimport { flattenMockOutput } from './mock-outputs';\nimport type { GeneratorTargetWithFull } from './target';\nimport { hasTypeScriptAwaitedType } from './typescript-version';\n\n/**\n * Ensures every operation has at least one tag by falling back to the\n * {@link DefaultTag} constant for untagged operations, so the tag-routing\n * logic in {@link generateTargetTags} always has a bucket to assign the\n * operation to.\n */\nfunction addDefaultTagIfEmpty(operation: GeneratorOperation) {\n  return {\n    ...operation,\n    tags: operation.tags.length > 0 ? operation.tags : [DefaultTag],\n  };\n}\n\nfunction emptyMockOutputFull(\n  type: GeneratorMockOutputFull['type'],\n): GeneratorMockOutputFull {\n  return {\n    type,\n    implementation: { function: '', handler: '', handlerName: '' },\n    imports: [],\n  };\n}\n\nfunction aliasConflictingSchemaFactory(\n  mockOutput: GeneratorMockOutputFull,\n  localMockName: string,\n): GeneratorMockOutputFull {\n  if (!mockOutput.implementation.handlerName) {\n    return mockOutput;\n  }\n\n  const hasCollision = mockOutput.imports.some(\n    (imp) => imp.schemaFactory && (imp.alias ?? imp.name) === localMockName,\n  );\n  if (!hasCollision) {\n    return mockOutput;\n  }\n\n  const implementation = Object.values(mockOutput.implementation).join('\\n');\n  const usedBindings = new Set(\n    mockOutput.imports.map((imp) => imp.alias ?? imp.name),\n  );\n  let alias = `${localMockName}SchemaFactory`;\n  let suffix = 2;\n  while (\n    usedBindings.has(alias) ||\n    new RegExp(String.raw`\\b${escapeRegExp(alias)}\\b`).test(implementation)\n  ) {\n    alias = `${localMockName}SchemaFactory${suffix}`;\n    suffix += 1;\n  }\n\n  const bindingPattern = new RegExp(\n    String.raw`\\b${escapeRegExp(localMockName)}\\b`,\n    'g',\n  );\n  const replaceBinding = (value: string) =>\n    value.replaceAll(bindingPattern, alias);\n\n  return {\n    ...mockOutput,\n    implementation: {\n      function: replaceBinding(mockOutput.implementation.function),\n      handler: replaceBinding(mockOutput.implementation.handler),\n      handlerName: replaceBinding(mockOutput.implementation.handlerName),\n    },\n    imports: mockOutput.imports.map((imp) =>\n      imp.schemaFactory && (imp.alias ?? imp.name) === localMockName\n        ? { ...imp, alias }\n        : imp,\n    ),\n  };\n}\n\nfunction mergeOperationMockOutputs(\n  accMockOutputs: GeneratorMockOutputFull[],\n  opMockOutputs: GeneratorMockOutputFull[],\n): GeneratorMockOutputFull[] {\n  const result: GeneratorMockOutputFull[] = accMockOutputs.map((m) => ({\n    type: m.type,\n    implementation: { ...m.implementation },\n    imports: [...m.imports],\n    strictMockSchemaTypeNames: m.strictMockSchemaTypeNames\n      ? [...m.strictMockSchemaTypeNames]\n      : undefined,\n    strictMockSchemaKinds: m.strictMockSchemaKinds\n      ? { ...m.strictMockSchemaKinds }\n      : undefined,\n  }));\n  for (const op of opMockOutputs) {\n    let acc = result.find((m) => m.type === op.type);\n    if (!acc) {\n      acc = emptyMockOutputFull(op.type);\n      result.push(acc);\n    }\n    acc.imports.push(...op.imports);\n    if (op.strictMockSchemaTypeNames?.length) {\n      acc.strictMockSchemaTypeNames = [\n        ...new Set([\n          ...(acc.strictMockSchemaTypeNames ?? []),\n          ...op.strictMockSchemaTypeNames,\n        ]),\n      ];\n    }\n    if (op.strictMockSchemaKinds) {\n      acc.strictMockSchemaKinds = {\n        ...acc.strictMockSchemaKinds,\n        ...op.strictMockSchemaKinds,\n      };\n    }\n    acc.implementation.function += op.implementation.function;\n    acc.implementation.handler += op.implementation.handler;\n    if (op.implementation.handlerName) {\n      const separator =\n        acc.implementation.handlerName.length > 0 ? ',\\n  ' : '  ';\n      acc.implementation.handlerName +=\n        separator + op.implementation.handlerName + '()';\n    }\n  }\n  return result;\n}\n\nfunction initialMockOutputsForOperation(\n  op: GeneratorOperation,\n): GeneratorMockOutputFull[] {\n  return op.mockOutputs.map((m) => ({\n    type: m.type,\n    implementation: {\n      function: m.implementation.function,\n      handler: m.implementation.handler,\n      handlerName: m.implementation.handlerName\n        ? '  ' + m.implementation.handlerName + '()'\n        : '',\n    },\n    imports: [...m.imports],\n    strictMockSchemaTypeNames: m.strictMockSchemaTypeNames\n      ? [...m.strictMockSchemaTypeNames]\n      : undefined,\n    strictMockSchemaKinds: m.strictMockSchemaKinds\n      ? { ...m.strictMockSchemaKinds }\n      : undefined,\n  }));\n}\n\nfunction generateTargetTags(\n  currentAcc: Record<string, GeneratorTargetFull>,\n  operation: GeneratorOperation,\n): Record<string, GeneratorTargetFull> {\n  const tag = getOperationTagKey(operation);\n\n  if (!Object.hasOwn(currentAcc, tag)) {\n    currentAcc[tag] = {\n      imports: operation.imports,\n      mockOutputs: initialMockOutputsForOperation(operation),\n      mutators: operation.mutator ? [operation.mutator] : [],\n      clientMutators: operation.clientMutators ?? [],\n      formData: operation.formData ? [operation.formData] : [],\n      formUrlEncoded: operation.formUrlEncoded\n        ? [operation.formUrlEncoded]\n        : [],\n      paramsSerializer: operation.paramsSerializer\n        ? [operation.paramsSerializer]\n        : [],\n      paramsFilter: operation.paramsFilter ? [operation.paramsFilter] : [],\n      fetchReviver: operation.fetchReviver ? [operation.fetchReviver] : [],\n      implementation: operation.implementation,\n    };\n\n    return currentAcc;\n  }\n\n  const currentOperation = currentAcc[tag];\n  currentAcc[tag] = {\n    implementation: currentOperation.implementation + operation.implementation,\n    imports: [...currentOperation.imports, ...operation.imports],\n    mockOutputs: mergeOperationMockOutputs(\n      currentOperation.mockOutputs,\n      operation.mockOutputs,\n    ),\n    mutators: operation.mutator\n      ? [...(currentOperation.mutators ?? []), operation.mutator]\n      : currentOperation.mutators,\n    clientMutators: operation.clientMutators\n      ? [\n          ...(currentOperation.clientMutators ?? []),\n          ...operation.clientMutators,\n        ]\n      : currentOperation.clientMutators,\n    formData: operation.formData\n      ? [...(currentOperation.formData ?? []), operation.formData]\n      : currentOperation.formData,\n    formUrlEncoded: operation.formUrlEncoded\n      ? [...(currentOperation.formUrlEncoded ?? []), operation.formUrlEncoded]\n      : currentOperation.formUrlEncoded,\n    paramsSerializer: operation.paramsSerializer\n      ? [\n          ...(currentOperation.paramsSerializer ?? []),\n          operation.paramsSerializer,\n        ]\n      : currentOperation.paramsSerializer,\n    paramsFilter: operation.paramsFilter\n      ? [...(currentOperation.paramsFilter ?? []), operation.paramsFilter]\n      : currentOperation.paramsFilter,\n    fetchReviver: operation.fetchReviver\n      ? [...(currentOperation.fetchReviver ?? []), operation.fetchReviver]\n      : currentOperation.fetchReviver,\n  };\n  return currentAcc;\n}\n\nexport async function generateTargetForTags(\n  builder: WriteSpecBuilder,\n  options: NormalizedOutputOptions,\n) {\n  const isAngularClient = options.client === OutputClient.ANGULAR;\n\n  const operations = Object.values(builder.operations).map((operation) =>\n    addDefaultTagIfEmpty(operation),\n  );\n  let allTargetTags: Record<string, GeneratorTargetFull> = {};\n  for (const [index, operation] of operations.entries()) {\n    allTargetTags = generateTargetTags(allTargetTags, operation);\n\n    if (index === operations.length - 1) {\n      const transformed: Record<string, GeneratorTargetFull> = {};\n      for (const [tag, target] of Object.entries(allTargetTags)) {\n        const isMutator = !!target.mutators?.some((mutator) =>\n          isAngularClient ? mutator.hasThirdArg : mutator.hasSecondArg,\n        );\n        const operationNames = operations\n          // Operations can have multiple tags, but they are grouped by their\n          // primary (first) tag. Filtering through the canonical\n          // `isOperationInTagBucket` keeps this in lockstep with how the\n          // buckets above were built, including untagged operations that were\n          // routed into the implicit `default` bucket by `addDefaultTagIfEmpty`.\n          .filter((operation) => isOperationInTagBucket(operation, tag));\n\n        const hasAwaitedType = hasTypeScriptAwaitedType(options.packageJson);\n\n        const titles = await builder.title({\n          outputClient: options.client,\n          title: pascal(tag),\n          customTitleFunc: options.override.title,\n          output: options,\n        });\n\n        const footer = await builder.footer({\n          outputClient: options.client,\n          operationNames: operationNames.map(\n            ({ operationName }) => operationName,\n          ),\n          operations: operationNames,\n          hasMutator: !!target.mutators?.length,\n          hasAwaitedType,\n          titles,\n          output: options,\n        });\n\n        const header = await builder.header({\n          outputClient: options.client,\n          isRequestOptions: options.override.requestOptions !== false,\n          isMutator,\n          isGlobalMutator: !!options.override.mutator,\n          provideIn: options.override.angular.provideIn,\n          hasAwaitedType,\n          titles,\n          output: options,\n          verbOptions: builder.verbOptions,\n          tag,\n          isDefaultTagBucket:\n            tag === 'default' &&\n            Object.values(builder.operations).some(\n              (operation) => operation.tags.length === 0,\n            ),\n          clientImplementation: target.implementation,\n        });\n\n        const sharedTypes = header.sharedTypes;\n        const deduplicationActive =\n          options.tagsSplitDeduplication && !options.workspace;\n        const inlinedSharedTypes =\n          !deduplicationActive && sharedTypes && sharedTypes.length > 0\n            ? sharedTypes\n                .map((t) => `${t.exported ? 'export ' : ''}${t.code}`)\n                .join('\\n') + '\\n\\n'\n            : '';\n\n        // Apply the per-tag header/footer wrap to each mock output that has\n        // accumulated handler entries. Mock outputs without a handler (faker\n        // only) skip the wrap.\n        const wrappedMockOutputs: GeneratorMockOutputFull[] =\n          target.mockOutputs.map((mockOutput) => {\n            const collisionSafeMockOutput = aliasConflictingSchemaFactory(\n              mockOutput,\n              titles.implementationMock,\n            );\n\n            return {\n              ...collisionSafeMockOutput,\n              implementation: {\n                function: collisionSafeMockOutput.implementation.function,\n                handler: collisionSafeMockOutput.implementation.handlerName\n                  ? collisionSafeMockOutput.implementation.handler +\n                    header.implementationMock +\n                    collisionSafeMockOutput.implementation.handlerName +\n                    footer.implementationMock\n                  : collisionSafeMockOutput.implementation.handler,\n                handlerName: collisionSafeMockOutput.implementation.handlerName,\n              },\n            };\n          });\n\n        transformed[tag] = {\n          implementation:\n            inlinedSharedTypes +\n            header.implementation +\n            target.implementation +\n            footer.implementation,\n          mockOutputs: wrappedMockOutputs,\n          imports: target.imports,\n          mutators: target.mutators,\n          clientMutators: target.clientMutators,\n          formData: target.formData,\n          formUrlEncoded: target.formUrlEncoded,\n          paramsSerializer: target.paramsSerializer,\n          paramsFilter: target.paramsFilter,\n          fetchReviver: target.fetchReviver,\n          // Forwarded regardless of deduplication: the writer needs to know\n          // which shared type names each tag declares (even when it inlines\n          // its own copy) so a root barrel can avoid re-export ambiguity\n          // between tags that redeclare the same type.\n          sharedTypes,\n        };\n      }\n      allTargetTags = transformed;\n    }\n  }\n\n  const result: Record<string, GeneratorTargetWithFull> = {};\n  for (const [tag, target] of Object.entries(allTargetTags)) {\n    result[tag] = {\n      ...target,\n      mockOutputs: target.mockOutputs.map((m) => flattenMockOutput(m)),\n      mockOutputsFull: target.mockOutputs,\n    };\n  }\n  return result;\n}\n","import path from 'node:path';\n\nimport { generateModelsInline } from '../generators';\nimport {\n  type MswMockOptions,\n  OutputClient,\n  OutputMockType,\n  type SharedTypeDeclaration,\n  type WriteModeProps,\n} from '../types';\nimport {\n  buildBarrelReExports,\n  conventionName,\n  getFileInfo,\n  getImportExtension,\n  getSchemasImportPath,\n  isFunction,\n  isString,\n  isSyntheticDefaultImportsAllow,\n  pascal,\n  upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { writeGeneratedFile } from './file';\nimport {\n  getFinalizeMockImplementationOptions,\n  filterLocalStrictMockTypeImports,\n} from './finalize-mock-implementation';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport {\n  generateClientImports,\n  generateOrvalHelperTypes,\n  generateTargetMutatorImports,\n} from './implementation-parts';\nimport {\n  collectRecoveredSchemaFactoryImports,\n  mergeGeneratorImports,\n} from './mock-imports';\nimport {\n  buildCrossFileFakerImports,\n  buildFakerReexportStatement,\n  collapseMswFakerFullOutputs,\n  flattenMockOutput,\n} from './mock-outputs';\nimport {\n  getFakerEntry,\n  getMockDir,\n  resolveMockSchemasPath,\n} from './mock-utils';\nimport { generateTargetForTags } from './target-tags';\n\nexport async function writeSplitTagsMode({\n  builder,\n  output,\n  projectName,\n  header,\n  needSchema,\n  generateSchemasInline,\n  schemaTagMap,\n  schemaOutputPlan,\n}: WriteModeProps): Promise<string[]> {\n  const { filename, dirname, extension } = getFileInfo(output.target, {\n    backupFilename: conventionName(\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      builder.info.title ?? 'filename',\n      output.namingConvention,\n    ),\n    extension: output.fileExtension,\n  });\n\n  const target = await generateTargetForTags(builder, output);\n\n  const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n    output.tsconfig,\n  );\n\n  interface MockIndexEntry {\n    ext: OutputMockType;\n    mockDir: string;\n    tags: string[];\n  }\n  const mockIndexEntries: MockIndexEntry[] = [];\n  const seenMockIndexKeys = new Set<string>();\n\n  const schemasTarget = output.schemas\n    ? // `output.schemas(.path)` already *is* the schemas directory. Use it\n      // directly rather than `getFileInfo(...).dirname`, which collapses to the\n      // parent directory when the name contains a dot, e.g. `*.schemas` (#3624)\n      // — that broke the mock files' schema imports derived from `schemasTarget`\n      // via `resolveMockSchemasPath`. For a dot-free name `getFileInfo(...)\n      // .dirname` returns the same directory, so existing output is unchanged.\n      isString(output.schemas)\n      ? output.schemas\n      : output.schemas.path\n    : path.join(\n        dirname,\n        filename +\n          '.schemas' +\n          getImportExtension(output.schemaFileExtension, output.tsconfig),\n      );\n\n  const tagEntries = Object.entries(target).toSorted(([a], [b]) =>\n    a.localeCompare(b),\n  );\n\n  const deduplicationEnabled =\n    output.tagsSplitDeduplication && !output.workspace;\n\n  const collectedSharedTypes: SharedTypeDeclaration[] = [];\n  const seenSharedTypeNames = new Set<string>();\n  // Without deduplication, each tag inlines its own copy of any shared type\n  // it needs (e.g. the fetch client's `HTTPStatusCode1xx` union). Recording\n  // the first tag that declares each name lets the root barrel re-export it\n  // by name from that one tag instead of via `export *`, which would be\n  // ambiguous once more than one tag redeclares the same type.\n  const firstTagForSharedType = new Map<string, string>();\n  for (const [tag, target] of tagEntries) {\n    if (!target.sharedTypes) continue;\n    for (const t of target.sharedTypes) {\n      if (!seenSharedTypeNames.has(t.name)) {\n        seenSharedTypeNames.add(t.name);\n        collectedSharedTypes.push(t);\n        firstTagForSharedType.set(t.name, tag);\n      }\n    }\n  }\n\n  const commonTypesImportExtension = getImportExtension(\n    extension,\n    output.tsconfig,\n  );\n  const commonTypesBasename = output.commonTypesFileName;\n  const commonTypesPath = path.join(dirname, commonTypesBasename + extension);\n  const commonTypesRelativeImport =\n    '..' +\n    '/' +\n    commonTypesBasename +\n    (deduplicationEnabled ? commonTypesImportExtension : '');\n\n  const generatedFilePathsArray = await Promise.all(\n    tagEntries.map(async ([tag, target]) => {\n      try {\n        const { imports, implementation, mockOutputsFull } = target;\n\n        const mswGeneratorEntry = output.mock.generators.find(\n          (g): g is MswMockOptions =>\n            !isFunction(g) && g.type === OutputMockType.MSW,\n        );\n        const collapsedFull = collapseMswFakerFullOutputs(mockOutputsFull, {\n          mswOperationResponses: mswGeneratorEntry?.operationResponses,\n        });\n        const mockOutputs = collapsedFull.map((m) => flattenMockOutput(m));\n\n        let implementationData = header;\n\n        if (\n          deduplicationEnabled &&\n          target.sharedTypes &&\n          target.sharedTypes.length > 0\n        ) {\n          const typeNames = target.sharedTypes.map((t) => t.name).join(', ');\n          implementationData += `import type { ${typeNames} } from '${commonTypesRelativeImport}';\\n`;\n        }\n\n        const importerPath = path.join(dirname, tag, tag + extension);\n        const schemaCustomImportPath = getSchemasImportPath(output.schemas);\n        const relativeSchemasPath = output.schemas\n          ? (schemaCustomImportPath ??\n            // `output.schemas(.path)` is a directory. Resolve the relative\n            // import to it directly (with the file extension kept) so the path\n            // stays correct even when the directory does not exist on disk yet\n            // and when its name contains a dot, e.g. `*.schemas` (#3624).\n            // Deriving it from `getFileInfo(...).dirname` collapsed to `../.`\n            // in those cases.\n            upath.getRelativeImportPath(\n              importerPath,\n              isString(output.schemas) ? output.schemas : output.schemas.path,\n              true,\n            ))\n          : '../' +\n            filename +\n            '.schemas' +\n            getImportExtension(output.schemaFileExtension, output.tsconfig);\n\n        const tagNames = new Set(tagEntries.map(([t]) => t));\n        const serviceSuffix =\n          OutputClient.ANGULAR === output.client ? '.service' : '';\n\n        const adjustedImports = imports.map((imp) => {\n          if (!imp.importPath) return imp;\n\n          if (!imp.importPath.startsWith('.')) return imp;\n\n          const resolvedPath = path.resolve(dirname, imp.importPath);\n          const targetBasename = path.basename(resolvedPath);\n\n          let targetFile: string;\n          if (tagNames.has(targetBasename)) {\n            const tagFilename = targetBasename + serviceSuffix + extension;\n            targetFile = path.join(resolvedPath, tagFilename);\n          } else {\n            targetFile = resolvedPath + extension;\n          }\n\n          const adjustedPath = upath.getRelativeImportPath(\n            importerPath,\n            targetFile,\n          );\n\n          return { ...imp, importPath: adjustedPath };\n        });\n\n        const importsForBuilder = generateImportsForBuilder(\n          output,\n          adjustedImports,\n          relativeSchemasPath,\n          schemaTagMap,\n          schemaOutputPlan,\n        );\n\n        implementationData += await generateClientImports({\n          builder,\n          output,\n          implementation,\n          imports: importsForBuilder,\n          projectName,\n          isAllowSyntheticDefaultImports,\n        });\n\n        const schemasPath =\n          !output.schemas && needSchema\n            ? path.join(\n                dirname,\n                filename + '.schemas' + output.schemaFileExtension,\n              )\n            : undefined;\n\n        if (schemasPath) {\n          const schemasData = generateSchemasInline\n            ? header + generateSchemasInline()\n            : header + generateModelsInline(builder.schemas);\n\n          await writeGeneratedFile(schemasPath, schemasData);\n        }\n\n        implementationData += generateTargetMutatorImports(\n          target,\n          implementation,\n          true,\n        );\n\n        implementationData += generateOrvalHelperTypes(implementation);\n\n        implementationData += `\\n${implementation}`;\n\n        const implementationFilename =\n          tag +\n          (OutputClient.ANGULAR === output.client ? '.service' : '') +\n          extension;\n\n        const implementationPath = path.join(\n          dirname,\n          tag,\n          implementationFilename,\n        );\n        await writeGeneratedFile(implementationPath, implementationData);\n\n        const mockPaths: string[] = [];\n\n        const hasFaker = mockOutputs.some(\n          (m) => m.type === OutputMockType.FAKER,\n        );\n        // Only import from the faker file when the collapse actually moved\n        // the factories there, importing names that are still declared\n        // locally would clash.\n        const mswFactoriesMoved =\n          hasFaker &&\n          collapsedFull.some(\n            (m) =>\n              m.type === OutputMockType.MSW &&\n              m.implementation.function.trim().length === 0,\n          );\n        const fakerImplementation =\n          mockOutputs.find((m) => m.type === OutputMockType.FAKER)\n            ?.implementation ?? '';\n        const fakerEntry = getFakerEntry(output.mock);\n        const fakerDir = fakerEntry\n          ? (getMockDir(fakerEntry, output.mock) ?? dirname)\n          : dirname;\n        const fakerFilePath = path.join(\n          fakerDir,\n          tag,\n          tag + '.faker' + extension,\n        );\n        const fakerImportExtension = getImportExtension(\n          extension,\n          output.tsconfig,\n        );\n\n        for (const mockOutput of mockOutputs) {\n          const rawEntry = output.mock.generators.find((g) => {\n            if (isFunction(g)) return mockOutput.type === OutputMockType.MSW;\n            return g.type === mockOutput.type;\n          });\n          if (!rawEntry) continue;\n\n          const mockExtension = isFunction(rawEntry)\n            ? OutputMockType.MSW\n            : getMockFileExtensionByTypeName(rawEntry);\n          const mockDir = getMockDir(rawEntry, output.mock) ?? dirname;\n\n          const mockFilePath = path.join(\n            mockDir,\n            tag,\n            tag + '.' + mockExtension + extension,\n          );\n\n          const mockRelativeSchemasPath =\n            schemaCustomImportPath ??\n            resolveMockSchemasPath(mockFilePath, schemasTarget);\n\n          const finalizeMockOptions = getFinalizeMockImplementationOptions(\n            output,\n            mockOutput,\n          );\n\n          const finalizedMockImplementation = builder.finalizeMockImplementation\n            ? builder.finalizeMockImplementation(\n                mockOutput.implementation,\n                finalizeMockOptions,\n              )\n            : mockOutput.implementation;\n\n          const usesSchemaFactories =\n            !isFunction(rawEntry) &&\n            rawEntry.type === OutputMockType.FAKER &&\n            rawEntry.schemas === true;\n          const recoveredSchemaFactoryImports =\n            usesSchemaFactories && output.schemas\n              ? collectRecoveredSchemaFactoryImports(\n                  finalizedMockImplementation,\n                  builder.schemas.filter((s) => s.schema).map((s) => s.name),\n                )\n              : [];\n\n          const crossFileFakerImports =\n            mswFactoriesMoved && mockOutput.type === OutputMockType.MSW\n              ? buildCrossFileFakerImports(\n                  mockFilePath,\n                  fakerFilePath,\n                  mockOutput.implementation,\n                  fakerImplementation,\n                  fakerImportExtension,\n                  fakerEntry?.importPath,\n                )\n              : [];\n\n          const importsMockForBuilder = generateImportsForBuilder(\n            output,\n            filterLocalStrictMockTypeImports(\n              mergeGeneratorImports(\n                mockOutput.imports,\n                recoveredSchemaFactoryImports,\n                crossFileFakerImports,\n              ),\n              finalizeMockOptions.strictSchemaTypeNames,\n            ),\n            mockRelativeSchemasPath,\n            schemaTagMap,\n            schemaOutputPlan,\n            mockFilePath,\n          );\n\n          let mockData = header;\n          mockData += builder.importsMock({\n            implementation: finalizedMockImplementation,\n            imports: importsMockForBuilder,\n            projectName,\n            hasSchemaDir: !!output.schemas,\n            isAllowSyntheticDefaultImports,\n            options: isFunction(rawEntry) ? undefined : rawEntry,\n          });\n          // Re-export the factories so importing them from the msw file keeps\n          // working.\n          mockData += buildFakerReexportStatement(crossFileFakerImports);\n          mockData += `\\n${finalizedMockImplementation}`;\n\n          await writeGeneratedFile(mockFilePath, mockData);\n          mockPaths.push(mockFilePath);\n\n          const indexKey = `${mockExtension}::${mockDir}`;\n          let indexEntry = mockIndexEntries.find(\n            (e) => e.ext === mockExtension && e.mockDir === mockDir,\n          );\n          if (!indexEntry) {\n            indexEntry = { ext: mockExtension, mockDir, tags: [] };\n            mockIndexEntries.push(indexEntry);\n            seenMockIndexKeys.add(indexKey);\n          }\n          if (!indexEntry.tags.includes(tag)) {\n            indexEntry.tags.push(tag);\n          }\n        }\n\n        return [\n          implementationPath,\n          ...(schemasPath ? [schemasPath] : []),\n          ...mockPaths,\n        ];\n      } catch (error) {\n        throw new Error(\n          `Oups... 🍻. An Error occurred while splitting tag ${tag} => ${String(error)}`,\n          { cause: error },\n        );\n      }\n    }),\n  );\n\n  if (output.mock.indexMockFiles) {\n    const mockImportExtension = getImportExtension(extension, output.tsconfig);\n    for (const { ext, mockDir, tags } of mockIndexEntries) {\n      const indexPath = path.join(mockDir, `index.${ext}${extension}`);\n      const indexContent = tags\n        .toSorted((a, b) => a.localeCompare(b))\n        .map((tag) => {\n          const localMockPath = upath.joinSafe(\n            './',\n            tag,\n            tag + '.' + ext + mockImportExtension,\n          );\n          return ext === OutputMockType.MSW\n            ? `export { get${pascal(tag)}Mock } from '${localMockPath}'\\n`\n            : `export * from '${localMockPath}'\\n`;\n        })\n        .join('');\n      await writeGeneratedFile(indexPath, indexContent);\n    }\n  }\n\n  let commonTypesFilePath: string | undefined;\n  if (deduplicationEnabled && collectedSharedTypes.length > 0) {\n    const commonTypesContent =\n      collectedSharedTypes.map((t) => `export ${t.code}`).join('\\n') + '\\n';\n    commonTypesFilePath = commonTypesPath;\n    await writeGeneratedFile(commonTypesPath, commonTypesContent);\n  }\n\n  let indexFilePath: string | undefined;\n  if (output.indexFiles && tagEntries.length > 0) {\n    const importExtension = getImportExtension(\n      output.fileExtension,\n      output.tsconfig,\n    );\n    const serviceSuffix =\n      OutputClient.ANGULAR === output.client ? '.service' : '';\n\n    const publicSharedTypeNames = collectedSharedTypes\n      .filter((t) => t.exported)\n      .map((t) => t.name);\n\n    // With deduplication, every shared type lives in one common-types file,\n    // so a single named re-export from there covers all of them. Without\n    // it, each tag redeclares its own copy of any shared type it needs, so\n    // wildcard-exporting more than one such tag would raise a TS2308\n    // ambiguity error. Re-export each name individually, by hand, from\n    // whichever tag first declared it: an explicit named export shadows an\n    // ambiguous `export *` for the same name, so this stays valid even\n    // though every other tag also exports that name via its own `export *`.\n    const namedReExports =\n      publicSharedTypeNames.length === 0\n        ? ''\n        : deduplicationEnabled\n          ? `export type { ${publicSharedTypeNames.join(', ')} } from './${commonTypesBasename}${importExtension}';\\n`\n          : publicSharedTypeNames\n              .map((name) => {\n                const owningTag = firstTagForSharedType.get(name);\n                if (!owningTag) return '';\n                const ownerFile = upath.joinSafe(\n                  './',\n                  owningTag,\n                  owningTag + serviceSuffix + importExtension,\n                );\n                return `export type { ${name} } from '${ownerFile}';\\n`;\n              })\n              .join('');\n\n    const tagReExports = tagEntries\n      .map(([tag]) => {\n        const tagFile = upath.joinSafe(\n          './',\n          tag,\n          tag + serviceSuffix + importExtension,\n        );\n        return `export * from '${tagFile}';\\n`;\n      })\n      .join('');\n\n    // `writeSpecs` writes the client extra files, not this writer. But this\n    // barrel is the only complete entry point. Without these lines you can\n    // reach Angular's `*.resource.ts` API only through a per-tag path, which a\n    // monorepo with enforced module boundaries forbids.\n    //\n    // Only a file that sets `barrelExport` goes in. Other generators put\n    // internal files in `extraFiles`, and some of them run code at module\n    // level.\n    const extraFileReExports = buildBarrelReExports(\n      builder.extraFiles.filter((file) => file.barrelExport),\n      { dirname, extension, importExtension },\n      // These already have a line pointing at the shared-types module, and a\n      // name gets one line.\n      { types: publicSharedTypeNames },\n    );\n\n    const indexContent =\n      namedReExports +\n      tagReExports +\n      extraFileReExports.map((line) => `${line}\\n`).join('');\n    indexFilePath = path.join(dirname, `index${extension}`);\n    await writeGeneratedFile(indexFilePath, indexContent);\n  }\n\n  return [\n    ...new Set([\n      ...(output.mock.indexMockFiles\n        ? mockIndexEntries.map(({ mockDir, ext }) =>\n            path.join(mockDir, `index.${ext}${extension}`),\n          )\n        : []),\n      ...(commonTypesFilePath ? [commonTypesFilePath] : []),\n      ...(indexFilePath ? [indexFilePath] : []),\n      ...generatedFilePathsArray.flat(),\n    ]),\n  ];\n}\n","import path from 'node:path';\n\nimport { generateModelsInline } from '../generators';\nimport { OutputMockType, type WriteModeProps } from '../types';\nimport {\n  conventionName,\n  getFileInfo,\n  getImportExtension,\n  getSchemasImportPath,\n  isFunction,\n  isString,\n  isSyntheticDefaultImportsAllow,\n  kebab,\n  pascal,\n  upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { writeGeneratedFile } from './file';\nimport {\n  getFinalizeMockImplementationOptions,\n  filterLocalStrictMockTypeImports,\n} from './finalize-mock-implementation';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport {\n  filterImportsUsedInImplementation,\n  generateClientImports,\n  generateOrvalHelperTypes,\n  generateTargetMutatorImports,\n} from './implementation-parts';\nimport {\n  collectRecoveredSchemaFactoryImports,\n  mergeGeneratorImports,\n} from './mock-imports';\nimport { collapseInlineMockOutputs } from './mock-outputs';\nimport { getMockDir, resolveMockSchemasPath } from './mock-utils';\nimport { generateTargetForTags } from './target-tags';\n\nexport async function writeTagsMode({\n  builder,\n  output,\n  projectName,\n  header,\n  needSchema,\n  generateSchemasInline,\n  schemaTagMap,\n  schemaOutputPlan,\n}: WriteModeProps): Promise<string[]> {\n  const {\n    path: targetPath,\n    filename,\n    dirname,\n    extension,\n  } = getFileInfo(output.target, {\n    backupFilename: conventionName(\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      builder.info.title ?? 'filename',\n      output.namingConvention,\n    ),\n    extension: output.fileExtension,\n  });\n\n  const target = await generateTargetForTags(builder, output);\n\n  const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n    output.tsconfig,\n  );\n\n  // Mock code lands in `<tag>/<tag>.msw.ts` / `<tag>/<tag>.faker.ts` next to\n  // each tag's implementation file by default, matching `split`/`tags-split`.\n  // `mock.inline: true` opts back into appending it to the implementation file.\n  const shouldDeinlineMocks = !output.mock.inline;\n\n  interface MockIndexEntry {\n    ext: OutputMockType;\n    mockDir: string;\n    tags: string[];\n  }\n  const mockIndexEntries: MockIndexEntry[] = [];\n  const seenMockIndexKeys = new Set<string>();\n\n  const schemaCustomImportPath = getSchemasImportPath(output.schemas);\n  const schemasPathRelative = output.schemas\n    ? (schemaCustomImportPath ??\n      upath.getRelativeImportPath(\n        targetPath,\n        getFileInfo(\n          isString(output.schemas) ? output.schemas : output.schemas.path,\n          { extension: output.fileExtension },\n        ).dirname,\n      ))\n    : './' +\n      filename +\n      '.schemas' +\n      getImportExtension(output.schemaFileExtension, output.tsconfig);\n\n  const schemasTarget = output.schemas\n    ? getFileInfo(\n        isString(output.schemas) ? output.schemas : output.schemas.path,\n        { extension: output.fileExtension },\n      ).dirname\n    : path.join(\n        dirname,\n        filename +\n          '.schemas' +\n          getImportExtension(output.schemaFileExtension, output.tsconfig),\n      );\n\n  const tagEntries = Object.entries(target).toSorted(([a], [b]) =>\n    a.localeCompare(b),\n  );\n\n  const generatedFilePathsArray = await Promise.all(\n    tagEntries.map(async ([tag, target]) => {\n      try {\n        const { imports, implementation, mockOutputs: rawMockOutputs } = target;\n\n        const implementationImports = filterImportsUsedInImplementation(\n          imports,\n          implementation,\n        );\n\n        const normalizedImports = implementationImports.map((imp) => ({\n          ...imp,\n        }));\n\n        const collapsedMockOutputs = shouldDeinlineMocks\n          ? []\n          : collapseInlineMockOutputs(rawMockOutputs);\n\n        let data = header;\n\n        if (!shouldDeinlineMocks) {\n          const importsMock = collapsedMockOutputs.flatMap((m) => m.imports);\n\n          for (const mockImport of importsMock) {\n            const matchingImport = normalizedImports.find(\n              (imp) =>\n                imp.name === mockImport.name &&\n                (imp.alias ?? '') === (mockImport.alias ?? ''),\n            );\n            if (!matchingImport) continue;\n\n            const mockNeedsRuntimeValue =\n              !!mockImport.values ||\n              !!mockImport.isConstant ||\n              !!mockImport.default ||\n              !!mockImport.namespaceImport ||\n              !!mockImport.syntheticDefaultImport;\n            if (mockNeedsRuntimeValue) {\n              matchingImport.values = true;\n            }\n          }\n        }\n\n        const importsForBuilder = generateImportsForBuilder(\n          output,\n          normalizedImports,\n          schemasPathRelative,\n          schemaTagMap,\n          schemaOutputPlan,\n        );\n\n        data += await generateClientImports({\n          builder,\n          output,\n          implementation,\n          imports: importsForBuilder,\n          projectName,\n          isAllowSyntheticDefaultImports,\n        });\n\n        const kebabTag = kebab(tag);\n        const implementationPath = path.join(\n          dirname,\n          `${kebabTag}${extension}`,\n        );\n\n        if (!shouldDeinlineMocks) {\n          for (const mockOutput of collapsedMockOutputs) {\n            const entry = output.mock.generators.find(\n              (g) => !isFunction(g) && g.type === mockOutput.type,\n            );\n            const importsMockForBuilder = generateImportsForBuilder(\n              output,\n              mockOutput.imports.filter(\n                (impMock) =>\n                  !normalizedImports.some(\n                    (imp) =>\n                      imp.name === impMock.name &&\n                      (imp.alias ?? '') === (impMock.alias ?? ''),\n                  ),\n              ),\n              schemasPathRelative,\n              schemaTagMap,\n              schemaOutputPlan,\n              implementationPath,\n            );\n\n            data += builder.importsMock({\n              implementation: mockOutput.implementation,\n              imports: importsMockForBuilder,\n              projectName,\n              hasSchemaDir: !!output.schemas,\n              isAllowSyntheticDefaultImports,\n              options: entry && !isFunction(entry) ? entry : undefined,\n            });\n          }\n        }\n\n        const schemasPath =\n          !output.schemas && needSchema\n            ? path.join(\n                dirname,\n                filename + '.schemas' + output.schemaFileExtension,\n              )\n            : undefined;\n\n        if (schemasPath) {\n          const schemasData = generateSchemasInline\n            ? header + generateSchemasInline()\n            : header + generateModelsInline(builder.schemas);\n\n          await writeGeneratedFile(schemasPath, schemasData);\n        }\n\n        data += generateTargetMutatorImports(target, implementation);\n\n        data += '\\n\\n';\n\n        data += generateOrvalHelperTypes(implementation);\n\n        data += implementation;\n\n        if (!shouldDeinlineMocks) {\n          const implementationMock = collapsedMockOutputs\n            .map((m) => m.implementation)\n            .join('\\n\\n');\n          const finalizedImplementationMock = builder.finalizeMockImplementation\n            ? builder.finalizeMockImplementation(\n                implementationMock,\n                getFinalizeMockImplementationOptions(\n                  output,\n                  collapsedMockOutputs,\n                ),\n              )\n            : implementationMock;\n\n          if (collapsedMockOutputs.length > 0) {\n            data += '\\n\\n';\n            data += finalizedImplementationMock;\n          }\n        }\n\n        await writeGeneratedFile(implementationPath, data);\n\n        const extraPaths: string[] = [];\n\n        if (shouldDeinlineMocks) {\n          for (const mockOutput of rawMockOutputs) {\n            const rawEntry = output.mock.generators.find((g) => {\n              if (isFunction(g)) return mockOutput.type === OutputMockType.MSW;\n              return g.type === mockOutput.type;\n            });\n            if (!rawEntry) continue;\n\n            const mockExtension = isFunction(rawEntry)\n              ? OutputMockType.MSW\n              : getMockFileExtensionByTypeName(rawEntry);\n            const mockDir = getMockDir(rawEntry, output.mock) ?? dirname;\n\n            const mockFilePath = path.join(\n              mockDir,\n              kebabTag,\n              kebabTag + '.' + mockExtension + extension,\n            );\n\n            const mockRelativeSchemasPath =\n              schemaCustomImportPath ??\n              resolveMockSchemasPath(mockFilePath, schemasTarget);\n\n            const finalizeMockOptions = getFinalizeMockImplementationOptions(\n              output,\n              mockOutput,\n            );\n\n            const finalizedMockImplementation =\n              builder.finalizeMockImplementation\n                ? builder.finalizeMockImplementation(\n                    mockOutput.implementation,\n                    finalizeMockOptions,\n                  )\n                : mockOutput.implementation;\n\n            const usesSchemaFactories =\n              !isFunction(rawEntry) &&\n              rawEntry.type === OutputMockType.FAKER &&\n              rawEntry.schemas === true;\n            const recoveredSchemaFactoryImports =\n              usesSchemaFactories && output.schemas\n                ? collectRecoveredSchemaFactoryImports(\n                    finalizedMockImplementation,\n                    builder.schemas.filter((s) => s.schema).map((s) => s.name),\n                  )\n                : [];\n\n            const importsMockForBuilder = generateImportsForBuilder(\n              output,\n              filterLocalStrictMockTypeImports(\n                mergeGeneratorImports(\n                  mockOutput.imports,\n                  recoveredSchemaFactoryImports,\n                ),\n                finalizeMockOptions.strictSchemaTypeNames,\n              ),\n              mockRelativeSchemasPath,\n              schemaTagMap,\n              schemaOutputPlan,\n              mockFilePath,\n            );\n\n            let mockData = header;\n            mockData += builder.importsMock({\n              implementation: finalizedMockImplementation,\n              imports: importsMockForBuilder,\n              projectName,\n              hasSchemaDir: !!output.schemas,\n              isAllowSyntheticDefaultImports,\n              options: isFunction(rawEntry) ? undefined : rawEntry,\n            });\n            mockData += `\\n${finalizedMockImplementation}`;\n\n            await writeGeneratedFile(mockFilePath, mockData);\n            extraPaths.push(mockFilePath);\n\n            const indexKey = `${mockExtension}::${mockDir}`;\n            let indexEntry = mockIndexEntries.find(\n              (e) => e.ext === mockExtension && e.mockDir === mockDir,\n            );\n            if (!indexEntry) {\n              indexEntry = { ext: mockExtension, mockDir, tags: [] };\n              mockIndexEntries.push(indexEntry);\n              seenMockIndexKeys.add(indexKey);\n            }\n            if (!indexEntry.tags.includes(kebabTag)) {\n              indexEntry.tags.push(kebabTag);\n            }\n          }\n        }\n\n        return [\n          implementationPath,\n          ...(schemasPath ? [schemasPath] : []),\n          ...extraPaths,\n        ];\n      } catch (error) {\n        throw new Error(\n          `Oups... 🍻. An Error occurred while writing tag ${tag} => ${String(error)}`,\n          { cause: error },\n        );\n      }\n    }),\n  );\n\n  if (shouldDeinlineMocks && output.mock.indexMockFiles) {\n    const mockImportExtension = getImportExtension(extension, output.tsconfig);\n    for (const { ext, mockDir, tags } of mockIndexEntries) {\n      const indexPath = path.join(mockDir, `index.${ext}${extension}`);\n      const indexContent = tags\n        .toSorted((a, b) => a.localeCompare(b))\n        .map((kebabTag) => {\n          const localMockPath = upath.joinSafe(\n            './',\n            kebabTag,\n            kebabTag + '.' + ext + mockImportExtension,\n          );\n          return ext === OutputMockType.MSW\n            ? `export { get${pascal(kebabTag)}Mock } from '${localMockPath}'\\n`\n            : `export * from '${localMockPath}'\\n`;\n        })\n        .join('');\n      await writeGeneratedFile(indexPath, indexContent);\n      generatedFilePathsArray.push([indexPath]);\n    }\n  }\n\n  return generatedFilePathsArray.flat();\n}\n","import {\n  DefaultTag,\n  type GeneratorOperation,\n  type GeneratorOperationTarget,\n  type GeneratorSchema,\n  type GeneratorTagHelpers,\n  type GeneratorTagOperationsTarget,\n  type NormalizedOutputOptions,\n  OutputClient,\n  type WriteSpecBuilder,\n} from '../types';\nimport { getOperationTagKey, isOperationInTagBucket, pascal } from '../utils';\nimport { flattenMockOutput } from './mock-outputs';\nimport { hasTypeScriptAwaitedType } from './typescript-version';\n\n/**\n * Resolves the transitive closure of component schemas an operation's\n * implementation references, so `tags-operations-split`'s per-operation\n * `.schemas` file includes not just the schemas named directly in the\n * operation's imports but everything those schemas reference too (e.g. a\n * `Pet` schema composed from `Dog` / `Cat` via `oneOf`). Mirrors the\n * traversal in `schema-tag-mapper.ts`'s `propagateTransitiveTags`.\n */\nexport function resolveTransitiveSchemas(\n  directNames: Iterable<string>,\n  schemas: readonly GeneratorSchema[],\n): GeneratorSchema[] {\n  const schemaByName = new Map(schemas.map((s) => [s.name, s]));\n  const included = new Set<string>();\n  const queue = [...directNames];\n\n  while (queue.length > 0) {\n    // oxlint-disable-next-line typescript/no-non-null-assertion\n    const name = queue.pop()!;\n    if (included.has(name)) continue;\n    const schema = schemaByName.get(name);\n    if (!schema) continue;\n    included.add(name);\n    // Match by name rather than by a missing `importPath`: when\n    // `output.schemas` is set, the schemas writer has already rewritten\n    // every component-schema import to point at its file in that\n    // directory, so an `importPath` no longer marks an external import.\n    for (const imp of schema.imports) {\n      if (schemaByName.has(imp.name) && !included.has(imp.name)) {\n        queue.push(imp.name);\n      }\n    }\n  }\n\n  return schemas.filter((s) => included.has(s.name));\n}\n\n// Matches top-level `type`/`const`/`function` declarations (optionally\n// already exported) so the shared helper block's declared identifiers can be\n// re-imported by name into each operation file. A side-effect-only import\n// (`import './tag.helpers'`) never brings the names into scope, so callers\n// must know exactly what to name in an import statement — and whether that\n// name is a type (safe to strip at compile time) or a runtime value like\n// `withQueryKey` (must survive as a real import, not `import type`). Client\n// header builders write these declarations assuming they land inline in the\n// operation file, so most are not `export`ed; capturing group 1 isolates the\n// existing `export ` (if any) so the rewrite step below can force it on\n// without doubling up.\nconst TYPE_DECLARATION_RE = /^(export\\s+)?type\\s+([A-Za-z_$][\\w$]*)/gm;\nconst VALUE_DECLARATION_RE =\n  /^(export\\s+)?(const|function)\\s+([A-Za-z_$][\\w$]*)/gm;\n\n/**\n * Extracts the top-level `type`/`const`/`function` names declared in the\n * tag helper block, and rewrites the block so every one of them is\n * `export`ed — necessary now that the block lives in its own module and is\n * imported by name rather than inlined into the operation file.\n */\nfunction extractDeclaredNames(implementation: string): {\n  implementation: string;\n  typeNames: string[];\n  valueNames: string[];\n} {\n  const typeNames = [...implementation.matchAll(TYPE_DECLARATION_RE)].map(\n    (match) => match[2],\n  );\n  const valueNames = [...implementation.matchAll(VALUE_DECLARATION_RE)].map(\n    (match) => match[3],\n  );\n  const exported = implementation\n    .replaceAll(TYPE_DECLARATION_RE, (whole, existingExport: string) =>\n      existingExport ? whole : `export ${whole}`,\n    )\n    .replaceAll(VALUE_DECLARATION_RE, (whole, existingExport: string) =>\n      existingExport ? whole : `export ${whole}`,\n    );\n  return { implementation: exported, typeNames, valueNames };\n}\n\n/**\n * Builds the import statement(s) an operation file uses to pull in its\n * tag's shared helper block, or `''` when the helper has nothing to export.\n * A plain `import './tag.helpers'` would compile but never bring the\n * helper's `type`/`const` names into scope — callers must import them by\n * name, and type names must use `import type` while runtime values\n * (e.g. `withQueryKey`) need a real import so they survive to the emitted JS.\n */\nexport function buildTagHelpersImport(\n  helpers: GeneratorTagHelpers,\n  helperImportPath: string,\n  usedIn?: string,\n): string {\n  const used = (name: string) =>\n    !usedIn || new RegExp(String.raw`\\b${name}\\b`).test(usedIn);\n\n  const typeNames = helpers.typeNames.filter(used);\n  const valueNames = helpers.valueNames.filter(used);\n\n  let result = '';\n  if (typeNames.length > 0) {\n    result += `import type { ${typeNames.join(', ')} } from '${helperImportPath}';\\n`;\n  }\n  if (valueNames.length > 0) {\n    result += `import { ${valueNames.join(', ')} } from '${helperImportPath}';\\n`;\n  }\n  return result;\n}\n\n/**\n * Ensures every operation has at least one tag by falling back to the\n * {@link DefaultTag} constant for untagged operations, mirroring\n * `target-tags.ts`'s `addDefaultTagIfEmpty` so operations without a tag still\n * land in a bucket.\n */\nfunction addDefaultTagIfEmpty(operation: GeneratorOperation) {\n  return {\n    ...operation,\n    tags: operation.tags.length > 0 ? operation.tags : [DefaultTag],\n  };\n}\n\n/**\n * Builds one {@link GeneratorTagOperationsTarget} per tag for the\n * `tags-operations` / `tags-operations-split` modes. Unlike\n * `generateTargetForTags`, operations within a tag are NOT merged into a\n * single implementation string — each operation keeps its own\n * implementation so the caller can write it to its own file.\n *\n * The tag's header/footer are still computed once (from the merged\n * implementation of every operation in the tag, exactly as\n * `generateTargetForTags` does) so client builders that key their output on\n * tag-wide signals (e.g. \"does any operation in this tag use a mutator\")\n * produce the same boilerplate they would in `tags` mode. That boilerplate\n * becomes the tag's shared `helpers` block, written once per tag and\n * imported by every operation file in that tag instead of being duplicated.\n */\nexport async function generateTargetForTagsOperations(\n  builder: WriteSpecBuilder,\n  options: NormalizedOutputOptions,\n): Promise<Record<string, GeneratorTagOperationsTarget>> {\n  const isAngularClient = options.client === OutputClient.ANGULAR;\n  const hasAwaitedType = hasTypeScriptAwaitedType(options.packageJson);\n\n  const operations = Object.values(builder.operations).map((operation) =>\n    addDefaultTagIfEmpty(operation),\n  );\n\n  const tags = [...new Set(operations.map((op) => getOperationTagKey(op)))];\n\n  const result: Record<string, GeneratorTagOperationsTarget> = {};\n\n  for (const tag of tags) {\n    const tagOperations = operations.filter((operation) =>\n      isOperationInTagBucket(operation, tag),\n    );\n\n    const mergedImplementation = tagOperations\n      .map((operation) => operation.implementation)\n      .join('');\n    const mergedMutators = tagOperations\n      .map((operation) => operation.mutator)\n      .filter((mutator): mutator is NonNullable<typeof mutator> => !!mutator);\n\n    const isMutator = mergedMutators.some((mutator) =>\n      isAngularClient ? mutator.hasThirdArg : mutator.hasSecondArg,\n    );\n\n    const titles = await builder.title({\n      outputClient: options.client,\n      title: pascal(tag),\n      customTitleFunc: options.override.title,\n      output: options,\n    });\n\n    const footer = await builder.footer({\n      outputClient: options.client,\n      operationNames: tagOperations.map(({ operationName }) => operationName),\n      operations: tagOperations,\n      hasMutator: mergedMutators.length > 0,\n      hasAwaitedType,\n      titles,\n      output: options,\n    });\n\n    const header = await builder.header({\n      outputClient: options.client,\n      isRequestOptions: options.override.requestOptions !== false,\n      isMutator,\n      isGlobalMutator: !!options.override.mutator,\n      provideIn: options.override.angular.provideIn,\n      hasAwaitedType,\n      titles,\n      output: options,\n      verbOptions: builder.verbOptions,\n      tag,\n      isDefaultTagBucket:\n        tag === DefaultTag &&\n        Object.values(builder.operations).some(\n          (operation) => operation.tags.length === 0,\n        ),\n      clientImplementation: mergedImplementation,\n    });\n\n    const sharedTypes = header.sharedTypes;\n    const inlinedSharedTypes =\n      sharedTypes && sharedTypes.length > 0\n        ? sharedTypes\n            .map((t) => `${t.exported ? 'export ' : ''}${t.code}`)\n            .join('\\n') + '\\n\\n'\n        : '';\n\n    const rawHelperImplementation =\n      inlinedSharedTypes + header.implementation + footer.implementation;\n    const {\n      implementation: helperImplementation,\n      typeNames,\n      valueNames,\n    } = extractDeclaredNames(rawHelperImplementation);\n\n    const operationTargets: GeneratorOperationTarget[] = tagOperations.map(\n      (operation) => {\n        // Each operation is its own file, so its mock handler gets its own\n        // header/footer wrap rather than sharing one wrap across the whole\n        // tag (as `target-tags.ts` does for the merged tag file).\n        const wrappedMockOutputs = operation.mockOutputs.map((m) => ({\n          type: m.type,\n          implementation: {\n            function: m.implementation.function,\n            // `handlerName` is the factory's identifier. The aggregate helper\n            // must call it, as `target.ts` / `target-tags.ts` do, so that\n            // `setupServer(...getPetsMock())` receives handlers, not\n            // factories.\n            handler: m.implementation.handlerName\n              ? m.implementation.handler +\n                header.implementationMock +\n                '  ' +\n                m.implementation.handlerName +\n                '()' +\n                footer.implementationMock\n              : m.implementation.handler,\n            handlerName: m.implementation.handlerName,\n          },\n          imports: m.imports,\n          strictMockSchemaTypeNames: m.strictMockSchemaTypeNames,\n          strictMockSchemaKinds: m.strictMockSchemaKinds,\n        }));\n\n        return {\n          operationName: operation.operationName,\n          imports: operation.imports,\n          implementation: operation.implementation,\n          mockOutputs: wrappedMockOutputs.map((m) => flattenMockOutput(m)),\n          mockOutputsFull: wrappedMockOutputs,\n          mutators: operation.mutator ? [operation.mutator] : undefined,\n          clientMutators: operation.clientMutators,\n          formData: operation.formData ? [operation.formData] : undefined,\n          formUrlEncoded: operation.formUrlEncoded\n            ? [operation.formUrlEncoded]\n            : undefined,\n          paramsSerializer: operation.paramsSerializer\n            ? [operation.paramsSerializer]\n            : undefined,\n          paramsFilter: operation.paramsFilter\n            ? [operation.paramsFilter]\n            : undefined,\n          fetchReviver: operation.fetchReviver\n            ? [operation.fetchReviver]\n            : undefined,\n        };\n      },\n    );\n\n    result[tag] = {\n      helpers: {\n        implementation: helperImplementation,\n        sharedTypes,\n        typeNames,\n        valueNames,\n      },\n      operations: operationTargets,\n    };\n  }\n\n  return result;\n}\n","import path from 'node:path';\n\nimport { generateModelsInline } from '../generators';\nimport {\n  OutputClient,\n  type OutputClientFunc,\n  OutputMockType,\n  type WriteModeProps,\n} from '../types';\nimport {\n  conventionName,\n  getFileInfo,\n  getImportExtension,\n  getSchemasImportPath,\n  isFunction,\n  isString,\n  isSyntheticDefaultImportsAllow,\n  kebab,\n  pascal,\n  upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { writeGeneratedFile } from './file';\nimport {\n  filterLocalStrictMockTypeImports,\n  getFinalizeMockImplementationOptions,\n} from './finalize-mock-implementation';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport {\n  filterImportsUsedInImplementation,\n  generateClientImports,\n  generateOrvalHelperTypes,\n  generateTargetMutatorImports,\n} from './implementation-parts';\nimport {\n  collectRecoveredSchemaFactoryImports,\n  mergeGeneratorImports,\n} from './mock-imports';\nimport { getMockDir, resolveMockSchemasPath } from './mock-utils';\nimport {\n  buildTagHelpersImport,\n  generateTargetForTagsOperations,\n} from './target-tags-operations';\n\nconst SUPPORTED_CLIENTS = new Set<string>([\n  OutputClient.REACT_QUERY,\n  OutputClient.SVELTE_QUERY,\n  OutputClient.VUE_QUERY,\n  OutputClient.SWR,\n  OutputClient.FETCH,\n]);\n\nexport function assertClientSupportsTagsOperations(\n  client: OutputClient | OutputClientFunc,\n  mode: string,\n): void {\n  if (typeof client !== 'string' || !SUPPORTED_CLIENTS.has(client)) {\n    const clientLabel = typeof client === 'string' ? client : 'custom';\n    throw new Error(\n      `Output mode '${mode}' is not supported with the '${clientLabel}' client. ` +\n        `It requires operations that compile to standalone functions ` +\n        `(react-query, svelte-query, vue-query, swr, fetch); '${clientLabel}' ` +\n        `groups operations into a shared structure. Use 'tags' or ` +\n        `'tags-split' instead.`,\n    );\n  }\n}\n\n/**\n * `tags-operations` mode: one file per operation, nested under a per-tag\n * directory (`<dir>/<tag>/<operation><ext>`), each containing both the\n * operation's types and its runtime implementation. A per-tag barrel\n * (`<dir>/<tag>/index<ext>`) re-exports every operation file so existing\n * `import from '<build>/<tag>'`-style imports keep working.\n */\nexport async function writeTagsOperationsMode({\n  builder,\n  output,\n  projectName,\n  header,\n  needSchema,\n  generateSchemasInline,\n  schemaTagMap,\n  schemaOutputPlan,\n}: WriteModeProps): Promise<string[]> {\n  assertClientSupportsTagsOperations(output.client, 'tags-operations');\n\n  const { filename, dirname, extension } = getFileInfo(output.target, {\n    backupFilename: conventionName(\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      builder.info.title ?? 'filename',\n      output.namingConvention,\n    ),\n    extension: output.fileExtension,\n  });\n\n  const target = await generateTargetForTagsOperations(builder, output);\n\n  const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n    output.tsconfig,\n  );\n\n  // Operation files live one directory deeper than `dirname` (under their\n  // tag subdirectory), so relative import paths need an extra `../` step\n  // compared to `tags-mode.ts`'s flat layout — matching how\n  // `split-tags-mode.ts` resolves paths for its per-tag subdirectories.\n  const schemaCustomImportPath = getSchemasImportPath(output.schemas);\n  const schemasPathRelative = output.schemas\n    ? (schemaCustomImportPath ??\n      upath.getRelativeImportPath(\n        path.join(dirname, 'tag', filename + extension),\n        getFileInfo(\n          isString(output.schemas) ? output.schemas : output.schemas.path,\n          { extension: output.fileExtension },\n        ).dirname,\n        true,\n      ))\n    : '../' +\n      filename +\n      '.schemas' +\n      getImportExtension(output.schemaFileExtension, output.tsconfig);\n\n  const schemasTarget = output.schemas\n    ? getFileInfo(\n        isString(output.schemas) ? output.schemas : output.schemas.path,\n        { extension: output.fileExtension },\n      ).dirname\n    : path.join(\n        dirname,\n        filename +\n          '.schemas' +\n          getImportExtension(output.schemaFileExtension, output.tsconfig),\n      );\n\n  const schemasPath =\n    !output.schemas && needSchema\n      ? path.join(dirname, filename + '.schemas' + output.schemaFileExtension)\n      : undefined;\n\n  if (schemasPath) {\n    const schemasData = generateSchemasInline\n      ? header + generateSchemasInline()\n      : header + generateModelsInline(builder.schemas);\n\n    await writeGeneratedFile(schemasPath, schemasData);\n  }\n\n  const tagEntries = Object.entries(target).toSorted(([a], [b]) =>\n    a.localeCompare(b),\n  );\n\n  interface MockIndexEntry {\n    ext: OutputMockType;\n    mockDir: string;\n    operations: { tag: string; opName: string; handlerName: string }[];\n  }\n\n  // Accumulated across every tag and written once after `Promise.all`\n  // resolves. The mock index lives at a tag-independent `mockDir`-root path\n  // whose entries reference `./<tag>/<op>`, so writing it per tag would let\n  // concurrent tags overwrite each other, leaving only the last tag's\n  // operations. This mirrors `split-tags-mode.ts`'s function-scoped\n  // accumulation.\n  const mockIndexEntries: MockIndexEntry[] = [];\n\n  const generatedFilePathsArray = await Promise.all(\n    tagEntries.map(async ([tag, { helpers, operations }]) => {\n      try {\n        const tagDir = path.join(dirname, tag);\n        const helperFilename = `${tag}.helpers${extension}`;\n        const helperPath = path.join(tagDir, helperFilename);\n        const hasHelpers = helpers.implementation.trim().length > 0;\n        const helperImportExtension = getImportExtension(\n          extension,\n          output.tsconfig,\n        );\n        const helperImportPath =\n          './' + tag + '.helpers' + helperImportExtension;\n\n        if (hasHelpers) {\n          await writeGeneratedFile(helperPath, header + helpers.implementation);\n        }\n\n        const operationFilePaths = await Promise.all(\n          operations.map(async (operation) => {\n            const operationFilename = kebab(operation.operationName);\n            const implementationPath = path.join(\n              tagDir,\n              `${operationFilename}${extension}`,\n            );\n\n            const implementationImports = filterImportsUsedInImplementation(\n              operation.imports,\n              operation.implementation,\n            );\n\n            const importsForBuilder = generateImportsForBuilder(\n              output,\n              implementationImports,\n              schemasPathRelative,\n              schemaTagMap,\n              schemaOutputPlan,\n            );\n\n            let data = header;\n\n            if (hasHelpers) {\n              data += buildTagHelpersImport(\n                helpers,\n                helperImportPath,\n                operation.implementation,\n              );\n            }\n\n            data += await generateClientImports({\n              builder,\n              output,\n              implementation: operation.implementation,\n              imports: importsForBuilder,\n              projectName,\n              isAllowSyntheticDefaultImports,\n            });\n\n            data += generateTargetMutatorImports(\n              operation,\n              operation.implementation,\n              true,\n            );\n\n            data += '\\n\\n';\n\n            data += generateOrvalHelperTypes(operation.implementation);\n\n            data += operation.implementation;\n\n            await writeGeneratedFile(implementationPath, data);\n\n            const extraPaths: string[] = [];\n\n            for (const mockOutput of operation.mockOutputsFull) {\n              if (!mockOutput.implementation.handlerName) continue;\n\n              const rawEntry = output.mock.generators.find((g) => {\n                if (isFunction(g))\n                  return mockOutput.type === OutputMockType.MSW;\n                return g.type === mockOutput.type;\n              });\n              if (!rawEntry) continue;\n\n              const mockExtension = isFunction(rawEntry)\n                ? OutputMockType.MSW\n                : getMockFileExtensionByTypeName(rawEntry);\n              const mockDir = getMockDir(rawEntry, output.mock) ?? dirname;\n\n              const kebabOperation = kebab(operation.operationName);\n              const mockFilePath = path.join(\n                mockDir,\n                tag,\n                kebabOperation + '.' + mockExtension + extension,\n              );\n\n              const mockRelativeSchemasPath =\n                schemaCustomImportPath ??\n                resolveMockSchemasPath(mockFilePath, schemasTarget);\n\n              const finalizeMockOptions = getFinalizeMockImplementationOptions(\n                output,\n                mockOutput,\n              );\n\n              const finalizedMockImplementation =\n                builder.finalizeMockImplementation\n                  ? builder.finalizeMockImplementation(\n                      mockOutput.implementation.function +\n                        mockOutput.implementation.handler,\n                      finalizeMockOptions,\n                    )\n                  : mockOutput.implementation.function +\n                    mockOutput.implementation.handler;\n\n              const usesSchemaFactories =\n                !isFunction(rawEntry) &&\n                rawEntry.type === OutputMockType.FAKER &&\n                rawEntry.schemas === true;\n              const recoveredSchemaFactoryImports =\n                usesSchemaFactories && output.schemas\n                  ? collectRecoveredSchemaFactoryImports(\n                      finalizedMockImplementation,\n                      builder.schemas\n                        .filter((s) => s.schema)\n                        .map((s) => s.name),\n                    )\n                  : [];\n\n              const importsMockForBuilder = generateImportsForBuilder(\n                output,\n                filterLocalStrictMockTypeImports(\n                  mergeGeneratorImports(\n                    mockOutput.imports,\n                    recoveredSchemaFactoryImports,\n                  ),\n                  finalizeMockOptions.strictSchemaTypeNames,\n                ),\n                mockRelativeSchemasPath,\n                schemaTagMap,\n                undefined,\n                mockFilePath,\n              );\n\n              let mockData = header;\n              mockData += builder.importsMock({\n                implementation: finalizedMockImplementation,\n                imports: importsMockForBuilder,\n                projectName,\n                hasSchemaDir: !!output.schemas,\n                isAllowSyntheticDefaultImports,\n                options: isFunction(rawEntry) ? undefined : rawEntry,\n              });\n              mockData += `\\n${finalizedMockImplementation}`;\n\n              await writeGeneratedFile(mockFilePath, mockData);\n              extraPaths.push(mockFilePath);\n\n              let indexEntry = mockIndexEntries.find(\n                (e) => e.ext === mockExtension && e.mockDir === mockDir,\n              );\n              if (!indexEntry) {\n                indexEntry = { ext: mockExtension, mockDir, operations: [] };\n                mockIndexEntries.push(indexEntry);\n              }\n              if (\n                !indexEntry.operations.some(\n                  (o) => o.tag === tag && o.opName === kebabOperation,\n                )\n              ) {\n                indexEntry.operations.push({\n                  tag,\n                  opName: kebabOperation,\n                  handlerName: mockOutput.implementation.handlerName,\n                });\n              }\n            }\n\n            return {\n              operationFilename,\n              paths: [implementationPath, ...extraPaths],\n            };\n          }),\n        );\n\n        const indexPaths: string[] = [];\n        if (output.indexFiles) {\n          const importExtension = getImportExtension(\n            extension,\n            output.tsconfig,\n          );\n          const barrelContent = operationFilePaths\n            .map(\n              ({ operationFilename }) =>\n                `export * from './${operationFilename}${importExtension}';\\n`,\n            )\n            .join('');\n          const indexPath = path.join(tagDir, `index${extension}`);\n          await writeGeneratedFile(indexPath, barrelContent);\n          indexPaths.push(indexPath);\n        }\n\n        return [\n          ...(hasHelpers ? [helperPath] : []),\n          ...operationFilePaths.flatMap(({ paths }) => paths),\n          ...indexPaths,\n        ];\n      } catch (error) {\n        throw new Error(\n          `Oups... 🍻. An Error occurred while writing tag ${tag} => ${String(error)}`,\n          { cause: error },\n        );\n      }\n    }),\n  );\n\n  const allGeneratedPaths = generatedFilePathsArray.flat();\n\n  // Written once, after every tag has accumulated its operations into the\n  // shared `mockIndexEntries`, so the tag-independent mock index at\n  // `<mockDir>/index.<ext><ext>` lists operations from all tags rather than\n  // just the last-completing one.\n  const mockIndexPaths: string[] = [];\n  if (output.mock.indexMockFiles) {\n    const mockImportExtension = getImportExtension(extension, output.tsconfig);\n    for (const { ext, mockDir, operations } of mockIndexEntries) {\n      const indexPath = path.join(mockDir, `index.${ext}${extension}`);\n      const indexContent = operations\n        .toSorted(\n          (a, b) =>\n            a.tag.localeCompare(b.tag) || a.opName.localeCompare(b.opName),\n        )\n        .map(({ tag, opName, handlerName }) => {\n          const localMockPath = upath.joinSafe(\n            './',\n            tag,\n            opName + '.' + ext + mockImportExtension,\n          );\n          // Alias by `{tag, opName}` (this entry's dedup key, therefore\n          // always unique) rather than re-exporting `handlerName` verbatim:\n          // `handlerName` is derived from `operationName`, which a user's\n          // `override.operationName` function can map to the same value for\n          // multiple operations, producing two identically-named exports in\n          // this shared barrel.\n          const alias = `${pascal(tag)}${pascal(opName)}MockHandler`;\n          return ext === OutputMockType.MSW\n            ? `export { ${handlerName} as ${alias} } from '${localMockPath}'\\n`\n            : `export * from '${localMockPath}'\\n`;\n        })\n        .join('');\n      await writeGeneratedFile(indexPath, indexContent);\n      mockIndexPaths.push(indexPath);\n    }\n  }\n\n  let rootIndexPath: string | undefined;\n  if (output.indexFiles) {\n    const importExtension = getImportExtension(extension, output.tsconfig);\n    const rootBarrelContent = tagEntries\n      .map(([tag]) => `export * from './${tag}/index${importExtension}';\\n`)\n      .join('');\n    rootIndexPath = path.join(dirname, `index${extension}`);\n    await writeGeneratedFile(rootIndexPath, rootBarrelContent);\n  }\n\n  return [\n    ...(schemasPath ? [schemasPath] : []),\n    ...(rootIndexPath ? [rootIndexPath] : []),\n    ...allGeneratedPaths,\n    ...mockIndexPaths,\n  ];\n}\n","import path from 'node:path';\n\nimport { generateModelsInline } from '../generators';\nimport { OutputMockType, type WriteModeProps } from '../types';\nimport {\n  conventionName,\n  getFileInfo,\n  getImportExtension,\n  getSchemasImportPath,\n  isFunction,\n  isString,\n  isSyntheticDefaultImportsAllow,\n  kebab,\n  pascal,\n  upath,\n} from '../utils';\nimport { getMockFileExtensionByTypeName } from '../utils/file-extensions';\nimport { writeGeneratedFile } from './file';\nimport {\n  filterLocalStrictMockTypeImports,\n  getFinalizeMockImplementationOptions,\n} from './finalize-mock-implementation';\nimport { generateImportsForBuilder } from './generate-imports-for-builder';\nimport {\n  filterImportsUsedInImplementation,\n  generateClientImports,\n  generateOrvalHelperTypes,\n  generateTargetMutatorImports,\n} from './implementation-parts';\nimport {\n  collectRecoveredSchemaFactoryImports,\n  mergeGeneratorImports,\n} from './mock-imports';\nimport { getMockDir, resolveMockSchemasPath } from './mock-utils';\nimport { assertClientSupportsTagsOperations } from './tags-operations-mode';\nimport {\n  buildTagHelpersImport,\n  generateTargetForTagsOperations,\n  resolveTransitiveSchemas,\n} from './target-tags-operations';\n\n/**\n * `tags-operations-split` mode: two files per operation, nested under a\n * per-tag directory (`<dir>/<tag>/<operation><ext>` for the runtime\n * implementation, `<dir>/<tag>/<operation>.schemas<ext>` for the component\n * schemas that operation's implementation references), plus a per-tag\n * barrel (`<dir>/<tag>/index<ext>`) re-exporting both files for every\n * operation so existing `import from '<build>/<tag>'`-style imports keep\n * working.\n */\nexport async function writeTagsOperationsSplitMode({\n  builder,\n  output,\n  projectName,\n  header,\n  needSchema,\n  generateSchemasInline,\n  schemaTagMap,\n  schemaOutputPlan,\n}: WriteModeProps): Promise<string[]> {\n  assertClientSupportsTagsOperations(output.client, 'tags-operations-split');\n\n  const { filename, dirname, extension } = getFileInfo(output.target, {\n    backupFilename: conventionName(\n      // oxlint-disable-next-line typescript/no-unnecessary-condition\n      builder.info.title ?? 'filename',\n      output.namingConvention,\n    ),\n    extension: output.fileExtension,\n  });\n\n  const target = await generateTargetForTagsOperations(builder, output);\n\n  const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(\n    output.tsconfig,\n  );\n\n  // Operation files live one directory deeper than `dirname` (under their\n  // tag subdirectory), so relative import paths need an extra `../` step —\n  // matching how `split-tags-mode.ts` resolves paths for its per-tag\n  // subdirectories.\n  const schemaCustomImportPath = getSchemasImportPath(output.schemas);\n  const schemasPathRelative = output.schemas\n    ? (schemaCustomImportPath ??\n      upath.getRelativeImportPath(\n        path.join(dirname, 'tag', filename + extension),\n        getFileInfo(\n          isString(output.schemas) ? output.schemas : output.schemas.path,\n          { extension: output.fileExtension },\n        ).dirname,\n        true,\n      ))\n    : '../' +\n      filename +\n      '.schemas' +\n      getImportExtension(output.schemaFileExtension, output.tsconfig);\n\n  const schemasTarget = output.schemas\n    ? getFileInfo(\n        isString(output.schemas) ? output.schemas : output.schemas.path,\n        { extension: output.fileExtension },\n      ).dirname\n    : path.join(\n        dirname,\n        filename +\n          '.schemas' +\n          getImportExtension(output.schemaFileExtension, output.tsconfig),\n      );\n\n  const globalSchemasPath =\n    !output.schemas && needSchema\n      ? path.join(dirname, filename + '.schemas' + output.schemaFileExtension)\n      : undefined;\n\n  if (globalSchemasPath) {\n    const schemasData = generateSchemasInline\n      ? header + generateSchemasInline()\n      : header + generateModelsInline(builder.schemas);\n\n    await writeGeneratedFile(globalSchemasPath, schemasData);\n  }\n\n  const tagEntries = Object.entries(target).toSorted(([a], [b]) =>\n    a.localeCompare(b),\n  );\n\n  interface MockIndexEntry {\n    ext: OutputMockType;\n    mockDir: string;\n    operations: { tag: string; opName: string; handlerName: string }[];\n  }\n\n  // Accumulated across every tag and written once after `Promise.all`\n  // resolves. The mock index lives at a tag-independent `mockDir`-root path\n  // whose entries reference `./<tag>/<op>`, so writing it per tag would let\n  // concurrent tags overwrite each other, leaving only the last tag's\n  // operations. This mirrors `split-tags-mode.ts`'s function-scoped\n  // accumulation.\n  const mockIndexEntries: MockIndexEntry[] = [];\n\n  const generatedFilePathsArray = await Promise.all(\n    tagEntries.map(async ([tag, { helpers, operations }]) => {\n      try {\n        const tagDir = path.join(dirname, tag);\n        const helperFilename = `${tag}.helpers${extension}`;\n        const helperPath = path.join(tagDir, helperFilename);\n        const hasHelpers = helpers.implementation.trim().length > 0;\n        const helperImportExtension = getImportExtension(\n          extension,\n          output.tsconfig,\n        );\n        const helperImportPath =\n          './' + tag + '.helpers' + helperImportExtension;\n\n        if (hasHelpers) {\n          await writeGeneratedFile(helperPath, header + helpers.implementation);\n        }\n\n        const operationFilePaths = await Promise.all(\n          operations.map(async (operation) => {\n            const operationFilename = kebab(operation.operationName);\n            const implementationPath = path.join(\n              tagDir,\n              `${operationFilename}${extension}`,\n            );\n            const operationSchemasFilename = `${operationFilename}.schemas${output.schemaFileExtension}`;\n            const operationSchemasPath = path.join(\n              tagDir,\n              operationSchemasFilename,\n            );\n            const operationSchemasImportPath =\n              './' +\n              operationFilename +\n              '.schemas' +\n              getImportExtension(output.schemaFileExtension, output.tsconfig);\n\n            const implementationImports = filterImportsUsedInImplementation(\n              operation.imports,\n              operation.implementation,\n            );\n\n            // Component schemas this operation's implementation actually\n            // references, scoped down from the full builder schema list —\n            // including transitive dependencies (e.g. a `Pet` schema\n            // composed from `Dog` / `Cat`) — so each operation's `.schemas`\n            // file is self-contained.\n            const directSchemaNames = implementationImports\n              .filter((imp) => !imp.importPath)\n              .map((imp) => imp.name);\n            const operationSchemas = resolveTransitiveSchemas(\n              directSchemaNames,\n              builder.schemas,\n            );\n            const referencedSchemaNames = new Set(\n              operationSchemas.map((s) => s.name),\n            );\n            const hasOperationSchemas = operationSchemas.length > 0;\n\n            if (hasOperationSchemas) {\n              const schemasData =\n                header + generateModelsInline(operationSchemas);\n              await writeGeneratedFile(operationSchemasPath, schemasData);\n            }\n\n            // Local component-schema imports are routed to the operation's\n            // own `.schemas` file; every other import (schemas dir, cross-tag\n            // helper types, etc.) keeps its existing resolution.\n            const adjustedImports = implementationImports.map((imp) => {\n              if (imp.importPath) return imp;\n              if (!referencedSchemaNames.has(imp.name)) return imp;\n              return { ...imp, importPath: operationSchemasImportPath };\n            });\n\n            const importsForBuilder = generateImportsForBuilder(\n              output,\n              adjustedImports,\n              schemasPathRelative,\n              schemaTagMap,\n              schemaOutputPlan,\n            );\n\n            let data = header;\n\n            if (hasHelpers) {\n              data += buildTagHelpersImport(\n                helpers,\n                helperImportPath,\n                operation.implementation,\n              );\n            }\n\n            data += await generateClientImports({\n              builder,\n              output,\n              implementation: operation.implementation,\n              imports: importsForBuilder,\n              projectName,\n              isAllowSyntheticDefaultImports,\n            });\n\n            data += generateTargetMutatorImports(\n              operation,\n              operation.implementation,\n              true,\n            );\n\n            data += '\\n\\n';\n\n            data += generateOrvalHelperTypes(operation.implementation);\n\n            data += operation.implementation;\n\n            await writeGeneratedFile(implementationPath, data);\n\n            const extraPaths: string[] = [];\n\n            for (const mockOutput of operation.mockOutputsFull) {\n              if (!mockOutput.implementation.handlerName) continue;\n\n              const rawEntry = output.mock.generators.find((g) => {\n                if (isFunction(g))\n                  return mockOutput.type === OutputMockType.MSW;\n                return g.type === mockOutput.type;\n              });\n              if (!rawEntry) continue;\n\n              const mockExtension = isFunction(rawEntry)\n                ? OutputMockType.MSW\n                : getMockFileExtensionByTypeName(rawEntry);\n              const mockDir = getMockDir(rawEntry, output.mock) ?? dirname;\n\n              const kebabOperation = kebab(operation.operationName);\n              const mockFilePath = path.join(\n                mockDir,\n                tag,\n                kebabOperation + '.' + mockExtension + extension,\n              );\n\n              const mockRelativeSchemasPath =\n                schemaCustomImportPath ??\n                resolveMockSchemasPath(mockFilePath, schemasTarget);\n\n              const finalizeMockOptions = getFinalizeMockImplementationOptions(\n                output,\n                mockOutput,\n              );\n\n              const finalizedMockImplementation =\n                builder.finalizeMockImplementation\n                  ? builder.finalizeMockImplementation(\n                      mockOutput.implementation.function +\n                        mockOutput.implementation.handler,\n                      finalizeMockOptions,\n                    )\n                  : mockOutput.implementation.function +\n                    mockOutput.implementation.handler;\n\n              const usesSchemaFactories =\n                !isFunction(rawEntry) &&\n                rawEntry.type === OutputMockType.FAKER &&\n                rawEntry.schemas === true;\n              const recoveredSchemaFactoryImports =\n                usesSchemaFactories && output.schemas\n                  ? collectRecoveredSchemaFactoryImports(\n                      finalizedMockImplementation,\n                      builder.schemas\n                        .filter((s) => s.schema)\n                        .map((s) => s.name),\n                    )\n                  : [];\n\n              const importsMockForBuilder = generateImportsForBuilder(\n                output,\n                filterLocalStrictMockTypeImports(\n                  mergeGeneratorImports(\n                    mockOutput.imports,\n                    recoveredSchemaFactoryImports,\n                  ),\n                  finalizeMockOptions.strictSchemaTypeNames,\n                ),\n                mockRelativeSchemasPath,\n                schemaTagMap,\n                undefined,\n                mockFilePath,\n              );\n\n              let mockData = header;\n              mockData += builder.importsMock({\n                implementation: finalizedMockImplementation,\n                imports: importsMockForBuilder,\n                projectName,\n                hasSchemaDir: !!output.schemas,\n                isAllowSyntheticDefaultImports,\n                options: isFunction(rawEntry) ? undefined : rawEntry,\n              });\n              mockData += `\\n${finalizedMockImplementation}`;\n\n              await writeGeneratedFile(mockFilePath, mockData);\n              extraPaths.push(mockFilePath);\n\n              let indexEntry = mockIndexEntries.find(\n                (e) => e.ext === mockExtension && e.mockDir === mockDir,\n              );\n              if (!indexEntry) {\n                indexEntry = { ext: mockExtension, mockDir, operations: [] };\n                mockIndexEntries.push(indexEntry);\n              }\n              if (\n                !indexEntry.operations.some(\n                  (o) => o.tag === tag && o.opName === kebabOperation,\n                )\n              ) {\n                indexEntry.operations.push({\n                  tag,\n                  opName: kebabOperation,\n                  handlerName: mockOutput.implementation.handlerName,\n                });\n              }\n            }\n\n            return {\n              operationFilename,\n              hasOperationSchemas,\n              operationSchemasFilename,\n              paths: [\n                implementationPath,\n                ...(hasOperationSchemas ? [operationSchemasPath] : []),\n                ...extraPaths,\n              ],\n            };\n          }),\n        );\n\n        const indexPaths: string[] = [];\n        if (output.indexFiles) {\n          const importExtension = getImportExtension(\n            extension,\n            output.tsconfig,\n          );\n          // Re-export only the runtime files, not each operation's\n          // `.schemas` file: two operations that both reference the same\n          // component schema (e.g. `Error` on every error response) would\n          // otherwise each declare it, and `export *`-ing both from this\n          // barrel is an ambiguous re-export. A schema type needed outside\n          // its own operation file can still be imported directly from\n          // `./<operation>.schemas`.\n          const barrelContent = operationFilePaths\n            .map(\n              ({ operationFilename }) =>\n                `export * from './${operationFilename}${importExtension}';\\n`,\n            )\n            .join('');\n          const indexPath = path.join(tagDir, `index${extension}`);\n          await writeGeneratedFile(indexPath, barrelContent);\n          indexPaths.push(indexPath);\n        }\n\n        return [\n          ...(hasHelpers ? [helperPath] : []),\n          ...operationFilePaths.flatMap(({ paths }) => paths),\n          ...indexPaths,\n        ];\n      } catch (error) {\n        throw new Error(\n          `Oups... 🍻. An Error occurred while writing tag ${tag} => ${String(error)}`,\n          { cause: error },\n        );\n      }\n    }),\n  );\n\n  const allGeneratedPaths = generatedFilePathsArray.flat();\n\n  // Written once, after every tag has accumulated its operations into the\n  // shared `mockIndexEntries`, so the tag-independent mock index at\n  // `<mockDir>/index.<ext><ext>` lists operations from all tags rather than\n  // just the last-completing one.\n  const mockIndexPaths: string[] = [];\n  if (output.mock.indexMockFiles) {\n    const mockImportExtension = getImportExtension(extension, output.tsconfig);\n    for (const { ext, mockDir, operations } of mockIndexEntries) {\n      const indexPath = path.join(mockDir, `index.${ext}${extension}`);\n      const indexContent = operations\n        .toSorted(\n          (a, b) =>\n            a.tag.localeCompare(b.tag) || a.opName.localeCompare(b.opName),\n        )\n        .map(({ tag, opName, handlerName }) => {\n          const localMockPath = upath.joinSafe(\n            './',\n            tag,\n            opName + '.' + ext + mockImportExtension,\n          );\n          // Alias by `{tag, opName}` (this entry's dedup key, therefore\n          // always unique) rather than re-exporting `handlerName` verbatim:\n          // `handlerName` is derived from `operationName`, which a user's\n          // `override.operationName` function can map to the same value for\n          // multiple operations, producing two identically-named exports in\n          // this shared barrel.\n          const alias = `${pascal(tag)}${pascal(opName)}MockHandler`;\n          return ext === OutputMockType.MSW\n            ? `export { ${handlerName} as ${alias} } from '${localMockPath}'\\n`\n            : `export * from '${localMockPath}'\\n`;\n        })\n        .join('');\n      await writeGeneratedFile(indexPath, indexContent);\n      mockIndexPaths.push(indexPath);\n    }\n  }\n\n  let rootIndexPath: string | undefined;\n  if (output.indexFiles) {\n    const importExtension = getImportExtension(extension, output.tsconfig);\n    const rootBarrelContent = tagEntries\n      .map(([tag]) => `export * from './${tag}/index${importExtension}';\\n`)\n      .join('');\n    rootIndexPath = path.join(dirname, `index${extension}`);\n    await writeGeneratedFile(rootIndexPath, rootBarrelContent);\n  }\n\n  return [\n    ...(globalSchemasPath ? [globalSchemasPath] : []),\n    ...(rootIndexPath ? [rootIndexPath] : []),\n    ...allGeneratedPaths,\n    ...mockIndexPaths,\n  ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAKA,MAAa,qBAAqB;CAChC,UAAU;CACV,OAAO;CACP,OAAO;AACT;AAoXA,MAAa,oBAAoB;CAC/B,cAAc;CACd,eAAe;AACjB;AAKA,MAAa,mBAAmB;CAC9B,YAAY;CACZ,aAAa;CACb,YAAY;CACZ,YAAY;AACd;AAKA,MAAa,iBAAiB;CAC5B,OAAO;CACP,MAAM;CACN,OAAO;AACT;AA8JA,MAAa,eAAe;CAC1B,SAAS;CACT,eAAe;CACf,O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