langgraph-ui-components 0.0.4 → 0.0.6

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 (525) hide show
  1. package/dist/index.es10.js +31 -16
  2. package/dist/index.es10.js.map +1 -1
  3. package/dist/index.es100.js +36 -3156
  4. package/dist/index.es100.js.map +1 -1
  5. package/dist/index.es101.js +162 -33
  6. package/dist/index.es101.js.map +1 -1
  7. package/dist/index.es102.js +203 -5
  8. package/dist/index.es102.js.map +1 -1
  9. package/dist/index.es103.js +13 -72
  10. package/dist/index.es103.js.map +1 -1
  11. package/dist/index.es104.js +27 -34
  12. package/dist/index.es104.js.map +1 -1
  13. package/dist/index.es105.js +34 -5
  14. package/dist/index.es105.js.map +1 -1
  15. package/dist/index.es106.js +3159 -2
  16. package/dist/index.es106.js.map +1 -1
  17. package/dist/index.es107.js +5 -11
  18. package/dist/index.es107.js.map +1 -1
  19. package/dist/index.es108.js +2 -503
  20. package/dist/index.es108.js.map +1 -1
  21. package/dist/index.es109.js +16 -5
  22. package/dist/index.es109.js.map +1 -1
  23. package/dist/index.es11.js +146 -120
  24. package/dist/index.es11.js.map +1 -1
  25. package/dist/index.es110.js +13 -2
  26. package/dist/index.es110.js.map +1 -1
  27. package/dist/index.es111.js +484 -129
  28. package/dist/index.es111.js.map +1 -1
  29. package/dist/index.es112.js +5 -906
  30. package/dist/index.es112.js.map +1 -1
  31. package/dist/index.es113.js +2 -282
  32. package/dist/index.es113.js.map +1 -1
  33. package/dist/index.es114.js +148 -4
  34. package/dist/index.es114.js.map +1 -1
  35. package/dist/index.es115.js +869 -407
  36. package/dist/index.es115.js.map +1 -1
  37. package/dist/index.es116.js +274 -40
  38. package/dist/index.es116.js.map +1 -1
  39. package/dist/index.es117.js +4 -24
  40. package/dist/index.es117.js.map +1 -1
  41. package/dist/index.es118.js +437 -72
  42. package/dist/index.es118.js.map +1 -1
  43. package/dist/index.es119.js +42 -125
  44. package/dist/index.es119.js.map +1 -1
  45. package/dist/index.es12.js +13 -103
  46. package/dist/index.es12.js.map +1 -1
  47. package/dist/index.es120.js +21 -48
  48. package/dist/index.es120.js.map +1 -1
  49. package/dist/index.es121.js +77 -8
  50. package/dist/index.es121.js.map +1 -1
  51. package/dist/index.es122.js +127 -43
  52. package/dist/index.es122.js.map +1 -1
  53. package/dist/index.es123.js +41 -91
  54. package/dist/index.es123.js.map +1 -1
  55. package/dist/index.es124.js +9 -52
  56. package/dist/index.es124.js.map +1 -1
  57. package/dist/index.es125.js +44 -15
  58. package/dist/index.es125.js.map +1 -1
  59. package/dist/index.es126.js +97 -13
  60. package/dist/index.es126.js.map +1 -1
  61. package/dist/index.es127.js +52 -88
  62. package/dist/index.es127.js.map +1 -1
  63. package/dist/index.es128.js +15 -2
  64. package/dist/index.es128.js.map +1 -1
  65. package/dist/index.es129.js +87 -54
  66. package/dist/index.es129.js.map +1 -1
  67. package/dist/index.es13.js +126 -32
  68. package/dist/index.es13.js.map +1 -1
  69. package/dist/index.es130.js +2 -100
  70. package/dist/index.es130.js.map +1 -1
  71. package/dist/index.es131.js +163 -190
  72. package/dist/index.es131.js.map +1 -1
  73. package/dist/index.es132.js +2 -110
  74. package/dist/index.es132.js.map +1 -1
  75. package/dist/index.es133.js +53 -32
  76. package/dist/index.es133.js.map +1 -1
  77. package/dist/index.es134.js +99 -9
  78. package/dist/index.es134.js.map +1 -1
  79. package/dist/index.es135.js +190 -10
  80. package/dist/index.es135.js.map +1 -1
  81. package/dist/index.es136.js +108 -10
  82. package/dist/index.es136.js.map +1 -1
  83. package/dist/index.es137.js +30 -86
  84. package/dist/index.es137.js.map +1 -1
  85. package/dist/index.es138.js +10 -275
  86. package/dist/index.es138.js.map +1 -1
  87. package/dist/index.es139.js +11 -2
  88. package/dist/index.es139.js.map +1 -1
  89. package/dist/index.es140.js +11 -163
  90. package/dist/index.es140.js.map +1 -1
  91. package/dist/index.es141.js +87 -47
  92. package/dist/index.es141.js.map +1 -1
  93. package/dist/index.es142.js +266 -31
  94. package/dist/index.es142.js.map +1 -1
  95. package/dist/index.es143.js +2 -35
  96. package/dist/index.es143.js.map +1 -1
  97. package/dist/index.es144.js +155 -31
  98. package/dist/index.es144.js.map +1 -1
  99. package/dist/index.es145.js +48 -21
  100. package/dist/index.es145.js.map +1 -1
  101. package/dist/index.es146.js +33 -584
  102. package/dist/index.es146.js.map +1 -1
  103. package/dist/index.es147.js +34 -124
  104. package/dist/index.es147.js.map +1 -1
  105. package/dist/index.es148.js +31 -155
  106. package/dist/index.es148.js.map +1 -1
  107. package/dist/index.es149.js +24 -2
  108. package/dist/index.es149.js.map +1 -1
  109. package/dist/index.es15.js +15 -15
  110. package/dist/index.es150.js +591 -2
  111. package/dist/index.es150.js.map +1 -1
  112. package/dist/index.es151.js +125 -2
  113. package/dist/index.es151.js.map +1 -1
  114. package/dist/index.es152.js +3 -21
  115. package/dist/index.es152.js.map +1 -1
  116. package/dist/index.es153.js +2 -2
  117. package/dist/index.es154.js +2 -25
  118. package/dist/index.es154.js.map +1 -1
  119. package/dist/index.es155.js +22 -8
  120. package/dist/index.es155.js.map +1 -1
  121. package/dist/index.es156.js +2 -5
  122. package/dist/index.es156.js.map +1 -1
  123. package/dist/index.es157.js +24 -12
  124. package/dist/index.es157.js.map +1 -1
  125. package/dist/index.es158.js +5 -6
  126. package/dist/index.es158.js.map +1 -1
  127. package/dist/index.es159.js +12 -63
  128. package/dist/index.es159.js.map +1 -1
  129. package/dist/index.es160.js +5 -21
  130. package/dist/index.es160.js.map +1 -1
  131. package/dist/index.es161.js +8 -6
  132. package/dist/index.es161.js.map +1 -1
  133. package/dist/index.es162.js +22 -346
  134. package/dist/index.es162.js.map +1 -1
  135. package/dist/index.es163.js +12 -25
  136. package/dist/index.es163.js.map +1 -1
  137. package/dist/index.es164.js +53 -11
  138. package/dist/index.es164.js.map +1 -1
  139. package/dist/index.es165.js +59 -49
  140. package/dist/index.es165.js.map +1 -1
  141. package/dist/index.es166.js +22 -7
  142. package/dist/index.es166.js.map +1 -1
  143. package/dist/index.es167.js +5 -102
  144. package/dist/index.es167.js.map +1 -1
  145. package/dist/index.es168.js +339 -109
  146. package/dist/index.es168.js.map +1 -1
  147. package/dist/index.es169.js +7 -136
  148. package/dist/index.es169.js.map +1 -1
  149. package/dist/index.es17.js +2 -2
  150. package/dist/index.es170.js +97 -109
  151. package/dist/index.es170.js.map +1 -1
  152. package/dist/index.es171.js +119 -6
  153. package/dist/index.es171.js.map +1 -1
  154. package/dist/index.es172.js +136 -4
  155. package/dist/index.es172.js.map +1 -1
  156. package/dist/index.es173.js +115 -2
  157. package/dist/index.es173.js.map +1 -1
  158. package/dist/index.es174.js +6 -3737
  159. package/dist/index.es174.js.map +1 -1
  160. package/dist/index.es175.js +2 -342
  161. package/dist/index.es175.js.map +1 -1
  162. package/dist/index.es176.js +138 -105
  163. package/dist/index.es176.js.map +1 -1
  164. package/dist/index.es177.js +2 -133
  165. package/dist/index.es177.js.map +1 -1
  166. package/dist/index.es178.js +3734 -12
  167. package/dist/index.es178.js.map +1 -1
  168. package/dist/index.es179.js +326 -136
  169. package/dist/index.es179.js.map +1 -1
  170. package/dist/index.es180.js +107 -13
  171. package/dist/index.es180.js.map +1 -1
  172. package/dist/index.es181.js +131 -6
  173. package/dist/index.es181.js.map +1 -1
  174. package/dist/index.es182.js +13 -19
  175. package/dist/index.es182.js.map +1 -1
  176. package/dist/index.es183.js +139 -77
  177. package/dist/index.es183.js.map +1 -1
  178. package/dist/index.es184.js +13 -241
  179. package/dist/index.es184.js.map +1 -1
  180. package/dist/index.es185.js +8 -24
  181. package/dist/index.es185.js.map +1 -1
  182. package/dist/index.es186.js +21 -6
  183. package/dist/index.es186.js.map +1 -1
  184. package/dist/index.es187.js +90 -4
  185. package/dist/index.es187.js.map +1 -1
  186. package/dist/index.es188.js +240 -15
  187. package/dist/index.es188.js.map +1 -1
  188. package/dist/index.es189.js +24 -8
  189. package/dist/index.es189.js.map +1 -1
  190. package/dist/index.es190.js +6 -142
  191. package/dist/index.es190.js.map +1 -1
  192. package/dist/index.es191.js +4 -2
  193. package/dist/index.es191.js.map +1 -1
  194. package/dist/index.es192.js +18 -32
  195. package/dist/index.es192.js.map +1 -1
  196. package/dist/index.es193.js +8 -6
  197. package/dist/index.es193.js.map +1 -1
  198. package/dist/index.es194.js +31 -105
  199. package/dist/index.es194.js.map +1 -1
  200. package/dist/index.es195.js +6 -13
  201. package/dist/index.es195.js.map +1 -1
  202. package/dist/index.es196.js +105 -17
  203. package/dist/index.es196.js.map +1 -1
  204. package/dist/index.es197.js +11 -29
  205. package/dist/index.es197.js.map +1 -1
  206. package/dist/index.es198.js +17 -3
  207. package/dist/index.es198.js.map +1 -1
  208. package/dist/index.es199.js +30 -4
  209. package/dist/index.es199.js.map +1 -1
  210. package/dist/index.es2.js +24 -15
  211. package/dist/index.es2.js.map +1 -1
  212. package/dist/index.es20.js +35 -66
  213. package/dist/index.es20.js.map +1 -1
  214. package/dist/index.es200.js +4 -5
  215. package/dist/index.es200.js.map +1 -1
  216. package/dist/index.es201.js +4 -36
  217. package/dist/index.es201.js.map +1 -1
  218. package/dist/index.es202.js +5 -8
  219. package/dist/index.es202.js.map +1 -1
  220. package/dist/index.es203.js +36 -5
  221. package/dist/index.es203.js.map +1 -1
  222. package/dist/index.es204.js +5 -4
  223. package/dist/index.es204.js.map +1 -1
  224. package/dist/index.es205.js +5 -41
  225. package/dist/index.es205.js.map +1 -1
  226. package/dist/index.es206.js +4 -10
  227. package/dist/index.es206.js.map +1 -1
  228. package/dist/index.es207.js +39 -239
  229. package/dist/index.es207.js.map +1 -1
  230. package/dist/index.es208.js +10 -48
  231. package/dist/index.es208.js.map +1 -1
  232. package/dist/index.es209.js +239 -32
  233. package/dist/index.es209.js.map +1 -1
  234. package/dist/index.es21.js +25 -34
  235. package/dist/index.es21.js.map +1 -1
  236. package/dist/index.es210.js +49 -11
  237. package/dist/index.es210.js.map +1 -1
  238. package/dist/index.es211.js +33 -6
  239. package/dist/index.es211.js.map +1 -1
  240. package/dist/index.es212.js +12 -6
  241. package/dist/index.es212.js.map +1 -1
  242. package/dist/index.es213.js +7 -64
  243. package/dist/index.es213.js.map +1 -1
  244. package/dist/index.es214.js +6 -40
  245. package/dist/index.es214.js.map +1 -1
  246. package/dist/index.es215.js +63 -30
  247. package/dist/index.es215.js.map +1 -1
  248. package/dist/index.es216.js +35 -56
  249. package/dist/index.es216.js.map +1 -1
  250. package/dist/index.es217.js +32 -15
  251. package/dist/index.es217.js.map +1 -1
  252. package/dist/index.es218.js +60 -21
  253. package/dist/index.es218.js.map +1 -1
  254. package/dist/index.es219.js +15 -5
  255. package/dist/index.es219.js.map +1 -1
  256. package/dist/index.es22.js +146 -27
  257. package/dist/index.es22.js.map +1 -1
  258. package/dist/index.es220.js +21 -15
  259. package/dist/index.es220.js.map +1 -1
  260. package/dist/index.es221.js +4 -32
  261. package/dist/index.es221.js.map +1 -1
  262. package/dist/index.es222.js +16 -4
  263. package/dist/index.es222.js.map +1 -1
  264. package/dist/index.es223.js +32 -4
  265. package/dist/index.es223.js.map +1 -1
  266. package/dist/index.es224.js +5 -5
  267. package/dist/index.es224.js.map +1 -1
  268. package/dist/index.es225.js +4 -7
  269. package/dist/index.es225.js.map +1 -1
  270. package/dist/index.es226.js +4 -91
  271. package/dist/index.es226.js.map +1 -1
  272. package/dist/index.es227.js +7 -17
  273. package/dist/index.es227.js.map +1 -1
  274. package/dist/index.es228.js +90 -760
  275. package/dist/index.es228.js.map +1 -1
  276. package/dist/index.es229.js +18 -66
  277. package/dist/index.es229.js.map +1 -1
  278. package/dist/index.es23.js +16 -146
  279. package/dist/index.es23.js.map +1 -1
  280. package/dist/index.es230.js +749 -161
  281. package/dist/index.es230.js.map +1 -1
  282. package/dist/index.es231.js +66 -38
  283. package/dist/index.es231.js.map +1 -1
  284. package/dist/index.es232.js +172 -135
  285. package/dist/index.es232.js.map +1 -1
  286. package/dist/index.es233.js +136 -92
  287. package/dist/index.es233.js.map +1 -1
  288. package/dist/index.es234.js +92 -32
  289. package/dist/index.es234.js.map +1 -1
  290. package/dist/index.es235.js +32 -284
  291. package/dist/index.es235.js.map +1 -1
  292. package/dist/index.es236.js +284 -25
  293. package/dist/index.es236.js.map +1 -1
  294. package/dist/index.es237.js +22 -20
  295. package/dist/index.es237.js.map +1 -1
  296. package/dist/index.es238.js +22 -13
  297. package/dist/index.es238.js.map +1 -1
  298. package/dist/index.es239.js +12 -12
  299. package/dist/index.es239.js.map +1 -1
  300. package/dist/index.es24.js +58 -295
  301. package/dist/index.es24.js.map +1 -1
  302. package/dist/index.es240.js +13 -24
  303. package/dist/index.es240.js.map +1 -1
  304. package/dist/index.es241.js +22 -42
  305. package/dist/index.es241.js.map +1 -1
  306. package/dist/index.es242.js +45 -11
  307. package/dist/index.es242.js.map +1 -1
  308. package/dist/index.es243.js +10 -10
  309. package/dist/index.es243.js.map +1 -1
  310. package/dist/index.es244.js +10 -10
  311. package/dist/index.es244.js.map +1 -1
  312. package/dist/index.es245.js +11 -14
  313. package/dist/index.es245.js.map +1 -1
  314. package/dist/index.es246.js +14 -11
  315. package/dist/index.es246.js.map +1 -1
  316. package/dist/index.es247.js +11 -11
  317. package/dist/index.es247.js.map +1 -1
  318. package/dist/index.es248.js +10 -10
  319. package/dist/index.es248.js.map +1 -1
  320. package/dist/index.es249.js +11 -15
  321. package/dist/index.es249.js.map +1 -1
  322. package/dist/index.es25.js +298 -114
  323. package/dist/index.es25.js.map +1 -1
  324. package/dist/index.es250.js +15 -11
  325. package/dist/index.es250.js.map +1 -1
  326. package/dist/index.es251.js +10 -10
  327. package/dist/index.es251.js.map +1 -1
  328. package/dist/index.es252.js +11 -11
  329. package/dist/index.es252.js.map +1 -1
  330. package/dist/index.es253.js +10 -10
  331. package/dist/index.es253.js.map +1 -1
  332. package/dist/index.es254.js +10 -10
  333. package/dist/index.es254.js.map +1 -1
  334. package/dist/index.es255.js +10 -10
  335. package/dist/index.es255.js.map +1 -1
  336. package/dist/index.es256.js +10 -10
  337. package/dist/index.es256.js.map +1 -1
  338. package/dist/index.es257.js +10 -10
  339. package/dist/index.es257.js.map +1 -1
  340. package/dist/index.es258.js +11 -56
  341. package/dist/index.es258.js.map +1 -1
  342. package/dist/index.es259.js +53 -46
  343. package/dist/index.es259.js.map +1 -1
  344. package/dist/index.es26.js +121 -5
  345. package/dist/index.es26.js.map +1 -1
  346. package/dist/index.es260.js +42 -112
  347. package/dist/index.es260.js.map +1 -1
  348. package/dist/index.es261.js +87 -352
  349. package/dist/index.es261.js.map +1 -1
  350. package/dist/index.es262.js +381 -15
  351. package/dist/index.es262.js.map +1 -1
  352. package/dist/index.es263.js +17 -10
  353. package/dist/index.es263.js.map +1 -1
  354. package/dist/index.es264.js +10 -30
  355. package/dist/index.es264.js.map +1 -1
  356. package/dist/index.es265.js +17 -17
  357. package/dist/index.es265.js.map +1 -1
  358. package/dist/index.es266.js +25 -56
  359. package/dist/index.es266.js.map +1 -1
  360. package/dist/index.es267.js +59 -14
  361. package/dist/index.es267.js.map +1 -1
  362. package/dist/index.es268.js +14 -74
  363. package/dist/index.es268.js.map +1 -1
  364. package/dist/index.es269.js +77 -11
  365. package/dist/index.es269.js.map +1 -1
  366. package/dist/index.es270.js +10 -10
  367. package/dist/index.es270.js.map +1 -1
  368. package/dist/index.es271.js +11 -15
  369. package/dist/index.es271.js.map +1 -1
  370. package/dist/index.es272.js +14 -51
  371. package/dist/index.es272.js.map +1 -1
  372. package/dist/index.es273.js +44 -158
  373. package/dist/index.es273.js.map +1 -1
  374. package/dist/index.es274.js +167 -2
  375. package/dist/index.es274.js.map +1 -1
  376. package/dist/index.es275.js +37 -10
  377. package/dist/index.es275.js.map +1 -1
  378. package/dist/index.es276.js +2 -20
  379. package/dist/index.es276.js.map +1 -1
  380. package/dist/index.es277.js +10 -38
  381. package/dist/index.es277.js.map +1 -1
  382. package/dist/index.es278.js +23 -0
  383. package/dist/index.es278.js.map +1 -0
  384. package/dist/index.es279.js +42 -0
  385. package/dist/index.es279.js.map +1 -0
  386. package/dist/index.es28.js +7 -7
  387. package/dist/index.es29.js +1 -1
  388. package/dist/index.es32.js +4 -4
  389. package/dist/index.es33.js +117 -13
  390. package/dist/index.es33.js.map +1 -1
  391. package/dist/index.es34.js +65 -112
  392. package/dist/index.es34.js.map +1 -1
  393. package/dist/index.es35.js +18 -71
  394. package/dist/index.es35.js.map +1 -1
  395. package/dist/index.es36.js +260 -17
  396. package/dist/index.es36.js.map +1 -1
  397. package/dist/index.es37.js +31 -249
  398. package/dist/index.es37.js.map +1 -1
  399. package/dist/index.es38.js +199 -27
  400. package/dist/index.es38.js.map +1 -1
  401. package/dist/index.es39.js +50 -198
  402. package/dist/index.es39.js.map +1 -1
  403. package/dist/index.es40.js +120 -45
  404. package/dist/index.es40.js.map +1 -1
  405. package/dist/index.es41.js +14 -132
  406. package/dist/index.es41.js.map +1 -1
  407. package/dist/index.es42.js +225 -19
  408. package/dist/index.es42.js.map +1 -1
  409. package/dist/index.es43.js +8 -229
  410. package/dist/index.es43.js.map +1 -1
  411. package/dist/index.es44.js +1190 -7
  412. package/dist/index.es44.js.map +1 -1
  413. package/dist/index.es45.js +6 -1191
  414. package/dist/index.es45.js.map +1 -1
  415. package/dist/index.es46.js +146 -6
  416. package/dist/index.es46.js.map +1 -1
  417. package/dist/index.es47.js +15 -146
  418. package/dist/index.es47.js.map +1 -1
  419. package/dist/index.es49.js +5 -93
  420. package/dist/index.es49.js.map +1 -1
  421. package/dist/index.es50.js +8 -4
  422. package/dist/index.es50.js.map +1 -1
  423. package/dist/index.es51.js +91 -33
  424. package/dist/index.es51.js.map +1 -1
  425. package/dist/index.es52.js +3 -71
  426. package/dist/index.es52.js.map +1 -1
  427. package/dist/index.es53.js +34 -36
  428. package/dist/index.es53.js.map +1 -1
  429. package/dist/index.es54.js +61 -295
  430. package/dist/index.es54.js.map +1 -1
  431. package/dist/index.es55.js +38 -9
  432. package/dist/index.es55.js.map +1 -1
  433. package/dist/index.es56.js +296 -81
  434. package/dist/index.es56.js.map +1 -1
  435. package/dist/index.es57.js +9 -8
  436. package/dist/index.es57.js.map +1 -1
  437. package/dist/index.es58.js +89 -13
  438. package/dist/index.es58.js.map +1 -1
  439. package/dist/index.es59.js +6 -141
  440. package/dist/index.es59.js.map +1 -1
  441. package/dist/index.es60.js +12 -297
  442. package/dist/index.es60.js.map +1 -1
  443. package/dist/index.es61.js +137 -60
  444. package/dist/index.es61.js.map +1 -1
  445. package/dist/index.es62.js +247 -160
  446. package/dist/index.es62.js.map +1 -1
  447. package/dist/index.es63.js +63 -31
  448. package/dist/index.es63.js.map +1 -1
  449. package/dist/index.es64.js +212 -8
  450. package/dist/index.es64.js.map +1 -1
  451. package/dist/index.es65.js +32 -10
  452. package/dist/index.es65.js.map +1 -1
  453. package/dist/index.es66.js +8 -186
  454. package/dist/index.es66.js.map +1 -1
  455. package/dist/index.es67.js +11 -23
  456. package/dist/index.es67.js.map +1 -1
  457. package/dist/index.es68.js +183 -1396
  458. package/dist/index.es68.js.map +1 -1
  459. package/dist/index.es69.js +24 -9
  460. package/dist/index.es69.js.map +1 -1
  461. package/dist/index.es70.js +1400 -8
  462. package/dist/index.es70.js.map +1 -1
  463. package/dist/index.es71.js +9 -6
  464. package/dist/index.es71.js.map +1 -1
  465. package/dist/index.es72.js +8 -163
  466. package/dist/index.es72.js.map +1 -1
  467. package/dist/index.es73.js +6 -672
  468. package/dist/index.es73.js.map +1 -1
  469. package/dist/index.es74.js +161 -10
  470. package/dist/index.es74.js.map +1 -1
  471. package/dist/index.es75.js +671 -39
  472. package/dist/index.es75.js.map +1 -1
  473. package/dist/index.es76.js +10 -32
  474. package/dist/index.es76.js.map +1 -1
  475. package/dist/index.es77.js +31 -223
  476. package/dist/index.es77.js.map +1 -1
  477. package/dist/index.es78.js +33 -29
  478. package/dist/index.es78.js.map +1 -1
  479. package/dist/index.es79.js +193 -36
  480. package/dist/index.es79.js.map +1 -1
  481. package/dist/index.es80.js +26 -72
  482. package/dist/index.es80.js.map +1 -1
  483. package/dist/index.es81.js +70 -47
  484. package/dist/index.es81.js.map +1 -1
  485. package/dist/index.es82.js +72 -26
  486. package/dist/index.es82.js.map +1 -1
  487. package/dist/index.es83.js +37 -28
  488. package/dist/index.es83.js.map +1 -1
  489. package/dist/index.es84.js +28 -55
  490. package/dist/index.es84.js.map +1 -1
  491. package/dist/index.es85.js +43 -13
  492. package/dist/index.es85.js.map +1 -1
  493. package/dist/index.es86.js +32 -132
  494. package/dist/index.es86.js.map +1 -1
  495. package/dist/index.es87.js +5 -21
  496. package/dist/index.es87.js.map +1 -1
  497. package/dist/index.es88.js +61 -170
  498. package/dist/index.es88.js.map +1 -1
  499. package/dist/index.es89.js +31 -235
  500. package/dist/index.es89.js.map +1 -1
  501. package/dist/index.es90.js +50 -348
  502. package/dist/index.es90.js.map +1 -1
  503. package/dist/index.es91.js +13 -137
  504. package/dist/index.es91.js.map +1 -1
  505. package/dist/index.es92.js +132 -65
  506. package/dist/index.es92.js.map +1 -1
  507. package/dist/index.es93.js +21 -37
  508. package/dist/index.es93.js.map +1 -1
  509. package/dist/index.es94.js +179 -34
  510. package/dist/index.es94.js.map +1 -1
  511. package/dist/index.es95.js +230 -155
  512. package/dist/index.es95.js.map +1 -1
  513. package/dist/index.es96.js +341 -189
  514. package/dist/index.es96.js.map +1 -1
  515. package/dist/index.es97.js +136 -13
  516. package/dist/index.es97.js.map +1 -1
  517. package/dist/index.es98.js +68 -28
  518. package/dist/index.es98.js.map +1 -1
  519. package/dist/index.es99.js +33 -30
  520. package/dist/index.es99.js.map +1 -1
  521. package/dist/langgraph-ui-components.css +107 -0
  522. package/dist/styles.css +1 -1
  523. package/package.json +8 -11
  524. package/dist/index.es48.js +0 -11
  525. package/dist/index.es48.js.map +0 -1
@@ -1,132 +1,49 @@
1
- import { $constructor, $ZodAsyncError } from "./index.es159.js";
2
- import { defineLazy, aborted } from "./index.es118.js";
3
- import { clone } from "./index.es118.js";
4
- import { safeParse, safeParseAsync } from "./index.es122.js";
5
- import { version } from "./index.es161.js";
6
- const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
7
- var _a;
8
- inst ?? (inst = {});
9
- inst._zod.def = def;
10
- inst._zod.bag = inst._zod.bag || {};
11
- inst._zod.version = version;
12
- const checks = [...inst._zod.def.checks ?? []];
13
- if (inst._zod.traits.has("$ZodCheck")) {
14
- checks.unshift(inst);
15
- }
16
- for (const ch of checks) {
17
- for (const fn of ch._zod.onattach) {
18
- fn(inst);
19
- }
1
+ import { __export } from "./index.es50.js";
2
+ var outputs_exports = {};
3
+ __export(outputs_exports, {
4
+ ChatGenerationChunk: () => ChatGenerationChunk,
5
+ GenerationChunk: () => GenerationChunk,
6
+ RUN_KEY: () => RUN_KEY
7
+ });
8
+ const RUN_KEY = "__run";
9
+ var GenerationChunk = class GenerationChunk2 {
10
+ text;
11
+ generationInfo;
12
+ constructor(fields) {
13
+ this.text = fields.text;
14
+ this.generationInfo = fields.generationInfo;
20
15
  }
21
- if (checks.length === 0) {
22
- (_a = inst._zod).deferred ?? (_a.deferred = []);
23
- inst._zod.deferred?.push(() => {
24
- inst._zod.run = inst._zod.parse;
25
- });
26
- } else {
27
- const runChecks = (payload, checks2, ctx) => {
28
- let isAborted = aborted(payload);
29
- let asyncResult;
30
- for (const ch of checks2) {
31
- if (ch._zod.def.when) {
32
- const shouldRun = ch._zod.def.when(payload);
33
- if (!shouldRun)
34
- continue;
35
- } else if (isAborted) {
36
- continue;
37
- }
38
- const currLen = payload.issues.length;
39
- const _ = ch._zod.check(payload);
40
- if (_ instanceof Promise && ctx?.async === false) {
41
- throw new $ZodAsyncError();
42
- }
43
- if (asyncResult || _ instanceof Promise) {
44
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
45
- await _;
46
- const nextLen = payload.issues.length;
47
- if (nextLen === currLen)
48
- return;
49
- if (!isAborted)
50
- isAborted = aborted(payload, currLen);
51
- });
52
- } else {
53
- const nextLen = payload.issues.length;
54
- if (nextLen === currLen)
55
- continue;
56
- if (!isAborted)
57
- isAborted = aborted(payload, currLen);
58
- }
59
- }
60
- if (asyncResult) {
61
- return asyncResult.then(() => {
62
- return payload;
63
- });
64
- }
65
- return payload;
66
- };
67
- const handleCanaryResult = (canary, payload, ctx) => {
68
- if (aborted(canary)) {
69
- canary.aborted = true;
70
- return canary;
71
- }
72
- const checkResult = runChecks(payload, checks, ctx);
73
- if (checkResult instanceof Promise) {
74
- if (ctx.async === false)
75
- throw new $ZodAsyncError();
76
- return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
77
- }
78
- return inst._zod.parse(checkResult, ctx);
79
- };
80
- inst._zod.run = (payload, ctx) => {
81
- if (ctx.skipChecks) {
82
- return inst._zod.parse(payload, ctx);
83
- }
84
- if (ctx.direction === "backward") {
85
- const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
86
- if (canary instanceof Promise) {
87
- return canary.then((canary2) => {
88
- return handleCanaryResult(canary2, payload, ctx);
89
- });
90
- }
91
- return handleCanaryResult(canary, payload, ctx);
92
- }
93
- const result = inst._zod.parse(payload, ctx);
94
- if (result instanceof Promise) {
95
- if (ctx.async === false)
96
- throw new $ZodAsyncError();
97
- return result.then((result2) => runChecks(result2, checks, ctx));
16
+ concat(chunk) {
17
+ return new GenerationChunk2({
18
+ text: this.text + chunk.text,
19
+ generationInfo: {
20
+ ...this.generationInfo,
21
+ ...chunk.generationInfo
98
22
  }
99
- return runChecks(result, checks, ctx);
100
- };
23
+ });
101
24
  }
102
- defineLazy(inst, "~standard", () => ({
103
- validate: (value) => {
104
- try {
105
- const r = safeParse(inst, value);
106
- return r.success ? { value: r.data } : { issues: r.error?.issues };
107
- } catch (_) {
108
- return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
109
- }
110
- },
111
- vendor: "zod",
112
- version: 1
113
- }));
114
- });
115
- const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
116
- $ZodType.init(inst, def);
117
- inst._zod.parse = (payload, _ctx) => {
118
- payload.issues.push({
119
- expected: "never",
120
- code: "invalid_type",
121
- input: payload.value,
122
- inst
25
+ };
26
+ var ChatGenerationChunk = class ChatGenerationChunk2 extends GenerationChunk {
27
+ message;
28
+ constructor(fields) {
29
+ super(fields);
30
+ this.message = fields.message;
31
+ }
32
+ concat(chunk) {
33
+ return new ChatGenerationChunk2({
34
+ text: this.text + chunk.text,
35
+ generationInfo: {
36
+ ...this.generationInfo,
37
+ ...chunk.generationInfo
38
+ },
39
+ message: this.message.concat(chunk.message)
123
40
  });
124
- return payload;
125
- };
126
- });
41
+ }
42
+ };
127
43
  export {
128
- $ZodNever,
129
- $ZodType,
130
- clone
44
+ ChatGenerationChunk,
45
+ GenerationChunk,
46
+ RUN_KEY,
47
+ outputs_exports
131
48
  };
132
49
  //# sourceMappingURL=index.es119.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es119.js","sources":["../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js"],"sourcesContent":["import * as checks from \"./checks.js\";\nimport * as core from \"./core.js\";\nimport { Doc } from \"./doc.js\";\nimport { parse, parseAsync, safeParse, safeParseAsync } from \"./parse.js\";\nimport * as regexes from \"./regexes.js\";\nimport * as util from \"./util.js\";\nimport { version } from \"./versions.js\";\nexport const $ZodType = /*@__PURE__*/ core.$constructor(\"$ZodType\", (inst, def) => {\n var _a;\n inst ?? (inst = {});\n inst._zod.def = def; // set _def property\n inst._zod.bag = inst._zod.bag || {}; // initialize _bag object\n inst._zod.version = version;\n const checks = [...(inst._zod.def.checks ?? [])];\n // if inst is itself a checks.$ZodCheck, run it as a check\n if (inst._zod.traits.has(\"$ZodCheck\")) {\n checks.unshift(inst);\n }\n for (const ch of checks) {\n for (const fn of ch._zod.onattach) {\n fn(inst);\n }\n }\n if (checks.length === 0) {\n // deferred initializer\n // inst._zod.parse is not yet defined\n (_a = inst._zod).deferred ?? (_a.deferred = []);\n inst._zod.deferred?.push(() => {\n inst._zod.run = inst._zod.parse;\n });\n }\n else {\n const runChecks = (payload, checks, ctx) => {\n let isAborted = util.aborted(payload);\n let asyncResult;\n for (const ch of checks) {\n if (ch._zod.def.when) {\n const shouldRun = ch._zod.def.when(payload);\n if (!shouldRun)\n continue;\n }\n else if (isAborted) {\n continue;\n }\n const currLen = payload.issues.length;\n const _ = ch._zod.check(payload);\n if (_ instanceof Promise && ctx?.async === false) {\n throw new core.$ZodAsyncError();\n }\n if (asyncResult || _ instanceof Promise) {\n asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {\n await _;\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n return;\n if (!isAborted)\n isAborted = util.aborted(payload, currLen);\n });\n }\n else {\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n continue;\n if (!isAborted)\n isAborted = util.aborted(payload, currLen);\n }\n }\n if (asyncResult) {\n return asyncResult.then(() => {\n return payload;\n });\n }\n return payload;\n };\n const handleCanaryResult = (canary, payload, ctx) => {\n // abort if the canary is aborted\n if (util.aborted(canary)) {\n canary.aborted = true;\n return canary;\n }\n // run checks first, then\n const checkResult = runChecks(payload, checks, ctx);\n if (checkResult instanceof Promise) {\n if (ctx.async === false)\n throw new core.$ZodAsyncError();\n return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));\n }\n return inst._zod.parse(checkResult, ctx);\n };\n inst._zod.run = (payload, ctx) => {\n if (ctx.skipChecks) {\n return inst._zod.parse(payload, ctx);\n }\n if (ctx.direction === \"backward\") {\n // run canary\n // initial pass (no checks)\n const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });\n if (canary instanceof Promise) {\n return canary.then((canary) => {\n return handleCanaryResult(canary, payload, ctx);\n });\n }\n return handleCanaryResult(canary, payload, ctx);\n }\n // forward\n const result = inst._zod.parse(payload, ctx);\n if (result instanceof Promise) {\n if (ctx.async === false)\n throw new core.$ZodAsyncError();\n return result.then((result) => runChecks(result, checks, ctx));\n }\n return runChecks(result, checks, ctx);\n };\n }\n // Lazy initialize ~standard to avoid creating objects for every schema\n util.defineLazy(inst, \"~standard\", () => ({\n validate: (value) => {\n try {\n const r = safeParse(inst, value);\n return r.success ? { value: r.data } : { issues: r.error?.issues };\n }\n catch (_) {\n return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));\n }\n },\n vendor: \"zod\",\n version: 1,\n }));\n});\nexport { clone } from \"./util.js\";\nexport const $ZodString = /*@__PURE__*/ core.$constructor(\"$ZodString\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);\n inst._zod.parse = (payload, _) => {\n if (def.coerce)\n try {\n payload.value = String(payload.value);\n }\n catch (_) { }\n if (typeof payload.value === \"string\")\n return payload;\n payload.issues.push({\n expected: \"string\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodStringFormat\", (inst, def) => {\n // check initialization must come first\n checks.$ZodCheckStringFormat.init(inst, def);\n $ZodString.init(inst, def);\n});\nexport const $ZodGUID = /*@__PURE__*/ core.$constructor(\"$ZodGUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.guid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodUUID = /*@__PURE__*/ core.$constructor(\"$ZodUUID\", (inst, def) => {\n if (def.version) {\n const versionMap = {\n v1: 1,\n v2: 2,\n v3: 3,\n v4: 4,\n v5: 5,\n v6: 6,\n v7: 7,\n v8: 8,\n };\n const v = versionMap[def.version];\n if (v === undefined)\n throw new Error(`Invalid UUID version: \"${def.version}\"`);\n def.pattern ?? (def.pattern = regexes.uuid(v));\n }\n else\n def.pattern ?? (def.pattern = regexes.uuid());\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodEmail = /*@__PURE__*/ core.$constructor(\"$ZodEmail\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.email);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodURL = /*@__PURE__*/ core.$constructor(\"$ZodURL\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n try {\n // Trim whitespace from input\n const trimmed = payload.value.trim();\n // @ts-ignore\n const url = new URL(trimmed);\n if (def.hostname) {\n def.hostname.lastIndex = 0;\n if (!def.hostname.test(url.hostname)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid hostname\",\n pattern: def.hostname.source,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n }\n if (def.protocol) {\n def.protocol.lastIndex = 0;\n if (!def.protocol.test(url.protocol.endsWith(\":\") ? url.protocol.slice(0, -1) : url.protocol)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid protocol\",\n pattern: def.protocol.source,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n }\n // Set the output value based on normalize flag\n if (def.normalize) {\n // Use normalized URL\n payload.value = url.href;\n }\n else {\n // Preserve the original input (trimmed)\n payload.value = trimmed;\n }\n return;\n }\n catch (_) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodEmoji = /*@__PURE__*/ core.$constructor(\"$ZodEmoji\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.emoji());\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodNanoID = /*@__PURE__*/ core.$constructor(\"$ZodNanoID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.nanoid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCUID = /*@__PURE__*/ core.$constructor(\"$ZodCUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cuid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCUID2 = /*@__PURE__*/ core.$constructor(\"$ZodCUID2\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cuid2);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodULID = /*@__PURE__*/ core.$constructor(\"$ZodULID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ulid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodXID = /*@__PURE__*/ core.$constructor(\"$ZodXID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.xid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodKSUID = /*@__PURE__*/ core.$constructor(\"$ZodKSUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ksuid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODateTime = /*@__PURE__*/ core.$constructor(\"$ZodISODateTime\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.datetime(def));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODate = /*@__PURE__*/ core.$constructor(\"$ZodISODate\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.date);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISOTime = /*@__PURE__*/ core.$constructor(\"$ZodISOTime\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.time(def));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODuration = /*@__PURE__*/ core.$constructor(\"$ZodISODuration\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.duration);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodIPv4 = /*@__PURE__*/ core.$constructor(\"$ZodIPv4\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ipv4);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `ipv4`;\n});\nexport const $ZodIPv6 = /*@__PURE__*/ core.$constructor(\"$ZodIPv6\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ipv6);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `ipv6`;\n inst._zod.check = (payload) => {\n try {\n // @ts-ignore\n new URL(`http://[${payload.value}]`);\n // return;\n }\n catch {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"ipv6\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodMAC = /*@__PURE__*/ core.$constructor(\"$ZodMAC\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.mac(def.delimiter));\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `mac`;\n});\nexport const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor(\"$ZodCIDRv4\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cidrv4);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor(\"$ZodCIDRv6\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n const parts = payload.value.split(\"/\");\n try {\n if (parts.length !== 2)\n throw new Error();\n const [address, prefix] = parts;\n if (!prefix)\n throw new Error();\n const prefixNum = Number(prefix);\n if (`${prefixNum}` !== prefix)\n throw new Error();\n if (prefixNum < 0 || prefixNum > 128)\n throw new Error();\n // @ts-ignore\n new URL(`http://[${address}]`);\n }\n catch {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"cidrv6\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\n////////////////////////////// ZodBase64 //////////////////////////////\nexport function isValidBase64(data) {\n if (data === \"\")\n return true;\n if (data.length % 4 !== 0)\n return false;\n try {\n // @ts-ignore\n atob(data);\n return true;\n }\n catch {\n return false;\n }\n}\nexport const $ZodBase64 = /*@__PURE__*/ core.$constructor(\"$ZodBase64\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.base64);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.contentEncoding = \"base64\";\n inst._zod.check = (payload) => {\n if (isValidBase64(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"base64\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\n////////////////////////////// ZodBase64 //////////////////////////////\nexport function isValidBase64URL(data) {\n if (!regexes.base64url.test(data))\n return false;\n const base64 = data.replace(/[-_]/g, (c) => (c === \"-\" ? \"+\" : \"/\"));\n const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, \"=\");\n return isValidBase64(padded);\n}\nexport const $ZodBase64URL = /*@__PURE__*/ core.$constructor(\"$ZodBase64URL\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.base64url);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.contentEncoding = \"base64url\";\n inst._zod.check = (payload) => {\n if (isValidBase64URL(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"base64url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodE164 = /*@__PURE__*/ core.$constructor(\"$ZodE164\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.e164);\n $ZodStringFormat.init(inst, def);\n});\n////////////////////////////// ZodJWT //////////////////////////////\nexport function isValidJWT(token, algorithm = null) {\n try {\n const tokensParts = token.split(\".\");\n if (tokensParts.length !== 3)\n return false;\n const [header] = tokensParts;\n if (!header)\n return false;\n // @ts-ignore\n const parsedHeader = JSON.parse(atob(header));\n if (\"typ\" in parsedHeader && parsedHeader?.typ !== \"JWT\")\n return false;\n if (!parsedHeader.alg)\n return false;\n if (algorithm && (!(\"alg\" in parsedHeader) || parsedHeader.alg !== algorithm))\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nexport const $ZodJWT = /*@__PURE__*/ core.$constructor(\"$ZodJWT\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidJWT(payload.value, def.alg))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"jwt\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodCustomStringFormat\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (def.fn(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: def.format,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodNumber = /*@__PURE__*/ core.$constructor(\"$ZodNumber\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Number(payload.value);\n }\n catch (_) { }\n const input = payload.value;\n if (typeof input === \"number\" && !Number.isNaN(input) && Number.isFinite(input)) {\n return payload;\n }\n const received = typeof input === \"number\"\n ? Number.isNaN(input)\n ? \"NaN\"\n : !Number.isFinite(input)\n ? \"Infinity\"\n : undefined\n : undefined;\n payload.issues.push({\n expected: \"number\",\n code: \"invalid_type\",\n input,\n inst,\n ...(received ? { received } : {}),\n });\n return payload;\n };\n});\nexport const $ZodNumberFormat = /*@__PURE__*/ core.$constructor(\"$ZodNumberFormat\", (inst, def) => {\n checks.$ZodCheckNumberFormat.init(inst, def);\n $ZodNumber.init(inst, def); // no format checks\n});\nexport const $ZodBoolean = /*@__PURE__*/ core.$constructor(\"$ZodBoolean\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.boolean;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Boolean(payload.value);\n }\n catch (_) { }\n const input = payload.value;\n if (typeof input === \"boolean\")\n return payload;\n payload.issues.push({\n expected: \"boolean\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodBigInt = /*@__PURE__*/ core.$constructor(\"$ZodBigInt\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.bigint;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = BigInt(payload.value);\n }\n catch (_) { }\n if (typeof payload.value === \"bigint\")\n return payload;\n payload.issues.push({\n expected: \"bigint\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodBigIntFormat = /*@__PURE__*/ core.$constructor(\"$ZodBigIntFormat\", (inst, def) => {\n checks.$ZodCheckBigIntFormat.init(inst, def);\n $ZodBigInt.init(inst, def); // no format checks\n});\nexport const $ZodSymbol = /*@__PURE__*/ core.$constructor(\"$ZodSymbol\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"symbol\")\n return payload;\n payload.issues.push({\n expected: \"symbol\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodUndefined = /*@__PURE__*/ core.$constructor(\"$ZodUndefined\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.undefined;\n inst._zod.values = new Set([undefined]);\n inst._zod.optin = \"optional\";\n inst._zod.optout = \"optional\";\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"undefined\")\n return payload;\n payload.issues.push({\n expected: \"undefined\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodNull = /*@__PURE__*/ core.$constructor(\"$ZodNull\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.null;\n inst._zod.values = new Set([null]);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (input === null)\n return payload;\n payload.issues.push({\n expected: \"null\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodAny = /*@__PURE__*/ core.$constructor(\"$ZodAny\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nexport const $ZodUnknown = /*@__PURE__*/ core.$constructor(\"$ZodUnknown\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nexport const $ZodNever = /*@__PURE__*/ core.$constructor(\"$ZodNever\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n payload.issues.push({\n expected: \"never\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodVoid = /*@__PURE__*/ core.$constructor(\"$ZodVoid\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"undefined\")\n return payload;\n payload.issues.push({\n expected: \"void\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodDate = /*@__PURE__*/ core.$constructor(\"$ZodDate\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce) {\n try {\n payload.value = new Date(payload.value);\n }\n catch (_err) { }\n }\n const input = payload.value;\n const isDate = input instanceof Date;\n const isValidDate = isDate && !Number.isNaN(input.getTime());\n if (isValidDate)\n return payload;\n payload.issues.push({\n expected: \"date\",\n code: \"invalid_type\",\n input,\n ...(isDate ? { received: \"Invalid Date\" } : {}),\n inst,\n });\n return payload;\n };\n});\nfunction handleArrayResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...util.prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nexport const $ZodArray = /*@__PURE__*/ core.$constructor(\"$ZodArray\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n expected: \"array\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n payload.value = Array(input.length);\n const proms = [];\n for (let i = 0; i < input.length; i++) {\n const item = input[i];\n const result = def.element._zod.run({\n value: item,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleArrayResult(result, payload, i)));\n }\n else {\n handleArrayResult(result, payload, i);\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload; //handleArrayResultsAsync(parseResults, final);\n };\n});\nfunction handlePropertyResult(result, final, key, input, isOptionalOut) {\n if (result.issues.length) {\n // For optional-out schemas, ignore errors on absent keys\n if (isOptionalOut && !(key in input)) {\n return;\n }\n final.issues.push(...util.prefixIssues(key, result.issues));\n }\n if (result.value === undefined) {\n if (key in input) {\n final.value[key] = undefined;\n }\n }\n else {\n final.value[key] = result.value;\n }\n}\nfunction normalizeDef(def) {\n const keys = Object.keys(def.shape);\n for (const k of keys) {\n if (!def.shape?.[k]?._zod?.traits?.has(\"$ZodType\")) {\n throw new Error(`Invalid element at key \"${k}\": expected a Zod schema`);\n }\n }\n const okeys = util.optionalKeys(def.shape);\n return {\n ...def,\n keys,\n keySet: new Set(keys),\n numKeys: keys.length,\n optionalKeys: new Set(okeys),\n };\n}\nfunction handleCatchall(proms, input, payload, ctx, def, inst) {\n const unrecognized = [];\n // iterate over input keys\n const keySet = def.keySet;\n const _catchall = def.catchall._zod;\n const t = _catchall.def.type;\n const isOptionalOut = _catchall.optout === \"optional\";\n for (const key in input) {\n if (keySet.has(key))\n continue;\n if (t === \"never\") {\n unrecognized.push(key);\n continue;\n }\n const r = _catchall.run({ value: input[key], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));\n }\n else {\n handlePropertyResult(r, payload, key, input, isOptionalOut);\n }\n }\n if (unrecognized.length) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n keys: unrecognized,\n input,\n inst,\n });\n }\n if (!proms.length)\n return payload;\n return Promise.all(proms).then(() => {\n return payload;\n });\n}\nexport const $ZodObject = /*@__PURE__*/ core.$constructor(\"$ZodObject\", (inst, def) => {\n // requires cast because technically $ZodObject doesn't extend\n $ZodType.init(inst, def);\n // const sh = def.shape;\n const desc = Object.getOwnPropertyDescriptor(def, \"shape\");\n if (!desc?.get) {\n const sh = def.shape;\n Object.defineProperty(def, \"shape\", {\n get: () => {\n const newSh = { ...sh };\n Object.defineProperty(def, \"shape\", {\n value: newSh,\n });\n return newSh;\n },\n });\n }\n const _normalized = util.cached(() => normalizeDef(def));\n util.defineLazy(inst._zod, \"propValues\", () => {\n const shape = def.shape;\n const propValues = {};\n for (const key in shape) {\n const field = shape[key]._zod;\n if (field.values) {\n propValues[key] ?? (propValues[key] = new Set());\n for (const v of field.values)\n propValues[key].add(v);\n }\n }\n return propValues;\n });\n const isObject = util.isObject;\n const catchall = def.catchall;\n let value;\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n expected: \"object\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n payload.value = {};\n const proms = [];\n const shape = value.shape;\n for (const key of value.keys) {\n const el = shape[key];\n const isOptionalOut = el._zod.optout === \"optional\";\n const r = el._zod.run({ value: input[key], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));\n }\n else {\n handlePropertyResult(r, payload, key, input, isOptionalOut);\n }\n }\n if (!catchall) {\n return proms.length ? Promise.all(proms).then(() => payload) : payload;\n }\n return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);\n };\n});\nexport const $ZodObjectJIT = /*@__PURE__*/ core.$constructor(\"$ZodObjectJIT\", (inst, def) => {\n // requires cast because technically $ZodObject doesn't extend\n $ZodObject.init(inst, def);\n const superParse = inst._zod.parse;\n const _normalized = util.cached(() => normalizeDef(def));\n const generateFastpass = (shape) => {\n const doc = new Doc([\"shape\", \"payload\", \"ctx\"]);\n const normalized = _normalized.value;\n const parseStr = (key) => {\n const k = util.esc(key);\n return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;\n };\n doc.write(`const input = payload.value;`);\n const ids = Object.create(null);\n let counter = 0;\n for (const key of normalized.keys) {\n ids[key] = `key_${counter++}`;\n }\n // A: preserve key order {\n doc.write(`const newResult = {};`);\n for (const key of normalized.keys) {\n const id = ids[key];\n const k = util.esc(key);\n const schema = shape[key];\n const isOptionalOut = schema?._zod?.optout === \"optional\";\n doc.write(`const ${id} = ${parseStr(key)};`);\n if (isOptionalOut) {\n // For optional-out schemas, ignore errors on absent keys\n doc.write(`\n if (${id}.issues.length) {\n if (${k} in input) {\n payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n }\n \n if (${id}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${id}.value;\n }\n \n `);\n }\n else {\n doc.write(`\n if (${id}.issues.length) {\n payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n \n if (${id}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${id}.value;\n }\n \n `);\n }\n }\n doc.write(`payload.value = newResult;`);\n doc.write(`return payload;`);\n const fn = doc.compile();\n return (payload, ctx) => fn(shape, payload, ctx);\n };\n let fastpass;\n const isObject = util.isObject;\n const jit = !core.globalConfig.jitless;\n const allowsEval = util.allowsEval;\n const fastEnabled = jit && allowsEval.value; // && !def.catchall;\n const catchall = def.catchall;\n let value;\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n expected: \"object\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {\n // always synchronous\n if (!fastpass)\n fastpass = generateFastpass(def.shape);\n payload = fastpass(payload, ctx);\n if (!catchall)\n return payload;\n return handleCatchall([], input, payload, ctx, value, inst);\n }\n return superParse(payload, ctx);\n };\n});\nfunction handleUnionResults(results, final, inst, ctx) {\n for (const result of results) {\n if (result.issues.length === 0) {\n final.value = result.value;\n return final;\n }\n }\n const nonaborted = results.filter((r) => !util.aborted(r));\n if (nonaborted.length === 1) {\n final.value = nonaborted[0].value;\n return nonaborted[0];\n }\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n });\n return final;\n}\nexport const $ZodUnion = /*@__PURE__*/ core.$constructor(\"$ZodUnion\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"optin\", () => def.options.some((o) => o._zod.optin === \"optional\") ? \"optional\" : undefined);\n util.defineLazy(inst._zod, \"optout\", () => def.options.some((o) => o._zod.optout === \"optional\") ? \"optional\" : undefined);\n util.defineLazy(inst._zod, \"values\", () => {\n if (def.options.every((o) => o._zod.values)) {\n return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));\n }\n return undefined;\n });\n util.defineLazy(inst._zod, \"pattern\", () => {\n if (def.options.every((o) => o._zod.pattern)) {\n const patterns = def.options.map((o) => o._zod.pattern);\n return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join(\"|\")})$`);\n }\n return undefined;\n });\n const single = def.options.length === 1;\n const first = def.options[0]._zod.run;\n inst._zod.parse = (payload, ctx) => {\n if (single) {\n return first(payload, ctx);\n }\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n }\n else {\n if (result.issues.length === 0)\n return result;\n results.push(result);\n }\n }\n if (!async)\n return handleUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results) => {\n return handleUnionResults(results, payload, inst, ctx);\n });\n };\n});\nfunction handleExclusiveUnionResults(results, final, inst, ctx) {\n const successes = results.filter((r) => r.issues.length === 0);\n if (successes.length === 1) {\n final.value = successes[0].value;\n return final;\n }\n if (successes.length === 0) {\n // No matches - same as regular union\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n });\n }\n else {\n // Multiple matches - exclusive union failure\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: [],\n inclusive: false,\n });\n }\n return final;\n}\nexport const $ZodXor = /*@__PURE__*/ core.$constructor(\"$ZodXor\", (inst, def) => {\n $ZodUnion.init(inst, def);\n def.inclusive = false;\n const single = def.options.length === 1;\n const first = def.options[0]._zod.run;\n inst._zod.parse = (payload, ctx) => {\n if (single) {\n return first(payload, ctx);\n }\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n }\n else {\n results.push(result);\n }\n }\n if (!async)\n return handleExclusiveUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results) => {\n return handleExclusiveUnionResults(results, payload, inst, ctx);\n });\n };\n});\nexport const $ZodDiscriminatedUnion = \n/*@__PURE__*/\ncore.$constructor(\"$ZodDiscriminatedUnion\", (inst, def) => {\n def.inclusive = false;\n $ZodUnion.init(inst, def);\n const _super = inst._zod.parse;\n util.defineLazy(inst._zod, \"propValues\", () => {\n const propValues = {};\n for (const option of def.options) {\n const pv = option._zod.propValues;\n if (!pv || Object.keys(pv).length === 0)\n throw new Error(`Invalid discriminated union option at index \"${def.options.indexOf(option)}\"`);\n for (const [k, v] of Object.entries(pv)) {\n if (!propValues[k])\n propValues[k] = new Set();\n for (const val of v) {\n propValues[k].add(val);\n }\n }\n }\n return propValues;\n });\n const disc = util.cached(() => {\n const opts = def.options;\n const map = new Map();\n for (const o of opts) {\n const values = o._zod.propValues?.[def.discriminator];\n if (!values || values.size === 0)\n throw new Error(`Invalid discriminated union option at index \"${def.options.indexOf(o)}\"`);\n for (const v of values) {\n if (map.has(v)) {\n throw new Error(`Duplicate discriminator value \"${String(v)}\"`);\n }\n map.set(v, o);\n }\n }\n return map;\n });\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!util.isObject(input)) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"object\",\n input,\n inst,\n });\n return payload;\n }\n const opt = disc.value.get(input?.[def.discriminator]);\n if (opt) {\n return opt._zod.run(payload, ctx);\n }\n if (def.unionFallback) {\n return _super(payload, ctx);\n }\n // no matching discriminator\n payload.issues.push({\n code: \"invalid_union\",\n errors: [],\n note: \"No matching discriminator\",\n discriminator: def.discriminator,\n input,\n path: [def.discriminator],\n inst,\n });\n return payload;\n };\n});\nexport const $ZodIntersection = /*@__PURE__*/ core.$constructor(\"$ZodIntersection\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n const left = def.left._zod.run({ value: input, issues: [] }, ctx);\n const right = def.right._zod.run({ value: input, issues: [] }, ctx);\n const async = left instanceof Promise || right instanceof Promise;\n if (async) {\n return Promise.all([left, right]).then(([left, right]) => {\n return handleIntersectionResults(payload, left, right);\n });\n }\n return handleIntersectionResults(payload, left, right);\n };\n});\nfunction mergeValues(a, b) {\n // const aType = parse.t(a);\n // const bType = parse.t(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n if (a instanceof Date && b instanceof Date && +a === +b) {\n return { valid: true, data: a };\n }\n if (util.isPlainObject(a) && util.isPlainObject(b)) {\n const bKeys = Object.keys(b);\n const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [key, ...sharedValue.mergeErrorPath],\n };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return { valid: false, mergeErrorPath: [] };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [index, ...sharedValue.mergeErrorPath],\n };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n return { valid: false, mergeErrorPath: [] };\n}\nfunction handleIntersectionResults(result, left, right) {\n // Track which side(s) report each key as unrecognized\n const unrecKeys = new Map();\n let unrecIssue;\n for (const iss of left.issues) {\n if (iss.code === \"unrecognized_keys\") {\n unrecIssue ?? (unrecIssue = iss);\n for (const k of iss.keys) {\n if (!unrecKeys.has(k))\n unrecKeys.set(k, {});\n unrecKeys.get(k).l = true;\n }\n }\n else {\n result.issues.push(iss);\n }\n }\n for (const iss of right.issues) {\n if (iss.code === \"unrecognized_keys\") {\n for (const k of iss.keys) {\n if (!unrecKeys.has(k))\n unrecKeys.set(k, {});\n unrecKeys.get(k).r = true;\n }\n }\n else {\n result.issues.push(iss);\n }\n }\n // Report only keys unrecognized by BOTH sides\n const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);\n if (bothKeys.length && unrecIssue) {\n result.issues.push({ ...unrecIssue, keys: bothKeys });\n }\n if (util.aborted(result))\n return result;\n const merged = mergeValues(left.value, right.value);\n if (!merged.valid) {\n throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);\n }\n result.value = merged.data;\n return result;\n}\nexport const $ZodTuple = /*@__PURE__*/ core.$constructor(\"$ZodTuple\", (inst, def) => {\n $ZodType.init(inst, def);\n const items = def.items;\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n input,\n inst,\n expected: \"tuple\",\n code: \"invalid_type\",\n });\n return payload;\n }\n payload.value = [];\n const proms = [];\n const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== \"optional\");\n const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;\n if (!def.rest) {\n const tooBig = input.length > items.length;\n const tooSmall = input.length < optStart - 1;\n if (tooBig || tooSmall) {\n payload.issues.push({\n ...(tooBig\n ? { code: \"too_big\", maximum: items.length, inclusive: true }\n : { code: \"too_small\", minimum: items.length }),\n input,\n inst,\n origin: \"array\",\n });\n return payload;\n }\n }\n let i = -1;\n for (const item of items) {\n i++;\n if (i >= input.length)\n if (i >= optStart)\n continue;\n const result = item._zod.run({\n value: input[i],\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleTupleResult(result, payload, i)));\n }\n else {\n handleTupleResult(result, payload, i);\n }\n }\n if (def.rest) {\n const rest = input.slice(items.length);\n for (const el of rest) {\n i++;\n const result = def.rest._zod.run({\n value: el,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleTupleResult(result, payload, i)));\n }\n else {\n handleTupleResult(result, payload, i);\n }\n }\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleTupleResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...util.prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nexport const $ZodRecord = /*@__PURE__*/ core.$constructor(\"$ZodRecord\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!util.isPlainObject(input)) {\n payload.issues.push({\n expected: \"record\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n const proms = [];\n const values = def.keyType._zod.values;\n if (values) {\n payload.value = {};\n const recordKeys = new Set();\n for (const key of values) {\n if (typeof key === \"string\" || typeof key === \"number\" || typeof key === \"symbol\") {\n recordKeys.add(typeof key === \"number\" ? key.toString() : key);\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[key] = result.value;\n }));\n }\n else {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[key] = result.value;\n }\n }\n }\n let unrecognized;\n for (const key in input) {\n if (!recordKeys.has(key)) {\n unrecognized = unrecognized ?? [];\n unrecognized.push(key);\n }\n }\n if (unrecognized && unrecognized.length > 0) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n input,\n inst,\n keys: unrecognized,\n });\n }\n }\n else {\n payload.value = {};\n for (const key of Reflect.ownKeys(input)) {\n if (key === \"__proto__\")\n continue;\n let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n if (keyResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n // Numeric string fallback: if key failed with \"expected number\", retry with Number(key)\n const checkNumericKey = typeof key === \"string\" &&\n regexes.number.test(key) &&\n keyResult.issues.length &&\n keyResult.issues.some((iss) => iss.code === \"invalid_type\" && iss.expected === \"number\");\n if (checkNumericKey) {\n const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);\n if (retryResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n if (retryResult.issues.length === 0) {\n keyResult = retryResult;\n }\n }\n if (keyResult.issues.length) {\n if (def.mode === \"loose\") {\n // Pass through unchanged\n payload.value[key] = input[key];\n }\n else {\n // Default \"strict\" behavior: error on invalid key\n payload.issues.push({\n code: \"invalid_key\",\n origin: \"record\",\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n input: key,\n path: [key],\n inst,\n });\n }\n continue;\n }\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[keyResult.value] = result.value;\n }));\n }\n else {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[keyResult.value] = result.value;\n }\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload;\n };\n});\nexport const $ZodMap = /*@__PURE__*/ core.$constructor(\"$ZodMap\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Map)) {\n payload.issues.push({\n expected: \"map\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n const proms = [];\n payload.value = new Map();\n for (const [key, value] of input) {\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);\n if (keyResult instanceof Promise || valueResult instanceof Promise) {\n proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }));\n }\n else {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {\n if (keyResult.issues.length) {\n if (util.propertyKeyTypes.has(typeof key)) {\n final.issues.push(...util.prefixIssues(key, keyResult.issues));\n }\n else {\n final.issues.push({\n code: \"invalid_key\",\n origin: \"map\",\n input,\n inst,\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n });\n }\n }\n if (valueResult.issues.length) {\n if (util.propertyKeyTypes.has(typeof key)) {\n final.issues.push(...util.prefixIssues(key, valueResult.issues));\n }\n else {\n final.issues.push({\n origin: \"map\",\n code: \"invalid_element\",\n input,\n inst,\n key: key,\n issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n });\n }\n }\n final.value.set(keyResult.value, valueResult.value);\n}\nexport const $ZodSet = /*@__PURE__*/ core.$constructor(\"$ZodSet\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Set)) {\n payload.issues.push({\n input,\n inst,\n expected: \"set\",\n code: \"invalid_type\",\n });\n return payload;\n }\n const proms = [];\n payload.value = new Set();\n for (const item of input) {\n const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleSetResult(result, payload)));\n }\n else\n handleSetResult(result, payload);\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleSetResult(result, final) {\n if (result.issues.length) {\n final.issues.push(...result.issues);\n }\n final.value.add(result.value);\n}\nexport const $ZodEnum = /*@__PURE__*/ core.$constructor(\"$ZodEnum\", (inst, def) => {\n $ZodType.init(inst, def);\n const values = util.getEnumValues(def.entries);\n const valuesSet = new Set(values);\n inst._zod.values = valuesSet;\n inst._zod.pattern = new RegExp(`^(${values\n .filter((k) => util.propertyKeyTypes.has(typeof k))\n .map((o) => (typeof o === \"string\" ? util.escapeRegex(o) : o.toString()))\n .join(\"|\")})$`);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (valuesSet.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: \"invalid_value\",\n values,\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodLiteral = /*@__PURE__*/ core.$constructor(\"$ZodLiteral\", (inst, def) => {\n $ZodType.init(inst, def);\n if (def.values.length === 0) {\n throw new Error(\"Cannot create literal schema with no valid values\");\n }\n const values = new Set(def.values);\n inst._zod.values = values;\n inst._zod.pattern = new RegExp(`^(${def.values\n .map((o) => (typeof o === \"string\" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))\n .join(\"|\")})$`);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (values.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: \"invalid_value\",\n values: def.values,\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodFile = /*@__PURE__*/ core.$constructor(\"$ZodFile\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n // @ts-ignore\n if (input instanceof File)\n return payload;\n payload.issues.push({\n expected: \"file\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodTransform = /*@__PURE__*/ core.$constructor(\"$ZodTransform\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(inst.constructor.name);\n }\n const _out = def.transform(payload.value, payload);\n if (ctx.async) {\n const output = _out instanceof Promise ? _out : Promise.resolve(_out);\n return output.then((output) => {\n payload.value = output;\n return payload;\n });\n }\n if (_out instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n payload.value = _out;\n return payload;\n };\n});\nfunction handleOptionalResult(result, input) {\n if (result.issues.length && input === undefined) {\n return { issues: [], value: undefined };\n }\n return result;\n}\nexport const $ZodOptional = /*@__PURE__*/ core.$constructor(\"$ZodOptional\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n inst._zod.optout = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => {\n return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;\n });\n util.defineLazy(inst._zod, \"pattern\", () => {\n const pattern = def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n if (def.innerType._zod.optin === \"optional\") {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise)\n return result.then((r) => handleOptionalResult(r, payload.value));\n return handleOptionalResult(result, payload.value);\n }\n if (payload.value === undefined) {\n return payload;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodExactOptional = /*@__PURE__*/ core.$constructor(\"$ZodExactOptional\", (inst, def) => {\n // Call parent init - inherits optin/optout = \"optional\"\n $ZodOptional.init(inst, def);\n // Override values/pattern to NOT add undefined\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n util.defineLazy(inst._zod, \"pattern\", () => def.innerType._zod.pattern);\n // Override parse to just delegate (no undefined handling)\n inst._zod.parse = (payload, ctx) => {\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodNullable = /*@__PURE__*/ core.$constructor(\"$ZodNullable\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"optin\", () => def.innerType._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.innerType._zod.optout);\n util.defineLazy(inst._zod, \"pattern\", () => {\n const pattern = def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;\n });\n util.defineLazy(inst._zod, \"values\", () => {\n return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n // Forward direction (decode): allow null to pass through\n if (payload.value === null)\n return payload;\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodDefault = /*@__PURE__*/ core.$constructor(\"$ZodDefault\", (inst, def) => {\n $ZodType.init(inst, def);\n // inst._zod.qin = \"true\";\n inst._zod.optin = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply defaults for undefined input\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n /**\n * $ZodDefault returns the default value immediately in forward direction.\n * It doesn't pass the default value into the validator (\"prefault\"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a \"prefault\" for the pipe. */\n return payload;\n }\n // Forward direction: continue with default handling\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleDefaultResult(result, def));\n }\n return handleDefaultResult(result, def);\n };\n});\nfunction handleDefaultResult(payload, def) {\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return payload;\n}\nexport const $ZodPrefault = /*@__PURE__*/ core.$constructor(\"$ZodPrefault\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply prefault for undefined input\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodNonOptional = /*@__PURE__*/ core.$constructor(\"$ZodNonOptional\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => {\n const v = def.innerType._zod.values;\n return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleNonOptionalResult(result, inst));\n }\n return handleNonOptionalResult(result, inst);\n };\n});\nfunction handleNonOptionalResult(payload, inst) {\n if (!payload.issues.length && payload.value === undefined) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: payload.value,\n inst,\n });\n }\n return payload;\n}\nexport const $ZodSuccess = /*@__PURE__*/ core.$constructor(\"$ZodSuccess\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(\"ZodSuccess\");\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => {\n payload.value = result.issues.length === 0;\n return payload;\n });\n }\n payload.value = result.issues.length === 0;\n return payload;\n };\n});\nexport const $ZodCatch = /*@__PURE__*/ core.$constructor(\"$ZodCatch\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"optin\", () => def.innerType._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.innerType._zod.optout);\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply catch logic\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => {\n payload.value = result.value;\n if (result.issues.length) {\n payload.value = def.catchValue({\n ...payload,\n error: {\n issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n },\n input: payload.value,\n });\n payload.issues = [];\n }\n return payload;\n });\n }\n payload.value = result.value;\n if (result.issues.length) {\n payload.value = def.catchValue({\n ...payload,\n error: {\n issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n },\n input: payload.value,\n });\n payload.issues = [];\n }\n return payload;\n };\n});\nexport const $ZodNaN = /*@__PURE__*/ core.$constructor(\"$ZodNaN\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"number\" || !Number.isNaN(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: \"nan\",\n code: \"invalid_type\",\n });\n return payload;\n }\n return payload;\n };\n});\nexport const $ZodPipe = /*@__PURE__*/ core.$constructor(\"$ZodPipe\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => def.in._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.in._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.out._zod.optout);\n util.defineLazy(inst._zod, \"propValues\", () => def.in._zod.propValues);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n const right = def.out._zod.run(payload, ctx);\n if (right instanceof Promise) {\n return right.then((right) => handlePipeResult(right, def.in, ctx));\n }\n return handlePipeResult(right, def.in, ctx);\n }\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left) => handlePipeResult(left, def.out, ctx));\n }\n return handlePipeResult(left, def.out, ctx);\n };\n});\nfunction handlePipeResult(left, next, ctx) {\n if (left.issues.length) {\n // prevent further checks\n left.aborted = true;\n return left;\n }\n return next._zod.run({ value: left.value, issues: left.issues }, ctx);\n}\nexport const $ZodCodec = /*@__PURE__*/ core.$constructor(\"$ZodCodec\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => def.in._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.in._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.out._zod.optout);\n util.defineLazy(inst._zod, \"propValues\", () => def.in._zod.propValues);\n inst._zod.parse = (payload, ctx) => {\n const direction = ctx.direction || \"forward\";\n if (direction === \"forward\") {\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left) => handleCodecAResult(left, def, ctx));\n }\n return handleCodecAResult(left, def, ctx);\n }\n else {\n const right = def.out._zod.run(payload, ctx);\n if (right instanceof Promise) {\n return right.then((right) => handleCodecAResult(right, def, ctx));\n }\n return handleCodecAResult(right, def, ctx);\n }\n };\n});\nfunction handleCodecAResult(result, def, ctx) {\n if (result.issues.length) {\n // prevent further checks\n result.aborted = true;\n return result;\n }\n const direction = ctx.direction || \"forward\";\n if (direction === \"forward\") {\n const transformed = def.transform(result.value, result);\n if (transformed instanceof Promise) {\n return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));\n }\n return handleCodecTxResult(result, transformed, def.out, ctx);\n }\n else {\n const transformed = def.reverseTransform(result.value, result);\n if (transformed instanceof Promise) {\n return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));\n }\n return handleCodecTxResult(result, transformed, def.in, ctx);\n }\n}\nfunction handleCodecTxResult(left, value, nextSchema, ctx) {\n // Check if transform added any issues\n if (left.issues.length) {\n left.aborted = true;\n return left;\n }\n return nextSchema._zod.run({ value, issues: left.issues }, ctx);\n}\nexport const $ZodReadonly = /*@__PURE__*/ core.$constructor(\"$ZodReadonly\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"propValues\", () => def.innerType._zod.propValues);\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.innerType?._zod?.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.innerType?._zod?.optout);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then(handleReadonlyResult);\n }\n return handleReadonlyResult(result);\n };\n});\nfunction handleReadonlyResult(payload) {\n payload.value = Object.freeze(payload.value);\n return payload;\n}\nexport const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor(\"$ZodTemplateLiteral\", (inst, def) => {\n $ZodType.init(inst, def);\n const regexParts = [];\n for (const part of def.parts) {\n if (typeof part === \"object\" && part !== null) {\n // is Zod schema\n if (!part._zod.pattern) {\n // if (!source)\n throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);\n }\n const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;\n if (!source)\n throw new Error(`Invalid template literal part: ${part._zod.traits}`);\n const start = source.startsWith(\"^\") ? 1 : 0;\n const end = source.endsWith(\"$\") ? source.length - 1 : source.length;\n regexParts.push(source.slice(start, end));\n }\n else if (part === null || util.primitiveTypes.has(typeof part)) {\n regexParts.push(util.escapeRegex(`${part}`));\n }\n else {\n throw new Error(`Invalid template literal part: ${part}`);\n }\n }\n inst._zod.pattern = new RegExp(`^${regexParts.join(\"\")}$`);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"string\") {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: \"string\",\n code: \"invalid_type\",\n });\n return payload;\n }\n inst._zod.pattern.lastIndex = 0;\n if (!inst._zod.pattern.test(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n code: \"invalid_format\",\n format: def.format ?? \"template_literal\",\n pattern: inst._zod.pattern.source,\n });\n return payload;\n }\n return payload;\n };\n});\nexport const $ZodFunction = /*@__PURE__*/ core.$constructor(\"$ZodFunction\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._def = def;\n inst._zod.def = def;\n inst.implement = (func) => {\n if (typeof func !== \"function\") {\n throw new Error(\"implement() must be called with a function\");\n }\n return function (...args) {\n const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;\n const result = Reflect.apply(func, this, parsedArgs);\n if (inst._def.output) {\n return parse(inst._def.output, result);\n }\n return result;\n };\n };\n inst.implementAsync = (func) => {\n if (typeof func !== \"function\") {\n throw new Error(\"implementAsync() must be called with a function\");\n }\n return async function (...args) {\n const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;\n const result = await Reflect.apply(func, this, parsedArgs);\n if (inst._def.output) {\n return await parseAsync(inst._def.output, result);\n }\n return result;\n };\n };\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"function\") {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"function\",\n input: payload.value,\n inst,\n });\n return payload;\n }\n // Check if output is a promise type to determine if we should use async implementation\n const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === \"promise\";\n if (hasPromiseOutput) {\n payload.value = inst.implementAsync(payload.value);\n }\n else {\n payload.value = inst.implement(payload.value);\n }\n return payload;\n };\n inst.input = (...args) => {\n const F = inst.constructor;\n if (Array.isArray(args[0])) {\n return new F({\n type: \"function\",\n input: new $ZodTuple({\n type: \"tuple\",\n items: args[0],\n rest: args[1],\n }),\n output: inst._def.output,\n });\n }\n return new F({\n type: \"function\",\n input: args[0],\n output: inst._def.output,\n });\n };\n inst.output = (output) => {\n const F = inst.constructor;\n return new F({\n type: \"function\",\n input: inst._def.input,\n output,\n });\n };\n return inst;\n});\nexport const $ZodPromise = /*@__PURE__*/ core.$constructor(\"$ZodPromise\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));\n };\n});\nexport const $ZodLazy = /*@__PURE__*/ core.$constructor(\"$ZodLazy\", (inst, def) => {\n $ZodType.init(inst, def);\n // let _innerType!: any;\n // util.defineLazy(def, \"getter\", () => {\n // if (!_innerType) {\n // _innerType = def.getter();\n // }\n // return () => _innerType;\n // });\n util.defineLazy(inst._zod, \"innerType\", () => def.getter());\n util.defineLazy(inst._zod, \"pattern\", () => inst._zod.innerType?._zod?.pattern);\n util.defineLazy(inst._zod, \"propValues\", () => inst._zod.innerType?._zod?.propValues);\n util.defineLazy(inst._zod, \"optin\", () => inst._zod.innerType?._zod?.optin ?? undefined);\n util.defineLazy(inst._zod, \"optout\", () => inst._zod.innerType?._zod?.optout ?? undefined);\n inst._zod.parse = (payload, ctx) => {\n const inner = inst._zod.innerType;\n return inner._zod.run(payload, ctx);\n };\n});\nexport const $ZodCustom = /*@__PURE__*/ core.$constructor(\"$ZodCustom\", (inst, def) => {\n checks.$ZodCheck.init(inst, def);\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _) => {\n return payload;\n };\n inst._zod.check = (payload) => {\n const input = payload.value;\n const r = def.fn(input);\n if (r instanceof Promise) {\n return r.then((r) => handleRefineResult(r, payload, input, inst));\n }\n handleRefineResult(r, payload, input, inst);\n return;\n };\n});\nfunction handleRefineResult(result, payload, input, inst) {\n if (!result) {\n const _iss = {\n code: \"custom\",\n input,\n inst, // incorporates params.error into issue reporting\n path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting\n continue: !inst._zod.def.abort,\n // params: inst._zod.def.params,\n };\n if (inst._zod.def.params)\n _iss.params = inst._zod.def.params;\n payload.issues.push(util.issue(_iss));\n }\n}\n"],"names":["core.$constructor","checks","util.aborted","core.$ZodAsyncError","checkResult","canary","result","util.defineLazy"],"mappings":"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","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es119.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/outputs.js"],"sourcesContent":["import { __export } from \"./_virtual/rolldown_runtime.js\";\n\n//#region src/outputs.ts\nvar outputs_exports = {};\n__export(outputs_exports, {\n\tChatGenerationChunk: () => ChatGenerationChunk,\n\tGenerationChunk: () => GenerationChunk,\n\tRUN_KEY: () => RUN_KEY\n});\nconst RUN_KEY = \"__run\";\n/**\n* Chunk of a single generation. Used for streaming.\n*/\nvar GenerationChunk = class GenerationChunk {\n\ttext;\n\tgenerationInfo;\n\tconstructor(fields) {\n\t\tthis.text = fields.text;\n\t\tthis.generationInfo = fields.generationInfo;\n\t}\n\tconcat(chunk) {\n\t\treturn new GenerationChunk({\n\t\t\ttext: this.text + chunk.text,\n\t\t\tgenerationInfo: {\n\t\t\t\t...this.generationInfo,\n\t\t\t\t...chunk.generationInfo\n\t\t\t}\n\t\t});\n\t}\n};\nvar ChatGenerationChunk = class ChatGenerationChunk extends GenerationChunk {\n\tmessage;\n\tconstructor(fields) {\n\t\tsuper(fields);\n\t\tthis.message = fields.message;\n\t}\n\tconcat(chunk) {\n\t\treturn new ChatGenerationChunk({\n\t\t\ttext: this.text + chunk.text,\n\t\t\tgenerationInfo: {\n\t\t\t\t...this.generationInfo,\n\t\t\t\t...chunk.generationInfo\n\t\t\t},\n\t\t\tmessage: this.message.concat(chunk.message)\n\t\t});\n\t}\n};\n\n//#endregion\nexport { ChatGenerationChunk, GenerationChunk, RUN_KEY, outputs_exports };\n//# sourceMappingURL=outputs.js.map"],"names":["GenerationChunk","ChatGenerationChunk"],"mappings":";AAGG,IAAC,kBAAkB,CAAA;AACtB,SAAS,iBAAiB;AAAA,EACzB,qBAAqB,MAAM;AAAA,EAC3B,iBAAiB,MAAM;AAAA,EACvB,SAAS,MAAM;AAChB,CAAC;AACI,MAAC,UAAU;AAIb,IAAC,kBAAkB,MAAMA,iBAAgB;AAAA,EAC3C;AAAA,EACA;AAAA,EACA,YAAY,QAAQ;AACnB,SAAK,OAAO,OAAO;AACnB,SAAK,iBAAiB,OAAO;AAAA,EAC9B;AAAA,EACA,OAAO,OAAO;AACb,WAAO,IAAIA,iBAAgB;AAAA,MAC1B,MAAM,KAAK,OAAO,MAAM;AAAA,MACxB,gBAAgB;AAAA,QACf,GAAG,KAAK;AAAA,QACR,GAAG,MAAM;AAAA,MACb;AAAA,IACA,CAAG;AAAA,EACF;AACD;AACG,IAAC,sBAAsB,MAAMC,6BAA4B,gBAAgB;AAAA,EAC3E;AAAA,EACA,YAAY,QAAQ;AACnB,UAAM,MAAM;AACZ,SAAK,UAAU,OAAO;AAAA,EACvB;AAAA,EACA,OAAO,OAAO;AACb,WAAO,IAAIA,qBAAoB;AAAA,MAC9B,MAAM,KAAK,OAAO,MAAM;AAAA,MACxB,gBAAgB;AAAA,QACf,GAAG,KAAK;AAAA,QACR,GAAG,MAAM;AAAA,MACb;AAAA,MACG,SAAS,KAAK,QAAQ,OAAO,MAAM,OAAO;AAAA,IAC7C,CAAG;AAAA,EACF;AACD;","x_google_ignoreList":[0]}
@@ -1,111 +1,21 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useStreamContext } from "./index.es6.js";
3
- import { isToolMessage, isAiWithToolCalls } from "./index.es19.js";
4
- import React__default, { useMemo, useRef, useEffect, useCallback } from "react";
5
- import Thinking from "./index.es20.js";
6
- import AgentMessage from "./index.es21.js";
7
- import CustomComponentRender from "./index.es22.js";
8
- import HumanMessage from "./index.es23.js";
9
- function ChatBody({ setIsFirstMessage, enableToolCallIndicator }) {
10
- const stream = useStreamContext();
11
- const messages = stream.messages;
12
- const isLoading = stream.isLoading;
13
- const memoMessages = useMemo(() => messages ?? [], [messages]);
14
- const messagesRef = useRef(null);
15
- const prevMessageCountRef = useRef(0);
16
- useEffect(() => {
17
- if (memoMessages.length > 0 && setIsFirstMessage) {
18
- setIsFirstMessage(false);
19
- }
20
- }, [memoMessages.length, setIsFirstMessage]);
21
- const renderMessage = useCallback((msg, index, messagesArray) => {
22
- if (!msg.content.length) return null;
23
- if (msg.additional_kwargs?.hidden) {
24
- return null;
25
- }
26
- const isLastMessage = index === messagesArray.length - 1;
27
- const isStreamingThisMessage = isLoading && isLastMessage && msg.type === "ai";
28
- const msgKey = msg.id ?? `msg-${index}`;
29
- if (msg.type === "human") {
30
- return /* @__PURE__ */ jsx(HumanMessage, { message: msg }, msgKey);
31
- }
32
- if (isToolMessage(msg)) {
33
- return null;
34
- }
35
- if (isAiWithToolCalls(msg)) {
36
- const toolMessages = [];
37
- let nextIndex = index + 1;
38
- while (nextIndex < messagesArray.length && isToolMessage(messagesArray[nextIndex])) {
39
- toolMessages.push(messagesArray[nextIndex]);
40
- nextIndex++;
41
- }
42
- const hasTextContent = typeof msg.content === "string" && msg.content.trim() || Array.isArray(msg.content) && msg.content.some((c) => c.type === "text" && c.text?.trim());
43
- return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
44
- toolMessages.length > 0 && enableToolCallIndicator && /* @__PURE__ */ jsx(
45
- Thinking,
46
- {
47
- title: "Agent Thinking",
48
- toolMessages
49
- }
50
- ),
51
- hasTextContent && /* @__PURE__ */ jsx(
52
- AgentMessage,
53
- {
54
- message: msg,
55
- isStreaming: isStreamingThisMessage
56
- }
57
- ),
58
- /* @__PURE__ */ jsx(CustomComponentRender, { message: msg, thread: stream })
59
- ] }, msgKey);
60
- }
61
- return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
62
- /* @__PURE__ */ jsx(
63
- AgentMessage,
64
- {
65
- message: msg,
66
- isStreaming: isStreamingThisMessage
67
- }
68
- ),
69
- /* @__PURE__ */ jsx(CustomComponentRender, { message: msg, thread: stream })
70
- ] }, msgKey);
71
- }, [isLoading, stream]);
72
- const renderedMessages = useMemo(() => {
73
- return memoMessages.map((msg, index) => {
74
- const element = renderMessage(msg, index, memoMessages);
75
- if (element && !element.key) {
76
- return React__default.cloneElement(element, { key: msg.id ?? `msg-${index}` });
77
- }
78
- return element;
79
- });
80
- }, [memoMessages, renderMessage]);
81
- useEffect(() => {
82
- const currentCount = memoMessages.length;
83
- const hasNewMessage = currentCount > prevMessageCountRef.current;
84
- if (messagesRef.current && (hasNewMessage || isLoading)) {
85
- const { scrollTop, scrollHeight, clientHeight } = messagesRef.current;
86
- const isNearBottom = scrollHeight - scrollTop - clientHeight < 100;
87
- if (isNearBottom || hasNewMessage) {
88
- messagesRef.current.scrollTop = messagesRef.current.scrollHeight;
89
- }
90
- }
91
- prevMessageCountRef.current = currentCount;
92
- }, [memoMessages, isLoading]);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { MessageSquareMoreIcon } from "lucide-react";
3
+ function ChatButton({
4
+ isVisible,
5
+ setOpen
6
+ }) {
7
+ if (!isVisible) return null;
93
8
  return /* @__PURE__ */ jsx(
94
- "div",
9
+ "button",
95
10
  {
96
- ref: messagesRef,
97
- className: "flex flex-col gap-4 rounded-4xl p-2",
98
- children: memoMessages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full text-zinc-500", children: "Start a conversation..." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
99
- renderedMessages,
100
- isLoading && memoMessages.length > 0 && memoMessages[memoMessages.length - 1].type === "human" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
101
- "Thinking",
102
- /* @__PURE__ */ jsx("span", { className: "animate-pulse", children: "..." })
103
- ] })
104
- ] })
11
+ onClick: () => setOpen(true),
12
+ "aria-label": "Open chat",
13
+ className: "fixed bottom-5 right-5 w-14 h-14 rounded-full bg-black text-white border-0 cursor-pointer flex items-center justify-center z-[60]",
14
+ children: /* @__PURE__ */ jsx(MessageSquareMoreIcon, { width: 24, height: 28 })
105
15
  }
106
16
  );
107
17
  }
108
18
  export {
109
- ChatBody as default
19
+ ChatButton as default
110
20
  };
111
21
  //# sourceMappingURL=index.es12.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es12.js","sources":["../src/components/ChatBody.tsx"],"sourcesContent":["import { useStreamContext } from \"@/providers/Stream\";\nimport { isAiWithToolCalls, isToolMessage } from \"@/utils/utils\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport Thinking from \"./Thinking\";\nimport AgentMessage from \"./messages/AgentMessage\";\nimport CustomComponentRender from \"./messages/CustomComponentRender\";\nimport HumanMessage from \"./messages/HumanMessage\";\nimport { logger } from \"@/utils/logger\";\n\nexport default function ChatBody({ setIsFirstMessage, enableToolCallIndicator }: { setIsFirstMessage?: React.Dispatch<React.SetStateAction<boolean>>, enableToolCallIndicator?: boolean }) {\n const stream = useStreamContext();\n const messages = stream.messages;\n const isLoading = stream.isLoading;\n\n logger.debug(\"ChatBody render - messages count:\", messages, \"isLoading:\", isLoading);\n\n // Memoize messages with stable reference\n const memoMessages = useMemo(() => messages ?? [], [messages]);\n\n const messagesRef = useRef<HTMLDivElement | null>(null);\n const prevMessageCountRef = useRef(0);\n\n // Set isFirstMessage to false when there are messages\n useEffect(() => {\n if (memoMessages.length > 0 && setIsFirstMessage) {\n setIsFirstMessage(false);\n }\n }, [memoMessages.length, setIsFirstMessage]);\n\n // Memoize message rendering logic to prevent unnecessary re-renders\n const renderMessage = useCallback((msg: typeof messages[0], index: number, messagesArray: typeof messages) => {\n if (!msg.content.length) return null;\n\n if (msg.additional_kwargs?.hidden) {\n return null;\n }\n\n const isLastMessage = index === messagesArray.length - 1;\n const isStreamingThisMessage =\n isLoading && isLastMessage && msg.type === \"ai\";\n \n // Use message id or fallback to index for key\n const msgKey = msg.id ?? `msg-${index}`;\n\n if (msg.type === \"human\") {\n return <HumanMessage key={msgKey} message={msg} />;\n }\n\n // Skip standalone tool messages\n if (isToolMessage(msg)) {\n return null;\n }\n\n // Group AI message with tool calls and subsequent tool messages\n if (isAiWithToolCalls(msg)) {\n const toolMessages = [];\n let nextIndex = index + 1;\n while (\n nextIndex < messagesArray.length &&\n isToolMessage(messagesArray[nextIndex])\n ) {\n toolMessages.push(messagesArray[nextIndex]);\n nextIndex++;\n }\n\n // Check if there's text content to display\n // Handle both string and array content formats\n const hasTextContent = \n (typeof msg.content === \"string\" && msg.content.trim()) ||\n (Array.isArray(msg.content) && msg.content.some((c: any) => c.type === \"text\" && c.text?.trim()));\n\n return (\n <React.Fragment key={msgKey}>\n {/* 1. Thinking indicator - only show if tool messages exist */}\n {toolMessages.length > 0 && enableToolCallIndicator && (\n <Thinking\n title=\"Agent Thinking\"\n toolMessages={toolMessages}\n />\n )}\n {/* 2. Agent message (if has text) */}\n {hasTextContent && (\n <AgentMessage\n message={msg}\n isStreaming={isStreamingThisMessage}\n />\n )}\n {/* 3. Custom component */}\n <CustomComponentRender message={msg} thread={stream} />\n </React.Fragment>\n );\n }\n\n return (\n <React.Fragment key={msgKey}>\n <AgentMessage\n message={msg}\n isStreaming={isStreamingThisMessage}\n />\n <CustomComponentRender message={msg} thread={stream} />\n </React.Fragment>\n );\n }, [isLoading, stream]);\n\n // Memoize the rendered messages array\n const renderedMessages = useMemo(() => {\n return memoMessages.map((msg, index) => {\n const element = renderMessage(msg, index, memoMessages);\n // Ensure every element has a key, using message id or fallback to index\n if (element && !element.key) {\n return React.cloneElement(element, { key: msg.id ?? `msg-${index}` });\n }\n return element;\n });\n }, [memoMessages, renderMessage]);\n\n // Auto-scroll only when new messages are added or content updates\n useEffect(() => {\n const currentCount = memoMessages.length;\n const hasNewMessage = currentCount > prevMessageCountRef.current;\n\n if (messagesRef.current && (hasNewMessage || isLoading)) {\n const { scrollTop, scrollHeight, clientHeight } = messagesRef.current;\n const isNearBottom = scrollHeight - scrollTop - clientHeight < 100;\n\n // Only auto-scroll if user is near bottom\n if (isNearBottom || hasNewMessage) {\n messagesRef.current.scrollTop = messagesRef.current.scrollHeight;\n }\n }\n\n prevMessageCountRef.current = currentCount;\n }, [memoMessages, isLoading]);\n\n return (\n <div\n ref={messagesRef}\n className=\"flex flex-col gap-4 rounded-4xl p-2\"\n >\n {memoMessages.length === 0 ? (\n <div className=\"flex items-center justify-center h-full text-zinc-500\">\n Start a conversation...\n </div>\n ) : (\n <>\n {renderedMessages}\n {/* Show thinking indicator when loading but no AI response yet */}\n {isLoading && memoMessages.length > 0 && memoMessages[memoMessages.length - 1].type === \"human\" && (\n <div className=\"flex items-center gap-2\">\n {/* <div className=\"animate rounded-full h-6 w-6 border-b-2 border-zinc-400\"></div> */}\n Thinking<span className=\"animate-pulse\">...</span>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n"],"names":["React"],"mappings":"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"}
1
+ {"version":3,"file":"index.es12.js","sources":["../src/components/ChatButton.tsx"],"sourcesContent":["import { MessageSquareMoreIcon } from \"lucide-react\";\n\nexport default function ChatButton({\n isVisible,\n setOpen,\n}: {\n isVisible: boolean;\n setOpen: (value: boolean) => void;\n}) {\n if (!isVisible) return null;\n return (\n <button\n onClick={() => setOpen(true)}\n aria-label=\"Open chat\"\n className=\"fixed bottom-5 right-5 w-14 h-14 rounded-full bg-black text-white border-0 cursor-pointer flex items-center justify-center z-[60]\"\n >\n <MessageSquareMoreIcon width={24} height={28} />\n </button>\n );\n}\n"],"names":[],"mappings":";;AAEA,SAAwB,WAAW;AAAA,EACjC;AAAA,EACA;AACF,GAGG;AACD,MAAI,CAAC,UAAW,QAAO;AACvB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,MAAM,QAAQ,IAAI;AAAA,MAC3B,cAAW;AAAA,MACX,WAAU;AAAA,MAEV,UAAA,oBAAC,uBAAA,EAAsB,OAAO,IAAI,QAAQ,GAAA,CAAI;AAAA,IAAA;AAAA,EAAA;AAGpD;"}
@@ -1,52 +1,25 @@
1
- var _a;
2
- class $ZodRegistry {
3
- constructor() {
4
- this._map = /* @__PURE__ */ new WeakMap();
5
- this._idmap = /* @__PURE__ */ new Map();
6
- }
7
- add(schema, ..._meta) {
8
- const meta = _meta[0];
9
- this._map.set(schema, meta);
10
- if (meta && typeof meta === "object" && "id" in meta) {
11
- this._idmap.set(meta.id, schema);
12
- }
13
- return this;
14
- }
15
- clear() {
16
- this._map = /* @__PURE__ */ new WeakMap();
17
- this._idmap = /* @__PURE__ */ new Map();
18
- return this;
19
- }
20
- remove(schema) {
21
- const meta = this._map.get(schema);
22
- if (meta && typeof meta === "object" && "id" in meta) {
23
- this._idmap.delete(meta.id);
24
- }
25
- this._map.delete(schema);
26
- return this;
27
- }
28
- get(schema) {
29
- const p = schema._zod.parent;
30
- if (p) {
31
- const pm = { ...this.get(p) ?? {} };
32
- delete pm.id;
33
- const f = { ...pm, ...this._map.get(schema) };
34
- return Object.keys(f).length ? f : void 0;
35
- }
36
- return this._map.get(schema);
37
- }
38
- has(schema) {
39
- return this._map.has(schema);
40
- }
1
+ const objectToString = Object.prototype.toString;
2
+ const isError = (value) => objectToString.call(value) === "[object Error]";
3
+ const errorMessages = /* @__PURE__ */ new Set([
4
+ "network error",
5
+ "Failed to fetch",
6
+ "NetworkError when attempting to fetch resource.",
7
+ "The Internet connection appears to be offline.",
8
+ "Network request failed",
9
+ "fetch failed",
10
+ "terminated",
11
+ " A network error occurred.",
12
+ "Network connection lost"
13
+ ]);
14
+ function isNetworkError(error) {
15
+ const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
16
+ if (!isValid) return false;
17
+ const { message, stack } = error;
18
+ if (message === "Load failed") return stack === void 0 || "__sentry_captured__" in error;
19
+ if (message.startsWith("error sending request for url")) return true;
20
+ return errorMessages.has(message);
41
21
  }
42
- function registry() {
43
- return new $ZodRegistry();
44
- }
45
- (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
46
- const globalRegistry = globalThis.__zod_globalRegistry;
47
22
  export {
48
- $ZodRegistry,
49
- globalRegistry,
50
- registry
23
+ isNetworkError
51
24
  };
52
25
  //# sourceMappingURL=index.es120.js.map