attaform 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -10
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -33
- package/dist/chunks/dev-key-collision-warnings.cjs.map +1 -1
- package/dist/chunks/dev-key-collision-warnings.mjs +1 -33
- package/dist/chunks/dev-key-collision-warnings.mjs.map +1 -1
- package/dist/chunks/devtools.cjs +3 -5
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +3 -5
- package/dist/chunks/devtools.mjs.map +1 -1
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -41
- package/dist/index.d.mts +6 -41
- package/dist/index.d.ts +6 -41
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +3 -11
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/{attaform.BGwNZ9GV.d.cts → attaform.BGMRvckW.d.ts} +10 -77
- package/dist/shared/{attaform.DvUH4a3o.d.ts → attaform.BJnNK75Y.d.cts} +45 -670
- package/dist/shared/{attaform.DvUH4a3o.d.mts → attaform.BJnNK75Y.d.mts} +45 -670
- package/dist/shared/{attaform.DvUH4a3o.d.cts → attaform.BJnNK75Y.d.ts} +45 -670
- package/dist/shared/{attaform.BKFwekY2.mjs → attaform.BhI9Icek.mjs} +3 -287
- package/dist/shared/attaform.BhI9Icek.mjs.map +1 -0
- package/dist/shared/{attaform.CRzpFCjV.cjs → attaform.BibT5AS_.cjs} +2 -2
- package/dist/shared/{attaform.CRzpFCjV.cjs.map → attaform.BibT5AS_.cjs.map} +1 -1
- package/dist/shared/{attaform.DkA5J8NW.d.cts → attaform.CO0e7YVY.d.cts} +1 -46
- package/dist/shared/{attaform.DkA5J8NW.d.ts → attaform.CO0e7YVY.d.mts} +1 -46
- package/dist/shared/{attaform.DkA5J8NW.d.mts → attaform.CO0e7YVY.d.ts} +1 -46
- package/dist/shared/{attaform.Q3eAD2wD.cjs → attaform.CaYj3ZfY.cjs} +3 -3
- package/dist/shared/{attaform.Q3eAD2wD.cjs.map → attaform.CaYj3ZfY.cjs.map} +1 -1
- package/dist/shared/{attaform.AyujQoHp.cjs → attaform.Cmb_LCie.cjs} +4 -4
- package/dist/shared/{attaform.DNuiFCXG.mjs.map → attaform.Cmb_LCie.cjs.map} +1 -1
- package/dist/shared/{attaform.CsB-iKbU.mjs → attaform.CtJOd7ox.mjs} +81 -591
- package/dist/shared/attaform.CtJOd7ox.mjs.map +1 -0
- package/dist/shared/{attaform.DgCfLqay.mjs → attaform.CzVta5o2.mjs} +4 -4
- package/dist/shared/attaform.CzVta5o2.mjs.map +1 -0
- package/dist/shared/{attaform.FN0vaQAg.d.mts → attaform.D52oJiYC.d.cts} +1 -1
- package/dist/shared/{attaform.aekT7mMx.d.cts → attaform.DCkSNnPr.d.mts} +1 -1
- package/dist/shared/{attaform.01iKS_lz.cjs → attaform.Db4E4IW6.cjs} +2 -294
- package/dist/shared/attaform.Db4E4IW6.cjs.map +1 -0
- package/dist/shared/{attaform.C-RtnCJM.cjs → attaform.DbyTD8N2.cjs} +4 -4
- package/dist/shared/attaform.DbyTD8N2.cjs.map +1 -0
- package/dist/shared/{attaform.DCjgGir_.mjs → attaform.Dd1Kmmaj.mjs} +3 -3
- package/dist/shared/{attaform.DCjgGir_.mjs.map → attaform.Dd1Kmmaj.mjs.map} +1 -1
- package/dist/shared/{attaform.D4XYaasQ.d.ts → attaform.DrY8srOp.d.mts} +10 -77
- package/dist/shared/{attaform.CjMcwV7W.cjs → attaform.DsQkXE3o.cjs} +79 -599
- package/dist/shared/attaform.DsQkXE3o.cjs.map +1 -0
- package/dist/shared/{attaform.CCCeEPwa.d.mts → attaform.DuPneYR0.d.cts} +10 -77
- package/dist/shared/{attaform.6xE0Lcfd.mjs → attaform.Dx9-QQE2.mjs} +2 -2
- package/dist/shared/{attaform.6xE0Lcfd.mjs.map → attaform.Dx9-QQE2.mjs.map} +1 -1
- package/dist/shared/{attaform.DUMWQefY.d.ts → attaform.WEwfXcHq.d.ts} +1 -1
- package/dist/shared/{attaform.DNuiFCXG.mjs → attaform.alpG7rT7.mjs} +4 -4
- package/dist/shared/{attaform.AyujQoHp.cjs.map → attaform.alpG7rT7.mjs.map} +1 -1
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +3 -3
- package/dist/zod-v3.d.mts +3 -3
- package/dist/zod-v3.d.ts +3 -3
- package/dist/zod-v3.mjs +2 -2
- package/dist/zod-v4.cjs +2 -2
- package/dist/zod-v4.d.cts +5 -5
- package/dist/zod-v4.d.mts +5 -5
- package/dist/zod-v4.d.ts +5 -5
- package/dist/zod-v4.mjs +2 -2
- package/dist/zod.cjs +5 -5
- package/dist/zod.d.cts +5 -5
- package/dist/zod.d.mts +5 -5
- package/dist/zod.d.ts +5 -5
- package/dist/zod.mjs +5 -5
- package/package.json +1 -1
- package/dist/chunks/indexeddb.cjs +0 -119
- package/dist/chunks/indexeddb.cjs.map +0 -1
- package/dist/chunks/indexeddb.mjs +0 -117
- package/dist/chunks/indexeddb.mjs.map +0 -1
- package/dist/chunks/local-storage.cjs +0 -58
- package/dist/chunks/local-storage.cjs.map +0 -1
- package/dist/chunks/local-storage.mjs +0 -56
- package/dist/chunks/local-storage.mjs.map +0 -1
- package/dist/chunks/multi-tab-sync.cjs +0 -367
- package/dist/chunks/multi-tab-sync.cjs.map +0 -1
- package/dist/chunks/multi-tab-sync.mjs +0 -364
- package/dist/chunks/multi-tab-sync.mjs.map +0 -1
- package/dist/chunks/session-storage.cjs +0 -58
- package/dist/chunks/session-storage.cjs.map +0 -1
- package/dist/chunks/session-storage.mjs +0 -56
- package/dist/chunks/session-storage.mjs.map +0 -1
- package/dist/chunks/wire-persistence.cjs +0 -396
- package/dist/chunks/wire-persistence.cjs.map +0 -1
- package/dist/chunks/wire-persistence.mjs +0 -394
- package/dist/chunks/wire-persistence.mjs.map +0 -1
- package/dist/shared/attaform.01iKS_lz.cjs.map +0 -1
- package/dist/shared/attaform.BKFwekY2.mjs.map +0 -1
- package/dist/shared/attaform.C-RtnCJM.cjs.map +0 -1
- package/dist/shared/attaform.CjMcwV7W.cjs.map +0 -1
- package/dist/shared/attaform.CsB-iKbU.mjs.map +0 -1
- package/dist/shared/attaform.DgCfLqay.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.BKFwekY2.mjs","sources":["../../src/runtime/core/dev.ts","../../src/runtime/core/errors.ts","../../src/runtime/core/ssr.ts","../../src/runtime/core/registry.ts","../../src/runtime/core/vue-shared-shim.ts","../../src/runtime/core/register-protocol.ts","../../src/runtime/core/directive-aria.ts","../../src/runtime/core/directive-listeners.ts","../../src/runtime/core/assigner-pipeline.ts","../../src/runtime/core/directive-file.ts","../../src/runtime/core/persistence/opt-in-registry.ts","../../src/runtime/core/persistence/sensitive-names.ts","../../src/runtime/core/directive-lifecycle.ts","../../src/runtime/core/directive-value-sync.ts","../../src/runtime/core/interactive-tags.ts","../../src/runtime/core/directive.ts","../../src/runtime/core/plugin.ts","../../src/runtime/core/paths.ts"],"sourcesContent":["/**\n * Portable dev-mode flag. `true` under a non-production build, `false`\n * in production. The expression shape below is load-bearing; read both\n * notes before changing it.\n *\n * Why the ternary (consumer dead-code elimination): consumer bundlers\n * replace `process.env.NODE_ENV` (dot-access) with a string literal.\n * Vite and esbuild do this via `define`, Webpack via `DefinePlugin`,\n * Rollup via `@rollup/plugin-replace`. After replacement this reads\n * `('production') !== 'production'`, which folds to the literal `false`,\n * so every `if (__DEV__)` block is dropped from the consumer's\n * production bundle. The `&&`-guarded form\n * (`typeof process !== 'undefined' && process.env.NODE_ENV !== 'production'`)\n * does NOT fold: esbuild will not inline a `const` whose initializer is\n * a short-circuit expression, so the dev branches survive. Keep the\n * `typeof` test inside the ternary condition; do not rewrite it as a\n * leading `&&` guard.\n *\n * Why the `typeof` guard (CDN safety): imported directly through a\n * browser-native ESM CDN (esm.sh, Skypack, unpkg) with no bundler in\n * front, `process` is undeclared. A bare `process.env.NODE_ENV` read\n * would throw a `ReferenceError` at module-eval. The `typeof` test\n * selects the `'production'` branch first, so `__DEV__` resolves to\n * `false` and the library still loads; only the dev diagnostic surface\n * degrades (warnings stay silent). To restore CDN debuggability, put a\n * bundler in the pipeline so `process.env.NODE_ENV` gets replaced,\n * which is the recommended path for any production app regardless.\n *\n * `import.meta.env.DEV` would resolve under Vite but break Node\n * consumers (no `import.meta.env`) and emit esbuild's\n * `empty-import-meta` warning in pre-bundled distributions. The\n * `process.env.NODE_ENV` choice is the broadest-compatibility option.\n *\n * The dot-access read needs the explicit `NODE_ENV` member declared in\n * `types/node-env.d.ts`; tsconfig's `noPropertyAccessFromIndexSignature`\n * rejects index-signature dot-access otherwise.\n */\nexport const __DEV__: boolean =\n (typeof process !== 'undefined' ? process.env.NODE_ENV : 'production') !== 'production'\n","/**\n * Typed error classes thrown by the form library. Each one signals a\n * distinct misuse so calling code can branch on `instanceof` instead\n * of pattern-matching error messages.\n *\n * Every class extends `AttaformError`, so consumers can write a single\n * polymorphic catch (`catch (e) { if (e instanceof AttaformError) ... }`)\n * instead of OR-chaining checks for each subclass. `AttaformError` itself\n * extends the standard `Error`, so existing `instanceof Error` usage\n * keeps working.\n */\n\n/**\n * Base for every error class thrown by `attaform`. Sets\n * `this.name` from the constructor's `new.target.name`, so subclasses\n * don't have to redeclare their own name override.\n */\nexport class AttaformError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options)\n this.name = new.target.name\n }\n}\n\n/**\n * Thrown when a path string is malformed — typically a dotted path\n * with empty segments (e.g. `'a..b'`, leading or trailing dots).\n * Use array form (`['a', 'b']`) for keys that contain literal dots.\n */\nexport class InvalidPathError extends AttaformError {}\n\n/**\n * Thrown when `useForm` receives an invalid configuration — most often\n * a schema passed directly as the first argument, or no argument at\n * all. The configuration is an options bag; the schema is one of\n * several fields, even when it's the only one in use.\n *\n * ```ts\n * // ✗ Crashes deep inside the validator with an opaque message:\n * const form = useForm(z.object({ ... }))\n * // ✗ Same:\n * const form = useForm()\n * // ✓ Pass the schema as the `schema` field:\n * const form = useForm({ schema: z.object({ ... }) })\n * ```\n *\n * The same shape applies to every entry point: `attaform/zod`,\n * `attaform/zod-v3`, `attaform/zod-v4`, and the schema-agnostic\n * `attaform` root.\n */\nexport class InvalidUseFormConfigError extends AttaformError {\n constructor() {\n super(\n '[attaform] useForm received an invalid configuration (a schema directly, no argument, ' +\n 'or no `schema` field). Pass it as `useForm({ schema })` — the schema is one of several ' +\n 'configuration options. See https://attaform.com/docs/api/use-form-return for the full ' +\n 'configuration shape.'\n )\n }\n}\n\n/**\n * Thrown when a `handleSubmit`-supplied `onError` callback itself\n * throws or rejects. Wraps the inner failure so both the original\n * cause (via `error.cause`) and the propagation site are visible.\n */\nexport class SubmitErrorHandlerError extends AttaformError {}\n\n/**\n * Coerce an unknown thrown value into an `Error`. A real `Error`\n * (including any `AttaformError` subclass) passes through untouched, so\n * its message, stack, name, and `cause` chain survive. A non-`Error`\n * throw (a string, a plain object, a rejected primitive) is wrapped in a\n * fresh `Error` whose `cause` preserves the original value.\n *\n * `handleSubmit` routes everything its `onSubmit` / `onError` callbacks\n * throw through here before parking it on `form.meta.submitError`, so\n * that slot is always a clean `Error | null` rather than `unknown` —\n * consumers can read `.message` and `.cause` without a type guard.\n */\nexport function toError(value: unknown): Error {\n if (value instanceof Error) return value\n const message =\n typeof value === 'string' && value.length > 0\n ? value\n : `Submit callback threw a non-Error value (${typeof value})`\n return new Error(message, { cause: value })\n}\n\n/**\n * Thrown when an `attaform` API needs the registry attached to a Vue\n * app but it isn't there yet. Component-level entry points (`useForm`,\n * `injectForm`, `useRegister`) lazy-install the registry on first use,\n * so this error is mostly reached by SSR helpers — `renderAttaformState`\n * and `hydrateAttaformState` — which run outside a setup context and\n * have no current instance to install against.\n *\n * Fix: add `app.use(createAttaform())` (or `app.use(createAttaform({\n * ssr: true }))` on the server) to your SSR entry, before\n * `renderToString` / hydration. Under Nuxt, `attaform/nuxt` already\n * does this; the error usually points at a non-Nuxt SSR setup that\n * hasn't installed explicitly.\n */\nexport class RegistryNotInstalledError extends AttaformError {\n constructor() {\n super(\n '[attaform] No registry attached to this Vue app. Component-level useForm / injectForm / ' +\n 'useRegister auto-install the registry, but SSR helpers (renderAttaformState, ' +\n 'hydrateAttaformState) run outside setup and require an explicit ' +\n '`app.use(createAttaform())` at server-render time. Add it to your SSR entry, before ' +\n '`renderToString`.'\n )\n }\n}\n\n/**\n * Thrown when `useForm` / `injectForm` is called outside of a\n * Vue `setup()` function — typically from an event handler, watcher,\n * or async callback that runs after mount.\n *\n * Fix: move the call into `setup()`, or trigger it from a child\n * component whose `setup()` runs the composable.\n */\nexport class OutsideSetupError extends AttaformError {\n constructor() {\n super(\n '[attaform] useForm / injectForm called outside Vue setup(). ' +\n 'Move into setup or mount a child component to trigger from an event.'\n )\n }\n}\n\n/**\n * Thrown when a `useForm({ key })` call uses a key starting with\n * `__atta:`. That prefix is reserved for keys the library generates\n * internally (e.g. for anonymous `useForm()` calls without an\n * explicit key). Pick a different prefix for your form.\n */\nexport class ReservedFormKeyError extends AttaformError {\n constructor(key: string) {\n super(\n `[attaform] Form key \"${key}\" uses the reserved \"__atta:\" namespace. ` +\n `Use a different prefix — \"__atta:\" is for library-internal synthetic keys ` +\n `(anonymous useForm() calls without an explicit key).`\n )\n }\n}\n\n/**\n * Thrown (in dev) when `useForm({ persist: ... })` is configured on\n * an anonymous form (no `key:` provided). The synthetic `__atta:anon:`\n * identity isn't stable across remounts (Vue's `useId()` allocator\n * drifts under HMR, and any sibling `useId()` call shifts subsequent\n * IDs), so the persistence layer can't reliably find the previous\n * mount's draft. Result: stale entries pile up in storage and the\n * user's most recent edit doesn't always come back.\n *\n * Fix: pass an explicit `key` to `useForm()`.\n *\n * In production builds the runtime downgrades this to a one-shot\n * `console.warn` so a deployed third-party app shipping the\n * anti-pattern doesn't hard-crash.\n */\n// (AnonPersistError class declaration is below; this docblock is the\n// historical preamble — kept here so blame/PR review can trace the\n// original intent. The richer class supersedes the earlier basic version.)\n\n/**\n * Thrown when persistence is misconfigured in a way that would either\n * (a) silently drop writes, or (b) namespace storage under a\n * non-deterministic synthetic key — both of which become security bugs\n * the moment encrypted persistence backends are added (the same key\n * may be derived for two unrelated forms).\n *\n * Two `cause` values, one error shape:\n *\n * - `'no-key'` — `useForm({ persist: ... })` called without `key:`.\n * Anonymous keys (`__atta:anon:*`) drift across mounts; persisting\n * to a non-deterministic location is refused outright.\n *\n * - `'register-without-config'` — `register(_, { persist: true })`\n * declared on a form whose `useForm()` options omit `persist:`.\n * The opt-in is recorded but nothing would ever land in storage.\n *\n * Fix: align the two layers — set `persist:` + `key:` on `useForm()`,\n * or remove `{ persist: true }` from the offending `register()` call.\n */\nexport class AnonPersistError extends AttaformError {\n readonly schemaFields: readonly string[] | undefined\n readonly callSite: string | undefined\n override readonly cause: 'no-key' | 'register-without-config'\n constructor(opts: {\n schemaFields?: readonly string[] | undefined\n callSite?: string | undefined\n cause: 'no-key' | 'register-without-config'\n }) {\n super(formatAnonPersistMessage(opts))\n this.schemaFields = opts.schemaFields\n this.callSite = opts.callSite\n this.cause = opts.cause\n }\n}\n\nfunction formatAnonPersistMessage(opts: {\n schemaFields?: readonly string[] | undefined\n callSite?: string | undefined\n cause: 'no-key' | 'register-without-config'\n}): string {\n const head =\n opts.cause === 'no-key'\n ? `useForm({ persist: ... }) requires an explicit \\`key:\\`. Anonymous synthetic keys (\\`__atta:anon:*\\`) drift across mounts and can collide between unrelated forms — refusing to persist to a non-deterministic location.`\n : `register(_, { persist: true }) declared on a form whose useForm() options have no \\`persist:\\` configured. The opt-in is recorded but nothing would ever land in storage.`\n const fields =\n opts.schemaFields !== undefined && opts.schemaFields.length > 0\n ? ` Form fields: { ${opts.schemaFields.join(', ')} }.`\n : ''\n const fix =\n opts.cause === 'no-key'\n ? ` Fix: add \\`key: '<stable-id>'\\` to useForm().`\n : ` Fix: add \\`persist: 'session'\\` (or 'local') and \\`key:\\` to useForm(), or remove \\`{ persist: true }\\` from this register() call.`\n const where = opts.callSite !== undefined ? ` ${opts.callSite}` : ''\n return `[attaform] ${head}${fields}${fix}${where}`\n}\n","/**\n * Portable SSR detection. The plugin captures this value at install time and\n * exposes it via the registry so every runtime branch reads a single source\n * of truth instead of sniffing `import.meta.*` (bundler-specific) at each\n * call site.\n *\n * Consumers can override the heuristic explicitly via\n * `createAttaform({ ssr: true })`; the default handles the common\n * Node-vs-browser split without relying on any bundler-injected flag.\n */\n\nexport interface SSRDetectOptions {\n /**\n * Force SSR-vs-client mode, bypassing the `typeof window` heuristic.\n * `true` activates the SSR code paths (no devtools, no persistence\n * wiring, payload serialisation enabled); `false` forces client mode.\n * The Nuxt plugin sets this from `import.meta.server` so SSR detection\n * never depends on whether `window` is polyfilled. Tests that need to\n * exercise the SSR code paths under jsdom pass `ssr: true`.\n */\n ssr?: boolean\n}\n\n/**\n * Returns true when running in a server-rendering context (no `window` / no\n * `document`). Explicit `ssr` flag always wins.\n *\n * Note: JSDOM-based test environments define `window`, so tests that need to\n * exercise SSR code paths must pass `{ ssr: true }` explicitly.\n */\nexport function detectSSR(options: SSRDetectOptions = {}): boolean {\n if (options.ssr !== undefined) return options.ssr\n return typeof window === 'undefined' && typeof document === 'undefined'\n}\n","import type { App, InjectionKey } from 'vue'\nimport { getCurrentInstance, inject, shallowReactive } from 'vue'\nimport type { AttaformDefaults, FormKey } from '../types/types-api'\nimport type { GenericForm } from '../types/types-core'\nimport type { UseWizardReturnType } from '../types/types-wizard'\nimport type { FormStore } from './create-form-store'\nimport { OutsideSetupError, RegistryNotInstalledError } from './errors'\nimport { detectSSR, type SSRDetectOptions } from './ssr'\n\n/**\n * Per-Vue-app container for all form state instances. Each\n * `app.use(createAttaform())` call gets its own registry,\n * so the library runs under bare Vue 3 + SSR (via\n * `@vue/server-renderer`) and Nuxt with the same code path.\n *\n * Each form's state lives in `forms: Map<FormKey, FormStore<GenericForm>>`.\n * The type relaxation at storage time is necessary because different\n * forms in the same app have different `Form` generics; callers recover\n * the specific form type via `useForm`'s overloads.\n */\n\n/**\n * Serialised snapshot of one form's state, captured by\n * `renderAttaformState` for SSR and replayed by\n * `hydrateAttaformState` on the client. Round-trips through\n * JSON-safe tuples; field references are intentionally omitted\n * (DOM nodes don't survive serialisation).\n */\nexport type SerializedFormData = {\n /** The form's value at snapshot time. */\n readonly form: unknown\n /**\n * Errors produced by the schema at snapshot time. Replayed into\n * the client form's error state at hydration; cleared on\n * successful re-validation client-side.\n */\n readonly schemaErrors: ReadonlyArray<readonly [string, unknown]>\n /**\n * Errors set explicitly via `setFieldErrors` / `addFieldErrors`\n * (typically from a server response parsed via `parseApiErrors`)\n * at snapshot time. Replayed at hydration; persists across\n * client-side re-validation.\n */\n readonly userErrors: ReadonlyArray<readonly [string, unknown]>\n /** Per-field metadata (timestamps, raw values, connection flags) captured at snapshot time. */\n readonly fields: ReadonlyArray<readonly [string, unknown]>\n /**\n * Path keys that were in the form's `blankPaths` set at\n * snapshot time. Round-trips the \"displayed empty\" UI state across\n * the SSR boundary — without it, the client briefly renders\n * `String(slim-default)` (e.g. `'0'`) for fields the server\n * rendered as blank. Optional in the wire format so older payload\n * shapes deserialise cleanly.\n */\n readonly blankPaths?: ReadonlyArray<string>\n}\n\nexport type PendingHydration = Map<FormKey, SerializedFormData>\n\n/**\n * The library's per-Vue-app container. One `AttaformRegistry` is\n * created per `app.use(createAttaform())` call.\n *\n * Most consumers never touch this directly — `useForm` and\n * `injectForm` reach the registry on your behalf. Access it\n * explicitly only when wiring SSR or a custom plugin integration.\n */\nexport type AttaformRegistry = {\n /**\n * Live forms keyed by `FormKey`.\n * @internal\n */\n readonly forms: Map<FormKey, FormStore<GenericForm>>\n /**\n * Live wizards keyed by the consumer-supplied `key` option. Populated\n * by `useWizard(entryForm, { key })`; consulted by `injectWizard(key)` to\n * resolve cross-component wizard handles. Anonymous wizards (no\n * `key`) do NOT register here — they're reachable only via ambient\n * provide/inject.\n * @internal\n */\n readonly wizards: Map<string, UseWizardReturnType>\n /**\n * Snapshots staged by `hydrateAttaformState` waiting to be consumed by the next `useForm` call.\n * @internal\n */\n readonly pendingHydration: PendingHydration\n /** `true` while running on the server during SSR; `false` on the client. */\n readonly ssr: boolean\n /** App-level defaults applied to every `useForm` call. */\n readonly defaults: AttaformDefaults\n /**\n * Track a consumer of `key`. Returns a dispose function — call it\n * when the consumer unmounts. The form is evicted automatically\n * when the last consumer disposes, so long-running SPAs don't\n * leak detached state across navigations.\n * @internal\n */\n readonly trackConsumer: (key: FormKey) => () => void\n /**\n * Track a consumer of wizard `key`. Returns a dispose function — call\n * it when the consumer unmounts. The wizard handle is evicted from\n * `wizards` once the last consumer disposes, mirroring the form\n * consumer-counting mechanics. Anonymous wizards never enter this\n * counter (they have no key to count under).\n * @internal\n */\n readonly trackWizardConsumer: (key: string) => () => void\n /**\n * Mark a form as eligible for SSR prefetch. The form's\n * `onServerPrefetch` hook consults `shouldPrefetch(key)` and runs the\n * captured `defaultValues` factory only when this set contains the\n * key (and the skip set does not). Set by `form.activate()`,\n * `useWizard`'s current-step auto-mark, and the future Vite transform.\n * @internal\n */\n readonly enqueuePrefetch: (key: FormKey) => void\n /**\n * Mark a form as ineligible for SSR prefetch. Overrides `enqueuePrefetch`.\n * Used by `useWizard` to keep non-current steps dormant on the\n * server even when a transform mark or stray `activate()` would\n * otherwise enqueue them — the wizard's \"user isn't on this step\"\n * signal wins.\n * @internal\n */\n readonly skipPrefetch: (key: FormKey) => void\n /**\n * Whether `key`'s SSR prefetch should run. Returns `true` iff the key\n * is enqueued AND not skipped.\n * @internal\n */\n readonly shouldPrefetch: (key: FormKey) => boolean\n /**\n * Wait for all pending persistence writes across every live form\n * to settle. Useful for SSR shutdown and integration tests that\n * need a deterministic teardown.\n * @internal\n */\n readonly shutdown: () => Promise<void>\n}\n\n/**\n * The Vue `InjectionKey` under which the registry is provided on the\n * app. Most consumers never need this — `useForm` and\n * `injectForm` resolve the registry automatically.\n */\n// `Symbol.for(...)` so the key survives module duplication. If Vite's\n// dep optimizer ends up serving attaform as two separate copies (one\n// live-ESM, one pre-bundled — the standard hazard for linked-source\n// installs that opt into `optimizeDeps.include`), each copy still\n// resolves the same global symbol from the well-known string. Plugin\n// install's `app.provide(kAttaformRegistry, ...)` and the page's\n// `inject(kAttaformRegistry, null)` agree on the key, so `useForm`\n// finds its registry regardless of which copy did the provide. The\n// `attaform:` prefix namespaces the key safely. Same reasoning\n// for `kFormContext` and `kFormInstanceId` below.\nexport const kAttaformRegistry: InjectionKey<AttaformRegistry> = Symbol.for('attaform:registry')\n\n/**\n * Provides the nearest-ancestor wizard handle to descendants. Installed\n * by `useWizard` after the handle is built, so any nested component can\n * call `injectWizard()` (no key) to reach the closest wizard without\n * threading the handle through props.\n *\n * Mirrors `kFormContext`'s shape — `Symbol.for(...)` for module-\n * duplication safety; consumers never read this key directly. Keyed\n * wizards remain reachable via `injectWizard(key)` regardless of\n * tree position; the ambient slot is the convenience path for\n * components that just want \"whatever wizard is above me.\"\n */\nexport const kAttaformAncestorWizard: InjectionKey<UseWizardReturnType> = Symbol.for(\n 'attaform:ancestor-wizard'\n)\n\n/**\n * Optional framework-aware resolver for the wizard's active step. The\n * `attaform/nuxt` runtime plugin provides this so `useWizard` can read\n * the current step from `useRoute().query[<param>]` without the wizard\n * core importing any framework router. Bare-Vue consumers wire\n * `options.restore` explicitly instead, or let the default `?step=<key>`\n * restore in `useWizard` handle the deep-link case.\n *\n * Shape: a single function that receives the wizard's URL param name\n * (default `'step'`) and returns the matching query value or\n * `undefined`. Called once during `useWizard()` construction, after any\n * explicit `options.restore` is consulted.\n */\nexport type WizardActiveStepResolver = (param: string) => string | undefined\n\nexport const kAttaformWizardActiveStepResolver: InjectionKey<WizardActiveStepResolver> = Symbol.for(\n 'attaform:wizard-active-step-resolver'\n)\n\n/**\n * Provides the current form's FormStore to descendants. Installed by\n * `useAbstractForm` after it resolves the state, so any nested component\n * can call `injectForm()` without prop-threading the form API.\n *\n * Typed as `FormStore<GenericForm>` — the descendant that re-emerges the\n * shape must supply its own `Form` generic, because Vue's InjectionKey\n * erases the generic at the provide/inject boundary.\n */\nexport const kFormContext: InjectionKey<FormStore<GenericForm>> =\n Symbol.for('attaform:form-context')\n\n/**\n * Provide / inject key for the per-`useForm()`-call instance ID. Provided\n * alongside `kFormContext` so descendants reaching via `injectForm()`\n * inherit the ancestor's `formInstanceId` and their locally-registered\n * elements tag against the SAME instance — keeps parent-submit-focus\n * working for inputs registered by deep children.\n *\n * Sibling `useForm({ key })` calls (e.g. sidebar + main rendering the\n * same form) sit at distinct tree positions, so each provides its own\n * ID; descendants of each branch inherit the branch's ID. Two ID spaces\n * stay isolated even when the underlying FormStore is shared.\n */\nexport const kFormInstanceId: InjectionKey<string> = Symbol.for('attaform:form-instance-id')\n\ndeclare module 'vue' {\n interface App {\n /** @internal */\n _attaform?: AttaformRegistry\n }\n}\n\n/** Options for `createRegistry`. */\nexport type CreateRegistryOptions = SSRDetectOptions & {\n /**\n * App-level defaults applied to every `useForm` call. Per-form\n * options always win. Omitted is equivalent to `{}`.\n */\n defaults?: AttaformDefaults\n}\n\n/**\n * Create a fresh `AttaformRegistry`. `createAttaform()` calls\n * this internally — most consumers never need to call it directly.\n * Use it when building a custom plugin that doesn't want the\n * `createAttaform` plugin's auto-install behaviour (e.g. test\n * harnesses, embedded apps).\n */\nexport function createRegistry(options: CreateRegistryOptions = {}): AttaformRegistry {\n const ssr = detectSSR(options)\n // Frozen so accidental writes downstream throw in dev. Public surface\n // (`createAttaform({ defaults })`) treats this as data, not as\n // a mutation point — there's no public API to update defaults after\n // install, and adding one would invite race conditions with already-\n // mounted forms.\n const defaults: AttaformDefaults = Object.freeze({ ...(options.defaults ?? {}) })\n // The outer object is plain (it holds references we never rebind); inner\n // Maps are reactive via Vue's collection handlers so per-key reads track\n // per-key. `shallowReactive` avoids Vue's deep Ref-unwrapping, which would\n // mangle FormStore.form's Ref<F> type into F on lookup.\n const forms = shallowReactive(new Map<FormKey, FormStore<GenericForm>>())\n // Wizards live alongside forms but follow simpler lifecycle: no IO to\n // drain on eviction (the wizard handle is just an object that closes\n // over per-form state). Reactive container so consumers can observe\n // registration in templates if they ever need to (e.g. dev panels).\n const wizards = shallowReactive(new Map<string, UseWizardReturnType>())\n const pendingHydration = shallowReactive(new Map<FormKey, SerializedFormData>())\n // Consumer counts are bookkeeping — not reactive. No template should ever\n // depend on \"how many useForm calls are live\", and using a plain Map\n // avoids triggering watchers when we increment on every mount.\n const consumers = new Map<FormKey, number>()\n\n // Stores that have been evicted from `forms` but still have a\n // pending drain. `shutdown()` awaits these too so a process-exit\n // hook doesn't tear down before debounced writes from already-\n // unmounted forms have a chance to flush.\n const evicting = new Set<FormStore<GenericForm>>()\n\n // Eviction is deferred to the next microtask when consumer count\n // hits zero — a new consumer that claims the same key inside the\n // same tick cancels the schedule and reuses the live FormStore.\n // Catches Vue's HMR re-mount, `<KeepAlive>` swaps, and any\n // unmount-then-remount pattern that completes synchronously.\n // Tokens are per-schedule so a churn cycle that flips zero → one\n // → zero produces a fresh schedule and the older token's microtask\n // no-ops on the cancellation flag.\n type EvictionToken = { cancelled: boolean }\n const pendingEvictions = new Map<FormKey, EvictionToken>()\n\n function cancelPendingEviction(key: FormKey): void {\n const pending = pendingEvictions.get(key)\n if (pending === undefined) return\n pending.cancelled = true\n pendingEvictions.delete(key)\n }\n\n function trackConsumer(key: FormKey): () => void {\n // A new consumer claiming the key while an eviction is pending is\n // a re-mount, not a termination. Cancel before bumping the count.\n cancelPendingEviction(key)\n consumers.set(key, (consumers.get(key) ?? 0) + 1)\n let disposed = false\n return () => {\n if (disposed) return\n disposed = true\n const remaining = (consumers.get(key) ?? 1) - 1\n if (remaining > 0) {\n consumers.set(key, remaining)\n return\n }\n // Last consumer disposed. Schedule eviction on the next\n // microtask; cancel if a new consumer claims the key first.\n // `consumers` is cleared immediately so a re-mount's count\n // starts at one (consistent with a cold mount); `forms` stays\n // populated so the re-mount's `useForm({ key })` lookup finds\n // the live FormStore and skips factory re-firing.\n consumers.delete(key)\n const token: EvictionToken = { cancelled: false }\n pendingEvictions.set(key, token)\n queueMicrotask(() => {\n if (token.cancelled) return\n // Defensive: a newer schedule may have replaced this token\n // without cancelling it (can't happen under the current code\n // path, but the guard makes the invariant explicit).\n if (pendingEvictions.get(key) !== token) return\n pendingEvictions.delete(key)\n const state = forms.get(key)\n forms.delete(key)\n if (state === undefined) return\n // Drain-then-dispose runs in the background so the\n // persistence layer's debounced final write can complete —\n // the FormStore is reachable through the closure here even\n // after `forms.delete`.\n evicting.add(state)\n void state\n .awaitPendingWrites()\n .catch(() => undefined)\n .finally(() => {\n evicting.delete(state)\n state.dispose()\n })\n })\n }\n }\n\n // Wizard ref-counting + deferred eviction — mirrors the form mechanics\n // above but skips the drain step (wizards have no IO). The deferred-\n // eviction-cancel pattern catches the wizard HMR / KeepAlive remount\n // case: a fresh consumer claiming the key inside the same tick cancels\n // the schedule and reuses the live handle, so children using\n // `injectWizard(key)` aren't handed a stale reference after a parent\n // re-mount.\n const wizardConsumers = new Map<string, number>()\n const pendingWizardEvictions = new Map<string, EvictionToken>()\n\n function cancelPendingWizardEviction(key: string): void {\n const pending = pendingWizardEvictions.get(key)\n if (pending === undefined) return\n pending.cancelled = true\n pendingWizardEvictions.delete(key)\n }\n\n function trackWizardConsumer(key: string): () => void {\n cancelPendingWizardEviction(key)\n wizardConsumers.set(key, (wizardConsumers.get(key) ?? 0) + 1)\n let disposed = false\n return () => {\n if (disposed) return\n disposed = true\n const remaining = (wizardConsumers.get(key) ?? 1) - 1\n if (remaining > 0) {\n wizardConsumers.set(key, remaining)\n return\n }\n wizardConsumers.delete(key)\n const token: EvictionToken = { cancelled: false }\n pendingWizardEvictions.set(key, token)\n queueMicrotask(() => {\n if (token.cancelled) return\n if (pendingWizardEvictions.get(key) !== token) return\n pendingWizardEvictions.delete(key)\n wizards.delete(key)\n })\n }\n }\n\n async function shutdown(): Promise<void> {\n // Snapshot the keys — `awaitPendingWrites` may resolve mid-iteration\n // and trigger eviction that mutates `forms` while we're walking.\n // Include the evicting set so in-flight drains from already-\n // unmounted forms also flush before shutdown returns.\n const states = [...forms.values(), ...evicting]\n await Promise.allSettled(states.map((state) => state.awaitPendingWrites()))\n }\n\n // SSR prefetch coordination. Plain (non-reactive) Sets — the read\n // path is `onServerPrefetch` callbacks, which fire imperatively after\n // setup, not from inside a reactive effect. A new registry is\n // created per SSR request (createAttaform() call), so cross-request\n // state cannot leak.\n const prefetchEnqueued = new Set<FormKey>()\n const prefetchSkipped = new Set<FormKey>()\n function enqueuePrefetch(key: FormKey): void {\n prefetchEnqueued.add(key)\n }\n function skipPrefetch(key: FormKey): void {\n prefetchSkipped.add(key)\n }\n function shouldPrefetch(key: FormKey): boolean {\n return prefetchEnqueued.has(key) && !prefetchSkipped.has(key)\n }\n\n return {\n forms,\n wizards,\n pendingHydration,\n ssr,\n defaults,\n trackConsumer,\n trackWizardConsumer,\n enqueuePrefetch,\n skipPrefetch,\n shouldPrefetch,\n shutdown,\n }\n}\n\n/**\n * Look up the current app's registry from inside a component's\n * `setup()` (or any synchronous code on the setup call stack).\n *\n * Most consumers don't need this — `useForm` and `injectForm`\n * call it on your behalf. Reach for it directly when building\n * custom integrations that need the raw registry.\n *\n * Throws:\n * - `OutsideSetupError` when called outside a Vue setup context\n * (e.g. from an event handler or async callback). Move the call\n * into setup, or trigger it from a child component.\n * - `RegistryNotInstalledError` when called inside setup but the\n * plugin wasn't installed. Add\n * `app.use(createAttaform())` to your app entry.\n */\nexport function useRegistry(): AttaformRegistry {\n const instance = getCurrentInstance()\n if (instance === null) {\n throw new OutsideSetupError()\n }\n const registry = inject(kAttaformRegistry, null)\n if (registry === null) {\n throw new RegistryNotInstalledError()\n }\n return registry\n}\n\n/**\n * Look up a Vue app's registry by `App` reference. Used by\n * SSR helpers (`renderAttaformState`, `hydrateAttaformState`) that\n * run outside a component setup context.\n *\n * Throws `RegistryNotInstalledError` when the app hasn't been wired\n * with `createAttaform()`.\n */\nexport function getRegistryFromApp(app: App): AttaformRegistry {\n const registry = app._attaform\n if (registry === undefined) {\n throw new RegistryNotInstalledError()\n }\n return registry\n}\n\nexport function attachRegistryToApp(app: App, registry: AttaformRegistry): void {\n app.provide(kAttaformRegistry, registry)\n app._attaform = registry\n}\n","/**\n * Inlined copies of the handful of utilities we use from @vue/shared.\n *\n * @vue/shared is technically an internal Vue package. Treating it as stable\n * API for a runtime-only form library is a fragility we don't need — these\n * implementations are six functions + ~40 lines, and keeping them in-tree\n * insulates us from future renames or semantic drift.\n *\n * Source (MIT © Vue.js contributors):\n * https://github.com/vuejs/core/blob/main/packages/shared/src/general.ts\n * https://github.com/vuejs/core/blob/main/packages/shared/src/looseEqual.ts\n * https://github.com/vuejs/core/blob/main/packages/shared/src/toDisplayString.ts\n *\n * Behavior preserved byte-for-byte where possible; minor cosmetic changes for\n * our stricter ESLint rules (strict-boolean-expressions, prefer-nullish-\n * coalescing). Any divergence from @vue/shared is a bug in this file.\n */\n\nexport const isArray = Array.isArray\n\nexport function isFunction(value: unknown): value is (...args: unknown[]) => unknown {\n return typeof value === 'function'\n}\n\nfunction toTypeString(value: unknown): string {\n return Object.prototype.toString.call(value)\n}\n\nexport function isSet(value: unknown): value is Set<unknown> {\n return toTypeString(value) === '[object Set]'\n}\n\nexport function isDate(value: unknown): value is Date {\n return toTypeString(value) === '[object Date]'\n}\n\nexport function isSymbol(value: unknown): value is symbol {\n return typeof value === 'symbol'\n}\n\nexport function isObject(value: unknown): value is Record<string | symbol, unknown> {\n return value !== null && typeof value === 'object'\n}\n\nexport function looseToNumber<T>(val: T): T | number {\n const n = parseFloat(val as unknown as string)\n return isNaN(n) ? val : n\n}\n\nfunction looseCompareArrays(a: unknown[], b: unknown[]): boolean {\n if (a.length !== b.length) return false\n let equal = true\n for (let i = 0; equal && i < a.length; i++) {\n equal = looseEqual(a[i], b[i])\n }\n return equal\n}\n\nexport function looseEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true\n const aValidType = isDate(a)\n const bValidType = isDate(b)\n if (aValidType || bValidType) {\n return aValidType && bValidType ? a.getTime() === b.getTime() : false\n }\n const aSymbol = isSymbol(a)\n const bSymbol = isSymbol(b)\n if (aSymbol || bSymbol) return a === b\n const aIsArray = isArray(a)\n const bIsArray = isArray(b)\n if (aIsArray || bIsArray) {\n return aIsArray && bIsArray ? looseCompareArrays(a, b) : false\n }\n // Short-circuit on object/non-object mismatch BEFORE the deep-equality\n // block. Without this, the fallthrough to `String(a) === String(b)` at\n // the bottom would coerce `{}` to `'[object Object]'` and incorrectly\n // claim `looseEqual({}, '[object Object]') === true`. @vue/shared's\n // own implementation makes the same early return.\n const aIsObject = isObject(a)\n const bIsObject = isObject(b)\n if (aIsObject !== bIsObject) return false\n if (aIsObject && bIsObject) {\n const keysA = Object.keys(a)\n if (keysA.length !== Object.keys(b).length) return false\n for (const key of keysA) {\n const hasA = Object.prototype.hasOwnProperty.call(a, key)\n const hasB = Object.prototype.hasOwnProperty.call(b, key)\n if (!hasA || !hasB || !looseEqual(a[key], b[key])) return false\n }\n return true\n }\n return String(a) === String(b)\n}\n\nexport function looseIndexOf(arr: readonly unknown[], val: unknown): number {\n return arr.findIndex((item) => looseEqual(item, val))\n}\n\nexport function invokeArrayFns(fns: ((...args: unknown[]) => unknown)[], ...args: unknown[]): void {\n for (let i = 0; i < fns.length; i++) {\n const fn = fns[i]\n if (fn) fn(...args)\n }\n}\n","import { isRef } from 'vue'\nimport type { InternalRegisterValue, RegisterValue } from '../types/types-api'\n\n// Shared register-protocol primitives: the markers and value guards that\n// the v-register directive, its file / lifecycle satellites, and\n// useRegister all build on. They live in this leaf (depending only on vue\n// and the types module) so those modules don't import directive.ts back,\n// which would form an import cycle.\n\n/**\n * Marker installed on the v-register directive object so consumers\n * (notably `useRegister`) can identify it in a child vnode's\n * directive list even when the consumer's bundler hasn't installed\n * attaform's compile-time transforms. `Symbol.for(...)` round-trips\n * across duplicate bundle copies: `attaform` and `attaform/zod` can\n * land on different `vRegister` references in the playground or\n * under pnpm-hoist edge cases, but both carry the same marker.\n */\nexport const V_REGISTER_MARKER: unique symbol = Symbol.for('attaform:v-register-directive')\n\n/**\n * Marker on the rendered root DOM element. Set by `useRegister`'s\n * `onMounted` hook; read by the directive's deferred warn check to\n * skip the \"is a no-op\" warn for components that handle binding via\n * an inner v-register.\n *\n * `Symbol.for(...)` so the marker round-trips across duplicate copies\n * of attaform — see `assignKey` in core/directive.ts for the same\n * reasoning. `useRegister` and the directive are typically loaded\n * from the same module copy, but a consumer importing from\n * `attaform/zod` (Vite-optimized bundle) and the Nuxt\n * plugin's relative-path import (live ESM) can land on different\n * copies; a global symbol means the marker check still works.\n */\nexport const REGISTER_OWNER_MARKER: unique symbol = Symbol.for('attaform:register-owner-marker')\n\n/**\n * Type guard for a `RegisterValue`. Returns `true` when `val` looks\n * like the object returned from `form.register(path)`.\n *\n * ```ts\n * if (isRegisterValue(slotValue)) {\n * // slotValue.innerRef is now a Ref<unknown>\n * }\n * ```\n *\n * Useful when building wrapper components that accept either a\n * `RegisterValue` or a plain ref via the same prop.\n */\nexport function isRegisterValue<Value = unknown>(val: unknown): val is RegisterValue<Value> {\n if (typeof val !== 'object' || val === null) return false\n if (!('innerRef' in val)) return false\n if (!isRef(val.innerRef)) return false\n if (!('registerElement' in val)) return false\n if (typeof val.registerElement !== 'function') return false\n if (!('setValueWithInternalPath' in val)) return false\n if (typeof val.setValueWithInternalPath !== 'function') return false\n return true\n}\n\n/**\n * `true` while a deferred async transform is in flight at this path.\n * `beginTransform` flips it synchronously inside the assigner, so a\n * listener's post-write force-sync block reads it (right after the\n * assigner returns) to skip snapping the DOM back to stale storage —\n * the resolved value is painted in by the orchestrator's `syncDom`\n * once the run lands.\n */\nexport function isTransforming(value: unknown): boolean {\n return isRegisterValue(value) && (value as InternalRegisterValue).transforming\n}\n","import { effectScope, watch, type VNode } from 'vue'\nimport type { DisplayState, RegisterValue } from '../types/types-api'\n\n/**\n * The aria attributes the directive keeps in sync with the field's\n * gated display state. Each is managed independently so authoring one\n * (e.g. a hand-written `aria-describedby`) never disables the others.\n */\nconst MANAGED_ARIA_ATTRS = [\n 'aria-invalid',\n 'aria-busy',\n 'aria-required',\n 'aria-describedby',\n] as const\n\n/**\n * Per-element symbol slots. `ariaLockKey` records which managed attrs\n * the author wrote (off-limits for the binding's lifetime);\n * `ariaScopeKey` holds the teardown for the reactive watch. Both\n * `Symbol.for(...)` so duplicate copies of attaform agree on the slot.\n */\nconst ariaLockKey: unique symbol = Symbol.for('attaform:aria-locks')\nconst ariaScopeKey: unique symbol = Symbol.for('attaform:aria-scope')\nexport type AriaCarrier = HTMLElement & {\n [ariaLockKey]?: Set<string>\n [ariaScopeKey]?: () => void\n}\n\nconst EMPTY_ARIA_LOCKS: ReadonlySet<string> = new Set()\n\n/**\n * \"Respect your markup\": detect authored aria attributes at the vnode\n * props level rather than the DOM, so a dynamic `:aria-invalid=\"x\"` is\n * caught even when `x` is falsy at mount. Locks only ever accumulate —\n * once an attribute is authored, the directive leaves it alone for the\n * binding's lifetime.\n */\nexport function mergeAriaLocks(el: AriaCarrier, vnode: VNode): Set<string> {\n let locks = el[ariaLockKey]\n if (locks === undefined) {\n locks = new Set<string>()\n el[ariaLockKey] = locks\n }\n const props = vnode.props\n if (props !== null) {\n for (const attr of MANAGED_ARIA_ATTRS) {\n if (attr in props) locks.add(attr)\n }\n }\n return locks\n}\n\nfunction setAriaAttr(el: HTMLElement, attr: string, value: string | null): void {\n if (value === null) el.removeAttribute(attr)\n else el.setAttribute(attr, value)\n}\n\n/**\n * The desired value for one managed aria attribute given the binding's\n * required flag and gated display state, or `null` when the attribute\n * should be absent. Shared by the DOM path (`applyAria`) so the\n * screen-reader signal stays in lockstep with the visible error state.\n * Binding to the gated display state (not raw `errors`) keeps the\n * signal honest about whether the consumer's `getDisplayState`\n * predicate has admitted the verdict for surfacing.\n */\nfunction resolveAriaValue(attr: string, rv: RegisterValue, ds: DisplayState): string | null {\n switch (attr) {\n case 'aria-invalid':\n return ds === 'error' ? 'true' : null\n case 'aria-busy':\n return ds === 'pending' ? 'true' : null\n case 'aria-required':\n return rv.isRequired === true ? 'true' : null\n case 'aria-describedby':\n return ds === 'error' && rv.aria?.errorId !== undefined ? rv.aria.errorId : null\n default:\n return null\n }\n}\n\n/**\n * Reflect the binding's gated display state onto the unmanaged aria\n * attributes. Each managed attr is set or removed independently.\n */\nexport function applyAria(el: AriaCarrier, rv: RegisterValue): void {\n if (rv.ariaEnabled !== true || rv.ariaDisplayState === undefined) return\n const locks = el[ariaLockKey] ?? EMPTY_ARIA_LOCKS\n const ds = rv.ariaDisplayState.value\n for (const attr of MANAGED_ARIA_ATTRS) {\n if (!locks.has(attr)) setAriaAttr(el, attr, resolveAriaValue(attr, rv, ds))\n }\n}\n\n/**\n * Begin managing aria for a binding: lock authored attrs, paint the\n * initial state, and watch `ariaDisplayState` in its own effect scope\n * so async validation ticks update the attributes even when no parent\n * re-render fires. No-op when this binding has aria disabled.\n */\nexport function setupAria(el: AriaCarrier, rv: RegisterValue, vnode: VNode): void {\n if (rv.ariaEnabled !== true || rv.ariaDisplayState === undefined) return\n mergeAriaLocks(el, vnode)\n applyAria(el, rv)\n const displayState = rv.ariaDisplayState\n const scope = effectScope(true)\n scope.run(() => {\n watch(displayState, () => applyAria(el, rv), { flush: 'post' })\n })\n el[ariaScopeKey] = (): void => scope.stop()\n}\n\n/**\n * Compute the aria props that should be emitted into the rendered\n * markup for an SSR / static render. Mirrors `applyAria`'s computation\n * but returns a props bag instead of mutating the DOM, so Vue's\n * `getSSRProps` directive hook can pass the same managed attributes\n * through the server's render pipeline. Authored attrs are honoured at\n * the vnode-prop level (the same source of truth `mergeAriaLocks`\n * reads on the client). Returns `undefined` when the binding has no\n * aria opt-in to mirror the directive contract that \"no aria\" means\n * \"no SSR props.\"\n */\nexport function getSSRAriaProps(\n rv: RegisterValue,\n vnode: VNode | null\n): Record<string, string> | undefined {\n if (rv.ariaEnabled !== true || rv.ariaDisplayState === undefined) return undefined\n const props = vnode?.props ?? null\n const ds = rv.ariaDisplayState.value\n const out: Record<string, string> = {}\n for (const attr of MANAGED_ARIA_ATTRS) {\n if (props !== null && attr in props) continue\n const value = resolveAriaValue(attr, rv, ds)\n if (value !== null) out[attr] = value\n }\n return out\n}\n\n/**\n * Stop managing aria: tear down the watch and clear only the attributes\n * the directive set (authored attrs stay). Gated on an active scope so\n * a binding that never managed aria leaves the element's attributes\n * untouched.\n */\nexport function teardownAria(el: AriaCarrier): void {\n const stop = el[ariaScopeKey]\n if (stop === undefined) return\n stop()\n delete el[ariaScopeKey]\n const locks = el[ariaLockKey] ?? EMPTY_ARIA_LOCKS\n for (const attr of MANAGED_ARIA_ATTRS) {\n if (!locks.has(attr)) el.removeAttribute(attr)\n }\n delete el[ariaLockKey]\n}\n","import type { RegisterValue } from '../types/types-api'\n\n/**\n * Per-element bag of listener tuples added by the active directive\n * variant in `created`. `vRegisterDynamic.beforeUnmount` (and the file\n * variant's `beforeUnmount`) drain the bag so reused elements\n * (KeepAlive, v-show) don't accumulate orphaned handlers across\n * activation cycles. Shared between every directive variant — both\n * the multi-tag variants in `directive.ts` and the file variant in\n * `directive-file.ts` — so the carrier symbol lives here and the\n * single `addEventListener` / `removeTrackedListeners` pair routes\n * every variant through one tracked path.\n *\n * `Symbol.for(...)` so duplicate copies of attaform agree on the\n * slot (a single-window app with two pinned versions, or an\n * SSR-hydration race where the bundles haven't fully agreed yet,\n * still see one bag per element).\n */\nconst listenersKey: unique symbol = Symbol.for('attaform:directive-listeners')\n\ntype TrackedListener = {\n event: string\n handler: EventListener\n // Explicitly `undefined`-able so `exactOptionalPropertyTypes` lets us\n // stash tuples where the caller didn't pass options.\n options: EventListenerOptions | undefined\n}\n\ntype ListenerCarrier = { [listenersKey]?: TrackedListener[] }\n\n/**\n * Attach an event listener and remember the tuple on the element so a\n * matching `removeTrackedListeners` later can detach it. A bare\n * `addEventListener` without tracking would leak across KeepAlive\n * re-activations where the DOM node is reused.\n */\nexport function addTrackedListener(\n el: Element,\n event: string,\n handler: EventListener,\n options?: EventListenerOptions\n): void {\n el.addEventListener(event, handler, options)\n const carrier = el as ListenerCarrier\n const bag = carrier[listenersKey] ?? []\n bag.push({ event, handler, options })\n carrier[listenersKey] = bag\n}\n\n/**\n * Detach every listener the active directive variant attached in\n * `created`, regardless of whether the binding is still a valid\n * RegisterValue. Called from `beforeUnmount` so an element re-used by\n * KeepAlive / v-show starts clean on its next activation cycle.\n */\nexport function removeTrackedListeners(el: Element): void {\n const carrier = el as ListenerCarrier\n const bag = carrier[listenersKey]\n if (bag === undefined) return\n for (const { event, handler, options } of bag) {\n el.removeEventListener(event, handler, options)\n }\n delete carrier[listenersKey]\n}\n\n/**\n * First genuine user-input event flips the field's sticky `interacted`\n * bit — the signal `defaultDisplayState` reads to keep a clean\n * tab-through quiet while still engaging validation the moment the\n * user edits. Routed only through DOM listeners, so hydration and\n * programmatic setValue never trip it. Idempotent and store-guarded\n * on the RegisterValue side.\n *\n * Takes `unknown` rather than `RegisterValue` so directive variants\n * can call it on `binding.value` without re-running the type guard at\n * every event firing site.\n */\nexport function noteInteraction(value: unknown): void {\n if (isRegisterValueLike(value)) value.markInteracted()\n}\n\nfunction isRegisterValueLike(val: unknown): val is RegisterValue {\n return (\n typeof val === 'object' &&\n val !== null &&\n 'markInteracted' in val &&\n typeof (val as { markInteracted: unknown }).markInteracted === 'function'\n )\n}\n","/**\n * The v-register assigner pipeline: the machinery that turns a DOM-side\n * value into a committed form write. Lifted out of `directive.ts` into\n * this leaf module so `directive-file.ts` can import `fireAssigner` /\n * `setAssignFunction` without re-creating the `directive.ts` <->\n * `directive-file.ts` import cycle.\n *\n * Owns the `assignKey` symbol slot, the default / consumer-wrapped\n * assigner tags + predicates, the `transforms: [...]` runner (sync-fast,\n * async-deferred), coercion application, and the `getModelAssigner` /\n * `setAssignFunction` install path. The directive definitions (text /\n * checkbox / radio / select) live in `directive.ts` and call in here.\n */\nimport { invokeArrayFns, isArray, isFunction } from './vue-shared-shim'\nimport type { VNode } from 'vue'\nimport { warn } from 'vue'\nimport { isRegisterValue } from './register-protocol'\nimport { __DEV__ } from './dev'\nimport type {\n CustomDirectiveRegisterAssignerFn,\n InternalRegisterValue,\n RegisterTransform,\n RegisterValue,\n TransformAbortHolder,\n TransformContext,\n} from '../types/types-api'\nimport type { PathKey } from './paths'\n\n/**\n * Symbol slot used by custom directive integrations to install an\n * assigner on the bound element. Read by the v-register directive\n * when a DOM event fires:\n *\n * ```ts\n * import { assignKey } from 'attaform'\n * el[assignKey] = (value) => myCustomWriter(value)\n * ```\n *\n * Most consumers never need this — the built-in directives wire\n * default assigners for text inputs, checkboxes, radios, and selects.\n */\n// `Symbol.for(...)` so `el[assignKey] = ...` round-trips across\n// duplicate copies of attaform. The directive (which writes the\n// default assigner) and the consumer-side composables/utilities (which\n// may read or override it) must agree on the key, or the directive\n// stops recognising consumer-installed assigners after the page is\n// served from a Vite-optimised copy that's distinct from the one the\n// directive registration came from. Same reasoning for `listenersKey`\n// and `DEFAULT_ASSIGNER_TAG` below.\nexport const assignKey: unique symbol = Symbol.for('attaform:assign-key')\n\n/**\n * Symbol-tagged on default-installed assigners so listener bodies can\n * tell \"no consumer override\" from \"consumer-installed assigner\". The\n * bail check (`shouldBailListener`) uses this to avoid the bubbled-\n * write bug for non-supported roots: the default assigner reading\n * `el.value` off a `<div>` would clobber form state with `''` /\n * `undefined` on every keystroke from a descendant input. A consumer-\n * installed assigner (via `assignKey` or `onUpdate:registerValue`)\n * has explicitly opted into reading whatever the listener captures,\n * so the bail doesn't apply.\n */\nconst DEFAULT_ASSIGNER_TAG: unique symbol = Symbol.for('attaform:default-assigner-tag')\n\ntype DefaultAssignerCarrier = { [DEFAULT_ASSIGNER_TAG]?: boolean }\n\nexport function isDefaultAssigner(fn: unknown): boolean {\n return typeof fn === 'function' && (fn as DefaultAssignerCarrier)[DEFAULT_ASSIGNER_TAG] === true\n}\n\n/**\n * Symbol-tagged on wrappers `getModelAssigner` produces for the\n * `@update:registerValue` install path. The tag lets `fireAssigner`\n * recognize an already-wrapped consumer handler and call it raw\n * (the wrapper already runs transforms + coerce + supplies `rv`).\n * Without the tag, fire-time would re-wrap and apply transforms\n * twice for that install path.\n */\nconst CONSUMER_WRAPPED_TAG: unique symbol = Symbol.for('attaform:consumer-wrapped-assigner')\n\ntype ConsumerWrappedCarrier = { [CONSUMER_WRAPPED_TAG]?: boolean }\n\nfunction isConsumerWrapped(fn: unknown): boolean {\n return typeof fn === 'function' && (fn as ConsumerWrappedCarrier)[CONSUMER_WRAPPED_TAG] === true\n}\n\n/**\n * Fire-time entry point for invoking whatever currently sits at\n * `el[assignKey]`. Replaces direct `el[assignKey]?.(value)` calls so\n * the directive's two consumer-install paths produce the same fire-\n * time contract:\n *\n * - `@update:registerValue` (vnode-prop listener): wrapped at\n * `created`-time by `getModelAssigner`, tagged with\n * `CONSUMER_WRAPPED_TAG`. Called raw here — its own body runs\n * `runTransforms` + `applyCoerce` and supplies `rv` to the user\n * handler.\n * - `el[assignKey] = fn` (pre- or post-install via companion\n * directive / `onMounted` / ref-callback): raw consumer fn,\n * untagged. JIT-wrapped here so the user sees the same\n * `(post-transform-post-coerce value, rv)` shape.\n *\n * The default-tagged sentinel runs its own pipeline internally and is\n * also called raw. A `registerValue` that isn't a `RegisterValue`\n * (e.g. `useRegister` returned `undefined` AND a consumer pre-\n * installed an assigner before `setAssignFunction` would have\n * installed the noop) falls through with `(value, undefined)` —\n * defensive; the documented happy path always has a real `rv`.\n */\nexport function fireAssigner(\n el: HTMLElement & { [k: symbol]: CustomDirectiveRegisterAssignerFn },\n registerValue: unknown,\n value: unknown\n): boolean | undefined {\n const fn = el[assignKey]\n if (fn === undefined) return undefined\n if (isDefaultAssigner(fn) || isConsumerWrapped(fn)) {\n return fn(value)\n }\n if (!isRegisterValue(registerValue)) {\n return fn(value, undefined)\n }\n // JIT-wrap the raw consumer fn: it gets the resolved, coerced value\n // (sync, or via the async kickoff). No `syncDom` — a consumer-installed\n // assigner owns its own DOM.\n return wrapWithTransforms(\n value,\n registerValue,\n (coerced) => fn(coerced, registerValue),\n undefined\n )\n}\n\n/**\n * Result of running a field's `transforms: [...]` pipeline. The chain\n * stays byte-for-byte synchronous until a transform returns a thenable;\n * only then does the result switch to `kind: 'async'`, handing the caller\n * a `run` thunk (the deferred remainder of the chain) plus the run's\n * abort `holder` so the deferred orchestrator can open a store-backed run\n * and commit the resolved value.\n *\n * - `kind: 'sync', ok: true` → committed-ready value (today's fast path).\n * - `kind: 'sync', ok: false` → a sync transform threw; the write aborts\n * (the helper already logged via `console.error`).\n * - `kind: 'async'` → a transform returned a thenable. `run`\n * resolves to the post-chain value (or rejects on a downstream throw /\n * rejection); `holder` carries the lazy abort signal.\n */\ntype TransformResult =\n | { kind: 'sync'; ok: true; value: unknown }\n | { kind: 'sync'; ok: false }\n | { kind: 'async'; run: () => Promise<unknown>; holder: TransformAbortHolder }\n\n/**\n * A transform as the runner invokes it: the public `RegisterTransform`\n * receives the transform context as its second argument. The cast is\n * internal to the call site — `RegisterTransform`'s public single-arg\n * shape stays the stable surface; passing `ctx` to a body that ignores\n * it is a no-op.\n */\ntype CtxTransform = (value: unknown, ctx: TransformContext) => unknown\n\n/**\n * Thenable check (not `instanceof Promise`) so a cross-realm or\n * non-native promise still routes async.\n */\nfunction isThenable(x: unknown): x is PromiseLike<unknown> {\n return (\n x !== null &&\n (typeof x === 'object' || typeof x === 'function') &&\n typeof (x as { then?: unknown }).then === 'function'\n )\n}\n\n/**\n * Build the lazy transform context for one pipeline run. `ctx.signal`\n * materializes its `AbortController` only on first access, so a chain\n * that never reaches for it allocates nothing. The store latches\n * `holder.aborted` at teardown, so a signal touched AFTER the run was\n * superseded is born aborted rather than live.\n */\nfunction makeTransformContext(): { ctx: TransformContext; holder: TransformAbortHolder } {\n const holder: TransformAbortHolder = { controller: null, aborted: false }\n const ctx: TransformContext = {\n get signal(): AbortSignal {\n if (holder.controller === null) {\n holder.controller = new AbortController()\n if (holder.aborted) holder.controller.abort()\n }\n return holder.controller.signal\n },\n }\n return { ctx, holder }\n}\n\n/**\n * Apply the field's transform pipeline to a value. Each transform runs\n * inside a per-call try/catch so a buggy or defensive-throw transform\n * doesn't crash the host app.\n *\n * The chain is sync-fast: while each transform returns a non-thenable the\n * loop stays synchronous (no Promise allocation, no abort controller, no\n * busy state) and the result commits in the same tick — byte-for-byte\n * today's behavior. The moment a transform returns a thenable, that index\n * and everything after it are captured in a `run` thunk and handed back\n * as a `kind: 'async'` result; the directive's deferred orchestrator\n * opens a store-backed run, awaits it, and commits the resolved value\n * (latest-request-wins).\n *\n * On a sync throw the pipeline aborts (subsequent transforms don't run),\n * nothing is written, and the caller returns `false`. An async failure (a\n * downstream throw or a rejected thenable) rejects `run` instead — the\n * orchestrator routes it to `field.transformError` with no console noise\n * (a network / file failure is an expected channel, not a programmer bug).\n *\n * `transforms` on `RegisterValue` is optional (test fixtures and custom\n * integrations can omit it); a missing array short-circuits to the\n * original value with no allocation (not even a ctx).\n */\nfunction runTransforms(initial: unknown, registerValue: RegisterValue): TransformResult {\n const transforms = registerValue.transforms\n if (transforms === undefined || transforms.length === 0) {\n return { kind: 'sync', ok: true, value: initial }\n }\n const { ctx, holder } = makeTransformContext()\n let v = initial\n for (let i = 0; i < transforms.length; i++) {\n const fn = transforms[i] as RegisterTransform\n let out: unknown\n try {\n out = (fn as CtxTransform)(v, ctx)\n } catch (err) {\n logTransformFailure(registerValue.path, i, fn, err)\n return { kind: 'sync', ok: false }\n }\n if (isThenable(out)) {\n // Switch to async for this index and everything after it. The\n // remaining transforms run in a `.then` chain seeded from the\n // thenable; a throw or rejection anywhere downstream rejects `run`,\n // which the orchestrator turns into `field.transformError`.\n const rest = transforms.slice(i + 1) as RegisterTransform[]\n const seed = out\n const run = (): Promise<unknown> =>\n rest.reduce<Promise<unknown>>(\n (acc, next) => acc.then((value) => (next as CtxTransform)(value, ctx)),\n Promise.resolve(seed)\n )\n return { kind: 'async', run, holder }\n }\n v = out\n }\n return { kind: 'sync', ok: true, value: v }\n}\n\n/**\n * Drive a deferred (async) transform run to its commit. Opens a store-\n * backed run through the RegisterValue's lifecycle hooks (the directive\n * never holds the store), awaits the chain, and — only if this run is\n * still the live one (latest-request-wins) — commits the resolved value\n * and repaints the bound element. Every path ends in `endTransform`, and\n * the whole thing is `.then`-guarded so a rejected transform never\n * escapes as an unhandled rejection.\n *\n * `commit` is the write step (default assigner → `setValueWithInternalPath`;\n * a consumer override → invoke the handler). `syncDom` repaints the bound\n * element from the freshly-committed storage; it is `undefined` on\n * consumer-override paths, where the consumer owns its own DOM.\n */\nfunction kickoffAsyncTransform(\n rv: InternalRegisterValue,\n holder: TransformAbortHolder,\n run: () => Promise<unknown>,\n commit: (coerced: unknown) => boolean | undefined,\n syncDom: (() => void) | undefined\n): void {\n const token = rv.beginTransform(holder)\n void run().then(\n (value) => {\n const live = rv.isCurrentTransform(token)\n // Release this run BEFORE committing. The commit funnels through the\n // store's write chokepoint, which supersedes in-flight transforms on\n // the path (latest-write-wins) — ending first means a transform\n // landing its OWN resolved value isn't caught by that supersede.\n rv.endTransform(token)\n if (!live) return\n const coerced = applyCoerce(value, rv)\n const wrote = commit(coerced)\n // A `false` commit is the slim-primitive gate refusing the resolved\n // value — surface it on `transformError` and leave the DOM showing\n // the user's raw input rather than reverting to stale storage. A\n // successful (or override-`undefined`) commit repaints to the\n // normalized result.\n if (wrote === false) rv.setTransformError(transformGateRejectedError(rv.path))\n else syncDom?.()\n },\n (err: unknown) => {\n // A rejection on a superseded / cancelled run (commonly an\n // AbortError) is silently discarded — only the live run's failure\n // reaches the consumer.\n if (rv.isCurrentTransform(token)) rv.setTransformError(toTransformError(err))\n rv.endTransform(token)\n }\n )\n}\n\n/**\n * Log a transform throw. Dev message includes path, index, transform name,\n * remediation hint, and the original error (with message + stack). Prod\n * message is a fixed string with NONE of those — transform bodies are\n * consumer code we don't control, so error messages and stack frames are\n * an information-leak surface (consumer-typed values, file paths, internal\n * function names). Set `NODE_ENV=development` to surface details.\n */\nfunction logTransformFailure(\n path: PathKey,\n index: number,\n fn: RegisterTransform,\n err: unknown\n): void {\n if (__DEV__) {\n const namePart = fn.name !== '' ? `, '${fn.name}'` : ''\n console.error(\n `[attaform] transform threw for path '${path}' (index ${index}${namePart}) — ` +\n `write aborted. Transforms must not throw; wrap your own try/catch if the throw is recoverable. ` +\n `Original error:`,\n err\n )\n } else {\n console.error(\n `[attaform] transform error — write aborted (set NODE_ENV=development for details).`\n )\n }\n}\n\n/**\n * Apply the field's coerce closure (built at register-time by\n * `buildCoerceFn`) to a post-transform value. Identity when the\n * RegisterValue is a hand-rolled mock that omits the field, or when\n * coercion was disabled / no coerction target was resolved at the\n * path. The closure itself runs the registry rule, post-validates\n * the result, and falls back to the original on any rule failure\n * (throw, wrong-kind, NaN) — see `schema-coerce.ts` for details.\n */\nexport function applyCoerce(value: unknown, registerValue: RegisterValue): unknown {\n return registerValue.coerce !== undefined ? registerValue.coerce(value) : value\n}\n\n/**\n * Run one write through the transform pipeline, then commit it. The\n * shared skeleton behind every assigner (`fireAssigner` plus\n * `getModelAssigner`'s override / multi-listener / default variants):\n * run transforms; when a transform goes async, hand off to\n * `kickoffAsyncTransform` and return `true` so the listener treats the\n * write as accepted; on a sync throw abort with `false`; otherwise\n * coerce and pass the value to `commit`.\n *\n * `commit` receives the post-transform, post-coerce value on the sync\n * path and (via the kickoff) on the async path. `syncDom` repaints the\n * bound element after an async commit; it is `undefined` on\n * consumer-override paths that own their own DOM.\n */\nfunction wrapWithTransforms(\n value: unknown,\n registerValue: RegisterValue,\n commit: (coerced: unknown) => boolean | undefined,\n syncDom: (() => void) | undefined\n): boolean | undefined {\n const r = runTransforms(value, registerValue)\n if (r.kind === 'async') {\n kickoffAsyncTransform(registerValue as InternalRegisterValue, r.holder, r.run, commit, syncDom)\n return true\n }\n if (!r.ok) return false\n const coerced = applyCoerce(r.value, registerValue)\n return commit(coerced)\n}\n\n/**\n * Normalize a rejected async transform's reason into an `Error` for the\n * `field.transformError` channel. Mirrors the submit path's `toError`,\n * with transform-appropriate wording for the rare non-Error rejection.\n */\nfunction toTransformError(value: unknown): Error {\n if (value instanceof Error) return value\n const message =\n typeof value === 'string' && value.length > 0\n ? value\n : `Transform rejected with a non-Error value (${typeof value})`\n return new Error(message, { cause: value })\n}\n\n/**\n * The error surfaced on `field.transformError` when an async transform\n * resolved a value the field's slim-primitive gate refused (the commit\n * returned `false`). A structured channel the consumer reads, not a\n * console log, so naming the field path is safe here.\n */\nfunction transformGateRejectedError(path: PathKey): Error {\n return new Error(\n `[attaform] transform result for path '${path}' was rejected by the field's type gate ` +\n `(the resolved value did not fit the schema slot).`\n )\n}\n\nconst getModelAssigner = (\n el: HTMLElement & { _syncFromStorage?: () => void },\n vnode: VNode,\n registerValue: RegisterValue\n): CustomDirectiveRegisterAssignerFn => {\n // developer escape hatch — Vue wires `onUpdate:registerValue` as either a\n // single function or an array of functions depending on how many listeners\n // are bound. We narrow before dispatching.\n //\n // Both shapes invoke the consumer's handler as `(value, registerValue)` so\n // a top-level handler can call `rv.setValueWithInternalPath(value)` to\n // forward the write into form state without having to capture `rv` via\n // closure. The RV auto-attaches per-element persistence meta from its\n // bound element when no `meta` is supplied — same code path the\n // default assigner below uses. Advanced consumers who want to suppress\n // (or override) persistence on a specific write pass an explicit\n // `meta` second argument; the RV honors it verbatim.\n //\n // Vue 3.5's compiler emits TWO different prop keys for `@update:registerValue`\n // depending on context. For native elements with an uppercase letter in the\n // event name (e.g. the `V` in `registerValue`), the compiler preserves\n // casing via the `on:` prefix form: `\"on:update:registerValue\"`. For\n // components, vnode lifecycle events, or all-lowercase event names, it\n // emits `\"onUpdate:registerValue\"`. Render-function authors using `h(...)`\n // pick whichever key they like. We read both forms; for components the\n // `onUpdate:` form normally wins, for plain `<input v-register>` the\n // `on:update:` form is what survives the compiler.\n // See @vue/compiler-core/transformOn (search for `[A-Z]/.test(rawName)`).\n const fn: unknown =\n vnode.props?.['onUpdate:registerValue'] ?? vnode.props?.['on:update:registerValue']\n if (isArray(fn)) {\n const fnArr = fn.filter((x) => isFunction(x)) as ((...args: unknown[]) => unknown)[]\n const wrapped: CustomDirectiveRegisterAssignerFn = (value) => {\n // Transforms run BEFORE the override sees the value. A consumer\n // who declared `transforms: [...]` intended \"always normalize\"; a\n // silent bypass on override would be the surprise. If they want\n // raw, they don't register transforms.\n // Schema-driven coerce runs AFTER transforms (the final type-fixup\n // before storage); override handlers receive the coerced value. The\n // multi-listener case has no single boolean to surface, so commit\n // returns undefined (\"succeeded\"), matching the single-handler\n // contract. No `syncDom` — a consumer override owns its own DOM.\n return wrapWithTransforms(\n value,\n registerValue,\n (coerced) => {\n invokeArrayFns(fnArr, coerced, registerValue)\n return undefined\n },\n undefined\n )\n }\n ;(wrapped as unknown as ConsumerWrappedCarrier)[CONSUMER_WRAPPED_TAG] = true\n return wrapped\n }\n if (isFunction(fn)) {\n const handler = fn as CustomDirectiveRegisterAssignerFn\n const wrapped: CustomDirectiveRegisterAssignerFn = (value) => {\n return wrapWithTransforms(\n value,\n registerValue,\n (coerced) => handler(coerced, registerValue),\n undefined\n )\n }\n ;(wrapped as unknown as ConsumerWrappedCarrier)[CONSUMER_WRAPPED_TAG] = true\n return wrapped\n }\n // Default-installed assigner. Tagged so the listener-body bail\n // (`shouldBailListener`) can distinguish it from consumer overrides\n // and prevent the bubbled-write bug on non-supported roots.\n //\n // Returns the underlying setValue boolean so listeners (e.g.\n // vRegisterSelect's change handler) can detect rejection and gate\n // post-write side effects like the `_assigning` flag.\n const defaultAssigner: CustomDirectiveRegisterAssignerFn = (value) => {\n // Schema-aware undefined short-circuit: when the path admits\n // undefined and the commit IS undefined (the text-input listener\n // mapped a DOM clear), skip transforms + coerce. Consumer-supplied\n // transforms today never receive undefined, so passing it through\n // would force every existing transform to add a `if (v == null)`\n // guard. Treat undefined as the schema-side absent signal that\n // bypasses normalization. Coerce already passes undefined cleanly\n // for paths that admit it, so skipping is a clarity win.\n if (value === undefined && registerValue.acceptsUndefined) {\n // Meta omitted on purpose: the RV's `setValueWithInternalPath`\n // auto-derives `{ persist: hasOptIn(elementId, path) }` from its\n // bound element when no meta is supplied. Same auto-derivation\n // path consumer-installed assigners get for free.\n return registerValue.setValueWithInternalPath(undefined)\n }\n // Default write path. On the async branch the resolved value lands\n // via setValueWithInternalPath, then `_syncFromStorage` (captured at\n // `created`-time) repaints the bound element; returning `true` lets\n // the listener skip its synchronous force-sync (the write is already\n // in flight — `isTransforming(value)` is true).\n return wrapWithTransforms(\n value,\n registerValue,\n (coerced) => registerValue.setValueWithInternalPath(coerced),\n el._syncFromStorage\n )\n }\n ;(defaultAssigner as unknown as DefaultAssignerCarrier)[DEFAULT_ASSIGNER_TAG] = true\n return defaultAssigner\n}\n\nfunction makeNoopAssigner(): CustomDirectiveRegisterAssignerFn {\n const noop: CustomDirectiveRegisterAssignerFn = (_) => undefined\n // Tag so `shouldBailListener` recognizes this as the default,\n // alongside the real default-model assigner.\n ;(noop as unknown as DefaultAssignerCarrier)[DEFAULT_ASSIGNER_TAG] = true\n return noop\n}\n\nexport function setAssignFunction(\n el: HTMLElement & { [AssignKey: symbol]: CustomDirectiveRegisterAssignerFn },\n vnode: VNode,\n value: RegisterValue<unknown> | undefined\n) {\n // Pre-install respect: if the consumer installed `el[assignKey]`\n // BEFORE this directive's `created` hook ran (e.g. via a companion\n // directive ordered first in `withDirectives`, or by a custom\n // element's constructor), preserve their assigner across the\n // entire directive lifecycle. The default assigner is a fallback\n // for the common case where nobody overrides; it should NEVER\n // clobber an explicit consumer override.\n //\n // Wrappers produced by `getModelAssigner` for the\n // `@update:registerValue` install path are tagged with\n // `CONSUMER_WRAPPED_TAG`; bailing on them too would freeze the\n // listener at the first vnode's prop value, so a parent re-render\n // that swaps the handler reference would never take effect. Allow\n // re-derivation in that case — the freshly produced wrapper closes\n // over the new vnode's prop function.\n const current = el[assignKey]\n if (current !== undefined && !isDefaultAssigner(current) && !isConsumerWrapped(current)) {\n return\n }\n\n // Invariant 4: `v-register=\"undefined\"` is a graceful no-op. The\n // composable `useRegister()` returns `ComputedRef<undefined>` when\n // a child is rendered standalone (no parent passed registerValue);\n // the inner `<input v-register=\"register\">` lands undefined here\n // and we silently install a no-op assigner. The composable already\n // emitted its own dev-warn at the call site, so a second warn from\n // the directive would be redundant noise.\n //\n // Other non-RegisterValue types still fall through to the warn —\n // those are likely typos (passing a string, an object literal, the\n // form API itself, etc.) and the developer benefits from a hint.\n if (value === undefined) {\n el[assignKey] = makeNoopAssigner()\n return\n }\n if (!isRegisterValue(value)) {\n warn(\n `v-register expected a RegisterValue, got '${typeof value}'. ` +\n `Bind to form.register('field') — not the field's ref, value, or path string.`\n )\n el[assignKey] = makeNoopAssigner()\n return\n }\n\n el[assignKey] = getModelAssigner(el, vnode, value)\n}\n","import { effectScope, warn, watch, type VNode } from 'vue'\nimport type {\n CustomDirectiveRegisterAssignerFn,\n RegisterModelDynamicCustomDirective,\n RegisterValue,\n} from '../types/types-api'\nimport { __DEV__ } from './dev'\nimport { addTrackedListener, noteInteraction, removeTrackedListeners } from './directive-listeners'\nimport type { PathKey } from './paths'\nimport type { PersistOptInRegistry } from './persistence/opt-in-registry'\nimport { fireAssigner, setAssignFunction } from './assigner-pipeline'\nimport { isRegisterValue, isTransforming } from './register-protocol'\n\n/**\n * True for any value the file directive treats as \"no file selected\":\n * `null`, `undefined`, the empty array (multi-input cleared), and an\n * empty `FileList`. Strict equality short-circuits the common cases;\n * the FileList check covers the case where a host wrote the live DOM\n * FileList back into storage (rare, but cheap to handle).\n */\nfunction isBlankFileValue(value: unknown): boolean {\n if (value === null || value === undefined) return true\n if (Array.isArray(value) && value.length === 0) return true\n if (typeof FileList !== 'undefined' && value instanceof FileList && value.length === 0)\n return true\n return false\n}\n\n/**\n * Whether this file input is `multiple`, reliably at any lifecycle point.\n *\n * The DOM `el.multiple` property is NOT yet applied inside a directive's\n * `created` hook (Vue patches an element's attributes AFTER its directive\n * `created` hooks run), so the created-time blank-seed can't trust it — a\n * stale `false` makes it seed the single-file shape (`null`) into an array\n * path, which the slim-primitive gate rejects with a dev warning. Read the\n * authored vnode prop instead, falling back to the DOM property for the\n * post-mount callers where it IS live. `multiple` is a boolean attribute:\n * present as `true` or `''`, absent otherwise.\n */\nfunction isMultipleInput(el: HTMLInputElement, vnode: VNode): boolean {\n if (el.multiple) return true\n const authored = vnode.props?.['multiple']\n return authored === true || authored === ''\n}\n\n/**\n * Read the current selection off a file input and reshape to the\n * directive's canonical storage form: `File[]` when the element has\n * the `multiple` attribute, `File | null` otherwise. `el.files` is\n * `null` on programmatically-detached inputs and the FileList is\n * empty when the user picked nothing — both collapse to the blank\n * shape.\n */\nfunction readFilesFromInput(el: HTMLInputElement): File[] | File | null {\n const files = el.files\n if (el.multiple) {\n return files === null ? [] : Array.from(files)\n }\n if (files === null || files.length === 0) return null\n return files.item(0)\n}\n\n/**\n * Per-form dedupe for the persisted-file-input dev warning. Keyed on\n * the form's `PersistOptInRegistry` (every form has its own instance)\n * so the warning fires once per (form, path) — a single noisy hint\n * during development rather than per-mount, per-keystroke noise.\n */\nconst warnedPersistedFileForms: WeakMap<PersistOptInRegistry, Set<PathKey>> | null = __DEV__\n ? new WeakMap<PersistOptInRegistry, Set<PathKey>>()\n : null\n\nfunction maybeWarnPersistedFile(value: RegisterValue): void {\n if (!__DEV__ || warnedPersistedFileForms === null) return\n if (value.persist !== true) return\n let warnedPaths = warnedPersistedFileForms.get(value.persistOptIns)\n if (warnedPaths === undefined) {\n warnedPaths = new Set<PathKey>()\n warnedPersistedFileForms.set(value.persistOptIns, warnedPaths)\n }\n if (warnedPaths.has(value.path)) return\n warnedPaths.add(value.path)\n warn(\n `[attaform] register('${value.path}', { persist: true }) on <input type=\"file\"> — ` +\n `files can't ride a refresh (browsers block programmatic writes to ` +\n `<input type=\"file\">), so this path won't be saved. For long-lived ` +\n `flows, upload on selection and persist the resulting URL or ID in a ` +\n `sibling string field.`\n )\n}\n\n/**\n * Symbol slot for the per-element effect-scope teardown function. The\n * blank-resync watcher inside `created` runs in its own scope so we\n * can stop it on `beforeUnmount` without depending on the surrounding\n * component still being alive.\n */\nconst fileScopeKey: unique symbol = Symbol.for('attaform:file-scope')\ntype FileScopeCarrier = { [fileScopeKey]?: () => void }\n\n/**\n * Real `v-register` variant for `<input type=\"file\">`. Reads\n * `event.target.files` into form state as `File | null` (single) or\n * `File[]` (multiple). Storage is the canonical blank shape (`null` /\n * `[]`) when no file is selected, with the path marked in\n * `blankPaths` so the friendly \"No value supplied\" error surfaces\n * through `derivedBlankErrors` on required-file fields — same channel\n * as required numbers / bigints.\n *\n * The persistence carve-out lives in `syncPersistOptIn`: file paths\n * never enter `persistOptIns`, never serialize, never rehydrate. The\n * `beforeUpdate` hook keeps the DOM in lockstep with storage by\n * clearing `el.value` when storage transitions to blank — the only\n * programmatic write browsers permit on file inputs.\n */\nexport const vRegisterFile: RegisterModelDynamicCustomDirective = {\n created(el, { value }, vnode) {\n if (!isRegisterValue(value)) return\n // `resolveDynamicModel` routes here only when `el.tagName === 'INPUT'`\n // and `el.type === 'file'`. The variant union type widens to include\n // select/textarea, so narrow once per hook. The dynamic directive's `el`\n // (unlike the `CustomRegisterDirective` variants) doesn't carry the\n // assign-key symbol index, so widen to the assigner carrier here — the\n // shared `setAssignFunction` / `fireAssigner` both read `el[assignKey]`.\n const input = el as HTMLInputElement & { [k: symbol]: CustomDirectiveRegisterAssignerFn }\n value.registerElement(input)\n // Install the shared assigner (the default writer, or a consumer\n // `@update:registerValue` override) so a file selection routes through the\n // same transform + coerce + async-orchestration pipeline as every other\n // input variant. A `transforms: [...]` chain on a file path now runs\n // (sync or async); an async transform drives the busy / pending / settle\n // machinery exactly as on a text input.\n setAssignFunction(input, vnode, value)\n maybeWarnPersistedFile(value)\n\n // Seed the blank-path channel on register. Storage shape gets\n // canonicalised to `null` / `[]` whenever the consumer's default\n // is loosely blank (e.g. `undefined` for a non-nullable\n // `z.file()` schema), so reads return a uniform shape regardless\n // of how the user expressed \"optional file\" in their schema.\n const currentRaw = value.innerRef.value\n if (isBlankFileValue(currentRaw)) {\n const blankShape: File[] | null = isMultipleInput(input, vnode) ? [] : null\n value.setValueWithInternalPath(blankShape, { blank: true })\n }\n\n addTrackedListener(input, 'change', () => {\n noteInteraction(value)\n const next = readFilesFromInput(input)\n // A cleared selection (no file) is a clear, not a normalize: commit the\n // canonical blank shape directly and skip the pipeline. Only a real\n // selection flows through `fireAssigner`, so `transforms: [...]` runs and\n // `coerce` post-fixes the normalized result. An async transform returns\n // the queued sentinel here; the deferred orchestrator commits the\n // resolved value once it lands (latest-pick-wins on a rapid re-select).\n if (isBlankFileValue(next)) {\n value.setValueWithInternalPath(next, { blank: true })\n return\n }\n fireAssigner(input, value, next)\n })\n\n // Watch storage for programmatic transitions to the blank shape\n // (`form.clear(path)` / `form.reset()` / hydrate). Re-mark the\n // path blank and clear the DOM input. `beforeUpdate` covers the\n // common parent-re-render case; this watcher catches storage\n // mutations that don't trigger a parent re-render. Runs in its\n // own effect scope so we can stop it from `beforeUnmount`\n // independent of the surrounding component.\n const scope = effectScope(true)\n scope.run(() => {\n watch(\n value.innerRef,\n (next) => {\n if (!isBlankFileValue(next)) return\n value.setValueWithInternalPath(next, { blank: true })\n if (input.value !== '') input.value = ''\n },\n { flush: 'post' }\n )\n })\n ;(input as FileScopeCarrier)[fileScopeKey] = (): void => scope.stop()\n },\n beforeUpdate(el, { value }) {\n if (!isRegisterValue(value)) return\n const input = el as HTMLInputElement\n // Storage → DOM + blankPaths sync. Two responsibilities:\n //\n // 1. Clear the DOM input when storage went blank\n // (`form.clear(path)` / `form.reset()` / hydrate). `el.value\n // = ''` is the one programmatic mutation browsers allow on\n // `<input type=\"file\">`.\n //\n // 2. Re-mark the path blank in the store so `derivedBlankErrors`\n // keeps firing the friendly \"No value supplied\" message after\n // programmatic clears. `form.clear` writes the schema's empty\n // value (`null`) but doesn't propagate `meta.blank: true`, so\n // the path would otherwise drift out of `blankPaths`. The\n // store's `Set.add` is idempotent, and identity-equal writes\n // don't trigger re-renders — safe to call on every update.\n //\n // Skip entirely while an async transform is in flight: storage is\n // transiently still the blank shape (the deferred commit hasn't landed)\n // even though the user already has a file selected. Re-marking blank here\n // would funnel through the write chokepoint and cancel the live run, and\n // clearing `el.value` would erase the selection mid-flight. The deferred\n // commit (or an explicit clear) settles both once the run lands.\n const currentRaw = value.innerRef.value\n if (isBlankFileValue(currentRaw) && !isTransforming(value)) {\n value.setValueWithInternalPath(currentRaw, { blank: true })\n if (input.value !== '') input.value = ''\n }\n },\n beforeUnmount(el, { value }) {\n removeTrackedListeners(el)\n const stop = (el as FileScopeCarrier)[fileScopeKey]\n if (stop !== undefined) {\n stop()\n delete (el as FileScopeCarrier)[fileScopeKey]\n }\n if (!isRegisterValue(value)) return\n value.deregisterElement(el)\n },\n}\n","import type { PathKey } from '../paths'\n\n/**\n * Per-element identity for the persistence opt-in registry.\n *\n * Why WeakMap-keyed monotonic counter:\n * - **No DOM mutation.** A `data-atta-id` attribute would alter SSR\n * output and risk hydration discrepancies. WeakMap is invisible.\n * - **Auto-GC.** When the element is removed from the DOM and goes\n * out of all references, the WeakMap entry vanishes — no leak.\n * - **Counter over UUID.** Element IDs never cross runtime boundaries\n * (the directive that consumes them is client-only), so collision\n * resistance across processes is irrelevant. Smaller, easier to\n * debug (\"el-7\" vs a UUID).\n */\nconst idGenerator = (() => {\n let counter = 0\n return () => `el-${++counter}`\n})()\n\nconst elementIds = new WeakMap<HTMLElement, string>()\n\nexport function getOrAssignElementId(el: HTMLElement): string {\n let id = elementIds.get(el)\n if (id === undefined) {\n id = idGenerator()\n elementIds.set(el, id)\n }\n return id\n}\n\n/**\n * Per-FormStore registry tracking which DOM elements have opted into\n * persistence for which paths. Lives on the FormStore so that two SFCs\n * sharing a key share the registry — opt-ins are per-element, not\n * per-component.\n *\n * The directive's input handler computes `meta.persist` for each write\n * by calling `hasOptIn(elementId, path)` — only THIS element's writes\n * persist if THIS element opted in. Other call sites that aren't tied\n * to a single element (history undo/redo, field-array helpers, devtools\n * edits) use `hasAnyOptInForPath(path)` — persist if any element has\n * opted into that path.\n *\n * Internal data structure: `Map<PathKey, Set<elementId>>`. Small forms\n * have ~10-50 paths; iteration is cheap. All operations are O(1) given\n * (id, path).\n */\nexport type PersistOptInRegistry = {\n /** Add an opt-in entry; idempotent. */\n add(elementId: string, path: PathKey): void\n /** Remove a single (element, path) entry. */\n remove(elementId: string, path: PathKey): void\n /** Remove every opt-in for `elementId`. Called from directive's beforeUnmount. */\n removeAllFor(elementId: string): void\n /** Check whether THIS element has opted into THIS path. */\n hasOptIn(elementId: string, path: PathKey): boolean\n /** Check whether ANY element has opted into this path. */\n hasAnyOptInForPath(path: PathKey): boolean\n /** Iterate every path that currently has at least one opt-in. */\n optedInPaths(): IterableIterator<PathKey>\n /** True iff no element has opted into any path. */\n isEmpty(): boolean\n /** Drop every entry. Called from FormStore.dispose. */\n clear(): void\n}\n\nexport function createPersistOptInRegistry(): PersistOptInRegistry {\n const byPath = new Map<PathKey, Set<string>>()\n\n function add(elementId: string, path: PathKey): void {\n const existing = byPath.get(path)\n if (existing === undefined) {\n byPath.set(path, new Set([elementId]))\n return\n }\n existing.add(elementId)\n }\n\n function remove(elementId: string, path: PathKey): void {\n const existing = byPath.get(path)\n if (existing === undefined) return\n existing.delete(elementId)\n if (existing.size === 0) byPath.delete(path)\n }\n\n function removeAllFor(elementId: string): void {\n for (const [path, ids] of byPath) {\n if (!ids.delete(elementId)) continue\n if (ids.size === 0) byPath.delete(path)\n }\n }\n\n function hasOptIn(elementId: string, path: PathKey): boolean {\n return byPath.get(path)?.has(elementId) ?? false\n }\n\n function hasAnyOptInForPath(path: PathKey): boolean {\n const ids = byPath.get(path)\n return ids !== undefined && ids.size > 0\n }\n\n function optedInPaths(): IterableIterator<PathKey> {\n return byPath.keys()\n }\n\n function isEmpty(): boolean {\n return byPath.size === 0\n }\n\n function clear(): void {\n byPath.clear()\n }\n\n return {\n add,\n remove,\n removeAllFor,\n hasOptIn,\n hasAnyOptInForPath,\n optedInPaths,\n isEmpty,\n clear,\n }\n}\n","import { __DEV__ } from '../dev'\nimport type { Path, PathKey, Segment } from '../paths'\n\n/**\n * The library's built-in conservative set of identifier name stems that\n * flag a path segment as \"this looks like data the consumer almost\n * certainly does not want serialised to client-side storage or\n * broadcast across tabs.\"\n *\n * Each entry is a NAME STEM, not a regex. Matching is case-insensitive\n * and tolerant of separator variants — `'card_number'` matches the\n * segments `'card_number'`, `'card-number'`, `'cardNumber'`, and\n * `'cardnumber'`. Short stems (compact length ≤ 5) get word-boundary\n * anchors to avoid common false positives — `'pin'` matches `'pin'`\n * and `'user_pin'` but not `'pinned'`; `'token'` matches `'token'` but\n * not `'tokenizer'`. Longer stems match anywhere (`'password'` matches\n * `'password'`, `'passwords'`, `'userPassword'`).\n *\n * Consumers extend or replace via per-form or global config:\n *\n * ```ts\n * createAttaform({\n * defaults: { sensitiveNames: [...DEFAULT_SENSITIVE_NAMES, 'mrn', 'tax_id'] }\n * })\n * ```\n *\n * The same resolved predicate gates persistence writes and multi-tab\n * sync broadcasts — one source of truth for \"what counts as sensitive\"\n * across those surfaces. (DevTools renders raw values by design.)\n *\n * **Non-goals.** This is not a soundness guarantee. Adversarial paths\n * (`'sensitive_data'`, `'CCV'` instead of `'CVV'`) can slip through.\n * The intent is a code-review trigger for the common-case footgun\n * plus a defense-in-depth filter on the cross-tab and DevTools\n * surfaces.\n */\nexport const DEFAULT_SENSITIVE_NAMES: readonly string[] = Object.freeze([\n // Passwords + PIN-like\n 'password',\n 'passwd',\n 'pwd',\n 'pin',\n // Card / payment\n 'cvv',\n 'cvc',\n 'card_number',\n 'card_num',\n 'card',\n 'iban',\n 'routing_number',\n 'account_number',\n // Government / identity\n 'ssn',\n 'social_security',\n 'dob',\n 'date_of_birth',\n 'passport',\n 'driver_license',\n // Tax IDs\n 'tin',\n 'ein',\n 'itin',\n 'tax_id',\n // Tokens / secrets / API auth\n 'token',\n 'tokens',\n 'secret',\n 'secrets',\n 'api_key',\n 'api_secret',\n 'api_token',\n 'private_key',\n 'bearer',\n 'oauth',\n 'auth_token',\n 'access_token',\n 'refresh_token',\n 'session_id',\n 'session_key',\n 'session_token',\n // MFA / OTP\n 'otp',\n 'one_time_password',\n 'one_time_code',\n 'mfa_secret',\n 'mfa_seed',\n 'mfa_code',\n 'mfa_token',\n 'two_factor_code',\n 'two_factor_token',\n '2fa',\n '2fa_code',\n '2fa_token',\n 'recovery_code',\n 'backup_code',\n])\n\n/**\n * Compact-length threshold below which a stem gets word-boundary\n * anchors. Tuned so `'pin'`, `'card'`, `'token'` get boundary\n * protection (avoiding `'pinned'`, `'cards'`, `'tokenizer'`) while\n * `'passwd'`, `'secret'`, `'tokens'` match as substring (catching\n * camelCase variants like `'userPassword'`).\n */\nconst WORD_BOUNDARY_THRESHOLD = 5\n\nfunction escapeRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * Build a single case-insensitive regex from a name stem. Underscores,\n * hyphens, and spaces in the input become `[_\\s-]?` (optional\n * separator) so `'card_number'` tolerates `'cardNumber'`,\n * `'card-number'`, `'cardnumber'`, and `'card number'` alike.\n */\nfunction nameToRegex(name: string): RegExp {\n const parts = name.split(/[_\\s-]/).filter((p) => p.length > 0)\n if (parts.length === 0) {\n // Pathological input (empty / all-separator); produce a regex that\n // matches nothing rather than throwing — keeps the caller's\n // composition surface forgiving.\n return /(?!)/\n }\n const escaped = parts.map(escapeRegex).join('[_\\\\s-]?')\n const compactLength = parts.reduce((sum, p) => sum + p.length, 0)\n const useBoundary = compactLength <= WORD_BOUNDARY_THRESHOLD\n const source = useBoundary ? `\\\\b${escaped}\\\\b` : escaped\n return new RegExp(source, 'i')\n}\n\nfunction namesToPatterns(names: readonly string[]): readonly RegExp[] {\n const patterns: RegExp[] = []\n for (const name of names) {\n if (typeof name !== 'string' || name.length === 0) continue\n patterns.push(nameToRegex(name))\n }\n return patterns\n}\n\nconst DEFAULT_PATTERNS = namesToPatterns(DEFAULT_SENSITIVE_NAMES)\n\n/**\n * Factory: returns a closure that tests a single Segment against the\n * resolved name list. `createIsSensitivePath` composes it to test the\n * segments of a full path.\n *\n * Pass an empty array to disable the heuristic entirely (no segment\n * counts as sensitive). Omitting the argument uses the library\n * default list.\n */\nexport function createSegmentMatchesSensitive(\n names: readonly string[] = DEFAULT_SENSITIVE_NAMES\n): (segment: Segment) => boolean {\n const patterns = names === DEFAULT_SENSITIVE_NAMES ? DEFAULT_PATTERNS : namesToPatterns(names)\n return (segment: Segment) => {\n if (typeof segment !== 'string') return false\n for (const p of patterns) {\n if (p.test(segment)) return true\n }\n return false\n }\n}\n\n/**\n * Factory: returns a closure that tests a path (structured `Path`,\n * dotted-string, or canonical JSON `PathKey`) against the resolved\n * name list. True iff ANY segment matches.\n *\n * Same predicate gates persistence writes, multi-tab broadcasts, AND\n * the DevTools edit-rejection check — consumers configure once via\n * `sensitiveNames` and every surface respects it.\n */\nexport function createIsSensitivePath(\n names: readonly string[] = DEFAULT_SENSITIVE_NAMES\n): (path: Path | PathKey | string) => boolean {\n const segmentMatches = createSegmentMatchesSensitive(names)\n return (path: Path | PathKey | string) => {\n if (typeof path !== 'string') {\n for (const segment of path) {\n if (segmentMatches(segment)) return true\n }\n return false\n }\n // String input: try JSON-array first (PathKey), fall back to dotted.\n if (path.startsWith('[')) {\n try {\n const parsed = JSON.parse(path) as unknown[]\n if (Array.isArray(parsed)) {\n for (const segment of parsed) {\n if (segmentMatches(segment as Segment)) return true\n }\n return false\n }\n } catch {\n // fall through to dotted parse\n }\n }\n for (const segment of path.split('.')) {\n if (segmentMatches(segment)) return true\n }\n return false\n }\n}\n\nconst defaultIsSensitivePath = createIsSensitivePath()\n\n/**\n * True iff any segment of the path matches the LIBRARY DEFAULT\n * sensitive-name list. For consumer-configurable matching, use\n * `createIsSensitivePath(list)` to build a per-form closure.\n */\nexport function isSensitivePath(path: Path | PathKey | string): boolean {\n return defaultIsSensitivePath(path)\n}\n\n/**\n * Dev-only dedup for the sensitive-persist warning. The directive's\n * opt-in sync re-runs on every render, so without this a static\n * sensitive field would warn on every re-render. `null` in production so\n * the Set allocation tree-shakes out.\n */\nconst warnedSensitivePersist: Set<string> | null = __DEV__ ? new Set<string>() : null\n\n/**\n * Decide whether `path` may be opted into persistence. A sensitive-named\n * path opted in WITHOUT `acknowledgeSensitive: true` is refused — the\n * opt-in is skipped and a one-shot dev warning is logged. The library\n * never throws here: a misconfigured persist flag must not take down the\n * consumer's app, and the safe fallback (not persisting the secret) is\n * exactly the secure default. Returns `true` when the path may persist,\n * `false` when it was blocked.\n *\n * The optional `isSensitive` predicate lets call sites pass the per-form\n * resolved closure; omit to use the library default list.\n */\nexport function allowSensitivePersist(\n path: Path | PathKey | string,\n acknowledged: boolean,\n isSensitive: (p: Path | PathKey | string) => boolean = defaultIsSensitivePath\n): boolean {\n if (acknowledged) return true\n if (!isSensitive(path)) return true\n if (warnedSensitivePersist !== null) {\n const display = Array.isArray(path) ? path.join('.') : String(path)\n if (!warnedSensitivePersist.has(display)) {\n warnedSensitivePersist.add(display)\n console.warn(\n `[attaform] Not persisting \"${display}\" — it matches a sensitive-name pattern ` +\n `(password / cvv / ssn / token / etc.) and was opted into persistence without ` +\n '`acknowledgeSensitive: true`. Storing sensitive data in client-side storage is a ' +\n 'compliance risk (PII / PCI-DSS / HIPAA / SOC2). Persist it server-side, or pass ' +\n '`acknowledgeSensitive: true` to register() / form.persist() if this is intentional.'\n )\n }\n }\n return false\n}\n\n/**\n * Test-only: reset the one-shot dedup so subsequent\n * `allowSensitivePersist` calls warn fresh. Mirrors\n * `resetInsecureContextWarnDedup`.\n */\nexport function resetSensitivePersistWarnDedup(): void {\n warnedSensitivePersist?.clear()\n}\n","import type { RegisterValue } from '../types/types-api'\nimport { isRegisterValue } from './register-protocol'\nimport { getOrAssignElementId } from './persistence/opt-in-registry'\nimport { allowSensitivePersist } from './persistence/sensitive-names'\n\n/**\n * Idempotent reconciliation of a single element's opt-in across the\n * directive lifecycle. Called from `created` (oldValue undefined),\n * `beforeUpdate` (oldValue the previous RegisterValue), and as a\n * convenience from `beforeUnmount` (value undefined).\n *\n * Handles every transition: persist flag flipping in either direction,\n * `register()` path changing (e.g. dynamic v-for index), and the\n * cross-form / cross-SFC case where `register()` returns a value bound\n * to a different FormStore (different `persistOptIns` instance).\n */\nexport function syncPersistOptIn(\n el: HTMLElement,\n value: unknown,\n oldValue: unknown,\n vnodeType: unknown\n): void {\n const wasOptedIn = isRegisterValue(oldValue) && oldValue.persist === true\n // File inputs can't survive a reload — `input.files` is read-only at\n // the browser layer, so even a perfect base64 round-trip couldn't\n // restore the picked file. The registry carve-out lives here so the\n // path never enters `optedInPaths`, never reaches the serializer, and\n // a separate `vRegisterFile` hook can surface the one-time dev warn\n // pointing consumers at the upload-on-select pattern.\n //\n // Detection consults `vnode.props.type` (passed in) first, then\n // `el.type` as a fallback. During `created`, Vue may not have\n // patched the `type` property onto the element yet — the vnode's\n // prop is the authoritative pre-patch source. On `beforeUpdate` the\n // element is fully patched and `el.type` agrees.\n const isFileInput =\n el.tagName === 'INPUT' && (vnodeType === 'file' || (el as HTMLInputElement).type === 'file')\n const wantsOptIn = !isFileInput && isRegisterValue(value) && value.persist === true\n if (!wasOptedIn && !wantsOptIn) return\n const elementId = getOrAssignElementId(el)\n // Detach the old opt-in unless every dimension matches (persist still\n // requested, same canonical path, same registry instance).\n if (wasOptedIn) {\n const old = oldValue as RegisterValue\n const samePathAndRegistry =\n wantsOptIn &&\n (value as RegisterValue).path === old.path &&\n (value as RegisterValue).persistOptIns === old.persistOptIns\n if (!samePathAndRegistry) {\n old.persistOptIns.remove(elementId, old.path)\n }\n }\n // Attach the new opt-in. `add` is idempotent, so if oldValue already\n // had the same (path, registry) we just re-touch the same entry.\n // The sensitive-name check fires here (not on every keystroke) — it's\n // the act of OPTING IN that crosses the compliance threshold.\n if (wantsOptIn) {\n const v = value as RegisterValue\n // A sensitive-named path opted in without `acknowledgeSensitive` is\n // warned + skipped (never thrown — this runs in the directive update\n // path). The unpersisted secret is the safe default.\n if (allowSensitivePersist(v.path, v.acknowledgeSensitive, v.isSensitivePath)) {\n v.persistOptIns.add(elementId, v.path)\n }\n }\n}\n\n/**\n * Reconcile the multi-tab sync OPT-OUT (`register('path',\n * { multiTab: false })`) across binding lifecycle transitions.\n * Symmetric with `syncPersistOptIn` for the multi-tab dimension.\n *\n * The RV's `markNoSync` / `unmarkNoSync` closures are pre-bound to\n * the canonical path key + the FormStore's ref-counted opt-out\n * registry (see `state.incrementNoSyncOptOut`). When `multiTab !==\n * false`, both closures are `undefined` and this function noops on\n * the hot path.\n *\n * Handles every transition:\n * - undefined → opted-out: increment\n * - opted-out → undefined: decrement\n * - opted-out → opted-out (same path): no-op (idempotent)\n * - opted-out → opted-out (path changed): decrement old, increment new\n */\nexport function syncMultiTabOptOut(value: unknown, oldValue: unknown): void {\n const wasOptedOut = isRegisterValue(oldValue) && oldValue.unmarkNoSync !== undefined\n const wantsOptOut = isRegisterValue(value) && value.markNoSync !== undefined\n if (!wasOptedOut && !wantsOptOut) return\n if (wasOptedOut) {\n const old = oldValue as RegisterValue\n const samePath = wantsOptOut && (value as RegisterValue).path === old.path\n if (!samePath) old.unmarkNoSync?.()\n }\n if (wantsOptOut) {\n const v = value as RegisterValue\n const samePathOld = wasOptedOut && (oldValue as RegisterValue).path === v.path\n if (!samePathOld) v.markNoSync?.()\n }\n}\n\n/**\n * Migrate the element's registration entry across binding-value\n * transitions. Symmetric with `syncPersistOptIn` for the\n * persistence opt-in dimension; this one tracks element-to-path\n * registration the form's element map relies on for\n * `getFieldState(path).meta.connected`, `focusFirstError`, and\n * `scrollToFirstError`.\n *\n * Cases:\n * - undefined → undefined: nothing to do.\n * - undefined → RV: register the new RV's element (the per-tag\n * `created` hook skipped this when the binding mounted with an\n * undefined value, so we have to catch up here).\n * - RV → undefined: deregister the old RV's element.\n * - RV → RV (same path + same form): skip the deregister side so\n * the `connected` flag doesn't thrash false → true on every\n * parent re-render. STILL call `registerElement` on the new RV:\n * `register('foo')` returns a fresh handle per render, and the\n * new RV owns its own bound-element reference (consumed by\n * `setValueWithInternalPath` to auto-attach per-element\n * persistence meta). `state.registerElement(path, el)` is\n * idempotent — a single Set membership check on the path's\n * element record.\n * - RV → RV (different path or different form): deregister old,\n * register new. Covers dynamic-path templates\n * (`v-register=\"form.register(\\`item.${i}\\`)\"`) and the\n * cross-form case where a wrapper component switches the\n * `registerValue` it forwards.\n */\nexport function syncElementRegistration(el: HTMLElement, value: unknown, oldValue: unknown): void {\n const wasRegistered = isRegisterValue(oldValue)\n const isRegistered = isRegisterValue(value)\n if (!wasRegistered && !isRegistered) return\n\n // Same path + same store: skip the deregister-then-register sequence\n // so the `connected` flag doesn't thrash false-true on every parent\n // re-render. But STILL call `registerElement` on the freshly closed-\n // over RV — `register()` returns a new RV per render, and the new RV\n // owns its own bound-element reference (consumed by\n // `setValueWithInternalPath` to auto-attach persistence meta).\n // `state.registerElement` is idempotent on (path, element) so the\n // re-call is a single Set membership check.\n const samePathAndStore =\n wasRegistered &&\n isRegistered &&\n oldValue.path === value.path &&\n oldValue.persistOptIns === value.persistOptIns\n\n if (wasRegistered && !samePathAndStore) {\n oldValue.deregisterElement(el)\n }\n if (isRegistered) {\n value.registerElement(el)\n }\n}\n","import { effectScope, watch, type WatchSource } from 'vue'\n\n/**\n * Per-element teardown slot for the value-sync watch. `Symbol.for(...)`\n * so duplicate copies of attaform agree on the slot across bundles.\n */\nconst valueSyncScopeKey: unique symbol = Symbol.for('attaform:value-sync-scope')\ntype ValueSyncCarrier = HTMLElement & {\n [valueSyncScopeKey]?: () => void\n}\n\n/**\n * ShadowRoot-aware \"is this element the focused one\" check. A\n * v-register'd control mounted inside a shadow tree reports its focus on\n * the rootNode, not on `document` — mirrors the activeElement lookup in\n * the directive's `beforeUpdate` and `register-api`'s focus probe.\n */\nfunction isElementFocused(el: HTMLElement): boolean {\n const rootNode = el.getRootNode()\n const activeElement =\n rootNode instanceof Document || rootNode instanceof ShadowRoot ? rootNode.activeElement : null\n return activeElement === el\n}\n\nexport interface ValueSyncOptions {\n /**\n * Skip the write while the element is focused. Set for text / textarea\n * so the watch never overwrites the user's in-flight edit or moves\n * their caret — the keystroke path and `beforeUpdate` own the focused\n * case. Left off for checkbox / radio / select: their DOM writes are\n * atomic and idempotent, so an external change must reflect even on a\n * focused control (that's the failure surface this closes), and the\n * in-flight-interaction window is guarded by `apply` itself (the\n * select's `_assigning` flag).\n */\n skipWhileFocused?: boolean\n}\n\n/**\n * Reactively mirror a register binding's reactive source onto the DOM for\n * changes that DON'T ride a host re-render:\n *\n * - cross-tab sync (`applyFormReplacement` from the multi-tab module),\n * - a sibling component's `setValue` / `reset` / `clear`,\n * - any imperative store write while the bound component's template\n * reads no field state (a display-only form never re-renders).\n *\n * The directive's `beforeUpdate` / `updated` hooks only fire on a host\n * re-render, so without this the store updates but the control stays\n * stale. `apply` performs the type-specific DOM write — `el.value` for\n * text, `el.checked` for checkbox / radio, `<option>.selected` for select\n * — and is the SAME write the re-render path runs, so both stay in\n * lockstep. Runs in its own effect scope, torn down by\n * `teardownValueSync` from the dispatcher's `beforeUnmount`.\n *\n * Mid-IME-composition writes are always skipped (text only; inert\n * elsewhere). A programmatic DOM write doesn't dispatch `input` / `change`,\n * so there's no write-back echo loop.\n */\nexport function setupValueSync(\n el: HTMLElement,\n source: WatchSource,\n apply: () => void,\n options: ValueSyncOptions = {}\n): void {\n const skipWhileFocused = options.skipWhileFocused === true\n const scope = effectScope(true)\n scope.run(() => {\n watch(\n source,\n () => {\n if ((el as { composing?: boolean }).composing === true) return\n if (skipWhileFocused && isElementFocused(el)) return\n apply()\n },\n { flush: 'post' }\n )\n })\n ;(el as ValueSyncCarrier)[valueSyncScopeKey] = (): void => scope.stop()\n}\n\n/**\n * Stop the value-sync watch. Gated on an active scope so an element that\n * never set one up is a no-op.\n */\nexport function teardownValueSync(el: HTMLElement): void {\n const carrier = el as ValueSyncCarrier\n const stop = carrier[valueSyncScopeKey]\n if (stop === undefined) return\n stop()\n delete carrier[valueSyncScopeKey]\n}\n","/**\n * Single source of truth for the set of HTML form-element tag names\n * Attaform treats as \"interactive value-bearing\" — the elements whose\n * default behaviour produces a model-relevant `change`/`input` event\n * and whose `value` / `checked` / `selectedIndex` properties the\n * v-register directive and `useRegister` composable own end-to-end.\n *\n * Both `directive.ts` (gate the unsupported-tag dev-warn + the\n * static-fallback path) and `register-api.ts` (gate focus/blur\n * listener attachment in the composable) read this same set. Pre-\n * dedup each file declared its own copy in a different order, with\n * nothing tying them together — the audit DIR-F2 flagged the silent-\n * drift risk that comes with two parallel sets gating the same\n * predicate.\n *\n * Tag names are uppercase to match `element.tagName` (the HTML spec\n * uppercases element tag names on the DOM side regardless of the\n * source's casing). Membership checks therefore work against the\n * native `.tagName` property without case normalization.\n */\nexport const INTERACTIVE_TAG_NAMES: ReadonlySet<string> = new Set(['INPUT', 'SELECT', 'TEXTAREA'])\n","/**\n * The `v-register` directive. Two-way binding with `v-model`-like\n * semantics, but writes go through the form's `RegisterValue` so\n * dirty / pristine / touched / errors stay coherent across the form.\n *\n * Bind to a native input, select, textarea, checkbox, or radio:\n *\n * ```vue\n * <input v-register=\"form.register('email')\" />\n * ```\n *\n * Installed automatically by `createAttaform()`; the export is\n * for advanced consumers who install directives manually. Works\n * identically under Nuxt, bare Vue CSR, and bare Vue +\n * `@vue/server-renderer` — Vue skips directive lifecycle hooks during\n * SSR, so the directive is a safe no-op server-side.\n */\nimport { isArray, isSet, looseEqual, looseIndexOf, looseToNumber } from './vue-shared-shim'\nimport type { DirectiveBinding, DirectiveHook, ObjectDirective, VNode } from 'vue'\nimport { nextTick, warn } from 'vue'\nimport {\n isRegisterValue,\n isTransforming,\n REGISTER_OWNER_MARKER,\n V_REGISTER_MARKER,\n} from './register-protocol'\nimport { __DEV__ } from './dev'\nimport {\n applyAria,\n getSSRAriaProps,\n mergeAriaLocks,\n setupAria,\n teardownAria,\n type AriaCarrier,\n} from './directive-aria'\nimport { vRegisterFile } from './directive-file'\nimport {\n syncElementRegistration,\n syncMultiTabOptOut,\n syncPersistOptIn,\n} from './directive-lifecycle'\nimport { addTrackedListener, noteInteraction, removeTrackedListeners } from './directive-listeners'\nimport { setupValueSync, teardownValueSync } from './directive-value-sync'\nimport { INTERACTIVE_TAG_NAMES } from './interactive-tags'\nimport type {\n InternalRegisterValue,\n RegisterCheckboxCustomDirective,\n RegisterModelDynamicCustomDirective,\n RegisterRadioCustomDirective,\n RegisterSelectCustomDirective,\n RegisterTextCustomDirective,\n RegisterValue,\n} from '../types/types-api'\nimport { getOrAssignElementId } from './persistence/opt-in-registry'\nimport {\n applyCoerce,\n assignKey,\n fireAssigner,\n isDefaultAssigner,\n setAssignFunction,\n} from './assigner-pipeline'\n\n// `assignKey` now lives in `assigner-pipeline.ts`; re-export it here so\n// the public `attaform` entry keeps exporting it from this module.\nexport { assignKey }\n\ntype ComposingTarget = (EventTarget & { composing: boolean }) | null\n\n/**\n * Write the directive-private `lastTypedForm` ref. Lives on the\n * `InternalRegisterValue` extension of `RegisterValue` (it's not part\n * of the public type), but every RV constructed by `register-api.ts`\n * carries it — so the cast captures a runtime invariant the type\n * system can't otherwise express. Used by the numeric-text listener\n * to surface the user's typed form (`'1e2'`) to `displayValue`\n * mid-typing without yanking the caret on the next render.\n */\nfunction writeLastTypedForm(rv: RegisterValue, next: string | null): void {\n ;(rv as InternalRegisterValue).lastTypedForm.value = next\n}\n\n/**\n * Listener-body bail. Called at the top of every event handler the\n * directive attaches. Bails when:\n * - the rendered root is a non-supported tag (where `el.value` is\n * meaningless), AND\n * - the assigner is the default (no consumer override).\n *\n * Catches two cases without needing instance-level sentinel detection:\n * 1. A `useRegister`-using child component — its rendered root is\n * usually a `<label>` / `<div>` / etc., and the inner\n * `<input v-register>` handles binding. The parent's directive's\n * listener on the rendered root would otherwise read `el.value`\n * off the wrapper and clobber the form.\n * 2. A bare `<div v-register>` with no escape hatch — same story,\n * the dev gets a deferred warn pointing at the recipe.\n *\n * Pre-installed `assignKey` AND `@update:registerValue` listener\n * shapes both bypass this bail (their assigner replaces the default,\n * stripping the tag). Post-installed `assignKey` (set via\n * `onMounted` or a ref callback) ALSO bypasses, because by the time\n * the next input event fires, the user's assigner is in place.\n */\nfunction shouldBailListener(el: HTMLElement): boolean {\n if (INTERACTIVE_TAG_NAMES.has(el.tagName)) return false\n return isDefaultAssigner((el as unknown as { [k: symbol]: unknown })[assignKey])\n}\n\n/**\n * Apply the field's element-level coerce closure (built at\n * register-time by `buildElementCoerceFn`) to a scalar DOM-side\n * value that should match an array/Set member. `coerceElement` is\n * only set on container paths; for scalar paths or when coercion\n * is disabled it's `undefined` and the raw value passes through.\n * Mirrors `applyCoerce` for the path-level case.\n */\nfunction applyElementCoerce(value: unknown, registerValue: RegisterValue): unknown {\n return registerValue.coerceElement !== undefined ? registerValue.coerceElement(value) : value\n}\n\nfunction onCompositionStart(e: Event) {\n const target = e.target as ComposingTarget\n if (!target) return\n\n target.composing = true\n}\n\nfunction onCompositionEnd(e: Event) {\n const target = e.target as ComposingTarget\n if (target?.composing === true) {\n target.composing = false\n target.dispatchEvent(new Event('input'))\n }\n}\n\n// We are exporting the v-model runtime directly as vnode hooks so that it can\n// be tree-shaken in case v-model is never used.\nconst vRegisterText: RegisterTextCustomDirective = {\n created(el, { value, modifiers: { lazy, trim, number } }, vnode) {\n // Static \"would this listener ever want to cast?\" gate for the\n // optional blur normalizer below. Read straight off vnode.props\n // at created-time because the modifier is what we're allowed to\n // freeze. Listener bodies re-derive `castToNumber` each fire\n // (see `liveCastToNumber`) so a dynamic `:type=\"...\"` swap is\n // honored against the post-patch DOM.\n const castToNumberAtCreated = number === true || vnode.props?.['type'] === 'number'\n const liveCastToNumber = (): boolean => number === true || el.getAttribute('type') === 'number'\n if (isRegisterValue(value)) {\n value.registerElement(el)\n setAssignFunction(el, vnode, value)\n }\n // Deferred async-transform repaint: paint the resolved/normalized\n // value into the input once the run commits (mirrors the post-write\n // force-sync below). Bare `<input v-register>` has no `innerRef`\n // watcher, so the orchestrator calls this directly rather than\n // relying on a parent re-render.\n el._syncFromStorage = (): void => {\n if (!isRegisterValue(value)) return\n const storage = value.innerRef.value\n const display = storage == null ? '' : String(storage)\n if (el.value !== display) el.value = display\n if (liveCastToNumber()) writeLastTypedForm(value, null)\n }\n addTrackedListener(el, lazy === true ? 'change' : 'input', (e) => {\n // Bail if this listener was attached on a non-supported root\n // (a `<label>` / `<div>` etc.) AND the assigner is the default.\n // The bubbled-write bug fires here without this guard: a\n // descendant's `input` event reaches this handler, reads\n // `el.value` off the wrapper (`''` in jsdom, `undefined` in\n // browsers), and clobbers the form. See `shouldBailListener`.\n if (shouldBailListener(el)) return\n const target = e.target as ComposingTarget\n if (target === null || target.composing) return\n noteInteraction(value)\n // Re-read per fire so a dynamic `:type=\"...\"` swap (text → number\n // or back) routes the next keystroke through the right branch.\n const castToNumber = liveCastToNumber()\n let domValue: string | number = el.value\n // Deferred-to-blur trim: only trim here when this listener is\n // already on `change` (i.e. `.lazy.trim`). Per-keystroke trim\n // on the `input` event fights Vue's `:value` patch — when the\n // user types a trailing space the trimmed write reaches the\n // model first, Vue's patch then sees `el.value` ahead of the\n // model and rewrites the DOM back to the trimmed form,\n // swallowing the space the user is still typing. The `change`-\n // bound normalization listener below catches the canonical\n // trimmed write at blur instead.\n if (trim === true && lazy === true) {\n domValue = domValue.trim()\n }\n if (castToNumber) {\n // Empty after the (deferred) trim — most commonly a backspace-\n // clear on `<input type=\"number\">` or a `.number` text input.\n // Mark the path blank rather than skipping silently:\n // storage gets the slim default (0), the UI shows blank via\n // `displayValue.value === ''`, and submit-time validation\n // raises \"No value supplied\" if the schema demands a number (the\n // public-housing footgun fix). Without this, the directive's\n // pre-fix skip-on-empty silently desynced storage from UI.\n //\n // `<input type=\"number\">` quirk: the browser blanks `el.value`\n // mid-typing for malformed input (`1e` is incomplete scientific\n // notation, so the browser hides the typed text from\n // `el.value` even though it's still visually in the DOM).\n // `validity.badInput` is `true` in that case and `false` for\n // a genuine empty field — we use it to distinguish a real\n // user-clear (mark) from a transient mid-edit (skip). Without\n // this guard, typing `1e` into a `type=\"number\"` field fires\n // `markBlank`, `displayValue` recomputes to `''`,\n // Vue patches the DOM and yanks the user's `1e` away.\n if (domValue === '') {\n // Guard against non-input elements with custom assigners\n // (the directive bails on default-assigner non-inputs via\n // `shouldBailListener`, but a consumer-installed assigner\n // can land on any tag — `validity` only exists on form\n // controls). The cast types `validity` as optional to\n // capture that shape.\n const validity = (el as { validity?: ValidityState }).validity\n if (validity?.badInput === true) {\n return\n }\n if (isRegisterValue(value)) {\n writeLastTypedForm(value, null)\n value.markBlank()\n }\n return\n }\n const typedString = domValue\n domValue = looseToNumber(domValue)\n if (typeof domValue !== 'number') {\n // Non-castable garbage like \"abc\" — text input with `.number`,\n // not protected by the beforeinput filter (e.g. consumer\n // pasted via JS or programmatic `el.value = 'abc'`). Treat\n // as the empty case so the gate's slim-primitive rejection\n // doesn't surface a dev warning for a transient mid-edit\n // state.\n if (isRegisterValue(value)) {\n writeLastTypedForm(value, null)\n value.markBlank()\n }\n return\n }\n if (!Number.isFinite(domValue)) {\n // Overflow: parseFloat returned Infinity / -Infinity for\n // values past Number.MAX_VALUE (e.g. `1e309`). Don't commit\n // — Zod's z.number() rejects non-finite, and\n // JSON.stringify() renders Infinity as `null`, both confusing\n // for devs and downstream consumers. Snap the DOM back to\n // the last good displayValue so the user gets immediate\n // visual feedback that their input was rejected (analogous\n // to a native `<input type=\"number\" max>` cap). Storage\n // stays at whatever the last finite write committed.\n if (isRegisterValue(value)) {\n const target = value.displayValue.value\n if (el.value !== target) el.value = target\n }\n return\n }\n // Castable: record the user's typed string so `displayValue`\n // surfaces it mid-typing. Storage commits real-time via the\n // assigner below; without `lastTypedForm`, Vue's `:value`\n // patch would write `String(cast)` (e.g. `'100'`) into the\n // DOM and yank the user away from the `1e2` they're typing.\n // The blur normalizer clears `lastTypedForm` so the post-blur\n // DOM matches storage exactly.\n if (isRegisterValue(value)) writeLastTypedForm(value, typedString)\n }\n // Schema-aware DOM clear: when the user empties an `.optional()`\n // string field, write `undefined` to storage rather than `''`.\n // Otherwise an `.optional()` schema's \"absent\" semantic would be\n // unreachable from the DOM once the user has typed anything, and\n // schemas like `z.string().email().optional()` would lock in a\n // permanent validation error after a clear (storage `''` is\n // neither undefined nor a valid email). Only the text path\n // reaches here — the castToNumber branch above already returns\n // for empty input, and `slimDefault` resolves to undefined for\n // an optional number leaf, so `markBlank` writes the right thing\n // there already.\n //\n // When the path doesn't admit string AND doesn't admit\n // undefined (e.g. required `z.number()` rendered as a plain\n // text input), short-circuit through `markBlank` for the same\n // reason `castToNumber` does: the empty-string write would be\n // rejected by the slim-primitive gate, and the post-write\n // force-sync below would then snap the DOM back to the stored\n // numeric — making the final character undeletable.\n if (\n domValue === '' &&\n isRegisterValue(value) &&\n !value.acceptsString &&\n !value.acceptsUndefined\n ) {\n writeLastTypedForm(value, null)\n value.markBlank()\n return\n }\n const commit =\n domValue === '' && isRegisterValue(value) && value.acceptsUndefined ? undefined : domValue\n fireAssigner(el, value, commit)\n // After the default assigner runs, force-sync the DOM when\n // storage diverges from the post-cast/post-trim `domValue`.\n // Two cases produce no Vue re-render and so leave the\n // imperative `beforeUpdate` DOM-from-storage sync stranded:\n // 1. A `transforms` pipeline mutated the write to a value\n // identical to current storage (a clamp at the cap, an\n // idempotent normalize, a coerce that re-emits the prior\n // stored shape) — `setValueWithInternalPath` produces no\n // patch, no reactive trigger, no render.\n // 2. The slim-primitive gate (or a transform-throw) silently\n // rejected the write — storage stays at the prior value,\n // again no render.\n // Either way the DOM keeps the user's raw typed text divorced\n // from storage. Comparing post-cast `domValue` (not the raw\n // typed string) preserves the typed-form contract: typing\n // `1e2` against a number schema casts to 100, storage updates\n // to 100, post-cast `domValue === storage`, no force-sync —\n // the user keeps seeing `1e2` mid-typing.\n //\n // Gated on `isDefaultAssigner` because custom assigners\n // (`@update:registerValue`, pre-installed `el[assignKey]`)\n // own their own DOM/storage relationship — they may write to\n // a different store, defer / batch / debounce, or intentionally\n // not update `innerRef.value`. The default assigner's contract\n // (\"a successful write reflects in `innerRef.value` immediately\")\n // is what makes the post-write storage comparison meaningful.\n if (isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !isTransforming(value)) {\n const storage = value.innerRef.value\n if (storage !== domValue) {\n const display = storage == null ? '' : String(storage)\n if (el.value !== display) el.value = display\n if (castToNumber) writeLastTypedForm(value, null)\n }\n }\n })\n if (trim === true || castToNumberAtCreated) {\n addTrackedListener(el, 'change', () => {\n if (shouldBailListener(el)) return\n // Mirror Vue's `castValue(el.value, trim, castToNumber)` so the\n // visible DOM normalizes after blur for both modifiers — without\n // the cast branch, a user typing ` 12 ` into a `.number` input\n // sees ` 12 ` stick after blur instead of `12`.\n let normalized: string | number = el.value\n if (trim === true) normalized = normalized.trim()\n // Re-derive each fire so a `:type` swap is honored at blur too.\n // The installation gate above is the static \"could this input\n // ever want cast-on-blur\" check, but the body's branch picks\n // up the current type per fire.\n const castToNumber = liveCastToNumber()\n if (castToNumber) {\n const cast = looseToNumber(normalized)\n if (typeof cast === 'number' && Number.isFinite(cast)) {\n // Blur: clear the typed-form override so `displayValue`\n // returns `String(storage)`. The DOM then patches to the\n // canonical form (`'1e2'` → `'100'`, `'01'` → `'1'`,\n // `'1.'` → `'1'`). Honest by design — what the user sees\n // after blur matches what's in storage. The model commit\n // is gated on `lazy !== true` because the lazy listener\n // already wrote on the same change event ahead of this\n // handler.\n if (isRegisterValue(value)) writeLastTypedForm(value, null)\n el.value = String(cast)\n if (lazy !== true) fireAssigner(el, value, cast)\n } else {\n // Uncastable mid-edit residue (lone '.', '-', 'abc') OR\n // overflow (`1e309` parses to Infinity). Native\n // `<input type=\"number\">` blur behaviour clears in both\n // cases; we match that. The keystroke listener has\n // already markBlank'd uncastable input under\n // non-lazy, but under `.lazy.number` (or for an overflow\n // pasted directly via the change event) this is the first\n // chance, so re-mark defensively.\n if (isRegisterValue(value)) {\n writeLastTypedForm(value, null)\n value.markBlank()\n }\n el.value = ''\n }\n return\n }\n el.value = typeof normalized === 'number' ? String(normalized) : normalized\n // Catch up the model on blur for non-lazy `.trim`. The input\n // listener wrote the raw mid-typing value (deferred trim);\n // here on `change` we commit the canonical trimmed form so\n // the DOM and the model agree once the user leaves the\n // field. Under `.lazy.trim`, the input listener (on\n // `change`) already wrote the trimmed value, so this branch\n // skips to avoid a redundant duplicate write.\n if (trim === true && lazy !== true) {\n fireAssigner(el, value, normalized)\n }\n })\n }\n if (lazy !== true) {\n addTrackedListener(el, 'compositionstart', onCompositionStart)\n addTrackedListener(el, 'compositionend', onCompositionEnd)\n // Safari < 10.2 & UIWebView doesn't fire compositionend when\n // switching focus before confirming composition choice\n // this also fixes the issue where some browsers e.g. iOS Chrome\n // fires \"change\" instead of \"input\" on autocomplete.\n addTrackedListener(el, 'change', onCompositionEnd)\n }\n // `.number` × text input — block non-numeric characters at the\n // DOM layer so `el.value` never holds garbage. Native\n // `<input type=\"number\">` already filters at the browser layer,\n // so we skip the listener there to avoid double-filtering. The\n // regex allows an optional leading `-`, a single `.`, any number\n // of digits, and an optional scientific-notation suffix\n // (`[eE][+-]?\\d*`) so devs get parity with native `type=\"number\"`\n // for inputs like `1e3`. Partial states (just `-`, `1.`, `1e`,\n // `1e-`) are accepted as the user is still typing; the blur\n // normalizer commits the cast value (or clears the DOM if the\n // residue is non-castable). Composition events\n // (`insertCompositionText`) aren't blocked — IME input proceeds\n // normally and the directive's `compositionend` handler catches\n // the final value.\n if (number === true && vnode.props?.['type'] !== 'number') {\n addTrackedListener(el, 'beforeinput', (e) => {\n const ev = e as InputEvent\n if (\n ev.inputType !== 'insertText' &&\n ev.inputType !== 'insertFromPaste' &&\n ev.inputType !== 'insertFromDrop'\n ) {\n return\n }\n const data = ev.data\n if (data === null) return\n const start = el.selectionStart ?? 0\n const end = el.selectionEnd ?? 0\n const next = el.value.slice(0, start) + data + el.value.slice(end)\n if (!/^-?\\d*\\.?\\d*([eE][+-]?\\d*)?$/.test(next)) ev.preventDefault()\n })\n }\n },\n // set value on mounted so it's after min/max for type=\"range\"\n mounted(el, { value }) {\n if (!isRegisterValue(value)) return\n\n // Read through `displayValue` rather than `innerRef`: it's the\n // string projection that already honours `blankPaths` (returns\n // `''` for a numeric leaf marked blank, even though storage\n // holds the slim default `0`). Without this, the storage `0`\n // round-trips to `'0'` here and the change handler at blur\n // sees `el.value === '0'`, casts to 0, and writes-back through\n // the assigner — wiping the blank flag and locking the user\n // out of the empty display state.\n el.value = value.displayValue.value\n\n // Reactive value sync: `beforeUpdate` only repaints the DOM when the\n // host component re-renders, so a form mutation that originates\n // outside this component (cross-tab sync, a sibling's setValue /\n // reset / clear, any imperative write while the template reads no\n // field state) wouldn't reach the input. Watch `displayValue` in its\n // own scope to close that gap — torn down via `teardownValueSync` in\n // the dispatcher's `beforeUnmount`. Focus-gated so it never disturbs\n // an in-flight edit; `beforeUpdate` writes the same target value.\n setupValueSync(\n el,\n value.displayValue,\n () => {\n const next = value.displayValue.value\n if (el.value !== next) el.value = next\n },\n { skipWhileFocused: true }\n )\n },\n beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim } }, vnode) {\n setAssignFunction(el, vnode, value)\n // Skip the el.value sync while the user is mid-IME-composition;\n // overwriting `el.value` would clobber the unresolved input.\n if ((el as { composing?: boolean }).composing === true) return\n if (!isRegisterValue(value)) return\n\n // `displayValue` is the canonical string view: it folds in the\n // blank/unset rule (returns `''` for blank-marked numeric\n // leaves) AND the typed-form preference (`lastTypedForm` so\n // mid-typing `'1e2'` doesn't get clobbered by a sibling\n // re-render). String comparison against the live DOM is honest:\n // pre-fix this branch parsed `el.value` through `looseToNumber`\n // and compared against raw storage, which paints `'0'` over a\n // blank-empty DOM on every reactive update.\n const target = value.displayValue.value\n if (el.value === target) {\n return\n }\n\n // ShadowRoot-aware activeElement check: a v-register'd input mounted\n // inside a shadow tree's `activeElement` lives on the rootNode, not\n // on `document`. Falling back to `document.activeElement === el` for\n // shadow-mounted inputs would always be `false`, defeating the\n // lazy/trim escape-hatches below.\n const rootNode = el.getRootNode()\n const activeElement =\n rootNode instanceof Document || rootNode instanceof ShadowRoot ? rootNode.activeElement : null\n if (activeElement === el && el.type !== 'range') {\n // Lazy escape: the consumer chose `change`-only updates. While\n // the user is still editing, suppress reverse-syncs that would\n // otherwise revert their typing on every parent re-render.\n if (lazy === true && value.innerRef.value === oldValue) {\n return\n }\n // Trim escape: same rationale — the trimmed-but-otherwise-equal\n // value is what we'd land on at blur anyway, so don't fight the\n // user's whitespace mid-typing.\n if (trim === true && el.value.trim() === target) {\n return\n }\n }\n\n el.value = target\n },\n}\n\nconst vRegisterCheckbox: RegisterCheckboxCustomDirective = {\n // #4096 array checkboxes need to be deep traversed\n deep: true,\n created(el, { value }, vnode) {\n if (!isRegisterValue(value)) return\n\n value.registerElement(el)\n setAssignFunction(el, vnode, value)\n // Deferred async-transform repaint: re-apply checked-state from the\n // committed value once the run lands (mirrors the post-write force-\n // sync below).\n el._syncFromStorage = (): void => {\n if (!isRegisterValue(value)) return\n setChecked(el, value)\n el._lastAppliedModel = value.innerRef.value\n }\n addTrackedListener(el, 'change', () => {\n if (shouldBailListener(el)) return\n noteInteraction(value)\n const modelValue = value.innerRef.value ?? []\n\n // this side-steps subtle 2-way binding bugs where ref updates but input cannot be tracked by value\n const explicitValueRequired = true\n const rawElementValue = getValue(el, explicitValueRequired)\n\n const checked = el.checked\n if (isArray(modelValue)) {\n if (rawElementValue === undefined) {\n warn(\n 'Checkbox bound to an array model is missing a `value` attribute — ' +\n 'cannot determine which item to add or remove. ' +\n 'Add value=\"...\" to each <input type=\"checkbox\">.'\n )\n return\n }\n // Element-level coerce on the raw DOM value so the\n // looseIndexOf lookup and the new array's element shape\n // match the post-coerce model. Without this, the change\n // handler builds a mixed-type array (e.g. boolean members\n // plus a raw string) and either fails to find the existing\n // entry on uncheck (case-sensitive looseEqual on booleans)\n // or appends a string to a typed-element array. The path-\n // level coerce in the assigner cleans up the new array\n // afterwards either way.\n const elementValue = applyElementCoerce(rawElementValue, value)\n const index = looseIndexOf(modelValue, elementValue)\n const found = index !== -1\n if (checked && !found) {\n fireAssigner(el, value, modelValue.concat(elementValue))\n } else if (!checked && found) {\n const filtered = [...modelValue]\n filtered.splice(index, 1)\n fireAssigner(el, value, filtered)\n }\n } else if (isSet(modelValue)) {\n if (rawElementValue === undefined) {\n warn(\n 'Checkbox bound to a Set model is missing a `value` attribute — ' +\n 'cannot determine which item to add or remove. ' +\n 'Add value=\"...\" to each <input type=\"checkbox\">.'\n )\n return\n }\n // Set's `.delete` uses strict ===, so coerce the element\n // BEFORE the Set ops or removals silently fail when the\n // model holds post-coerce booleans/numbers and the DOM\n // gives back the raw string.\n const elementValue = applyElementCoerce(rawElementValue, value)\n const cloned = new Set(modelValue)\n if (checked) {\n cloned.add(elementValue)\n } else {\n cloned.delete(elementValue)\n }\n fireAssigner(el, value, cloned)\n } else {\n fireAssigner(el, value, getCheckboxValue(el, checked))\n }\n // After the default assigner runs, force-sync `el.checked` to\n // current storage. Catches the no-op-write case: a transform\n // mapped the click's value to current storage (e.g. an always-\n // false transform on an already-false checkbox) — no patch, no\n // render, no `beforeUpdate` setChecked. Without this the DOM\n // stays at the user's click state, divorced from storage.\n // Skipped for custom assigners (they own DOM/storage sync) and\n // while a transform is in flight (the deferred commit hasn't\n // landed yet — `_syncFromStorage` repaints once it does).\n if (isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !isTransforming(value)) {\n setChecked(el, value)\n el._lastAppliedModel = value.innerRef.value\n }\n })\n },\n // set initial checked on mount to wait for true-value/false-value\n mounted(el, { value }) {\n setChecked(el, value)\n if (!isRegisterValue(value)) return\n el._lastAppliedModel = value.innerRef.value\n // External model changes that don't trigger a host re-render\n // (cross-tab sync, a sibling's setValue / reset / clear) re-run the\n // same `setChecked` the `beforeUpdate` path uses. Not focus-gated:\n // an external change must reflect even on a focused checkbox, and the\n // write is idempotent (`setChecked` skips when `el.checked` matches).\n setupValueSync(el, value.innerRef, () => {\n setChecked(el, value)\n el._lastAppliedModel = value.innerRef.value\n })\n },\n // Skip the DOM sync when the model is identity-unchanged from the\n // last application. Pre-fix the scalar branch in `setChecked`\n // gated on `originalValue === oldValue`, comparing a primitive\n // scalar against the wrapper RegisterValue object — always !==,\n // so the guard was a silent no-op. Array / Set branches lacked\n // any guard. The per-render re-apply mirrors the just-fixed\n // `vRegisterSelect` shape: a sibling's reactive write triggers\n // `beforeUpdate` mid-click, `setChecked` re-applies the prior\n // model state, and the in-flight user toggle is clobbered before\n // the browser fires `change`. Identity comparison on\n // `innerRef.value` is sound for the same reason as multi-select —\n // every form write produces a fresh value at the path (new\n // primitives; new array/Set references along the spine), so\n // reference equality tracks \"did the model move\" exactly.\n beforeUpdate(el, binding, vnode) {\n setAssignFunction(el, vnode, binding.value)\n if (!isRegisterValue(binding.value)) return\n const currentModel = binding.value.innerRef.value\n if (el._lastAppliedModel === currentModel) return\n setChecked(el, binding.value)\n el._lastAppliedModel = currentModel\n },\n}\n\nfunction setChecked(el: HTMLInputElement, value: unknown): void {\n if (!isRegisterValue(value)) return\n\n const originalValue = value.innerRef.value\n let checked: boolean\n\n // Read the option-value via `getValue(el)` rather than\n // `vnode.props?.['value']`. On SSR + hydration, Vue skips\n // `patchProp` for hoisted static `value=\"...\"` attributes — vnode\n // props don't carry the value AND `el._value` is never set, so the\n // old code returned undefined and unchecked the box even when the\n // DOM `value` attribute matched the model. `getValue` (post the\n // static-attr fix) checks `_value` first, then the DOM property,\n // so all three paths (Vue dynamic, Vue hydrated static, manual\n // setAttribute) resolve identically.\n // All three branches compare the post-coerce model against the\n // RAW DOM-side value (the option's `value` attribute, or the\n // checkbox's `_trueValue`). Coerce normalizes the WRITE direction\n // (e.g. `\"True\"` → `true` for `z.boolean()`); without symmetric\n // normalization on the READ direction, `looseEqual` /\n // `looseIndexOf` / `Set.has` fight the user's click on every\n // re-render. Route the raw value through the same `applyCoerce`\n // closure to restore parity. See setChecked-mid-coerce regression\n // tests in coerce.test.ts.\n if (isArray(originalValue)) {\n // Element-level coerce: the DOM-side raw value is a SCALAR\n // matching against the array's element type, not the path's\n // top-level type (which would be `array`, with no scalar\n // coerce target).\n checked = looseIndexOf(originalValue, applyElementCoerce(getValue(el), value)) > -1\n } else if (isSet(originalValue)) {\n // Set.has uses SameValueZero (===), not loose comparison —\n // mismatch is fatal here, not just for case-sensitive booleans.\n checked = originalValue.has(applyElementCoerce(getValue(el), value))\n } else {\n const trueValueCoerced = applyCoerce(getCheckboxValue(el, true), value)\n checked = looseEqual(originalValue, trueValueCoerced)\n }\n\n if (el.checked !== checked) {\n el.checked = checked\n }\n}\n\nconst vRegisterRadio: RegisterRadioCustomDirective = {\n created(el, { value }, vnode) {\n if (!isRegisterValue(value)) return\n\n value.registerElement(el)\n setAssignFunction(el, vnode, value)\n // Deferred async-transform repaint: re-apply checked-state from the\n // committed value once the run lands (mirrors the post-write force-\n // sync below).\n el._syncFromStorage = (): void => {\n if (!isRegisterValue(value)) return\n const currentModel = value.innerRef.value\n const target = looseEqual(currentModel, applyCoerce(getValue(el), value))\n if (el.checked !== target) el.checked = target\n el._lastAppliedModel = currentModel\n }\n addTrackedListener(el, 'change', () => {\n if (shouldBailListener(el)) return\n noteInteraction(value)\n fireAssigner(el, value, getValue(el))\n // After the default assigner runs, force-sync `el.checked` to\n // current storage. Catches the no-op-write case where a\n // transform maps the click's value to current storage — no\n // patch, no render, no `beforeUpdate` sync. Skipped for custom\n // assigners (they own DOM/storage sync) and while a transform is\n // in flight (the deferred commit repaints via `_syncFromStorage`).\n if (isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !isTransforming(value)) {\n const currentModel = value.innerRef.value\n const target = looseEqual(currentModel, applyCoerce(getValue(el), value))\n if (el.checked !== target) el.checked = target\n el._lastAppliedModel = currentModel\n }\n })\n },\n // Initial checked-state sync runs in `mounted`, NOT `created` —\n // Vue's directive lifecycle fires `created` BEFORE the element's\n // attributes are patched (`type`, `value`, `_value` etc. aren't on\n // the element yet), so `getValue(el)` would return `undefined` and\n // every radio in a group would mount unchecked regardless of the\n // model. Checkbox already uses `mounted: setChecked` for the same\n // reason.\n mounted(el, { value }) {\n if (!isRegisterValue(value)) return\n // Read the option-value via `getValue(el)` rather than\n // `vnode.props?.['value']` so SSR-hydrated static `value=\"...\"`\n // attributes (which don't surface in vnode.props because Vue's\n // static-attr fast path skips patchProp) still resolve correctly.\n // Coerce the raw value the same way the change handler will so\n // the comparison stays symmetric — see setChecked's note.\n el.checked = looseEqual(value.innerRef.value, applyCoerce(getValue(el), value))\n el._lastAppliedModel = value.innerRef.value\n // External model changes that don't trigger a host re-render re-run\n // the same checked computation the `beforeUpdate` path uses. Not\n // focus-gated: an external change must reflect even on a focused\n // radio, and writing `el.checked` is atomic.\n setupValueSync(el, value.innerRef, () => {\n el.checked = looseEqual(value.innerRef.value, applyCoerce(getValue(el), value))\n el._lastAppliedModel = value.innerRef.value\n })\n },\n // Skip the DOM sync when the model is identity-unchanged from the\n // last application. Pre-fix the guard read `value.innerRef.value\n // !== oldValue`, comparing a primitive scalar against the previous\n // binding's wrapper RegisterValue object — always !==, so the\n // guard was a silent no-op and `el.checked = …` re-applied on\n // every parent re-render. Same shape as the just-fixed\n // `vRegisterSelect` and `setChecked` bugs: a sibling's reactive\n // write triggers `beforeUpdate` mid-click and writes back the\n // prior model state, clobbering the in-flight selection.\n beforeUpdate(el, { value }, vnode) {\n if (!isRegisterValue(value)) return\n\n setAssignFunction(el, vnode, value)\n const currentModel = value.innerRef.value\n if (el._lastAppliedModel === currentModel) return\n el.checked = looseEqual(currentModel, applyCoerce(getValue(el), value))\n el._lastAppliedModel = currentModel\n },\n}\n\nconst vRegisterSelect: RegisterSelectCustomDirective = {\n // <select multiple> value need to be deep traversed\n deep: true,\n created(el, { value, modifiers: { number } }, vnode) {\n if (!isRegisterValue(value)) return\n\n value.registerElement(el)\n // Deferred async-transform repaint: re-apply the selection from the\n // committed value once the run lands (mirrors the post-write force-\n // sync below).\n el._syncFromStorage = (): void => {\n if (!isRegisterValue(value)) return\n setSelected(el, value)\n el._lastAppliedModel = value.innerRef.value\n }\n addTrackedListener(el, 'change', () => {\n if (shouldBailListener(el)) return\n noteInteraction(value)\n // Re-derive each fire so an Array ↔ Set swap on the bound path\n // (a `form.setValue('picks', new Set([...]))` against a union\n // schema, or any other write that lands a different container\n // shape) routes the next change through the matching constructor.\n const isSetModel = isSet(value.innerRef.value)\n const selectedVal = Array.prototype.filter\n .call(el.options, (o: HTMLOptionElement) => o.selected)\n .map((o: HTMLOptionElement) => (number === true ? looseToNumber(getValue(o)) : getValue(o)))\n const wrote = fireAssigner(\n el,\n value,\n el.multiple ? (isSetModel ? new Set(selectedVal) : selectedVal) : selectedVal[0]\n )\n // Only set `_assigning` when the write actually landed. A\n // rejected write (slim-primitive gate said no) should NOT\n // suppress the next `updated` hook's `setSelected` — we want\n // the DOM to revert to `innerRef.value` since the form state\n // didn't change. `undefined` from a consumer-installed assigner\n // counts as \"succeeded\" for back-compat (their assigner has no\n // way to signal otherwise).\n if (wrote !== false) {\n el._assigning = true\n void nextTick(() => {\n el._assigning = false\n })\n }\n // After the default assigner runs, force-sync the `<select>`\n // selection to current storage. Catches the no-op-write case:\n // a transform mapped the user's pick to current storage (e.g.\n // always-fixed transform) — no patch, no render, no `updated`\n // setSelected. Without this the DOM stays at the user's\n // selection, divorced from storage. Skipped for custom\n // assigners (they own DOM/storage sync) and while a transform is\n // in flight (the deferred commit repaints via `_syncFromStorage`).\n if (isRegisterValue(value) && isDefaultAssigner(el[assignKey]) && !isTransforming(value)) {\n setSelected(el, value)\n el._lastAppliedModel = value.innerRef.value\n }\n })\n setAssignFunction(el, vnode, value)\n },\n // set value in mounted & updated because <select> relies on its children\n // <option>s.\n mounted(el, { value }) {\n setSelected(el, value)\n if (!isRegisterValue(value)) return\n el._lastAppliedModel = value.innerRef.value\n // External model changes that don't trigger a host re-render re-run\n // the same `setSelected` the `updated` path uses. The `_assigning`\n // guard short-circuits the mid-click window (mousedown → change) so\n // an in-progress multi-select isn't clobbered, matching `updated`.\n setupValueSync(el, value.innerRef, () => {\n if (el._assigning === true) return\n setSelected(el, value)\n el._lastAppliedModel = value.innerRef.value\n })\n },\n beforeUpdate(el, binding, vnode) {\n setAssignFunction(el, vnode, binding.value)\n },\n // Skip the DOM sync when the model is identity-unchanged from the\n // last application. Parent re-renders fire `updated` whether or not\n // the bound model actually moved (a typed character in a sibling,\n // an async-validation tick, any reactive read elsewhere on the\n // page). Without this guard, every such render unconditionally re-\n // applies `setSelected` against the prior model, which on a\n // `<select multiple>` clobbers any in-progress user selection\n // between mousedown and the browser's change-event decision — the\n // browser then sees no net change, never fires `change`, and the\n // model never updates. Identity comparison is sound: every form\n // write produces a new array/Set reference at the path (the diff-\n // apply replacement of `form.value` rolls forward fresh structures\n // along the spine), so reference equality on `innerRef.value`\n // tracks \"did the model move\" exactly. The `_assigning` gate stays\n // — it short-circuits the immediate post-write render where the\n // DOM is already in sync from the user's click.\n updated(el, { value }) {\n if (el._assigning === true) return\n if (!isRegisterValue(value)) return\n const currentModel = value.innerRef.value\n if (el._lastAppliedModel === currentModel) return\n setSelected(el, value)\n el._lastAppliedModel = currentModel\n },\n}\n\nfunction setSelected(el: HTMLSelectElement, value: unknown) {\n if (!isRegisterValue(value)) return\n\n // Use the model value directly — mirrors Vue's reference\n // `vModelSelect.setSelected`. Pre-fix this went through a\n // `getBaseValue` indirection that read DOM-current selection state\n // instead of the model, returning an empty Set for single-select\n // numeric models. The downstream `looseEqual('1', Set{})` always\n // failed, so `selectedIndex` ended at `-1` (no option highlighted)\n // even though the bound value matched an option. Single-select with\n // number / string / boolean now correctly drives the DOM via\n // `looseEqual` (which coerces primitives through `String(...)`),\n // and multi-select uses the Array / Set membership it always did.\n const externalValue = value.innerRef.value\n const isMultiple = el.multiple\n const isArrayValue = isArray(externalValue)\n\n if (isMultiple && !isArrayValue && !isSet(externalValue)) {\n if (__DEV__) {\n warn(\n `<select multiple v-register> expected an Array or Set, got ` +\n `${Object.prototype.toString.call(externalValue).slice(8, -1)}. ` +\n `Bind to a list-typed schema (e.g. z.array(z.string()) or z.set(z.string())).`\n )\n }\n return\n }\n // Symmetric misuse: non-multiple select bound to an Array / Set\n // model. The change handler would write `selectedVal[0]` (scalar)\n // back, which the slim-primitive gate rejects against an Array\n // path — so the user's clicks silently fail. Mount-time\n // `looseEqual('a', ['a', 'b'])` also returns false, so no option\n // ever appears highlighted. Bail with a dev-warn pointing at the\n // fix (`add multiple` for list bindings, or use a scalar model).\n if (!isMultiple && (isArrayValue || isSet(externalValue))) {\n if (__DEV__) {\n warn(\n `<select v-register> (no \\`multiple\\` attribute) expected a scalar value for its ` +\n `binding, but got ${Object.prototype.toString.call(externalValue).slice(8, -1)}. ` +\n `Add the \\`multiple\\` attribute to bind to a list, or use a scalar schema (e.g. ` +\n `\\`z.string()\\`) for a single-select binding.`\n )\n }\n return\n }\n\n if (isMultiple) {\n // Precompute a `Set<string>` of stringified model members once,\n // then do O(1) lookups per option. Drops the per-option work\n // from O(N) to O(1), so total `setSelected` cost is O(N + M)\n // for an N-item model and an M-option <select> — matters for\n // long forms (thousands of options or selected items). Both\n // Array and Set primitive paths share this; only object-valued\n // option binds (rare) keep their original identity comparisons.\n //\n // Each option's raw `value` is routed through `applyCoerce`\n // before stringifying so the comparison stays symmetric with\n // the change handler's WRITE-side coerce — without it,\n // `String(true) === \"true\"` but the option's raw `\"True\"`\n // stringifies to `\"True\"` and the option silently never matches.\n const stringifiedMembers = new Set<string>()\n const iter: Iterable<unknown> = isArrayValue\n ? (externalValue as ReadonlyArray<unknown>)\n : (externalValue as Set<unknown>)\n for (const v of iter) stringifiedMembers.add(String(v))\n\n for (let i = 0, l = el.options.length; i < l; i++) {\n const option = el.options[i]\n if (!option) continue\n // Element-level coerce: a multi-select's option matches a\n // member of an array/Set model, so the comparison must run\n // against the element type, not the path's top-level type.\n const optionValue = applyElementCoerce(getValue(option), value)\n const optionType = typeof optionValue\n if (optionType === 'string' || optionType === 'number') {\n option.selected = stringifiedMembers.has(String(optionValue))\n } else if (optionType === 'boolean') {\n // Booleans go through the same stringify channel — covers\n // `<option value=\"True\">` × `z.array(z.boolean())` after\n // coerce normalises to `true`.\n option.selected = stringifiedMembers.has(String(optionValue))\n } else if (isArrayValue) {\n // Object option, Array model: structural equality via\n // `looseIndexOf` (mirrors Vue's reference).\n option.selected = looseIndexOf(externalValue, optionValue) > -1\n } else {\n // Object option, Set model: identity-based `.has` (Sets\n // can't structurally compare without iterating, and Vue's\n // reference uses identity here).\n option.selected = (externalValue as Set<unknown>).has(optionValue)\n }\n }\n return\n }\n\n // Non-multiple: find the first option matching the scalar model\n // and set selectedIndex; clear if nothing matches. Coerce the\n // raw option value to keep parity with the change handler.\n for (let i = 0, l = el.options.length; i < l; i++) {\n const option = el.options[i]\n if (!option) continue\n if (looseEqual(applyCoerce(getValue(option), value), externalValue)) {\n if (el.selectedIndex !== i) el.selectedIndex = i\n return\n }\n }\n if (el.selectedIndex !== -1) el.selectedIndex = -1\n}\n\n// retrieve raw value set via :value bindings\n//\n// `explicitRequired` is the checkbox-array / checkbox-Set caller's way\n// of saying \"the user must have provided an option-value via either a\n// dynamic `:value` binding (Vue sets `el._value`) OR a static `value`\n// attribute (DOM has `value` attribute set). If neither is present,\n// the default `el.value` of 'on' would silently add the bogus literal\n// 'on' to the array on every toggle — surface as undefined so the\n// caller can warn instead.\"\n//\n// Without the `hasAttribute('value')` fallback, the SSR + static-attr\n// hydration path fails: Vue's hydration skips patchProp for hoisted\n// static attributes, `el._value` is never set, but the DOM still\n// reflects the rendered `value=\"apple\"` attribute. We need to honor\n// either signal.\nfunction getValue(el: HTMLOptionElement | HTMLInputElement, explicitRequired = false) {\n if ('_value' in el) return el._value\n if (explicitRequired && !el.hasAttribute('value')) return undefined\n return el.value\n}\n\n// retrieve raw value for true-value and false-value set via :true-value or :false-value bindings\nfunction getCheckboxValue(\n el: HTMLInputElement & { _trueValue?: unknown; _falseValue?: unknown },\n checked: boolean\n) {\n const key = checked ? '_trueValue' : '_falseValue'\n return key in el ? el[key] : checked\n}\n\n// Tags the directive's text/checkbox/radio/select variants handle\n// natively. A v-register binding on anything else (a `<div>`, a\n// `<span>`, a Vue component whose root is a non-form element) gets\n// listeners attached normally — but the listener bodies bail (via\n// `shouldBailListener`) when the assigner is still the default. This\n// prevents the bubbled-write bug while letting consumer-installed\n// `assignKey` / `@update:registerValue` shapes flow through.\n//\n// The dev-warn for the \"no escape hatch\" case is deferred to the\n// next tick after the directive's `mounted` hook, so `useRegister`'s\n// `onMounted` marker has a chance to set `REGISTER_OWNER_MARKER` on\n// the rendered root before the warn check runs. The anchor is\n// `mounted`, NOT `created`, on purpose: `mounted` always runs inside\n// a real scheduler post-flush (fresh mount AND the Suspense/async-\n// hydration path), so the `nextTick` chained from it reliably\n// resolves after the owning child's post-flush `onMounted`. Anchoring\n// from `created` races during async hydration — the directive hook\n// then runs inside a bare `Promise.then` (registerDep / Suspense)\n// with no active flush, so a `created`-scheduled `nextTick` is a bare\n// microtask that fires before the marker is set, warning falsely on\n// every SSR'd wrapper. Without any deferral, deeply-nested\n// `useRegister` children would always warn (the directive can't\n// reach the child instance via `binding.instance` — that's the\n// page/parent component, whose `subTree` is the outer element tree,\n// not the child component vnode directly).\n\n// One-shot dev-warn dedupe so a v-for over 100 unsupported elements\n// produces one warning, not 100. Keyed by element identity (WeakSet\n// for GC-friendliness).\nconst warnedUnsupportedElements: WeakSet<HTMLElement> | null = __DEV__\n ? new WeakSet<HTMLElement>()\n : null\n\nconst vRegisterDynamic: RegisterModelDynamicCustomDirective = {\n created(el, binding, vnode) {\n // Per-element persist opt-in is reconciled at the dynamic level so\n // the per-tag variants stay focused on their input semantics.\n syncPersistOptIn(el, binding.value, undefined, vnode.props?.['type'])\n // Per-path multi-tab opt-out lives at the dynamic level too —\n // ref-counted on the FormStore so multiple bindings on the same\n // path balance correctly across conditional renders.\n syncMultiTabOptOut(binding.value, undefined)\n\n // Always run the per-tag variant's `created` — listener-body bail\n // (`shouldBailListener`) prevents the bubbled-write bug on\n // non-supported roots while letting consumer overrides through.\n callModelHook(el, binding, vnode, null, 'created')\n\n // Auto-aria: lock authored attrs, paint the initial state, and watch\n // the gated display state for async ticks. No-op when the binding\n // disabled aria or carries no display-state accessor.\n if (isRegisterValue(binding.value)) setupAria(el as AriaCarrier, binding.value, vnode)\n },\n mounted(el, binding, vnode) {\n callModelHook(el, binding, vnode, null, 'mounted')\n\n // Defer the unsupported-element warn one tick past `mounted`. By the\n // time this resolves:\n // - useRegister's onMounted has run, setting REGISTER_OWNER_MARKER\n // on the el if the child component called useRegister()\n // - any post-install assignKey override (via onMounted /\n // ref-callback) is in place, so the assigner isn't default\n // anymore. The warn fires only when neither escape hatch was used.\n // Anchoring on `mounted` rather than `created` is what makes this\n // hold on the async-hydration path (see the directive-level note\n // above the dedupe set): `mounted` always runs inside a real\n // post-flush, so this `nextTick` resolves after the owning child's\n // `onMounted`, never before it.\n if (\n __DEV__ &&\n warnedUnsupportedElements !== null &&\n !INTERACTIVE_TAG_NAMES.has(el.tagName) &&\n !warnedUnsupportedElements.has(el)\n ) {\n void nextTick(() => {\n if (warnedUnsupportedElements.has(el)) return\n const hasMarker =\n (el as unknown as { [k: symbol]: unknown })[REGISTER_OWNER_MARKER] === true\n const hasUserAssigner = !isDefaultAssigner(\n (el as unknown as { [k: symbol]: unknown })[assignKey]\n )\n if (hasMarker || hasUserAssigner) return\n warnedUnsupportedElements.add(el)\n warn(\n `[attaform] v-register on <${el.tagName.toLowerCase()}> is a no-op — ` +\n `non-input roots aren't bound to text-input semantics. For custom components: ` +\n `call \\`useRegister()\\` in the child's setup and re-bind v-register to an inner ` +\n `native element. Lower-level: install a custom assigner via the \\`assignKey\\` ` +\n `symbol on the element.`\n )\n })\n }\n },\n beforeUpdate(el, binding, vnode, prevVNode) {\n // Reactive opt-in toggling: `register('foo', { persist: rememberMe })`\n // re-evaluates on every parent render. `binding.oldValue` holds the\n // prior RegisterValue so the helper can diff persist / path / registry\n // and migrate the entry without thrashing.\n syncPersistOptIn(el, binding.value, binding.oldValue, vnode.props?.['type'])\n // Reactive multi-tab opt-out toggling — same diff strategy.\n syncMultiTabOptOut(binding.value, binding.oldValue)\n // Same diff for the form's element map. Catches the\n // `useRegister`-driven swap (binding mounted with `undefined`,\n // a real RV arrives on the next render), the dynamic-path case,\n // and the cross-form swap. Same-path + same-form transitions\n // short-circuit so identity-stable bindings don't thrash.\n syncElementRegistration(el, binding.value, binding.oldValue)\n callModelHook(el, binding, vnode, prevVNode, 'beforeUpdate')\n\n // Re-derive aria. A path change (a reused node rebound on reorder)\n // re-establishes the watch against the new path's display state; a\n // disabled / removed binding tears down the attrs we set; otherwise\n // we re-paint and pick up any newly-authored attribute lock.\n const ariaEl = el as AriaCarrier\n const value = binding.value\n if (\n !isRegisterValue(value) ||\n value.ariaEnabled !== true ||\n value.ariaDisplayState === undefined\n ) {\n teardownAria(ariaEl)\n } else {\n const old = binding.oldValue\n const pathChanged = !isRegisterValue(old) || old.path !== value.path\n if (pathChanged) {\n teardownAria(ariaEl)\n setupAria(ariaEl, value, vnode)\n } else {\n mergeAriaLocks(ariaEl, vnode)\n applyAria(ariaEl, value)\n }\n }\n },\n updated(el, binding, vnode, prevVNode) {\n callModelHook(el, binding, vnode, prevVNode, 'updated')\n },\n beforeUnmount(el, { value }) {\n // Detach every listener the variant attached in `created`, regardless\n // of whether the binding is still a valid RegisterValue. An element\n // re-used by KeepAlive / v-show would otherwise double its listener\n // count on the next activation cycle.\n removeTrackedListeners(el)\n\n // Stop the aria watch and clear the attributes we set. A reused\n // element (KeepAlive / v-show) starts clean on its next activation.\n teardownAria(el as AriaCarrier)\n\n // Stop the reactive value-sync watch (text / textarea bindings). A\n // no-op for variants that never set one up.\n teardownValueSync(el)\n\n // Drop every opt-in this element ever held — `removeAllFor` sweeps\n // by elementId rather than (id, path), which covers the case where\n // the binding's path changed across updates and we don't want to\n // hunt for the latest entry.\n if (isRegisterValue(value)) {\n value.persistOptIns.removeAllFor(getOrAssignElementId(el))\n // Mirror cleanup for multi-tab opt-out — decrement ref count so\n // the path doesn't stay tab-local after every opted-out binding\n // unmounts.\n value.unmarkNoSync?.()\n }\n\n if (!isRegisterValue(value)) return\n\n value.deregisterElement(el)\n\n // Remove internal state that the directive attaches directly to the\n // element. If the element is reused (<KeepAlive>, v-show), stale flags\n // like `composing: true` (IME in progress) would swallow user input.\n delete (el as { composing?: boolean }).composing\n delete (el as { _assigning?: boolean })._assigning\n delete (el as { _syncFromStorage?: () => void })._syncFromStorage\n delete (el as unknown as { [k: symbol]: unknown })[assignKey]\n },\n // The lifecycle hooks above don't run on the server (Vue skips\n // directive lifecycle during SSR), so emit the same aria attributes\n // here from the SSR-time gated display state. Honors authored attrs\n // (vnode-level lockout) and the ariaEnabled gate, touches no DOM, and\n // shares `resolveAriaValue` with the client path. Ids are SSR-stable\n // (formInstanceId derives from Vue's useId), so a server-rendered\n // describedby matches the client after hydration.\n getSSRProps(binding, vnode) {\n const rv = binding.value\n if (!isRegisterValue(rv)) return undefined\n // Vue passes `null` for the vnode in the compiled SSR directive-props\n // helper (string-based SSR has no vnode object), and the real vnode\n // in the runtime `withDirectives` path. The vnode-level authored\n // lockout is therefore only available client-side and on the runtime\n // SSR path; under compiled SSR an authored aria attribute can't be\n // detected here, and the client directive reconciles it on hydration.\n const realVnode = (vnode as VNode | null) ?? null\n const ariaProps = getSSRAriaProps(rv, realVnode)\n\n // Form-state (`value` / `checked`) is the runtime path's analogue of\n // the compile-time transform's injected binding. Compiled SSR passes a\n // `null` vnode (the transform already emitted the binding there), so\n // this only fires for `h()` / `withDirectives` renders — the two\n // mechanisms own disjoint paths and never double-emit. Without it, a\n // render-function field rendered server-side carries its aria attrs\n // but no value, painting empty for one frame before the client\n // directive fills it in on mount.\n const formStateProps = realVnode !== null ? getSSRFormStateProps(rv, realVnode) : undefined\n\n if (ariaProps === undefined && formStateProps === undefined) return undefined\n // Disjoint key spaces (`aria-*` vs `value` / `checked`), so the merge\n // order is immaterial; spreading `undefined` is a no-op.\n return { ...ariaProps, ...formStateProps }\n },\n}\n\nfunction resolveDynamicModel(tagName: string, type: unknown) {\n // tagName is always uppercase per DOM spec (el.tagName); type comes from\n // vnode.props and is usually a string, but reactive bindings (`:type=\"x\"`)\n // can pass other values — guard defensively.\n if (tagName === 'SELECT') return vRegisterSelect\n if (tagName === 'TEXTAREA') return vRegisterText\n if (typeof type !== 'string') return vRegisterText\n if (type === 'file') return vRegisterFile\n if (type === 'checkbox') return vRegisterCheckbox\n if (type === 'radio') return vRegisterRadio\n return vRegisterText\n}\n\n/**\n * SSR `checked` verdict for a checkbox, mirroring `setChecked`'s\n * Array→`looseIndexOf` / Set→`.has` / scalar→`looseEqual(trueValue)`\n * ladder — but reading the option-value and true-value from `vnode.props`\n * rather than the DOM element (there's no element server-side). Returns\n * the props bag (`{ checked: '' }`) when the box should render checked,\n * else `undefined` so no attribute is emitted.\n */\nfunction ssrCheckboxProps(\n rv: RegisterValue,\n props: Record<string, unknown> | null\n): Record<string, string> | undefined {\n const model = rv.innerRef.value\n const optionValue = props?.['value']\n let checked: boolean\n if (isArray(model)) {\n checked = looseIndexOf(model, applyElementCoerce(optionValue, rv)) > -1\n } else if (isSet(model)) {\n checked = model.has(applyElementCoerce(optionValue, rv))\n } else {\n // `getCheckboxValue(el, true)` returns `_trueValue` (the `:true-value`\n // binding) when present, else `true`. On the server we read the\n // `true-value` prop directly.\n const trueValue = props !== null && 'true-value' in props ? props['true-value'] : true\n checked = looseEqual(model, applyCoerce(trueValue, rv))\n }\n return checked ? { checked: '' } : undefined\n}\n\n/**\n * Compute the form-state props (`value` / `checked`) the directive would\n * apply on mount, for SSR emission on the RUNTIME render-function path.\n * Mirrors each variant's mount logic — `vRegisterText`'s\n * `el.value = displayValue.value`, `setChecked`, the radio `looseEqual` —\n * but sources the element-side option-value from `vnode.props` since\n * there's no DOM element server-side.\n *\n * Returns `undefined` for the variants whose initial state can't be\n * expressed at the element level here:\n * - file: browsers reject `value` on file inputs; `vRegisterFile` owns\n * the DOM contract.\n * - select: option `selected` is option-level, not expressible from the\n * `<select>` element's props (compiled templates carry it via\n * `componentBridgeTransform`; documented limitation for runtime\n * render functions).\n *\n * Only reached on the runtime path — compiled SSR passes a `null` vnode,\n * where the compile-time transform already injected the binding — so the\n * two mechanisms never double-emit.\n */\nfunction getSSRFormStateProps(rv: RegisterValue, vnode: VNode): Record<string, string> | undefined {\n // Component vnodes (`h(MyComp, ...)` with a v-register binding) have no\n // element-level form state — the inner native input the component\n // re-binds owns it. Only real HTML tags dispatch here.\n if (typeof vnode.type !== 'string') return undefined\n const props = (vnode.props as Record<string, unknown> | null) ?? null\n const variant = resolveDynamicModel(vnode.type.toUpperCase(), props?.['type'])\n\n if (variant === vRegisterFile || variant === vRegisterSelect) return undefined\n if (variant === vRegisterCheckbox) return ssrCheckboxProps(rv, props)\n if (variant === vRegisterRadio) {\n const matches = looseEqual(rv.innerRef.value, applyCoerce(props?.['value'], rv))\n return matches ? { checked: '' } : undefined\n }\n // text / textarea / number / email — mirror `el.value = displayValue`.\n // `displayValue` already folds blank/unset to `''`; omit the attribute\n // for an empty field so SSR matches the no-value initial paint.\n const value = rv.displayValue.value\n return value === '' ? undefined : { value }\n}\n\nfunction callModelHook(\n el: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement,\n binding: DirectiveBinding,\n vnode: VNode,\n prevVNode: VNode | null,\n hook: keyof ObjectDirective\n) {\n const modelToUse = resolveDynamicModel(el.tagName, vnode.props?.['type'])\n const fn = modelToUse[hook] as DirectiveHook | undefined\n fn?.(el, binding, vnode, prevVNode)\n}\n\nexport type VXCustomDirective =\n | typeof vRegisterText\n | typeof vRegisterCheckbox\n | typeof vRegisterSelect\n | typeof vRegisterRadio\n | typeof vRegisterDynamic\n\n/**\n * The `v-register` directive. Bind a form field to a native input,\n * select, textarea, checkbox, or radio:\n *\n * ```vue\n * <input v-register=\"form.register('email')\" />\n * <select v-register=\"form.register('country')\">\n * <option value=\"us\">US</option>\n * <option value=\"uk\">UK</option>\n * </select>\n * ```\n *\n * The directive picks the right binding strategy automatically based\n * on the element's `tagName` and `type`. Registered globally by\n * `createAttaform()`. Most consumers never import it directly, but\n * it's exposed for advanced integrations that wire directives\n * manually.\n */\nexport const vRegister = vRegisterDynamic\n\n// Stamp the marker on the directive object after definition. Reading\n// it from `vnode.dirs[].dir[V_REGISTER_MARKER]` lets `useRegister`\n// find the parent's binding even without the compile-time bridge-\n// prop injection — keeps the wrapper pattern working in bare-Vue and\n// playground setups.\n;(vRegisterDynamic as unknown as { [k: symbol]: true })[V_REGISTER_MARKER] = true\n","import type { App, Plugin } from 'vue'\nimport { __DEV__ } from './dev'\nimport { attachRegistryToApp, createRegistry, type AttaformRegistry } from './registry'\nimport { vRegister } from './directive'\nimport type { SSRDetectOptions } from './ssr'\nimport type { AttaformDefaults } from '../types/types-api'\n\n/**\n * Options for `createAttaform()`.\n */\nexport type AttaformPluginOptions = SSRDetectOptions & {\n /**\n * Whether to install the Vue DevTools integration. Default `true`.\n * The integration is dev-only: the `import('./devtools')` sits behind\n * the `__DEV__` flag, so a consumer's production build folds it out\n * entirely (no devtools chunk shipped, no fetch attempted). In\n * development the DevTools peer is loaded lazily and a missing peer\n * fails silently. Pass `false` to skip the integration even in dev.\n */\n devtools?: boolean\n /**\n * App-level defaults applied to every `useForm` call in this app.\n * Per-form options always win. See `AttaformDefaults` for\n * the supported option set and the merge rules.\n *\n * ```ts\n * app.use(\n * createAttaform({\n * defaults: { debounceMs: 100 },\n * })\n * )\n * ```\n */\n defaults?: AttaformDefaults\n}\n\n/**\n * Install the form library on a Vue app. Idempotent: a second call\n * for the same `app` is a no-op (with a dev warning when explicit, no\n * warning when triggered by the lazy-install path).\n *\n * Used internally by:\n * - `createAttaform()` — the explicit plugin install path.\n * - `ensureAttaformInstalled()` — the lazy-install path triggered by\n * `useForm` / `injectForm` / `useRegister` when no explicit install\n * has happened yet.\n *\n * Both paths converge here so the `_attaform` slot, the\n * `kAttaformRegistry` provide, the `v-register` directive, and the\n * devtools attach happen in the same order regardless of how the\n * registry was first attached.\n */\nfunction installAttaformOnApp(\n app: App,\n options: AttaformPluginOptions,\n source: 'explicit' | 'lazy'\n): AttaformRegistry {\n // Idempotent install: a second call (e.g. createAttaform() registered\n // twice via vite.config + nuxt module, or createAttaform() after a\n // lazy useForm call) would otherwise overwrite the existing registry —\n // orphaning every FormStore the previous instance had built. Detect\n // via the `_attaform` slot `attachRegistryToApp` writes; bail with a\n // dev warning ONLY for the explicit path, since the lazy path is\n // expected to no-op when the user has already installed explicitly.\n if (app._attaform !== undefined) {\n if (__DEV__ && source === 'explicit') {\n console.warn(\n '[attaform] createAttaform() install was called twice on the same app; ' +\n 'the second call is a no-op. ' +\n 'Likely cause: registering the plugin via both the Nuxt module AND a manual `app.use(...)`.'\n )\n }\n return app._attaform\n }\n const registry = createRegistry(options)\n attachRegistryToApp(app, registry)\n app.directive('register', vRegister)\n\n if (__DEV__ && options.devtools !== false && !registry.ssr) {\n void (async () => {\n try {\n const { setupAttaformDevtools } = await import('./devtools')\n await setupAttaformDevtools(app, registry)\n } catch {\n // Missing peer dep / DevTools not attached — silently skip.\n // The form runtime works without DevTools; this is pure-\n // observability tooling.\n }\n })()\n }\n\n return registry\n}\n\n/**\n * Lazy-install the form library on a Vue app from inside a setup\n * context. Called by `useForm`, `injectForm`, and `useRegister` so\n * `pnpm install attaform` is the entire setup story for the common\n * CSR case — no `app.use(createAttaform())` required in `main.ts`.\n *\n * If the app already has an attaform registry attached (because the\n * consumer installed `createAttaform({ defaults, devtools })` or the\n * Nuxt module ran), this is a no-op and the existing registry is\n * returned. App-wide options are preserved.\n *\n * SSR helpers (`renderAttaformState`, `hydrateAttaformState`) do NOT\n * use this path — they run outside setup and require explicit\n * `createAttaform()` install.\n */\nexport function ensureAttaformInstalled(app: App): AttaformRegistry {\n return installAttaformOnApp(app, {}, 'lazy')\n}\n\n/**\n * Create the Vue plugin that installs the form library on a Vue\n * application. Required only when you want app-wide options\n * (`defaults`, `devtools: false`, `ssr: true`) — for the default\n * setup, `useForm` / `injectForm` / `useRegister` lazy-install the\n * registry on first use.\n *\n * ```ts\n * import { createApp } from 'vue'\n * import { createAttaform } from 'attaform'\n *\n * createApp(App)\n * .use(createAttaform({ defaults: { debounceMs: 100 } }))\n * .mount('#app')\n * ```\n *\n * Under SSR with bare Vue 3, install explicitly with `{ ssr: true }`\n * from your server entry — the SSR serialization helpers\n * (`renderAttaformState` / `hydrateAttaformState`) require an\n * already-attached registry and don't trigger lazy install. Under\n * Nuxt, install via `attaform/nuxt` instead — the Nuxt module wires\n * both server and client automatically.\n *\n * Installing more than once on the same app is a no-op (the second\n * call logs a dev-mode warning).\n */\nexport function createAttaform(options: AttaformPluginOptions = {}): Plugin {\n const plugin: Plugin = {\n install(app: App) {\n installAttaformOnApp(app, options, 'explicit')\n },\n }\n return plugin\n}\n","import { InvalidPathError } from './errors'\n\n/**\n * Path primitives for advanced integrations. The form library accepts\n * paths in dotted-string form (`'user.email'`) at every public API.\n * These primitives are exposed for adapter authors who need to\n * canonicalise user-provided paths.\n */\n\ndeclare const pathKeyBrand: unique symbol\n\n/**\n * Branded string identifier for a canonicalised path. Useful as a\n * `Map` key — two paths that resolve to the same canonical form\n * produce the same `PathKey`. Treat as opaque; don't try to parse.\n */\nexport type PathKey = string & { readonly [pathKeyBrand]: 'PathKey' }\n\n/** A single path segment — a property name or array index. */\nexport type Segment = string | number\n/** A structured path as a read-only sequence of segments. */\nexport type Path = readonly Segment[]\n\n/** Tests an integer-like string without leading zeros. `'0'` | `'1'` | `'42'` pass; `'01'`, `'-1'`, `'1.5'` do not. */\nconst INTEGER_SEGMENT = /^(?:0|[1-9]\\d*)$/\n\nfunction normalizeSegment(raw: Segment): Segment {\n if (typeof raw === 'number') {\n if (!Number.isInteger(raw) || raw < 0) {\n throw new InvalidPathError(\n `Path segments must be non-negative integers when numeric; got ${String(raw)}`\n )\n }\n return raw\n }\n // Integer-looking strings normalise to numbers so that dotted-form\n // `'items.0.name'` and array-form `['items', 0, 'name']` yield the same\n // canonical path (and PathKey).\n if (INTEGER_SEGMENT.test(raw)) return Number(raw)\n return raw\n}\n\n/**\n * Parse a dotted-string path into structured segments.\n *\n * ```ts\n * parseDottedPath('user.address.line1') // ['user', 'address', 'line1']\n * parseDottedPath('items.0.name') // ['items', 0, 'name']\n * parseDottedPath('') // [''] (the empty-string key)\n * ```\n *\n * The empty-string input `''` is the **literal empty-key path**, not\n * the root. Use the array form `[]` for root. Form-level errors\n * (root `.refine()`) live at the empty-string path bucket so\n * `errors('')` returns them without sweeping every field error too.\n *\n * Throws `InvalidPathError` for paths with empty INTERNAL segments\n * (`'a..b'`, leading or trailing dots). For keys containing literal\n * dots, pass an array form (`['user.name']`) instead.\n */\nexport function parseDottedPath(path: string): Segment[] {\n if (path.length === 0) return ['']\n const rawSegments = path.split('.')\n const segments: Segment[] = []\n for (const raw of rawSegments) {\n if (raw.length === 0) {\n throw new InvalidPathError(\n `Path '${path}' has an empty segment; use the array form for empty keys.`\n )\n }\n segments.push(normalizeSegment(raw))\n }\n return segments\n}\n\n/**\n * Bounded FIFO cache for canonicalizePath on dotted-string inputs.\n * Real forms re-canonicalise a small working-set of paths thousands\n * of times per session (every keystroke on a registered field, every\n * validate, every getValue), so a small cache amortises the parse +\n * stringify cost across repeat calls without pinning memory as apps\n * accumulate fields.\n *\n * Eviction is FIFO (oldest insertion wins), not LRU. The 128-entry\n * cap is generous relative to a typical form's working set\n * (playground: ~15 paths; the entire test suite: 45 unique register\n * patterns) — overflow doesn't fire in practice. On the rare overflow\n * a re-canonicalisation hit is still O(segments) and lands back in\n * the cache. Bumping recency on every hit (`delete` + `set`) costs\n * two Map operations per cache hit, in the hottest read-side loop in\n * the library, with no observable benefit at this cap — so we don't.\n *\n * Array inputs are not cached: callers in the runtime (unset-walker's\n * recursive `[...segments, i]`, devtools' inspector `payload.path.slice(...)`)\n * overwhelmingly pass freshly-allocated arrays per call, so a\n * WeakMap-keyed cache would miss on every call and pay the\n * lookup-then-set cost without benefit.\n */\nconst CANONICAL_STRING_CACHE_MAX = 128\nconst canonicalStringCache = new Map<string, { segments: readonly Segment[]; key: PathKey }>()\n\n/**\n * Inverse cache: PathKey → segments. Populated by `canonicalizePath`\n * (string and array branches) so any consumer holding a PathKey\n * produced through the canonical pipeline can recover its structured\n * segments without `JSON.parse`. Callers reach this through\n * `segmentsForPathKey` below.\n *\n * The store-side data structures keyed by PathKey (form-store error\n * maps, blank-paths set, variant-memory map, persistence opt-in\n * registry) all source their keys from `canonicalizePath`, so reads\n * are dominantly cache hits. Cold paths (PathKeys round-tripped from\n * a persisted payload that came from disk) still hit a single\n * `JSON.parse` on first lookup, then warm the cache.\n *\n * Bounded FIFO at 4096 entries — generous relative to a typical form's\n * working set (~tens to ~hundreds of paths per form) but small enough\n * that long-running multi-form apps don't accumulate unbounded\n * references. Eviction only fires on net-new entries; idempotent\n * overwrites (same key, same segments) don't count toward the cap.\n */\nconst PATHKEY_TO_SEGMENTS_MAX = 4096\nconst pathKeyToSegments = new Map<PathKey, readonly Segment[]>()\n\nfunction rememberSegmentsForPathKey(key: PathKey, segments: readonly Segment[]): void {\n if (!pathKeyToSegments.has(key) && pathKeyToSegments.size >= PATHKEY_TO_SEGMENTS_MAX) {\n const oldest = pathKeyToSegments.keys().next().value\n if (oldest !== undefined) pathKeyToSegments.delete(oldest)\n }\n pathKeyToSegments.set(key, segments)\n}\n\n/**\n * Recover the structured `Segment[]` for a `PathKey` produced by\n * `canonicalizePath`. O(1) on the hot path (cache hit); cold keys\n * fall back to `JSON.parse(key)` plus segment normalization, then\n * warm the cache so subsequent lookups hit.\n *\n * Returns `null` for malformed PathKeys (non-JSON, non-array, or\n * containing values that aren't strings/numbers). Keys produced by\n * `canonicalizePath` never trip this — corrupt persistence payloads\n * (or test fixtures crafting raw strings) are the only realistic\n * sources.\n */\nexport function segmentsForPathKey(key: PathKey): readonly Segment[] | null {\n const cached = pathKeyToSegments.get(key)\n if (cached !== undefined) return cached\n let parsed: unknown\n try {\n parsed = JSON.parse(key)\n } catch {\n return null\n }\n if (!Array.isArray(parsed)) return null\n const segments: Segment[] = []\n for (const raw of parsed) {\n if (typeof raw !== 'string' && typeof raw !== 'number') return null\n segments.push(normalizeSegment(raw))\n }\n rememberSegmentsForPathKey(key, segments)\n return segments\n}\n\n/**\n * Canonicalise a path into structured segments plus a stable string\n * key. Accepts either dotted-string or array form; integer-looking\n * segments normalise to numbers.\n *\n * ```ts\n * canonicalizePath('items.0.name')\n * // { segments: ['items', 0, 'name'], key: '[\"items\",0,\"name\"]' as PathKey }\n *\n * canonicalizePath(['items', 0, 'name'])\n * // → same result\n * ```\n *\n * The returned `key` is suitable as a `Map`/`Set` key — equal paths\n * produce equal keys regardless of input form.\n */\nexport function canonicalizePath(input: string | Path): {\n segments: readonly Segment[]\n key: PathKey\n} {\n if (typeof input === 'string') {\n const cached = canonicalStringCache.get(input)\n if (cached !== undefined) return cached\n // `parseDottedPath` already normalises each segment; the previous\n // `.map(normalizeSegment)` second pass was a no-op. We drop it here.\n const segments: readonly Segment[] = parseDottedPath(input)\n const key = JSON.stringify(segments) as PathKey\n const entry = { segments, key }\n if (canonicalStringCache.size >= CANONICAL_STRING_CACHE_MAX) {\n const oldest = canonicalStringCache.keys().next().value\n if (oldest !== undefined) canonicalStringCache.delete(oldest)\n }\n canonicalStringCache.set(input, entry)\n rememberSegmentsForPathKey(key, segments)\n return entry\n }\n return keyForSegments(input)\n}\n\n/**\n * Canonical `{ segments, key }` for an already-array path: normalise each\n * segment (integer-looking → number) and mint the stable `JSON.stringify`\n * key, exactly as [[canonicalizePath]]'s array branch does (it delegates\n * here). Factored out so a hot caller that already holds a segment array\n * — the container field-state leaf walk — can produce a `PathKey` that\n * matches the one `originals` was seeded with WITHOUT routing through\n * `canonicalizePath`, whose per-read call count a meta-budget test gate\n * watches.\n */\nexport function keyForSegments(input: Path): {\n segments: readonly Segment[]\n key: PathKey\n} {\n const segments = Array.from(input).map(normalizeSegment)\n const key = JSON.stringify(segments) as PathKey\n rememberSegmentsForPathKey(key, segments)\n return { segments, key }\n}\n\n/**\n * Render a segment array as a dotted path string, matching the form\n * library's public-facing path notation (`'user.email'`,\n * `'items.0.name'`). The inverse of [[parseDottedPath]] for the\n * common case — segments that contain literal dots, leading zeros,\n * or array-index brackets round-trip ambiguously and shouldn't reach\n * this helper.\n *\n * Used at the I/O boundary where internal `PathKey` storage is\n * surfaced to consumers (the `form.blankPaths` view, the persisted\n * payload, the SSR snapshot).\n */\nexport function segmentsToDotted(segments: Path): string {\n return segments.join('.')\n}\n\n/**\n * Convenience: resolve a `PathKey` back to its dotted public form.\n * Returns `null` for malformed keys (matches [[segmentsForPathKey]]'s\n * contract). The common path is a cache hit on `pathKeyToSegments`\n * plus a single `join('.')`.\n */\nexport function pathKeyToDotted(key: PathKey): string | null {\n const segments = segmentsForPathKey(key)\n if (segments === null) return null\n return segmentsToDotted(segments)\n}\n\n/**\n * Normalise an I/O-boundary path string into a canonical `PathKey`. Used\n * by the form store and its hydration paths, where seeds can arrive in\n * either of two shapes:\n *\n * - dotted-string form (`'user.email'`) — public path notation, also\n * what persistence writes to disk via [[pathKeyToDotted]];\n * - already-canonical `PathKey` JSON (`'[\"user\",\"email\"]'`) — what the\n * construction-time unset walker emits and what the rest of the\n * runtime keys its internal data structures on.\n *\n * Detection: a string that parses as a JSON `Segment[]` is treated as\n * an already-canonical `PathKey` and round-tripped untouched.\n * Anything else falls through to [[canonicalizePath]]'s dotted-string\n * parser, so `'user.email'` parses to `['user', 'email']` and gets\n * stringified back into PathKey form.\n *\n * A consumer holding a literal-key string that happens to look like\n * JSON (`'[\"foo\"]'`) would be misread as a PathKey, but that's a\n * degenerate case — array form (`['[\"foo\"]']`) is the unambiguous\n * way to address such a key everywhere paths are accepted.\n */\nexport function coerceToPathKey(input: string): PathKey {\n if (input.length > 0 && input.charCodeAt(0) === 91 /* '[' */) {\n try {\n const parsed: unknown = JSON.parse(input)\n if (\n Array.isArray(parsed) &&\n parsed.every((s) => typeof s === 'string' || typeof s === 'number')\n ) {\n return input as PathKey\n }\n } catch {\n // Not JSON — fall through to the dotted-string branch.\n }\n }\n return canonicalizePath(input).key\n}\n\n/**\n * The root path — an empty segment tuple. Pass to APIs that accept\n * a `Path` to address the form value as a whole.\n */\nexport const ROOT_PATH: Path = Object.freeze([])\n/** Stable string key for the root path. */\nexport const ROOT_PATH_KEY = '[]' as PathKey\n\n/**\n * The form-level path — a one-segment path with the empty-string\n * key. Conventionally home for errors that don't belong to any\n * specific field: root `.refine()` messages, server-emitted form\n * errors, capacity / availability / cross-field-summary banners.\n *\n * Distinct from `ROOT_PATH` (`[]`): the root is the whole-form\n * subtree address (e.g. `errors([])` returns every error). The\n * form-level path is a sibling-of-no-field path that aggregation\n * walks DON'T sweep into per-field reads — `errors('field')`\n * returns only the field's errors, never the form-level bucket,\n * and `errors('')` returns only the form-level bucket, never the\n * field errors.\n */\nexport const FORM_ERRORS_PATH: Path = Object.freeze([''])\n/** Stable string key for the form-level errors path. */\nexport const FORM_ERRORS_PATH_KEY = '[\"\"]' as PathKey\n\n/**\n * `true` when `path` starts with every segment of `prefix` (in order).\n * The empty `prefix` matches every path — ROOT prefix is universal.\n *\n * Walks segments rather than `PathKey` strings because the data this\n * helper operates on (e.g. `meta.errors[].path`) carries segment\n * arrays directly.\n *\n * ```ts\n * isPathPrefix(['cargo'], ['cargo', 'items', 0, 'sku']) // true\n * isPathPrefix(['cargo', 'items'], ['cargo']) // false (path shorter)\n * isPathPrefix([], ['anything']) // true (root prefix)\n * ```\n */\nexport function isPathPrefix(prefix: readonly Segment[], path: readonly Segment[]): boolean {\n if (path.length < prefix.length) return false\n for (let i = 0; i < prefix.length; i++) {\n if (path[i] !== prefix[i]) return false\n }\n return true\n}\n\n/**\n * `true` when two paths are structurally equal: same length and identical\n * segments in order. Numeric and string segments compare with `!==`, so `0`\n * and `'0'` are NOT equal — pass canonicalised paths (integer-looking segments\n * normalised to numbers, as [[canonicalizePath]] and the diff walker both do).\n *\n * ```ts\n * pathsEqual(['rows', 0], ['rows', 0]) // true\n * pathsEqual(['rows'], ['rows', 0]) // false (different length)\n * pathsEqual(['rows', 0], ['rows', '0']) // false (segment types differ)\n * ```\n */\nexport function pathsEqual(a: readonly Segment[], b: readonly Segment[]): boolean {\n if (a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false\n }\n return true\n}\n"],"names":["target"],"mappings":";;AAqCO,MAAM,WACV,OAAO,OAAA,KAAY,cAAc,OAAA,CAAQ,GAAA,CAAI,WAAW,YAAA,MAAkB;;;;;ACrBtE,MAAM,sBAAsB,KAAA,CAAM;AAAA,EACvC,WAAA,CAAY,SAAiB,OAAA,EAAwB;AACnD,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,OAAO,GAAA,CAAA,MAAA,CAAW,IAAA;AAAA,EACzB;AACF;AAOO,MAAM,yBAAyB,aAAA,CAAc;AAAC;AAqB9C,MAAM,kCAAkC,aAAA,CAAc;AAAA,EAC3D,WAAA,GAAc;AACZ,IAAA,KAAA;AAAA,MACE;AAAA,KAIF;AAAA,EACF;AACF;AAOO,MAAM,gCAAgC,aAAA,CAAc;AAAC;AAcrD,SAAS,QAAQ,KAAA,EAAuB;AAC7C,EAAA,IAAI,KAAA,YAAiB,OAAO,OAAO,KAAA;AACnC,EAAA,MAAM,OAAA,GACJ,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,SAAS,CAAA,GACxC,KAAA,GACA,CAAA,yCAAA,EAA4C,OAAO,KAAK,CAAA,CAAA,CAAA;AAC9D,EAAA,OAAO,IAAI,KAAA,CAAM,OAAA,EAAS,EAAE,KAAA,EAAO,OAAO,CAAA;AAC5C;AA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