attaform 0.20.2 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/chunks/dev-key-collision-warnings.cjs +58 -0
  2. package/dist/chunks/dev-key-collision-warnings.cjs.map +1 -0
  3. package/dist/chunks/dev-key-collision-warnings.mjs +55 -0
  4. package/dist/chunks/dev-key-collision-warnings.mjs.map +1 -0
  5. package/dist/chunks/devtools.cjs +1 -1
  6. package/dist/chunks/devtools.mjs +1 -1
  7. package/dist/chunks/fingerprint.cjs +186 -0
  8. package/dist/chunks/fingerprint.cjs.map +1 -0
  9. package/dist/chunks/fingerprint.mjs +184 -0
  10. package/dist/chunks/fingerprint.mjs.map +1 -0
  11. package/dist/chunks/fingerprint2.cjs +162 -0
  12. package/dist/chunks/fingerprint2.cjs.map +1 -0
  13. package/dist/chunks/fingerprint2.mjs +160 -0
  14. package/dist/chunks/fingerprint2.mjs.map +1 -0
  15. package/dist/chunks/indexeddb.cjs +1 -1
  16. package/dist/chunks/indexeddb.mjs +1 -1
  17. package/dist/chunks/local-storage.cjs +1 -1
  18. package/dist/chunks/local-storage.mjs +1 -1
  19. package/dist/chunks/multi-tab-sync.cjs +367 -0
  20. package/dist/chunks/multi-tab-sync.cjs.map +1 -0
  21. package/dist/chunks/multi-tab-sync.mjs +364 -0
  22. package/dist/chunks/multi-tab-sync.mjs.map +1 -0
  23. package/dist/chunks/session-storage.cjs +1 -1
  24. package/dist/chunks/session-storage.mjs +1 -1
  25. package/dist/chunks/wire-persistence.cjs +396 -0
  26. package/dist/chunks/wire-persistence.cjs.map +1 -0
  27. package/dist/chunks/wire-persistence.mjs +394 -0
  28. package/dist/chunks/wire-persistence.mjs.map +1 -0
  29. package/dist/esbuild.cjs +28 -0
  30. package/dist/esbuild.cjs.map +1 -0
  31. package/dist/esbuild.d.cts +56 -0
  32. package/dist/esbuild.d.mts +56 -0
  33. package/dist/esbuild.d.ts +56 -0
  34. package/dist/esbuild.mjs +26 -0
  35. package/dist/esbuild.mjs.map +1 -0
  36. package/dist/index.cjs +5 -3
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +66 -70
  39. package/dist/index.d.mts +66 -70
  40. package/dist/index.d.ts +66 -70
  41. package/dist/index.mjs +5 -5
  42. package/dist/nuxt.d.cts +1 -1
  43. package/dist/nuxt.d.mts +1 -1
  44. package/dist/nuxt.d.ts +1 -1
  45. package/dist/rollup.cjs +24 -0
  46. package/dist/rollup.cjs.map +1 -0
  47. package/dist/rollup.d.cts +35 -0
  48. package/dist/rollup.d.mts +35 -0
  49. package/dist/rollup.d.ts +35 -0
  50. package/dist/rollup.mjs +22 -0
  51. package/dist/rollup.mjs.map +1 -0
  52. package/dist/rspack.cjs +10 -0
  53. package/dist/rspack.cjs.map +1 -0
  54. package/dist/rspack.d.cts +40 -0
  55. package/dist/rspack.d.mts +40 -0
  56. package/dist/rspack.d.ts +40 -0
  57. package/dist/rspack.mjs +8 -0
  58. package/dist/rspack.mjs.map +1 -0
  59. package/dist/runtime/plugins/attaform.cjs +2 -2
  60. package/dist/runtime/plugins/attaform.mjs +2 -2
  61. package/dist/shared/attaform.BJGA_UOS.mjs +37 -0
  62. package/dist/shared/attaform.BJGA_UOS.mjs.map +1 -0
  63. package/dist/shared/attaform.BRGIpZo4.cjs +26 -0
  64. package/dist/shared/attaform.BRGIpZo4.cjs.map +1 -0
  65. package/dist/shared/{attaform.DAKrGhxc.cjs → attaform.BSkvn43g.cjs} +101 -417
  66. package/dist/shared/attaform.BSkvn43g.cjs.map +1 -0
  67. package/dist/shared/{attaform.sWm8B15V.d.mts → attaform.BWfliRIK.d.cts} +172 -2
  68. package/dist/shared/{attaform.BGk8cfw2.mjs → attaform.Be8NZG9M.mjs} +178 -21
  69. package/dist/shared/attaform.Be8NZG9M.mjs.map +1 -0
  70. package/dist/shared/{attaform.D2SCCd4O.cjs → attaform.Bq5sX7TF.cjs} +2 -2
  71. package/dist/shared/{attaform.D2SCCd4O.cjs.map → attaform.Bq5sX7TF.cjs.map} +1 -1
  72. package/dist/shared/{attaform.ceGEAEMk.d.ts → attaform.Bv7dRDWK.d.ts} +172 -2
  73. package/dist/shared/attaform.C3Doa9Pt.mjs +24 -0
  74. package/dist/shared/attaform.C3Doa9Pt.mjs.map +1 -0
  75. package/dist/shared/{attaform.B_hph5AE.cjs → attaform.CICFZ1iS.cjs} +178 -20
  76. package/dist/shared/attaform.CICFZ1iS.cjs.map +1 -0
  77. package/dist/shared/attaform.CQN9R62B.cjs +39 -0
  78. package/dist/shared/attaform.CQN9R62B.cjs.map +1 -0
  79. package/dist/shared/{attaform.CwLjUqmQ.cjs → attaform.ClXwitZj.cjs} +735 -960
  80. package/dist/shared/attaform.ClXwitZj.cjs.map +1 -0
  81. package/dist/shared/{attaform.99cfHcIt.d.cts → attaform.D0dWZsJt.d.cts} +349 -77
  82. package/dist/shared/{attaform.99cfHcIt.d.mts → attaform.D0dWZsJt.d.mts} +349 -77
  83. package/dist/shared/{attaform.99cfHcIt.d.ts → attaform.D0dWZsJt.d.ts} +349 -77
  84. package/dist/shared/{attaform.z5j3LwJz.cjs → attaform.D32WwKk6.cjs} +216 -35
  85. package/dist/shared/attaform.D32WwKk6.cjs.map +1 -0
  86. package/dist/shared/{attaform.C5aYC_T8.mjs → attaform.DMEP_ENr.mjs} +39 -392
  87. package/dist/shared/attaform.DMEP_ENr.mjs.map +1 -0
  88. package/dist/shared/{attaform.tiWEVznj.mjs → attaform.DR6RmxWZ.mjs} +725 -962
  89. package/dist/shared/attaform.DR6RmxWZ.mjs.map +1 -0
  90. package/dist/shared/{attaform.Dt7dEcHk.mjs → attaform.DozgVlCE.mjs} +89 -405
  91. package/dist/shared/attaform.DozgVlCE.mjs.map +1 -0
  92. package/dist/shared/{attaform.DN5CvZrg.d.ts → attaform.Duecg2NO.d.mts} +2 -2
  93. package/dist/shared/attaform.DuzQYscR.d.cts +41 -0
  94. package/dist/shared/attaform.DuzQYscR.d.mts +41 -0
  95. package/dist/shared/attaform.DuzQYscR.d.ts +41 -0
  96. package/dist/shared/{attaform.BXinSW2T.d.mts → attaform.FudOcHaa.d.cts} +2 -2
  97. package/dist/shared/attaform.LEWUFqUw.cjs +54 -0
  98. package/dist/shared/attaform.LEWUFqUw.cjs.map +1 -0
  99. package/dist/shared/{attaform.CywE4y8x.d.cts → attaform.MtrpT6Ki.d.ts} +2 -2
  100. package/dist/shared/{attaform.DbRgDFa7.d.cts → attaform.NQ8mybyW.d.mts} +172 -2
  101. package/dist/shared/{attaform.Cd4AOfwu.cjs → attaform.S-pYLSo4.cjs} +68 -402
  102. package/dist/shared/attaform.S-pYLSo4.cjs.map +1 -0
  103. package/dist/shared/{attaform.CnrxbkB6.mjs → attaform.Y1ZGhM4k.mjs} +2 -2
  104. package/dist/shared/{attaform.CnrxbkB6.mjs.map → attaform.Y1ZGhM4k.mjs.map} +1 -1
  105. package/dist/shared/{attaform.QG5TG8lB.mjs → attaform.pmtahXKy.mjs} +216 -36
  106. package/dist/shared/attaform.pmtahXKy.mjs.map +1 -0
  107. package/dist/shared/attaform.sHkHv_98.mjs +51 -0
  108. package/dist/shared/attaform.sHkHv_98.mjs.map +1 -0
  109. package/dist/vite.cjs +9 -45
  110. package/dist/vite.cjs.map +1 -1
  111. package/dist/vite.d.cts +36 -0
  112. package/dist/vite.d.mts +36 -0
  113. package/dist/vite.d.ts +36 -0
  114. package/dist/vite.mjs +8 -44
  115. package/dist/vite.mjs.map +1 -1
  116. package/dist/webpack.cjs +10 -0
  117. package/dist/webpack.cjs.map +1 -0
  118. package/dist/webpack.d.cts +37 -0
  119. package/dist/webpack.d.mts +37 -0
  120. package/dist/webpack.d.ts +37 -0
  121. package/dist/webpack.mjs +8 -0
  122. package/dist/webpack.mjs.map +1 -0
  123. package/dist/zod-v3.cjs +3 -3
  124. package/dist/zod-v3.d.cts +3 -3
  125. package/dist/zod-v3.d.mts +3 -3
  126. package/dist/zod-v3.d.ts +3 -3
  127. package/dist/zod-v3.mjs +3 -3
  128. package/dist/zod-v4.cjs +3 -3
  129. package/dist/zod-v4.d.cts +4 -4
  130. package/dist/zod-v4.d.mts +4 -4
  131. package/dist/zod-v4.d.ts +4 -4
  132. package/dist/zod-v4.mjs +3 -3
  133. package/dist/zod.cjs +8 -8
  134. package/dist/zod.cjs.map +1 -1
  135. package/dist/zod.d.cts +52 -10
  136. package/dist/zod.d.mts +52 -10
  137. package/dist/zod.d.ts +52 -10
  138. package/dist/zod.mjs +6 -6
  139. package/dist/zod.mjs.map +1 -1
  140. package/package.json +19 -5
  141. package/dist/shared/attaform.BGk8cfw2.mjs.map +0 -1
  142. package/dist/shared/attaform.B_hph5AE.cjs.map +0 -1
  143. package/dist/shared/attaform.C5aYC_T8.mjs.map +0 -1
  144. package/dist/shared/attaform.Cd4AOfwu.cjs.map +0 -1
  145. package/dist/shared/attaform.CwLjUqmQ.cjs.map +0 -1
  146. package/dist/shared/attaform.DAKrGhxc.cjs.map +0 -1
  147. package/dist/shared/attaform.Dt7dEcHk.mjs.map +0 -1
  148. package/dist/shared/attaform.QG5TG8lB.mjs.map +0 -1
  149. package/dist/shared/attaform.tiWEVznj.mjs.map +0 -1
  150. package/dist/shared/attaform.z5j3LwJz.cjs.map +0 -1
@@ -1,8 +1,7 @@
1
- import { isFunction, cloneDeep } from 'lodash-es';
2
1
  import { z } from 'zod';
3
- import { f as fieldMetaStore, g as getFieldMetaForSchema, a as getFieldMetaListForSchema, s as slimPrimitivesWalk, c as createAbstractSchema, w as walkPathSegments, d as deriveDefaultWalk, p as peelEmbeddedDefault, N as NO_EMBEDDED_DEFAULT } from './attaform.BGk8cfw2.mjs';
4
- import { h as humanize, g as getAtPath, m as slimKindOf, k as setAtPath, e as isPlainRecord, o as useAbstractForm } from './attaform.tiWEVznj.mjs';
5
- import { a as AttaformError, _ as __DEV__, j as canonicalizePath, d as InvalidUseFormConfigError } from './attaform.QG5TG8lB.mjs';
2
+ import { f as fieldMetaStore, g as getFieldMetaForSchema, a as getFieldMetaListForSchema, s as slimPrimitivesWalk, c as createAbstractSchema, w as walkPathSegments, d as deriveDefaultWalk, b as getFieldMetaPathMap, m as mergeDeep, p as peelEmbeddedDefault, N as NO_EMBEDDED_DEFAULT } from './attaform.Be8NZG9M.mjs';
3
+ import { j as humanize, i as getAtPath, x as slimKindOf, w as setAtPath, B as useAbstractForm } from './attaform.DR6RmxWZ.mjs';
4
+ import { a as AttaformError, _ as __DEV__, j as canonicalizePath, d as InvalidUseFormConfigError } from './attaform.pmtahXKy.mjs';
6
5
 
7
6
  const fieldMeta = fieldMetaStore;
8
7
  function withMeta(schema, payload) {
@@ -19,6 +18,42 @@ function getFieldMetaList(schema) {
19
18
  return getFieldMetaListForSchema(schema);
20
19
  }
21
20
 
21
+ function cloneSchemaDeep(value) {
22
+ return clone(value, /* @__PURE__ */ new WeakMap());
23
+ }
24
+ function clone(value, seen) {
25
+ if (value === null || typeof value !== "object") return value;
26
+ if (seen.has(value)) return seen.get(value);
27
+ if (value instanceof RegExp) {
28
+ const copy2 = new RegExp(value.source, value.flags);
29
+ copy2.lastIndex = value.lastIndex;
30
+ seen.set(value, copy2);
31
+ return copy2;
32
+ }
33
+ if (value instanceof Date) {
34
+ const copy2 = new Date(value.getTime());
35
+ seen.set(value, copy2);
36
+ return copy2;
37
+ }
38
+ if (Array.isArray(value)) {
39
+ const copy2 = [];
40
+ seen.set(value, copy2);
41
+ for (let i = 0; i < value.length; i++) {
42
+ copy2[i] = clone(value[i], seen);
43
+ }
44
+ return copy2;
45
+ }
46
+ const copy = Object.create(Object.getPrototypeOf(value));
47
+ seen.set(value, copy);
48
+ const source = value;
49
+ for (const key of Reflect.ownKeys(value)) {
50
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
51
+ if (descriptor?.enumerable !== true) continue;
52
+ copy[key] = clone(source[key], seen);
53
+ }
54
+ return copy;
55
+ }
56
+
22
57
  class UnsupportedSchemaError extends AttaformError {
23
58
  }
24
59
 
@@ -199,10 +234,10 @@ function isAsyncEffect(schema) {
199
234
  return fn.constructor.name === "AsyncFunction";
200
235
  }
201
236
  function containsAsyncRefine(schema, seen) {
202
- return walkForAsync(schema, "refinement", /* @__PURE__ */ new WeakSet());
237
+ return walkForAsync(schema, "refinement", seen ?? /* @__PURE__ */ new WeakSet());
203
238
  }
204
239
  function containsAsyncTransform(schema, seen) {
205
- return walkForAsync(schema, "transform-or-preprocess", /* @__PURE__ */ new WeakSet());
240
+ return walkForAsync(schema, "transform-or-preprocess", seen ?? /* @__PURE__ */ new WeakSet());
206
241
  }
207
242
  function walkForAsync(schema, target, visited) {
208
243
  const candidate = schema;
@@ -525,254 +560,41 @@ function assertSupportedKinds(schema, path = [], lazyGetters = []) {
525
560
  }
526
561
  }
527
562
 
528
- const cyclicSentinel = "<cyclic>";
529
- function fingerprintZodSchema(schema) {
530
- const cache = /* @__PURE__ */ new WeakMap();
531
- const inProgress = /* @__PURE__ */ new WeakSet();
532
- return visit(schema, cache, inProgress);
533
- }
534
- function visit(schema, cache, inProgress) {
535
- const key = schema;
536
- const cached = cache.get(key);
537
- if (cached !== void 0) return cached;
538
- if (inProgress.has(key)) return cyclicSentinel;
539
- inProgress.add(key);
540
- try {
541
- const computed = computeFingerprint(schema, cache, inProgress);
542
- cache.set(key, computed);
543
- return computed;
544
- } finally {
545
- inProgress.delete(key);
546
- }
547
- }
548
- function getDef(schema) {
549
- return schema._def;
550
- }
551
- function computeFingerprint(schema, cache, inProgress) {
552
- const def = getDef(schema);
553
- const kind = def.typeName ?? "ZodUnknown";
554
- const recurse = (child) => visit(child, cache, inProgress);
555
- switch (kind) {
556
- case "ZodString":
557
- case "ZodNumber":
558
- case "ZodBigInt":
559
- case "ZodDate":
560
- return `${kind}${formatChecks(def.checks)}`;
561
- case "ZodBoolean":
562
- case "ZodNull":
563
- case "ZodUndefined":
564
- case "ZodAny":
565
- case "ZodUnknown":
566
- case "ZodNaN":
567
- case "ZodVoid":
568
- case "ZodNever":
569
- return kind;
570
- case "ZodLiteral":
571
- return `ZodLiteral:${canonicalStringify(def.value)}`;
572
- case "ZodEnum": {
573
- const values = Array.isArray(def.values) ? def.values : [];
574
- const sorted = [...values].sort((a, b) => {
575
- const as = String(a);
576
- const bs = String(b);
577
- return as < bs ? -1 : as > bs ? 1 : 0;
578
- });
579
- return `ZodEnum:${canonicalStringify(sorted)}`;
580
- }
581
- case "ZodNativeEnum": {
582
- const values = def.values && typeof def.values === "object" && !Array.isArray(def.values) ? Object.values(def.values) : [];
583
- const sorted = [...values].sort((a, b) => {
584
- const as = String(a);
585
- const bs = String(b);
586
- return as < bs ? -1 : as > bs ? 1 : 0;
587
- });
588
- return `ZodNativeEnum:${canonicalStringify(sorted)}`;
589
- }
590
- case "ZodObject": {
591
- const shape = readShapeSafely(def);
592
- const sortedEntries = Object.entries(shape).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${recurse(v)}`);
593
- return `ZodObject{${sortedEntries.join(",")}}${formatChecks(def.checks)}`;
594
- }
595
- case "ZodArray":
596
- return `ZodArray[${def.type === void 0 ? "?" : recurse(def.type)}]${formatChecks(def.checks)}`;
597
- case "ZodTuple": {
598
- const items = def.items ?? [];
599
- return `ZodTuple[${items.map(recurse).join(",")}]`;
600
- }
601
- case "ZodRecord": {
602
- const keyPart = def.keyType === void 0 ? "?" : recurse(def.keyType);
603
- const valuePart = def.valueType === void 0 ? "?" : recurse(def.valueType);
604
- return `ZodRecord<${keyPart},${valuePart}>`;
605
- }
606
- case "ZodUnion": {
607
- const options = (def.options ?? []).map(recurse).sort();
608
- return `ZodUnion(${options.join("|")})`;
609
- }
610
- case "ZodDiscriminatedUnion": {
611
- const disc = def.discriminator ?? "?";
612
- const options = (def.options ?? []).map(recurse).sort();
613
- return `ZodDiscriminatedUnion[${JSON.stringify(disc)}](${options.join("|")})`;
614
- }
615
- case "ZodOptional": {
616
- const inner = def.innerType;
617
- return inner === void 0 ? "ZodOptional(?)" : `ZodOptional(${recurse(inner)})`;
618
- }
619
- case "ZodNullable": {
620
- const inner = def.innerType;
621
- return inner === void 0 ? "ZodNullable(?)" : `ZodNullable(${recurse(inner)})`;
622
- }
623
- case "ZodDefault": {
624
- const inner = def.innerType;
625
- return `ZodDefault[${defaultFactoryRepr(def.defaultValue)}](${inner === void 0 ? "?" : recurse(inner)})`;
626
- }
627
- case "ZodReadonly": {
628
- const inner = def.innerType;
629
- return inner === void 0 ? "ZodReadonly(?)" : `ZodReadonly(${recurse(inner)})`;
630
- }
631
- case "ZodEffects": {
632
- const effectType = def.effect?.type ?? "effect";
633
- const inner = def.schema;
634
- return `ZodEffects:${effectType}:fn:*(${inner === void 0 ? "?" : recurse(inner)})`;
635
- }
636
- case "ZodPipeline": {
637
- const inner = def.in ?? def.out;
638
- return inner === void 0 ? "ZodPipeline(?)" : `ZodPipeline(${recurse(inner)})`;
639
- }
640
- case "ZodCatch": {
641
- const inner = def.innerType ?? def.schema;
642
- const catchRepr = defaultFactoryRepr(def.catchValue);
643
- return `ZodCatch[${catchRepr}](${inner === void 0 ? "?" : recurse(inner)})`;
644
- }
645
- case "ZodLazy": {
646
- const resolve = def.getter;
647
- if (typeof resolve !== "function") return "ZodLazy(?)";
648
- try {
649
- const inner = resolve();
650
- return `ZodLazy(${recurse(inner)})`;
651
- } catch {
652
- return "ZodLazy(?)";
653
- }
654
- }
655
- case "ZodIntersection": {
656
- const leftPart = def.left === void 0 ? "?" : recurse(def.left);
657
- const rightPart = def.right === void 0 ? "?" : recurse(def.right);
658
- const parts = [leftPart, rightPart].sort();
659
- return `ZodIntersection(${parts.join("&")})`;
660
- }
661
- case "ZodSet": {
662
- const inner = def.valueType;
663
- return inner === void 0 ? "ZodSet(?)" : `ZodSet<${recurse(inner)}>${formatChecks(def.checks)}`;
664
- }
665
- case "ZodBranded": {
666
- const inner = def.type;
667
- return inner === void 0 ? "ZodBranded(?)" : `ZodBranded(${recurse(inner)})`;
668
- }
669
- // Structural opacity — schemas whose runtime behaviour isn't
670
- // introspectable via `_def` fall here. Still distinguishable
671
- // from other kinds by the returned string.
672
- case "ZodPromise":
673
- case "ZodFunction":
674
- case "ZodMap":
675
- case "ZodSymbol":
676
- default:
677
- return `${kind}:*`;
678
- }
679
- }
680
- function readShapeSafely(def) {
681
- if (typeof def.shape !== "function") return {};
682
- try {
683
- return def.shape();
684
- } catch {
685
- return {};
686
- }
687
- }
688
- function defaultFactoryRepr(factory) {
689
- if (typeof factory !== "function") return "none";
690
- let first;
691
- let second;
692
- try {
693
- first = factory();
694
- second = factory();
695
- } catch {
696
- return "fn:*";
697
- }
698
- if (!Object.is(first, second)) return "fn:*";
699
- if (typeof first === "function") return "fn:*";
700
- return canonicalStringify(first);
701
- }
702
- function formatChecks(checks) {
703
- if (!Array.isArray(checks) || checks.length === 0) return "";
704
- const parts = checks.map((c) => canonicalStringify(c)).sort();
705
- return `[${parts.join(";")}]`;
706
- }
707
- function canonicalStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
708
- if (value === null) return "null";
709
- if (value === void 0) return "undefined";
710
- const t = typeof value;
711
- if (t === "string") return JSON.stringify(value);
712
- if (t === "number" || t === "boolean") return String(value);
713
- if (t === "bigint") return `${String(value)}n`;
714
- if (t === "function") return "fn:*";
715
- if (t === "symbol") return "symbol:*";
716
- if (Array.isArray(value)) {
717
- if (seen.has(value)) return "<cyclic>";
718
- seen.add(value);
719
- try {
720
- return `[${value.map((v) => canonicalStringify(v, seen)).join(",")}]`;
721
- } finally {
722
- seen.delete(value);
723
- }
724
- }
725
- if (t === "object") {
726
- const obj = value;
727
- if (seen.has(obj)) return "<cyclic>";
728
- seen.add(obj);
729
- try {
730
- if (value instanceof Date) return `date:${value.getTime()}`;
731
- if (value instanceof RegExp) return `regex:${String(value)}`;
732
- const entries = Object.entries(obj).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${canonicalStringify(v, seen)}`);
733
- return `{${entries.join(",")}}`;
734
- } finally {
735
- seen.delete(obj);
736
- }
737
- }
738
- return "unknown";
739
- }
740
-
741
563
  const V3_INTROSPECTOR = {
742
564
  kindOf: (schema) => kindOf(schema),
743
- getObjectShape: (schema) => getObjectShape(schema),
744
- getTupleItems: (schema) => getTupleItems(schema),
565
+ getObjectShape,
566
+ getTupleItems,
745
567
  getDiscriminatedOptions: (schema) => getDiscriminatedOptions(schema),
746
- getDiscriminator: (schema) => getDiscriminator(schema),
747
- getLiteralValues: (schema) => getLiteralValues(schema),
748
- isPreprocessNode: (schema) => isPreprocessNode(schema),
749
- isCoercePrimitive: (schema) => isCoercePrimitive(schema),
750
- containsAsyncRefine: (schema) => containsAsyncRefine(schema),
751
- containsAsyncTransform: (schema) => containsAsyncTransform(schema),
752
- hasContainerOrRootRefine: (schema) => hasContainerOrRootRefine(schema),
568
+ getDiscriminator,
569
+ getLiteralValues,
570
+ isPreprocessNode,
571
+ isCoercePrimitive,
572
+ containsAsyncRefine,
573
+ containsAsyncTransform,
574
+ hasContainerOrRootRefine,
753
575
  // Walker accessors (D2 / D3 / D5).
754
- getArrayElement: (schema) => getArrayElement(schema),
755
- getSetValueType: (schema) => getSetValueType(schema),
756
- getRecordKeyType: (schema) => getRecordKeyType(schema),
757
- getRecordValueType: (schema) => getRecordValueType(schema),
758
- getUnionOptions: (schema) => getUnionOptions(schema),
759
- getIntersectionLeft: (schema) => getIntersectionLeft(schema),
760
- getIntersectionRight: (schema) => getIntersectionRight(schema),
576
+ getArrayElement,
577
+ getSetValueType,
578
+ getRecordKeyType,
579
+ getRecordValueType,
580
+ getUnionOptions,
581
+ getIntersectionLeft,
582
+ getIntersectionRight,
761
583
  getEnumValues: (schema) => {
762
584
  if (!isZodSchemaType(schema, "ZodEnum")) return [];
763
585
  return schema.options;
764
586
  },
765
- getNativeEnumValues: (schema) => getNativeEnumValues(schema),
766
- unwrapInner: (schema) => unwrapInner(schema),
767
- unwrapBranded: (schema) => unwrapBranded(schema),
768
- unwrapEffectsSource: (schema) => unwrapEffectsSource(schema),
769
- unwrapPipeIn: (schema) => unwrapPipeIn(schema),
770
- unwrapPipeOut: (schema) => unwrapPipeOut(schema),
771
- unwrapLazy: (schema) => unwrapLazy(schema),
772
- getLazyGetter: (schema) => getLazyGetter(schema),
773
- getDefaultValue: (schema) => getDefaultValue$1(schema),
774
- getCatchDefault: (schema) => getCatchDefault(schema),
775
- hasCatchValue: (schema) => hasCatchValue(schema)
587
+ getNativeEnumValues,
588
+ unwrapInner,
589
+ unwrapBranded,
590
+ unwrapEffectsSource,
591
+ unwrapPipeIn,
592
+ unwrapPipeOut,
593
+ unwrapLazy,
594
+ getLazyGetter,
595
+ getDefaultValue: getDefaultValue$1,
596
+ getCatchDefault,
597
+ hasCatchValue
776
598
  };
777
599
 
778
600
  function slimPrimitivesV3(schema) {
@@ -953,22 +775,6 @@ function constraintsAreSlimValid(slimSchema, constraints) {
953
775
  return false;
954
776
  }
955
777
  }
956
- function mergeDeepV3(base, override) {
957
- if (override === void 0) return base;
958
- if (!isPlainRecord(override)) return override;
959
- if (!isPlainRecord(base)) return override;
960
- const result = { ...base };
961
- for (const key of Object.keys(override)) {
962
- const oVal = override[key];
963
- const bVal = base[key];
964
- if (isPlainRecord(oVal) && isPlainRecord(bVal)) {
965
- result[key] = mergeDeepV3(bVal, oVal);
966
- } else {
967
- result[key] = oVal;
968
- }
969
- }
970
- return result;
971
- }
972
778
  let warnedZodCodeMissing = false;
973
779
  function zodAdapter(zodSchema) {
974
780
  assertSupportedKinds(zodSchema);
@@ -991,9 +797,13 @@ function zodAdapter(zodSchema) {
991
797
  options
992
798
  );
993
799
  }
800
+ async function lazyFingerprint(schema) {
801
+ const { fingerprintZodSchema } = await import('../chunks/fingerprint.mjs');
802
+ return fingerprintZodSchema(schema);
803
+ }
994
804
  function buildV3Services() {
995
805
  return {
996
- fingerprint: (schema) => fingerprintZodSchema(schema),
806
+ fingerprint: (schema) => lazyFingerprint(schema),
997
807
  getNestedSchemasAtPath: (schema, path, maxRecursionDepth) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth),
998
808
  // v3 pre-strips refinements / defaults / wrappers off the root for
999
809
  // slim-mode walks — `getSlimPrimitiveTypesAtPath` and
@@ -1145,9 +955,14 @@ function isLeafRequiredV3(schema, depth = 0) {
1145
955
  return inner === void 0 ? true : isLeafRequiredV3(inner, depth + 1);
1146
956
  }
1147
957
  if (isZodSchemaType(schema, "ZodEffects")) {
958
+ if (getEffectsKind(schema) === "preprocess") return true;
1148
959
  const inner = unwrapEffectsSource(schema);
1149
960
  return inner === void 0 ? true : isLeafRequiredV3(inner, depth + 1);
1150
961
  }
962
+ if (isZodSchemaType(schema, "ZodLazy")) {
963
+ const inner = unwrapLazy(schema);
964
+ return inner === void 0 ? true : isLeafRequiredV3(inner, depth + 1);
965
+ }
1151
966
  if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
1152
967
  const options = getUnionOptions(schema);
1153
968
  if (options.length === 0) return true;
@@ -1194,6 +1009,7 @@ function unwrapToDiscriminatedUnion(schema, depth = 0) {
1194
1009
  continue;
1195
1010
  }
1196
1011
  if (isZodSchemaType(currentSchema, "ZodEffects")) {
1012
+ if (getEffectsKind(currentSchema) === "preprocess") return void 0;
1197
1013
  const inner = unwrapEffectsSource(currentSchema);
1198
1014
  if (!inner) return void 0;
1199
1015
  currentSchema = inner;
@@ -1411,7 +1227,7 @@ function stripRootSchema(schema, stripConfig) {
1411
1227
  }
1412
1228
  const getStripInstruction = (stripValueOrCallback, schema) => {
1413
1229
  if (stripValueOrCallback === void 0 || stripValueOrCallback === false) return false;
1414
- return isFunction(stripValueOrCallback) ? stripValueOrCallback(schema) : stripValueOrCallback;
1230
+ return typeof stripValueOrCallback === "function" ? stripValueOrCallback(schema) : stripValueOrCallback;
1415
1231
  };
1416
1232
  function getSlimSchema(config) {
1417
1233
  function _getSlimSchema(_schema) {
@@ -1441,7 +1257,7 @@ function getSlimSchema(config) {
1441
1257
  if (discKey === void 0) return _schema;
1442
1258
  for (const option of getDiscriminatedOptions(_schema)) {
1443
1259
  const slimmedSchema = _getSlimSchema(option);
1444
- const deepCloneSlimmedSchema = cloneDeep(slimmedSchema);
1260
+ const deepCloneSlimmedSchema = cloneSchemaDeep(slimmedSchema);
1445
1261
  slimmedSchemas.push(deepCloneSlimmedSchema);
1446
1262
  }
1447
1263
  return z.discriminatedUnion(
@@ -1503,142 +1319,6 @@ function peelAllV3Wrappers(schema) {
1503
1319
  }
1504
1320
  return current;
1505
1321
  }
1506
- const pathMetaCacheV3 = /* @__PURE__ */ new WeakMap();
1507
- function getPathMetaMapV3(rootSchema) {
1508
- const cached = pathMetaCacheV3.get(rootSchema);
1509
- if (cached !== void 0) return cached;
1510
- const map = /* @__PURE__ */ new Map();
1511
- const counters = /* @__PURE__ */ new Map();
1512
- const lastPathPerSchema = /* @__PURE__ */ new Map();
1513
- const inProgress = /* @__PURE__ */ new WeakSet();
1514
- walkForMetaV3(rootSchema, [], map, counters, lastPathPerSchema, inProgress);
1515
- for (const [schema, lastPath] of lastPathPerSchema) {
1516
- const list = getFieldMetaList(schema);
1517
- const consumed = counters.get(schema) ?? 0;
1518
- if (list.length <= consumed) continue;
1519
- const surplus = list.slice(consumed).reduce((acc, p) => ({ ...acc, ...p }), {});
1520
- const existing = map.get(lastPath) ?? {};
1521
- map.set(lastPath, { ...existing, ...surplus });
1522
- }
1523
- pathMetaCacheV3.set(rootSchema, map);
1524
- return map;
1525
- }
1526
- function consumePayloadV3(schema, counters) {
1527
- const list = getFieldMetaList(schema);
1528
- if (list.length === 0) return void 0;
1529
- const idx = counters.get(schema) ?? 0;
1530
- const payload = list[Math.min(idx, list.length - 1)];
1531
- counters.set(schema, idx + 1);
1532
- return payload;
1533
- }
1534
- function walkForMetaV3(schema, path, map, counters, lastPathPerSchema, inProgress) {
1535
- if (inProgress.has(schema)) return;
1536
- inProgress.add(schema);
1537
- try {
1538
- const pathKey = canonicalizePath(path).key;
1539
- if (!map.has(pathKey)) {
1540
- const payload = consumePayloadV3(schema, counters);
1541
- if (payload !== void 0) {
1542
- map.set(pathKey, payload);
1543
- lastPathPerSchema.set(schema, pathKey);
1544
- }
1545
- }
1546
- const peeled = peelAllV3Wrappers(schema);
1547
- if (peeled !== schema && !map.has(pathKey)) {
1548
- const payload = consumePayloadV3(peeled, counters);
1549
- if (payload !== void 0) {
1550
- map.set(pathKey, payload);
1551
- lastPathPerSchema.set(peeled, pathKey);
1552
- }
1553
- }
1554
- if (isZodSchemaType(schema, "ZodObject")) {
1555
- const shape = getObjectShape(schema);
1556
- for (const [key, child] of Object.entries(shape)) {
1557
- walkForMetaV3(
1558
- child,
1559
- [...path, key],
1560
- map,
1561
- counters,
1562
- lastPathPerSchema,
1563
- inProgress
1564
- );
1565
- }
1566
- return;
1567
- }
1568
- if (isZodSchemaType(schema, "ZodArray")) {
1569
- const inner = getArrayElement(schema);
1570
- if (inner) walkForMetaV3(inner, [...path, 0], map, counters, lastPathPerSchema, inProgress);
1571
- return;
1572
- }
1573
- if (isZodSchemaType(schema, "ZodTuple")) {
1574
- const items = getTupleItems(schema);
1575
- items.forEach((item, i) => {
1576
- walkForMetaV3(
1577
- item,
1578
- [...path, i],
1579
- map,
1580
- counters,
1581
- lastPathPerSchema,
1582
- inProgress
1583
- );
1584
- });
1585
- return;
1586
- }
1587
- if (isZodSchemaType(schema, "ZodSet")) {
1588
- const inner = getSetValueType(schema);
1589
- if (inner) walkForMetaV3(inner, [...path, 0], map, counters, lastPathPerSchema, inProgress);
1590
- return;
1591
- }
1592
- if (isZodSchemaType(schema, "ZodRecord")) {
1593
- const inner = getRecordValueType(schema);
1594
- if (inner) walkForMetaV3(inner, [...path, "*"], map, counters, lastPathPerSchema, inProgress);
1595
- return;
1596
- }
1597
- if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
1598
- for (const opt of getUnionOptions(schema)) {
1599
- walkForMetaV3(opt, path, map, counters, lastPathPerSchema, inProgress);
1600
- }
1601
- return;
1602
- }
1603
- if (isZodSchemaType(schema, "ZodIntersection")) {
1604
- const left = getIntersectionLeft(schema);
1605
- const right = getIntersectionRight(schema);
1606
- if (left) walkForMetaV3(left, path, map, counters, lastPathPerSchema, inProgress);
1607
- if (right) walkForMetaV3(right, path, map, counters, lastPathPerSchema, inProgress);
1608
- return;
1609
- }
1610
- if (isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodReadonly") || isZodSchemaType(schema, "ZodCatch")) {
1611
- const inner = unwrapInner(schema);
1612
- if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
1613
- return;
1614
- }
1615
- if (isZodSchemaType(schema, "ZodEffects")) {
1616
- const inner = unwrapEffectsSource(schema);
1617
- if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
1618
- return;
1619
- }
1620
- if (isZodSchemaType(schema, "ZodPipeline")) {
1621
- const inner = unwrapPipeIn(schema);
1622
- if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
1623
- return;
1624
- }
1625
- if (isZodSchemaType(schema, "ZodBranded")) {
1626
- const inner = unwrapBranded(schema);
1627
- if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
1628
- return;
1629
- }
1630
- if (isZodSchemaType(schema, "ZodLazy")) {
1631
- try {
1632
- const inner = unwrapLazy(schema);
1633
- if (inner) walkForMetaV3(inner, path, map, counters, lastPathPerSchema, inProgress);
1634
- } catch {
1635
- }
1636
- return;
1637
- }
1638
- } finally {
1639
- inProgress.delete(schema);
1640
- }
1641
- }
1642
1322
  function resolveFieldMetaAtPathV3(rootSchema, path, maxRecursionDepth) {
1643
1323
  const lastSegment = path.length === 0 ? "" : path[path.length - 1];
1644
1324
  const target = path.length === 0 ? rootSchema : getNestedZodSchemasAtPath(rootSchema, path, maxRecursionDepth)[0];
@@ -1650,7 +1330,11 @@ function resolveFieldMetaAtPathV3(rootSchema, path, maxRecursionDepth) {
1650
1330
  meta: Object.freeze({})
1651
1331
  };
1652
1332
  }
1653
- const pathMap = getPathMetaMapV3(rootSchema);
1333
+ const pathMap = getFieldMetaPathMap(rootSchema, {
1334
+ intro: V3_INTROSPECTOR,
1335
+ peelAllWrappers: peelAllV3Wrappers,
1336
+ getFieldMetaList
1337
+ });
1654
1338
  const pathKey = canonicalizePath(path).key;
1655
1339
  const peeled = peelV3Wrappers(target);
1656
1340
  const payload = pathMap.get(pathKey) ?? getFieldMeta(target) ?? (peeled !== target ? getFieldMeta(peeled) : void 0);
@@ -1684,7 +1368,7 @@ function runStrictGetDefaultsV3(rootSchema, config, formKey, maxRecursionDepth)
1684
1368
  });
1685
1369
  let rawDefaultValues = defaultValuesWithoutConstraints;
1686
1370
  if (!isPrimitive(rawDefaultValues)) {
1687
- rawDefaultValues = mergeDeepV3(defaultValuesWithoutConstraints, config.constraints);
1371
+ rawDefaultValues = mergeDeep(defaultValuesWithoutConstraints, config.constraints);
1688
1372
  } else if (constraintsAreSlimValid(slimSchema, config.constraints)) {
1689
1373
  rawDefaultValues = config.constraints;
1690
1374
  }
@@ -1832,7 +1516,7 @@ function runStrictGetDefaultsV3(rootSchema, config, formKey, maxRecursionDepth)
1832
1516
  }
1833
1517
  }
1834
1518
  }
1835
- fixedData = mergeDeepV3(rawDefaultValues, fixedData);
1519
+ fixedData = mergeDeep(rawDefaultValues, fixedData);
1836
1520
  const secondParse = slimSchema.safeParse(fixedData);
1837
1521
  const finalData = secondParse.success ? secondParse.data : fixedData;
1838
1522
  return {
@@ -1873,4 +1557,4 @@ function useForm(configuration) {
1873
1557
  }
1874
1558
 
1875
1559
  export { fieldMeta as f, isZodSchemaType as i, useForm as u, withMeta as w, zodAdapter as z };
1876
- //# sourceMappingURL=attaform.Dt7dEcHk.mjs.map
1560
+ //# sourceMappingURL=attaform.DozgVlCE.mjs.map