attaform 0.20.2 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/chunks/dev-key-collision-warnings.cjs +58 -0
  2. package/dist/chunks/dev-key-collision-warnings.cjs.map +1 -0
  3. package/dist/chunks/dev-key-collision-warnings.mjs +55 -0
  4. package/dist/chunks/dev-key-collision-warnings.mjs.map +1 -0
  5. package/dist/chunks/devtools.cjs +1 -1
  6. package/dist/chunks/devtools.mjs +1 -1
  7. package/dist/chunks/fingerprint.cjs +186 -0
  8. package/dist/chunks/fingerprint.cjs.map +1 -0
  9. package/dist/chunks/fingerprint.mjs +184 -0
  10. package/dist/chunks/fingerprint.mjs.map +1 -0
  11. package/dist/chunks/fingerprint2.cjs +162 -0
  12. package/dist/chunks/fingerprint2.cjs.map +1 -0
  13. package/dist/chunks/fingerprint2.mjs +160 -0
  14. package/dist/chunks/fingerprint2.mjs.map +1 -0
  15. package/dist/chunks/indexeddb.cjs +1 -1
  16. package/dist/chunks/indexeddb.mjs +1 -1
  17. package/dist/chunks/local-storage.cjs +1 -1
  18. package/dist/chunks/local-storage.mjs +1 -1
  19. package/dist/chunks/multi-tab-sync.cjs +367 -0
  20. package/dist/chunks/multi-tab-sync.cjs.map +1 -0
  21. package/dist/chunks/multi-tab-sync.mjs +364 -0
  22. package/dist/chunks/multi-tab-sync.mjs.map +1 -0
  23. package/dist/chunks/session-storage.cjs +1 -1
  24. package/dist/chunks/session-storage.mjs +1 -1
  25. package/dist/chunks/wire-persistence.cjs +396 -0
  26. package/dist/chunks/wire-persistence.cjs.map +1 -0
  27. package/dist/chunks/wire-persistence.mjs +394 -0
  28. package/dist/chunks/wire-persistence.mjs.map +1 -0
  29. package/dist/esbuild.cjs +28 -0
  30. package/dist/esbuild.cjs.map +1 -0
  31. package/dist/esbuild.d.cts +56 -0
  32. package/dist/esbuild.d.mts +56 -0
  33. package/dist/esbuild.d.ts +56 -0
  34. package/dist/esbuild.mjs +26 -0
  35. package/dist/esbuild.mjs.map +1 -0
  36. package/dist/index.cjs +5 -3
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +66 -70
  39. package/dist/index.d.mts +66 -70
  40. package/dist/index.d.ts +66 -70
  41. package/dist/index.mjs +5 -5
  42. package/dist/nuxt.d.cts +1 -1
  43. package/dist/nuxt.d.mts +1 -1
  44. package/dist/nuxt.d.ts +1 -1
  45. package/dist/rollup.cjs +24 -0
  46. package/dist/rollup.cjs.map +1 -0
  47. package/dist/rollup.d.cts +35 -0
  48. package/dist/rollup.d.mts +35 -0
  49. package/dist/rollup.d.ts +35 -0
  50. package/dist/rollup.mjs +22 -0
  51. package/dist/rollup.mjs.map +1 -0
  52. package/dist/rspack.cjs +10 -0
  53. package/dist/rspack.cjs.map +1 -0
  54. package/dist/rspack.d.cts +40 -0
  55. package/dist/rspack.d.mts +40 -0
  56. package/dist/rspack.d.ts +40 -0
  57. package/dist/rspack.mjs +8 -0
  58. package/dist/rspack.mjs.map +1 -0
  59. package/dist/runtime/plugins/attaform.cjs +2 -2
  60. package/dist/runtime/plugins/attaform.mjs +2 -2
  61. package/dist/shared/attaform.BJGA_UOS.mjs +37 -0
  62. package/dist/shared/attaform.BJGA_UOS.mjs.map +1 -0
  63. package/dist/shared/attaform.BRGIpZo4.cjs +26 -0
  64. package/dist/shared/attaform.BRGIpZo4.cjs.map +1 -0
  65. package/dist/shared/{attaform.DAKrGhxc.cjs → attaform.BSkvn43g.cjs} +101 -417
  66. package/dist/shared/attaform.BSkvn43g.cjs.map +1 -0
  67. package/dist/shared/{attaform.sWm8B15V.d.mts → attaform.BWfliRIK.d.cts} +172 -2
  68. package/dist/shared/{attaform.BGk8cfw2.mjs → attaform.Be8NZG9M.mjs} +178 -21
  69. package/dist/shared/attaform.Be8NZG9M.mjs.map +1 -0
  70. package/dist/shared/{attaform.D2SCCd4O.cjs → attaform.Bq5sX7TF.cjs} +2 -2
  71. package/dist/shared/{attaform.D2SCCd4O.cjs.map → attaform.Bq5sX7TF.cjs.map} +1 -1
  72. package/dist/shared/{attaform.ceGEAEMk.d.ts → attaform.Bv7dRDWK.d.ts} +172 -2
  73. package/dist/shared/attaform.C3Doa9Pt.mjs +24 -0
  74. package/dist/shared/attaform.C3Doa9Pt.mjs.map +1 -0
  75. package/dist/shared/{attaform.B_hph5AE.cjs → attaform.CICFZ1iS.cjs} +178 -20
  76. package/dist/shared/attaform.CICFZ1iS.cjs.map +1 -0
  77. package/dist/shared/attaform.CQN9R62B.cjs +39 -0
  78. package/dist/shared/attaform.CQN9R62B.cjs.map +1 -0
  79. package/dist/shared/{attaform.CwLjUqmQ.cjs → attaform.ClXwitZj.cjs} +735 -960
  80. package/dist/shared/attaform.ClXwitZj.cjs.map +1 -0
  81. package/dist/shared/{attaform.99cfHcIt.d.cts → attaform.D0dWZsJt.d.cts} +349 -77
  82. package/dist/shared/{attaform.99cfHcIt.d.mts → attaform.D0dWZsJt.d.mts} +349 -77
  83. package/dist/shared/{attaform.99cfHcIt.d.ts → attaform.D0dWZsJt.d.ts} +349 -77
  84. package/dist/shared/{attaform.z5j3LwJz.cjs → attaform.D32WwKk6.cjs} +216 -35
  85. package/dist/shared/attaform.D32WwKk6.cjs.map +1 -0
  86. package/dist/shared/{attaform.C5aYC_T8.mjs → attaform.DMEP_ENr.mjs} +39 -392
  87. package/dist/shared/attaform.DMEP_ENr.mjs.map +1 -0
  88. package/dist/shared/{attaform.tiWEVznj.mjs → attaform.DR6RmxWZ.mjs} +725 -962
  89. package/dist/shared/attaform.DR6RmxWZ.mjs.map +1 -0
  90. package/dist/shared/{attaform.Dt7dEcHk.mjs → attaform.DozgVlCE.mjs} +89 -405
  91. package/dist/shared/attaform.DozgVlCE.mjs.map +1 -0
  92. package/dist/shared/{attaform.DN5CvZrg.d.ts → attaform.Duecg2NO.d.mts} +2 -2
  93. package/dist/shared/attaform.DuzQYscR.d.cts +41 -0
  94. package/dist/shared/attaform.DuzQYscR.d.mts +41 -0
  95. package/dist/shared/attaform.DuzQYscR.d.ts +41 -0
  96. package/dist/shared/{attaform.BXinSW2T.d.mts → attaform.FudOcHaa.d.cts} +2 -2
  97. package/dist/shared/attaform.LEWUFqUw.cjs +54 -0
  98. package/dist/shared/attaform.LEWUFqUw.cjs.map +1 -0
  99. package/dist/shared/{attaform.CywE4y8x.d.cts → attaform.MtrpT6Ki.d.ts} +2 -2
  100. package/dist/shared/{attaform.DbRgDFa7.d.cts → attaform.NQ8mybyW.d.mts} +172 -2
  101. package/dist/shared/{attaform.Cd4AOfwu.cjs → attaform.S-pYLSo4.cjs} +68 -402
  102. package/dist/shared/attaform.S-pYLSo4.cjs.map +1 -0
  103. package/dist/shared/{attaform.CnrxbkB6.mjs → attaform.Y1ZGhM4k.mjs} +2 -2
  104. package/dist/shared/{attaform.CnrxbkB6.mjs.map → attaform.Y1ZGhM4k.mjs.map} +1 -1
  105. package/dist/shared/{attaform.QG5TG8lB.mjs → attaform.pmtahXKy.mjs} +216 -36
  106. package/dist/shared/attaform.pmtahXKy.mjs.map +1 -0
  107. package/dist/shared/attaform.sHkHv_98.mjs +51 -0
  108. package/dist/shared/attaform.sHkHv_98.mjs.map +1 -0
  109. package/dist/vite.cjs +9 -45
  110. package/dist/vite.cjs.map +1 -1
  111. package/dist/vite.d.cts +36 -0
  112. package/dist/vite.d.mts +36 -0
  113. package/dist/vite.d.ts +36 -0
  114. package/dist/vite.mjs +8 -44
  115. package/dist/vite.mjs.map +1 -1
  116. package/dist/webpack.cjs +10 -0
  117. package/dist/webpack.cjs.map +1 -0
  118. package/dist/webpack.d.cts +37 -0
  119. package/dist/webpack.d.mts +37 -0
  120. package/dist/webpack.d.ts +37 -0
  121. package/dist/webpack.mjs +8 -0
  122. package/dist/webpack.mjs.map +1 -0
  123. package/dist/zod-v3.cjs +3 -3
  124. package/dist/zod-v3.d.cts +3 -3
  125. package/dist/zod-v3.d.mts +3 -3
  126. package/dist/zod-v3.d.ts +3 -3
  127. package/dist/zod-v3.mjs +3 -3
  128. package/dist/zod-v4.cjs +3 -3
  129. package/dist/zod-v4.d.cts +4 -4
  130. package/dist/zod-v4.d.mts +4 -4
  131. package/dist/zod-v4.d.ts +4 -4
  132. package/dist/zod-v4.mjs +3 -3
  133. package/dist/zod.cjs +8 -8
  134. package/dist/zod.cjs.map +1 -1
  135. package/dist/zod.d.cts +52 -10
  136. package/dist/zod.d.mts +52 -10
  137. package/dist/zod.d.ts +52 -10
  138. package/dist/zod.mjs +6 -6
  139. package/dist/zod.mjs.map +1 -1
  140. package/package.json +19 -5
  141. package/dist/shared/attaform.BGk8cfw2.mjs.map +0 -1
  142. package/dist/shared/attaform.B_hph5AE.cjs.map +0 -1
  143. package/dist/shared/attaform.C5aYC_T8.mjs.map +0 -1
  144. package/dist/shared/attaform.Cd4AOfwu.cjs.map +0 -1
  145. package/dist/shared/attaform.CwLjUqmQ.cjs.map +0 -1
  146. package/dist/shared/attaform.DAKrGhxc.cjs.map +0 -1
  147. package/dist/shared/attaform.Dt7dEcHk.mjs.map +0 -1
  148. package/dist/shared/attaform.QG5TG8lB.mjs.map +0 -1
  149. package/dist/shared/attaform.tiWEVznj.mjs.map +0 -1
  150. package/dist/shared/attaform.z5j3LwJz.cjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"attaform.BGk8cfw2.mjs","sources":["../../src/runtime/core/abstract-schema-factory.ts","../../src/runtime/core/walk-path-segments.ts","../../src/runtime/core/merge-deep.ts","../../src/runtime/core/walk-derive-default.ts","../../src/runtime/core/field-meta-store.ts","../../src/runtime/core/walk-slim-primitives.ts"],"sourcesContent":["/**\n * `createAbstractSchema` — the schema-agnostic factory that hosts every\n * `AbstractSchema` method whose implementation is identical-modulo-\n * introspector between the v3 and v4 adapters.\n *\n * Each adapter wires through two small contracts:\n *\n * - `SchemaIntrospector<Schema>` — pure, side-effect-free accessors\n * that read schema shape. The factory branches on `kindOf`, walks\n * discriminated-union literals via `getLiteralValues` /\n * `getDiscriminatedOptions`, detects coerce / preprocess nodes,\n * and consults the three async / container-refine flags.\n *\n * - `AbstractSchemaServices<Schema, Form, GetValueFormType>` — the\n * adapter-specific delegates the factory calls for everything that\n * genuinely diverges per Zod version: fingerprinting, path-walking\n * (the path walker itself has v3 / v4 quirks), default-value\n * derivation, the strict-mode `getDefaultValues` flow,\n * wrapper-peeling that's tied to the per-version wrapper set,\n * field-meta resolution, and the per-version `safeParse`\n * boundary.\n *\n * The two-interface split keeps the introspector reusable by any other\n * walker (fingerprint, slim-primitives, default-values) without dragging\n * in the side-effectful services. Services consume the introspector as\n * they wish; the factory consumes both.\n *\n * Behavior-neutral by design: the goal is one set of definitions for\n * the 13 structurally-parallel methods, with no observable change at\n * either adapter's `AbstractSchema` surface. Per-adapter caches keep\n * the same lifetime (one per `useForm()` call); `getSchemasAtPath`\n * preserves each adapter's prior sub-schema shape via the\n * `makeSubSchema` service (v3 recurses; v4 builds the 5-method stub).\n */\nimport type {\n AbstractSchema,\n DefaultValuesResponse,\n FormKey,\n GetDefaultValuesConfig,\n ResolvedFieldMeta,\n SlimPrimitiveKind,\n UnionDiscriminatorContext,\n ValidationError,\n ValidationResponse,\n ValidateOptions,\n} from '../types/types-api'\nimport type { SchemaFactoryOptions } from './get-computed-schema'\nimport { AttaformErrorCode } from './error-codes'\nimport { canonicalizePath, type Path, type PathKey } from './paths'\n\nconst PATH_SEPARATOR = '.'\n\n/**\n * Stable shape-discriminant the factory branches on. Adapters return\n * the union of v3 + v4 kinds plus `'unknown'` for anything they don't\n * recognise — the factory only inspects a small subset\n * (`'tuple'` / `'array'` for `arrayShapeAtPath`,\n * `'literal'` for the discriminated-union walk), so adapters can return\n * extra version-specific kinds (`'effects'` / `'pipeline'` / `'branded'`\n * / `'native-enum'` on v3) without confusing the factory.\n */\nexport type SharedZodKind =\n | 'string'\n | 'number'\n | 'boolean'\n | 'bigint'\n | 'date'\n | 'null'\n | 'undefined'\n | 'literal'\n | 'enum'\n | 'native-enum'\n | 'object'\n | 'array'\n | 'tuple'\n | 'set'\n | 'record'\n | 'map'\n | 'union'\n | 'discriminated-union'\n | 'intersection'\n | 'optional'\n | 'nullable'\n | 'default'\n | 'catch'\n | 'readonly'\n | 'branded'\n | 'effects'\n | 'pipeline'\n | 'lazy'\n | 'pipe'\n | 'transform'\n | 'preprocess'\n | 'any'\n | 'unknown'\n | 'never'\n | 'nan'\n | 'void'\n | 'file'\n | 'function'\n | 'symbol'\n | 'promise'\n | 'custom'\n | 'template-literal'\n\n/**\n * Pure schema-shape accessors. The factory consults these to branch on\n * structural facts about a schema node. Every member is side-effect-\n * free and idempotent.\n *\n * `kindOf` returns the discriminant; the structural accessors\n * (`getObjectShape`, `getTupleItems`, `getDiscriminatedOptions`,\n * `getLiteralValues`) read a single field of the node's def shape.\n * The three boolean predicates summarise tree-walking detections each\n * adapter already exposes; both adapters memoise them at the\n * AbstractSchema level so calling per construction is cheap.\n */\nexport interface SchemaIntrospector<Schema> {\n /** Discriminant on schema shape. Adapters may return extra kinds. */\n kindOf(schema: Schema): SharedZodKind | string\n /**\n * Returns the property-to-sub-schema map of a `ZodObject`. Empty\n * record for non-objects.\n */\n getObjectShape(schema: Schema): Record<string, Schema>\n /** Returns the position-typed items of a `ZodTuple`. Empty for non-tuples. */\n getTupleItems(schema: Schema): readonly Schema[]\n /**\n * Returns the option objects of a `ZodDiscriminatedUnion` — each one\n * is itself a `ZodObject` whose `getObjectShape` includes the\n * discriminator key as a `ZodLiteral`.\n */\n getDiscriminatedOptions(schema: Schema): readonly Schema[]\n /** Returns the discriminator key of a `ZodDiscriminatedUnion`. */\n getDiscriminator(schema: Schema): string | undefined\n /**\n * Returns the literal values a `ZodLiteral` admits. Multi-value\n * literals (`z.literal(['a', 'b'])`) return both; single-value return\n * the one. Empty for non-literals.\n */\n getLiteralValues(schema: Schema): readonly unknown[]\n /**\n * True iff the node is a preprocess-style schema-side normalizer:\n * `z.preprocess(fn, inner)` in either version. v3's `ZodEffects`\n * with `effect.type === 'preprocess'` and v4's `ZodPipe<ZodTransform,\n * inner>` both collapse here. Coerce primitives go through\n * `isCoercePrimitive` instead — they're not pipes in v4 and not\n * effects in v3, but both adapters detect them off the same flag.\n */\n isPreprocessNode(schema: Schema): boolean\n /**\n * True iff the schema is a `z.coerce.X()` primitive. Both adapter\n * versions store the coerce intent as a flag on the wrapped\n * primitive's def (not as a wrapper), so detection is uniform.\n */\n isCoercePrimitive(schema: Schema): boolean\n /**\n * True iff the schema tree contains a refine whose predicate can run\n * asynchronously. v3 is conservative (every `.refine` flagged because\n * the inner sync wrapper hides the user fn); v4 is exact (inspects\n * `def.checks[].def.fn.constructor.name`). Either way the runtime\n * uses this to decide whether a construction-time async pass is\n * needed.\n */\n containsAsyncRefine(schema: Schema): boolean\n /**\n * True iff the schema tree contains a `.transform(asyncFn)` /\n * `z.preprocess(asyncFn, …)`. Statically detectable in both adapters\n * via the user fn's `constructor.name === 'AsyncFunction'`. Disjoint\n * from `containsAsyncRefine` — refines and transforms live in\n * different slots.\n */\n containsAsyncTransform(schema: Schema): boolean\n /**\n * True iff any refine fires at a container node (object / array /\n * tuple / union / discriminated-union / intersection / record / set)\n * or the root. False means every refine is leaf-local, so per-keystroke\n * subtree validation catches the same verdicts as a whole-form pass.\n */\n hasContainerOrRootRefine(schema: Schema): boolean\n\n // ---------------------------------------------------------------------\n // Walker accessors — consumed by the shared `core/walk-*` walkers (D2 /\n // D3 / D5) so the path-walking / slim-primitive / default-derivation\n // shapes don't fork per adapter. v3 / v4 each expose the full surface;\n // members not applicable to one adapter return `undefined` (kept on the\n // contract so the walkers don't branch on adapter identity).\n // ---------------------------------------------------------------------\n\n /** Element schema of a `z.array(...)`. Undefined for non-arrays / malformed defs. */\n getArrayElement(schema: Schema): Schema | undefined\n /** Element schema of a `z.set(...)`. Undefined for non-sets / malformed defs. */\n getSetValueType(schema: Schema): Schema | undefined\n /** Key schema of a `z.record(K, V)`. Undefined for non-records / single-arg records. */\n getRecordKeyType(schema: Schema): Schema | undefined\n /** Value schema of a `z.record(...)`. Undefined for non-records / malformed defs. */\n getRecordValueType(schema: Schema): Schema | undefined\n /** Option array of a `z.union(...)`. Empty for non-unions. */\n getUnionOptions(schema: Schema): readonly Schema[]\n /** Left side of a `z.intersection(L, R)`. Undefined for non-intersections. */\n getIntersectionLeft(schema: Schema): Schema | undefined\n /** Right side of a `z.intersection(L, R)`. Undefined for non-intersections. */\n getIntersectionRight(schema: Schema): Schema | undefined\n /** Values of a `z.enum(...)`. Empty for non-enums. */\n getEnumValues(schema: Schema): readonly (string | number)[]\n /**\n * Raw reverse-mapped values object of a `z.nativeEnum(E)`. v3 returns\n * the TS enum object directly; v4 always returns `undefined` because\n * v4 folds nativeEnum into the regular `enum` kind.\n */\n getNativeEnumValues(schema: Schema): Record<string, unknown> | undefined\n\n /**\n * Inner schema of any wrapper exposing `def.innerType` — Optional /\n * Nullable / Default / Readonly / Catch in both v3 and v4. Branded\n * (v3-only) uses `def.type` instead — see `unwrapBranded`. Returns\n * `undefined` when no inner is available.\n */\n unwrapInner(schema: Schema): Schema | undefined\n /**\n * v3-only: `ZodBranded`'s inner schema (`_def.type`). Returns\n * `undefined` on v4 (no branded wrapper) and on non-branded schemas.\n */\n unwrapBranded(schema: Schema): Schema | undefined\n /**\n * v3-only: structural source of a `ZodEffects` (refine / transform /\n * preprocess) — `_def.schema`. Returns `undefined` on v4 (no\n * ZodEffects wrapper; effects live as pipe sides / leaf checks).\n */\n unwrapEffectsSource(schema: Schema): Schema | undefined\n /** Input side of v4's `z.pipe(IN, OUT)` (also v3's `z.pipeline(...)`). */\n unwrapPipeIn(schema: Schema): Schema | undefined\n /** Output side of a pipe — undefined on v3's `ZodEffects`. */\n unwrapPipeOut(schema: Schema): Schema | undefined\n /**\n * Inner schema of a `z.lazy(() => inner)`. Each call invokes the\n * getter fresh; if the getter throws (recursive cycle resolved before\n * its target is constructed) returns `undefined`.\n */\n unwrapLazy(schema: Schema): Schema | undefined\n /**\n * Getter function reference of a `z.lazy()` wrapper — used by walkers\n * that track cycle identity by the getter rather than its result\n * (each call returns a distinct schema instance).\n */\n getLazyGetter(schema: Schema): (() => unknown) | undefined\n\n /**\n * Resolve a `z.default(...)` wrapper to its declared default value.\n * v3 stores the default as a thunk (`() => value`); v4 stores it as\n * a getter that returns the value directly. Both adapters return the\n * resolved value here.\n */\n getDefaultValue(schema: Schema): unknown\n /**\n * Resolve a `z.catch(inner, val)` wrapper to its fallback value.\n * The catch slot stores a `(ctx) => value` function; both adapters\n * invoke it with a placeholder context and surface `undefined` if\n * the consumer's function throws.\n */\n getCatchDefault(schema: Schema): unknown\n /**\n * True iff the schema carries a callable `z.catch(...)` fallback.\n * Lets callers distinguish \"no catch wrapper\" from \"catch wrapper\n * whose value happens to be `undefined`.\"\n */\n hasCatchValue(schema: Schema): boolean\n}\n\n/**\n * Adapter-specific delegates the factory calls for operations that\n * genuinely differ per Zod version (path walking, default-value\n * derivation, wrapper-peeling, error normalization, sub-schema\n * construction). Each service is a thin wrapper around per-adapter\n * helpers; the factory composes them.\n *\n * `safeParseSync` / `safeParseAsync` abstract the per-version\n * `safeParse` / `safeParseAsync` calls so the factory can stay\n * version-agnostic. Both return a uniform success-discriminant shape;\n * `safeParseSync` is allowed to throw when the schema is async-only\n * (the factory catches and falls back to the async path).\n *\n * `makeSubSchema` is the per-adapter sub-schema constructor for\n * `getSchemasAtPath`. v3 recurses through the full adapter factory\n * (sub-schemas expose the entire `AbstractSchema` surface). v4 builds\n * a 5-method stub (fingerprint / needsAsyncValidation /\n * getDefaultValues / getSchemasAtPath / validateAtPath) because none\n * of its consumers reach for the wider surface and the stub keeps\n * sub-walker allocation cheap. The factory preserves each adapter's\n * prior behavior by routing through this service rather than hard-\n * coding one strategy.\n */\nexport interface AbstractSchemaServices<Schema, Form, GetValueFormType> {\n /** Returns the deterministic structural fingerprint of the schema. */\n fingerprint(schema: Schema): string\n /**\n * Returns every sub-schema reachable at the given path. Multiple\n * results indicate a union / discriminated-union split; empty\n * indicates the path doesn't resolve. Adapters cap descent through\n * `z.lazy(...)` via `maxRecursionDepth`.\n */\n getNestedSchemasAtPath(schema: Schema, path: Path, maxRecursionDepth: number): Schema[]\n /**\n * \"Slim-mode\" path walk — the variant `getSlimPrimitiveTypesAtPath`\n * and `getSchemasAtPath` consume. v3 strips refinements / defaults /\n * optional / nullable / effects off the root before walking, so the\n * yielded candidates reflect the slim shape (matches what the slim-\n * primitive gate sees and what consumers expect when introspecting\n * sub-schemas). v4 walks the original schema and aliases this to\n * `getNestedSchemasAtPath` — its path walker already inlines the\n * wrapper peeling.\n */\n getNestedSchemasInSlimMode(schema: Schema, path: Path, maxRecursionDepth: number): Schema[]\n /** Returns the slim-primitive accept-set of a single sub-schema. */\n slimPrimitivesOf(schema: Schema, maxRecursionDepth: number): Set<SlimPrimitiveKind>\n /**\n * Returns the schema's prescribed default at the given root. The\n * runtime calls this in `getDefaultAtPath` (`useDefault=true` — honor\n * `.default(x)`) and `getEmptyValueAtPath` (`useDefault=false` —\n * yield the inner-schema's falsy concrete). v3 and v4 each implement\n * their own walker; the factory only consumes the result.\n */\n deriveDefault(\n schema: Schema,\n useDefault: boolean,\n maxRecursionDepth: number,\n formKey: FormKey\n ): unknown\n /**\n * Adapter-owned construction-time default-values flow. v3 runs a\n * validate-then-fix loop against a slim schema with strict-mode\n * refine seeding; v4 runs a strict-pass-or-lax-success against the\n * derived data. Both honour `config.strict ?? true` and\n * `config.constraints`.\n */\n runStrictGetDefaults(\n schema: Schema,\n config: GetDefaultValuesConfig<Form>,\n formKey: FormKey,\n maxRecursionDepth: number\n ): DefaultValuesResponse<Form>\n /**\n * Peels `.optional()` / `.nullable()` only when the inner is\n * structurally fillable (object / array / tuple / record /\n * union / intersection or a chain of peelable wrappers that resolve\n * to one of those). Used by `getDefaultAtPath` so partial writes\n * through optional sub-schemas fill from the inner shape's defaults.\n * `.default(x)` is preserved at every layer.\n */\n unwrapStructuralWrappers(schema: Schema): Schema\n /**\n * Peels every transparent wrapper (optional / nullable / default /\n * readonly / catch / pipe / lazy / branded / effects) and descends\n * intersection sides looking for a single discriminated union.\n * Returns the matching DU or `undefined` when no DU is found or\n * when ambiguity bails (two different DUs both reachable).\n */\n unwrapToDiscriminatedUnion(schema: Schema): Schema | undefined\n /**\n * Peels every transparent wrapper off a schema — for `arrayShapeAtPath`\n * the goal is the structural kind regardless of default-value\n * semantics, so `.default(x)` / `.catch(x)` are peeled here whereas\n * `unwrapStructuralWrappers` preserves them.\n */\n peelAllWrappers(schema: Schema): Schema\n /**\n * Returns `true` iff the leaf schema is \"required\" at the\n * union-aware sense documented on `AbstractSchema.isRequiredAtPath`:\n * `.optional()` / `.nullable()` / `.default()` / `.catch()` at any\n * wrapper layer make the leaf permissive; union requires every\n * branch; intersection requires either side.\n */\n isLeafRequired(schema: Schema): boolean\n /** Returns the resolved field-meta payload for the schema at `path`. */\n resolveFieldMetaAtPath(schema: Schema, path: Path, maxRecursionDepth: number): ResolvedFieldMeta\n /**\n * Normalise schema-library issues into the runtime's\n * `ValidationError[]` shape. v3 and v4 have slightly different\n * `ZodIssue` payloads; each adapter knows how to map its own.\n */\n issuesToValidationErrors(issues: readonly unknown[], formKey: FormKey): ValidationError[]\n /**\n * Run a sync `safeParse` against the schema. Returns a tagged result\n * the factory aggregates into a `ValidationResponse`. MAY throw when\n * the schema contains async-only refines / transforms (the factory\n * catches and falls back to the async path).\n */\n safeParseSync(\n schema: Schema,\n data: unknown\n ): { success: true; data: unknown } | { success: false; issues: readonly unknown[] }\n /** Async sister of `safeParseSync`. MUST NOT throw (catch user-fn rejections). */\n safeParseAsync(\n schema: Schema,\n data: unknown\n ): Promise<{ success: true; data: unknown } | { success: false; issues: readonly unknown[] }>\n /**\n * Per-adapter sub-schema constructor for `getSchemasAtPath`. v3\n * recurses through the full factory (sub-schemas carry the entire\n * `AbstractSchema` surface). v4 returns a 5-method stub. The factory\n * delegates here to preserve each adapter's prior shape; consumers\n * across the runtime only reach for `needsAsyncValidation()` on\n * sub-schemas, so both shapes are observationally interchangeable.\n */\n makeSubSchema(\n schema: Schema,\n formKey: FormKey,\n maxRecursionDepth: number\n ): AbstractSchema<unknown, GetValueFormType>\n}\n\n/**\n * Build a runtime `AbstractSchema` for `rootSchema` by composing the\n * shared uniform-method implementations with the per-adapter introspector\n * + services. Each adapter calls this once per `useForm({ schema })` —\n * the returned object plus its three caches (`leafCache`,\n * `preprocessOrCoerceCache`, `discriminatorCache`) plus the two memoised\n * lazy flags live for the form's lifetime.\n */\nexport function createAbstractSchema<Schema, Form, GetValueFormType>(\n rootSchema: Schema,\n intro: SchemaIntrospector<Schema>,\n services: AbstractSchemaServices<Schema, Form, GetValueFormType>,\n formKey: FormKey,\n options: SchemaFactoryOptions\n): AbstractSchema<Form, GetValueFormType> {\n const maxRecursionDepth = options.maxRecursionDepth\n\n // Per-adapter caches. Lifetime = one `createAbstractSchema` call (one\n // per `useForm()`). These memoise the schema walks that the proxy\n // traps + reactive computeds hit on every read so the schema doesn't\n // get re-walked per keystroke / per field-state get.\n const leafCache = new Map<PathKey, boolean>()\n const preprocessOrCoerceCache = new Map<PathKey, boolean>()\n const discriminatorCache = new Map<PathKey, UnionDiscriminatorContext | undefined>()\n // Memoised one-shot tree walks. `needsAsyncValidation` is queried at\n // construction by the store (drives the construction-time async seed);\n // `hasContainerOrRootRefine` is queried per keystroke (drives the\n // subtree-vs-whole-form scope cut).\n let asyncValidationFlag: boolean | null = null\n let containerRefineFlag: boolean | null = null\n\n function computeDiscriminator(path: Path): UnionDiscriminatorContext | undefined {\n const candidates =\n path.length === 0\n ? [rootSchema]\n : services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n // `unwrapToDiscriminatedUnion` peels every transparent wrapper\n // (Optional / Nullable / Default / Readonly / Catch / Effects /\n // Pipeline / Branded) and descends Intersection sides looking for a\n // single discriminated union. Ambiguous resolutions (two distinct\n // DUs both reachable across candidates) bail — the runtime then\n // falls back to a plain write.\n let matchedUnion: Schema | undefined\n for (const candidate of candidates) {\n const du = services.unwrapToDiscriminatedUnion(candidate)\n if (du === undefined) continue\n if (matchedUnion !== undefined && matchedUnion !== du) return undefined\n matchedUnion = du\n }\n if (matchedUnion === undefined) return undefined\n const discKey = intro.getDiscriminator(matchedUnion)\n if (discKey === undefined) return undefined\n const unionOptions = intro.getDiscriminatedOptions(matchedUnion)\n const literalSet = new Set<unknown>()\n for (const opt of unionOptions) {\n const shape = intro.getObjectShape(opt)\n const litSchema = shape[discKey]\n if (litSchema === undefined) continue\n if (intro.kindOf(litSchema) !== 'literal') continue\n // Multi-value literals (`z.literal(['a','b'])`) register every\n // member as a selectable variant.\n for (const v of intro.getLiteralValues(litSchema)) literalSet.add(v)\n }\n return {\n discriminatorKey: discKey,\n getVariantDefault(value: unknown): unknown {\n for (const opt of unionOptions) {\n const shape = intro.getObjectShape(opt)\n const litSchema = shape[discKey]\n if (litSchema === undefined) continue\n if (intro.kindOf(litSchema) !== 'literal') continue\n const literalValues = intro.getLiteralValues(litSchema)\n if (literalValues.includes(value)) {\n return services.deriveDefault(opt, true, maxRecursionDepth, formKey)\n }\n }\n return undefined\n },\n isVariantSelected(value: unknown): boolean {\n return literalSet.has(value)\n },\n }\n }\n\n const abstractSchema: AbstractSchema<Form, GetValueFormType> = {\n fingerprint: () => services.fingerprint(rootSchema),\n\n needsAsyncValidation(): boolean {\n asyncValidationFlag ??=\n intro.containsAsyncRefine(rootSchema) || intro.containsAsyncTransform(rootSchema)\n return asyncValidationFlag\n },\n\n hasContainerOrRootRefine(): boolean {\n containerRefineFlag ??= intro.hasContainerOrRootRefine(rootSchema)\n return containerRefineFlag\n },\n\n getDefaultValues(config: GetDefaultValuesConfig<Form>): DefaultValuesResponse<Form> {\n return services.runStrictGetDefaults(rootSchema, config, formKey, maxRecursionDepth)\n },\n\n getDefaultAtPath(path) {\n // Empty path → root default. Reuses the same generator used at\n // form construction so refines / wrappers behave consistently.\n if (path.length === 0) {\n return services.deriveDefault(rootSchema, true, maxRecursionDepth, formKey)\n }\n const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (first === undefined) return undefined\n // STRUCTURAL default: peel `.optional()` / `.nullable()` so partial\n // object writes through optional sub-schemas (`{ profile:\n // z.object({...}).optional() }`) get the inner shape's defaults\n // filled in. `.default(x)` is preserved so deriveDefault returns\n // the explicit default. First candidate matches\n // `validateAtPath`'s first-success semantic.\n const peeled = services.unwrapStructuralWrappers(first)\n return services.deriveDefault(peeled, true, maxRecursionDepth, formKey)\n },\n\n getEmptyValueAtPath(path) {\n // `clear`'s underlying value lookup. Same path-resolution flow as\n // `getDefaultAtPath` but with `useDefault=false` so `.default(x)`\n // / `.catch(x)` wrappers are skipped — the walker yields the\n // inner-schema's empty concrete instead. Structural wrappers\n // (`.optional()` / `.nullable()`) are NOT peeled: clearing an\n // `.optional()` slot is legitimately `undefined`, clearing a\n // `.nullable()` slot is `null`.\n if (path.length === 0) {\n return services.deriveDefault(rootSchema, false, maxRecursionDepth, formKey)\n }\n const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (first === undefined) return undefined\n return services.deriveDefault(first, false, maxRecursionDepth, formKey)\n },\n\n arrayShapeAtPath(path) {\n if (path.length === 0) return undefined\n const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (first === undefined) return undefined\n const peeled = services.peelAllWrappers(first)\n const kind = intro.kindOf(peeled)\n if (kind === 'tuple') return intro.getTupleItems(peeled).length\n if (kind === 'array') return null\n return undefined\n },\n\n getSchemasAtPath(path) {\n // Slim-mode walk: v3 strips refinements / defaults / wrappers off\n // the root so the yielded sub-schemas reflect the slim shape (the\n // shape the slim-primitive gate consults). v4 aliases the slim\n // and unstripped walks to the same call. The factory uses one\n // hook for both `getSlimPrimitiveTypesAtPath` and\n // `getSchemasAtPath` — same v3 strip semantic, same v4 alias.\n const resolved = services.getNestedSchemasInSlimMode(rootSchema, path, maxRecursionDepth)\n // Empty list is a valid result for paths the schema doesn't\n // declare — callers (getValue / register / custom introspection)\n // treat `[]` as \"no sub-schema here\". No warning needed.\n if (resolved.length === 0) return []\n return resolved.map((sub) => services.makeSubSchema(sub, formKey, maxRecursionDepth))\n },\n\n getSlimPrimitiveTypesAtPath(path): Set<SlimPrimitiveKind> {\n // Empty path is the root form: always an object.\n if (path.length === 0) return new Set<SlimPrimitiveKind>(['object'])\n const resolved = services.getNestedSchemasInSlimMode(rootSchema, path, maxRecursionDepth)\n // Path doesn't resolve in the schema → no kinds accepted. The\n // gate's membership check rejects every kind against an empty\n // set, blocking writes to typo / unknown paths.\n if (resolved.length === 0) return new Set<SlimPrimitiveKind>()\n const out = new Set<SlimPrimitiveKind>()\n for (const candidate of resolved) {\n for (const k of services.slimPrimitivesOf(candidate, maxRecursionDepth)) {\n out.add(k)\n }\n }\n return out\n },\n\n isLeafAtPath(path): boolean {\n const cacheKey = canonicalizePath(path).key\n const cached = leafCache.get(cacheKey)\n if (cached !== undefined) return cached\n const prim = this.getSlimPrimitiveTypesAtPath(path)\n // Empty set → path doesn't exist in schema → descend permissively\n // (treat as container so schema-named reserved keys at depth 2+\n // don't shadow). Any container kind in the set → descend.\n // Otherwise every kind is a primitive → leaf.\n const isLeaf =\n prim.size > 0 &&\n !prim.has('object') &&\n !prim.has('array') &&\n !prim.has('map') &&\n !prim.has('set')\n leafCache.set(cacheKey, isLeaf)\n return isLeaf\n },\n\n isPreprocessOrCoerceLeaf(path): boolean {\n // Walks prefixes of `path` looking for either shape adapters\n // use for schema-side input normalizers (`z.preprocess(...)` or\n // `z.coerce.X()`). Returns true at such a node OR anywhere\n // underneath it; the slim-primitive gate uses this to accept\n // raw consumer writes verbatim throughout that subtree.\n const cacheKey = canonicalizePath(path).key\n const cached = preprocessOrCoerceCache.get(cacheKey)\n if (cached !== undefined) return cached\n let hit = false\n for (let i = 0; i <= path.length && !hit; i++) {\n const prefix = path.slice(0, i)\n const candidates: Schema[] =\n prefix.length === 0\n ? [rootSchema]\n : services.getNestedSchemasAtPath(rootSchema, prefix, maxRecursionDepth)\n for (const candidate of candidates) {\n if (intro.isCoercePrimitive(candidate) || intro.isPreprocessNode(candidate)) {\n hit = true\n break\n }\n }\n }\n preprocessOrCoerceCache.set(cacheKey, hit)\n return hit\n },\n\n isRequiredAtPath(path): boolean {\n // Root form is structurally required (it's the parsed object).\n // The required-empty check tracks primitive leaves only, so this\n // branch is academic for the call sites that matter.\n if (path.length === 0) return true\n const resolved = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (resolved.length === 0) return false\n // Every candidate must be required for the path overall to be\n // required — matches the union \"any-branch-permissive\" rule\n // when the path traverses a union.\n return resolved.every((candidate) => services.isLeafRequired(candidate))\n },\n\n getFieldMetaAtPath(path): ResolvedFieldMeta {\n return services.resolveFieldMetaAtPath(rootSchema, path, maxRecursionDepth)\n },\n\n getUnionDiscriminatorAtPath(path): UnionDiscriminatorContext | undefined {\n const cacheKey = canonicalizePath(path).key\n if (discriminatorCache.has(cacheKey)) {\n return discriminatorCache.get(cacheKey)\n }\n const result = computeDiscriminator(path)\n discriminatorCache.set(cacheKey, result)\n return result\n },\n\n validateAtPath(\n data: unknown,\n path: Path | undefined,\n validateOptions?: ValidateOptions\n ): ReturnType<AbstractSchema<Form, GetValueFormType>['validateAtPath']> {\n // Sync attempt: when `options.sync === true`, try the sync parse.\n // It throws on async refines / pipes / transforms; we catch and\n // fall through to the async path. Without the flag the adapter\n // goes straight to async — the historical contract every non-\n // reshape callsite expects.\n const trySync = validateOptions?.sync === true\n if (trySync) {\n try {\n return runSync()\n } catch {\n // Async-only schema. Fall through to the async path.\n }\n }\n return runAsync()\n\n function runSync(): ValidationResponse<GetValueFormType> {\n if (path === undefined) {\n const result = services.safeParseSync(rootSchema, data)\n return result.success\n ? {\n data: result.data as GetValueFormType,\n errors: undefined,\n success: true,\n formKey,\n }\n : {\n data: undefined,\n errors: services.issuesToValidationErrors(result.issues, formKey),\n success: false,\n formKey,\n }\n }\n const resolved = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (resolved.length === 0) return pathNotFound(path)\n const aggregated: ValidationError[] = []\n for (const candidate of resolved) {\n const result = services.safeParseSync(candidate, data)\n if (result.success) {\n return {\n data: result.data as GetValueFormType,\n errors: undefined,\n success: true,\n formKey,\n }\n }\n aggregated.push(...services.issuesToValidationErrors(result.issues, formKey))\n }\n return { data: undefined, errors: aggregated, success: false, formKey }\n }\n\n async function runAsync(): Promise<ValidationResponse<GetValueFormType>> {\n if (path === undefined) {\n let result: Awaited<ReturnType<typeof services.safeParseAsync>>\n try {\n result = await services.safeParseAsync(rootSchema, data)\n } catch (err) {\n return validatorThrewResponse(err, [])\n }\n return result.success\n ? {\n data: result.data as GetValueFormType,\n errors: undefined,\n success: true,\n formKey,\n }\n : {\n data: undefined,\n errors: services.issuesToValidationErrors(result.issues, formKey),\n success: false,\n formKey,\n }\n }\n const resolved = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (resolved.length === 0) return pathNotFound(path)\n // Sequential await — parallelising would run every branch's\n // async side effects on a value only one branch should see.\n const aggregated: ValidationError[] = []\n for (const candidate of resolved) {\n let result: Awaited<ReturnType<typeof services.safeParseAsync>>\n try {\n result = await services.safeParseAsync(candidate, data)\n } catch (err) {\n return validatorThrewResponse(err, path)\n }\n if (result.success) {\n return {\n data: result.data as GetValueFormType,\n errors: undefined,\n success: true,\n formKey,\n }\n }\n aggregated.push(...services.issuesToValidationErrors(result.issues, formKey))\n }\n return { data: undefined, errors: aggregated, success: false, formKey }\n }\n\n // User code inside `z.preprocess` / `.refine` / `.transform` can\n // throw (sync) or reject (async). Zod does NOT wrap these into\n // issues; they propagate out of `safeParse` / `safeParseAsync`.\n // Without this catch the throw bubbles through `validateAtPath`\n // into the runtime's submit / change-mode pipelines as either a\n // `submitError` (handleSubmit) or an unhandled rejection\n // (scheduleFieldValidation), and the consumer would never see a\n // path-scoped error message. Surface as a `ValidationError` at\n // the field path so the form's normal error pipeline handles it.\n function validatorThrewResponse(\n err: unknown,\n errPath: Path\n ): ValidationResponse<GetValueFormType> {\n const message =\n err instanceof Error ? err.message : typeof err === 'string' ? err : 'Validator threw'\n return {\n data: undefined,\n errors: [\n {\n message,\n path: [...errPath],\n formKey,\n code: AttaformErrorCode.ValidatorThrew,\n },\n ],\n success: false,\n formKey,\n }\n }\n\n function pathNotFound(p: Path): ValidationResponse<GetValueFormType> {\n return {\n data: undefined,\n errors: [\n {\n message: `Path '${p.join(PATH_SEPARATOR)}' did not resolve to any schema`,\n path: [...p],\n formKey,\n code: AttaformErrorCode.PathNotFound,\n },\n ],\n success: false,\n formKey,\n }\n }\n },\n }\n\n return abstractSchema\n}\n","/**\n * Shared path walker — descends a dotted segment array through a Zod\n * schema tree and returns the sub-schemas reachable at that path.\n *\n * One body, two adapters: v3 and v4 each invoke `walkPathSegments`\n * with their `SchemaIntrospector` instance. Wrapper / container kinds\n * (Optional / Nullable / Default / Readonly / Catch / Pipe / Pipeline /\n * Effects / Branded / Lazy / Intersection / Union / DiscriminatedUnion /\n * Object / Array / Set / Record / Tuple) all dispatch through the\n * introspector accessors, so the walker stays agnostic to per-version\n * `def.*` shape.\n *\n * Semantics (preserved verbatim from the prior per-adapter\n * implementations — characterised by `test/adapters/zod-v3/path-walker.test.ts`\n * and `test/adapters/zod-v4/path-walker.test.ts`):\n *\n * - Unions return multiple candidates (caller tries each).\n * - Discriminated unions filter options to those whose shape owns the\n * next segment (`Object.hasOwn`, NOT `in`, so `Object.prototype` keys\n * don't leak); fall back to every option when no shape matches\n * (the segment is the discriminator key itself).\n * - Object shape access uses `Object.hasOwn` for the same reason: a\n * bare `shape[head]` would resolve `'toString'` / `'valueOf'` etc.\n * to the inherited Function and treat it as a schema.\n * - Transparent wrappers (optional / nullable / default / readonly /\n * catch / pipe / pipeline / effects / branded) descend without\n * consuming a segment.\n * - `lazy` bumps the lazy counter; past the cap the walker returns\n * `[]` so writes at recursive paths deeper than `maxRecursionDepth`\n * fall back to a permissive type gate.\n * - Intersection unions both sides' resolutions — callers try each\n * candidate, matching parse-time semantics where a value must\n * satisfy both.\n * - Leaf kinds (string / number / boolean / literal / enum / etc.)\n * return `[]` when path remains, so a caller that asked for\n * `firstName.middle` against a string schema gets an empty\n * resolution rather than a wrong schema.\n * - Unsupported kinds (`map` / `symbol` / `function` / `promise`) are\n * rejected at adapter construction by `assertSupportedKinds`; the\n * walker's exhaustiveness on those kinds returns `[]` defensively\n * so a downstream caller that instantiates a sub-schema directly\n * isn't crashed.\n */\nimport type { SchemaIntrospector } from './abstract-schema-factory'\n\nexport function walkPathSegments<Schema>(\n schema: Schema,\n segments: readonly string[],\n intro: SchemaIntrospector<Schema>,\n maxDepth: number,\n lazyDepth: number\n): Schema[] {\n if (segments.length === 0) return [schema]\n const [head, ...rest] = segments\n if (head === undefined) return [schema]\n const kind = intro.kindOf(schema)\n switch (kind) {\n case 'object': {\n const shape = intro.getObjectShape(schema)\n if (!Object.hasOwn(shape, head)) return []\n const next = shape[head]\n return next === undefined ? [] : walkPathSegments(next, rest, intro, maxDepth, lazyDepth)\n }\n case 'array': {\n const inner = intro.getArrayElement(schema)\n return inner === undefined ? [] : walkPathSegments(inner, rest, intro, maxDepth, lazyDepth)\n }\n case 'set': {\n // Sets aren't position-indexed; the head segment is a synthetic\n // indexer (`[...path, 0]`) used to query the element type. Descend\n // into the value schema and consume the segment.\n const inner = intro.getSetValueType(schema)\n return inner === undefined ? [] : walkPathSegments(inner, rest, intro, maxDepth, lazyDepth)\n }\n case 'record': {\n const inner = intro.getRecordValueType(schema)\n return inner === undefined ? [] : walkPathSegments(inner, rest, intro, maxDepth, lazyDepth)\n }\n case 'tuple': {\n const index = Number(head)\n if (!Number.isInteger(index)) return []\n const items = intro.getTupleItems(schema)\n const item = items[index]\n return item === undefined ? [] : walkPathSegments(item, rest, intro, maxDepth, lazyDepth)\n }\n case 'union':\n return intro\n .getUnionOptions(schema)\n .flatMap((opt) => walkPathSegments(opt, segments, intro, maxDepth, lazyDepth))\n case 'discriminated-union': {\n const options = intro.getDiscriminatedOptions(schema)\n const matching = options.filter((opt) => Object.hasOwn(intro.getObjectShape(opt), head))\n const candidates = matching.length > 0 ? matching : options\n return candidates.flatMap((opt) =>\n walkPathSegments(opt, segments, intro, maxDepth, lazyDepth)\n )\n }\n case 'optional':\n case 'nullable':\n case 'default':\n case 'readonly':\n case 'catch': {\n // `catch` peels like a wrapper — descend into the inner schema.\n // The catch fallback only matters at parse time, not path lookup.\n const inner = intro.unwrapInner(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'pipe': {\n // v4: `z.pipe(IN, OUT)` / `z.preprocess(fn, inner)` desugars to\n // pipe-with-transform-on-`in`. Both sides are sub-schemas; the\n // walker peeks at either, preferring `in`.\n const inner = intro.unwrapPipeIn(schema) ?? intro.unwrapPipeOut(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'pipeline': {\n // v3: `z.pipeline(...)` — peel to the input side.\n const inner = intro.unwrapPipeIn(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'effects': {\n // v3: `ZodEffects` (refine / transform / preprocess) — peel to\n // the structural source schema. Path resolution lands on the\n // inner shape regardless of effect type.\n const inner = intro.unwrapEffectsSource(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'branded': {\n // v3: `ZodBranded` — peel to the inner schema. Brands are\n // compile-time tags with no runtime structural impact.\n const inner = intro.unwrapBranded(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'lazy': {\n // Bump the lazy counter. Past the cap, return [] so callers fall\n // back to permissive behaviour at recursive paths beyond the cap.\n if (lazyDepth >= maxDepth) return []\n const inner = intro.unwrapLazy(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth + 1)\n }\n case 'intersection': {\n const left = intro.getIntersectionLeft(schema)\n const right = intro.getIntersectionRight(schema)\n const leftResults =\n left === undefined ? [] : walkPathSegments(left, segments, intro, maxDepth, lazyDepth)\n const rightResults =\n right === undefined ? [] : walkPathSegments(right, segments, intro, maxDepth, lazyDepth)\n return [...leftResults, ...rightResults]\n }\n // Leaves — can't descend further. The unsupported kinds (`map` /\n // `symbol` / `function` / `promise`) are rejected at adapter\n // construction by `assertSupportedKinds`; falling through to `[]`\n // keeps the walker defensive in case construction is skipped\n // (e.g. a downstream test instantiates a sub-schema directly).\n default:\n return []\n }\n}\n","/**\n * Plain-record deep merge for default-value derivation.\n *\n * Leaf semantics (anything not a plain `{}` record is a leaf):\n * - `undefined` override → no-op (base wins).\n * - `null` override → replaces base (a deliberate \"clear this field\"\n * signal that mustn't be merged into).\n * - Primitives / arrays / Date / Map / class instances → replace\n * wholesale (e.g. an array override doesn't concat).\n *\n * Recursion only when BOTH sides are plain records. The override-key\n * walk uses `Object.keys` (own enumerable) so a key with an explicit\n * `undefined` value lands here too — the consumer's choice to name the\n * path overrides the base's value, mirroring how an explicit `null`\n * would.\n *\n * Hosted in core so the v3 and v4 default-value walkers single-source\n * the intersection / constraint-merge step. Previously identical\n * `mergeDeep` / `mergeDeepV3` bodies lived per-adapter.\n */\nimport { isPlainRecord } from './path-walker'\nimport { safeAssign, safeOwnRead } from './safe-assign'\n\nexport function mergeDeep(base: unknown, override: unknown): unknown {\n if (override === undefined) return base\n if (!isPlainRecord(override)) return override\n if (!isPlainRecord(base)) return override\n\n // Object spread carries `base`'s own properties through the\n // spec's `CreateDataProperty` step, which bypasses the\n // `__proto__` setter — so a `base` carrying a literal\n // `__proto__` own property (e.g. from JSON-parsed adapter\n // defaults that round-tripped through storage) survives the\n // spread without reassigning the result's prototype. The\n // per-key reads route through `safeOwnRead` so a\n // `key === '__proto__'` doesn't resolve via the inherited\n // accessor on the regular target. The per-key `safeAssign` lands\n // an `override`'s `__proto__` entry as an own data property via\n // `Object.defineProperty`; every other key takes the plain\n // bracket-assign branch. Legitimate consumer-schema fields named\n // `prototype` / `constructor` / `__proto__` flow through default-\n // value derivation alongside every other key, and\n // `Object.prototype` stays untouched.\n const result: Record<string, unknown> = { ...base }\n for (const key of Object.keys(override)) {\n const oVal = safeOwnRead(override, key)\n const bVal = safeOwnRead(base, key)\n if (isPlainRecord(oVal) && isPlainRecord(bVal)) {\n safeAssign(result, key, mergeDeep(bVal, oVal))\n } else {\n safeAssign(result, key, oVal)\n }\n }\n return result\n}\n","/**\n * Shared default-value walker — derives the initial seed value the\n * runtime places at every leaf of a Zod schema tree.\n *\n * Both v3 and v4 adapters dispatch through this body via their\n * `SchemaIntrospector` instance plus a small `DeriveDefaultContext`\n * carrying per-adapter knobs (`unsupportedKindFallback`, `formKey`).\n * The per-version kind sets — v3's `branded` / `effects` / `pipeline`\n * / `native-enum`, v4's `pipe` / `file` — collapse to distinct cases\n * on the SharedZodKind switch.\n *\n * Semantics (preserved verbatim from the prior per-adapter\n * implementations — characterised by the `default-values`,\n * `get-default-at-path`, and `default-values-parity` test suites in\n * `test/adapters/zod-v{3,4}/`):\n *\n * - When `useDefault=true`, the walker FIRST peels transparent\n * wrappers (Optional / Nullable / Readonly / Catch-without-value /\n * Branded / Effects / Pipeline) looking for an embedded\n * `ZodDefault` — and returns its value if found. This mirrors v3's\n * prior `unwrapDefault` chain-peel and CLOSES a v3↔v4 parity gap:\n * on v4, `z.string().default('x').optional()` previously returned\n * `undefined` because the outer-kind switch hit `case 'optional'`\n * first; under the unified walker it returns `'x'`. ZodCatch\n * precedence is preserved: catch wraps default → catch wins (the\n * chain-peel returns the catch value at the outer Catch layer).\n *\n * - Schema-side input normalizers (`z.coerce.X()`,\n * `z.preprocess(fn, _)`) declare a write boundary the runtime\n * cannot honestly synthesise a default for. Both early-return\n * `undefined` so the consumer's `defaultValues` or a later\n * `setValue` owns what lands in storage.\n *\n * - Containers recurse into children; leaves return their kind's\n * canonical empty value (`'' / 0 / 0n / false / new Date(0) /\n * null / undefined / NaN / first enum or literal value /\n * [] / new Set() / {}`).\n *\n * - Unions / DUs use the first option as the seed.\n *\n * - Intersections merge both sides via the shared `mergeDeep`.\n *\n * - Lazy bumps a counter; past `maxDepth` returns `undefined` (the\n * recursive node falls back to consumer-supplied defaultValues).\n *\n * - Catch with `useDefault=true` returns the catch fallback; with\n * `useDefault=false` recurses the inner so the leaf's empty value\n * wins.\n *\n * - `void` / `any` / `unknown` / `never` / opaque kinds return\n * `undefined`.\n */\nimport type { SchemaIntrospector } from './abstract-schema-factory'\nimport { mergeDeep } from './merge-deep'\nimport { safeAssign } from './safe-assign'\n\nexport interface DeriveDefaultContext<Schema> {\n /**\n * Fallback for a kind the walker doesn't have a case for. Returning\n * `undefined` is the safe default; v3 wires a `console.warn` here\n * for visibility into custom-adapter consumers, v4 returns\n * `undefined` silently (its kind set is exhaustive against\n * `SchemaIntrospector.kindOf`).\n */\n unsupportedKindFallback(schema: Schema, kind: string): unknown\n /**\n * How `case 'catch'` resolves when `useDefault=false`. The two\n * adapters chose differently and pinned the choice with tests:\n *\n * - v3 wires `'preserveCatch'`: a `.catch(v)` wrapper always\n * surfaces its fallback `v`, regardless of `useDefault`. Rationale:\n * the catch is an emphatic consumer statement that should\n * resurface across submit failures, hydration, and history.\n * - v4 wires `'recurseInner'`: `useDefault=false` means \"show the\n * leaf empty\", and `.catch()` is a default-like wrapper that gets\n * skipped. The walker recurses into the inner so the leaf's\n * bare empty value (`'' / 0 / false / ...`) wins.\n *\n * On `useDefault=true` the chain-peel at the top of the walker\n * already finds and returns the catch fallback at either adapter,\n * so this knob only takes effect on `useDefault=false`.\n */\n catchOnUseDefaultFalse: 'preserveCatch' | 'recurseInner'\n}\n\n/**\n * Sentinel for the chain-peel-default helper. Distinct from\n * `undefined`, which IS a legal returned default value (e.g.\n * `z.string().default(undefined)`).\n */\nexport const NO_EMBEDDED_DEFAULT = Symbol('atta:no-embedded-default')\n\n/**\n * Peel transparent wrappers looking for an embedded `ZodDefault` (or\n * a `ZodCatch` with a fallback value, which takes precedence over a\n * nested default at the same depth). Returns the resolved value or\n * the sentinel `NO_EMBEDDED_DEFAULT` if none found.\n *\n * Mirrors v3's prior `unwrapDefault` loop and now applies on v4 too.\n * v4's kind set means `branded` / `effects` / `pipeline` peels\n * silently no-op (the introspector stubs return undefined).\n *\n * Bounded loop (32 iterations) matches the prior cap and acts as a\n * runaway guard for pathological wrapper stacks / self-referential\n * lazy loops resolved before their inner is constructed.\n *\n * Exported so the v3 strict-mode fix-up loop in `zod-v3/index.ts`\n * (the `runStrictGetDefaultsV3` validate-then-fix path) can reuse\n * it for the issue-driven default-resolution step.\n */\nexport function peelEmbeddedDefault<Schema>(\n schema: Schema,\n intro: SchemaIntrospector<Schema>\n): unknown {\n let current: Schema | undefined = schema\n for (let i = 0; i < 32; i++) {\n if (current === undefined) return NO_EMBEDDED_DEFAULT\n const k = intro.kindOf(current)\n if (k === 'default') return intro.getDefaultValue(current)\n if (k === 'catch') {\n if (intro.hasCatchValue(current)) return intro.getCatchDefault(current)\n current = intro.unwrapInner(current)\n continue\n }\n if (k === 'optional' || k === 'nullable' || k === 'readonly') {\n current = intro.unwrapInner(current)\n continue\n }\n if (k === 'branded') {\n current = intro.unwrapBranded(current)\n continue\n }\n if (k === 'effects') {\n current = intro.unwrapEffectsSource(current)\n continue\n }\n if (k === 'pipeline') {\n current = intro.unwrapPipeIn(current)\n continue\n }\n return NO_EMBEDDED_DEFAULT\n }\n return NO_EMBEDDED_DEFAULT\n}\n\n/**\n * Walk transparent wrappers looking for a `ZodDefault` in the chain.\n * Used by the preprocess branch to decide whether the inner has a\n * consumer-declared default the adapter should honor (recurse the\n * inner) or whether the slot is fully consumer-owned (`undefined`).\n *\n * Distinct from `peelEmbeddedDefault` in that the result is a\n * boolean — the caller decides what to do with it, not the value\n * itself.\n */\nfunction hasDeclaredDefaultInChain<Schema>(\n schema: Schema,\n intro: SchemaIntrospector<Schema>\n): boolean {\n let current: Schema | undefined = schema\n for (let i = 0; i < 32; i++) {\n if (current === undefined) return false\n const k = intro.kindOf(current)\n if (k === 'default') return true\n if (k === 'optional' || k === 'nullable' || k === 'readonly' || k === 'catch') {\n current = intro.unwrapInner(current)\n continue\n }\n return false\n }\n return false\n}\n\nexport function deriveDefaultWalk<Schema>(\n schema: Schema,\n useDefault: boolean,\n intro: SchemaIntrospector<Schema>,\n maxDepth: number,\n ctx: DeriveDefaultContext<Schema>,\n lazyDepth = 0\n): unknown {\n // Pre-check the wrapper chain for an embedded ZodDefault / ZodCatch\n // fallback. Returning it here is what makes\n // `z.string().default('x').optional()` resolve to 'x' rather than\n // undefined. Closes the v3↔v4 parity gap (v4 previously stopped at\n // the outer Optional and returned undefined).\n if (useDefault) {\n const peeled = peelEmbeddedDefault(schema, intro)\n if (peeled !== NO_EMBEDDED_DEFAULT) return peeled\n }\n\n // `z.coerce.X()` flags the wrapped primitive's def with `coerce:\n // true`; the consumer's pre-conversion input shape is unknown so\n // synthesising the primitive's slim concrete (`''` / `0` / etc.)\n // would claim a value the consumer never supplied. Leave the slot\n // `undefined` so `defaultValues` or a later `setValue` owns what\n // lands in storage. A consumer-declared `.default(x)` on the coerce\n // primitive was already honored by the chain-peel above.\n if (intro.isCoercePrimitive(schema)) return undefined\n\n const kind = intro.kindOf(schema)\n switch (kind) {\n case 'object': {\n const shape = intro.getObjectShape(schema)\n // Default container carries `Object.prototype`. The default\n // flows directly into `form.values`; matching the rest of the\n // value-write pipeline keeps the initial tree consistent with\n // what `setAtPath` and `mergeDeep` produce. Schema field names\n // can legitimately include `__proto__` (an architecture firm\n // tracking prototypes; a Zod schema with `z.object({ __proto__: … })`);\n // `safeAssign` lands such a key as an own data property.\n const out: Record<string, unknown> = {}\n for (const [key, subSchema] of Object.entries(shape)) {\n safeAssign(\n out,\n key,\n deriveDefaultWalk(subSchema, useDefault, intro, maxDepth, ctx, lazyDepth)\n )\n }\n return out\n }\n case 'array':\n return []\n case 'set':\n return new Set()\n case 'record':\n return {}\n case 'tuple': {\n const items = intro.getTupleItems(schema)\n return items.map((item) =>\n deriveDefaultWalk(item, useDefault, intro, maxDepth, ctx, lazyDepth)\n )\n }\n case 'union': {\n const options = intro.getUnionOptions(schema)\n const first = options[0]\n return first === undefined\n ? undefined\n : deriveDefaultWalk(first, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'discriminated-union': {\n const options = intro.getDiscriminatedOptions(schema)\n const first = options[0]\n return first === undefined\n ? undefined\n : deriveDefaultWalk(first, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'optional':\n return undefined\n case 'nullable':\n return null\n case 'default': {\n // `useDefault=false` path: the chain-peel above is suppressed,\n // so a direct ZodDefault still lands here — recurse the inner\n // to produce the leaf's bare empty value (the explicit default\n // is the consumer's \"starting state\" intent, not the leaf's\n // type-honest blank).\n if (useDefault) return intro.getDefaultValue(schema)\n const inner = intro.unwrapInner(schema)\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'readonly':\n case 'branded': {\n // Readonly: v3 + v4 transparent wrapper.\n // Branded: v3-only — `_def.type` carrier.\n const inner = kind === 'branded' ? intro.unwrapBranded(schema) : intro.unwrapInner(schema)\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'effects': {\n // v3-only. `ZodEffects` wraps refine / transform / preprocess.\n // For `preprocess`: the input side is the user-supplied fn, so\n // the slot has no canonical empty value the adapter can honestly\n // synthesise. If the inner declares a default, recurse (the\n // chain-peel finds it for useDefault=true; under useDefault=false\n // we recurse to the leaf's empty). Otherwise return undefined so\n // `defaultValues` or a later setValue owns the slot.\n // For `refinement` / `transform`: recurse the structural source.\n const inner = intro.unwrapEffectsSource(schema)\n if (intro.isPreprocessNode(schema)) {\n if (inner !== undefined && hasDeclaredDefaultInChain(inner, intro)) {\n return deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n return undefined\n }\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'pipeline': {\n // v3-only. The pre-transform default is the input schema's\n // natural default.\n const inner = intro.unwrapPipeIn(schema)\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'pipe': {\n // v4-only. Two sub-cases mirroring v3's preprocess branch:\n //\n // - `z.preprocess(fn, inner)` — `in` is a ZodTransform. The\n // input shape is unknown until the consumer writes. If the\n // inner carries a declared default, recurse; otherwise\n // return undefined.\n // - `.transform(fn)` (transform on output) / generic / codec\n // pipes — the input side IS the source schema; peel to it.\n const inn = intro.unwrapPipeIn(schema)\n if (inn !== undefined && intro.kindOf(inn) === 'transform') {\n const out = intro.unwrapPipeOut(schema)\n if (out !== undefined && hasDeclaredDefaultInChain(out, intro)) {\n return deriveDefaultWalk(out, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n return undefined\n }\n const out = intro.unwrapPipeOut(schema)\n const real =\n inn !== undefined && intro.kindOf(inn) !== 'transform'\n ? inn\n : out !== undefined && intro.kindOf(out) !== 'transform'\n ? out\n : (inn ?? out)\n return real === undefined\n ? undefined\n : deriveDefaultWalk(real, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'string':\n return ''\n case 'number':\n return 0\n case 'bigint':\n // z.bigint() strictly rejects numbers; the default must be a\n // bigint literal. Using `0` here would fail the schema's own\n // validation during default-values derivation.\n return 0n\n case 'boolean':\n return false\n case 'date':\n return new Date(0)\n case 'null':\n return null\n case 'undefined':\n return undefined\n case 'enum': {\n const values = intro.getEnumValues(schema)\n return values[0]\n }\n case 'native-enum': {\n // v3-only. Numeric enums get reverse-mapped\n // (`enum E { A }` → `{ A: 0, '0': 'A' }`); the valid runtime\n // members are the keys whose VALUE'S key isn't itself a number.\n // String enums have no reverse mapping, so every key is valid.\n // Pick the first valid value.\n const values = intro.getNativeEnumValues(schema)\n if (values === undefined) return undefined\n const validKeys = Object.keys(values).filter(\n (k) => typeof values[values[k] as string] !== 'number'\n )\n if (validKeys.length === 0) return undefined\n const first = validKeys[0]\n return first === undefined ? undefined : values[first]\n }\n case 'literal': {\n const values = intro.getLiteralValues(schema)\n return values[0]\n }\n case 'nan':\n return NaN\n case 'lazy': {\n // Bump the lazy counter ONLY here — structural recursion doesn't\n // accumulate. Past the cap, return undefined so a recursive node\n // ends in a non-fatal blank; `defaultValues` (consumer-supplied)\n // is the authority for what the seed should be at the recursive\n // boundary anyway.\n if (lazyDepth >= maxDepth) return undefined\n let inner: Schema | undefined\n try {\n inner = intro.unwrapLazy(schema)\n } catch {\n return undefined\n }\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth + 1)\n }\n case 'intersection': {\n const left = intro.getIntersectionLeft(schema)\n const right = intro.getIntersectionRight(schema)\n const l =\n left === undefined\n ? undefined\n : deriveDefaultWalk(left, useDefault, intro, maxDepth, ctx, lazyDepth)\n const r =\n right === undefined\n ? undefined\n : deriveDefaultWalk(right, useDefault, intro, maxDepth, ctx, lazyDepth)\n // `mergeDeep` prefers `right` where both sides carry a plain-\n // record value at a key, and returns `right` wholesale when\n // either side is a leaf. Matches parse-time semantics: an\n // intersection of `{ a }` and `{ b }` must satisfy both, so the\n // merged shape carries both keys' defaults.\n return mergeDeep(l, r)\n }\n case 'catch': {\n // `useDefault=true` was already caught by `peelEmbeddedDefault`\n // at the top of the walker; reaching this branch implies\n // `useDefault=false`. The two adapters chose different\n // semantics here and pinned the choice with tests (see the\n // `catchOnUseDefaultFalse` docblock on `DeriveDefaultContext`).\n if (useDefault) return intro.getCatchDefault(schema)\n if (ctx.catchOnUseDefaultFalse === 'preserveCatch' && intro.hasCatchValue(schema)) {\n return intro.getCatchDefault(schema)\n }\n const inner = intro.unwrapInner(schema)\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'file':\n // `z.file()` has no canonical \"empty file\" — the user picks one\n // through the directive's change handler. `null` is the storage\n // blank value the directive canonicalises to on register / clear;\n // emitting `null` here keeps `getEmptyValueAtPath` aligned with\n // what `form.clear(path)` writes.\n return null\n case 'any':\n case 'unknown':\n case 'void':\n case 'never':\n case 'promise':\n case 'custom':\n case 'template-literal':\n case 'transform':\n case 'map':\n case 'symbol':\n case 'function':\n // `promise` / `custom` / `template-literal` / `map` / `symbol` /\n // `function` are rejected by `assertSupportedKinds` at adapter\n // construction, so these branches are unreachable through the\n // public surface. `transform` is the input side of a\n // `z.preprocess(fn, inner)` and has no own default — callers\n // walk to `inner` via the surrounding pipe / effects. Kept for\n // exhaustive switch safety.\n return undefined\n default:\n return ctx.unsupportedKindFallback(schema, kind)\n }\n}\n","/**\n * Shared field-metadata storage. Both Zod adapters (v3 and v4) and the\n * unified `attaform/zod` entry read from the same `WeakMap`s so a\n * payload written via any entry's `withMeta` / `fieldMeta.add` is\n * visible to whichever adapter actually runs at lookup time.\n *\n * No `zod` runtime import — pure JavaScript primitives. The previous\n * v4 adapter built `fieldMeta` via `z.registry<FieldMetaPayload>()`,\n * which left a `z.registry` namespace reference reachable from\n * `attaform/zod`'s module graph; bundlers analysing a `zod@^3` consumer\n * resolved that against zod 3's exports map (no `registry` export) and\n * emitted an `IMPORT_IS_UNDEFINED` warning. Lifting storage here drops\n * that reference entirely so the unified entry behaves cleanly on any\n * Zod major.\n *\n * The native v4 chain `schema.register(fieldMeta, payload)` still\n * works against this shim — Zod 4's `.register()` only calls\n * `registry.add(this, payload)` and returns the schema; structural\n * matching is enough.\n *\n * Two parallel maps:\n * - `store` — last-write-wins single payload per schema reference.\n * Backs `fieldMeta.get(schema)` and the adapter's\n * `getFieldMetaAtPath` single-payload fallback.\n * - `lists` — every registration in order, per schema reference.\n * Backs the v4 adapter's path-walker disambiguation when the same\n * schema instance is bound at multiple form paths.\n */\n\nimport type { FieldMetaPayload } from './field-meta'\n\n/**\n * Minimal registry shape the shared store satisfies — `.add` / `.get`\n * / `.has` / `.remove`. Cast to `z.$ZodRegistry<FieldMetaPayload>` at\n * the v4 adapter's re-export so the native `schema.register(fieldMeta,\n * payload)` chain type-checks; the v3 adapter exports it as its own\n * registry-shaped surface.\n */\nexport type FieldMetaStore = {\n add(schema: object, payload: FieldMetaPayload): FieldMetaStore\n get(schema: object): FieldMetaPayload | undefined\n has(schema: object): boolean\n remove(schema: object): FieldMetaStore\n}\n\nconst store = new WeakMap<object, FieldMetaPayload>()\nconst lists = new WeakMap<object, FieldMetaPayload[]>()\n\nconst registry: FieldMetaStore = {\n add(schema, payload) {\n store.set(schema, payload)\n const list = lists.get(schema) ?? []\n list.push(payload)\n lists.set(schema, list)\n return registry\n },\n get(schema) {\n return store.get(schema)\n },\n has(schema) {\n return store.has(schema)\n },\n remove(schema) {\n store.delete(schema)\n lists.delete(schema)\n return registry\n },\n}\n\n/**\n * The shared registry every Attaform-aware Zod schema can register\n * field metadata against, regardless of Zod major. One module-scoped\n * instance — every adapter entry re-exports this same object so\n * writes from one entry are visible at lookup through any other.\n */\nexport const fieldMetaStore: FieldMetaStore = registry\n\n/**\n * Last-write-wins payload lookup for a schema reference. Returns\n * `undefined` if nothing has been registered.\n */\nexport function getFieldMetaForSchema(schema: object): FieldMetaPayload | undefined {\n return store.get(schema)\n}\n\n/**\n * Read every payload registered against `schema` in registration\n * order. Empty list when nothing has been registered. Used by the v4\n * adapter's path-resolver to disambiguate per occurrence when one\n * schema instance is bound at multiple form paths.\n */\nexport function getFieldMetaListForSchema(schema: object): readonly FieldMetaPayload[] {\n return lists.get(schema) ?? []\n}\n","/**\n * Shared slim-primitive walker — returns the set of\n * `SlimPrimitiveKind`s a schema accepts at write time. Wrappers\n * (Optional / Nullable / Default / Readonly / Catch / Pipe /\n * Pipeline / Effects / Branded / Lazy) are peeled; refinement-level\n * constraints (`.email()`, `.min(N)`, enum membership, literal\n * equality, regex) are ignored.\n *\n * Both v3 and v4 adapters dispatch through this body via their\n * `SchemaIntrospector` instance. Their per-version kind sets — v3's\n * `branded` / `effects` / `pipeline` / `native-enum`, v4's `pipe` /\n * `file` — collapse to distinct cases on the SharedZodKind switch;\n * each adapter's `kindOf` returns only the kinds it knows.\n *\n * Semantics (preserved verbatim from the prior per-adapter\n * implementations — characterised by `test/adapters/zod-v{3,4}/\n * slim-primitives.test.ts`):\n *\n * - Leaves (string / number / boolean / bigint / date / null /\n * undefined / void / nan) map to their kind singleton.\n * - Enum walks values, categorising each by typeof (string / number\n * members register their respective kinds). Empty enum falls back\n * to string.\n * - Literal walks values through the shared `slimKindOf` to map each\n * value to a kind. Multi-value literals (`z.literal(['a', 1])`)\n * register both.\n * - Object / record → object; array / tuple → array; set → set;\n * file → file + null (the directive's \"no file selected\"\n * sentinel — v4 only).\n * - Optional adds 'undefined' to the inner set; nullable adds 'null'.\n * - Default / readonly / catch / branded peel transparently.\n * - Pipe (v4) consults both `in` and `out`: if `in` is a transform,\n * use `out` (the structural side of a preprocess); else prefer\n * `in` (the source schema). Pipeline (v3) takes the `in` side.\n * - Effects (v3) peels to the structural source.\n * - Lazy bumps the depth counter; past the cap returns `permissive`\n * so recursive paths beyond the cap aren't false-rejected.\n * - Union / discriminated-union: union the option sets.\n * - Intersection: intersect both sides (must satisfy both at parse\n * time).\n * - Native-enum (v3) walks values, categorising by typeof.\n * - Never returns empty; any / unknown / unrecognised return\n * permissive.\n */\nimport type { SchemaIntrospector } from './abstract-schema-factory'\nimport { slimKindOf } from './slim-primitive-gate'\nimport type { SlimPrimitiveKind } from '../types/types-api'\n\n// The slim-primitive permissive set — kinds the gate accepts when the\n// walker can't characterise a schema. Identical between v3 and v4 by\n// design; hosted in core for single-source-of-truth.\nexport const PERMISSIVE_SLIM_KINDS: ReadonlySet<SlimPrimitiveKind> =\n /* @__PURE__ */ new Set<SlimPrimitiveKind>([\n 'string',\n 'number',\n 'boolean',\n 'bigint',\n 'date',\n 'null',\n 'undefined',\n 'object',\n 'array',\n 'symbol',\n 'function',\n 'map',\n 'set',\n 'file',\n ])\n\n// Module-level frozen singletons for the leaf branches. Returning a\n// shared instance instead of `new Set([…])` per call cuts a hot\n// allocation when slim-primitives is reached through wrappers and\n// collapses the inline literal Set constructions into shared\n// references for a small bundle-size win. The walker returns\n// `ReadonlySet`; callers that need to mutate (optional / nullable /\n// union branches, and the public boundary) clone first.\nconst KIND_STRING: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['string'])\nconst KIND_NUMBER: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['number'])\nconst KIND_BOOLEAN: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['boolean'])\nconst KIND_BIGINT: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['bigint'])\nconst KIND_DATE: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['date'])\nconst KIND_NULL: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['null'])\nconst KIND_UNDEFINED: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['undefined'])\nconst KIND_OBJECT: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['object'])\nconst KIND_ARRAY: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['array'])\nconst KIND_SET: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['set'])\nconst KIND_FILE: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['file', 'null'])\nconst EMPTY_KINDS: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set()\n\nexport function slimPrimitivesWalk<Schema>(\n schema: Schema,\n intro: SchemaIntrospector<Schema>,\n maxDepth: number,\n lazyDepth = 0\n): ReadonlySet<SlimPrimitiveKind> {\n const kind = intro.kindOf(schema)\n switch (kind) {\n case 'string':\n return KIND_STRING\n case 'number':\n case 'nan':\n return KIND_NUMBER\n case 'boolean':\n return KIND_BOOLEAN\n case 'bigint':\n return KIND_BIGINT\n case 'date':\n return KIND_DATE\n case 'file':\n // `z.file()` accepts `File` instances at write time. `null` is\n // also accepted at the slim-primitive level so the directive's\n // canonical blank value (the \"no file selected\" sentinel) lands\n // even on required-file schemas — the blank-path channel + the\n // derived \"No value supplied\" error already gates submission, so\n // permitting `null` storage here doesn't loosen schema enforcement.\n return KIND_FILE\n case 'null':\n return KIND_NULL\n case 'undefined':\n case 'void':\n return KIND_UNDEFINED\n case 'enum': {\n const values = intro.getEnumValues(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const v of values) {\n if (typeof v === 'string') out.add('string')\n else if (typeof v === 'number') out.add('number')\n }\n return out.size === 0 ? KIND_STRING : out\n }\n case 'native-enum': {\n // v3 only — `z.nativeEnum(E)` exposes the reverse-mapped TS enum\n // object on `_def.values`. Categorise each member by typeof.\n // Numeric enums also include reverse-mapped string keys whose\n // value is a number; both string and number kinds get registered.\n const values = intro.getNativeEnumValues(schema)\n if (values === undefined) return KIND_STRING\n const out = new Set<SlimPrimitiveKind>()\n for (const v of Object.values(values)) {\n if (typeof v === 'string') out.add('string')\n else if (typeof v === 'number') out.add('number')\n }\n return out.size === 0 ? KIND_STRING : out\n }\n case 'literal': {\n const values = intro.getLiteralValues(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const v of values) out.add(slimKindOf(v))\n return out.size === 0 ? PERMISSIVE_SLIM_KINDS : out\n }\n case 'object':\n case 'record':\n return KIND_OBJECT\n case 'array':\n case 'tuple':\n return KIND_ARRAY\n case 'set':\n return KIND_SET\n case 'optional': {\n const inner = intro.unwrapInner(schema)\n const innerSet =\n inner === undefined ? EMPTY_KINDS : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n const out = new Set<SlimPrimitiveKind>(innerSet)\n out.add('undefined')\n return out\n }\n case 'nullable': {\n const inner = intro.unwrapInner(schema)\n const innerSet =\n inner === undefined ? EMPTY_KINDS : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n const out = new Set<SlimPrimitiveKind>(innerSet)\n out.add('null')\n return out\n }\n case 'default':\n case 'readonly':\n case 'catch': {\n const inner = intro.unwrapInner(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'branded': {\n // v3-only. Brand wrappers carry their inner on `_def.type`.\n const inner = intro.unwrapBranded(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'effects': {\n // v3-only. ZodEffects wraps refines / transforms / preprocess;\n // for slim-primitive purposes the structural source is the\n // pre-transform shape (consumers write to that shape).\n const inner = intro.unwrapEffectsSource(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'pipeline': {\n // v3-only. Take the input side.\n const inner = intro.unwrapPipeIn(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'pipe': {\n // v4-only. `z.preprocess(fn, inner)` and `z.coerce.X()`\n // (pipe-with-transform-on-input) and `inner.transform(fn)`\n // (transform-on-output) all serialise as ZodPipe, but the\n // \"storage shape\" lives on opposite sides. For preprocess /\n // coerce, the input side IS the transform (shapeless,\n // PERMISSIVE) and the inner schema sits on the output. For\n // `.transform`, the input side is the source schema. Pick the\n // non-transform side so `isLeafAtPath` and the directive coerce\n // target both resolve against a real shape.\n const pipeIn = intro.unwrapPipeIn(schema)\n const pipeOut = intro.unwrapPipeOut(schema)\n const inner =\n pipeIn !== undefined && intro.kindOf(pipeIn) === 'transform' ? pipeOut : (pipeIn ?? pipeOut)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'lazy': {\n // Bump on lazy crossing only; past the cap, fall back to\n // permissive so recursive paths beyond the cap aren't gated.\n if (lazyDepth >= maxDepth) return PERMISSIVE_SLIM_KINDS\n const inner = intro.unwrapLazy(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth + 1)\n }\n case 'union':\n case 'discriminated-union': {\n // Both adapters store DU options on `def.options` too, so\n // `getUnionOptions` works for either kind.\n const options = intro.getUnionOptions(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const opt of options) {\n for (const k of slimPrimitivesWalk(opt, intro, maxDepth, lazyDepth)) out.add(k)\n }\n return out.size === 0 ? PERMISSIVE_SLIM_KINDS : out\n }\n case 'intersection': {\n const left = intro.getIntersectionLeft(schema)\n const right = intro.getIntersectionRight(schema)\n const leftSet =\n left === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(left, intro, maxDepth, lazyDepth)\n const rightSet =\n right === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(right, intro, maxDepth, lazyDepth)\n const out = new Set<SlimPrimitiveKind>()\n for (const k of leftSet) if (rightSet.has(k)) out.add(k)\n return out\n }\n case 'never':\n return EMPTY_KINDS\n case 'any':\n case 'unknown':\n return PERMISSIVE_SLIM_KINDS\n // Opaque / unsupported kinds: be permissive so legitimate writes\n // aren't false-rejected. The unsupported kinds (`map` / `symbol` /\n // `function` / `promise`) are rejected at adapter construction by\n // `assertSupportedKinds`; this fallthrough keeps the walker\n // defensive in case construction is skipped.\n default:\n return PERMISSIVE_SLIM_KINDS\n }\n}\n"],"names":["out"],"mappings":";;;AAkDA,MAAM,cAAA,GAAiB,GAAA;AAiXhB,SAAS,oBAAA,CACd,UAAA,EACA,KAAA,EACA,QAAA,EACA,SACA,OAAA,EACwC;AACxC,EAAA,MAAM,oBAAoB,OAAA,CAAQ,iBAAA;AAMlC,EAAA,MAAM,SAAA,uBAAgB,GAAA,EAAsB;AAC5C,EAAA,MAAM,uBAAA,uBAA8B,GAAA,EAAsB;AAC1D,EAAA,MAAM,kBAAA,uBAAyB,GAAA,EAA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EAAuB;AACvC,MAAA,KAAA,MAAW,OAAO,OAAA,EAAS;AACzB,QAAA,KAAA,MAAW,CAAA,IAAK,mBAAmB,GAAA,EAAK,KAAA,EAAO,UAAU,SAAS,CAAA,EAAG,GAAA,CAAI,GAAA,CAAI,CAAC,CAAA;AAAA,MAChF;AACA,MAAA,OAAO,GAAA,CAAI,IAAA,KAAS,CAAA,GAAI,qBAAA,GAAwB,GAAA;AAAA,IAClD;AAAA,IACA,KAAK,cAAA,EAAgB;AACnB,MAAA,MAAM,IAAA,GAAO,KAAA,CAAM,mBAAA,CAAoB,MAAM,CAAA;AAC7C,MAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,oBAAA,CAAqB,MAAM,CAAA;AAC/C,MAAA,MAAM,OAAA,GACJ,SAAS,MAAA,GACL,qBAAA,GACA,mBAAmB,IAAA,EAAM,KAAA,EAAO,UAAU,SAAS,CAAA;AACzD,MAAA,MAAM,QAAA,GACJ,UAAU,MAAA,GACN,qBAAA,GACA,mBAAmB,KAAA,EAAO,KAAA,EAAO,UAAU,SAAS,CAAA;AAC1D,MAAA,MAAM,GAAA,uBAAU,GAAA,EAAuB;AACvC,MAAA,KAAA,MAAW,CAAA,IAAK,SAAS,IAAI,QAAA,CAAS,IAAI,CAAC,CAAA,EAAG,GAAA,CAAI,GAAA,CAAI,CAAC,CAAA;AACvD,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,IACA,KAAK,OAAA;AACH,MAAA,OAAO,WAAA;AAAA,IACT,KAAK,KAAA;AAAA,IACL,KAAK,SAAA;AACH,MAAA,OAAO,qBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMT;AACE,MAAA,OAAO,qBAAA;AAAA;AAEb;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"attaform.B_hph5AE.cjs","sources":["../../src/runtime/core/abstract-schema-factory.ts","../../src/runtime/core/walk-path-segments.ts","../../src/runtime/core/merge-deep.ts","../../src/runtime/core/walk-derive-default.ts","../../src/runtime/core/field-meta-store.ts","../../src/runtime/core/walk-slim-primitives.ts"],"sourcesContent":["/**\n * `createAbstractSchema` — the schema-agnostic factory that hosts every\n * `AbstractSchema` method whose implementation is identical-modulo-\n * introspector between the v3 and v4 adapters.\n *\n * Each adapter wires through two small contracts:\n *\n * - `SchemaIntrospector<Schema>` — pure, side-effect-free accessors\n * that read schema shape. The factory branches on `kindOf`, walks\n * discriminated-union literals via `getLiteralValues` /\n * `getDiscriminatedOptions`, detects coerce / preprocess nodes,\n * and consults the three async / container-refine flags.\n *\n * - `AbstractSchemaServices<Schema, Form, GetValueFormType>` — the\n * adapter-specific delegates the factory calls for everything that\n * genuinely diverges per Zod version: fingerprinting, path-walking\n * (the path walker itself has v3 / v4 quirks), default-value\n * derivation, the strict-mode `getDefaultValues` flow,\n * wrapper-peeling that's tied to the per-version wrapper set,\n * field-meta resolution, and the per-version `safeParse`\n * boundary.\n *\n * The two-interface split keeps the introspector reusable by any other\n * walker (fingerprint, slim-primitives, default-values) without dragging\n * in the side-effectful services. Services consume the introspector as\n * they wish; the factory consumes both.\n *\n * Behavior-neutral by design: the goal is one set of definitions for\n * the 13 structurally-parallel methods, with no observable change at\n * either adapter's `AbstractSchema` surface. Per-adapter caches keep\n * the same lifetime (one per `useForm()` call); `getSchemasAtPath`\n * preserves each adapter's prior sub-schema shape via the\n * `makeSubSchema` service (v3 recurses; v4 builds the 5-method stub).\n */\nimport type {\n AbstractSchema,\n DefaultValuesResponse,\n FormKey,\n GetDefaultValuesConfig,\n ResolvedFieldMeta,\n SlimPrimitiveKind,\n UnionDiscriminatorContext,\n ValidationError,\n ValidationResponse,\n ValidateOptions,\n} from '../types/types-api'\nimport type { SchemaFactoryOptions } from './get-computed-schema'\nimport { AttaformErrorCode } from './error-codes'\nimport { canonicalizePath, type Path, type PathKey } from './paths'\n\nconst PATH_SEPARATOR = '.'\n\n/**\n * Stable shape-discriminant the factory branches on. Adapters return\n * the union of v3 + v4 kinds plus `'unknown'` for anything they don't\n * recognise — the factory only inspects a small subset\n * (`'tuple'` / `'array'` for `arrayShapeAtPath`,\n * `'literal'` for the discriminated-union walk), so adapters can return\n * extra version-specific kinds (`'effects'` / `'pipeline'` / `'branded'`\n * / `'native-enum'` on v3) without confusing the factory.\n */\nexport type SharedZodKind =\n | 'string'\n | 'number'\n | 'boolean'\n | 'bigint'\n | 'date'\n | 'null'\n | 'undefined'\n | 'literal'\n | 'enum'\n | 'native-enum'\n | 'object'\n | 'array'\n | 'tuple'\n | 'set'\n | 'record'\n | 'map'\n | 'union'\n | 'discriminated-union'\n | 'intersection'\n | 'optional'\n | 'nullable'\n | 'default'\n | 'catch'\n | 'readonly'\n | 'branded'\n | 'effects'\n | 'pipeline'\n | 'lazy'\n | 'pipe'\n | 'transform'\n | 'preprocess'\n | 'any'\n | 'unknown'\n | 'never'\n | 'nan'\n | 'void'\n | 'file'\n | 'function'\n | 'symbol'\n | 'promise'\n | 'custom'\n | 'template-literal'\n\n/**\n * Pure schema-shape accessors. The factory consults these to branch on\n * structural facts about a schema node. Every member is side-effect-\n * free and idempotent.\n *\n * `kindOf` returns the discriminant; the structural accessors\n * (`getObjectShape`, `getTupleItems`, `getDiscriminatedOptions`,\n * `getLiteralValues`) read a single field of the node's def shape.\n * The three boolean predicates summarise tree-walking detections each\n * adapter already exposes; both adapters memoise them at the\n * AbstractSchema level so calling per construction is cheap.\n */\nexport interface SchemaIntrospector<Schema> {\n /** Discriminant on schema shape. Adapters may return extra kinds. */\n kindOf(schema: Schema): SharedZodKind | string\n /**\n * Returns the property-to-sub-schema map of a `ZodObject`. Empty\n * record for non-objects.\n */\n getObjectShape(schema: Schema): Record<string, Schema>\n /** Returns the position-typed items of a `ZodTuple`. Empty for non-tuples. */\n getTupleItems(schema: Schema): readonly Schema[]\n /**\n * Returns the option objects of a `ZodDiscriminatedUnion` — each one\n * is itself a `ZodObject` whose `getObjectShape` includes the\n * discriminator key as a `ZodLiteral`.\n */\n getDiscriminatedOptions(schema: Schema): readonly Schema[]\n /** Returns the discriminator key of a `ZodDiscriminatedUnion`. */\n getDiscriminator(schema: Schema): string | undefined\n /**\n * Returns the literal values a `ZodLiteral` admits. Multi-value\n * literals (`z.literal(['a', 'b'])`) return both; single-value return\n * the one. Empty for non-literals.\n */\n getLiteralValues(schema: Schema): readonly unknown[]\n /**\n * True iff the node is a preprocess-style schema-side normalizer:\n * `z.preprocess(fn, inner)` in either version. v3's `ZodEffects`\n * with `effect.type === 'preprocess'` and v4's `ZodPipe<ZodTransform,\n * inner>` both collapse here. Coerce primitives go through\n * `isCoercePrimitive` instead — they're not pipes in v4 and not\n * effects in v3, but both adapters detect them off the same flag.\n */\n isPreprocessNode(schema: Schema): boolean\n /**\n * True iff the schema is a `z.coerce.X()` primitive. Both adapter\n * versions store the coerce intent as a flag on the wrapped\n * primitive's def (not as a wrapper), so detection is uniform.\n */\n isCoercePrimitive(schema: Schema): boolean\n /**\n * True iff the schema tree contains a refine whose predicate can run\n * asynchronously. v3 is conservative (every `.refine` flagged because\n * the inner sync wrapper hides the user fn); v4 is exact (inspects\n * `def.checks[].def.fn.constructor.name`). Either way the runtime\n * uses this to decide whether a construction-time async pass is\n * needed.\n */\n containsAsyncRefine(schema: Schema): boolean\n /**\n * True iff the schema tree contains a `.transform(asyncFn)` /\n * `z.preprocess(asyncFn, …)`. Statically detectable in both adapters\n * via the user fn's `constructor.name === 'AsyncFunction'`. Disjoint\n * from `containsAsyncRefine` — refines and transforms live in\n * different slots.\n */\n containsAsyncTransform(schema: Schema): boolean\n /**\n * True iff any refine fires at a container node (object / array /\n * tuple / union / discriminated-union / intersection / record / set)\n * or the root. False means every refine is leaf-local, so per-keystroke\n * subtree validation catches the same verdicts as a whole-form pass.\n */\n hasContainerOrRootRefine(schema: Schema): boolean\n\n // ---------------------------------------------------------------------\n // Walker accessors — consumed by the shared `core/walk-*` walkers (D2 /\n // D3 / D5) so the path-walking / slim-primitive / default-derivation\n // shapes don't fork per adapter. v3 / v4 each expose the full surface;\n // members not applicable to one adapter return `undefined` (kept on the\n // contract so the walkers don't branch on adapter identity).\n // ---------------------------------------------------------------------\n\n /** Element schema of a `z.array(...)`. Undefined for non-arrays / malformed defs. */\n getArrayElement(schema: Schema): Schema | undefined\n /** Element schema of a `z.set(...)`. Undefined for non-sets / malformed defs. */\n getSetValueType(schema: Schema): Schema | undefined\n /** Key schema of a `z.record(K, V)`. Undefined for non-records / single-arg records. */\n getRecordKeyType(schema: Schema): Schema | undefined\n /** Value schema of a `z.record(...)`. Undefined for non-records / malformed defs. */\n getRecordValueType(schema: Schema): Schema | undefined\n /** Option array of a `z.union(...)`. Empty for non-unions. */\n getUnionOptions(schema: Schema): readonly Schema[]\n /** Left side of a `z.intersection(L, R)`. Undefined for non-intersections. */\n getIntersectionLeft(schema: Schema): Schema | undefined\n /** Right side of a `z.intersection(L, R)`. Undefined for non-intersections. */\n getIntersectionRight(schema: Schema): Schema | undefined\n /** Values of a `z.enum(...)`. Empty for non-enums. */\n getEnumValues(schema: Schema): readonly (string | number)[]\n /**\n * Raw reverse-mapped values object of a `z.nativeEnum(E)`. v3 returns\n * the TS enum object directly; v4 always returns `undefined` because\n * v4 folds nativeEnum into the regular `enum` kind.\n */\n getNativeEnumValues(schema: Schema): Record<string, unknown> | undefined\n\n /**\n * Inner schema of any wrapper exposing `def.innerType` — Optional /\n * Nullable / Default / Readonly / Catch in both v3 and v4. Branded\n * (v3-only) uses `def.type` instead — see `unwrapBranded`. Returns\n * `undefined` when no inner is available.\n */\n unwrapInner(schema: Schema): Schema | undefined\n /**\n * v3-only: `ZodBranded`'s inner schema (`_def.type`). Returns\n * `undefined` on v4 (no branded wrapper) and on non-branded schemas.\n */\n unwrapBranded(schema: Schema): Schema | undefined\n /**\n * v3-only: structural source of a `ZodEffects` (refine / transform /\n * preprocess) — `_def.schema`. Returns `undefined` on v4 (no\n * ZodEffects wrapper; effects live as pipe sides / leaf checks).\n */\n unwrapEffectsSource(schema: Schema): Schema | undefined\n /** Input side of v4's `z.pipe(IN, OUT)` (also v3's `z.pipeline(...)`). */\n unwrapPipeIn(schema: Schema): Schema | undefined\n /** Output side of a pipe — undefined on v3's `ZodEffects`. */\n unwrapPipeOut(schema: Schema): Schema | undefined\n /**\n * Inner schema of a `z.lazy(() => inner)`. Each call invokes the\n * getter fresh; if the getter throws (recursive cycle resolved before\n * its target is constructed) returns `undefined`.\n */\n unwrapLazy(schema: Schema): Schema | undefined\n /**\n * Getter function reference of a `z.lazy()` wrapper — used by walkers\n * that track cycle identity by the getter rather than its result\n * (each call returns a distinct schema instance).\n */\n getLazyGetter(schema: Schema): (() => unknown) | undefined\n\n /**\n * Resolve a `z.default(...)` wrapper to its declared default value.\n * v3 stores the default as a thunk (`() => value`); v4 stores it as\n * a getter that returns the value directly. Both adapters return the\n * resolved value here.\n */\n getDefaultValue(schema: Schema): unknown\n /**\n * Resolve a `z.catch(inner, val)` wrapper to its fallback value.\n * The catch slot stores a `(ctx) => value` function; both adapters\n * invoke it with a placeholder context and surface `undefined` if\n * the consumer's function throws.\n */\n getCatchDefault(schema: Schema): unknown\n /**\n * True iff the schema carries a callable `z.catch(...)` fallback.\n * Lets callers distinguish \"no catch wrapper\" from \"catch wrapper\n * whose value happens to be `undefined`.\"\n */\n hasCatchValue(schema: Schema): boolean\n}\n\n/**\n * Adapter-specific delegates the factory calls for operations that\n * genuinely differ per Zod version (path walking, default-value\n * derivation, wrapper-peeling, error normalization, sub-schema\n * construction). Each service is a thin wrapper around per-adapter\n * helpers; the factory composes them.\n *\n * `safeParseSync` / `safeParseAsync` abstract the per-version\n * `safeParse` / `safeParseAsync` calls so the factory can stay\n * version-agnostic. Both return a uniform success-discriminant shape;\n * `safeParseSync` is allowed to throw when the schema is async-only\n * (the factory catches and falls back to the async path).\n *\n * `makeSubSchema` is the per-adapter sub-schema constructor for\n * `getSchemasAtPath`. v3 recurses through the full adapter factory\n * (sub-schemas expose the entire `AbstractSchema` surface). v4 builds\n * a 5-method stub (fingerprint / needsAsyncValidation /\n * getDefaultValues / getSchemasAtPath / validateAtPath) because none\n * of its consumers reach for the wider surface and the stub keeps\n * sub-walker allocation cheap. The factory preserves each adapter's\n * prior behavior by routing through this service rather than hard-\n * coding one strategy.\n */\nexport interface AbstractSchemaServices<Schema, Form, GetValueFormType> {\n /** Returns the deterministic structural fingerprint of the schema. */\n fingerprint(schema: Schema): string\n /**\n * Returns every sub-schema reachable at the given path. Multiple\n * results indicate a union / discriminated-union split; empty\n * indicates the path doesn't resolve. Adapters cap descent through\n * `z.lazy(...)` via `maxRecursionDepth`.\n */\n getNestedSchemasAtPath(schema: Schema, path: Path, maxRecursionDepth: number): Schema[]\n /**\n * \"Slim-mode\" path walk — the variant `getSlimPrimitiveTypesAtPath`\n * and `getSchemasAtPath` consume. v3 strips refinements / defaults /\n * optional / nullable / effects off the root before walking, so the\n * yielded candidates reflect the slim shape (matches what the slim-\n * primitive gate sees and what consumers expect when introspecting\n * sub-schemas). v4 walks the original schema and aliases this to\n * `getNestedSchemasAtPath` — its path walker already inlines the\n * wrapper peeling.\n */\n getNestedSchemasInSlimMode(schema: Schema, path: Path, maxRecursionDepth: number): Schema[]\n /** Returns the slim-primitive accept-set of a single sub-schema. */\n slimPrimitivesOf(schema: Schema, maxRecursionDepth: number): Set<SlimPrimitiveKind>\n /**\n * Returns the schema's prescribed default at the given root. The\n * runtime calls this in `getDefaultAtPath` (`useDefault=true` — honor\n * `.default(x)`) and `getEmptyValueAtPath` (`useDefault=false` —\n * yield the inner-schema's falsy concrete). v3 and v4 each implement\n * their own walker; the factory only consumes the result.\n */\n deriveDefault(\n schema: Schema,\n useDefault: boolean,\n maxRecursionDepth: number,\n formKey: FormKey\n ): unknown\n /**\n * Adapter-owned construction-time default-values flow. v3 runs a\n * validate-then-fix loop against a slim schema with strict-mode\n * refine seeding; v4 runs a strict-pass-or-lax-success against the\n * derived data. Both honour `config.strict ?? true` and\n * `config.constraints`.\n */\n runStrictGetDefaults(\n schema: Schema,\n config: GetDefaultValuesConfig<Form>,\n formKey: FormKey,\n maxRecursionDepth: number\n ): DefaultValuesResponse<Form>\n /**\n * Peels `.optional()` / `.nullable()` only when the inner is\n * structurally fillable (object / array / tuple / record /\n * union / intersection or a chain of peelable wrappers that resolve\n * to one of those). Used by `getDefaultAtPath` so partial writes\n * through optional sub-schemas fill from the inner shape's defaults.\n * `.default(x)` is preserved at every layer.\n */\n unwrapStructuralWrappers(schema: Schema): Schema\n /**\n * Peels every transparent wrapper (optional / nullable / default /\n * readonly / catch / pipe / lazy / branded / effects) and descends\n * intersection sides looking for a single discriminated union.\n * Returns the matching DU or `undefined` when no DU is found or\n * when ambiguity bails (two different DUs both reachable).\n */\n unwrapToDiscriminatedUnion(schema: Schema): Schema | undefined\n /**\n * Peels every transparent wrapper off a schema — for `arrayShapeAtPath`\n * the goal is the structural kind regardless of default-value\n * semantics, so `.default(x)` / `.catch(x)` are peeled here whereas\n * `unwrapStructuralWrappers` preserves them.\n */\n peelAllWrappers(schema: Schema): Schema\n /**\n * Returns `true` iff the leaf schema is \"required\" at the\n * union-aware sense documented on `AbstractSchema.isRequiredAtPath`:\n * `.optional()` / `.nullable()` / `.default()` / `.catch()` at any\n * wrapper layer make the leaf permissive; union requires every\n * branch; intersection requires either side.\n */\n isLeafRequired(schema: Schema): boolean\n /** Returns the resolved field-meta payload for the schema at `path`. */\n resolveFieldMetaAtPath(schema: Schema, path: Path, maxRecursionDepth: number): ResolvedFieldMeta\n /**\n * Normalise schema-library issues into the runtime's\n * `ValidationError[]` shape. v3 and v4 have slightly different\n * `ZodIssue` payloads; each adapter knows how to map its own.\n */\n issuesToValidationErrors(issues: readonly unknown[], formKey: FormKey): ValidationError[]\n /**\n * Run a sync `safeParse` against the schema. Returns a tagged result\n * the factory aggregates into a `ValidationResponse`. MAY throw when\n * the schema contains async-only refines / transforms (the factory\n * catches and falls back to the async path).\n */\n safeParseSync(\n schema: Schema,\n data: unknown\n ): { success: true; data: unknown } | { success: false; issues: readonly unknown[] }\n /** Async sister of `safeParseSync`. MUST NOT throw (catch user-fn rejections). */\n safeParseAsync(\n schema: Schema,\n data: unknown\n ): Promise<{ success: true; data: unknown } | { success: false; issues: readonly unknown[] }>\n /**\n * Per-adapter sub-schema constructor for `getSchemasAtPath`. v3\n * recurses through the full factory (sub-schemas carry the entire\n * `AbstractSchema` surface). v4 returns a 5-method stub. The factory\n * delegates here to preserve each adapter's prior shape; consumers\n * across the runtime only reach for `needsAsyncValidation()` on\n * sub-schemas, so both shapes are observationally interchangeable.\n */\n makeSubSchema(\n schema: Schema,\n formKey: FormKey,\n maxRecursionDepth: number\n ): AbstractSchema<unknown, GetValueFormType>\n}\n\n/**\n * Build a runtime `AbstractSchema` for `rootSchema` by composing the\n * shared uniform-method implementations with the per-adapter introspector\n * + services. Each adapter calls this once per `useForm({ schema })` —\n * the returned object plus its three caches (`leafCache`,\n * `preprocessOrCoerceCache`, `discriminatorCache`) plus the two memoised\n * lazy flags live for the form's lifetime.\n */\nexport function createAbstractSchema<Schema, Form, GetValueFormType>(\n rootSchema: Schema,\n intro: SchemaIntrospector<Schema>,\n services: AbstractSchemaServices<Schema, Form, GetValueFormType>,\n formKey: FormKey,\n options: SchemaFactoryOptions\n): AbstractSchema<Form, GetValueFormType> {\n const maxRecursionDepth = options.maxRecursionDepth\n\n // Per-adapter caches. Lifetime = one `createAbstractSchema` call (one\n // per `useForm()`). These memoise the schema walks that the proxy\n // traps + reactive computeds hit on every read so the schema doesn't\n // get re-walked per keystroke / per field-state get.\n const leafCache = new Map<PathKey, boolean>()\n const preprocessOrCoerceCache = new Map<PathKey, boolean>()\n const discriminatorCache = new Map<PathKey, UnionDiscriminatorContext | undefined>()\n // Memoised one-shot tree walks. `needsAsyncValidation` is queried at\n // construction by the store (drives the construction-time async seed);\n // `hasContainerOrRootRefine` is queried per keystroke (drives the\n // subtree-vs-whole-form scope cut).\n let asyncValidationFlag: boolean | null = null\n let containerRefineFlag: boolean | null = null\n\n function computeDiscriminator(path: Path): UnionDiscriminatorContext | undefined {\n const candidates =\n path.length === 0\n ? [rootSchema]\n : services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n // `unwrapToDiscriminatedUnion` peels every transparent wrapper\n // (Optional / Nullable / Default / Readonly / Catch / Effects /\n // Pipeline / Branded) and descends Intersection sides looking for a\n // single discriminated union. Ambiguous resolutions (two distinct\n // DUs both reachable across candidates) bail — the runtime then\n // falls back to a plain write.\n let matchedUnion: Schema | undefined\n for (const candidate of candidates) {\n const du = services.unwrapToDiscriminatedUnion(candidate)\n if (du === undefined) continue\n if (matchedUnion !== undefined && matchedUnion !== du) return undefined\n matchedUnion = du\n }\n if (matchedUnion === undefined) return undefined\n const discKey = intro.getDiscriminator(matchedUnion)\n if (discKey === undefined) return undefined\n const unionOptions = intro.getDiscriminatedOptions(matchedUnion)\n const literalSet = new Set<unknown>()\n for (const opt of unionOptions) {\n const shape = intro.getObjectShape(opt)\n const litSchema = shape[discKey]\n if (litSchema === undefined) continue\n if (intro.kindOf(litSchema) !== 'literal') continue\n // Multi-value literals (`z.literal(['a','b'])`) register every\n // member as a selectable variant.\n for (const v of intro.getLiteralValues(litSchema)) literalSet.add(v)\n }\n return {\n discriminatorKey: discKey,\n getVariantDefault(value: unknown): unknown {\n for (const opt of unionOptions) {\n const shape = intro.getObjectShape(opt)\n const litSchema = shape[discKey]\n if (litSchema === undefined) continue\n if (intro.kindOf(litSchema) !== 'literal') continue\n const literalValues = intro.getLiteralValues(litSchema)\n if (literalValues.includes(value)) {\n return services.deriveDefault(opt, true, maxRecursionDepth, formKey)\n }\n }\n return undefined\n },\n isVariantSelected(value: unknown): boolean {\n return literalSet.has(value)\n },\n }\n }\n\n const abstractSchema: AbstractSchema<Form, GetValueFormType> = {\n fingerprint: () => services.fingerprint(rootSchema),\n\n needsAsyncValidation(): boolean {\n asyncValidationFlag ??=\n intro.containsAsyncRefine(rootSchema) || intro.containsAsyncTransform(rootSchema)\n return asyncValidationFlag\n },\n\n hasContainerOrRootRefine(): boolean {\n containerRefineFlag ??= intro.hasContainerOrRootRefine(rootSchema)\n return containerRefineFlag\n },\n\n getDefaultValues(config: GetDefaultValuesConfig<Form>): DefaultValuesResponse<Form> {\n return services.runStrictGetDefaults(rootSchema, config, formKey, maxRecursionDepth)\n },\n\n getDefaultAtPath(path) {\n // Empty path → root default. Reuses the same generator used at\n // form construction so refines / wrappers behave consistently.\n if (path.length === 0) {\n return services.deriveDefault(rootSchema, true, maxRecursionDepth, formKey)\n }\n const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (first === undefined) return undefined\n // STRUCTURAL default: peel `.optional()` / `.nullable()` so partial\n // object writes through optional sub-schemas (`{ profile:\n // z.object({...}).optional() }`) get the inner shape's defaults\n // filled in. `.default(x)` is preserved so deriveDefault returns\n // the explicit default. First candidate matches\n // `validateAtPath`'s first-success semantic.\n const peeled = services.unwrapStructuralWrappers(first)\n return services.deriveDefault(peeled, true, maxRecursionDepth, formKey)\n },\n\n getEmptyValueAtPath(path) {\n // `clear`'s underlying value lookup. Same path-resolution flow as\n // `getDefaultAtPath` but with `useDefault=false` so `.default(x)`\n // / `.catch(x)` wrappers are skipped — the walker yields the\n // inner-schema's empty concrete instead. Structural wrappers\n // (`.optional()` / `.nullable()`) are NOT peeled: clearing an\n // `.optional()` slot is legitimately `undefined`, clearing a\n // `.nullable()` slot is `null`.\n if (path.length === 0) {\n return services.deriveDefault(rootSchema, false, maxRecursionDepth, formKey)\n }\n const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (first === undefined) return undefined\n return services.deriveDefault(first, false, maxRecursionDepth, formKey)\n },\n\n arrayShapeAtPath(path) {\n if (path.length === 0) return undefined\n const [first] = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (first === undefined) return undefined\n const peeled = services.peelAllWrappers(first)\n const kind = intro.kindOf(peeled)\n if (kind === 'tuple') return intro.getTupleItems(peeled).length\n if (kind === 'array') return null\n return undefined\n },\n\n getSchemasAtPath(path) {\n // Slim-mode walk: v3 strips refinements / defaults / wrappers off\n // the root so the yielded sub-schemas reflect the slim shape (the\n // shape the slim-primitive gate consults). v4 aliases the slim\n // and unstripped walks to the same call. The factory uses one\n // hook for both `getSlimPrimitiveTypesAtPath` and\n // `getSchemasAtPath` — same v3 strip semantic, same v4 alias.\n const resolved = services.getNestedSchemasInSlimMode(rootSchema, path, maxRecursionDepth)\n // Empty list is a valid result for paths the schema doesn't\n // declare — callers (getValue / register / custom introspection)\n // treat `[]` as \"no sub-schema here\". No warning needed.\n if (resolved.length === 0) return []\n return resolved.map((sub) => services.makeSubSchema(sub, formKey, maxRecursionDepth))\n },\n\n getSlimPrimitiveTypesAtPath(path): Set<SlimPrimitiveKind> {\n // Empty path is the root form: always an object.\n if (path.length === 0) return new Set<SlimPrimitiveKind>(['object'])\n const resolved = services.getNestedSchemasInSlimMode(rootSchema, path, maxRecursionDepth)\n // Path doesn't resolve in the schema → no kinds accepted. The\n // gate's membership check rejects every kind against an empty\n // set, blocking writes to typo / unknown paths.\n if (resolved.length === 0) return new Set<SlimPrimitiveKind>()\n const out = new Set<SlimPrimitiveKind>()\n for (const candidate of resolved) {\n for (const k of services.slimPrimitivesOf(candidate, maxRecursionDepth)) {\n out.add(k)\n }\n }\n return out\n },\n\n isLeafAtPath(path): boolean {\n const cacheKey = canonicalizePath(path).key\n const cached = leafCache.get(cacheKey)\n if (cached !== undefined) return cached\n const prim = this.getSlimPrimitiveTypesAtPath(path)\n // Empty set → path doesn't exist in schema → descend permissively\n // (treat as container so schema-named reserved keys at depth 2+\n // don't shadow). Any container kind in the set → descend.\n // Otherwise every kind is a primitive → leaf.\n const isLeaf =\n prim.size > 0 &&\n !prim.has('object') &&\n !prim.has('array') &&\n !prim.has('map') &&\n !prim.has('set')\n leafCache.set(cacheKey, isLeaf)\n return isLeaf\n },\n\n isPreprocessOrCoerceLeaf(path): boolean {\n // Walks prefixes of `path` looking for either shape adapters\n // use for schema-side input normalizers (`z.preprocess(...)` or\n // `z.coerce.X()`). Returns true at such a node OR anywhere\n // underneath it; the slim-primitive gate uses this to accept\n // raw consumer writes verbatim throughout that subtree.\n const cacheKey = canonicalizePath(path).key\n const cached = preprocessOrCoerceCache.get(cacheKey)\n if (cached !== undefined) return cached\n let hit = false\n for (let i = 0; i <= path.length && !hit; i++) {\n const prefix = path.slice(0, i)\n const candidates: Schema[] =\n prefix.length === 0\n ? [rootSchema]\n : services.getNestedSchemasAtPath(rootSchema, prefix, maxRecursionDepth)\n for (const candidate of candidates) {\n if (intro.isCoercePrimitive(candidate) || intro.isPreprocessNode(candidate)) {\n hit = true\n break\n }\n }\n }\n preprocessOrCoerceCache.set(cacheKey, hit)\n return hit\n },\n\n isRequiredAtPath(path): boolean {\n // Root form is structurally required (it's the parsed object).\n // The required-empty check tracks primitive leaves only, so this\n // branch is academic for the call sites that matter.\n if (path.length === 0) return true\n const resolved = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (resolved.length === 0) return false\n // Every candidate must be required for the path overall to be\n // required — matches the union \"any-branch-permissive\" rule\n // when the path traverses a union.\n return resolved.every((candidate) => services.isLeafRequired(candidate))\n },\n\n getFieldMetaAtPath(path): ResolvedFieldMeta {\n return services.resolveFieldMetaAtPath(rootSchema, path, maxRecursionDepth)\n },\n\n getUnionDiscriminatorAtPath(path): UnionDiscriminatorContext | undefined {\n const cacheKey = canonicalizePath(path).key\n if (discriminatorCache.has(cacheKey)) {\n return discriminatorCache.get(cacheKey)\n }\n const result = computeDiscriminator(path)\n discriminatorCache.set(cacheKey, result)\n return result\n },\n\n validateAtPath(\n data: unknown,\n path: Path | undefined,\n validateOptions?: ValidateOptions\n ): ReturnType<AbstractSchema<Form, GetValueFormType>['validateAtPath']> {\n // Sync attempt: when `options.sync === true`, try the sync parse.\n // It throws on async refines / pipes / transforms; we catch and\n // fall through to the async path. Without the flag the adapter\n // goes straight to async — the historical contract every non-\n // reshape callsite expects.\n const trySync = validateOptions?.sync === true\n if (trySync) {\n try {\n return runSync()\n } catch {\n // Async-only schema. Fall through to the async path.\n }\n }\n return runAsync()\n\n function runSync(): ValidationResponse<GetValueFormType> {\n if (path === undefined) {\n const result = services.safeParseSync(rootSchema, data)\n return result.success\n ? {\n data: result.data as GetValueFormType,\n errors: undefined,\n success: true,\n formKey,\n }\n : {\n data: undefined,\n errors: services.issuesToValidationErrors(result.issues, formKey),\n success: false,\n formKey,\n }\n }\n const resolved = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (resolved.length === 0) return pathNotFound(path)\n const aggregated: ValidationError[] = []\n for (const candidate of resolved) {\n const result = services.safeParseSync(candidate, data)\n if (result.success) {\n return {\n data: result.data as GetValueFormType,\n errors: undefined,\n success: true,\n formKey,\n }\n }\n aggregated.push(...services.issuesToValidationErrors(result.issues, formKey))\n }\n return { data: undefined, errors: aggregated, success: false, formKey }\n }\n\n async function runAsync(): Promise<ValidationResponse<GetValueFormType>> {\n if (path === undefined) {\n let result: Awaited<ReturnType<typeof services.safeParseAsync>>\n try {\n result = await services.safeParseAsync(rootSchema, data)\n } catch (err) {\n return validatorThrewResponse(err, [])\n }\n return result.success\n ? {\n data: result.data as GetValueFormType,\n errors: undefined,\n success: true,\n formKey,\n }\n : {\n data: undefined,\n errors: services.issuesToValidationErrors(result.issues, formKey),\n success: false,\n formKey,\n }\n }\n const resolved = services.getNestedSchemasAtPath(rootSchema, path, maxRecursionDepth)\n if (resolved.length === 0) return pathNotFound(path)\n // Sequential await — parallelising would run every branch's\n // async side effects on a value only one branch should see.\n const aggregated: ValidationError[] = []\n for (const candidate of resolved) {\n let result: Awaited<ReturnType<typeof services.safeParseAsync>>\n try {\n result = await services.safeParseAsync(candidate, data)\n } catch (err) {\n return validatorThrewResponse(err, path)\n }\n if (result.success) {\n return {\n data: result.data as GetValueFormType,\n errors: undefined,\n success: true,\n formKey,\n }\n }\n aggregated.push(...services.issuesToValidationErrors(result.issues, formKey))\n }\n return { data: undefined, errors: aggregated, success: false, formKey }\n }\n\n // User code inside `z.preprocess` / `.refine` / `.transform` can\n // throw (sync) or reject (async). Zod does NOT wrap these into\n // issues; they propagate out of `safeParse` / `safeParseAsync`.\n // Without this catch the throw bubbles through `validateAtPath`\n // into the runtime's submit / change-mode pipelines as either a\n // `submitError` (handleSubmit) or an unhandled rejection\n // (scheduleFieldValidation), and the consumer would never see a\n // path-scoped error message. Surface as a `ValidationError` at\n // the field path so the form's normal error pipeline handles it.\n function validatorThrewResponse(\n err: unknown,\n errPath: Path\n ): ValidationResponse<GetValueFormType> {\n const message =\n err instanceof Error ? err.message : typeof err === 'string' ? err : 'Validator threw'\n return {\n data: undefined,\n errors: [\n {\n message,\n path: [...errPath],\n formKey,\n code: AttaformErrorCode.ValidatorThrew,\n },\n ],\n success: false,\n formKey,\n }\n }\n\n function pathNotFound(p: Path): ValidationResponse<GetValueFormType> {\n return {\n data: undefined,\n errors: [\n {\n message: `Path '${p.join(PATH_SEPARATOR)}' did not resolve to any schema`,\n path: [...p],\n formKey,\n code: AttaformErrorCode.PathNotFound,\n },\n ],\n success: false,\n formKey,\n }\n }\n },\n }\n\n return abstractSchema\n}\n","/**\n * Shared path walker — descends a dotted segment array through a Zod\n * schema tree and returns the sub-schemas reachable at that path.\n *\n * One body, two adapters: v3 and v4 each invoke `walkPathSegments`\n * with their `SchemaIntrospector` instance. Wrapper / container kinds\n * (Optional / Nullable / Default / Readonly / Catch / Pipe / Pipeline /\n * Effects / Branded / Lazy / Intersection / Union / DiscriminatedUnion /\n * Object / Array / Set / Record / Tuple) all dispatch through the\n * introspector accessors, so the walker stays agnostic to per-version\n * `def.*` shape.\n *\n * Semantics (preserved verbatim from the prior per-adapter\n * implementations — characterised by `test/adapters/zod-v3/path-walker.test.ts`\n * and `test/adapters/zod-v4/path-walker.test.ts`):\n *\n * - Unions return multiple candidates (caller tries each).\n * - Discriminated unions filter options to those whose shape owns the\n * next segment (`Object.hasOwn`, NOT `in`, so `Object.prototype` keys\n * don't leak); fall back to every option when no shape matches\n * (the segment is the discriminator key itself).\n * - Object shape access uses `Object.hasOwn` for the same reason: a\n * bare `shape[head]` would resolve `'toString'` / `'valueOf'` etc.\n * to the inherited Function and treat it as a schema.\n * - Transparent wrappers (optional / nullable / default / readonly /\n * catch / pipe / pipeline / effects / branded) descend without\n * consuming a segment.\n * - `lazy` bumps the lazy counter; past the cap the walker returns\n * `[]` so writes at recursive paths deeper than `maxRecursionDepth`\n * fall back to a permissive type gate.\n * - Intersection unions both sides' resolutions — callers try each\n * candidate, matching parse-time semantics where a value must\n * satisfy both.\n * - Leaf kinds (string / number / boolean / literal / enum / etc.)\n * return `[]` when path remains, so a caller that asked for\n * `firstName.middle` against a string schema gets an empty\n * resolution rather than a wrong schema.\n * - Unsupported kinds (`map` / `symbol` / `function` / `promise`) are\n * rejected at adapter construction by `assertSupportedKinds`; the\n * walker's exhaustiveness on those kinds returns `[]` defensively\n * so a downstream caller that instantiates a sub-schema directly\n * isn't crashed.\n */\nimport type { SchemaIntrospector } from './abstract-schema-factory'\n\nexport function walkPathSegments<Schema>(\n schema: Schema,\n segments: readonly string[],\n intro: SchemaIntrospector<Schema>,\n maxDepth: number,\n lazyDepth: number\n): Schema[] {\n if (segments.length === 0) return [schema]\n const [head, ...rest] = segments\n if (head === undefined) return [schema]\n const kind = intro.kindOf(schema)\n switch (kind) {\n case 'object': {\n const shape = intro.getObjectShape(schema)\n if (!Object.hasOwn(shape, head)) return []\n const next = shape[head]\n return next === undefined ? [] : walkPathSegments(next, rest, intro, maxDepth, lazyDepth)\n }\n case 'array': {\n const inner = intro.getArrayElement(schema)\n return inner === undefined ? [] : walkPathSegments(inner, rest, intro, maxDepth, lazyDepth)\n }\n case 'set': {\n // Sets aren't position-indexed; the head segment is a synthetic\n // indexer (`[...path, 0]`) used to query the element type. Descend\n // into the value schema and consume the segment.\n const inner = intro.getSetValueType(schema)\n return inner === undefined ? [] : walkPathSegments(inner, rest, intro, maxDepth, lazyDepth)\n }\n case 'record': {\n const inner = intro.getRecordValueType(schema)\n return inner === undefined ? [] : walkPathSegments(inner, rest, intro, maxDepth, lazyDepth)\n }\n case 'tuple': {\n const index = Number(head)\n if (!Number.isInteger(index)) return []\n const items = intro.getTupleItems(schema)\n const item = items[index]\n return item === undefined ? [] : walkPathSegments(item, rest, intro, maxDepth, lazyDepth)\n }\n case 'union':\n return intro\n .getUnionOptions(schema)\n .flatMap((opt) => walkPathSegments(opt, segments, intro, maxDepth, lazyDepth))\n case 'discriminated-union': {\n const options = intro.getDiscriminatedOptions(schema)\n const matching = options.filter((opt) => Object.hasOwn(intro.getObjectShape(opt), head))\n const candidates = matching.length > 0 ? matching : options\n return candidates.flatMap((opt) =>\n walkPathSegments(opt, segments, intro, maxDepth, lazyDepth)\n )\n }\n case 'optional':\n case 'nullable':\n case 'default':\n case 'readonly':\n case 'catch': {\n // `catch` peels like a wrapper — descend into the inner schema.\n // The catch fallback only matters at parse time, not path lookup.\n const inner = intro.unwrapInner(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'pipe': {\n // v4: `z.pipe(IN, OUT)` / `z.preprocess(fn, inner)` desugars to\n // pipe-with-transform-on-`in`. Both sides are sub-schemas; the\n // walker peeks at either, preferring `in`.\n const inner = intro.unwrapPipeIn(schema) ?? intro.unwrapPipeOut(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'pipeline': {\n // v3: `z.pipeline(...)` — peel to the input side.\n const inner = intro.unwrapPipeIn(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'effects': {\n // v3: `ZodEffects` (refine / transform / preprocess) — peel to\n // the structural source schema. Path resolution lands on the\n // inner shape regardless of effect type.\n const inner = intro.unwrapEffectsSource(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'branded': {\n // v3: `ZodBranded` — peel to the inner schema. Brands are\n // compile-time tags with no runtime structural impact.\n const inner = intro.unwrapBranded(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth)\n }\n case 'lazy': {\n // Bump the lazy counter. Past the cap, return [] so callers fall\n // back to permissive behaviour at recursive paths beyond the cap.\n if (lazyDepth >= maxDepth) return []\n const inner = intro.unwrapLazy(schema)\n return inner === undefined\n ? []\n : walkPathSegments(inner, segments, intro, maxDepth, lazyDepth + 1)\n }\n case 'intersection': {\n const left = intro.getIntersectionLeft(schema)\n const right = intro.getIntersectionRight(schema)\n const leftResults =\n left === undefined ? [] : walkPathSegments(left, segments, intro, maxDepth, lazyDepth)\n const rightResults =\n right === undefined ? [] : walkPathSegments(right, segments, intro, maxDepth, lazyDepth)\n return [...leftResults, ...rightResults]\n }\n // Leaves — can't descend further. The unsupported kinds (`map` /\n // `symbol` / `function` / `promise`) are rejected at adapter\n // construction by `assertSupportedKinds`; falling through to `[]`\n // keeps the walker defensive in case construction is skipped\n // (e.g. a downstream test instantiates a sub-schema directly).\n default:\n return []\n }\n}\n","/**\n * Plain-record deep merge for default-value derivation.\n *\n * Leaf semantics (anything not a plain `{}` record is a leaf):\n * - `undefined` override → no-op (base wins).\n * - `null` override → replaces base (a deliberate \"clear this field\"\n * signal that mustn't be merged into).\n * - Primitives / arrays / Date / Map / class instances → replace\n * wholesale (e.g. an array override doesn't concat).\n *\n * Recursion only when BOTH sides are plain records. The override-key\n * walk uses `Object.keys` (own enumerable) so a key with an explicit\n * `undefined` value lands here too — the consumer's choice to name the\n * path overrides the base's value, mirroring how an explicit `null`\n * would.\n *\n * Hosted in core so the v3 and v4 default-value walkers single-source\n * the intersection / constraint-merge step. Previously identical\n * `mergeDeep` / `mergeDeepV3` bodies lived per-adapter.\n */\nimport { isPlainRecord } from './path-walker'\nimport { safeAssign, safeOwnRead } from './safe-assign'\n\nexport function mergeDeep(base: unknown, override: unknown): unknown {\n if (override === undefined) return base\n if (!isPlainRecord(override)) return override\n if (!isPlainRecord(base)) return override\n\n // Object spread carries `base`'s own properties through the\n // spec's `CreateDataProperty` step, which bypasses the\n // `__proto__` setter — so a `base` carrying a literal\n // `__proto__` own property (e.g. from JSON-parsed adapter\n // defaults that round-tripped through storage) survives the\n // spread without reassigning the result's prototype. The\n // per-key reads route through `safeOwnRead` so a\n // `key === '__proto__'` doesn't resolve via the inherited\n // accessor on the regular target. The per-key `safeAssign` lands\n // an `override`'s `__proto__` entry as an own data property via\n // `Object.defineProperty`; every other key takes the plain\n // bracket-assign branch. Legitimate consumer-schema fields named\n // `prototype` / `constructor` / `__proto__` flow through default-\n // value derivation alongside every other key, and\n // `Object.prototype` stays untouched.\n const result: Record<string, unknown> = { ...base }\n for (const key of Object.keys(override)) {\n const oVal = safeOwnRead(override, key)\n const bVal = safeOwnRead(base, key)\n if (isPlainRecord(oVal) && isPlainRecord(bVal)) {\n safeAssign(result, key, mergeDeep(bVal, oVal))\n } else {\n safeAssign(result, key, oVal)\n }\n }\n return result\n}\n","/**\n * Shared default-value walker — derives the initial seed value the\n * runtime places at every leaf of a Zod schema tree.\n *\n * Both v3 and v4 adapters dispatch through this body via their\n * `SchemaIntrospector` instance plus a small `DeriveDefaultContext`\n * carrying per-adapter knobs (`unsupportedKindFallback`, `formKey`).\n * The per-version kind sets — v3's `branded` / `effects` / `pipeline`\n * / `native-enum`, v4's `pipe` / `file` — collapse to distinct cases\n * on the SharedZodKind switch.\n *\n * Semantics (preserved verbatim from the prior per-adapter\n * implementations — characterised by the `default-values`,\n * `get-default-at-path`, and `default-values-parity` test suites in\n * `test/adapters/zod-v{3,4}/`):\n *\n * - When `useDefault=true`, the walker FIRST peels transparent\n * wrappers (Optional / Nullable / Readonly / Catch-without-value /\n * Branded / Effects / Pipeline) looking for an embedded\n * `ZodDefault` — and returns its value if found. This mirrors v3's\n * prior `unwrapDefault` chain-peel and CLOSES a v3↔v4 parity gap:\n * on v4, `z.string().default('x').optional()` previously returned\n * `undefined` because the outer-kind switch hit `case 'optional'`\n * first; under the unified walker it returns `'x'`. ZodCatch\n * precedence is preserved: catch wraps default → catch wins (the\n * chain-peel returns the catch value at the outer Catch layer).\n *\n * - Schema-side input normalizers (`z.coerce.X()`,\n * `z.preprocess(fn, _)`) declare a write boundary the runtime\n * cannot honestly synthesise a default for. Both early-return\n * `undefined` so the consumer's `defaultValues` or a later\n * `setValue` owns what lands in storage.\n *\n * - Containers recurse into children; leaves return their kind's\n * canonical empty value (`'' / 0 / 0n / false / new Date(0) /\n * null / undefined / NaN / first enum or literal value /\n * [] / new Set() / {}`).\n *\n * - Unions / DUs use the first option as the seed.\n *\n * - Intersections merge both sides via the shared `mergeDeep`.\n *\n * - Lazy bumps a counter; past `maxDepth` returns `undefined` (the\n * recursive node falls back to consumer-supplied defaultValues).\n *\n * - Catch with `useDefault=true` returns the catch fallback; with\n * `useDefault=false` recurses the inner so the leaf's empty value\n * wins.\n *\n * - `void` / `any` / `unknown` / `never` / opaque kinds return\n * `undefined`.\n */\nimport type { SchemaIntrospector } from './abstract-schema-factory'\nimport { mergeDeep } from './merge-deep'\nimport { safeAssign } from './safe-assign'\n\nexport interface DeriveDefaultContext<Schema> {\n /**\n * Fallback for a kind the walker doesn't have a case for. Returning\n * `undefined` is the safe default; v3 wires a `console.warn` here\n * for visibility into custom-adapter consumers, v4 returns\n * `undefined` silently (its kind set is exhaustive against\n * `SchemaIntrospector.kindOf`).\n */\n unsupportedKindFallback(schema: Schema, kind: string): unknown\n /**\n * How `case 'catch'` resolves when `useDefault=false`. The two\n * adapters chose differently and pinned the choice with tests:\n *\n * - v3 wires `'preserveCatch'`: a `.catch(v)` wrapper always\n * surfaces its fallback `v`, regardless of `useDefault`. Rationale:\n * the catch is an emphatic consumer statement that should\n * resurface across submit failures, hydration, and history.\n * - v4 wires `'recurseInner'`: `useDefault=false` means \"show the\n * leaf empty\", and `.catch()` is a default-like wrapper that gets\n * skipped. The walker recurses into the inner so the leaf's\n * bare empty value (`'' / 0 / false / ...`) wins.\n *\n * On `useDefault=true` the chain-peel at the top of the walker\n * already finds and returns the catch fallback at either adapter,\n * so this knob only takes effect on `useDefault=false`.\n */\n catchOnUseDefaultFalse: 'preserveCatch' | 'recurseInner'\n}\n\n/**\n * Sentinel for the chain-peel-default helper. Distinct from\n * `undefined`, which IS a legal returned default value (e.g.\n * `z.string().default(undefined)`).\n */\nexport const NO_EMBEDDED_DEFAULT = Symbol('atta:no-embedded-default')\n\n/**\n * Peel transparent wrappers looking for an embedded `ZodDefault` (or\n * a `ZodCatch` with a fallback value, which takes precedence over a\n * nested default at the same depth). Returns the resolved value or\n * the sentinel `NO_EMBEDDED_DEFAULT` if none found.\n *\n * Mirrors v3's prior `unwrapDefault` loop and now applies on v4 too.\n * v4's kind set means `branded` / `effects` / `pipeline` peels\n * silently no-op (the introspector stubs return undefined).\n *\n * Bounded loop (32 iterations) matches the prior cap and acts as a\n * runaway guard for pathological wrapper stacks / self-referential\n * lazy loops resolved before their inner is constructed.\n *\n * Exported so the v3 strict-mode fix-up loop in `zod-v3/index.ts`\n * (the `runStrictGetDefaultsV3` validate-then-fix path) can reuse\n * it for the issue-driven default-resolution step.\n */\nexport function peelEmbeddedDefault<Schema>(\n schema: Schema,\n intro: SchemaIntrospector<Schema>\n): unknown {\n let current: Schema | undefined = schema\n for (let i = 0; i < 32; i++) {\n if (current === undefined) return NO_EMBEDDED_DEFAULT\n const k = intro.kindOf(current)\n if (k === 'default') return intro.getDefaultValue(current)\n if (k === 'catch') {\n if (intro.hasCatchValue(current)) return intro.getCatchDefault(current)\n current = intro.unwrapInner(current)\n continue\n }\n if (k === 'optional' || k === 'nullable' || k === 'readonly') {\n current = intro.unwrapInner(current)\n continue\n }\n if (k === 'branded') {\n current = intro.unwrapBranded(current)\n continue\n }\n if (k === 'effects') {\n current = intro.unwrapEffectsSource(current)\n continue\n }\n if (k === 'pipeline') {\n current = intro.unwrapPipeIn(current)\n continue\n }\n return NO_EMBEDDED_DEFAULT\n }\n return NO_EMBEDDED_DEFAULT\n}\n\n/**\n * Walk transparent wrappers looking for a `ZodDefault` in the chain.\n * Used by the preprocess branch to decide whether the inner has a\n * consumer-declared default the adapter should honor (recurse the\n * inner) or whether the slot is fully consumer-owned (`undefined`).\n *\n * Distinct from `peelEmbeddedDefault` in that the result is a\n * boolean — the caller decides what to do with it, not the value\n * itself.\n */\nfunction hasDeclaredDefaultInChain<Schema>(\n schema: Schema,\n intro: SchemaIntrospector<Schema>\n): boolean {\n let current: Schema | undefined = schema\n for (let i = 0; i < 32; i++) {\n if (current === undefined) return false\n const k = intro.kindOf(current)\n if (k === 'default') return true\n if (k === 'optional' || k === 'nullable' || k === 'readonly' || k === 'catch') {\n current = intro.unwrapInner(current)\n continue\n }\n return false\n }\n return false\n}\n\nexport function deriveDefaultWalk<Schema>(\n schema: Schema,\n useDefault: boolean,\n intro: SchemaIntrospector<Schema>,\n maxDepth: number,\n ctx: DeriveDefaultContext<Schema>,\n lazyDepth = 0\n): unknown {\n // Pre-check the wrapper chain for an embedded ZodDefault / ZodCatch\n // fallback. Returning it here is what makes\n // `z.string().default('x').optional()` resolve to 'x' rather than\n // undefined. Closes the v3↔v4 parity gap (v4 previously stopped at\n // the outer Optional and returned undefined).\n if (useDefault) {\n const peeled = peelEmbeddedDefault(schema, intro)\n if (peeled !== NO_EMBEDDED_DEFAULT) return peeled\n }\n\n // `z.coerce.X()` flags the wrapped primitive's def with `coerce:\n // true`; the consumer's pre-conversion input shape is unknown so\n // synthesising the primitive's slim concrete (`''` / `0` / etc.)\n // would claim a value the consumer never supplied. Leave the slot\n // `undefined` so `defaultValues` or a later `setValue` owns what\n // lands in storage. A consumer-declared `.default(x)` on the coerce\n // primitive was already honored by the chain-peel above.\n if (intro.isCoercePrimitive(schema)) return undefined\n\n const kind = intro.kindOf(schema)\n switch (kind) {\n case 'object': {\n const shape = intro.getObjectShape(schema)\n // Default container carries `Object.prototype`. The default\n // flows directly into `form.values`; matching the rest of the\n // value-write pipeline keeps the initial tree consistent with\n // what `setAtPath` and `mergeDeep` produce. Schema field names\n // can legitimately include `__proto__` (an architecture firm\n // tracking prototypes; a Zod schema with `z.object({ __proto__: … })`);\n // `safeAssign` lands such a key as an own data property.\n const out: Record<string, unknown> = {}\n for (const [key, subSchema] of Object.entries(shape)) {\n safeAssign(\n out,\n key,\n deriveDefaultWalk(subSchema, useDefault, intro, maxDepth, ctx, lazyDepth)\n )\n }\n return out\n }\n case 'array':\n return []\n case 'set':\n return new Set()\n case 'record':\n return {}\n case 'tuple': {\n const items = intro.getTupleItems(schema)\n return items.map((item) =>\n deriveDefaultWalk(item, useDefault, intro, maxDepth, ctx, lazyDepth)\n )\n }\n case 'union': {\n const options = intro.getUnionOptions(schema)\n const first = options[0]\n return first === undefined\n ? undefined\n : deriveDefaultWalk(first, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'discriminated-union': {\n const options = intro.getDiscriminatedOptions(schema)\n const first = options[0]\n return first === undefined\n ? undefined\n : deriveDefaultWalk(first, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'optional':\n return undefined\n case 'nullable':\n return null\n case 'default': {\n // `useDefault=false` path: the chain-peel above is suppressed,\n // so a direct ZodDefault still lands here — recurse the inner\n // to produce the leaf's bare empty value (the explicit default\n // is the consumer's \"starting state\" intent, not the leaf's\n // type-honest blank).\n if (useDefault) return intro.getDefaultValue(schema)\n const inner = intro.unwrapInner(schema)\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'readonly':\n case 'branded': {\n // Readonly: v3 + v4 transparent wrapper.\n // Branded: v3-only — `_def.type` carrier.\n const inner = kind === 'branded' ? intro.unwrapBranded(schema) : intro.unwrapInner(schema)\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'effects': {\n // v3-only. `ZodEffects` wraps refine / transform / preprocess.\n // For `preprocess`: the input side is the user-supplied fn, so\n // the slot has no canonical empty value the adapter can honestly\n // synthesise. If the inner declares a default, recurse (the\n // chain-peel finds it for useDefault=true; under useDefault=false\n // we recurse to the leaf's empty). Otherwise return undefined so\n // `defaultValues` or a later setValue owns the slot.\n // For `refinement` / `transform`: recurse the structural source.\n const inner = intro.unwrapEffectsSource(schema)\n if (intro.isPreprocessNode(schema)) {\n if (inner !== undefined && hasDeclaredDefaultInChain(inner, intro)) {\n return deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n return undefined\n }\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'pipeline': {\n // v3-only. The pre-transform default is the input schema's\n // natural default.\n const inner = intro.unwrapPipeIn(schema)\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'pipe': {\n // v4-only. Two sub-cases mirroring v3's preprocess branch:\n //\n // - `z.preprocess(fn, inner)` — `in` is a ZodTransform. The\n // input shape is unknown until the consumer writes. If the\n // inner carries a declared default, recurse; otherwise\n // return undefined.\n // - `.transform(fn)` (transform on output) / generic / codec\n // pipes — the input side IS the source schema; peel to it.\n const inn = intro.unwrapPipeIn(schema)\n if (inn !== undefined && intro.kindOf(inn) === 'transform') {\n const out = intro.unwrapPipeOut(schema)\n if (out !== undefined && hasDeclaredDefaultInChain(out, intro)) {\n return deriveDefaultWalk(out, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n return undefined\n }\n const out = intro.unwrapPipeOut(schema)\n const real =\n inn !== undefined && intro.kindOf(inn) !== 'transform'\n ? inn\n : out !== undefined && intro.kindOf(out) !== 'transform'\n ? out\n : (inn ?? out)\n return real === undefined\n ? undefined\n : deriveDefaultWalk(real, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'string':\n return ''\n case 'number':\n return 0\n case 'bigint':\n // z.bigint() strictly rejects numbers; the default must be a\n // bigint literal. Using `0` here would fail the schema's own\n // validation during default-values derivation.\n return 0n\n case 'boolean':\n return false\n case 'date':\n return new Date(0)\n case 'null':\n return null\n case 'undefined':\n return undefined\n case 'enum': {\n const values = intro.getEnumValues(schema)\n return values[0]\n }\n case 'native-enum': {\n // v3-only. Numeric enums get reverse-mapped\n // (`enum E { A }` → `{ A: 0, '0': 'A' }`); the valid runtime\n // members are the keys whose VALUE'S key isn't itself a number.\n // String enums have no reverse mapping, so every key is valid.\n // Pick the first valid value.\n const values = intro.getNativeEnumValues(schema)\n if (values === undefined) return undefined\n const validKeys = Object.keys(values).filter(\n (k) => typeof values[values[k] as string] !== 'number'\n )\n if (validKeys.length === 0) return undefined\n const first = validKeys[0]\n return first === undefined ? undefined : values[first]\n }\n case 'literal': {\n const values = intro.getLiteralValues(schema)\n return values[0]\n }\n case 'nan':\n return NaN\n case 'lazy': {\n // Bump the lazy counter ONLY here — structural recursion doesn't\n // accumulate. Past the cap, return undefined so a recursive node\n // ends in a non-fatal blank; `defaultValues` (consumer-supplied)\n // is the authority for what the seed should be at the recursive\n // boundary anyway.\n if (lazyDepth >= maxDepth) return undefined\n let inner: Schema | undefined\n try {\n inner = intro.unwrapLazy(schema)\n } catch {\n return undefined\n }\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth + 1)\n }\n case 'intersection': {\n const left = intro.getIntersectionLeft(schema)\n const right = intro.getIntersectionRight(schema)\n const l =\n left === undefined\n ? undefined\n : deriveDefaultWalk(left, useDefault, intro, maxDepth, ctx, lazyDepth)\n const r =\n right === undefined\n ? undefined\n : deriveDefaultWalk(right, useDefault, intro, maxDepth, ctx, lazyDepth)\n // `mergeDeep` prefers `right` where both sides carry a plain-\n // record value at a key, and returns `right` wholesale when\n // either side is a leaf. Matches parse-time semantics: an\n // intersection of `{ a }` and `{ b }` must satisfy both, so the\n // merged shape carries both keys' defaults.\n return mergeDeep(l, r)\n }\n case 'catch': {\n // `useDefault=true` was already caught by `peelEmbeddedDefault`\n // at the top of the walker; reaching this branch implies\n // `useDefault=false`. The two adapters chose different\n // semantics here and pinned the choice with tests (see the\n // `catchOnUseDefaultFalse` docblock on `DeriveDefaultContext`).\n if (useDefault) return intro.getCatchDefault(schema)\n if (ctx.catchOnUseDefaultFalse === 'preserveCatch' && intro.hasCatchValue(schema)) {\n return intro.getCatchDefault(schema)\n }\n const inner = intro.unwrapInner(schema)\n return inner === undefined\n ? undefined\n : deriveDefaultWalk(inner, useDefault, intro, maxDepth, ctx, lazyDepth)\n }\n case 'file':\n // `z.file()` has no canonical \"empty file\" — the user picks one\n // through the directive's change handler. `null` is the storage\n // blank value the directive canonicalises to on register / clear;\n // emitting `null` here keeps `getEmptyValueAtPath` aligned with\n // what `form.clear(path)` writes.\n return null\n case 'any':\n case 'unknown':\n case 'void':\n case 'never':\n case 'promise':\n case 'custom':\n case 'template-literal':\n case 'transform':\n case 'map':\n case 'symbol':\n case 'function':\n // `promise` / `custom` / `template-literal` / `map` / `symbol` /\n // `function` are rejected by `assertSupportedKinds` at adapter\n // construction, so these branches are unreachable through the\n // public surface. `transform` is the input side of a\n // `z.preprocess(fn, inner)` and has no own default — callers\n // walk to `inner` via the surrounding pipe / effects. Kept for\n // exhaustive switch safety.\n return undefined\n default:\n return ctx.unsupportedKindFallback(schema, kind)\n }\n}\n","/**\n * Shared field-metadata storage. Both Zod adapters (v3 and v4) and the\n * unified `attaform/zod` entry read from the same `WeakMap`s so a\n * payload written via any entry's `withMeta` / `fieldMeta.add` is\n * visible to whichever adapter actually runs at lookup time.\n *\n * No `zod` runtime import — pure JavaScript primitives. The previous\n * v4 adapter built `fieldMeta` via `z.registry<FieldMetaPayload>()`,\n * which left a `z.registry` namespace reference reachable from\n * `attaform/zod`'s module graph; bundlers analysing a `zod@^3` consumer\n * resolved that against zod 3's exports map (no `registry` export) and\n * emitted an `IMPORT_IS_UNDEFINED` warning. Lifting storage here drops\n * that reference entirely so the unified entry behaves cleanly on any\n * Zod major.\n *\n * The native v4 chain `schema.register(fieldMeta, payload)` still\n * works against this shim — Zod 4's `.register()` only calls\n * `registry.add(this, payload)` and returns the schema; structural\n * matching is enough.\n *\n * Two parallel maps:\n * - `store` — last-write-wins single payload per schema reference.\n * Backs `fieldMeta.get(schema)` and the adapter's\n * `getFieldMetaAtPath` single-payload fallback.\n * - `lists` — every registration in order, per schema reference.\n * Backs the v4 adapter's path-walker disambiguation when the same\n * schema instance is bound at multiple form paths.\n */\n\nimport type { FieldMetaPayload } from './field-meta'\n\n/**\n * Minimal registry shape the shared store satisfies — `.add` / `.get`\n * / `.has` / `.remove`. Cast to `z.$ZodRegistry<FieldMetaPayload>` at\n * the v4 adapter's re-export so the native `schema.register(fieldMeta,\n * payload)` chain type-checks; the v3 adapter exports it as its own\n * registry-shaped surface.\n */\nexport type FieldMetaStore = {\n add(schema: object, payload: FieldMetaPayload): FieldMetaStore\n get(schema: object): FieldMetaPayload | undefined\n has(schema: object): boolean\n remove(schema: object): FieldMetaStore\n}\n\nconst store = new WeakMap<object, FieldMetaPayload>()\nconst lists = new WeakMap<object, FieldMetaPayload[]>()\n\nconst registry: FieldMetaStore = {\n add(schema, payload) {\n store.set(schema, payload)\n const list = lists.get(schema) ?? []\n list.push(payload)\n lists.set(schema, list)\n return registry\n },\n get(schema) {\n return store.get(schema)\n },\n has(schema) {\n return store.has(schema)\n },\n remove(schema) {\n store.delete(schema)\n lists.delete(schema)\n return registry\n },\n}\n\n/**\n * The shared registry every Attaform-aware Zod schema can register\n * field metadata against, regardless of Zod major. One module-scoped\n * instance — every adapter entry re-exports this same object so\n * writes from one entry are visible at lookup through any other.\n */\nexport const fieldMetaStore: FieldMetaStore = registry\n\n/**\n * Last-write-wins payload lookup for a schema reference. Returns\n * `undefined` if nothing has been registered.\n */\nexport function getFieldMetaForSchema(schema: object): FieldMetaPayload | undefined {\n return store.get(schema)\n}\n\n/**\n * Read every payload registered against `schema` in registration\n * order. Empty list when nothing has been registered. Used by the v4\n * adapter's path-resolver to disambiguate per occurrence when one\n * schema instance is bound at multiple form paths.\n */\nexport function getFieldMetaListForSchema(schema: object): readonly FieldMetaPayload[] {\n return lists.get(schema) ?? []\n}\n","/**\n * Shared slim-primitive walker — returns the set of\n * `SlimPrimitiveKind`s a schema accepts at write time. Wrappers\n * (Optional / Nullable / Default / Readonly / Catch / Pipe /\n * Pipeline / Effects / Branded / Lazy) are peeled; refinement-level\n * constraints (`.email()`, `.min(N)`, enum membership, literal\n * equality, regex) are ignored.\n *\n * Both v3 and v4 adapters dispatch through this body via their\n * `SchemaIntrospector` instance. Their per-version kind sets — v3's\n * `branded` / `effects` / `pipeline` / `native-enum`, v4's `pipe` /\n * `file` — collapse to distinct cases on the SharedZodKind switch;\n * each adapter's `kindOf` returns only the kinds it knows.\n *\n * Semantics (preserved verbatim from the prior per-adapter\n * implementations — characterised by `test/adapters/zod-v{3,4}/\n * slim-primitives.test.ts`):\n *\n * - Leaves (string / number / boolean / bigint / date / null /\n * undefined / void / nan) map to their kind singleton.\n * - Enum walks values, categorising each by typeof (string / number\n * members register their respective kinds). Empty enum falls back\n * to string.\n * - Literal walks values through the shared `slimKindOf` to map each\n * value to a kind. Multi-value literals (`z.literal(['a', 1])`)\n * register both.\n * - Object / record → object; array / tuple → array; set → set;\n * file → file + null (the directive's \"no file selected\"\n * sentinel — v4 only).\n * - Optional adds 'undefined' to the inner set; nullable adds 'null'.\n * - Default / readonly / catch / branded peel transparently.\n * - Pipe (v4) consults both `in` and `out`: if `in` is a transform,\n * use `out` (the structural side of a preprocess); else prefer\n * `in` (the source schema). Pipeline (v3) takes the `in` side.\n * - Effects (v3) peels to the structural source.\n * - Lazy bumps the depth counter; past the cap returns `permissive`\n * so recursive paths beyond the cap aren't false-rejected.\n * - Union / discriminated-union: union the option sets.\n * - Intersection: intersect both sides (must satisfy both at parse\n * time).\n * - Native-enum (v3) walks values, categorising by typeof.\n * - Never returns empty; any / unknown / unrecognised return\n * permissive.\n */\nimport type { SchemaIntrospector } from './abstract-schema-factory'\nimport { slimKindOf } from './slim-primitive-gate'\nimport type { SlimPrimitiveKind } from '../types/types-api'\n\n// The slim-primitive permissive set — kinds the gate accepts when the\n// walker can't characterise a schema. Identical between v3 and v4 by\n// design; hosted in core for single-source-of-truth.\nexport const PERMISSIVE_SLIM_KINDS: ReadonlySet<SlimPrimitiveKind> =\n /* @__PURE__ */ new Set<SlimPrimitiveKind>([\n 'string',\n 'number',\n 'boolean',\n 'bigint',\n 'date',\n 'null',\n 'undefined',\n 'object',\n 'array',\n 'symbol',\n 'function',\n 'map',\n 'set',\n 'file',\n ])\n\n// Module-level frozen singletons for the leaf branches. Returning a\n// shared instance instead of `new Set([…])` per call cuts a hot\n// allocation when slim-primitives is reached through wrappers and\n// collapses the inline literal Set constructions into shared\n// references for a small bundle-size win. The walker returns\n// `ReadonlySet`; callers that need to mutate (optional / nullable /\n// union branches, and the public boundary) clone first.\nconst KIND_STRING: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['string'])\nconst KIND_NUMBER: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['number'])\nconst KIND_BOOLEAN: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['boolean'])\nconst KIND_BIGINT: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['bigint'])\nconst KIND_DATE: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['date'])\nconst KIND_NULL: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['null'])\nconst KIND_UNDEFINED: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['undefined'])\nconst KIND_OBJECT: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['object'])\nconst KIND_ARRAY: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['array'])\nconst KIND_SET: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['set'])\nconst KIND_FILE: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set(['file', 'null'])\nconst EMPTY_KINDS: ReadonlySet<SlimPrimitiveKind> = /* @__PURE__ */ new Set()\n\nexport function slimPrimitivesWalk<Schema>(\n schema: Schema,\n intro: SchemaIntrospector<Schema>,\n maxDepth: number,\n lazyDepth = 0\n): ReadonlySet<SlimPrimitiveKind> {\n const kind = intro.kindOf(schema)\n switch (kind) {\n case 'string':\n return KIND_STRING\n case 'number':\n case 'nan':\n return KIND_NUMBER\n case 'boolean':\n return KIND_BOOLEAN\n case 'bigint':\n return KIND_BIGINT\n case 'date':\n return KIND_DATE\n case 'file':\n // `z.file()` accepts `File` instances at write time. `null` is\n // also accepted at the slim-primitive level so the directive's\n // canonical blank value (the \"no file selected\" sentinel) lands\n // even on required-file schemas — the blank-path channel + the\n // derived \"No value supplied\" error already gates submission, so\n // permitting `null` storage here doesn't loosen schema enforcement.\n return KIND_FILE\n case 'null':\n return KIND_NULL\n case 'undefined':\n case 'void':\n return KIND_UNDEFINED\n case 'enum': {\n const values = intro.getEnumValues(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const v of values) {\n if (typeof v === 'string') out.add('string')\n else if (typeof v === 'number') out.add('number')\n }\n return out.size === 0 ? KIND_STRING : out\n }\n case 'native-enum': {\n // v3 only — `z.nativeEnum(E)` exposes the reverse-mapped TS enum\n // object on `_def.values`. Categorise each member by typeof.\n // Numeric enums also include reverse-mapped string keys whose\n // value is a number; both string and number kinds get registered.\n const values = intro.getNativeEnumValues(schema)\n if (values === undefined) return KIND_STRING\n const out = new Set<SlimPrimitiveKind>()\n for (const v of Object.values(values)) {\n if (typeof v === 'string') out.add('string')\n else if (typeof v === 'number') out.add('number')\n }\n return out.size === 0 ? KIND_STRING : out\n }\n case 'literal': {\n const values = intro.getLiteralValues(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const v of values) out.add(slimKindOf(v))\n return out.size === 0 ? PERMISSIVE_SLIM_KINDS : out\n }\n case 'object':\n case 'record':\n return KIND_OBJECT\n case 'array':\n case 'tuple':\n return KIND_ARRAY\n case 'set':\n return KIND_SET\n case 'optional': {\n const inner = intro.unwrapInner(schema)\n const innerSet =\n inner === undefined ? EMPTY_KINDS : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n const out = new Set<SlimPrimitiveKind>(innerSet)\n out.add('undefined')\n return out\n }\n case 'nullable': {\n const inner = intro.unwrapInner(schema)\n const innerSet =\n inner === undefined ? EMPTY_KINDS : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n const out = new Set<SlimPrimitiveKind>(innerSet)\n out.add('null')\n return out\n }\n case 'default':\n case 'readonly':\n case 'catch': {\n const inner = intro.unwrapInner(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'branded': {\n // v3-only. Brand wrappers carry their inner on `_def.type`.\n const inner = intro.unwrapBranded(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'effects': {\n // v3-only. ZodEffects wraps refines / transforms / preprocess;\n // for slim-primitive purposes the structural source is the\n // pre-transform shape (consumers write to that shape).\n const inner = intro.unwrapEffectsSource(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'pipeline': {\n // v3-only. Take the input side.\n const inner = intro.unwrapPipeIn(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'pipe': {\n // v4-only. `z.preprocess(fn, inner)` and `z.coerce.X()`\n // (pipe-with-transform-on-input) and `inner.transform(fn)`\n // (transform-on-output) all serialise as ZodPipe, but the\n // \"storage shape\" lives on opposite sides. For preprocess /\n // coerce, the input side IS the transform (shapeless,\n // PERMISSIVE) and the inner schema sits on the output. For\n // `.transform`, the input side is the source schema. Pick the\n // non-transform side so `isLeafAtPath` and the directive coerce\n // target both resolve against a real shape.\n const pipeIn = intro.unwrapPipeIn(schema)\n const pipeOut = intro.unwrapPipeOut(schema)\n const inner =\n pipeIn !== undefined && intro.kindOf(pipeIn) === 'transform' ? pipeOut : (pipeIn ?? pipeOut)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth)\n }\n case 'lazy': {\n // Bump on lazy crossing only; past the cap, fall back to\n // permissive so recursive paths beyond the cap aren't gated.\n if (lazyDepth >= maxDepth) return PERMISSIVE_SLIM_KINDS\n const inner = intro.unwrapLazy(schema)\n return inner === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(inner, intro, maxDepth, lazyDepth + 1)\n }\n case 'union':\n case 'discriminated-union': {\n // Both adapters store DU options on `def.options` too, so\n // `getUnionOptions` works for either kind.\n const options = intro.getUnionOptions(schema)\n const out = new Set<SlimPrimitiveKind>()\n for (const opt of options) {\n for (const k of slimPrimitivesWalk(opt, intro, maxDepth, lazyDepth)) out.add(k)\n }\n return out.size === 0 ? PERMISSIVE_SLIM_KINDS : out\n }\n case 'intersection': {\n const left = intro.getIntersectionLeft(schema)\n const right = intro.getIntersectionRight(schema)\n const leftSet =\n left === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(left, intro, maxDepth, lazyDepth)\n const rightSet =\n right === undefined\n ? PERMISSIVE_SLIM_KINDS\n : slimPrimitivesWalk(right, intro, maxDepth, lazyDepth)\n const out = new Set<SlimPrimitiveKind>()\n for (const k of leftSet) if (rightSet.has(k)) out.add(k)\n return out\n }\n case 'never':\n return EMPTY_KINDS\n case 'any':\n case 'unknown':\n return PERMISSIVE_SLIM_KINDS\n // Opaque / unsupported kinds: be permissive so legitimate writes\n // aren't false-rejected. The unsupported kinds (`map` / `symbol` /\n // `function` / `promise`) are rejected at adapter construction by\n // `assertSupportedKinds`; this fallthrough keeps the walker\n // defensive in case construction is skipped.\n default:\n return PERMISSIVE_SLIM_KINDS\n }\n}\n"],"names":["canonicalizePath","AttaformErrorCode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