@weavelogic/knowledge-graph-agent 0.2.0 → 0.3.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.
Files changed (585) hide show
  1. package/README.md +686 -304
  2. package/dist/_virtual/_commonjsHelpers.js +7 -0
  3. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  4. package/dist/_virtual/additionalItems.js +5 -0
  5. package/dist/_virtual/additionalItems.js.map +1 -0
  6. package/dist/_virtual/additionalProperties.js +5 -0
  7. package/dist/_virtual/additionalProperties.js.map +1 -0
  8. package/dist/_virtual/ajv.js +6 -0
  9. package/dist/_virtual/ajv.js.map +1 -0
  10. package/dist/_virtual/ajv2.js +5 -0
  11. package/dist/_virtual/ajv2.js.map +1 -0
  12. package/dist/_virtual/allOf.js +5 -0
  13. package/dist/_virtual/allOf.js.map +1 -0
  14. package/dist/_virtual/anyOf.js +5 -0
  15. package/dist/_virtual/anyOf.js.map +1 -0
  16. package/dist/_virtual/applicability.js +5 -0
  17. package/dist/_virtual/applicability.js.map +1 -0
  18. package/dist/_virtual/boolSchema.js +5 -0
  19. package/dist/_virtual/boolSchema.js.map +1 -0
  20. package/dist/_virtual/code.js +5 -0
  21. package/dist/_virtual/code.js.map +1 -0
  22. package/dist/_virtual/code2.js +5 -0
  23. package/dist/_virtual/code2.js.map +1 -0
  24. package/dist/_virtual/const.js +5 -0
  25. package/dist/_virtual/const.js.map +1 -0
  26. package/dist/_virtual/contains.js +5 -0
  27. package/dist/_virtual/contains.js.map +1 -0
  28. package/dist/_virtual/core.js +5 -0
  29. package/dist/_virtual/core.js.map +1 -0
  30. package/dist/_virtual/dataType.js +5 -0
  31. package/dist/_virtual/dataType.js.map +1 -0
  32. package/dist/_virtual/defaults.js +5 -0
  33. package/dist/_virtual/defaults.js.map +1 -0
  34. package/dist/_virtual/dependencies.js +5 -0
  35. package/dist/_virtual/dependencies.js.map +1 -0
  36. package/dist/_virtual/draft7.js +5 -0
  37. package/dist/_virtual/draft7.js.map +1 -0
  38. package/dist/_virtual/enum.js +5 -0
  39. package/dist/_virtual/enum.js.map +1 -0
  40. package/dist/_virtual/equal.js +5 -0
  41. package/dist/_virtual/equal.js.map +1 -0
  42. package/dist/_virtual/errors.js +5 -0
  43. package/dist/_virtual/errors.js.map +1 -0
  44. package/dist/_virtual/format.js +5 -0
  45. package/dist/_virtual/format.js.map +1 -0
  46. package/dist/_virtual/formats.js +5 -0
  47. package/dist/_virtual/formats.js.map +1 -0
  48. package/dist/_virtual/id.js +5 -0
  49. package/dist/_virtual/id.js.map +1 -0
  50. package/dist/_virtual/if.js +5 -0
  51. package/dist/_virtual/if.js.map +1 -0
  52. package/dist/_virtual/index.js +8 -0
  53. package/dist/_virtual/index.js.map +1 -0
  54. package/dist/_virtual/index10.js +5 -0
  55. package/dist/_virtual/index10.js.map +1 -0
  56. package/dist/_virtual/index11.js +5 -0
  57. package/dist/_virtual/index11.js.map +1 -0
  58. package/dist/_virtual/index12.js +5 -0
  59. package/dist/_virtual/index12.js.map +1 -0
  60. package/dist/_virtual/index2.js +5 -0
  61. package/dist/_virtual/index2.js.map +1 -0
  62. package/dist/_virtual/index3.js +5 -0
  63. package/dist/_virtual/index3.js.map +1 -0
  64. package/dist/_virtual/index4.js +5 -0
  65. package/dist/_virtual/index4.js.map +1 -0
  66. package/dist/_virtual/index5.js +5 -0
  67. package/dist/_virtual/index5.js.map +1 -0
  68. package/dist/_virtual/index6.js +5 -0
  69. package/dist/_virtual/index6.js.map +1 -0
  70. package/dist/_virtual/index7.js +5 -0
  71. package/dist/_virtual/index7.js.map +1 -0
  72. package/dist/_virtual/index8.js +5 -0
  73. package/dist/_virtual/index8.js.map +1 -0
  74. package/dist/_virtual/index9.js +5 -0
  75. package/dist/_virtual/index9.js.map +1 -0
  76. package/dist/_virtual/items.js +5 -0
  77. package/dist/_virtual/items.js.map +1 -0
  78. package/dist/_virtual/items2020.js +5 -0
  79. package/dist/_virtual/items2020.js.map +1 -0
  80. package/dist/_virtual/keyword.js +5 -0
  81. package/dist/_virtual/keyword.js.map +1 -0
  82. package/dist/_virtual/limit.js +5 -0
  83. package/dist/_virtual/limit.js.map +1 -0
  84. package/dist/_virtual/limitItems.js +5 -0
  85. package/dist/_virtual/limitItems.js.map +1 -0
  86. package/dist/_virtual/limitLength.js +5 -0
  87. package/dist/_virtual/limitLength.js.map +1 -0
  88. package/dist/_virtual/limitNumber.js +5 -0
  89. package/dist/_virtual/limitNumber.js.map +1 -0
  90. package/dist/_virtual/limitProperties.js +5 -0
  91. package/dist/_virtual/limitProperties.js.map +1 -0
  92. package/dist/_virtual/metadata.js +5 -0
  93. package/dist/_virtual/metadata.js.map +1 -0
  94. package/dist/_virtual/multipleOf.js +5 -0
  95. package/dist/_virtual/multipleOf.js.map +1 -0
  96. package/dist/_virtual/names.js +5 -0
  97. package/dist/_virtual/names.js.map +1 -0
  98. package/dist/_virtual/not.js +5 -0
  99. package/dist/_virtual/not.js.map +1 -0
  100. package/dist/_virtual/oneOf.js +5 -0
  101. package/dist/_virtual/oneOf.js.map +1 -0
  102. package/dist/_virtual/pattern.js +5 -0
  103. package/dist/_virtual/pattern.js.map +1 -0
  104. package/dist/_virtual/patternProperties.js +5 -0
  105. package/dist/_virtual/patternProperties.js.map +1 -0
  106. package/dist/_virtual/prefixItems.js +5 -0
  107. package/dist/_virtual/prefixItems.js.map +1 -0
  108. package/dist/_virtual/properties.js +5 -0
  109. package/dist/_virtual/properties.js.map +1 -0
  110. package/dist/_virtual/propertyNames.js +5 -0
  111. package/dist/_virtual/propertyNames.js.map +1 -0
  112. package/dist/_virtual/ref.js +5 -0
  113. package/dist/_virtual/ref.js.map +1 -0
  114. package/dist/_virtual/ref_error.js +5 -0
  115. package/dist/_virtual/ref_error.js.map +1 -0
  116. package/dist/_virtual/required.js +5 -0
  117. package/dist/_virtual/required.js.map +1 -0
  118. package/dist/_virtual/resolve.js +5 -0
  119. package/dist/_virtual/resolve.js.map +1 -0
  120. package/dist/_virtual/rules.js +5 -0
  121. package/dist/_virtual/rules.js.map +1 -0
  122. package/dist/_virtual/scope.js +5 -0
  123. package/dist/_virtual/scope.js.map +1 -0
  124. package/dist/_virtual/subschema.js +5 -0
  125. package/dist/_virtual/subschema.js.map +1 -0
  126. package/dist/_virtual/thenElse.js +5 -0
  127. package/dist/_virtual/thenElse.js.map +1 -0
  128. package/dist/_virtual/types.js +5 -0
  129. package/dist/_virtual/types.js.map +1 -0
  130. package/dist/_virtual/ucs2length.js +5 -0
  131. package/dist/_virtual/ucs2length.js.map +1 -0
  132. package/dist/_virtual/uniqueItems.js +5 -0
  133. package/dist/_virtual/uniqueItems.js.map +1 -0
  134. package/dist/_virtual/uri.js +5 -0
  135. package/dist/_virtual/uri.js.map +1 -0
  136. package/dist/_virtual/util.js +5 -0
  137. package/dist/_virtual/util.js.map +1 -0
  138. package/dist/_virtual/validation_error.js +5 -0
  139. package/dist/_virtual/validation_error.js.map +1 -0
  140. package/dist/agents/analyst-agent.d.ts +230 -0
  141. package/dist/agents/analyst-agent.d.ts.map +1 -0
  142. package/dist/agents/analyst-agent.js +793 -0
  143. package/dist/agents/analyst-agent.js.map +1 -0
  144. package/dist/agents/architect-agent.d.ts +248 -0
  145. package/dist/agents/architect-agent.d.ts.map +1 -0
  146. package/dist/agents/architect-agent.js +685 -0
  147. package/dist/agents/architect-agent.js.map +1 -0
  148. package/dist/agents/base-agent.d.ts +169 -0
  149. package/dist/agents/base-agent.d.ts.map +1 -0
  150. package/dist/agents/base-agent.js +441 -0
  151. package/dist/agents/base-agent.js.map +1 -0
  152. package/dist/agents/coder-agent.d.ts +191 -0
  153. package/dist/agents/coder-agent.d.ts.map +1 -0
  154. package/dist/agents/coder-agent.js +1008 -0
  155. package/dist/agents/coder-agent.js.map +1 -0
  156. package/dist/agents/index.d.ts +18 -0
  157. package/dist/agents/index.d.ts.map +1 -0
  158. package/dist/agents/index.js +40 -0
  159. package/dist/agents/index.js.map +1 -0
  160. package/dist/agents/registry.d.ts +213 -0
  161. package/dist/agents/registry.d.ts.map +1 -0
  162. package/dist/agents/registry.js +419 -0
  163. package/dist/agents/registry.js.map +1 -0
  164. package/dist/agents/researcher-agent.d.ts +226 -0
  165. package/dist/agents/researcher-agent.d.ts.map +1 -0
  166. package/dist/agents/researcher-agent.js +572 -0
  167. package/dist/agents/researcher-agent.js.map +1 -0
  168. package/dist/agents/rules-engine.d.ts +320 -0
  169. package/dist/agents/rules-engine.d.ts.map +1 -0
  170. package/dist/agents/rules-engine.js +552 -0
  171. package/dist/agents/rules-engine.js.map +1 -0
  172. package/dist/agents/tester-agent.d.ts +219 -0
  173. package/dist/agents/tester-agent.d.ts.map +1 -0
  174. package/dist/agents/tester-agent.js +683 -0
  175. package/dist/agents/tester-agent.js.map +1 -0
  176. package/dist/agents/types.d.ts +425 -0
  177. package/dist/agents/types.d.ts.map +1 -0
  178. package/dist/agents/types.js +57 -0
  179. package/dist/agents/types.js.map +1 -0
  180. package/dist/caching/index.d.ts +55 -0
  181. package/dist/caching/index.d.ts.map +1 -0
  182. package/dist/caching/index.js +206 -0
  183. package/dist/caching/index.js.map +1 -0
  184. package/dist/caching/lru-cache.d.ts +254 -0
  185. package/dist/caching/lru-cache.d.ts.map +1 -0
  186. package/dist/caching/types.d.ts +95 -0
  187. package/dist/caching/types.d.ts.map +1 -0
  188. package/dist/chunking/chunker.d.ts +94 -0
  189. package/dist/chunking/chunker.d.ts.map +1 -0
  190. package/dist/chunking/index.d.ts +125 -0
  191. package/dist/chunking/index.d.ts.map +1 -0
  192. package/dist/chunking/index.js +283 -0
  193. package/dist/chunking/index.js.map +1 -0
  194. package/dist/chunking/types.d.ts +92 -0
  195. package/dist/chunking/types.d.ts.map +1 -0
  196. package/dist/cli/commands/commit.d.ts +11 -0
  197. package/dist/cli/commands/commit.d.ts.map +1 -0
  198. package/dist/cli/commands/commit.js +379 -0
  199. package/dist/cli/commands/commit.js.map +1 -0
  200. package/dist/cli/commands/config.d.ts +8 -0
  201. package/dist/cli/commands/config.d.ts.map +1 -0
  202. package/dist/cli/commands/config.js +107 -0
  203. package/dist/cli/commands/config.js.map +1 -0
  204. package/dist/cli/commands/cultivate.d.ts +16 -0
  205. package/dist/cli/commands/cultivate.d.ts.map +1 -0
  206. package/dist/cli/commands/cultivate.js +254 -0
  207. package/dist/cli/commands/cultivate.js.map +1 -0
  208. package/dist/cli/commands/diagnostics.d.ts +8 -0
  209. package/dist/cli/commands/diagnostics.d.ts.map +1 -0
  210. package/dist/cli/commands/diagnostics.js +140 -0
  211. package/dist/cli/commands/diagnostics.js.map +1 -0
  212. package/dist/cli/commands/generate.d.ts +13 -0
  213. package/dist/cli/commands/generate.d.ts.map +1 -0
  214. package/dist/cli/commands/init-primitives.d.ts +19 -0
  215. package/dist/cli/commands/init-primitives.d.ts.map +1 -0
  216. package/dist/cli/commands/init-primitives.js +208 -0
  217. package/dist/cli/commands/init-primitives.js.map +1 -0
  218. package/dist/cli/commands/sop.d.ts +14 -0
  219. package/dist/cli/commands/sop.d.ts.map +1 -0
  220. package/dist/cli/commands/sop.js +598 -0
  221. package/dist/cli/commands/sop.js.map +1 -0
  222. package/dist/cli/index.d.ts.map +1 -1
  223. package/dist/cli/index.js +40 -1
  224. package/dist/cli/index.js.map +1 -1
  225. package/dist/config/index.d.ts +153 -0
  226. package/dist/config/index.d.ts.map +1 -0
  227. package/dist/config/index.js +141 -0
  228. package/dist/config/index.js.map +1 -0
  229. package/dist/config/manager.d.ts +136 -0
  230. package/dist/config/manager.d.ts.map +1 -0
  231. package/dist/config/types.d.ts +127 -0
  232. package/dist/config/types.d.ts.map +1 -0
  233. package/dist/core/cache.d.ts +185 -0
  234. package/dist/core/cache.d.ts.map +1 -0
  235. package/dist/core/cache.js +435 -0
  236. package/dist/core/cache.js.map +1 -0
  237. package/dist/cultivation/deep-analyzer.d.ts +129 -0
  238. package/dist/cultivation/deep-analyzer.d.ts.map +1 -0
  239. package/dist/cultivation/deep-analyzer.js +322 -0
  240. package/dist/cultivation/deep-analyzer.js.map +1 -0
  241. package/dist/cultivation/index.d.ts +13 -0
  242. package/dist/cultivation/index.d.ts.map +1 -0
  243. package/dist/cultivation/seed-generator.d.ts +92 -0
  244. package/dist/cultivation/seed-generator.d.ts.map +1 -0
  245. package/dist/cultivation/seed-generator.js +1033 -0
  246. package/dist/cultivation/seed-generator.js.map +1 -0
  247. package/dist/cultivation/types.d.ts +230 -0
  248. package/dist/cultivation/types.d.ts.map +1 -0
  249. package/dist/generators/claude-md.d.ts +7 -0
  250. package/dist/generators/claude-md.d.ts.map +1 -1
  251. package/dist/generators/claude-md.js.map +1 -1
  252. package/dist/generators/docs-init.d.ts +6 -0
  253. package/dist/generators/docs-init.d.ts.map +1 -1
  254. package/dist/generators/docs-init.js.map +1 -1
  255. package/dist/health/checks.d.ts +135 -0
  256. package/dist/health/checks.d.ts.map +1 -0
  257. package/dist/health/index.d.ts +119 -0
  258. package/dist/health/index.d.ts.map +1 -0
  259. package/dist/health/index.js +191 -0
  260. package/dist/health/index.js.map +1 -0
  261. package/dist/health/monitor.d.ts +146 -0
  262. package/dist/health/monitor.d.ts.map +1 -0
  263. package/dist/health/types.d.ts +135 -0
  264. package/dist/health/types.d.ts.map +1 -0
  265. package/dist/index.d.ts +30 -0
  266. package/dist/index.d.ts.map +1 -1
  267. package/dist/index.js +173 -1
  268. package/dist/index.js.map +1 -1
  269. package/dist/integrations/auto-commit.d.ts +175 -0
  270. package/dist/integrations/auto-commit.d.ts.map +1 -0
  271. package/dist/integrations/auto-commit.js +399 -0
  272. package/dist/integrations/auto-commit.js.map +1 -0
  273. package/dist/integrations/git.d.ts +299 -0
  274. package/dist/integrations/git.d.ts.map +1 -0
  275. package/dist/integrations/git.js +465 -0
  276. package/dist/integrations/git.js.map +1 -0
  277. package/dist/mcp-server/bin.d.ts +11 -0
  278. package/dist/mcp-server/bin.d.ts.map +1 -0
  279. package/dist/mcp-server/handlers/index.d.ts +57 -0
  280. package/dist/mcp-server/handlers/index.d.ts.map +1 -0
  281. package/dist/mcp-server/handlers/index.js +235 -0
  282. package/dist/mcp-server/handlers/index.js.map +1 -0
  283. package/dist/mcp-server/index.d.ts +28 -0
  284. package/dist/mcp-server/index.d.ts.map +1 -0
  285. package/dist/mcp-server/server.d.ts +133 -0
  286. package/dist/mcp-server/server.d.ts.map +1 -0
  287. package/dist/mcp-server/server.js +280 -0
  288. package/dist/mcp-server/server.js.map +1 -0
  289. package/dist/mcp-server/tools/agents/index.d.ts +10 -0
  290. package/dist/mcp-server/tools/agents/index.d.ts.map +1 -0
  291. package/dist/mcp-server/tools/agents/list.d.ts +19 -0
  292. package/dist/mcp-server/tools/agents/list.d.ts.map +1 -0
  293. package/dist/mcp-server/tools/agents/spawn.d.ts +19 -0
  294. package/dist/mcp-server/tools/agents/spawn.d.ts.map +1 -0
  295. package/dist/mcp-server/tools/graph/generate.d.ts +21 -0
  296. package/dist/mcp-server/tools/graph/generate.d.ts.map +1 -0
  297. package/dist/mcp-server/tools/graph/index.d.ts +11 -0
  298. package/dist/mcp-server/tools/graph/index.d.ts.map +1 -0
  299. package/dist/mcp-server/tools/graph/query.d.ts +22 -0
  300. package/dist/mcp-server/tools/graph/query.d.ts.map +1 -0
  301. package/dist/mcp-server/tools/graph/stats.d.ts +22 -0
  302. package/dist/mcp-server/tools/graph/stats.d.ts.map +1 -0
  303. package/dist/mcp-server/tools/health.d.ts +21 -0
  304. package/dist/mcp-server/tools/health.d.ts.map +1 -0
  305. package/dist/mcp-server/tools/index.d.ts +13 -0
  306. package/dist/mcp-server/tools/index.d.ts.map +1 -0
  307. package/dist/mcp-server/tools/registry.d.ts +90 -0
  308. package/dist/mcp-server/tools/registry.d.ts.map +1 -0
  309. package/dist/mcp-server/tools/registry.js +663 -0
  310. package/dist/mcp-server/tools/registry.js.map +1 -0
  311. package/dist/mcp-server/tools/search/index.d.ts +10 -0
  312. package/dist/mcp-server/tools/search/index.d.ts.map +1 -0
  313. package/dist/mcp-server/tools/search/nodes.d.ts +22 -0
  314. package/dist/mcp-server/tools/search/nodes.d.ts.map +1 -0
  315. package/dist/mcp-server/tools/search/tags.d.ts +22 -0
  316. package/dist/mcp-server/tools/search/tags.d.ts.map +1 -0
  317. package/dist/mcp-server/types/index.d.ts +286 -0
  318. package/dist/mcp-server/types/index.d.ts.map +1 -0
  319. package/dist/memory/index.d.ts +10 -0
  320. package/dist/memory/index.d.ts.map +1 -0
  321. package/dist/memory/vault-sync.d.ts +212 -0
  322. package/dist/memory/vault-sync.d.ts.map +1 -0
  323. package/dist/memory/vault-sync.js +463 -0
  324. package/dist/memory/vault-sync.js.map +1 -0
  325. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +296 -0
  326. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
  327. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +71 -0
  328. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
  329. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +26 -0
  330. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  331. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +407 -0
  332. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
  333. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1332 -0
  334. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
  335. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +71 -0
  336. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
  337. package/dist/node_modules/ajv/dist/ajv.js +84 -0
  338. package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
  339. package/dist/node_modules/ajv/dist/compile/codegen/code.js +160 -0
  340. package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
  341. package/dist/node_modules/ajv/dist/compile/codegen/index.js +728 -0
  342. package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
  343. package/dist/node_modules/ajv/dist/compile/codegen/scope.js +152 -0
  344. package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
  345. package/dist/node_modules/ajv/dist/compile/errors.js +131 -0
  346. package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
  347. package/dist/node_modules/ajv/dist/compile/index.js +234 -0
  348. package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
  349. package/dist/node_modules/ajv/dist/compile/names.js +44 -0
  350. package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
  351. package/dist/node_modules/ajv/dist/compile/ref_error.js +22 -0
  352. package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
  353. package/dist/node_modules/ajv/dist/compile/resolve.js +163 -0
  354. package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
  355. package/dist/node_modules/ajv/dist/compile/rules.js +35 -0
  356. package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
  357. package/dist/node_modules/ajv/dist/compile/util.js +173 -0
  358. package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
  359. package/dist/node_modules/ajv/dist/compile/validate/applicability.js +27 -0
  360. package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
  361. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +58 -0
  362. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
  363. package/dist/node_modules/ajv/dist/compile/validate/dataType.js +193 -0
  364. package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
  365. package/dist/node_modules/ajv/dist/compile/validate/defaults.js +43 -0
  366. package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
  367. package/dist/node_modules/ajv/dist/compile/validate/index.js +522 -0
  368. package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
  369. package/dist/node_modules/ajv/dist/compile/validate/keyword.js +126 -0
  370. package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
  371. package/dist/node_modules/ajv/dist/compile/validate/subschema.js +89 -0
  372. package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
  373. package/dist/node_modules/ajv/dist/core.js +628 -0
  374. package/dist/node_modules/ajv/dist/core.js.map +1 -0
  375. package/dist/node_modules/ajv/dist/refs/data.json.js +24 -0
  376. package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
  377. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +25 -0
  378. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
  379. package/dist/node_modules/ajv/dist/runtime/equal.js +16 -0
  380. package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
  381. package/dist/node_modules/ajv/dist/runtime/ucs2length.js +30 -0
  382. package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
  383. package/dist/node_modules/ajv/dist/runtime/uri.js +16 -0
  384. package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  385. package/dist/node_modules/ajv/dist/runtime/validation_error.js +20 -0
  386. package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
  387. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +59 -0
  388. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
  389. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +114 -0
  390. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
  391. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +32 -0
  392. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
  393. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +22 -0
  394. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
  395. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +100 -0
  396. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
  397. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +103 -0
  398. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
  399. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +75 -0
  400. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
  401. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +68 -0
  402. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
  403. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +64 -0
  404. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
  405. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +43 -0
  406. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
  407. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +36 -0
  408. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
  409. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
  410. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
  411. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +81 -0
  412. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
  413. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +22 -0
  414. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
  415. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +66 -0
  416. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
  417. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +49 -0
  418. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
  419. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +23 -0
  420. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
  421. package/dist/node_modules/ajv/dist/vocabularies/code.js +140 -0
  422. package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
  423. package/dist/node_modules/ajv/dist/vocabularies/core/id.js +19 -0
  424. package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
  425. package/dist/node_modules/ajv/dist/vocabularies/core/index.js +27 -0
  426. package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
  427. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +132 -0
  428. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
  429. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +114 -0
  430. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
  431. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +18 -0
  432. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
  433. package/dist/node_modules/ajv/dist/vocabularies/draft7.js +31 -0
  434. package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
  435. package/dist/node_modules/ajv/dist/vocabularies/format/format.js +95 -0
  436. package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
  437. package/dist/node_modules/ajv/dist/vocabularies/format/index.js +16 -0
  438. package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
  439. package/dist/node_modules/ajv/dist/vocabularies/metadata.js +27 -0
  440. package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
  441. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +36 -0
  442. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
  443. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +56 -0
  444. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
  445. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +52 -0
  446. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
  447. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +34 -0
  448. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
  449. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +39 -0
  450. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
  451. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +37 -0
  452. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
  453. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +34 -0
  454. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
  455. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +33 -0
  456. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
  457. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +34 -0
  458. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
  459. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +89 -0
  460. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
  461. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +75 -0
  462. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
  463. package/dist/node_modules/ajv-formats/dist/formats.js +209 -0
  464. package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
  465. package/dist/node_modules/ajv-formats/dist/index.js +51 -0
  466. package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
  467. package/dist/node_modules/ajv-formats/dist/limit.js +80 -0
  468. package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
  469. package/dist/node_modules/fast-deep-equal/index.js +39 -0
  470. package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
  471. package/dist/node_modules/fast-uri/index.js +261 -0
  472. package/dist/node_modules/fast-uri/index.js.map +1 -0
  473. package/dist/node_modules/fast-uri/lib/schemes.js +215 -0
  474. package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
  475. package/dist/node_modules/fast-uri/lib/utils.js +261 -0
  476. package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
  477. package/dist/node_modules/json-schema-traverse/index.js +92 -0
  478. package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
  479. package/dist/node_modules/zod/v4/classic/errors.js +37 -0
  480. package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
  481. package/dist/node_modules/zod/v4/classic/iso.js +43 -0
  482. package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
  483. package/dist/node_modules/zod/v4/classic/parse.js +13 -0
  484. package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
  485. package/dist/node_modules/zod/v4/classic/schemas.js +688 -0
  486. package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
  487. package/dist/node_modules/zod/v4/core/api.js +492 -0
  488. package/dist/node_modules/zod/v4/core/api.js.map +1 -0
  489. package/dist/node_modules/zod/v4/core/checks.js +405 -0
  490. package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
  491. package/dist/node_modules/zod/v4/core/core.js +58 -0
  492. package/dist/node_modules/zod/v4/core/core.js.map +1 -0
  493. package/dist/node_modules/zod/v4/core/doc.js +38 -0
  494. package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
  495. package/dist/node_modules/zod/v4/core/errors.js +82 -0
  496. package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
  497. package/dist/node_modules/zod/v4/core/parse.js +60 -0
  498. package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
  499. package/dist/node_modules/zod/v4/core/regexes.js +87 -0
  500. package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
  501. package/dist/node_modules/zod/v4/core/registries.js +52 -0
  502. package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
  503. package/dist/node_modules/zod/v4/core/schemas.js +1283 -0
  504. package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
  505. package/dist/node_modules/zod/v4/core/util.js +341 -0
  506. package/dist/node_modules/zod/v4/core/util.js.map +1 -0
  507. package/dist/node_modules/zod/v4/core/versions.js +9 -0
  508. package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
  509. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +2 -0
  510. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
  511. package/dist/reasoning/index.d.ts +74 -0
  512. package/dist/reasoning/index.d.ts.map +1 -0
  513. package/dist/reasoning/index.js +124 -0
  514. package/dist/reasoning/index.js.map +1 -0
  515. package/dist/reasoning/tracker.d.ts +210 -0
  516. package/dist/reasoning/tracker.d.ts.map +1 -0
  517. package/dist/reasoning/types.d.ts +146 -0
  518. package/dist/reasoning/types.d.ts.map +1 -0
  519. package/dist/recovery/backup.d.ts +110 -0
  520. package/dist/recovery/backup.d.ts.map +1 -0
  521. package/dist/recovery/index.d.ts +70 -0
  522. package/dist/recovery/index.d.ts.map +1 -0
  523. package/dist/recovery/index.js +186 -0
  524. package/dist/recovery/index.js.map +1 -0
  525. package/dist/recovery/integrity.d.ts +74 -0
  526. package/dist/recovery/integrity.d.ts.map +1 -0
  527. package/dist/recovery/types.d.ts +94 -0
  528. package/dist/recovery/types.d.ts.map +1 -0
  529. package/dist/services/index.d.ts +130 -0
  530. package/dist/services/index.d.ts.map +1 -0
  531. package/dist/services/index.js +134 -0
  532. package/dist/services/index.js.map +1 -0
  533. package/dist/services/manager.d.ts +140 -0
  534. package/dist/services/manager.d.ts.map +1 -0
  535. package/dist/services/types.d.ts +106 -0
  536. package/dist/services/types.d.ts.map +1 -0
  537. package/dist/services/watchers.d.ts +95 -0
  538. package/dist/services/watchers.d.ts.map +1 -0
  539. package/dist/sops/compliance-checker.d.ts +83 -0
  540. package/dist/sops/compliance-checker.d.ts.map +1 -0
  541. package/dist/sops/compliance-checker.js +399 -0
  542. package/dist/sops/compliance-checker.js.map +1 -0
  543. package/dist/sops/gap-analyzer.d.ts +124 -0
  544. package/dist/sops/gap-analyzer.d.ts.map +1 -0
  545. package/dist/sops/gap-analyzer.js +313 -0
  546. package/dist/sops/gap-analyzer.js.map +1 -0
  547. package/dist/sops/index.d.ts +14 -0
  548. package/dist/sops/index.d.ts.map +1 -0
  549. package/dist/sops/overlay-manager.d.ts +115 -0
  550. package/dist/sops/overlay-manager.d.ts.map +1 -0
  551. package/dist/sops/overlay-manager.js +394 -0
  552. package/dist/sops/overlay-manager.js.map +1 -0
  553. package/dist/sops/registry.d.ts +73 -0
  554. package/dist/sops/registry.d.ts.map +1 -0
  555. package/dist/sops/registry.js +919 -0
  556. package/dist/sops/registry.js.map +1 -0
  557. package/dist/sops/types.d.ts +377 -0
  558. package/dist/sops/types.d.ts.map +1 -0
  559. package/dist/sops/types.js +46 -0
  560. package/dist/sops/types.js.map +1 -0
  561. package/dist/utils/error-recovery.d.ts +230 -0
  562. package/dist/utils/error-recovery.d.ts.map +1 -0
  563. package/dist/utils/error-recovery.js +228 -0
  564. package/dist/utils/error-recovery.js.map +1 -0
  565. package/dist/utils/error-taxonomy.d.ts +149 -0
  566. package/dist/utils/error-taxonomy.d.ts.map +1 -0
  567. package/dist/utils/error-taxonomy.js +260 -0
  568. package/dist/utils/error-taxonomy.js.map +1 -0
  569. package/dist/utils/index.d.ts +11 -0
  570. package/dist/utils/index.d.ts.map +1 -0
  571. package/dist/utils/logger.d.ts +139 -0
  572. package/dist/utils/logger.d.ts.map +1 -0
  573. package/dist/utils/logger.js +311 -0
  574. package/dist/utils/logger.js.map +1 -0
  575. package/dist/workflows/index.d.ts +11 -0
  576. package/dist/workflows/index.d.ts.map +1 -0
  577. package/dist/workflows/registry.d.ts +118 -0
  578. package/dist/workflows/registry.d.ts.map +1 -0
  579. package/dist/workflows/registry.js +575 -0
  580. package/dist/workflows/registry.js.map +1 -0
  581. package/dist/workflows/types.d.ts +322 -0
  582. package/dist/workflows/types.d.ts.map +1 -0
  583. package/dist/workflows/types.js +16 -0
  584. package/dist/workflows/types.js.map +1 -0
  585. package/package.json +1 -1
@@ -0,0 +1,1283 @@
1
+ import { $ZodCheck, $ZodCheckStringFormat, $ZodCheckNumberFormat } from "./checks.js";
2
+ import { $constructor, globalConfig, config, $ZodAsyncError } from "./core.js";
3
+ import { Doc } from "./doc.js";
4
+ import { safeParse, safeParseAsync } from "./parse.js";
5
+ import { string, number, boolean, datetime, date, time, duration, email, guid, uuid, hostname, emoji, nanoid, cuid, cuid2, ulid, xid, ksuid, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, e164 } from "./regexes.js";
6
+ import { defineLazy, allowsEval, cached, isObject, esc, cleanRegex, isPlainObject, prefixIssues, finalizeIssue, getEnumValues, propertyKeyTypes, escapeRegex, aborted, optionalKeys, issue } from "./util.js";
7
+ import { clone } from "./util.js";
8
+ import { version } from "./versions.js";
9
+ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
10
+ var _a;
11
+ inst ?? (inst = {});
12
+ inst._zod.def = def;
13
+ inst._zod.bag = inst._zod.bag || {};
14
+ inst._zod.version = version;
15
+ const checks = [...inst._zod.def.checks ?? []];
16
+ if (inst._zod.traits.has("$ZodCheck")) {
17
+ checks.unshift(inst);
18
+ }
19
+ for (const ch of checks) {
20
+ for (const fn of ch._zod.onattach) {
21
+ fn(inst);
22
+ }
23
+ }
24
+ if (checks.length === 0) {
25
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
26
+ inst._zod.deferred?.push(() => {
27
+ inst._zod.run = inst._zod.parse;
28
+ });
29
+ } else {
30
+ const runChecks = (payload, checks2, ctx) => {
31
+ let isAborted = aborted(payload);
32
+ let asyncResult;
33
+ for (const ch of checks2) {
34
+ if (ch._zod.def.when) {
35
+ const shouldRun = ch._zod.def.when(payload);
36
+ if (!shouldRun)
37
+ continue;
38
+ } else if (isAborted) {
39
+ continue;
40
+ }
41
+ const currLen = payload.issues.length;
42
+ const _ = ch._zod.check(payload);
43
+ if (_ instanceof Promise && ctx?.async === false) {
44
+ throw new $ZodAsyncError();
45
+ }
46
+ if (asyncResult || _ instanceof Promise) {
47
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
48
+ await _;
49
+ const nextLen = payload.issues.length;
50
+ if (nextLen === currLen)
51
+ return;
52
+ if (!isAborted)
53
+ isAborted = aborted(payload, currLen);
54
+ });
55
+ } else {
56
+ const nextLen = payload.issues.length;
57
+ if (nextLen === currLen)
58
+ continue;
59
+ if (!isAborted)
60
+ isAborted = aborted(payload, currLen);
61
+ }
62
+ }
63
+ if (asyncResult) {
64
+ return asyncResult.then(() => {
65
+ return payload;
66
+ });
67
+ }
68
+ return payload;
69
+ };
70
+ inst._zod.run = (payload, ctx) => {
71
+ const result = inst._zod.parse(payload, ctx);
72
+ if (result instanceof Promise) {
73
+ if (ctx.async === false)
74
+ throw new $ZodAsyncError();
75
+ return result.then((result2) => runChecks(result2, checks, ctx));
76
+ }
77
+ return runChecks(result, checks, ctx);
78
+ };
79
+ }
80
+ inst["~standard"] = {
81
+ validate: (value) => {
82
+ try {
83
+ const r = safeParse(inst, value);
84
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
85
+ } catch (_) {
86
+ return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
87
+ }
88
+ },
89
+ vendor: "zod",
90
+ version: 1
91
+ };
92
+ });
93
+ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
94
+ $ZodType.init(inst, def);
95
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
96
+ inst._zod.parse = (payload, _) => {
97
+ if (def.coerce)
98
+ try {
99
+ payload.value = String(payload.value);
100
+ } catch (_2) {
101
+ }
102
+ if (typeof payload.value === "string")
103
+ return payload;
104
+ payload.issues.push({
105
+ expected: "string",
106
+ code: "invalid_type",
107
+ input: payload.value,
108
+ inst
109
+ });
110
+ return payload;
111
+ };
112
+ });
113
+ const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
114
+ $ZodCheckStringFormat.init(inst, def);
115
+ $ZodString.init(inst, def);
116
+ });
117
+ const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
118
+ def.pattern ?? (def.pattern = guid);
119
+ $ZodStringFormat.init(inst, def);
120
+ });
121
+ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
122
+ if (def.version) {
123
+ const versionMap = {
124
+ v1: 1,
125
+ v2: 2,
126
+ v3: 3,
127
+ v4: 4,
128
+ v5: 5,
129
+ v6: 6,
130
+ v7: 7,
131
+ v8: 8
132
+ };
133
+ const v = versionMap[def.version];
134
+ if (v === void 0)
135
+ throw new Error(`Invalid UUID version: "${def.version}"`);
136
+ def.pattern ?? (def.pattern = uuid(v));
137
+ } else
138
+ def.pattern ?? (def.pattern = uuid());
139
+ $ZodStringFormat.init(inst, def);
140
+ });
141
+ const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
142
+ def.pattern ?? (def.pattern = email);
143
+ $ZodStringFormat.init(inst, def);
144
+ });
145
+ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
146
+ $ZodStringFormat.init(inst, def);
147
+ inst._zod.check = (payload) => {
148
+ try {
149
+ const orig = payload.value;
150
+ const url = new URL(orig);
151
+ const href = url.href;
152
+ if (def.hostname) {
153
+ def.hostname.lastIndex = 0;
154
+ if (!def.hostname.test(url.hostname)) {
155
+ payload.issues.push({
156
+ code: "invalid_format",
157
+ format: "url",
158
+ note: "Invalid hostname",
159
+ pattern: hostname.source,
160
+ input: payload.value,
161
+ inst,
162
+ continue: !def.abort
163
+ });
164
+ }
165
+ }
166
+ if (def.protocol) {
167
+ def.protocol.lastIndex = 0;
168
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
169
+ payload.issues.push({
170
+ code: "invalid_format",
171
+ format: "url",
172
+ note: "Invalid protocol",
173
+ pattern: def.protocol.source,
174
+ input: payload.value,
175
+ inst,
176
+ continue: !def.abort
177
+ });
178
+ }
179
+ }
180
+ if (!orig.endsWith("/") && href.endsWith("/")) {
181
+ payload.value = href.slice(0, -1);
182
+ } else {
183
+ payload.value = href;
184
+ }
185
+ return;
186
+ } catch (_) {
187
+ payload.issues.push({
188
+ code: "invalid_format",
189
+ format: "url",
190
+ input: payload.value,
191
+ inst,
192
+ continue: !def.abort
193
+ });
194
+ }
195
+ };
196
+ });
197
+ const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
198
+ def.pattern ?? (def.pattern = emoji());
199
+ $ZodStringFormat.init(inst, def);
200
+ });
201
+ const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
202
+ def.pattern ?? (def.pattern = nanoid);
203
+ $ZodStringFormat.init(inst, def);
204
+ });
205
+ const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
206
+ def.pattern ?? (def.pattern = cuid);
207
+ $ZodStringFormat.init(inst, def);
208
+ });
209
+ const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
210
+ def.pattern ?? (def.pattern = cuid2);
211
+ $ZodStringFormat.init(inst, def);
212
+ });
213
+ const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
214
+ def.pattern ?? (def.pattern = ulid);
215
+ $ZodStringFormat.init(inst, def);
216
+ });
217
+ const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
218
+ def.pattern ?? (def.pattern = xid);
219
+ $ZodStringFormat.init(inst, def);
220
+ });
221
+ const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
222
+ def.pattern ?? (def.pattern = ksuid);
223
+ $ZodStringFormat.init(inst, def);
224
+ });
225
+ const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
226
+ def.pattern ?? (def.pattern = datetime(def));
227
+ $ZodStringFormat.init(inst, def);
228
+ });
229
+ const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
230
+ def.pattern ?? (def.pattern = date);
231
+ $ZodStringFormat.init(inst, def);
232
+ });
233
+ const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
234
+ def.pattern ?? (def.pattern = time(def));
235
+ $ZodStringFormat.init(inst, def);
236
+ });
237
+ const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
238
+ def.pattern ?? (def.pattern = duration);
239
+ $ZodStringFormat.init(inst, def);
240
+ });
241
+ const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
242
+ def.pattern ?? (def.pattern = ipv4);
243
+ $ZodStringFormat.init(inst, def);
244
+ inst._zod.onattach.push((inst2) => {
245
+ const bag = inst2._zod.bag;
246
+ bag.format = `ipv4`;
247
+ });
248
+ });
249
+ const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
250
+ def.pattern ?? (def.pattern = ipv6);
251
+ $ZodStringFormat.init(inst, def);
252
+ inst._zod.onattach.push((inst2) => {
253
+ const bag = inst2._zod.bag;
254
+ bag.format = `ipv6`;
255
+ });
256
+ inst._zod.check = (payload) => {
257
+ try {
258
+ new URL(`http://[${payload.value}]`);
259
+ } catch {
260
+ payload.issues.push({
261
+ code: "invalid_format",
262
+ format: "ipv6",
263
+ input: payload.value,
264
+ inst,
265
+ continue: !def.abort
266
+ });
267
+ }
268
+ };
269
+ });
270
+ const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
271
+ def.pattern ?? (def.pattern = cidrv4);
272
+ $ZodStringFormat.init(inst, def);
273
+ });
274
+ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
275
+ def.pattern ?? (def.pattern = cidrv6);
276
+ $ZodStringFormat.init(inst, def);
277
+ inst._zod.check = (payload) => {
278
+ const [address, prefix] = payload.value.split("/");
279
+ try {
280
+ if (!prefix)
281
+ throw new Error();
282
+ const prefixNum = Number(prefix);
283
+ if (`${prefixNum}` !== prefix)
284
+ throw new Error();
285
+ if (prefixNum < 0 || prefixNum > 128)
286
+ throw new Error();
287
+ new URL(`http://[${address}]`);
288
+ } catch {
289
+ payload.issues.push({
290
+ code: "invalid_format",
291
+ format: "cidrv6",
292
+ input: payload.value,
293
+ inst,
294
+ continue: !def.abort
295
+ });
296
+ }
297
+ };
298
+ });
299
+ function isValidBase64(data) {
300
+ if (data === "")
301
+ return true;
302
+ if (data.length % 4 !== 0)
303
+ return false;
304
+ try {
305
+ atob(data);
306
+ return true;
307
+ } catch {
308
+ return false;
309
+ }
310
+ }
311
+ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
312
+ def.pattern ?? (def.pattern = base64);
313
+ $ZodStringFormat.init(inst, def);
314
+ inst._zod.onattach.push((inst2) => {
315
+ inst2._zod.bag.contentEncoding = "base64";
316
+ });
317
+ inst._zod.check = (payload) => {
318
+ if (isValidBase64(payload.value))
319
+ return;
320
+ payload.issues.push({
321
+ code: "invalid_format",
322
+ format: "base64",
323
+ input: payload.value,
324
+ inst,
325
+ continue: !def.abort
326
+ });
327
+ };
328
+ });
329
+ function isValidBase64URL(data) {
330
+ if (!base64url.test(data))
331
+ return false;
332
+ const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
333
+ const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
334
+ return isValidBase64(padded);
335
+ }
336
+ const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
337
+ def.pattern ?? (def.pattern = base64url);
338
+ $ZodStringFormat.init(inst, def);
339
+ inst._zod.onattach.push((inst2) => {
340
+ inst2._zod.bag.contentEncoding = "base64url";
341
+ });
342
+ inst._zod.check = (payload) => {
343
+ if (isValidBase64URL(payload.value))
344
+ return;
345
+ payload.issues.push({
346
+ code: "invalid_format",
347
+ format: "base64url",
348
+ input: payload.value,
349
+ inst,
350
+ continue: !def.abort
351
+ });
352
+ };
353
+ });
354
+ const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
355
+ def.pattern ?? (def.pattern = e164);
356
+ $ZodStringFormat.init(inst, def);
357
+ });
358
+ function isValidJWT(token, algorithm = null) {
359
+ try {
360
+ const tokensParts = token.split(".");
361
+ if (tokensParts.length !== 3)
362
+ return false;
363
+ const [header] = tokensParts;
364
+ if (!header)
365
+ return false;
366
+ const parsedHeader = JSON.parse(atob(header));
367
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
368
+ return false;
369
+ if (!parsedHeader.alg)
370
+ return false;
371
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
372
+ return false;
373
+ return true;
374
+ } catch {
375
+ return false;
376
+ }
377
+ }
378
+ const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
379
+ $ZodStringFormat.init(inst, def);
380
+ inst._zod.check = (payload) => {
381
+ if (isValidJWT(payload.value, def.alg))
382
+ return;
383
+ payload.issues.push({
384
+ code: "invalid_format",
385
+ format: "jwt",
386
+ input: payload.value,
387
+ inst,
388
+ continue: !def.abort
389
+ });
390
+ };
391
+ });
392
+ const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
393
+ $ZodType.init(inst, def);
394
+ inst._zod.pattern = inst._zod.bag.pattern ?? number;
395
+ inst._zod.parse = (payload, _ctx) => {
396
+ if (def.coerce)
397
+ try {
398
+ payload.value = Number(payload.value);
399
+ } catch (_) {
400
+ }
401
+ const input = payload.value;
402
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
403
+ return payload;
404
+ }
405
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
406
+ payload.issues.push({
407
+ expected: "number",
408
+ code: "invalid_type",
409
+ input,
410
+ inst,
411
+ ...received ? { received } : {}
412
+ });
413
+ return payload;
414
+ };
415
+ });
416
+ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
417
+ $ZodCheckNumberFormat.init(inst, def);
418
+ $ZodNumber.init(inst, def);
419
+ });
420
+ const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
421
+ $ZodType.init(inst, def);
422
+ inst._zod.pattern = boolean;
423
+ inst._zod.parse = (payload, _ctx) => {
424
+ if (def.coerce)
425
+ try {
426
+ payload.value = Boolean(payload.value);
427
+ } catch (_) {
428
+ }
429
+ const input = payload.value;
430
+ if (typeof input === "boolean")
431
+ return payload;
432
+ payload.issues.push({
433
+ expected: "boolean",
434
+ code: "invalid_type",
435
+ input,
436
+ inst
437
+ });
438
+ return payload;
439
+ };
440
+ });
441
+ const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
442
+ $ZodType.init(inst, def);
443
+ inst._zod.parse = (payload) => payload;
444
+ });
445
+ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
446
+ $ZodType.init(inst, def);
447
+ inst._zod.parse = (payload, _ctx) => {
448
+ payload.issues.push({
449
+ expected: "never",
450
+ code: "invalid_type",
451
+ input: payload.value,
452
+ inst
453
+ });
454
+ return payload;
455
+ };
456
+ });
457
+ function handleArrayResult(result, final, index) {
458
+ if (result.issues.length) {
459
+ final.issues.push(...prefixIssues(index, result.issues));
460
+ }
461
+ final.value[index] = result.value;
462
+ }
463
+ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
464
+ $ZodType.init(inst, def);
465
+ inst._zod.parse = (payload, ctx) => {
466
+ const input = payload.value;
467
+ if (!Array.isArray(input)) {
468
+ payload.issues.push({
469
+ expected: "array",
470
+ code: "invalid_type",
471
+ input,
472
+ inst
473
+ });
474
+ return payload;
475
+ }
476
+ payload.value = Array(input.length);
477
+ const proms = [];
478
+ for (let i = 0; i < input.length; i++) {
479
+ const item = input[i];
480
+ const result = def.element._zod.run({
481
+ value: item,
482
+ issues: []
483
+ }, ctx);
484
+ if (result instanceof Promise) {
485
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
486
+ } else {
487
+ handleArrayResult(result, payload, i);
488
+ }
489
+ }
490
+ if (proms.length) {
491
+ return Promise.all(proms).then(() => payload);
492
+ }
493
+ return payload;
494
+ };
495
+ });
496
+ function handleObjectResult(result, final, key) {
497
+ if (result.issues.length) {
498
+ final.issues.push(...prefixIssues(key, result.issues));
499
+ }
500
+ final.value[key] = result.value;
501
+ }
502
+ function handleOptionalObjectResult(result, final, key, input) {
503
+ if (result.issues.length) {
504
+ if (input[key] === void 0) {
505
+ if (key in input) {
506
+ final.value[key] = void 0;
507
+ } else {
508
+ final.value[key] = result.value;
509
+ }
510
+ } else {
511
+ final.issues.push(...prefixIssues(key, result.issues));
512
+ }
513
+ } else if (result.value === void 0) {
514
+ if (key in input)
515
+ final.value[key] = void 0;
516
+ } else {
517
+ final.value[key] = result.value;
518
+ }
519
+ }
520
+ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
521
+ $ZodType.init(inst, def);
522
+ const _normalized = cached(() => {
523
+ const keys = Object.keys(def.shape);
524
+ for (const k of keys) {
525
+ if (!(def.shape[k] instanceof $ZodType)) {
526
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
527
+ }
528
+ }
529
+ const okeys = optionalKeys(def.shape);
530
+ return {
531
+ shape: def.shape,
532
+ keys,
533
+ keySet: new Set(keys),
534
+ numKeys: keys.length,
535
+ optionalKeys: new Set(okeys)
536
+ };
537
+ });
538
+ defineLazy(inst._zod, "propValues", () => {
539
+ const shape = def.shape;
540
+ const propValues = {};
541
+ for (const key in shape) {
542
+ const field = shape[key]._zod;
543
+ if (field.values) {
544
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
545
+ for (const v of field.values)
546
+ propValues[key].add(v);
547
+ }
548
+ }
549
+ return propValues;
550
+ });
551
+ const generateFastpass = (shape) => {
552
+ const doc = new Doc(["shape", "payload", "ctx"]);
553
+ const normalized = _normalized.value;
554
+ const parseStr = (key) => {
555
+ const k = esc(key);
556
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
557
+ };
558
+ doc.write(`const input = payload.value;`);
559
+ const ids = /* @__PURE__ */ Object.create(null);
560
+ let counter = 0;
561
+ for (const key of normalized.keys) {
562
+ ids[key] = `key_${counter++}`;
563
+ }
564
+ doc.write(`const newResult = {}`);
565
+ for (const key of normalized.keys) {
566
+ if (normalized.optionalKeys.has(key)) {
567
+ const id = ids[key];
568
+ doc.write(`const ${id} = ${parseStr(key)};`);
569
+ const k = esc(key);
570
+ doc.write(`
571
+ if (${id}.issues.length) {
572
+ if (input[${k}] === undefined) {
573
+ if (${k} in input) {
574
+ newResult[${k}] = undefined;
575
+ }
576
+ } else {
577
+ payload.issues = payload.issues.concat(
578
+ ${id}.issues.map((iss) => ({
579
+ ...iss,
580
+ path: iss.path ? [${k}, ...iss.path] : [${k}],
581
+ }))
582
+ );
583
+ }
584
+ } else if (${id}.value === undefined) {
585
+ if (${k} in input) newResult[${k}] = undefined;
586
+ } else {
587
+ newResult[${k}] = ${id}.value;
588
+ }
589
+ `);
590
+ } else {
591
+ const id = ids[key];
592
+ doc.write(`const ${id} = ${parseStr(key)};`);
593
+ doc.write(`
594
+ if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
595
+ ...iss,
596
+ path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
597
+ })));`);
598
+ doc.write(`newResult[${esc(key)}] = ${id}.value`);
599
+ }
600
+ }
601
+ doc.write(`payload.value = newResult;`);
602
+ doc.write(`return payload;`);
603
+ const fn = doc.compile();
604
+ return (payload, ctx) => fn(shape, payload, ctx);
605
+ };
606
+ let fastpass;
607
+ const isObject$1 = isObject;
608
+ const jit = !globalConfig.jitless;
609
+ const allowsEval$1 = allowsEval;
610
+ const fastEnabled = jit && allowsEval$1.value;
611
+ const catchall = def.catchall;
612
+ let value;
613
+ inst._zod.parse = (payload, ctx) => {
614
+ value ?? (value = _normalized.value);
615
+ const input = payload.value;
616
+ if (!isObject$1(input)) {
617
+ payload.issues.push({
618
+ expected: "object",
619
+ code: "invalid_type",
620
+ input,
621
+ inst
622
+ });
623
+ return payload;
624
+ }
625
+ const proms = [];
626
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
627
+ if (!fastpass)
628
+ fastpass = generateFastpass(def.shape);
629
+ payload = fastpass(payload, ctx);
630
+ } else {
631
+ payload.value = {};
632
+ const shape = value.shape;
633
+ for (const key of value.keys) {
634
+ const el = shape[key];
635
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
636
+ const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
637
+ if (r instanceof Promise) {
638
+ proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
639
+ } else if (isOptional) {
640
+ handleOptionalObjectResult(r, payload, key, input);
641
+ } else {
642
+ handleObjectResult(r, payload, key);
643
+ }
644
+ }
645
+ }
646
+ if (!catchall) {
647
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
648
+ }
649
+ const unrecognized = [];
650
+ const keySet = value.keySet;
651
+ const _catchall = catchall._zod;
652
+ const t = _catchall.def.type;
653
+ for (const key of Object.keys(input)) {
654
+ if (keySet.has(key))
655
+ continue;
656
+ if (t === "never") {
657
+ unrecognized.push(key);
658
+ continue;
659
+ }
660
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
661
+ if (r instanceof Promise) {
662
+ proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
663
+ } else {
664
+ handleObjectResult(r, payload, key);
665
+ }
666
+ }
667
+ if (unrecognized.length) {
668
+ payload.issues.push({
669
+ code: "unrecognized_keys",
670
+ keys: unrecognized,
671
+ input,
672
+ inst
673
+ });
674
+ }
675
+ if (!proms.length)
676
+ return payload;
677
+ return Promise.all(proms).then(() => {
678
+ return payload;
679
+ });
680
+ };
681
+ });
682
+ function handleUnionResults(results, final, inst, ctx) {
683
+ for (const result of results) {
684
+ if (result.issues.length === 0) {
685
+ final.value = result.value;
686
+ return final;
687
+ }
688
+ }
689
+ final.issues.push({
690
+ code: "invalid_union",
691
+ input: final.value,
692
+ inst,
693
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
694
+ });
695
+ return final;
696
+ }
697
+ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
698
+ $ZodType.init(inst, def);
699
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
700
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
701
+ defineLazy(inst._zod, "values", () => {
702
+ if (def.options.every((o) => o._zod.values)) {
703
+ return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
704
+ }
705
+ return void 0;
706
+ });
707
+ defineLazy(inst._zod, "pattern", () => {
708
+ if (def.options.every((o) => o._zod.pattern)) {
709
+ const patterns = def.options.map((o) => o._zod.pattern);
710
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
711
+ }
712
+ return void 0;
713
+ });
714
+ inst._zod.parse = (payload, ctx) => {
715
+ let async = false;
716
+ const results = [];
717
+ for (const option of def.options) {
718
+ const result = option._zod.run({
719
+ value: payload.value,
720
+ issues: []
721
+ }, ctx);
722
+ if (result instanceof Promise) {
723
+ results.push(result);
724
+ async = true;
725
+ } else {
726
+ if (result.issues.length === 0)
727
+ return result;
728
+ results.push(result);
729
+ }
730
+ }
731
+ if (!async)
732
+ return handleUnionResults(results, payload, inst, ctx);
733
+ return Promise.all(results).then((results2) => {
734
+ return handleUnionResults(results2, payload, inst, ctx);
735
+ });
736
+ };
737
+ });
738
+ const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
739
+ $ZodUnion.init(inst, def);
740
+ const _super = inst._zod.parse;
741
+ defineLazy(inst._zod, "propValues", () => {
742
+ const propValues = {};
743
+ for (const option of def.options) {
744
+ const pv = option._zod.propValues;
745
+ if (!pv || Object.keys(pv).length === 0)
746
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
747
+ for (const [k, v] of Object.entries(pv)) {
748
+ if (!propValues[k])
749
+ propValues[k] = /* @__PURE__ */ new Set();
750
+ for (const val of v) {
751
+ propValues[k].add(val);
752
+ }
753
+ }
754
+ }
755
+ return propValues;
756
+ });
757
+ const disc = cached(() => {
758
+ const opts = def.options;
759
+ const map = /* @__PURE__ */ new Map();
760
+ for (const o of opts) {
761
+ const values = o._zod.propValues[def.discriminator];
762
+ if (!values || values.size === 0)
763
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
764
+ for (const v of values) {
765
+ if (map.has(v)) {
766
+ throw new Error(`Duplicate discriminator value "${String(v)}"`);
767
+ }
768
+ map.set(v, o);
769
+ }
770
+ }
771
+ return map;
772
+ });
773
+ inst._zod.parse = (payload, ctx) => {
774
+ const input = payload.value;
775
+ if (!isObject(input)) {
776
+ payload.issues.push({
777
+ code: "invalid_type",
778
+ expected: "object",
779
+ input,
780
+ inst
781
+ });
782
+ return payload;
783
+ }
784
+ const opt = disc.value.get(input?.[def.discriminator]);
785
+ if (opt) {
786
+ return opt._zod.run(payload, ctx);
787
+ }
788
+ if (def.unionFallback) {
789
+ return _super(payload, ctx);
790
+ }
791
+ payload.issues.push({
792
+ code: "invalid_union",
793
+ errors: [],
794
+ note: "No matching discriminator",
795
+ input,
796
+ path: [def.discriminator],
797
+ inst
798
+ });
799
+ return payload;
800
+ };
801
+ });
802
+ const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
803
+ $ZodType.init(inst, def);
804
+ inst._zod.parse = (payload, ctx) => {
805
+ const input = payload.value;
806
+ const left = def.left._zod.run({ value: input, issues: [] }, ctx);
807
+ const right = def.right._zod.run({ value: input, issues: [] }, ctx);
808
+ const async = left instanceof Promise || right instanceof Promise;
809
+ if (async) {
810
+ return Promise.all([left, right]).then(([left2, right2]) => {
811
+ return handleIntersectionResults(payload, left2, right2);
812
+ });
813
+ }
814
+ return handleIntersectionResults(payload, left, right);
815
+ };
816
+ });
817
+ function mergeValues(a, b) {
818
+ if (a === b) {
819
+ return { valid: true, data: a };
820
+ }
821
+ if (a instanceof Date && b instanceof Date && +a === +b) {
822
+ return { valid: true, data: a };
823
+ }
824
+ if (isPlainObject(a) && isPlainObject(b)) {
825
+ const bKeys = Object.keys(b);
826
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
827
+ const newObj = { ...a, ...b };
828
+ for (const key of sharedKeys) {
829
+ const sharedValue = mergeValues(a[key], b[key]);
830
+ if (!sharedValue.valid) {
831
+ return {
832
+ valid: false,
833
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
834
+ };
835
+ }
836
+ newObj[key] = sharedValue.data;
837
+ }
838
+ return { valid: true, data: newObj };
839
+ }
840
+ if (Array.isArray(a) && Array.isArray(b)) {
841
+ if (a.length !== b.length) {
842
+ return { valid: false, mergeErrorPath: [] };
843
+ }
844
+ const newArray = [];
845
+ for (let index = 0; index < a.length; index++) {
846
+ const itemA = a[index];
847
+ const itemB = b[index];
848
+ const sharedValue = mergeValues(itemA, itemB);
849
+ if (!sharedValue.valid) {
850
+ return {
851
+ valid: false,
852
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
853
+ };
854
+ }
855
+ newArray.push(sharedValue.data);
856
+ }
857
+ return { valid: true, data: newArray };
858
+ }
859
+ return { valid: false, mergeErrorPath: [] };
860
+ }
861
+ function handleIntersectionResults(result, left, right) {
862
+ if (left.issues.length) {
863
+ result.issues.push(...left.issues);
864
+ }
865
+ if (right.issues.length) {
866
+ result.issues.push(...right.issues);
867
+ }
868
+ if (aborted(result))
869
+ return result;
870
+ const merged = mergeValues(left.value, right.value);
871
+ if (!merged.valid) {
872
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
873
+ }
874
+ result.value = merged.data;
875
+ return result;
876
+ }
877
+ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
878
+ $ZodType.init(inst, def);
879
+ inst._zod.parse = (payload, ctx) => {
880
+ const input = payload.value;
881
+ if (!isPlainObject(input)) {
882
+ payload.issues.push({
883
+ expected: "record",
884
+ code: "invalid_type",
885
+ input,
886
+ inst
887
+ });
888
+ return payload;
889
+ }
890
+ const proms = [];
891
+ if (def.keyType._zod.values) {
892
+ const values = def.keyType._zod.values;
893
+ payload.value = {};
894
+ for (const key of values) {
895
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
896
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
897
+ if (result instanceof Promise) {
898
+ proms.push(result.then((result2) => {
899
+ if (result2.issues.length) {
900
+ payload.issues.push(...prefixIssues(key, result2.issues));
901
+ }
902
+ payload.value[key] = result2.value;
903
+ }));
904
+ } else {
905
+ if (result.issues.length) {
906
+ payload.issues.push(...prefixIssues(key, result.issues));
907
+ }
908
+ payload.value[key] = result.value;
909
+ }
910
+ }
911
+ }
912
+ let unrecognized;
913
+ for (const key in input) {
914
+ if (!values.has(key)) {
915
+ unrecognized = unrecognized ?? [];
916
+ unrecognized.push(key);
917
+ }
918
+ }
919
+ if (unrecognized && unrecognized.length > 0) {
920
+ payload.issues.push({
921
+ code: "unrecognized_keys",
922
+ input,
923
+ inst,
924
+ keys: unrecognized
925
+ });
926
+ }
927
+ } else {
928
+ payload.value = {};
929
+ for (const key of Reflect.ownKeys(input)) {
930
+ if (key === "__proto__")
931
+ continue;
932
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
933
+ if (keyResult instanceof Promise) {
934
+ throw new Error("Async schemas not supported in object keys currently");
935
+ }
936
+ if (keyResult.issues.length) {
937
+ payload.issues.push({
938
+ origin: "record",
939
+ code: "invalid_key",
940
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
941
+ input: key,
942
+ path: [key],
943
+ inst
944
+ });
945
+ payload.value[keyResult.value] = keyResult.value;
946
+ continue;
947
+ }
948
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
949
+ if (result instanceof Promise) {
950
+ proms.push(result.then((result2) => {
951
+ if (result2.issues.length) {
952
+ payload.issues.push(...prefixIssues(key, result2.issues));
953
+ }
954
+ payload.value[keyResult.value] = result2.value;
955
+ }));
956
+ } else {
957
+ if (result.issues.length) {
958
+ payload.issues.push(...prefixIssues(key, result.issues));
959
+ }
960
+ payload.value[keyResult.value] = result.value;
961
+ }
962
+ }
963
+ }
964
+ if (proms.length) {
965
+ return Promise.all(proms).then(() => payload);
966
+ }
967
+ return payload;
968
+ };
969
+ });
970
+ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
971
+ $ZodType.init(inst, def);
972
+ const values = getEnumValues(def.entries);
973
+ inst._zod.values = new Set(values);
974
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
975
+ inst._zod.parse = (payload, _ctx) => {
976
+ const input = payload.value;
977
+ if (inst._zod.values.has(input)) {
978
+ return payload;
979
+ }
980
+ payload.issues.push({
981
+ code: "invalid_value",
982
+ values,
983
+ input,
984
+ inst
985
+ });
986
+ return payload;
987
+ };
988
+ });
989
+ const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
990
+ $ZodType.init(inst, def);
991
+ inst._zod.values = new Set(def.values);
992
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? o.toString() : String(o)).join("|")})$`);
993
+ inst._zod.parse = (payload, _ctx) => {
994
+ const input = payload.value;
995
+ if (inst._zod.values.has(input)) {
996
+ return payload;
997
+ }
998
+ payload.issues.push({
999
+ code: "invalid_value",
1000
+ values: def.values,
1001
+ input,
1002
+ inst
1003
+ });
1004
+ return payload;
1005
+ };
1006
+ });
1007
+ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1008
+ $ZodType.init(inst, def);
1009
+ inst._zod.parse = (payload, _ctx) => {
1010
+ const _out = def.transform(payload.value, payload);
1011
+ if (_ctx.async) {
1012
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1013
+ return output.then((output2) => {
1014
+ payload.value = output2;
1015
+ return payload;
1016
+ });
1017
+ }
1018
+ if (_out instanceof Promise) {
1019
+ throw new $ZodAsyncError();
1020
+ }
1021
+ payload.value = _out;
1022
+ return payload;
1023
+ };
1024
+ });
1025
+ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1026
+ $ZodType.init(inst, def);
1027
+ inst._zod.optin = "optional";
1028
+ inst._zod.optout = "optional";
1029
+ defineLazy(inst._zod, "values", () => {
1030
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
1031
+ });
1032
+ defineLazy(inst._zod, "pattern", () => {
1033
+ const pattern = def.innerType._zod.pattern;
1034
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1035
+ });
1036
+ inst._zod.parse = (payload, ctx) => {
1037
+ if (def.innerType._zod.optin === "optional") {
1038
+ return def.innerType._zod.run(payload, ctx);
1039
+ }
1040
+ if (payload.value === void 0) {
1041
+ return payload;
1042
+ }
1043
+ return def.innerType._zod.run(payload, ctx);
1044
+ };
1045
+ });
1046
+ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1047
+ $ZodType.init(inst, def);
1048
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1049
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1050
+ defineLazy(inst._zod, "pattern", () => {
1051
+ const pattern = def.innerType._zod.pattern;
1052
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1053
+ });
1054
+ defineLazy(inst._zod, "values", () => {
1055
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
1056
+ });
1057
+ inst._zod.parse = (payload, ctx) => {
1058
+ if (payload.value === null)
1059
+ return payload;
1060
+ return def.innerType._zod.run(payload, ctx);
1061
+ };
1062
+ });
1063
+ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
1064
+ $ZodType.init(inst, def);
1065
+ inst._zod.optin = "optional";
1066
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1067
+ inst._zod.parse = (payload, ctx) => {
1068
+ if (payload.value === void 0) {
1069
+ payload.value = def.defaultValue;
1070
+ return payload;
1071
+ }
1072
+ const result = def.innerType._zod.run(payload, ctx);
1073
+ if (result instanceof Promise) {
1074
+ return result.then((result2) => handleDefaultResult(result2, def));
1075
+ }
1076
+ return handleDefaultResult(result, def);
1077
+ };
1078
+ });
1079
+ function handleDefaultResult(payload, def) {
1080
+ if (payload.value === void 0) {
1081
+ payload.value = def.defaultValue;
1082
+ }
1083
+ return payload;
1084
+ }
1085
+ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
1086
+ $ZodType.init(inst, def);
1087
+ inst._zod.optin = "optional";
1088
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1089
+ inst._zod.parse = (payload, ctx) => {
1090
+ if (payload.value === void 0) {
1091
+ payload.value = def.defaultValue;
1092
+ }
1093
+ return def.innerType._zod.run(payload, ctx);
1094
+ };
1095
+ });
1096
+ const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
1097
+ $ZodType.init(inst, def);
1098
+ defineLazy(inst._zod, "values", () => {
1099
+ const v = def.innerType._zod.values;
1100
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
1101
+ });
1102
+ inst._zod.parse = (payload, ctx) => {
1103
+ const result = def.innerType._zod.run(payload, ctx);
1104
+ if (result instanceof Promise) {
1105
+ return result.then((result2) => handleNonOptionalResult(result2, inst));
1106
+ }
1107
+ return handleNonOptionalResult(result, inst);
1108
+ };
1109
+ });
1110
+ function handleNonOptionalResult(payload, inst) {
1111
+ if (!payload.issues.length && payload.value === void 0) {
1112
+ payload.issues.push({
1113
+ code: "invalid_type",
1114
+ expected: "nonoptional",
1115
+ input: payload.value,
1116
+ inst
1117
+ });
1118
+ }
1119
+ return payload;
1120
+ }
1121
+ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
1122
+ $ZodType.init(inst, def);
1123
+ inst._zod.optin = "optional";
1124
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1125
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1126
+ inst._zod.parse = (payload, ctx) => {
1127
+ const result = def.innerType._zod.run(payload, ctx);
1128
+ if (result instanceof Promise) {
1129
+ return result.then((result2) => {
1130
+ payload.value = result2.value;
1131
+ if (result2.issues.length) {
1132
+ payload.value = def.catchValue({
1133
+ ...payload,
1134
+ error: {
1135
+ issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
1136
+ },
1137
+ input: payload.value
1138
+ });
1139
+ payload.issues = [];
1140
+ }
1141
+ return payload;
1142
+ });
1143
+ }
1144
+ payload.value = result.value;
1145
+ if (result.issues.length) {
1146
+ payload.value = def.catchValue({
1147
+ ...payload,
1148
+ error: {
1149
+ issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
1150
+ },
1151
+ input: payload.value
1152
+ });
1153
+ payload.issues = [];
1154
+ }
1155
+ return payload;
1156
+ };
1157
+ });
1158
+ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
1159
+ $ZodType.init(inst, def);
1160
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
1161
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1162
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1163
+ inst._zod.parse = (payload, ctx) => {
1164
+ const left = def.in._zod.run(payload, ctx);
1165
+ if (left instanceof Promise) {
1166
+ return left.then((left2) => handlePipeResult(left2, def, ctx));
1167
+ }
1168
+ return handlePipeResult(left, def, ctx);
1169
+ };
1170
+ });
1171
+ function handlePipeResult(left, def, ctx) {
1172
+ if (aborted(left)) {
1173
+ return left;
1174
+ }
1175
+ return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
1176
+ }
1177
+ const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
1178
+ $ZodType.init(inst, def);
1179
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1180
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1181
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1182
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1183
+ inst._zod.parse = (payload, ctx) => {
1184
+ const result = def.innerType._zod.run(payload, ctx);
1185
+ if (result instanceof Promise) {
1186
+ return result.then(handleReadonlyResult);
1187
+ }
1188
+ return handleReadonlyResult(result);
1189
+ };
1190
+ });
1191
+ function handleReadonlyResult(payload) {
1192
+ payload.value = Object.freeze(payload.value);
1193
+ return payload;
1194
+ }
1195
+ const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
1196
+ $ZodCheck.init(inst, def);
1197
+ $ZodType.init(inst, def);
1198
+ inst._zod.parse = (payload, _) => {
1199
+ return payload;
1200
+ };
1201
+ inst._zod.check = (payload) => {
1202
+ const input = payload.value;
1203
+ const r = def.fn(input);
1204
+ if (r instanceof Promise) {
1205
+ return r.then((r2) => handleRefineResult(r2, payload, input, inst));
1206
+ }
1207
+ handleRefineResult(r, payload, input, inst);
1208
+ return;
1209
+ };
1210
+ });
1211
+ function handleRefineResult(result, payload, input, inst) {
1212
+ if (!result) {
1213
+ const _iss = {
1214
+ code: "custom",
1215
+ input,
1216
+ inst,
1217
+ // incorporates params.error into issue reporting
1218
+ path: [...inst._zod.def.path ?? []],
1219
+ // incorporates params.error into issue reporting
1220
+ continue: !inst._zod.def.abort
1221
+ // params: inst._zod.def.params,
1222
+ };
1223
+ if (inst._zod.def.params)
1224
+ _iss.params = inst._zod.def.params;
1225
+ payload.issues.push(issue(_iss));
1226
+ }
1227
+ }
1228
+ export {
1229
+ $ZodArray,
1230
+ $ZodBase64,
1231
+ $ZodBase64URL,
1232
+ $ZodBoolean,
1233
+ $ZodCIDRv4,
1234
+ $ZodCIDRv6,
1235
+ $ZodCUID,
1236
+ $ZodCUID2,
1237
+ $ZodCatch,
1238
+ $ZodCustom,
1239
+ $ZodDefault,
1240
+ $ZodDiscriminatedUnion,
1241
+ $ZodE164,
1242
+ $ZodEmail,
1243
+ $ZodEmoji,
1244
+ $ZodEnum,
1245
+ $ZodGUID,
1246
+ $ZodIPv4,
1247
+ $ZodIPv6,
1248
+ $ZodISODate,
1249
+ $ZodISODateTime,
1250
+ $ZodISODuration,
1251
+ $ZodISOTime,
1252
+ $ZodIntersection,
1253
+ $ZodJWT,
1254
+ $ZodKSUID,
1255
+ $ZodLiteral,
1256
+ $ZodNanoID,
1257
+ $ZodNever,
1258
+ $ZodNonOptional,
1259
+ $ZodNullable,
1260
+ $ZodNumber,
1261
+ $ZodNumberFormat,
1262
+ $ZodObject,
1263
+ $ZodOptional,
1264
+ $ZodPipe,
1265
+ $ZodPrefault,
1266
+ $ZodReadonly,
1267
+ $ZodRecord,
1268
+ $ZodString,
1269
+ $ZodStringFormat,
1270
+ $ZodTransform,
1271
+ $ZodType,
1272
+ $ZodULID,
1273
+ $ZodURL,
1274
+ $ZodUUID,
1275
+ $ZodUnion,
1276
+ $ZodUnknown,
1277
+ $ZodXID,
1278
+ clone,
1279
+ isValidBase64,
1280
+ isValidBase64URL,
1281
+ isValidJWT
1282
+ };
1283
+ //# sourceMappingURL=schemas.js.map