@farm.js/core 0.1.34 → 0.1.36

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 (282) hide show
  1. package/dist/agent-mcp-BVExL8rZ.d.mts +109 -0
  2. package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
  3. package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
  4. package/dist/agent-mcp-luzfXK-P.d.ts +109 -0
  5. package/dist/agent-runtime.cjs +5 -3
  6. package/dist/agent-runtime.d.mts +4 -5
  7. package/dist/agent-runtime.d.ts +4 -5
  8. package/dist/agent-runtime.mjs +4 -2
  9. package/dist/api/route-manager.cjs +7 -7
  10. package/dist/api/route-manager.d.mts +15 -10
  11. package/dist/api/route-manager.d.ts +15 -10
  12. package/dist/api/route-manager.mjs +6 -6
  13. package/dist/api/runtime.cjs +7 -5
  14. package/dist/api/runtime.d.mts +7 -66
  15. package/dist/api/runtime.d.ts +7 -66
  16. package/dist/api/runtime.mjs +7 -5
  17. package/dist/api.cjs +9 -9
  18. package/dist/api.d.mts +8 -9
  19. package/dist/api.d.ts +8 -9
  20. package/dist/api.mjs +8 -8
  21. package/dist/{app-q4rmZlXK.d.mts → app-BukwkFIu.d.mts} +52 -12
  22. package/dist/{app-DgotYGbq.d.ts → app-Yfa2dsFy.d.ts} +52 -12
  23. package/dist/app-markdown.cjs +6 -6
  24. package/dist/app-markdown.d.mts +5 -6
  25. package/dist/app-markdown.d.ts +5 -6
  26. package/dist/app-markdown.mjs +5 -5
  27. package/dist/{chunk-XV5DJTBX.mjs → chunk-276VJSM6.mjs} +627 -260
  28. package/dist/{chunk-36MK5YCW.cjs → chunk-2YTDKNH3.cjs} +547 -240
  29. package/dist/{chunk-VHANUNEG.mjs → chunk-35GKZR22.mjs} +2 -2
  30. package/dist/{chunk-LR5QSC2P.mjs → chunk-35WV46VL.mjs} +399 -92
  31. package/dist/{chunk-UX5S4JEO.cjs → chunk-42NHY7HW.cjs} +57 -7
  32. package/dist/{chunk-U4PTAHW3.mjs → chunk-4E5AEDKY.mjs} +7 -11
  33. package/dist/{chunk-NGVORZVZ.mjs → chunk-4E5WBPEG.mjs} +73 -351
  34. package/dist/{chunk-AQZFOP7S.mjs → chunk-4GLOOWKE.mjs} +5 -5
  35. package/dist/{chunk-7BT4H4P7.cjs → chunk-4NU4GGTC.cjs} +2 -2
  36. package/dist/{chunk-AGC75XAE.mjs → chunk-4WCZJQUO.mjs} +55 -5
  37. package/dist/chunk-4WQ6PGSJ.cjs +367 -0
  38. package/dist/{chunk-QCFFHV5H.mjs → chunk-4WVJLURN.mjs} +1 -1
  39. package/dist/chunk-6SJ2KJTA.mjs +314 -0
  40. package/dist/chunk-75RZHGLS.cjs +135 -0
  41. package/dist/{chunk-P64MIF5B.cjs → chunk-ADEA7PN3.cjs} +483 -60
  42. package/dist/{chunk-YQVSHTMR.mjs → chunk-AJQTP4OO.mjs} +1 -1
  43. package/dist/{chunk-TA5G2HWD.cjs → chunk-AO6RYU5N.cjs} +31 -28
  44. package/dist/{chunk-MOKLYNHV.cjs → chunk-BO36SELV.cjs} +6 -6
  45. package/dist/{chunk-7Y6ZNFPX.mjs → chunk-BPOF5U4N.mjs} +17 -7
  46. package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
  47. package/dist/{chunk-TDFPACVX.cjs → chunk-CBJJH36A.cjs} +50 -25
  48. package/dist/{chunk-VKNHTSAP.cjs → chunk-CGBDNNSM.cjs} +2 -2
  49. package/dist/chunk-CI6E3UOH.cjs +314 -0
  50. package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
  51. package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
  52. package/dist/{chunk-QGYRXFU2.cjs → chunk-D2BB47NB.cjs} +8 -8
  53. package/dist/chunk-DTSROJ5J.mjs +367 -0
  54. package/dist/{chunk-ODBZYBAB.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
  55. package/dist/{chunk-ROUTX2E5.cjs → chunk-ECKF2BAM.cjs} +18 -5
  56. package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
  57. package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
  58. package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
  59. package/dist/{chunk-HR5KPHC2.mjs → chunk-EWET4D2Y.mjs} +1 -1
  60. package/dist/{chunk-PXKIEXZD.mjs → chunk-F5QO4FNE.mjs} +1 -1
  61. package/dist/{chunk-MIDIZJZC.cjs → chunk-FO427P6I.cjs} +22 -12
  62. package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
  63. package/dist/{chunk-JDPAKVS4.mjs → chunk-GQRWBCWK.mjs} +8 -5
  64. package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
  65. package/dist/{chunk-WNNYOOIB.mjs → chunk-HOXTWRGB.mjs} +1 -1
  66. package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
  67. package/dist/{chunk-QJ3J6MZT.cjs → chunk-JNUWCDTF.cjs} +8 -8
  68. package/dist/{chunk-BTAG7LI7.cjs → chunk-JZVADIOD.cjs} +2 -2
  69. package/dist/{chunk-EM6SBQKM.cjs → chunk-KIIMAWOJ.cjs} +37 -2
  70. package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
  71. package/dist/{chunk-GOABMOX3.mjs → chunk-LSZAVSGY.mjs} +468 -45
  72. package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
  73. package/dist/{chunk-GNSDTTWZ.mjs → chunk-MKYBIIAQ.mjs} +30 -5
  74. package/dist/{chunk-ZHPHJPQP.cjs → chunk-MRMI32SN.cjs} +88 -366
  75. package/dist/{chunk-7M52YUMY.cjs → chunk-N2NAS2AM.cjs} +2 -2
  76. package/dist/{chunk-SJVKK4JE.cjs → chunk-NMHWYWDR.cjs} +1144 -777
  77. package/dist/chunk-NRDBW4MP.mjs +45 -0
  78. package/dist/{chunk-657WJNRY.mjs → chunk-O6I6VWKK.mjs} +20 -5
  79. package/dist/{chunk-O27L4YAA.mjs → chunk-O6WAEAX3.mjs} +2 -2
  80. package/dist/chunk-OFZUJMCU.mjs +601 -0
  81. package/dist/{chunk-ZKP7C2B6.mjs → chunk-OHLSEQ57.mjs} +22 -13
  82. package/dist/{chunk-X242HVD5.mjs → chunk-OO7GXVSR.mjs} +1 -1
  83. package/dist/chunk-PTZ2TVNE.cjs +178 -0
  84. package/dist/{chunk-3ATMYLLJ.mjs → chunk-Q2KB32T4.mjs} +1 -1
  85. package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
  86. package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
  87. package/dist/{chunk-G26MUMKL.cjs → chunk-S6VYG6XU.cjs} +23 -8
  88. package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
  89. package/dist/{chunk-MPEYMSCF.cjs → chunk-SDOTRX3V.cjs} +5 -5
  90. package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
  91. package/dist/{chunk-LMJ7VRHZ.mjs → chunk-T4OGRVNS.mjs} +13 -3
  92. package/dist/{chunk-T5CERMEH.cjs → chunk-T5OJPTVN.cjs} +2 -2
  93. package/dist/{chunk-Z2YLTERK.cjs → chunk-TE2G5ION.cjs} +6 -6
  94. package/dist/chunk-UH6QN5NL.mjs +178 -0
  95. package/dist/{chunk-PQDFUSXD.cjs → chunk-UVW64BCB.cjs} +44 -35
  96. package/dist/{chunk-VCCUOMQN.mjs → chunk-VILIPRS6.mjs} +1 -1
  97. package/dist/{chunk-A5FGU2WU.cjs → chunk-VQLJWDVW.cjs} +19 -23
  98. package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
  99. package/dist/{chunk-K3F2E6GS.cjs → chunk-WC5UV2HQ.cjs} +2 -2
  100. package/dist/chunk-WWFTAUFG.cjs +45 -0
  101. package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
  102. package/dist/{chunk-3VSKDFAT.mjs → chunk-WZ77PUAM.mjs} +1 -1
  103. package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
  104. package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
  105. package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
  106. package/dist/chunk-YSLWRWWP.cjs +601 -0
  107. package/dist/{chunk-LI2LMOLR.mjs → chunk-YWMZUGIS.mjs} +18 -5
  108. package/dist/chunk-ZLAT2CWY.mjs +135 -0
  109. package/dist/{chunk-XF7Q24PF.mjs → chunk-ZMMBIVQM.mjs} +35 -0
  110. package/dist/{chunk-U74I55WB.cjs → chunk-ZWM5KGAA.cjs} +19 -9
  111. package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-C3mK9Pol.d.mts} +300 -7
  112. package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-r1mOtSC1.d.ts} +300 -7
  113. package/dist/client-plugins.d.mts +4 -5
  114. package/dist/client-plugins.d.ts +4 -5
  115. package/dist/client.cjs +5 -5
  116. package/dist/client.d.mts +8 -9
  117. package/dist/client.d.ts +8 -9
  118. package/dist/client.mjs +4 -4
  119. package/dist/config.d.mts +4 -5
  120. package/dist/config.d.ts +4 -5
  121. package/dist/{devtools-RNXCTS4R.mjs → devtools-ERIKFEXX.mjs} +11 -10
  122. package/dist/{devtools-HU6Y2MNV.cjs → devtools-JZJJY5CK.cjs} +12 -11
  123. package/dist/docs.cjs +15 -14
  124. package/dist/docs.d.mts +41 -4
  125. package/dist/docs.d.ts +41 -4
  126. package/dist/docs.mjs +14 -13
  127. package/dist/i18n/client.d.mts +2 -2
  128. package/dist/i18n/client.d.ts +2 -2
  129. package/dist/i18n/index.d.mts +3 -3
  130. package/dist/i18n/index.d.ts +3 -3
  131. package/dist/i18n/server.d.mts +5 -5
  132. package/dist/i18n/server.d.ts +5 -5
  133. package/dist/image/server.cjs +3 -3
  134. package/dist/image/server.mjs +2 -2
  135. package/dist/image/sharp.cjs +10 -10
  136. package/dist/image/sharp.mjs +2 -2
  137. package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
  138. package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
  139. package/dist/index.cjs +51 -44
  140. package/dist/index.d.mts +20 -21
  141. package/dist/index.d.ts +20 -21
  142. package/dist/index.mjs +50 -43
  143. package/dist/integrations.cjs +7 -3
  144. package/dist/integrations.d.mts +4 -5
  145. package/dist/integrations.d.ts +4 -5
  146. package/dist/integrations.mjs +6 -2
  147. package/dist/internal/app-markdown-runtime.cjs +5 -5
  148. package/dist/internal/app-markdown-runtime.d.mts +5 -6
  149. package/dist/internal/app-markdown-runtime.d.ts +5 -6
  150. package/dist/internal/app-markdown-runtime.mjs +4 -4
  151. package/dist/internal/build-runtime.cjs +32 -30
  152. package/dist/internal/build-runtime.d.mts +6 -7
  153. package/dist/internal/build-runtime.d.ts +6 -7
  154. package/dist/internal/build-runtime.mjs +31 -29
  155. package/dist/internal/cli-runtime.cjs +17 -16
  156. package/dist/internal/cli-runtime.mjs +16 -15
  157. package/dist/internal/client-error-overlay.cjs +6 -6
  158. package/dist/internal/client-error-overlay.mjs +2 -2
  159. package/dist/internal/client-runtime.cjs +2 -2
  160. package/dist/internal/client-runtime.mjs +1 -1
  161. package/dist/internal/compression-runtime.d.mts +4 -5
  162. package/dist/internal/compression-runtime.d.ts +4 -5
  163. package/dist/internal/config-runtime.cjs +12 -11
  164. package/dist/internal/config-runtime.d.mts +5 -6
  165. package/dist/internal/config-runtime.d.ts +5 -6
  166. package/dist/internal/config-runtime.mjs +11 -10
  167. package/dist/internal/isolated-boundary.cjs +3 -2
  168. package/dist/internal/isolated-boundary.d.mts +1 -1
  169. package/dist/internal/isolated-boundary.d.ts +1 -1
  170. package/dist/internal/isolated-boundary.mjs +2 -1
  171. package/dist/internal/metadata-image-runtime.cjs +3 -3
  172. package/dist/internal/metadata-image-runtime.mjs +2 -2
  173. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  174. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  175. package/dist/internal/production-runtime.cjs +63 -25
  176. package/dist/internal/production-runtime.d.mts +117 -37
  177. package/dist/internal/production-runtime.d.ts +117 -37
  178. package/dist/internal/production-runtime.mjs +65 -27
  179. package/dist/internal/server-tree.cjs +12 -0
  180. package/dist/internal/server-tree.d.mts +27 -0
  181. package/dist/internal/server-tree.d.ts +27 -0
  182. package/dist/internal/server-tree.mjs +12 -0
  183. package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
  184. package/dist/layers-VUWIOFEO.cjs +18 -0
  185. package/dist/markdown.cjs +4 -4
  186. package/dist/markdown.d.mts +4 -5
  187. package/dist/markdown.d.ts +4 -5
  188. package/dist/markdown.mjs +3 -3
  189. package/dist/middleware.cjs +7 -7
  190. package/dist/middleware.d.mts +6 -7
  191. package/dist/middleware.d.ts +6 -7
  192. package/dist/middleware.mjs +6 -6
  193. package/dist/navigation.cjs +5 -5
  194. package/dist/navigation.d.mts +7 -8
  195. package/dist/navigation.d.ts +7 -8
  196. package/dist/navigation.mjs +4 -4
  197. package/dist/{nitro-HSAQFXSS.cjs → nitro-7F65EZZS.cjs} +3 -3
  198. package/dist/{nitro-4XGPNIK4.mjs → nitro-MPZJGPXK.mjs} +2 -2
  199. package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
  200. package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
  201. package/dist/observability.d.mts +1 -1
  202. package/dist/observability.d.ts +1 -1
  203. package/dist/plugin.cjs +28 -26
  204. package/dist/plugin.d.mts +4 -5
  205. package/dist/plugin.d.ts +4 -5
  206. package/dist/plugin.mjs +27 -25
  207. package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-CCeVZXst.d.mts} +4 -4
  208. package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-DPnsggY3.d.ts} +4 -4
  209. package/dist/query/client.cjs +6 -6
  210. package/dist/query/client.mjs +2 -2
  211. package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
  212. package/dist/{render-plan-D72O1qm4.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
  213. package/dist/renderer/react/server.cjs +10 -4
  214. package/dist/renderer/react/server.d.mts +2 -1
  215. package/dist/renderer/react/server.d.ts +2 -1
  216. package/dist/renderer/react/server.mjs +7 -1
  217. package/dist/renderer-client.cjs +5 -5
  218. package/dist/renderer-client.d.mts +6 -7
  219. package/dist/renderer-client.d.ts +6 -7
  220. package/dist/renderer-client.mjs +2 -2
  221. package/dist/renderer.d.mts +2 -0
  222. package/dist/renderer.d.ts +2 -0
  223. package/dist/{request-DbyOYI2j.d.ts → request-Bkg-hERy.d.ts} +1 -1
  224. package/dist/{request-Be83WafN.d.mts → request-CsGARcAw.d.mts} +1 -1
  225. package/dist/request.d.mts +5 -6
  226. package/dist/request.d.ts +5 -6
  227. package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
  228. package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
  229. package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
  230. package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
  231. package/dist/{router-D94-SDlW.d.ts → router-B8CR9GbD.d.ts} +1 -1
  232. package/dist/{router-ALUvm8gC.d.mts → router-Cp6yRE8A.d.mts} +1 -1
  233. package/dist/routes.d.mts +4 -5
  234. package/dist/routes.d.ts +4 -5
  235. package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
  236. package/dist/runtime-CAEv36S_.d.mts +69 -0
  237. package/dist/runtime-CQVsT330.d.ts +69 -0
  238. package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
  239. package/dist/server-action-security.cjs +3 -3
  240. package/dist/server-action-security.mjs +2 -2
  241. package/dist/server-fn.cjs +4 -4
  242. package/dist/server-fn.mjs +3 -3
  243. package/dist/server-plugins.d.mts +5 -6
  244. package/dist/server-plugins.d.ts +5 -6
  245. package/dist/server-query.cjs +5 -5
  246. package/dist/server-query.mjs +4 -4
  247. package/dist/server.cjs +47 -45
  248. package/dist/server.d.mts +13 -14
  249. package/dist/server.d.ts +13 -14
  250. package/dist/server.mjs +30 -28
  251. package/dist/{spa-router-CxK3USIz.d.ts → spa-router-BuciWGCZ.d.ts} +3 -3
  252. package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-DwbqGkGj.d.mts} +3 -3
  253. package/dist/testing.cjs +9 -9
  254. package/dist/testing.d.mts +4 -5
  255. package/dist/testing.d.ts +4 -5
  256. package/dist/testing.mjs +7 -7
  257. package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
  258. package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
  259. package/dist/{utils-4wVRcpOw.d.mts → utils-B9V0S_yL.d.mts} +1 -1
  260. package/dist/{utils-311Y8eoK.d.ts → utils-CaoWKtYM.d.ts} +1 -1
  261. package/dist/version.cjs +2 -2
  262. package/dist/version.mjs +1 -1
  263. package/dist/vite.cjs +28 -26
  264. package/dist/vite.d.mts +4 -5
  265. package/dist/vite.d.ts +4 -5
  266. package/dist/vite.mjs +27 -25
  267. package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
  268. package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
  269. package/dist/workflows.cjs +3 -3
  270. package/dist/workflows.d.mts +1 -1
  271. package/dist/workflows.d.ts +1 -1
  272. package/dist/workflows.mjs +2 -2
  273. package/package.json +9 -1
  274. package/dist/chunk-M64YUMA4.cjs +0 -58
  275. package/dist/chunk-QLQ32WC4.mjs +0 -58
  276. package/dist/layers-4PNE2HOY.cjs +0 -18
  277. package/dist/metadata-2HSU2i_w.d.mts +0 -52
  278. package/dist/metadata-Cjs8JMRM.d.ts +0 -52
  279. package/dist/types-DFbjpjXX.d.mts +0 -105
  280. package/dist/types-DFbjpjXX.d.ts +0 -105
  281. package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
  282. package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
@@ -0,0 +1,601 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkWWFTAUFGcjs = require('./chunk-WWFTAUFG.cjs');
5
+
6
+
7
+ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
8
+
9
+ // src/client/server-tree.ts
10
+ var MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
11
+ var FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
12
+ var SERVER_HTML_TAG = "farm-server-html";
13
+ var FARM_SERVER_TREE_ATTRIBUTE = "data-farm-server-tree";
14
+ var SERVER_TREE_CHUNK_ATTRIBUTE = "data-farm-server-tree-chunk";
15
+ var SERVER_HTML_ATTRIBUTE = "data-farm-server-html";
16
+ var PARSER_SENSITIVE_TAGS = /* @__PURE__ */ new Set([
17
+ "caption",
18
+ "colgroup",
19
+ "datalist",
20
+ "head",
21
+ "html",
22
+ "iframe",
23
+ "math",
24
+ "noscript",
25
+ "optgroup",
26
+ "option",
27
+ "script",
28
+ "select",
29
+ "style",
30
+ "svg",
31
+ "table",
32
+ "tbody",
33
+ "td",
34
+ "template",
35
+ "textarea",
36
+ "tfoot",
37
+ "th",
38
+ "thead",
39
+ "title",
40
+ "tr"
41
+ ]);
42
+ var _UnsupportedNode = class _UnsupportedNode extends Error {
43
+ };
44
+ _chunkS3JO3N4Hcjs.__name.call(void 0, _UnsupportedNode, "UnsupportedNode");
45
+ var UnsupportedNode = _UnsupportedNode;
46
+ var _UnsupportedInParserSensitiveElement = class _UnsupportedInParserSensitiveElement extends Error {
47
+ };
48
+ _chunkS3JO3N4Hcjs.__name.call(void 0, _UnsupportedInParserSensitiveElement, "UnsupportedInParserSensitiveElement");
49
+ var UnsupportedInParserSensitiveElement = _UnsupportedInParserSensitiveElement;
50
+ function getHooksDispatcherSlot(ReactRuntime) {
51
+ const runtime = ReactRuntime;
52
+ const react19 = runtime.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
53
+ if (react19 && "H" in react19) {
54
+ return {
55
+ get: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => react19.H, "get"),
56
+ set: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (value) => {
57
+ react19.H = value;
58
+ }, "set")
59
+ };
60
+ }
61
+ const react18 = _optionalChain([runtime, 'access', _ => _.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, 'optionalAccess', _2 => _2.ReactCurrentDispatcher]);
62
+ if (react18) {
63
+ return {
64
+ get: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => react18.current, "get"),
65
+ set: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (value) => {
66
+ react18.current = value;
67
+ }, "set")
68
+ };
69
+ }
70
+ return null;
71
+ }
72
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getHooksDispatcherSlot, "getHooksDispatcherSlot");
73
+ var unsupportedHooksDispatcher = /* @__PURE__ */ new Proxy(
74
+ {},
75
+ {
76
+ get(_target, name) {
77
+ return () => {
78
+ throw new UnsupportedNode(`calls ${String(name)}()`);
79
+ };
80
+ }
81
+ }
82
+ );
83
+ function callServerComponent(ReactRuntime, render, props, forwardRef) {
84
+ const slot = getHooksDispatcherSlot(ReactRuntime);
85
+ const previous = _optionalChain([slot, 'optionalAccess', _3 => _3.get, 'call', _4 => _4()]);
86
+ _optionalChain([slot, 'optionalAccess', _5 => _5.set, 'call', _6 => _6(unsupportedHooksDispatcher)]);
87
+ try {
88
+ return forwardRef ? render(props, null) : render(props);
89
+ } finally {
90
+ _optionalChain([slot, 'optionalAccess', _7 => _7.set, 'call', _8 => _8(previous)]);
91
+ }
92
+ }
93
+ _chunkS3JO3N4Hcjs.__name.call(void 0, callServerComponent, "callServerComponent");
94
+ function isThenable(value) {
95
+ return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
96
+ }
97
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isThenable, "isThenable");
98
+ function serverHtmlNode(state, node, key, context) {
99
+ if (context.parserSensitive) throw new UnsupportedInParserSensitiveElement();
100
+ const id = state.nextId++;
101
+ state.serverHtml.set(id, node);
102
+ return key === null ? { $: "x", i: id } : { $: "x", i: id, k: String(key) };
103
+ }
104
+ _chunkS3JO3N4Hcjs.__name.call(void 0, serverHtmlNode, "serverHtmlNode");
105
+ async function resolveProps(state, props, context, host) {
106
+ const entries = await Promise.all(
107
+ Object.entries(props).map(async ([name, value]) => {
108
+ if (value === void 0) return null;
109
+ if (name === "ref") {
110
+ if (value === null) return null;
111
+ throw new UnsupportedNode("receives a ref");
112
+ }
113
+ if (host && typeof value === "function") {
114
+ throw new UnsupportedNode(`passes a function to <${String(name)}>`);
115
+ }
116
+ return [name, await resolveValue(state, value, context, /* @__PURE__ */ new Set())];
117
+ })
118
+ );
119
+ return Object.fromEntries(entries.filter((entry) => entry !== null));
120
+ }
121
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveProps, "resolveProps");
122
+ async function resolveValue(state, value, context, seen) {
123
+ if (value === null || value === void 0) return null;
124
+ if (typeof value === "string" || typeof value === "boolean") return value;
125
+ if (typeof value === "number") {
126
+ return Number.isFinite(value) ? value : { $: "n", v: String(value) };
127
+ }
128
+ if (typeof value !== "object") throw new UnsupportedNode(`passes a ${typeof value} value`);
129
+ if (state.ReactRuntime.isValidElement(value)) {
130
+ return resolveElement(state, value, context);
131
+ }
132
+ if (isThenable(value)) {
133
+ try {
134
+ return { $: "P", v: await resolveValue(state, await value, context, seen) };
135
+ } catch (error) {
136
+ if (error instanceof UnsupportedInParserSensitiveElement) throw error;
137
+ throw new UnsupportedNode("passes a promise that does not resolve to a serializable value");
138
+ }
139
+ }
140
+ if (seen.has(value)) throw new UnsupportedNode("passes a circular value");
141
+ seen.add(value);
142
+ try {
143
+ if (Array.isArray(value)) {
144
+ return await Promise.all(value.map((entry) => resolveValue(state, entry, context, seen)));
145
+ }
146
+ const prototype = Object.getPrototypeOf(value);
147
+ if (prototype !== Object.prototype && prototype !== null) {
148
+ throw new UnsupportedNode("passes a class instance");
149
+ }
150
+ const entries = await Promise.all(
151
+ Object.entries(value).filter(([, entry]) => entry !== void 0).map(
152
+ async ([name, entry]) => [
153
+ name,
154
+ await resolveValue(state, entry, context, seen)
155
+ ]
156
+ )
157
+ );
158
+ const object = Object.fromEntries(entries);
159
+ return Object.prototype.hasOwnProperty.call(object, "$") ? { $: "o", v: object } : object;
160
+ } finally {
161
+ seen.delete(value);
162
+ }
163
+ }
164
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveValue, "resolveValue");
165
+ async function resolveElement(state, element, context) {
166
+ const { ReactRuntime } = state;
167
+ const key = element.key === null || element.key === void 0 ? null : String(element.key);
168
+ const withKey = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (node) => key === null ? node : { ...node, k: key }, "withKey");
169
+ let type = element.type;
170
+ const props = _nullishCoalesce(element.props, () => ( {}));
171
+ try {
172
+ if (typeof type === "string") {
173
+ const parserSensitive = context.parserSensitive || PARSER_SENSITIVE_TAGS.has(type);
174
+ try {
175
+ const { children, ...rest } = props;
176
+ const resolved2 = await resolveProps(state, rest, context, true);
177
+ if (children !== void 0) {
178
+ resolved2.children = await resolveValue(state, children, { parserSensitive }, /* @__PURE__ */ new Set());
179
+ }
180
+ return withKey({ $: "h", t: type, p: resolved2 });
181
+ } catch (error) {
182
+ if (error instanceof UnsupportedInParserSensitiveElement && !context.parserSensitive) {
183
+ return serverHtmlNode(state, element, key, context);
184
+ }
185
+ throw error;
186
+ }
187
+ }
188
+ if (type === ReactRuntime.Fragment || type === ReactRuntime.StrictMode) {
189
+ return withKey({
190
+ $: "f",
191
+ c: await resolveValue(state, props.children, context, /* @__PURE__ */ new Set())
192
+ });
193
+ }
194
+ if (type === ReactRuntime.Suspense) {
195
+ const id = state.nextId++;
196
+ const fallback = await resolveValue(state, props.fallback, context, /* @__PURE__ */ new Set());
197
+ const encoded = resolveValue(state, props.children, context, /* @__PURE__ */ new Set()).catch((error) => {
198
+ if (error instanceof UnsupportedNode) {
199
+ return serverHtmlNode(
200
+ state,
201
+ ReactRuntime.createElement(
202
+ ReactRuntime.Fragment,
203
+ null,
204
+ props.children
205
+ ),
206
+ null,
207
+ { parserSensitive: false }
208
+ );
209
+ }
210
+ throw error;
211
+ });
212
+ encoded.catch(() => {
213
+ });
214
+ state.chunks.set(id, { encoded });
215
+ return withKey({ $: "s", f: fallback, i: id });
216
+ }
217
+ const clientReference = _chunkWWFTAUFGcjs.getFarmClientReference.call(void 0, type);
218
+ if (clientReference) {
219
+ const { children, ...rest } = props;
220
+ const resolved2 = await resolveProps(state, rest, context, false);
221
+ if (children !== void 0) {
222
+ resolved2.children = await resolveValue(state, children, context, /* @__PURE__ */ new Set());
223
+ }
224
+ state.components.set(
225
+ `${clientReference.reference}#${clientReference.exportName}`,
226
+ clientReference.Component
227
+ );
228
+ return withKey({
229
+ $: "c",
230
+ r: clientReference.reference,
231
+ e: clientReference.exportName,
232
+ p: resolved2
233
+ });
234
+ }
235
+ let forwardRef = false;
236
+ while (type && typeof type === "object") {
237
+ const typeOf = type.$$typeof;
238
+ if (typeOf === MEMO_TYPE) {
239
+ type = type.type;
240
+ if (_chunkWWFTAUFGcjs.getFarmClientReference.call(void 0, type)) {
241
+ return resolveElement(
242
+ state,
243
+ ReactRuntime.createElement(type, {
244
+ ...props,
245
+ key: element.key
246
+ }),
247
+ context
248
+ );
249
+ }
250
+ continue;
251
+ }
252
+ if (typeOf === FORWARD_REF_TYPE) {
253
+ type = type.render;
254
+ forwardRef = true;
255
+ break;
256
+ }
257
+ throw new UnsupportedNode("is not a function component");
258
+ }
259
+ if (typeof type !== "function") throw new UnsupportedNode("is not a function component");
260
+ if (_optionalChain([type, 'access', _9 => _9.prototype, 'optionalAccess', _10 => _10.isReactComponent])) {
261
+ throw new UnsupportedNode("is a class component");
262
+ }
263
+ let rendered = callServerComponent(
264
+ ReactRuntime,
265
+ type,
266
+ props,
267
+ forwardRef
268
+ );
269
+ if (isThenable(rendered)) rendered = await rendered;
270
+ const resolved = await resolveValue(state, rendered, context, /* @__PURE__ */ new Set());
271
+ return key === null ? resolved : { $: "f", k: key, c: resolved };
272
+ } catch (error) {
273
+ if (error instanceof UnsupportedNode) return serverHtmlNode(state, element, key, context);
274
+ throw error;
275
+ }
276
+ }
277
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveElement, "resolveElement");
278
+ function serializeTreePayload(value) {
279
+ return JSON.stringify(value).replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
280
+ }
281
+ _chunkS3JO3N4Hcjs.__name.call(void 0, serializeTreePayload, "serializeTreePayload");
282
+ var chunkComponents = /* @__PURE__ */ new WeakMap();
283
+ function getChunkComponent(ReactRuntime) {
284
+ const existing = chunkComponents.get(ReactRuntime.createElement);
285
+ if (existing) return existing;
286
+ function FarmServerTreeChunk({ chunk }) {
287
+ if (chunk.status === "fulfilled") return chunk.value;
288
+ if (chunk.status === "rejected") throw chunk.reason;
289
+ const use = ReactRuntime.use;
290
+ if (typeof use === "function") return use(chunk.promise);
291
+ throw chunk.promise;
292
+ }
293
+ _chunkS3JO3N4Hcjs.__name.call(void 0, FarmServerTreeChunk, "FarmServerTreeChunk");
294
+ chunkComponents.set(ReactRuntime.createElement, FarmServerTreeChunk);
295
+ return FarmServerTreeChunk;
296
+ }
297
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getChunkComponent, "getChunkComponent");
298
+ function fulfilledThenable(value) {
299
+ const promise = Promise.resolve(value);
300
+ promise.status = "fulfilled";
301
+ promise.value = value;
302
+ return promise;
303
+ }
304
+ _chunkS3JO3N4Hcjs.__name.call(void 0, fulfilledThenable, "fulfilledThenable");
305
+ function createTreeChildren(ReactRuntime, children, resolver) {
306
+ if (children === void 0) return [];
307
+ const node = createTreeValue(ReactRuntime, children, resolver);
308
+ return Array.isArray(children) ? node : [node];
309
+ }
310
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createTreeChildren, "createTreeChildren");
311
+ function createTreeProps(ReactRuntime, props, resolver, key) {
312
+ const { children, ...rest } = props;
313
+ const created = {};
314
+ for (const [name, value] of Object.entries(rest)) {
315
+ created[name] = createTreeValue(ReactRuntime, value, resolver);
316
+ }
317
+ if (typeof key === "string") created.key = key;
318
+ return { props: created, children: createTreeChildren(ReactRuntime, children, resolver) };
319
+ }
320
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createTreeProps, "createTreeProps");
321
+ function createTreeValue(ReactRuntime, value, resolver) {
322
+ if (value === null || typeof value !== "object") return value;
323
+ if (Array.isArray(value))
324
+ return value.map((entry) => createTreeValue(ReactRuntime, entry, resolver));
325
+ switch (value.$) {
326
+ case "h": {
327
+ const { props, children } = createTreeProps(
328
+ ReactRuntime,
329
+ value.p,
330
+ resolver,
331
+ value.k
332
+ );
333
+ return ReactRuntime.createElement(value.t, props, ...children);
334
+ }
335
+ case "c": {
336
+ const { props, children } = createTreeProps(
337
+ ReactRuntime,
338
+ value.p,
339
+ resolver,
340
+ value.k
341
+ );
342
+ return ReactRuntime.createElement(
343
+ resolver.component(value.r, value.e),
344
+ props,
345
+ ...children
346
+ );
347
+ }
348
+ case "f":
349
+ return ReactRuntime.createElement(
350
+ ReactRuntime.Fragment,
351
+ typeof value.k === "string" ? { key: value.k } : null,
352
+ ...createTreeChildren(ReactRuntime, value.c, resolver)
353
+ );
354
+ case "s":
355
+ return ReactRuntime.createElement(
356
+ ReactRuntime.Suspense,
357
+ {
358
+ ...typeof value.k === "string" ? { key: value.k } : {},
359
+ fallback: createTreeValue(
360
+ ReactRuntime,
361
+ value.f,
362
+ resolver
363
+ )
364
+ },
365
+ ReactRuntime.createElement(getChunkComponent(ReactRuntime), {
366
+ chunk: resolver.chunk(value.i)
367
+ })
368
+ );
369
+ case "x":
370
+ return resolver.serverHtml(value.i, typeof value.k === "string" ? value.k : null);
371
+ case "n":
372
+ return Number(value.v);
373
+ case "P":
374
+ return fulfilledThenable(createTreeValue(ReactRuntime, value.v, resolver));
375
+ case "o": {
376
+ const object = value.v;
377
+ return Object.fromEntries(
378
+ Object.entries(object).map(([name, entry]) => [
379
+ name,
380
+ createTreeValue(ReactRuntime, entry, resolver)
381
+ ])
382
+ );
383
+ }
384
+ default:
385
+ return Object.fromEntries(
386
+ Object.entries(value).map(([name, entry]) => [
387
+ name,
388
+ createTreeValue(ReactRuntime, entry, resolver)
389
+ ])
390
+ );
391
+ }
392
+ }
393
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createTreeValue, "createTreeValue");
394
+ function createTreeScript(ReactRuntime, attribute, value, json) {
395
+ return ReactRuntime.createElement("script", {
396
+ type: "application/json",
397
+ [attribute]: value,
398
+ dangerouslySetInnerHTML: { __html: json }
399
+ });
400
+ }
401
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createTreeScript, "createTreeScript");
402
+ function createTreePage(ReactRuntime, tree, json, resolver, key) {
403
+ return ReactRuntime.createElement(
404
+ ReactRuntime.Fragment,
405
+ key === void 0 ? null : { key },
406
+ createTreeValue(ReactRuntime, tree, resolver),
407
+ createTreeScript(ReactRuntime, FARM_SERVER_TREE_ATTRIBUTE, "", json)
408
+ );
409
+ }
410
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createTreePage, "createTreePage");
411
+ async function renderFarmServerTreePage(ReactRuntime, element, options) {
412
+ const state = {
413
+ ReactRuntime,
414
+ nextId: 0,
415
+ components: /* @__PURE__ */ new Map(),
416
+ serverHtml: /* @__PURE__ */ new Map(),
417
+ chunks: /* @__PURE__ */ new Map()
418
+ };
419
+ const tree = await resolveValue(state, element, { parserSensitive: false }, /* @__PURE__ */ new Set());
420
+ const resolver = {
421
+ component(reference, exportName) {
422
+ const Component = state.components.get(`${reference}#${exportName}`);
423
+ if (!Component)
424
+ throw new Error(`client reference ${reference}#${exportName} was not resolved`);
425
+ return Component;
426
+ },
427
+ chunk(id) {
428
+ const entry = state.chunks.get(id);
429
+ if (entry.chunk) return entry.chunk;
430
+ const chunk = {
431
+ status: "pending",
432
+ promise: entry.encoded.then(
433
+ (encoded) => {
434
+ chunk.value = ReactRuntime.createElement(
435
+ ReactRuntime.Fragment,
436
+ null,
437
+ createTreeValue(ReactRuntime, encoded, resolver),
438
+ createTreeScript(
439
+ ReactRuntime,
440
+ SERVER_TREE_CHUNK_ATTRIBUTE,
441
+ String(id),
442
+ serializeTreePayload({ t: encoded })
443
+ )
444
+ );
445
+ chunk.status = "fulfilled";
446
+ return chunk.value;
447
+ },
448
+ (error) => {
449
+ chunk.status = "rejected";
450
+ chunk.reason = error;
451
+ throw error;
452
+ }
453
+ )
454
+ };
455
+ chunk.promise.catch(() => {
456
+ });
457
+ entry.chunk = chunk;
458
+ return chunk;
459
+ },
460
+ serverHtml(id, key) {
461
+ return ReactRuntime.createElement(
462
+ SERVER_HTML_TAG,
463
+ {
464
+ ...key === null ? {} : { key },
465
+ [SERVER_HTML_ATTRIBUTE]: String(id),
466
+ style: { display: "contents" }
467
+ },
468
+ options.isolate(state.serverHtml.get(id))
469
+ );
470
+ }
471
+ };
472
+ const page = createTreePage(
473
+ ReactRuntime,
474
+ tree,
475
+ serializeTreePayload({ v: 1, t: tree }),
476
+ resolver
477
+ );
478
+ return ReactRuntime.createElement(/* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, function FarmServerTreePage() {
479
+ return page;
480
+ }, "FarmServerTreePage"));
481
+ }
482
+ _chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmServerTreePage, "renderFarmServerTreePage");
483
+ function collectReferences(value, references) {
484
+ if (value === null || typeof value !== "object") return;
485
+ if (Array.isArray(value)) {
486
+ for (const entry of value) collectReferences(entry, references);
487
+ return;
488
+ }
489
+ if (value.$ === "c") references.add(`${value.r}#${value.e}`);
490
+ for (const entry of Object.values(value)) collectReferences(entry, references);
491
+ }
492
+ _chunkS3JO3N4Hcjs.__name.call(void 0, collectReferences, "collectReferences");
493
+ function parseHtml(html) {
494
+ const template = document.createElement("template");
495
+ template.innerHTML = html;
496
+ return template.content;
497
+ }
498
+ _chunkS3JO3N4Hcjs.__name.call(void 0, parseHtml, "parseHtml");
499
+ function originalExport(module, exportName) {
500
+ const Component = _optionalChain([module, 'access', _11 => _11.__farm_client_boundary_originals__, 'optionalAccess', _12 => _12[exportName]]);
501
+ if (typeof Component !== "function" && typeof Component !== "object") {
502
+ throw new Error(`compiled original export ${exportName} was not found`);
503
+ }
504
+ return Component;
505
+ }
506
+ _chunkS3JO3N4Hcjs.__name.call(void 0, originalExport, "originalExport");
507
+ async function createFarmServerTreeElement(ReactRuntime, source, options) {
508
+ const root = typeof source === "string" ? parseHtml(source) : source;
509
+ const script = root.querySelector(`script[${FARM_SERVER_TREE_ATTRIBUTE}]`);
510
+ if (!script) return null;
511
+ const json = _nullishCoalesce(script.textContent, () => ( ""));
512
+ const payload = JSON.parse(json);
513
+ if (payload.v !== 1) throw new Error("unsupported server tree payload version");
514
+ const chunks = /* @__PURE__ */ new Map();
515
+ for (const chunkScript of root.querySelectorAll(
516
+ `script[${SERVER_TREE_CHUNK_ATTRIBUTE}]`
517
+ )) {
518
+ const chunkJson = _nullishCoalesce(chunkScript.textContent, () => ( ""));
519
+ chunks.set(Number(chunkScript.getAttribute(SERVER_TREE_CHUNK_ATTRIBUTE)), {
520
+ tree: JSON.parse(chunkJson).t,
521
+ json: chunkJson
522
+ });
523
+ }
524
+ const references = /* @__PURE__ */ new Set();
525
+ collectReferences(payload.t, references);
526
+ for (const chunk of chunks.values()) collectReferences(chunk.tree, references);
527
+ const components = /* @__PURE__ */ new Map();
528
+ await Promise.all(
529
+ Array.from(references, async (key) => {
530
+ const separator = key.lastIndexOf("#");
531
+ const reference = key.slice(0, separator);
532
+ components.set(key, originalExport(await options.load(reference), key.slice(separator + 1)));
533
+ })
534
+ );
535
+ const serverHtml = /* @__PURE__ */ new Map();
536
+ for (const container of root.querySelectorAll(`${SERVER_HTML_TAG}[${SERVER_HTML_ATTRIBUTE}]`)) {
537
+ serverHtml.set(Number(container.getAttribute(SERVER_HTML_ATTRIBUTE)), container.innerHTML);
538
+ }
539
+ const resolver = {
540
+ component(reference, exportName) {
541
+ const Component = components.get(`${reference}#${exportName}`);
542
+ if (!Component) throw new Error(`client reference ${reference}#${exportName} was not loaded`);
543
+ return Component;
544
+ },
545
+ chunk(id) {
546
+ const chunk = chunks.get(id);
547
+ if (!chunk) throw new Error(`server tree chunk ${id} was not found`);
548
+ const value = ReactRuntime.createElement(
549
+ ReactRuntime.Fragment,
550
+ null,
551
+ createTreeValue(ReactRuntime, chunk.tree, resolver),
552
+ createTreeScript(ReactRuntime, SERVER_TREE_CHUNK_ATTRIBUTE, String(id), chunk.json)
553
+ );
554
+ return { status: "fulfilled", value, promise: Promise.resolve(value) };
555
+ },
556
+ serverHtml(id, key) {
557
+ const html = serverHtml.get(id);
558
+ if (html === void 0) throw new Error(`server HTML ${id} was not found`);
559
+ return ReactRuntime.createElement(options.ServerHtml, {
560
+ ...key === null ? {} : { key },
561
+ as: SERVER_HTML_TAG,
562
+ [SERVER_HTML_ATTRIBUTE]: String(id),
563
+ style: { display: "contents" },
564
+ suppressHydrationWarning: true,
565
+ dangerouslySetInnerHTML: { __html: html }
566
+ });
567
+ }
568
+ };
569
+ const build = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => createTreePage(ReactRuntime, payload.t, json, resolver), "build");
570
+ build();
571
+ function FarmServerTreePage() {
572
+ const [, setVersion] = ReactRuntime.useState(0);
573
+ ReactRuntime.useEffect(() => {
574
+ const listener = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (reference, module) => {
575
+ let changed = false;
576
+ for (const key of components.keys()) {
577
+ const separator = key.lastIndexOf("#");
578
+ if (key.slice(0, separator) !== reference) continue;
579
+ components.set(key, originalExport(module, key.slice(separator + 1)));
580
+ changed = true;
581
+ }
582
+ if (changed) setVersion((version) => version + 1);
583
+ return changed;
584
+ }, "listener");
585
+ return _chunkWWFTAUFGcjs.subscribeFarmServerTreeUpdates.call(void 0, listener);
586
+ }, []);
587
+ return build();
588
+ }
589
+ _chunkS3JO3N4Hcjs.__name.call(void 0, FarmServerTreePage, "FarmServerTreePage");
590
+ return ReactRuntime.createElement(
591
+ FarmServerTreePage,
592
+ options.key === void 0 ? null : { key: options.key }
593
+ );
594
+ }
595
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmServerTreeElement, "createFarmServerTreeElement");
596
+
597
+
598
+
599
+
600
+
601
+ exports.FARM_SERVER_TREE_ATTRIBUTE = FARM_SERVER_TREE_ATTRIBUTE; exports.renderFarmServerTreePage = renderFarmServerTreePage; exports.createFarmServerTreeElement = createFarmServerTreeElement;
@@ -1,3 +1,7 @@
1
+ import {
2
+ markFarmClientReference,
3
+ updateFarmServerTreeModule
4
+ } from "./chunk-NRDBW4MP.mjs";
1
5
  import {
2
6
  __name
3
7
  } from "./chunk-LPEX4YW6.mjs";
@@ -63,6 +67,7 @@ function isolateFarmServerPageGraph(ReactRuntime, element) {
63
67
  return ReactRuntime.createElement(Context.Provider, { value: false }, element);
64
68
  }
65
69
  __name(isolateFarmServerPageGraph, "isolateFarmServerPageGraph");
70
+ var warnedUnserializableBoundaries = /* @__PURE__ */ new Set();
66
71
  function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReference, exportName, islandStrategy) {
67
72
  function FarmIsolatedClientBoundary(props) {
68
73
  const Context = getBoundaryGraphContext(ReactRuntime);
@@ -75,9 +80,12 @@ function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReferen
75
80
  try {
76
81
  serializedProps = serializeBoundaryPayload(props);
77
82
  } catch (error) {
78
- if (typeof window === "undefined") {
83
+ const message = error instanceof Error ? error.message : String(error);
84
+ const warningKey = `${moduleReference}#${exportName}:${message}`;
85
+ if (typeof window === "undefined" && !warnedUnserializableBoundaries.has(warningKey)) {
86
+ warnedUnserializableBoundaries.add(warningKey);
79
87
  console.warn(
80
- `[Farm.js] Could not isolate ${moduleReference}#${exportName}: ${error instanceof Error ? error.message : String(error)}. The server-rendered component was preserved without client hydration.`
88
+ `[Farm.js] Could not isolate ${moduleReference}#${exportName}: ${message}. The server-rendered component was preserved without client hydration.`
81
89
  );
82
90
  }
83
91
  return ReactRuntime.createElement(Component, props);
@@ -109,6 +117,11 @@ function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReferen
109
117
  }
110
118
  __name(FarmIsolatedClientBoundary, "FarmIsolatedClientBoundary");
111
119
  FarmIsolatedClientBoundary.displayName = `FarmIsolated(${Component.displayName || Component.name || exportName})`;
120
+ markFarmClientReference(FarmIsolatedClientBoundary, {
121
+ reference: moduleReference,
122
+ exportName,
123
+ Component
124
+ });
112
125
  return FarmIsolatedClientBoundary;
113
126
  }
114
127
  __name(createFarmIsolatedClientBoundary, "createFarmIsolatedClientBoundary");
@@ -300,7 +313,7 @@ function createFarmIsolatedHydrationRuntime(options) {
300
313
  __name(hydrate, "hydrate");
301
314
  function updateModule(reference, module) {
302
315
  const originals = module.__farm_client_boundary_originals__;
303
- let updated = 0;
316
+ let updated = updateFarmServerTreeModule(reference, module);
304
317
  for (const [container, record] of roots) {
305
318
  if (record.reference !== reference) continue;
306
319
  const Component = originals?.[record.exportName];
@@ -355,7 +368,7 @@ function createFarmIsolatedHydrationRuntime(options) {
355
368
  }
356
369
  __name(createFarmIsolatedHydrationRuntime, "createFarmIsolatedHydrationRuntime");
357
370
  function createFarmServerPageBoundary(ReactRuntime, runtime) {
358
- return /* @__PURE__ */ __name(function FarmServerPage(props) {
371
+ return /* @__PURE__ */ __name(function FarmServerPage({ as = "div", ...props }) {
359
372
  const ref = ReactRuntime.useRef(null);
360
373
  const html = props.dangerouslySetInnerHTML.__html;
361
374
  ReactRuntime.useLayoutEffect(() => {
@@ -376,7 +389,7 @@ function createFarmServerPageBoundary(ReactRuntime, runtime) {
376
389
  });
377
390
  };
378
391
  }, [html]);
379
- return ReactRuntime.createElement("div", { ...props, ref });
392
+ return ReactRuntime.createElement(as, { ...props, ref });
380
393
  }, "FarmServerPage");
381
394
  }
382
395
  __name(createFarmServerPageBoundary, "createFarmServerPageBoundary");