@farm.js/core 0.1.34 → 0.1.35

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 (261) hide show
  1. package/dist/agent-runtime.cjs +3 -3
  2. package/dist/agent-runtime.d.mts +4 -5
  3. package/dist/agent-runtime.d.ts +4 -5
  4. package/dist/agent-runtime.mjs +2 -2
  5. package/dist/api/route-manager.cjs +5 -5
  6. package/dist/api/route-manager.d.mts +6 -7
  7. package/dist/api/route-manager.d.ts +6 -7
  8. package/dist/api/route-manager.mjs +4 -4
  9. package/dist/api/runtime.cjs +6 -4
  10. package/dist/api/runtime.d.mts +4 -5
  11. package/dist/api/runtime.d.ts +4 -5
  12. package/dist/api/runtime.mjs +6 -4
  13. package/dist/api.cjs +6 -6
  14. package/dist/api.d.mts +7 -8
  15. package/dist/api.d.ts +7 -8
  16. package/dist/api.mjs +5 -5
  17. package/dist/{app-DgotYGbq.d.ts → app-BXB3JZYc.d.ts} +38 -12
  18. package/dist/{app-q4rmZlXK.d.mts → app-D_j9AAVL.d.mts} +38 -12
  19. package/dist/app-markdown.cjs +5 -5
  20. package/dist/app-markdown.d.mts +5 -6
  21. package/dist/app-markdown.d.ts +5 -6
  22. package/dist/app-markdown.mjs +4 -4
  23. package/dist/{chunk-LMJ7VRHZ.mjs → chunk-22LTEMGQ.mjs} +1 -1
  24. package/dist/{chunk-AQZFOP7S.mjs → chunk-2G2NNLE2.mjs} +1 -1
  25. package/dist/{chunk-QJ3J6MZT.cjs → chunk-3BHT4WMP.cjs} +2 -2
  26. package/dist/{chunk-X242HVD5.mjs → chunk-3PXS2MHU.mjs} +1 -1
  27. package/dist/{chunk-A5FGU2WU.cjs → chunk-3UH7MRCP.cjs} +19 -23
  28. package/dist/{chunk-AGC75XAE.mjs → chunk-4JHOT46A.mjs} +1 -1
  29. package/dist/{chunk-XV5DJTBX.mjs → chunk-4KU5Q7C2.mjs} +424 -230
  30. package/dist/{chunk-TA5G2HWD.cjs → chunk-4MMGO7YW.cjs} +21 -21
  31. package/dist/{chunk-7BT4H4P7.cjs → chunk-62XKI4Z3.cjs} +2 -2
  32. package/dist/{chunk-ZKP7C2B6.mjs → chunk-6DU6UFUE.mjs} +12 -11
  33. package/dist/{chunk-GOABMOX3.mjs → chunk-6ETPZTJI.mjs} +366 -4
  34. package/dist/{chunk-7Y6ZNFPX.mjs → chunk-6TJOML4E.mjs} +13 -3
  35. package/dist/{chunk-3ATMYLLJ.mjs → chunk-6WCPV6G2.mjs} +1 -1
  36. package/dist/{chunk-BTAG7LI7.cjs → chunk-73MC7ZL6.cjs} +2 -2
  37. package/dist/chunk-75RZHGLS.cjs +135 -0
  38. package/dist/{chunk-VKNHTSAP.cjs → chunk-7GLPRTTF.cjs} +2 -2
  39. package/dist/{chunk-7M52YUMY.cjs → chunk-7L5V3KQO.cjs} +2 -2
  40. package/dist/{chunk-LI2LMOLR.mjs → chunk-C35ZBVRD.mjs} +12 -3
  41. package/dist/{chunk-YQVSHTMR.mjs → chunk-CP6X4AEU.mjs} +1 -1
  42. package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
  43. package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
  44. package/dist/{chunk-ROUTX2E5.cjs → chunk-DBNKI4NF.cjs} +12 -3
  45. package/dist/{chunk-UX5S4JEO.cjs → chunk-EFCQPQMG.cjs} +3 -3
  46. package/dist/{chunk-K3F2E6GS.cjs → chunk-EJQT6KZN.cjs} +2 -2
  47. package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
  48. package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
  49. package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
  50. package/dist/{chunk-WNNYOOIB.mjs → chunk-F6Z3Y5KL.mjs} +1 -1
  51. package/dist/{chunk-PQDFUSXD.cjs → chunk-F7JZENPF.cjs} +33 -32
  52. package/dist/{chunk-TDFPACVX.cjs → chunk-FTFYRMQQ.cjs} +18 -18
  53. package/dist/{chunk-657WJNRY.mjs → chunk-G5RT7EXW.mjs} +1 -1
  54. package/dist/{chunk-MOKLYNHV.cjs → chunk-GFHLGIYC.cjs} +6 -6
  55. package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
  56. package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
  57. package/dist/{chunk-GNSDTTWZ.mjs → chunk-HMIJDL7S.mjs} +1 -1
  58. package/dist/{chunk-PXKIEXZD.mjs → chunk-HUMR6LSU.mjs} +1 -1
  59. package/dist/{chunk-SJVKK4JE.cjs → chunk-ICUQICNC.cjs} +912 -718
  60. package/dist/{chunk-P64MIF5B.cjs → chunk-IPXLADVO.cjs} +387 -25
  61. package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
  62. package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
  63. package/dist/chunk-NRDBW4MP.mjs +45 -0
  64. package/dist/chunk-OFZUJMCU.mjs +601 -0
  65. package/dist/{chunk-VCCUOMQN.mjs → chunk-OKZUAXHF.mjs} +1 -1
  66. package/dist/{chunk-EM6SBQKM.cjs → chunk-OMVAU7NT.cjs} +27 -2
  67. package/dist/{chunk-O27L4YAA.mjs → chunk-PDOCJ6RY.mjs} +2 -2
  68. package/dist/{chunk-36MK5YCW.cjs → chunk-PFQKNERH.cjs} +346 -206
  69. package/dist/{chunk-HR5KPHC2.mjs → chunk-Q3VLETLE.mjs} +1 -1
  70. package/dist/{chunk-LR5QSC2P.mjs → chunk-QAU5JD57.mjs} +211 -71
  71. package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
  72. package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
  73. package/dist/{chunk-ZHPHJPQP.cjs → chunk-RU3M2FIK.cjs} +18 -14
  74. package/dist/{chunk-JDPAKVS4.mjs → chunk-SAZVVAJH.mjs} +3 -3
  75. package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
  76. package/dist/{chunk-QCFFHV5H.mjs → chunk-SMHH4VDG.mjs} +1 -1
  77. package/dist/{chunk-U4PTAHW3.mjs → chunk-SOMHP6GF.mjs} +7 -11
  78. package/dist/{chunk-VHANUNEG.mjs → chunk-UAORZ7QA.mjs} +2 -2
  79. package/dist/{chunk-NGVORZVZ.mjs → chunk-UJD4PHYB.mjs} +15 -11
  80. package/dist/{chunk-U74I55WB.cjs → chunk-ULAWS2PA.cjs} +13 -3
  81. package/dist/{chunk-MPEYMSCF.cjs → chunk-VFQT3LAO.cjs} +5 -5
  82. package/dist/{chunk-Z2YLTERK.cjs → chunk-VZJR7UTG.cjs} +6 -6
  83. package/dist/chunk-WWFTAUFG.cjs +45 -0
  84. package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
  85. package/dist/{chunk-QGYRXFU2.cjs → chunk-X6W5FFH6.cjs} +8 -8
  86. package/dist/{chunk-MIDIZJZC.cjs → chunk-XBML5KMG.cjs} +8 -8
  87. package/dist/{chunk-G26MUMKL.cjs → chunk-XCACDAZZ.cjs} +4 -4
  88. package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
  89. package/dist/{chunk-XF7Q24PF.mjs → chunk-Y7RKTKYI.mjs} +25 -0
  90. package/dist/{chunk-ODBZYBAB.cjs → chunk-YC6V7PWE.cjs} +1 -1
  91. package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
  92. package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
  93. package/dist/chunk-YSLWRWWP.cjs +601 -0
  94. package/dist/{chunk-3VSKDFAT.mjs → chunk-YULD7ICZ.mjs} +1 -1
  95. package/dist/chunk-ZLAT2CWY.mjs +135 -0
  96. package/dist/{chunk-T5CERMEH.cjs → chunk-ZXGAFZDO.cjs} +2 -2
  97. package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-CvIslxWi.d.mts} +207 -7
  98. package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-HIyulDym.d.ts} +207 -7
  99. package/dist/client-plugins.d.mts +4 -5
  100. package/dist/client-plugins.d.ts +4 -5
  101. package/dist/client.cjs +5 -5
  102. package/dist/client.d.mts +8 -9
  103. package/dist/client.d.ts +8 -9
  104. package/dist/client.mjs +4 -4
  105. package/dist/config.d.mts +4 -5
  106. package/dist/config.d.ts +4 -5
  107. package/dist/{devtools-HU6Y2MNV.cjs → devtools-EAUY43BS.cjs} +9 -9
  108. package/dist/{devtools-RNXCTS4R.mjs → devtools-EE5RIBTH.mjs} +8 -8
  109. package/dist/docs.cjs +12 -12
  110. package/dist/docs.d.mts +41 -4
  111. package/dist/docs.d.ts +41 -4
  112. package/dist/docs.mjs +11 -11
  113. package/dist/i18n/client.d.mts +2 -2
  114. package/dist/i18n/client.d.ts +2 -2
  115. package/dist/i18n/index.d.mts +3 -3
  116. package/dist/i18n/index.d.ts +3 -3
  117. package/dist/i18n/server.d.mts +5 -5
  118. package/dist/i18n/server.d.ts +5 -5
  119. package/dist/image/server.cjs +3 -3
  120. package/dist/image/server.mjs +2 -2
  121. package/dist/image/sharp.cjs +10 -10
  122. package/dist/image/sharp.mjs +2 -2
  123. package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
  124. package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
  125. package/dist/index.cjs +38 -35
  126. package/dist/index.d.mts +19 -20
  127. package/dist/index.d.ts +19 -20
  128. package/dist/index.mjs +37 -34
  129. package/dist/integrations.cjs +3 -3
  130. package/dist/integrations.d.mts +4 -5
  131. package/dist/integrations.d.ts +4 -5
  132. package/dist/integrations.mjs +2 -2
  133. package/dist/internal/app-markdown-runtime.cjs +4 -4
  134. package/dist/internal/app-markdown-runtime.d.mts +5 -6
  135. package/dist/internal/app-markdown-runtime.d.ts +5 -6
  136. package/dist/internal/app-markdown-runtime.mjs +3 -3
  137. package/dist/internal/build-runtime.cjs +26 -26
  138. package/dist/internal/build-runtime.d.mts +6 -7
  139. package/dist/internal/build-runtime.d.ts +6 -7
  140. package/dist/internal/build-runtime.mjs +25 -25
  141. package/dist/internal/cli-runtime.cjs +13 -13
  142. package/dist/internal/cli-runtime.mjs +12 -12
  143. package/dist/internal/client-error-overlay.cjs +6 -6
  144. package/dist/internal/client-error-overlay.mjs +2 -2
  145. package/dist/internal/client-runtime.cjs +2 -2
  146. package/dist/internal/client-runtime.mjs +1 -1
  147. package/dist/internal/compression-runtime.d.mts +4 -5
  148. package/dist/internal/compression-runtime.d.ts +4 -5
  149. package/dist/internal/config-runtime.cjs +9 -9
  150. package/dist/internal/config-runtime.d.mts +5 -6
  151. package/dist/internal/config-runtime.d.ts +5 -6
  152. package/dist/internal/config-runtime.mjs +8 -8
  153. package/dist/internal/isolated-boundary.cjs +3 -2
  154. package/dist/internal/isolated-boundary.d.mts +1 -0
  155. package/dist/internal/isolated-boundary.d.ts +1 -0
  156. package/dist/internal/isolated-boundary.mjs +2 -1
  157. package/dist/internal/metadata-image-runtime.cjs +3 -3
  158. package/dist/internal/metadata-image-runtime.mjs +2 -2
  159. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  160. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  161. package/dist/internal/production-runtime.cjs +47 -23
  162. package/dist/internal/production-runtime.d.mts +58 -18
  163. package/dist/internal/production-runtime.d.ts +58 -18
  164. package/dist/internal/production-runtime.mjs +43 -19
  165. package/dist/internal/server-tree.cjs +12 -0
  166. package/dist/internal/server-tree.d.mts +27 -0
  167. package/dist/internal/server-tree.d.ts +27 -0
  168. package/dist/internal/server-tree.mjs +12 -0
  169. package/dist/markdown.cjs +3 -3
  170. package/dist/markdown.d.mts +4 -5
  171. package/dist/markdown.d.ts +4 -5
  172. package/dist/markdown.mjs +2 -2
  173. package/dist/{metadata-Cjs8JMRM.d.ts → metadata-BnLDsUOS.d.ts} +16 -2
  174. package/dist/{metadata-2HSU2i_w.d.mts → metadata-WGpBYcGn.d.mts} +16 -2
  175. package/dist/middleware.cjs +4 -4
  176. package/dist/middleware.d.mts +6 -7
  177. package/dist/middleware.d.ts +6 -7
  178. package/dist/middleware.mjs +3 -3
  179. package/dist/navigation.cjs +5 -5
  180. package/dist/navigation.d.mts +7 -8
  181. package/dist/navigation.d.ts +7 -8
  182. package/dist/navigation.mjs +4 -4
  183. package/dist/{nitro-4XGPNIK4.mjs → nitro-MXRDCXWZ.mjs} +2 -2
  184. package/dist/{nitro-HSAQFXSS.cjs → nitro-OVPLKPE2.cjs} +3 -3
  185. package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
  186. package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
  187. package/dist/observability.d.mts +1 -1
  188. package/dist/observability.d.ts +1 -1
  189. package/dist/plugin.cjs +22 -22
  190. package/dist/plugin.d.mts +4 -5
  191. package/dist/plugin.d.ts +4 -5
  192. package/dist/plugin.mjs +21 -21
  193. package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-0sRnuYc-.d.mts} +4 -4
  194. package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-Crq6CJ-2.d.ts} +4 -4
  195. package/dist/query/client.cjs +6 -6
  196. package/dist/query/client.mjs +2 -2
  197. package/dist/{render-plan-D72O1qm4.d.ts → render-plan-8ozZh2Qv.d.ts} +1 -1
  198. package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-gs9GGPzw.d.mts} +1 -1
  199. package/dist/renderer/react/server.cjs +10 -4
  200. package/dist/renderer/react/server.d.mts +2 -1
  201. package/dist/renderer/react/server.d.ts +2 -1
  202. package/dist/renderer/react/server.mjs +7 -1
  203. package/dist/renderer-client.cjs +5 -5
  204. package/dist/renderer-client.d.mts +6 -7
  205. package/dist/renderer-client.d.ts +6 -7
  206. package/dist/renderer-client.mjs +2 -2
  207. package/dist/renderer.d.mts +2 -0
  208. package/dist/renderer.d.ts +2 -0
  209. package/dist/{request-DbyOYI2j.d.ts → request-B5G8rLBH.d.ts} +1 -1
  210. package/dist/{request-Be83WafN.d.mts → request-fkhiynXe.d.mts} +1 -1
  211. package/dist/request.d.mts +5 -6
  212. package/dist/request.d.ts +5 -6
  213. package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
  214. package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
  215. package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-CLnS7AZj.d.mts} +1 -1
  216. package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-lS5nUMua.d.ts} +1 -1
  217. package/dist/{router-D94-SDlW.d.ts → router-4iuiYnOW.d.ts} +1 -1
  218. package/dist/{router-ALUvm8gC.d.mts → router-ifU8Dui1.d.mts} +1 -1
  219. package/dist/routes.d.mts +4 -5
  220. package/dist/routes.d.ts +4 -5
  221. package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
  222. package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
  223. package/dist/server-action-security.cjs +3 -3
  224. package/dist/server-action-security.mjs +2 -2
  225. package/dist/server-fn.cjs +4 -4
  226. package/dist/server-fn.mjs +3 -3
  227. package/dist/server-plugins.d.mts +5 -6
  228. package/dist/server-plugins.d.ts +5 -6
  229. package/dist/server-query.cjs +5 -5
  230. package/dist/server-query.mjs +4 -4
  231. package/dist/server.cjs +41 -41
  232. package/dist/server.d.mts +13 -14
  233. package/dist/server.d.ts +13 -14
  234. package/dist/server.mjs +24 -24
  235. package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-Bq7VCOwx.d.mts} +3 -3
  236. package/dist/{spa-router-CxK3USIz.d.ts → spa-router-DaJk5Re4.d.ts} +3 -3
  237. package/dist/testing.cjs +7 -7
  238. package/dist/testing.d.mts +4 -5
  239. package/dist/testing.d.ts +4 -5
  240. package/dist/testing.mjs +5 -5
  241. package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
  242. package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
  243. package/dist/{utils-311Y8eoK.d.ts → utils-BXLmFsVR.d.ts} +1 -1
  244. package/dist/{utils-4wVRcpOw.d.mts → utils-XJn0c9bj.d.mts} +1 -1
  245. package/dist/version.cjs +2 -2
  246. package/dist/version.mjs +1 -1
  247. package/dist/vite.cjs +22 -22
  248. package/dist/vite.d.mts +4 -5
  249. package/dist/vite.d.ts +4 -5
  250. package/dist/vite.mjs +21 -21
  251. package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
  252. package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
  253. package/dist/workflows.cjs +3 -3
  254. package/dist/workflows.d.mts +1 -1
  255. package/dist/workflows.d.ts +1 -1
  256. package/dist/workflows.mjs +2 -2
  257. package/package.json +9 -1
  258. package/dist/chunk-M64YUMA4.cjs +0 -58
  259. package/dist/chunk-QLQ32WC4.mjs +0 -58
  260. package/dist/types-DFbjpjXX.d.mts +0 -105
  261. package/dist/types-DFbjpjXX.d.ts +0 -105
@@ -3,7 +3,7 @@
3
3
  var _chunkOWOUTKIJcjs = require('./chunk-OWOUTKIJ.cjs');
4
4
 
5
5
 
6
- var _chunkZHPHJPQPcjs = require('./chunk-ZHPHJPQP.cjs');
6
+ var _chunkRU3M2FIKcjs = require('./chunk-RU3M2FIK.cjs');
7
7
 
8
8
 
9
9
  var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
@@ -15,14 +15,18 @@ var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
15
15
  var _chunkTKJZFIMLcjs = require('./chunk-TKJZFIML.cjs');
16
16
 
17
17
 
18
- var _chunkM64YUMA4cjs = require('./chunk-M64YUMA4.cjs');
18
+
19
+ var _chunk75RZHGLScjs = require('./chunk-75RZHGLS.cjs');
20
+
21
+
22
+ var _chunkOMVAU7NTcjs = require('./chunk-OMVAU7NT.cjs');
19
23
 
20
24
 
21
25
 
22
26
  var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
23
27
 
24
28
 
25
- var _chunkODBZYBABcjs = require('./chunk-ODBZYBAB.cjs');
29
+ var _chunkYC6V7PWEcjs = require('./chunk-YC6V7PWE.cjs');
26
30
 
27
31
 
28
32
  var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
@@ -33,6 +37,184 @@ var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
33
37
 
34
38
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
35
39
 
40
+ // src/routing/route-groups.ts
41
+ function isRouteGroupSegment(part) {
42
+ return part.startsWith("(") && part.endsWith(")");
43
+ }
44
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isRouteGroupSegment, "isRouteGroupSegment");
45
+ function formatRouteSegment(segment) {
46
+ if (!segment.isDynamic) return segment.segment;
47
+ if (segment.isCatchAll) {
48
+ return segment.isOptional ? `[[...${segment.segment}]]` : `[...${segment.segment}]`;
49
+ }
50
+ return `[${segment.segment}]`;
51
+ }
52
+ _chunkS3JO3N4Hcjs.__name.call(void 0, formatRouteSegment, "formatRouteSegment");
53
+ function createRouteDirectoryPattern(route) {
54
+ const parts = route.filePath.replace(/\\/g, "/").split("/").filter(Boolean);
55
+ parts.pop();
56
+ if (parts.length === 0) return "/";
57
+ let segmentIndex = 0;
58
+ const directory = parts.map((part) => {
59
+ if (isRouteGroupSegment(part)) return part;
60
+ const segment = route.segments[segmentIndex++];
61
+ return segment ? formatRouteSegment(segment) : part;
62
+ });
63
+ return `/${directory.join("/")}`;
64
+ }
65
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createRouteDirectoryPattern, "createRouteDirectoryPattern");
66
+ function stripRouteGroups(pattern) {
67
+ if (!pattern.includes("(")) return pattern;
68
+ const parts = pattern.split("/").filter((part) => part && !isRouteGroupSegment(part));
69
+ return parts.length === 0 ? "/" : `/${parts.join("/")}`;
70
+ }
71
+ _chunkS3JO3N4Hcjs.__name.call(void 0, stripRouteGroups, "stripRouteGroups");
72
+ function getRouteGroupScope(pattern) {
73
+ if (!pattern.includes("(")) return null;
74
+ const parts = pattern.split("/");
75
+ for (let index = parts.length - 1; index > 0; index--) {
76
+ if (isRouteGroupSegment(parts[index])) return parts.slice(0, index + 1).join("/");
77
+ }
78
+ return null;
79
+ }
80
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getRouteGroupScope, "getRouteGroupScope");
81
+ function isInRouteGroupScope(directory, scope) {
82
+ if (scope === null) return true;
83
+ if (typeof directory !== "string") return false;
84
+ return directory === scope || directory.startsWith(`${scope}/`);
85
+ }
86
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isInRouteGroupScope, "isInRouteGroupScope");
87
+ function getRouteDirectoryDepth(pattern) {
88
+ return pattern.split("/").filter(Boolean).length;
89
+ }
90
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getRouteDirectoryDepth, "getRouteDirectoryDepth");
91
+ function routeBoundaryCoversDirectory(boundaryPattern, directory) {
92
+ const boundaryUrl = stripRouteGroups(boundaryPattern);
93
+ const routeUrl = stripRouteGroups(directory);
94
+ return (boundaryUrl === "/" || routeUrl === boundaryUrl || routeUrl.startsWith(`${boundaryUrl.replace(/\/$/, "")}/`)) && isInRouteGroupScope(directory, getRouteGroupScope(boundaryPattern));
95
+ }
96
+ _chunkS3JO3N4Hcjs.__name.call(void 0, routeBoundaryCoversDirectory, "routeBoundaryCoversDirectory");
97
+
98
+ // src/server/full-document.ts
99
+ var CONTENTS_WRAPPER = /^<div\b[^>]*style="display\s*:\s*contents"[^>]*>/i;
100
+ var HOISTED_HEAD_ELEMENT = /^(?:<(?:meta|link|base)\b[^>]*>|<title\b[^>]*>[\s\S]*?<\/title>|<script\b[^>]*\basync\b[^>]*><\/script>|<style\b[^>]*\bdata-precedence\b[^>]*>[\s\S]*?<\/style>)/i;
101
+ function peelDocumentPrefix(markup) {
102
+ let inner = markup.replace(/^\s+/, "");
103
+ let hoisted = "";
104
+ let match;
105
+ while (match = _nullishCoalesce(CONTENTS_WRAPPER.exec(inner), () => ( HOISTED_HEAD_ELEMENT.exec(inner)))) {
106
+ if (!/^<div/i.test(match[0])) hoisted += match[0];
107
+ inner = inner.slice(match[0].length).replace(/^\s+/, "");
108
+ }
109
+ return { inner, hoisted };
110
+ }
111
+ _chunkS3JO3N4Hcjs.__name.call(void 0, peelDocumentPrefix, "peelDocumentPrefix");
112
+ function restoreHoistedHead(document, hoisted) {
113
+ if (!hoisted) return document;
114
+ if (/<head[\s>]/i.test(document)) {
115
+ return document.replace(/<head\b[^>]*>/i, (open) => open + hoisted);
116
+ }
117
+ return document.replace(/<html\b[^>]*>/i, (open) => `${open}<head>${hoisted}</head>`);
118
+ }
119
+ _chunkS3JO3N4Hcjs.__name.call(void 0, restoreHoistedHead, "restoreHoistedHead");
120
+ function extractFarmFullDocument(markup) {
121
+ const { inner, hoisted } = peelDocumentPrefix(markup);
122
+ if (!/^<!doctype/i.test(inner) && !/^<html[\s>]/i.test(inner)) return null;
123
+ const start = markup.search(/<!doctype|<html[\s>]/i);
124
+ const lower = markup.toLowerCase();
125
+ let closeIndex = lower.lastIndexOf("</html>");
126
+ if (lower.length !== markup.length) {
127
+ closeIndex = -1;
128
+ const closing = /<\/html>/gi;
129
+ let match;
130
+ while (match = closing.exec(markup)) closeIndex = match.index;
131
+ }
132
+ if (start < 0 || closeIndex < 0) return null;
133
+ const closeEnd = closeIndex + "</html>".length;
134
+ let document = markup.slice(start, closeEnd);
135
+ const streamedTail = markup.slice(closeEnd).replace(/^(?:\s*<\/div>)+/i, "").trim();
136
+ if (streamedTail) {
137
+ document = document.replace(/<\/body>/i, () => `${streamedTail}</body>`);
138
+ }
139
+ return restoreHoistedHead(document, hoisted);
140
+ }
141
+ _chunkS3JO3N4Hcjs.__name.call(void 0, extractFarmFullDocument, "extractFarmFullDocument");
142
+ function classifyFarmDocumentPrefix(markup) {
143
+ const { inner } = peelDocumentPrefix(markup);
144
+ if (/^<!doctype/i.test(inner) || /^<html[\s>]/i.test(inner)) return "document";
145
+ return inner === "" ? "pending" : "fragment";
146
+ }
147
+ _chunkS3JO3N4Hcjs.__name.call(void 0, classifyFarmDocumentPrefix, "classifyFarmDocumentPrefix");
148
+ function ensureFarmDocumentHead(markup) {
149
+ if (/<head[\s>]/i.test(markup)) return markup;
150
+ return markup.replace(/<html([^>]*)>/i, (_match, attributes) => {
151
+ return `<html${attributes}><head></head>`;
152
+ });
153
+ }
154
+ _chunkS3JO3N4Hcjs.__name.call(void 0, ensureFarmDocumentHead, "ensureFarmDocumentHead");
155
+ function ensureFarmDocumentRoot(markup) {
156
+ if (/\sid=["']root["']/i.test(markup)) return markup;
157
+ return markup.replace(
158
+ /<body\b([^>]*)>/i,
159
+ (_match, attributes) => `<body${attributes}><div id="root">`
160
+ ).replace(/<\/body>/i, () => "</div></body>");
161
+ }
162
+ _chunkS3JO3N4Hcjs.__name.call(void 0, ensureFarmDocumentRoot, "ensureFarmDocumentRoot");
163
+ function hasFarmDocumentIcon(markup) {
164
+ return /<link\b[^>]*\brel=["']?(?:shortcut )?icon\b/i.test(markup);
165
+ }
166
+ _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmDocumentIcon, "hasFarmDocumentIcon");
167
+ function removeFarmDocumentTitles(markup) {
168
+ return markup.replace(/<title\b[^>]*>[\s\S]*?<\/title>\s*/gi, "");
169
+ }
170
+ _chunkS3JO3N4Hcjs.__name.call(void 0, removeFarmDocumentTitles, "removeFarmDocumentTitles");
171
+ function ensureFarmDocumentMeta(markup, viewport = "") {
172
+ const head = _nullishCoalesce(_optionalChain([/<head\b[^>]*>([\s\S]*?)<\/head>/i, 'access', _ => _.exec, 'call', _2 => _2(markup), 'optionalAccess', _3 => _3[1]]), () => ( ""));
173
+ const hasNamedMeta = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (name) => new RegExp(`<meta\\b[^>]*\\bname=["']?${name}(?=["'\\s/>])`, "i").test(head), "hasNamedMeta");
174
+ const tags = [
175
+ /<meta\b[^>]*\bcharset\s*=/i.test(head) ? "" : '<meta charset="utf-8">',
176
+ ...(_nullishCoalesce(viewport.match(/<meta\b[^>]*>/gi), () => ( []))).filter((tag) => {
177
+ const name = _optionalChain([/\bname="([\w-]+)"/, 'access', _4 => _4.exec, 'call', _5 => _5(tag), 'optionalAccess', _6 => _6[1]]);
178
+ return !name || !hasNamedMeta(name);
179
+ })
180
+ ].filter(Boolean);
181
+ if (tags.length === 0) return markup;
182
+ return markup.replace(/<head\b[^>]*>/i, (open) => `${open}${tags.join("")}`);
183
+ }
184
+ _chunkS3JO3N4Hcjs.__name.call(void 0, ensureFarmDocumentMeta, "ensureFarmDocumentMeta");
185
+ function composeFarmFullDocument(documentHtml, assets) {
186
+ let html = ensureFarmDocumentMeta(ensureFarmDocumentHead(documentHtml), assets.viewport);
187
+ if (assets.htmlAttributes) {
188
+ html = html.replace(/<html\b([^>]*)>/i, (_match, attrs) => {
189
+ let nextAttributes = attrs;
190
+ for (const name of _nullishCoalesce(assets.replaceHtmlAttributes, () => ( []))) {
191
+ const escapedName = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
192
+ nextAttributes = nextAttributes.replace(
193
+ new RegExp("\\s+" + escapedName + `=(?:"[^"]*"|'[^']*'|[^\\s>]+)`, "gi"),
194
+ ""
195
+ );
196
+ }
197
+ return `<html${nextAttributes}${assets.htmlAttributes}>`;
198
+ });
199
+ }
200
+ html = ensureFarmDocumentRoot(html);
201
+ const headAssets = [
202
+ assets.fallbackIcon && !hasFarmDocumentIcon(html) ? '<link rel="icon" href="data:,">' : "",
203
+ assets.headAssets
204
+ ].filter(Boolean).join("\n ");
205
+ if (headAssets) {
206
+ html = html.replace(/<\/head>/i, () => ` ${headAssets}
207
+ </head>`);
208
+ }
209
+ if (assets.bodyFooter) {
210
+ html = html.replace(/<\/body>/i, () => ` ${assets.bodyFooter}
211
+ </body>`);
212
+ }
213
+ return /^\s*<!doctype/i.test(html) ? html : `<!DOCTYPE html>
214
+ ${html}`;
215
+ }
216
+ _chunkS3JO3N4Hcjs.__name.call(void 0, composeFarmFullDocument, "composeFarmFullDocument");
217
+
36
218
  // src/i18n/alternates.ts
37
219
  function renderFarmLocaleAlternateLinks(pathname, config, options = {}) {
38
220
  if (config.routing === "none") return "";
@@ -129,7 +311,7 @@ function serializeSitemap(value) {
129
311
  return candidate;
130
312
  });
131
313
  const hasLanguageAlternates = entries.some(
132
- (entry) => _optionalChain([entry, 'access', _ => _.alternates, 'optionalAccess', _2 => _2.languages]) && Object.keys(entry.alternates.languages).length > 0
314
+ (entry) => _optionalChain([entry, 'access', _7 => _7.alternates, 'optionalAccess', _8 => _8.languages]) && Object.keys(entry.alternates.languages).length > 0
133
315
  );
134
316
  const namespace = hasLanguageAlternates ? ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' : "";
135
317
  const lines = [
@@ -148,7 +330,7 @@ function serializeSitemap(value) {
148
330
  if (entry.priority !== void 0) {
149
331
  lines.push(` <priority>${escapeXml(entry.priority)}</priority>`);
150
332
  }
151
- for (const [language, href] of Object.entries(_optionalChain([entry, 'access', _3 => _3.alternates, 'optionalAccess', _4 => _4.languages]) || {})) {
333
+ for (const [language, href] of Object.entries(_optionalChain([entry, 'access', _9 => _9.alternates, 'optionalAccess', _10 => _10.languages]) || {})) {
152
334
  lines.push(
153
335
  ` <xhtml:link rel="alternate" hreflang="${escapeXml(language)}" href="${escapeXml(href)}" />`
154
336
  );
@@ -216,7 +398,7 @@ function createFarmMetadataRouteResponse(kind, value, routeModule = {}, options
216
398
  if (isResponse(value)) {
217
399
  return method === "HEAD" ? _chunkTKJZFIMLcjs.omitFarmResponseBody.call(void 0, value) : value;
218
400
  }
219
- const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ? _chunkZHPHJPQPcjs.serializeFarmLlmsTxt.call(void 0, value) : serializeManifest(value);
401
+ const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ? _chunkRU3M2FIKcjs.serializeFarmLlmsTxt.call(void 0, value) : serializeManifest(value);
220
402
  const contentType = kind === "sitemap" ? "application/xml; charset=utf-8" : kind === "robots" || kind === "llms" || kind === "llms-full" ? "text/plain; charset=utf-8" : "application/manifest+json; charset=utf-8";
221
403
  return new Response(method === "HEAD" ? null : body, {
222
404
  headers: {
@@ -228,6 +410,171 @@ function createFarmMetadataRouteResponse(kind, value, routeModule = {}, options
228
410
  }
229
411
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmMetadataRouteResponse, "createFarmMetadataRouteResponse");
230
412
 
413
+ // src/ai-catalog.ts
414
+ var FARM_AI_CATALOG_PATH = "/.well-known/ai-catalog.json";
415
+ var FARM_ARD_PATH = "/.well-known/ard.json";
416
+ var FARM_MCP_SERVER_CARD_SUFFIX = "/server-card";
417
+ var SERVER_CARD_SCHEMA = "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";
418
+ var SERVER_CARD_TYPE = "application/mcp-server-card+json";
419
+ var AI_CATALOG_TYPE = "application/ai-catalog+json";
420
+ var CARD_DESCRIPTION_MAX = 100;
421
+ var REVERSE_DNS_NAME = /^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;
422
+ function listFarmMCPServerSources(input) {
423
+ const sources = /* @__PURE__ */ new Map();
424
+ for (const { server, details } of _chunk75RZHGLScjs._listFarmMCPCatalogs.call(void 0, )) {
425
+ const endpoint = _chunkKNBBQHO2cjs.resolveFarmAPIServerRoutePath.call(void 0, server.path, input.apiServerBasePath);
426
+ if (sources.has(endpoint)) continue;
427
+ sources.set(endpoint, {
428
+ ...server,
429
+ protocolVersions: _optionalChain([details, 'optionalAccess', _11 => _11.protocolVersions]),
430
+ endpoint,
431
+ local: true
432
+ });
433
+ }
434
+ for (const server of _chunk75RZHGLScjs._listFarmRegisteredMCPServers.call(void 0, )) {
435
+ const endpoint = server.path ? _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, server.path, input.basePath) : server.url;
436
+ if (sources.has(endpoint)) continue;
437
+ sources.set(endpoint, { ...server, endpoint, local: Boolean(server.path) });
438
+ }
439
+ return [...sources.values()];
440
+ }
441
+ _chunkS3JO3N4Hcjs.__name.call(void 0, listFarmMCPServerSources, "listFarmMCPServerSources");
442
+ function serverCardLocation(endpoint) {
443
+ return `${endpoint.replace(/\/$/, "")}${FARM_MCP_SERVER_CARD_SUFFIX}`;
444
+ }
445
+ _chunkS3JO3N4Hcjs.__name.call(void 0, serverCardLocation, "serverCardLocation");
446
+ function listFarmMCPServerCards(origin, input = {}) {
447
+ const host = new URL(origin).hostname;
448
+ return listFarmMCPServerSources(input).map((server) => {
449
+ const endpointUrl = server.local ? `${origin}${server.endpoint}` : server.endpoint;
450
+ const cardPath = server.local ? serverCardLocation(server.endpoint) : void 0;
451
+ const slug = cardSlug(server.name);
452
+ const description = truncate(_optionalChain([server, 'access', _12 => _12.description, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]) || `MCP server for ${host}`);
453
+ const card = {
454
+ $schema: SERVER_CARD_SCHEMA,
455
+ // The card's name is reverse-DNS; a plain server name is namespaced by the host.
456
+ name: REVERSE_DNS_NAME.test(server.name) ? server.name : `${cardNamespace(host)}/${slug}`,
457
+ version: server.version,
458
+ description,
459
+ ...server.title ? { title: server.title } : {},
460
+ websiteUrl: `${origin}${_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, "/", input.basePath).replace(/(.)\/$/, "$1")}`,
461
+ remotes: [
462
+ {
463
+ type: "streamable-http",
464
+ url: endpointUrl,
465
+ ..._optionalChain([server, 'access', _15 => _15.protocolVersions, 'optionalAccess', _16 => _16.length]) ? { supportedProtocolVersions: [...server.protocolVersions] } : {}
466
+ }
467
+ ]
468
+ };
469
+ return {
470
+ ...cardPath ? { cardPath } : {},
471
+ card,
472
+ entry: {
473
+ identifier: `urn:air:${host}:mcp:${slug}`,
474
+ type: SERVER_CARD_TYPE,
475
+ url: cardPath ? `${origin}${cardPath}` : serverCardLocation(endpointUrl),
476
+ displayName: _nullishCoalesce(server.title, () => ( server.name)),
477
+ description,
478
+ version: server.version
479
+ }
480
+ };
481
+ });
482
+ }
483
+ _chunkS3JO3N4Hcjs.__name.call(void 0, listFarmMCPServerCards, "listFarmMCPServerCards");
484
+ function listFarmMCPLlmsTxtLinks(origin, input = {}) {
485
+ const servers = listFarmMCPServerCards(origin, input);
486
+ if (!servers.length) return [];
487
+ return [
488
+ ...servers.map(({ card, entry }) => ({
489
+ title: entry.displayName,
490
+ url: card.remotes[0].url,
491
+ description: `${card.description} (Streamable HTTP MCP endpoint; server card at ${entry.url})`
492
+ })),
493
+ {
494
+ title: "AI catalog",
495
+ url: `${origin}${_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, FARM_AI_CATALOG_PATH, input.basePath)}`,
496
+ description: "MCP server cards for this site"
497
+ }
498
+ ];
499
+ }
500
+ _chunkS3JO3N4Hcjs.__name.call(void 0, listFarmMCPLlmsTxtLinks, "listFarmMCPLlmsTxtLinks");
501
+ function createFarmAiCatalogResponse(request, input = {}, requestUrl) {
502
+ let url;
503
+ try {
504
+ url = _nullishCoalesce(requestUrl, () => ( new URL(request.url)));
505
+ } catch (e3) {
506
+ return null;
507
+ }
508
+ const { pathname } = url;
509
+ if (!pathname.endsWith(FARM_MCP_SERVER_CARD_SUFFIX) && !pathname.includes("/.well-known/")) {
510
+ return null;
511
+ }
512
+ const ard = pathname === _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, FARM_ARD_PATH, input.basePath);
513
+ const catalogPath = ard || pathname === _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, FARM_AI_CATALOG_PATH, input.basePath);
514
+ if (!catalogPath && !pathname.endsWith(FARM_MCP_SERVER_CARD_SUFFIX)) return null;
515
+ const servers = listFarmMCPServerCards(url.origin, input);
516
+ const card = catalogPath ? void 0 : servers.find((server) => server.cardPath === pathname);
517
+ if (!servers.length || !catalogPath && !card) return null;
518
+ const method = request.method.toUpperCase();
519
+ if (method === "OPTIONS") return new Response(null, { status: 204, headers: corsHeaders() });
520
+ if (method !== "GET" && method !== "HEAD") {
521
+ return new Response("Method Not Allowed", {
522
+ status: 405,
523
+ headers: { ...corsHeaders(), Allow: "GET, HEAD, OPTIONS", "Content-Type": "text/plain" }
524
+ });
525
+ }
526
+ const body = JSON.stringify(
527
+ card ? card.card : { specVersion: "1.0", entries: servers.map(({ entry }) => entry) }
528
+ );
529
+ const etag = `W/"${fnv1a(body)}"`;
530
+ const headers = {
531
+ ...corsHeaders(),
532
+ "Content-Type": card ? `${SERVER_CARD_TYPE}; charset=utf-8` : ard ? "application/json; charset=utf-8" : `${AI_CATALOG_TYPE}; charset=utf-8`,
533
+ // The body names the request's origin, so caches revalidate rather than reuse it.
534
+ "Cache-Control": "public, max-age=0, must-revalidate",
535
+ ETag: etag,
536
+ "X-Content-Type-Options": "nosniff"
537
+ };
538
+ if (_chunkOMVAU7NTcjs.matchesFarmIfNoneMatch.call(void 0, request.headers.get("if-none-match"), etag)) {
539
+ return new Response(null, { status: 304, headers });
540
+ }
541
+ _chunkJ63ZH5OQcjs.emitFarmAgentRead.call(void 0, request, card ? "mcp-server-card" : "ai-catalog", 200);
542
+ return new Response(method === "HEAD" ? null : body, { status: 200, headers });
543
+ }
544
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmAiCatalogResponse, "createFarmAiCatalogResponse");
545
+ function corsHeaders() {
546
+ return {
547
+ "Access-Control-Allow-Origin": "*",
548
+ "Access-Control-Allow-Methods": "GET, HEAD, OPTIONS",
549
+ "Access-Control-Allow-Headers": "Content-Type, If-None-Match",
550
+ "Access-Control-Expose-Headers": "ETag"
551
+ };
552
+ }
553
+ _chunkS3JO3N4Hcjs.__name.call(void 0, corsHeaders, "corsHeaders");
554
+ function cardNamespace(host) {
555
+ if (host.includes(":") || /^\d+(?:\.\d+){3}$/.test(host)) return "local";
556
+ return host.split(".").reverse().join(".");
557
+ }
558
+ _chunkS3JO3N4Hcjs.__name.call(void 0, cardNamespace, "cardNamespace");
559
+ function cardSlug(name) {
560
+ const last = name.includes("/") ? name.slice(name.lastIndexOf("/") + 1) : name;
561
+ return last.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "mcp";
562
+ }
563
+ _chunkS3JO3N4Hcjs.__name.call(void 0, cardSlug, "cardSlug");
564
+ function truncate(text) {
565
+ return text.length <= CARD_DESCRIPTION_MAX ? text : `${text.slice(0, CARD_DESCRIPTION_MAX - 1).trimEnd()}\u2026`;
566
+ }
567
+ _chunkS3JO3N4Hcjs.__name.call(void 0, truncate, "truncate");
568
+ function fnv1a(value) {
569
+ let hash = 2166136261;
570
+ for (let index = 0; index < value.length; index++) {
571
+ hash ^= value.charCodeAt(index);
572
+ hash = Math.imul(hash, 16777619);
573
+ }
574
+ return (hash >>> 0).toString(16).padStart(8, "0");
575
+ }
576
+ _chunkS3JO3N4Hcjs.__name.call(void 0, fnv1a, "fnv1a");
577
+
231
578
  // src/components/error-page.ts
232
579
  var ERROR_STATUS_TEXT = {
233
580
  400: "Bad Request",
@@ -466,8 +813,8 @@ function resolveFarmApiCatalogInput(config) {
466
813
  const mcp = config.mcp && config.mcp.enabled !== false ? config.mcp : void 0;
467
814
  return {
468
815
  basePath: config.basePath,
469
- apiBaseURL: _nullishCoalesce(_optionalChain([config, 'access', _5 => _5.openapi, 'optionalAccess', _6 => _6.servers, 'optionalAccess', _7 => _7[0], 'optionalAccess', _8 => _8.url]), () => ( config.api.baseURL)),
470
- openapi: _optionalChain([config, 'access', _9 => _9.openapi, 'optionalAccess', _10 => _10.enabled]) ? { specRoute: config.openapi.specRoute, route: config.openapi.route } : void 0,
816
+ apiBaseURL: _nullishCoalesce(_optionalChain([config, 'access', _17 => _17.openapi, 'optionalAccess', _18 => _18.servers, 'optionalAccess', _19 => _19[0], 'optionalAccess', _20 => _20.url]), () => ( config.api.baseURL)),
817
+ openapi: _optionalChain([config, 'access', _21 => _21.openapi, 'optionalAccess', _22 => _22.enabled]) ? { specRoute: config.openapi.specRoute, route: config.openapi.route } : void 0,
471
818
  mcpPath: mcp ? _chunkKNBBQHO2cjs.resolveFarmAPIServerRoutePath.call(void 0,
472
819
  _nullishCoalesce(mcp.path, () => ( "/api/mcp")),
473
820
  _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
@@ -479,8 +826,8 @@ function createFarmApiCatalog(input) {
479
826
  const appPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (path) => _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, path, input.basePath), "appPath");
480
827
  const items = [];
481
828
  const contexts = [];
482
- const specRoute = _optionalChain([input, 'access', _11 => _11.openapi, 'optionalAccess', _12 => _12.specRoute]);
483
- const reference = _optionalChain([input, 'access', _13 => _13.openapi, 'optionalAccess', _14 => _14.route]);
829
+ const specRoute = _optionalChain([input, 'access', _23 => _23.openapi, 'optionalAccess', _24 => _24.specRoute]);
830
+ const reference = _optionalChain([input, 'access', _25 => _25.openapi, 'optionalAccess', _26 => _26.route]);
484
831
  if (specRoute || reference) {
485
832
  const api = { anchor: input.apiBaseURL };
486
833
  if (specRoute) {
@@ -526,23 +873,23 @@ var FARM_INFRA_SIGNATURE_HEADER = "farmjs-infra-signature";
526
873
  var SIGNED_PURPOSE = "farmjs-manifest-v1";
527
874
  var SIGNATURE_WINDOW_SECONDS = 300;
528
875
  function resolveFarmAppManifestInput(config, extra) {
529
- const llms = _optionalChain([config, 'access', _15 => _15.agent, 'optionalAccess', _16 => _16.llmsTxt]);
876
+ const llms = _optionalChain([config, 'access', _27 => _27.agent, 'optionalAccess', _28 => _28.llmsTxt]);
530
877
  const plugins = (_nullishCoalesce(config.plugins, () => ( []))).map(({ name }) => name);
531
878
  const webmcp = plugins.includes("farm:webmcp");
532
879
  return {
533
- renderer: _nullishCoalesce(_optionalChain([config, 'access', _17 => _17.renderer, 'optionalAccess', _18 => _18.name]), () => ( "react")),
880
+ renderer: _nullishCoalesce(_optionalChain([config, 'access', _29 => _29.renderer, 'optionalAccess', _30 => _30.name]), () => ( "react")),
534
881
  basePath: config.basePath || "/",
535
882
  build: extra.build,
536
883
  packages: extra.packages,
537
884
  webmcp: { enabled: webmcp, tools: webmcp ? _nullishCoalesce(extra.webmcpTools, () => ( [])) : [] },
538
885
  integrations: Object.entries(_nullishCoalesce(config.integrations, () => ( {}))).flatMap(([key, integration]) => {
539
- const category = _nullishCoalesce(_optionalChain([integration, 'optionalAccess', _19 => _19.category]), () => ( _optionalChain([integration, 'optionalAccess', _20 => _20.slot])));
886
+ const category = _nullishCoalesce(_optionalChain([integration, 'optionalAccess', _31 => _31.category]), () => ( _optionalChain([integration, 'optionalAccess', _32 => _32.slot])));
540
887
  return integration && category && integration.type ? [{ key, category, type: integration.type }] : [];
541
888
  }),
542
889
  agent: {
543
- apiCatalog: _optionalChain([config, 'access', _21 => _21.agent, 'optionalAccess', _22 => _22.apiCatalog]) ? "/.well-known/api-catalog" : null,
890
+ apiCatalog: _optionalChain([config, 'access', _33 => _33.agent, 'optionalAccess', _34 => _34.apiCatalog]) ? "/.well-known/api-catalog" : null,
544
891
  llmsTxt: llms === true || typeof llms === "object" && llms !== null && llms.enabled !== false,
545
- openapi: _optionalChain([config, 'access', _23 => _23.openapi, 'optionalAccess', _24 => _24.enabled]) && config.openapi.specRoute ? config.openapi.specRoute : null
892
+ openapi: _optionalChain([config, 'access', _35 => _35.openapi, 'optionalAccess', _36 => _36.enabled]) && config.openapi.specRoute ? config.openapi.specRoute : null
546
893
  },
547
894
  plugins,
548
895
  analytics: config.analytics !== false
@@ -558,21 +905,21 @@ function createFarmAppManifest(input) {
558
905
  return {
559
906
  schemaVersion: 1,
560
907
  app: {
561
- farm: _chunkODBZYBABcjs.FARM_VERSION,
908
+ farm: _chunkYC6V7PWEcjs.FARM_VERSION,
562
909
  renderer: input.renderer,
563
910
  basePath: input.basePath,
564
911
  build: input.build
565
912
  },
566
913
  packages: input.packages,
567
914
  mcp: {
568
- servers: _chunkM64YUMA4cjs._listFarmMCPCatalogs.call(void 0, ).map(({ server, tools, details }) => ({
915
+ servers: _chunk75RZHGLScjs._listFarmMCPCatalogs.call(void 0, ).map(({ server, tools, details }) => ({
569
916
  name: server.name,
570
917
  version: server.version,
571
918
  path: server.path,
572
- resources: [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _25 => _25.resources]), () => ( []))],
573
- prompts: [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _26 => _26.prompts]), () => ( []))],
919
+ resources: [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _37 => _37.resources]), () => ( []))],
920
+ prompts: [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _38 => _38.prompts]), () => ( []))],
574
921
  tools: tools.map((tool) => {
575
- const schemas = _optionalChain([details, 'optionalAccess', _27 => _27.schemas, 'optionalAccess', _28 => _28[tool.name]]);
922
+ const schemas = _optionalChain([details, 'optionalAccess', _39 => _39.schemas, 'optionalAccess', _40 => _40[tool.name]]);
576
923
  const hints = Object.fromEntries(
577
924
  ["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"].filter((hint) => typeof tool[hint] === "boolean").map((hint) => [hint, tool[hint]])
578
925
  );
@@ -584,7 +931,7 @@ function createFarmAppManifest(input) {
584
931
  ...tool.kind === "endpoint" ? { method: tool.method, path: tool.path } : {},
585
932
  ...hints,
586
933
  ...schemas ? { inputSchema: schemas.input } : {},
587
- ..._optionalChain([schemas, 'optionalAccess', _29 => _29.output]) ? { outputSchema: schemas.output } : {}
934
+ ..._optionalChain([schemas, 'optionalAccess', _41 => _41.output]) ? { outputSchema: schemas.output } : {}
588
935
  };
589
936
  })
590
937
  }))
@@ -625,7 +972,7 @@ async function verifyFarmInfraManifestSignature(header, key, now = Date.now()) {
625
972
  if (!header || header.length > 2048) return false;
626
973
  const parts = header.split(",").map((part) => part.trim());
627
974
  const timestamp = Number(
628
- _optionalChain([/^t=(\d{1,12})$/, 'access', _30 => _30.exec, 'call', _31 => _31(_nullishCoalesce(parts.find((part) => part.startsWith("t=")), () => ( ""))), 'optionalAccess', _32 => _32[1]])
975
+ _optionalChain([/^t=(\d{1,12})$/, 'access', _42 => _42.exec, 'call', _43 => _43(_nullishCoalesce(parts.find((part) => part.startsWith("t=")), () => ( ""))), 'optionalAccess', _44 => _44[1]])
629
976
  );
630
977
  if (!Number.isSafeInteger(timestamp)) return false;
631
978
  if (Math.abs(now / 1e3 - timestamp) > SIGNATURE_WINDOW_SECONDS) return false;
@@ -637,13 +984,13 @@ ${timestamp}`);
637
984
  }
638
985
  _chunkS3JO3N4Hcjs.__name.call(void 0, verifyFarmInfraManifestSignature, "verifyFarmInfraManifestSignature");
639
986
  function processEnv() {
640
- return _nullishCoalesce(_optionalChain([globalThis, 'access', _33 => _33.process, 'optionalAccess', _34 => _34.env]), () => ( {}));
987
+ return _nullishCoalesce(_optionalChain([globalThis, 'access', _45 => _45.process, 'optionalAccess', _46 => _46.env]), () => ( {}));
641
988
  }
642
989
  _chunkS3JO3N4Hcjs.__name.call(void 0, processEnv, "processEnv");
643
990
  async function createFarmAppManifestResponse(request, input, options) {
644
991
  if (request.method !== "GET" && request.method !== "HEAD") return null;
645
992
  if (!options.development) {
646
- const key = _optionalChain([(_nullishCoalesce(options.env, () => ( processEnv()))), 'access', _35 => _35.FARMJS_API_KEY, 'optionalAccess', _36 => _36.trim, 'call', _37 => _37()]);
993
+ const key = _optionalChain([(_nullishCoalesce(options.env, () => ( processEnv()))), 'access', _47 => _47.FARMJS_API_KEY, 'optionalAccess', _48 => _48.trim, 'call', _49 => _49()]);
647
994
  if (!input.analytics || !key) return null;
648
995
  const signed = await verifyFarmInfraManifestSignature(
649
996
  request.headers.get(FARM_INFRA_SIGNATURE_HEADER),
@@ -675,4 +1022,19 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmAppManifestResponse, "createFarm
675
1022
 
676
1023
 
677
1024
 
678
- exports.renderFarmLocaleAlternateLinks = renderFarmLocaleAlternateLinks; exports.createLateRedirectRecovery = createLateRedirectRecovery; exports.createLateNotFoundRecovery = createLateNotFoundRecovery; exports.createFarmMetadataRouteResponse = createFarmMetadataRouteResponse; exports.resolveDefaultErrorStatus = resolveDefaultErrorStatus; exports.getDefaultErrorStatusText = getDefaultErrorStatusText; exports.createDefaultErrorMarkup = createDefaultErrorMarkup; exports.createFarmThemeDocumentParts = createFarmThemeDocumentParts; exports.applyFarmThemeDocument = applyFarmThemeDocument; exports.FARM_API_CATALOG_PATH = FARM_API_CATALOG_PATH; exports.resolveFarmApiCatalogInput = resolveFarmApiCatalogInput; exports.createFarmApiCatalogResponse = createFarmApiCatalogResponse; exports.FARM_APP_MANIFEST_PATH = FARM_APP_MANIFEST_PATH; exports.resolveFarmAppManifestInput = resolveFarmAppManifestInput; exports.createFarmAppManifestResponse = createFarmAppManifestResponse;
1025
+
1026
+
1027
+
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+
1040
+ exports.formatRouteSegment = formatRouteSegment; exports.createRouteDirectoryPattern = createRouteDirectoryPattern; exports.stripRouteGroups = stripRouteGroups; exports.getRouteGroupScope = getRouteGroupScope; exports.isInRouteGroupScope = isInRouteGroupScope; exports.getRouteDirectoryDepth = getRouteDirectoryDepth; exports.routeBoundaryCoversDirectory = routeBoundaryCoversDirectory; exports.HOISTED_HEAD_ELEMENT = HOISTED_HEAD_ELEMENT; exports.extractFarmFullDocument = extractFarmFullDocument; exports.classifyFarmDocumentPrefix = classifyFarmDocumentPrefix; exports.removeFarmDocumentTitles = removeFarmDocumentTitles; exports.ensureFarmDocumentMeta = ensureFarmDocumentMeta; exports.composeFarmFullDocument = composeFarmFullDocument; exports.renderFarmLocaleAlternateLinks = renderFarmLocaleAlternateLinks; exports.createLateRedirectRecovery = createLateRedirectRecovery; exports.createLateNotFoundRecovery = createLateNotFoundRecovery; exports.createFarmMetadataRouteResponse = createFarmMetadataRouteResponse; exports.listFarmMCPLlmsTxtLinks = listFarmMCPLlmsTxtLinks; exports.createFarmAiCatalogResponse = createFarmAiCatalogResponse; exports.resolveDefaultErrorStatus = resolveDefaultErrorStatus; exports.getDefaultErrorStatusText = getDefaultErrorStatusText; exports.createDefaultErrorMarkup = createDefaultErrorMarkup; exports.createFarmThemeDocumentParts = createFarmThemeDocumentParts; exports.applyFarmThemeDocument = applyFarmThemeDocument; exports.FARM_API_CATALOG_PATH = FARM_API_CATALOG_PATH; exports.resolveFarmApiCatalogInput = resolveFarmApiCatalogInput; exports.createFarmApiCatalogResponse = createFarmApiCatalogResponse; exports.FARM_APP_MANIFEST_PATH = FARM_APP_MANIFEST_PATH; exports.resolveFarmAppManifestInput = resolveFarmAppManifestInput; exports.createFarmAppManifestResponse = createFarmAppManifestResponse;
@@ -137,7 +137,14 @@ function getEventTargetAssetUrl(value) {
137
137
  return void 0;
138
138
  }
139
139
  const tagName = typeof target.tagName === "string" ? target.tagName.toLowerCase() : "";
140
- if (tagName !== "script" && tagName !== "link") {
140
+ if (tagName === "script") {
141
+ if (target.type !== "module" && target.noModule !== true) return void 0;
142
+ } else if (tagName === "link") {
143
+ const rel = typeof target.rel === "string" ? target.rel.toLowerCase().split(/\s+/) : [];
144
+ if (!rel.some((value2) => ["stylesheet", "modulepreload", "preload"].includes(value2))) {
145
+ return void 0;
146
+ }
147
+ } else {
141
148
  return void 0;
142
149
  }
143
150
  return typeof target.src === "string" && target.src ? target.src : typeof target.href === "string" && target.href ? target.href : void 0;
@@ -83,4 +83,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, parseInterceptionMarker, "parseInterceptio
83
83
 
84
84
 
85
85
 
86
- exports.isRouteSlotSegment = isRouteSlotSegment; exports.parseRouteSlotFile = parseRouteSlotFile; exports.createRouteSlotContainerId = createRouteSlotContainerId;
86
+
87
+ exports.isRouteSlotSegment = isRouteSlotSegment; exports.parseRouteSlotFile = parseRouteSlotFile; exports.createRouteSlotContainerId = createRouteSlotContainerId; exports.parseInterceptionMarker = parseInterceptionMarker;
@@ -0,0 +1,45 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-LPEX4YW6.mjs";
4
+
5
+ // src/client/client-reference.ts
6
+ var CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("farm.isolated-hydration.client-reference");
7
+ function markFarmClientReference(boundary, reference) {
8
+ Object.defineProperty(boundary, CLIENT_REFERENCE, { value: reference });
9
+ }
10
+ __name(markFarmClientReference, "markFarmClientReference");
11
+ function getFarmClientReference(type) {
12
+ if (!type || typeof type !== "function" && typeof type !== "object") return void 0;
13
+ return type[CLIENT_REFERENCE];
14
+ }
15
+ __name(getFarmClientReference, "getFarmClientReference");
16
+ var SERVER_TREE_UPDATES = /* @__PURE__ */ Symbol.for("farm.isolated-hydration.server-tree-updates");
17
+ function getListeners() {
18
+ const shared = globalThis;
19
+ return shared[SERVER_TREE_UPDATES] ?? (shared[SERVER_TREE_UPDATES] = /* @__PURE__ */ new Set());
20
+ }
21
+ __name(getListeners, "getListeners");
22
+ function subscribeFarmServerTreeUpdates(listener) {
23
+ const listeners = getListeners();
24
+ listeners.add(listener);
25
+ return () => {
26
+ listeners.delete(listener);
27
+ };
28
+ }
29
+ __name(subscribeFarmServerTreeUpdates, "subscribeFarmServerTreeUpdates");
30
+ function updateFarmServerTreeModule(reference, module) {
31
+ const listeners = globalThis[SERVER_TREE_UPDATES];
32
+ let updated = 0;
33
+ if (listeners) {
34
+ for (const listener of listeners) if (listener(reference, module)) updated++;
35
+ }
36
+ return updated;
37
+ }
38
+ __name(updateFarmServerTreeModule, "updateFarmServerTreeModule");
39
+
40
+ export {
41
+ markFarmClientReference,
42
+ getFarmClientReference,
43
+ subscribeFarmServerTreeUpdates,
44
+ updateFarmServerTreeModule
45
+ };