import { d as FieldOverrides, u as FieldOverride } from "./types-BBQaEPfE.mjs"; import { r as SchemaIoSide } from "./adapter-ktQaheWB.mjs"; import { c as IsSwagger2Doc, i as FromJSONSchemaMode, m as TypeAtPath, p as ResolveOpenAPIRef, r as FromJSONSchema, v as __SchemaInferenceFellBack } from "./typeInference-Y8tNEQJk.mjs"; import { z } from "zod"; //#region src/core/inferValue.d.ts /** * Recursive mapped type that mirrors a schema's shape for per-field * overrides. Dispatches on the schema kind in the same order as * {@link InferSchemaValue} so the inferred override map tracks the * inferred value shape. * * Exported so `` and other consumers can type their * `fields` prop against the same machinery `` uses. * * @group Components */ type InferFields = IsSwagger2Doc extends true ? __SchemaInferenceFellBack : T extends z.ZodType ? FieldOverrides> : T extends { openapi: unknown; } ? Ref extends string ? FieldOverrides, Ref>> : Record : T extends object ? unknown extends FromJSONSchema ? Record : FieldOverrides> : Record; /** * Infer the data type carried by the schema input. * * Mirrors {@link InferFields}'s dispatch order: Zod schema → `z.infer`, * OpenAPI doc + ref → `ResolveOpenAPIRef`, plain JSON Schema object → * `FromJSONSchema`, everything else → `unknown`. The `Mode` parameter * is plumbed through to `FromJSONSchema` / `ResolveOpenAPIRef` so * `readOnly` / `writeOnly` keywords participate in the inferred * object shape — `"output"` for the rendered value, `"input"` for the * `onChange` argument. * * When the schema's value type cannot be statically determined (e.g. * a runtime `Record` JSON Schema, or an OpenAPI doc * without a ref), the result falls back to `unknown` so callers can * still supply arbitrary values. */ type InferSchemaValue = IsSwagger2Doc extends true ? __SchemaInferenceFellBack : T extends z.ZodType ? Mode extends "input" ? z.input : z.output : T extends { openapi: unknown; } ? Ref extends string ? ResolveOpenAPIRef, Ref, [], Mode> : unknown : T extends object ? FromJSONSchema, [], Mode> | (unknown extends FromJSONSchema ? unknown : never) extends infer V ? V : unknown : unknown; /** * Narrow an inferred value type to the sub-shape at `P`, or return * the original value type when `P` is `undefined` (no path supplied). */ type NarrowAtPath = P extends string ? TypeAtPath : V; /** * Public alias mapping a schema input to the rendered value type. * * Picks the OUTPUT side (server → client) of every transform / pipe / * codec. For a `` or `` * (both defaults), this is the inferred shape of `value` and the * parameter of `onChange`. */ type InferredOutputValue = NarrowAtPath, P>; /** * Companion to {@link InferredOutputValue} for `"input"`-mode shapes. * * Picks the INPUT side (client → server) of every transform / pipe / * codec. Surfaces as the inferred shape of `value` / `onChange` when * a consumer renders ``. For JSON Schema * inputs with `readOnly`/`writeOnly` annotations, the INPUT mode * omits properties marked `readOnly: true`. */ type InferredInputValue = NarrowAtPath, P>; /** * Resolve the schema-driven value type for either I/O direction. * * Thin convenience over {@link InferredOutputValue} / * {@link InferredInputValue} so consumers that decide between the * two at the type level (e.g. a generic wrapper component) can pass * the chosen direction as a type argument rather than branch on it * with conditional types. Falls back to `unknown` when the schema's * value type cannot be statically inferred, identical to the * underlying helpers. */ type InferredValue = NarrowAtPath, P>; //#endregion export { InferredValue as a, InferredOutputValue as i, InferSchemaValue as n, InferredInputValue as r, InferFields as t };