@farm.js/core 0.1.25 → 0.1.27

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 (181) hide show
  1. package/dist/agent-runtime.d.mts +8 -10
  2. package/dist/agent-runtime.d.ts +8 -10
  3. package/dist/api/client.cjs +3 -3
  4. package/dist/api/client.d.mts +4 -5
  5. package/dist/api/client.d.ts +4 -5
  6. package/dist/api/client.mjs +2 -2
  7. package/dist/api/route-manager.cjs +6 -5
  8. package/dist/api/route-manager.d.mts +7 -9
  9. package/dist/api/route-manager.d.ts +7 -9
  10. package/dist/api/route-manager.mjs +5 -4
  11. package/dist/api/runtime.cjs +10 -4
  12. package/dist/api/runtime.d.mts +35 -3
  13. package/dist/api/runtime.d.ts +35 -3
  14. package/dist/api/runtime.mjs +9 -3
  15. package/dist/{api-client-Cx54IR5g.d.mts → api-client-BjMmY8OD.d.mts} +2 -3
  16. package/dist/{api-client-DykpaKcY.d.ts → api-client-CyFtZFJ4.d.ts} +2 -3
  17. package/dist/api.cjs +9 -8
  18. package/dist/api.d.mts +9 -11
  19. package/dist/api.d.ts +9 -11
  20. package/dist/api.mjs +9 -8
  21. package/dist/{app-ZuWrAMc_.d.mts → app-BfzZdjgX.d.mts} +3 -4
  22. package/dist/{app-BF-ctoxh.d.ts → app-CXK7Prrt.d.ts} +3 -4
  23. package/dist/app-markdown.cjs +12 -4
  24. package/dist/app-markdown.d.mts +9 -11
  25. package/dist/app-markdown.d.ts +9 -11
  26. package/dist/app-markdown.mjs +11 -3
  27. package/dist/{chunk-2BIJGZR3.mjs → chunk-3PTVHMLD.mjs} +1 -1
  28. package/dist/{chunk-XME4TCLB.mjs → chunk-4FHDV7VM.mjs} +2 -2
  29. package/dist/{chunk-KLSSO6YD.mjs → chunk-4UNKCNSL.mjs} +1 -1
  30. package/dist/chunk-5MKEDGLD.cjs +53 -0
  31. package/dist/{chunk-E3RDL2DA.cjs → chunk-DQMTHWPI.cjs} +61 -31
  32. package/dist/{chunk-TTVHACQV.cjs → chunk-FOT7LZEO.cjs} +1 -1
  33. package/dist/{chunk-2KI3CL3N.mjs → chunk-FPW4W3VW.mjs} +1 -1
  34. package/dist/{chunk-6K4SPQWL.cjs → chunk-HF5SIACK.cjs} +3 -3
  35. package/dist/{chunk-T2OPSH6S.mjs → chunk-HG237IEY.mjs} +12 -5
  36. package/dist/chunk-J63ZH5OQ.cjs +62 -0
  37. package/dist/{chunk-BD2U4ZL6.cjs → chunk-JQGDQO2I.cjs} +8 -8
  38. package/dist/{chunk-RR6UGYUT.mjs → chunk-JT25KHDI.mjs} +39 -9
  39. package/dist/{chunk-O5DVPF3R.cjs → chunk-KAERLFD3.cjs} +16 -11
  40. package/dist/{chunk-H7CJRJ4L.cjs → chunk-LAHZ7LZA.cjs} +16 -16
  41. package/dist/{chunk-XM4ZDVD7.mjs → chunk-MBFURXAC.mjs} +1 -1
  42. package/dist/{chunk-6VEHUKZ2.mjs → chunk-MM5D6VLP.mjs} +4 -20
  43. package/dist/chunk-MVL2RAJW.mjs +62 -0
  44. package/dist/{chunk-YA6LLTIJ.cjs → chunk-ND224OE2.cjs} +4 -20
  45. package/dist/{chunk-RYDW7GPR.cjs → chunk-NPFGGBM5.cjs} +13 -13
  46. package/dist/{chunk-VZWO3XVL.mjs → chunk-O2LV5XDG.mjs} +2 -2
  47. package/dist/chunk-O6XNAMBV.mjs +53 -0
  48. package/dist/{chunk-N2Z4ZFDE.mjs → chunk-OGHTEYXS.mjs} +22 -14
  49. package/dist/{chunk-U4MP7XTD.mjs → chunk-POXI72VV.mjs} +180 -16
  50. package/dist/{chunk-QGG336NI.mjs → chunk-Q4BHBO6V.mjs} +1 -1
  51. package/dist/{chunk-AXYTGLF3.cjs → chunk-QI7WQSMI.cjs} +4 -4
  52. package/dist/{chunk-WOI2HOGA.mjs → chunk-QQQNJS2E.mjs} +1 -1
  53. package/dist/{chunk-CFNOGDUS.cjs → chunk-TDWFCC2T.cjs} +2 -2
  54. package/dist/{chunk-R7LCG3BT.cjs → chunk-UNSKL6BI.cjs} +89 -81
  55. package/dist/{chunk-WJYCI56T.mjs → chunk-UWTQTZFN.mjs} +52 -33
  56. package/dist/{chunk-5YYJ6Q2L.mjs → chunk-WIVTGKLY.mjs} +7 -2
  57. package/dist/{chunk-65P6OGYN.cjs → chunk-WJKVTJJR.cjs} +12 -5
  58. package/dist/{chunk-OAVTUMJP.cjs → chunk-YXM74XOW.cjs} +9 -9
  59. package/dist/{chunk-QYMRIVG6.cjs → chunk-YZBV7733.cjs} +120 -101
  60. package/dist/{chunk-2ITKVAIF.cjs → chunk-ZSO5GWGD.cjs} +203 -39
  61. package/dist/{client-plugins-DPG0NeZN.d.mts → client-plugins-1GS4zubE.d.mts} +1940 -1677
  62. package/dist/{client-plugins-Fgni-_25.d.ts → client-plugins-B1Za6F5x.d.ts} +1940 -1677
  63. package/dist/client-plugins.d.mts +8 -10
  64. package/dist/client-plugins.d.ts +8 -10
  65. package/dist/client.cjs +4 -4
  66. package/dist/client.d.mts +10 -12
  67. package/dist/client.d.ts +10 -12
  68. package/dist/client.mjs +3 -3
  69. package/dist/config.d.mts +8 -10
  70. package/dist/config.d.ts +8 -10
  71. package/dist/{devtools-I7TBFOKD.mjs → devtools-6RN6KHTW.mjs} +8 -3
  72. package/dist/{devtools-6OA7FEF6.cjs → devtools-CQJ3H6MX.cjs} +9 -4
  73. package/dist/docs.cjs +11 -6
  74. package/dist/docs.mjs +10 -5
  75. package/dist/{endpoint-1zA994xL.d.ts → endpoint-CA-TNX60.d.ts} +1 -1
  76. package/dist/{endpoint-DAc96i93.d.mts → endpoint-CCHFqyTE.d.mts} +1 -1
  77. package/dist/index.cjs +26 -21
  78. package/dist/index.d.mts +16 -18
  79. package/dist/index.d.ts +16 -18
  80. package/dist/index.mjs +26 -21
  81. package/dist/{integration-api-BbaiokCC.d.ts → integration-api-0y4FXJpC.d.mts} +128 -1
  82. package/dist/{integration-api-BbaiokCC.d.mts → integration-api-BPJo5oXb.d.ts} +128 -1
  83. package/dist/integrations.d.mts +8 -10
  84. package/dist/integrations.d.ts +8 -10
  85. package/dist/internal/app-markdown-runtime.cjs +11 -3
  86. package/dist/internal/app-markdown-runtime.d.mts +9 -10
  87. package/dist/internal/app-markdown-runtime.d.ts +9 -10
  88. package/dist/internal/app-markdown-runtime.mjs +10 -2
  89. package/dist/internal/build-runtime.cjs +19 -17
  90. package/dist/internal/build-runtime.d.mts +10 -12
  91. package/dist/internal/build-runtime.d.ts +10 -12
  92. package/dist/internal/build-runtime.mjs +18 -16
  93. package/dist/internal/cli-runtime.cjs +9 -5
  94. package/dist/internal/cli-runtime.mjs +8 -4
  95. package/dist/internal/client-error-overlay.cjs +4 -4
  96. package/dist/internal/client-error-overlay.mjs +1 -1
  97. package/dist/internal/compression-runtime.d.mts +8 -10
  98. package/dist/internal/compression-runtime.d.ts +8 -10
  99. package/dist/internal/config-runtime.cjs +9 -4
  100. package/dist/internal/config-runtime.d.mts +9 -11
  101. package/dist/internal/config-runtime.d.ts +9 -11
  102. package/dist/internal/config-runtime.mjs +8 -3
  103. package/dist/internal/infra-analytics-runtime.cjs +4 -3
  104. package/dist/internal/infra-analytics-runtime.mjs +2 -1
  105. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  106. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  107. package/dist/internal/production-runtime.cjs +8 -5
  108. package/dist/internal/production-runtime.d.mts +16 -16
  109. package/dist/internal/production-runtime.d.ts +16 -16
  110. package/dist/internal/production-runtime.mjs +7 -4
  111. package/dist/markdown.cjs +10 -2
  112. package/dist/markdown.d.mts +35 -153
  113. package/dist/markdown.d.ts +35 -153
  114. package/dist/markdown.mjs +9 -1
  115. package/dist/{metadata-CDnRHKVq.d.ts → metadata-7LKgQEWF.d.ts} +1 -1
  116. package/dist/{metadata-D0EF7esB.d.mts → metadata-B9mCxKgp.d.mts} +1 -1
  117. package/dist/middleware.d.mts +9 -11
  118. package/dist/middleware.d.ts +9 -11
  119. package/dist/navigation.d.mts +10 -12
  120. package/dist/navigation.d.ts +10 -12
  121. package/dist/{nitro-ZKLGOTVY.mjs → nitro-NAKCRVHX.mjs} +4 -3
  122. package/dist/{nitro-KQDU7CFE.cjs → nitro-VYDZGYFY.cjs} +4 -3
  123. package/dist/observability-BupkiN0m.d.mts +447 -0
  124. package/dist/observability-BupkiN0m.d.ts +447 -0
  125. package/dist/observability.d.mts +2 -417
  126. package/dist/observability.d.ts +2 -417
  127. package/dist/plugin.cjs +14 -12
  128. package/dist/plugin.d.mts +9 -11
  129. package/dist/plugin.d.ts +9 -11
  130. package/dist/plugin.mjs +13 -11
  131. package/dist/{production-runtime-DpCt0opU.d.ts → production-runtime-B3xnY6fI.d.ts} +1 -1
  132. package/dist/{production-runtime-x3W4wVqx.d.mts → production-runtime-DramhI0c.d.mts} +1 -1
  133. package/dist/{render-plan-D5oFRVBV.d.ts → render-plan-CpW32tOL.d.ts} +1 -1
  134. package/dist/{render-plan-tazUJalK.d.mts → render-plan-CtQB-zHS.d.mts} +1 -1
  135. package/dist/renderer-client.d.mts +6 -8
  136. package/dist/renderer-client.d.ts +6 -8
  137. package/dist/{request-CzZX0Aew.d.ts → request-BVGGeQv4.d.ts} +1 -1
  138. package/dist/{request-CXmQy5ks.d.mts → request-DlLVBKe3.d.mts} +1 -1
  139. package/dist/request.d.mts +9 -11
  140. package/dist/request.d.ts +9 -11
  141. package/dist/{route-rendering-Dw3C362T.d.ts → route-rendering-BdEldajn.d.ts} +1 -1
  142. package/dist/{route-rendering-B-qpe32B.d.mts → route-rendering-DChYLNdh.d.mts} +1 -1
  143. package/dist/{router-CLl3xHwl.d.ts → router-D0Az-1Nu.d.ts} +1 -1
  144. package/dist/{router-CafM2jlw.d.mts → router-D5htHn_M.d.mts} +1 -1
  145. package/dist/routes.d.mts +6 -8
  146. package/dist/routes.d.ts +6 -8
  147. package/dist/server-fn-client.d.mts +3 -4
  148. package/dist/server-fn-client.d.ts +3 -4
  149. package/dist/server-fn.d.mts +1 -1
  150. package/dist/server-fn.d.ts +1 -1
  151. package/dist/server-plugins.d.mts +8 -10
  152. package/dist/server-plugins.d.ts +8 -10
  153. package/dist/server-query-client.d.mts +1 -1
  154. package/dist/server-query-client.d.ts +1 -1
  155. package/dist/server-query.d.mts +1 -1
  156. package/dist/server-query.d.ts +1 -1
  157. package/dist/server.cjs +292 -141
  158. package/dist/server.d.mts +13 -15
  159. package/dist/server.d.ts +13 -15
  160. package/dist/server.mjs +278 -127
  161. package/dist/{spa-router-6sJfsMlQ.d.mts → spa-router-DVfSJZ5o.d.mts} +2 -2
  162. package/dist/{spa-router-DePr2aZ6.d.ts → spa-router-DmwP_7QL.d.ts} +2 -2
  163. package/dist/testing.cjs +6 -5
  164. package/dist/testing.d.mts +7 -9
  165. package/dist/testing.d.ts +7 -9
  166. package/dist/testing.mjs +5 -4
  167. package/dist/{utils-BPHr-1mP.d.mts → utils-B_Rmr0-n.d.mts} +1 -1
  168. package/dist/{utils-BBKC3cf3.d.ts → utils-Dv0OuLtF.d.ts} +1 -1
  169. package/dist/version.cjs +2 -2
  170. package/dist/version.mjs +1 -1
  171. package/dist/vite.cjs +14 -12
  172. package/dist/vite.d.mts +8 -10
  173. package/dist/vite.d.ts +8 -10
  174. package/dist/vite.mjs +13 -11
  175. package/package.json +1 -1
  176. package/dist/route-B0XrsrFk.d.mts +0 -128
  177. package/dist/route-DOEpbyWZ.d.ts +0 -128
  178. package/dist/{chunk-GDUYXFIS.mjs → chunk-6EG7U4NF.mjs} +3 -3
  179. package/dist/{chunk-YAOX43YI.cjs → chunk-C7OUJ6JI.cjs} +2 -2
  180. package/dist/{chunk-IXTFU4PL.cjs → chunk-NL3ZSMZB.cjs} +2 -2
  181. package/dist/{chunk-L6V3P73N.mjs → chunk-UOXGA6TO.mjs} +4 -4
@@ -1,5 +1,14 @@
1
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
2
 
3
+ var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
4
+
5
+
6
+ var _chunk5MKEDGLDcjs = require('./chunk-5MKEDGLD.cjs');
7
+
8
+
9
+ var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
10
+
11
+
3
12
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
4
13
 
5
14
  // src/markdown-view.ts
@@ -39,10 +48,12 @@ function parseFarmMarkdownHeadings(markdown) {
39
48
  end: lines.length
40
49
  });
41
50
  }
42
- for (let headingIndex = 0; headingIndex < headings.length; headingIndex++) {
43
- const heading = headings[headingIndex];
44
- const next = headings.slice(headingIndex + 1).find((candidate) => candidate.level <= heading.level);
45
- if (next) heading.end = next.start;
51
+ const open = [];
52
+ for (const heading of headings) {
53
+ while (open.length > 0 && open[open.length - 1].level >= heading.level) {
54
+ open.pop().end = heading.start;
55
+ }
56
+ open.push(heading);
46
57
  }
47
58
  return headings;
48
59
  }
@@ -55,23 +66,49 @@ function estimateFarmMarkdownTokens(text) {
55
66
  return Math.ceil(text.length / 4);
56
67
  }
57
68
  _chunkS3JO3N4Hcjs.__name.call(void 0, estimateFarmMarkdownTokens, "estimateFarmMarkdownTokens");
69
+ var FARM_MARKDOWN_MIN_TOKEN_BUDGET = 100;
70
+ var FARM_MARKDOWN_VIEW_PARAMS = [
71
+ "outline",
72
+ "section",
73
+ "actions",
74
+ "max_tokens",
75
+ "cursor"
76
+ ];
58
77
  function selectFarmMarkdownView(markdown, searchParams, markdownPath) {
59
78
  const wantsOutline = searchParams.has("outline");
60
79
  const sectionId = searchParams.get("section");
61
- if (!wantsOutline && sectionId === null) return { status: 200, body: markdown };
80
+ const budget = searchParams.get("max_tokens");
81
+ if (!wantsOutline && sectionId === null && budget === null)
82
+ return { status: 200, body: markdown };
83
+ const viewUrl = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (view) => {
84
+ const query = new URLSearchParams(searchParams);
85
+ for (const name of FARM_MARKDOWN_VIEW_PARAMS) query.delete(name);
86
+ for (const [name, value] of Object.entries(view)) {
87
+ if (value !== null && value !== void 0) query.set(name, value);
88
+ }
89
+ const search = query.toString();
90
+ return search ? `${markdownPath}?${search}` : markdownPath;
91
+ }, "viewUrl");
92
+ const withinBudget = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (document) => budget === null ? { status: 200, body: document } : selectFarmMarkdownPart(
93
+ document,
94
+ budget,
95
+ searchParams.get("cursor"),
96
+ (cursor) => viewUrl({ section: sectionId, max_tokens: budget, cursor })
97
+ ), "withinBudget");
98
+ if (!wantsOutline && sectionId === null) return withinBudget(markdown);
62
99
  const lines = markdown.split("\n");
63
100
  const headings = parseFarmMarkdownHeadings(markdown);
64
101
  const sectionText = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (heading) => lines.slice(heading.start, heading.end).join("\n").trim(), "sectionText");
65
102
  if (sectionId !== null) {
66
103
  const heading = headings.find((candidate) => candidate.id === sectionId);
67
- if (heading) return { status: 200, body: `${sectionText(heading)}
68
- ` };
104
+ if (heading) return withinBudget(`${sectionText(heading)}
105
+ `);
69
106
  const available = headings.map((candidate) => `- \`${candidate.id}\``).join("\n");
70
107
  return {
71
108
  status: 404,
72
109
  body: `# Section not found
73
110
 
74
- \`${sectionId}\` is not a section of ${markdownPath}.
111
+ ${markdownCodeSpan(sectionId)} is not a section of ${markdownPath}.
75
112
 
76
113
  ` + (available ? `Available sections:
77
114
 
@@ -79,23 +116,31 @@ ${available}
79
116
  ` : "This page has no sections.\n")
80
117
  };
81
118
  }
82
- const minLevel = Math.min(...headings.map((heading) => heading.level));
119
+ const minLevel = headings.reduce((min, heading) => Math.min(min, heading.level), 6);
83
120
  const entries = headings.map((heading) => {
84
121
  const indent = " ".repeat(heading.level - minLevel);
85
122
  const tokens = estimateFarmMarkdownTokens(sectionText(heading));
86
- return `${indent}- [${heading.text}](${markdownPath}?section=${encodeURIComponent(heading.id)}) ~${tokens} tokens`;
123
+ return `${indent}- [${heading.text}](${viewUrl({ section: heading.id })}) ~${tokens} tokens`;
87
124
  });
88
125
  return {
89
126
  status: 200,
90
127
  body: `# Outline of ${markdownPath}
91
128
 
92
- About ${estimateFarmMarkdownTokens(markdown)} tokens in total. Request one section with \`?section=<id>\`.
129
+ About ${estimateFarmMarkdownTokens(markdown)} tokens in total. Request one section with \`?section=<id>\`, or read in parts with \`?max_tokens=<n>\`.
93
130
 
94
131
  ` + (entries.length > 0 ? `${entries.join("\n")}
95
132
  ` : "This page has no headings.\n")
96
133
  };
97
134
  }
98
135
  _chunkS3JO3N4Hcjs.__name.call(void 0, selectFarmMarkdownView, "selectFarmMarkdownView");
136
+ function markdownCodeSpan(value) {
137
+ const text = value.replace(/[\p{Cc}\u2028\u2029]+/gu, " ");
138
+ const longestRun = (_nullishCoalesce(text.match(/`+/g), () => ( []))).reduce((max, run) => Math.max(max, run.length), 0);
139
+ const fence = "`".repeat(longestRun + 1);
140
+ const pad = text.startsWith("`") || text.endsWith("`") ? " " : "";
141
+ return `${fence}${pad}${text}${pad}${fence}`;
142
+ }
143
+ _chunkS3JO3N4Hcjs.__name.call(void 0, markdownCodeSpan, "markdownCodeSpan");
99
144
  function selectFarmPageActionsView(markdownPath, actions, headers) {
100
145
  headers.set("Content-Type", "application/json; charset=utf-8");
101
146
  const page = markdownPath === "/index.md" ? "/" : markdownPath.replace(/\.md$/, "");
@@ -106,7 +151,117 @@ function selectFarmPageActionsView(markdownPath, actions, headers) {
106
151
  };
107
152
  }
108
153
  _chunkS3JO3N4Hcjs.__name.call(void 0, selectFarmPageActionsView, "selectFarmPageActionsView");
154
+ function selectFarmMarkdownPart(document, rawBudget, rawCursor, partUrl) {
155
+ const budget = /^\d{1,9}$/.test(rawBudget) ? Number(rawBudget) : Number.NaN;
156
+ if (!(budget >= FARM_MARKDOWN_MIN_TOKEN_BUDGET)) {
157
+ return {
158
+ status: 400,
159
+ body: `# Invalid max_tokens
160
+
161
+ \`max_tokens\` must be a whole number of at least ${FARM_MARKDOWN_MIN_TOKEN_BUDGET}.
162
+ `
163
+ };
164
+ }
165
+ const lines = document.replace(/\n$/, "").split("\n");
166
+ const version = hashFarmMarkdown(document).slice(0, 8);
167
+ let start = 0;
168
+ if (rawCursor !== null) {
169
+ const match = /^(\d{1,9})\.([0-9a-z]+)$/.exec(rawCursor);
170
+ if (!match || Number(match[1]) <= 0 || Number(match[1]) >= lines.length) {
171
+ return {
172
+ status: 400,
173
+ body: `# Invalid cursor
174
+
175
+ Start again at ${partUrl()}.
176
+ `
177
+ };
178
+ }
179
+ if (match[2] !== version) {
180
+ return {
181
+ status: 409,
182
+ body: `# Page changed
183
+
184
+ The page changed after this cursor was issued. Start again at ${partUrl()}.
185
+ `
186
+ };
187
+ }
188
+ start = Number(match[1]);
189
+ }
190
+ const fences = readOpenFences(lines);
191
+ const reopen = fences[start];
192
+ const room = budget * 4 - 200;
193
+ let size = reopen ? reopen.opener.length + 1 : 0;
194
+ let end = start;
195
+ let lastBreak = -1;
196
+ while (end < lines.length) {
197
+ const length = lines[end].length + 1;
198
+ if (end > start && size + length > room) break;
199
+ size += length;
200
+ end++;
201
+ if (end < lines.length && isPartBreak(lines, fences, end)) lastBreak = end;
202
+ }
203
+ const head = reopen ? `${reopen.opener}
204
+ ` : "";
205
+ if (end >= lines.length) {
206
+ return { status: 200, body: `${head}${lines.slice(start).join("\n")}
207
+ ` };
208
+ }
209
+ if (lastBreak > start) end = lastBreak;
210
+ const open = fences[end];
211
+ const part = `${head}${lines.slice(start, end).join("\n").replace(/\n+$/, "")}${open ? `
212
+ ${open.closer}` : ""}`;
213
+ const next = partUrl(`${end}.${version}`);
214
+ const remaining = estimateFarmMarkdownTokens(lines.slice(end).join("\n"));
215
+ return {
216
+ status: 200,
217
+ body: `${part}
218
+
219
+ ---
220
+
221
+ Continue: ${next} (about ${remaining} more tokens)
222
+ `,
223
+ headers: { Link: `<${next}>; rel="next"` }
224
+ };
225
+ }
226
+ _chunkS3JO3N4Hcjs.__name.call(void 0, selectFarmMarkdownPart, "selectFarmMarkdownPart");
227
+ function readOpenFences(lines) {
228
+ const open = [];
229
+ let fence;
230
+ let frontMatter = _optionalChain([lines, 'access', _5 => _5[0], 'optionalAccess', _6 => _6.trim, 'call', _7 => _7()]) === "---";
231
+ for (let index = 0; index < lines.length; index++) {
232
+ open.push(frontMatter && index > 0 ? { opener: "", closer: "" } : fence);
233
+ const line = lines[index];
234
+ if (frontMatter) {
235
+ if (index > 0 && line.trim() === "---") frontMatter = false;
236
+ continue;
237
+ }
238
+ const match = FENCE.exec(line);
239
+ if (!match) continue;
240
+ const marker = match[1];
241
+ if (!fence) fence = { opener: line.trim(), closer: marker, marker };
242
+ else if (marker[0] === fence.marker[0] && marker.length >= fence.marker.length)
243
+ fence = void 0;
244
+ }
245
+ return open;
246
+ }
247
+ _chunkS3JO3N4Hcjs.__name.call(void 0, readOpenFences, "readOpenFences");
248
+ function isPartBreak(lines, fences, index) {
249
+ if (fences[index]) return false;
250
+ return lines[index - 1].trim() === "" || ATX_HEADING.test(lines[index]);
251
+ }
252
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isPartBreak, "isPartBreak");
253
+ function readMarkdownViewName(searchParams) {
254
+ if (searchParams.has("actions")) return "actions";
255
+ if (searchParams.has("outline")) return "outline";
256
+ if (searchParams.has("max_tokens")) return "parts";
257
+ return searchParams.has("section") ? "section" : void 0;
258
+ }
259
+ _chunkS3JO3N4Hcjs.__name.call(void 0, readMarkdownViewName, "readMarkdownViewName");
109
260
  function createFarmMarkdownETag(body) {
261
+ return `W/"${hashFarmMarkdown(body)}-${body.length.toString(36)}"`;
262
+ }
263
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmMarkdownETag, "createFarmMarkdownETag");
264
+ function hashFarmMarkdown(body) {
110
265
  let h1 = 3735928559;
111
266
  let h2 = 1103547991;
112
267
  for (let index = 0; index < body.length; index++) {
@@ -116,10 +271,9 @@ function createFarmMarkdownETag(body) {
116
271
  }
117
272
  h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
118
273
  h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
119
- const hash = (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36);
120
- return `W/"${hash}-${body.length.toString(36)}"`;
274
+ return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36);
121
275
  }
122
- _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmMarkdownETag, "createFarmMarkdownETag");
276
+ _chunkS3JO3N4Hcjs.__name.call(void 0, hashFarmMarkdown, "hashFarmMarkdown");
123
277
  function ifNoneMatchIncludes(header, etag) {
124
278
  if (!header) return false;
125
279
  const opaque = etag.replace(/^W\//, "");
@@ -130,6 +284,9 @@ function createFarmMarkdownViewResponse(options) {
130
284
  const url = _nullishCoalesce(options.requestUrl, () => ( new URL(options.request.url)));
131
285
  const view = url.searchParams.has("actions") ? selectFarmPageActionsView(options.markdownPath, _nullishCoalesce(options.actions, () => ( [])), options.headers) : selectFarmMarkdownView(options.markdown, url.searchParams, options.markdownPath);
132
286
  const status = view.status === 200 ? options.status : view.status;
287
+ _chunkJ63ZH5OQcjs.emitFarmAgentRead.call(void 0, options.request, "markdown", status, readMarkdownViewName(url.searchParams));
288
+ for (const [name, value] of Object.entries(_nullishCoalesce(view.headers, () => ( {}))))
289
+ options.headers.append(name, value);
133
290
  const etag = createFarmMarkdownETag(view.body);
134
291
  options.headers.set("ETag", etag);
135
292
  if (status === 200 && ifNoneMatchIncludes(options.request.headers.get("if-none-match"), etag)) {
@@ -187,7 +344,7 @@ function resolveMarkdownConfig(config) {
187
344
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveMarkdownConfig, "resolveMarkdownConfig");
188
345
  function resolveMarkdownMirrorTarget(config, pathname, options = {}) {
189
346
  const hasMarkdownExtension = pathname.toLowerCase().endsWith(".md");
190
- if (!_optionalChain([config, 'optionalAccess', _5 => _5.enabled]) || !hasMarkdownExtension && !requestAcceptsMarkdown(options.accept)) {
347
+ if (!_optionalChain([config, 'optionalAccess', _8 => _8.enabled]) || !hasMarkdownExtension && !requestAcceptsMarkdown(options.accept)) {
191
348
  return null;
192
349
  }
193
350
  const targetPathname = normalizeMarkdownRoute(
@@ -207,7 +364,7 @@ async function createMarkdownMirrorResponse(options) {
207
364
  if (options.request.method !== "GET" && options.request.method !== "HEAD") {
208
365
  return null;
209
366
  }
210
- const requestUrl = _optionalChain([options, 'access', _6 => _6.requestUrl, 'optionalAccess', _7 => _7.href]) === options.request.url ? options.requestUrl : new URL(options.request.url);
367
+ const requestUrl = _optionalChain([options, 'access', _9 => _9.requestUrl, 'optionalAccess', _10 => _10.href]) === options.request.url ? options.requestUrl : new URL(options.request.url);
211
368
  const hasMarkdownExtension = requestUrl.pathname.toLowerCase().endsWith(".md");
212
369
  const target = resolveMarkdownMirrorTarget(options.config, requestUrl.pathname, {
213
370
  accept: options.request.headers.get("accept")
@@ -220,7 +377,7 @@ async function createMarkdownMirrorResponse(options) {
220
377
  }
221
378
  const pageUrl = new URL(options.request.url);
222
379
  pageUrl.pathname = target.pathname;
223
- for (const name of ["outline", "section", "actions"]) pageUrl.searchParams.delete(name);
380
+ for (const name of FARM_MARKDOWN_VIEW_PARAMS) pageUrl.searchParams.delete(name);
224
381
  const headers = new Headers(options.request.headers);
225
382
  headers.set("accept", "text/html");
226
383
  const pageResponse = await options.renderPage(
@@ -229,7 +386,8 @@ async function createMarkdownMirrorResponse(options) {
229
386
  headers
230
387
  })
231
388
  );
232
- if (!isHtmlResponse(pageResponse)) {
389
+ const redirects = pageResponse.status >= 300 && pageResponse.status < 400 && pageResponse.headers.has("location");
390
+ if (redirects || !isHtmlResponse(pageResponse)) {
233
391
  return createMarkdownAccessResponse(
234
392
  pageResponse,
235
393
  target.pathname,
@@ -240,9 +398,15 @@ async function createMarkdownMirrorResponse(options) {
240
398
  const html = await pageResponse.text();
241
399
  const markdownPath = target.pathname === "/" ? "/index.md" : `${target.pathname}.md`;
242
400
  const actions = extractFarmPageActions(html, pageUrl);
401
+ for (const form of actions) {
402
+ if (!_optionalChain([form, 'access', _11 => _11.action, 'optionalAccess', _12 => _12.startsWith, 'call', _13 => _13("/")])) continue;
403
+ const pathname = new URL(form.action, pageUrl.origin).pathname;
404
+ const tool = _nullishCoalesce(_chunk5MKEDGLDcjs._findFarmMCPEndpointTool.call(void 0, form.method, pathname, options.apiServerBasePath), () => ( _chunk5MKEDGLDcjs._findFarmMCPEndpointTool.call(void 0, form.method, _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname), options.apiServerBasePath)));
405
+ if (tool) form.tool = tool;
406
+ }
243
407
  const markdown = htmlToMarkdown(html, {
244
- title: _optionalChain([target, 'access', _8 => _8.route, 'optionalAccess', _9 => _9.title]),
245
- includeMetadata: _nullishCoalesce(_optionalChain([options, 'access', _10 => _10.config, 'optionalAccess', _11 => _11.includeMetadata]), () => ( true)),
408
+ title: _optionalChain([target, 'access', _14 => _14.route, 'optionalAccess', _15 => _15.title]),
409
+ includeMetadata: _nullishCoalesce(_optionalChain([options, 'access', _16 => _16.config, 'optionalAccess', _17 => _17.includeMetadata]), () => ( true)),
246
410
  sourcePath: target.pathname,
247
411
  actionsPath: actions.length > 0 ? `${markdownPath}?actions` : void 0
248
412
  });
@@ -254,17 +418,17 @@ async function createMarkdownMirrorResponse(options) {
254
418
  if (!hasMarkdownExtension) {
255
419
  headersOut.set("Vary", "Accept");
256
420
  }
257
- for (const token of _nullishCoalesce(_optionalChain([pageResponse, 'access', _12 => _12.headers, 'access', _13 => _13.get, 'call', _14 => _14("vary"), 'optionalAccess', _15 => _15.split, 'call', _16 => _16(",")]), () => ( []))) {
421
+ for (const token of _nullishCoalesce(_optionalChain([pageResponse, 'access', _18 => _18.headers, 'access', _19 => _19.get, 'call', _20 => _20("vary"), 'optionalAccess', _21 => _21.split, 'call', _22 => _22(",")]), () => ( []))) {
258
422
  const name = token.trim();
259
423
  if (name && name.toLowerCase() !== "accept") appendHeaderToken(headersOut, "Vary", name);
260
424
  }
261
425
  const pageCacheControl = pageResponse.headers.get("cache-control");
262
- const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access', _17 => _17.route, 'optionalAccess', _18 => _18.cache]), () => ( _optionalChain([options, 'access', _19 => _19.config, 'optionalAccess', _20 => _20.cache]))), () => ( false));
426
+ const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access', _23 => _23.route, 'optionalAccess', _24 => _24.cache]), () => ( _optionalChain([options, 'access', _25 => _25.config, 'optionalAccess', _26 => _26.cache]))), () => ( false));
263
427
  headersOut.set(
264
428
  "Cache-Control",
265
429
  pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : createMarkdownCacheHeader(cache)
266
430
  );
267
- const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(_optionalChain([value, 'optionalAccess', _21 => _21.trim, 'call', _22 => _22()]))).join(", ");
431
+ const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(_optionalChain([value, 'optionalAccess', _27 => _27.trim, 'call', _28 => _28()]))).join(", ");
268
432
  if (robots) headersOut.set("X-Robots-Tag", robots);
269
433
  const canonical = readHtmlCanonicalHref(html);
270
434
  if (canonical) {
@@ -521,7 +685,7 @@ function getFarmMarkdownAlternatePath(config, pathname) {
521
685
  }
522
686
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmMarkdownAlternatePath, "getFarmMarkdownAlternatePath");
523
687
  function isFarmMarkdownMirrorExposed(config, pathname) {
524
- if (!_optionalChain([config, 'optionalAccess', _23 => _23.enabled])) return false;
688
+ if (!_optionalChain([config, 'optionalAccess', _29 => _29.enabled])) return false;
525
689
  return config.expose === true || findExposedMarkdownRoute(config, pathname) !== null;
526
690
  }
527
691
  _chunkS3JO3N4Hcjs.__name.call(void 0, isFarmMarkdownMirrorExposed, "isFarmMarkdownMirrorExposed");
@@ -614,7 +778,7 @@ function extractHtmlBody(html) {
614
778
  const body = rootMatch ? rootMatch[1] : bodyMatch ? bodyMatch[1] : html;
615
779
  const main = extractFirstElementContent(body, ["main"]);
616
780
  if (main !== void 0) return main;
617
- const articles = _nullishCoalesce(_optionalChain([body, 'access', _24 => _24.match, 'call', _25 => _25(/<article\b/gi), 'optionalAccess', _26 => _26.length]), () => ( 0));
781
+ const articles = _nullishCoalesce(_optionalChain([body, 'access', _30 => _30.match, 'call', _31 => _31(/<article\b/gi), 'optionalAccess', _32 => _32.length]), () => ( 0));
618
782
  return articles === 1 ? _nullishCoalesce(extractFirstElementContent(body, ["article"]), () => ( body)) : body;
619
783
  }
620
784
  _chunkS3JO3N4Hcjs.__name.call(void 0, extractHtmlBody, "extractHtmlBody");
@@ -630,7 +794,7 @@ function extractFirstElementContent(html, tagNames) {
630
794
  _chunkS3JO3N4Hcjs.__name.call(void 0, extractFirstElementContent, "extractFirstElementContent");
631
795
  function readHtmlMetaContent(html, name) {
632
796
  for (const match of html.matchAll(/<meta\b([^>]*)>/gi)) {
633
- if (_optionalChain([readHtmlAttribute, 'call', _27 => _27(match[1], "name"), 'optionalAccess', _28 => _28.toLowerCase, 'call', _29 => _29()]) === name) {
797
+ if (_optionalChain([readHtmlAttribute, 'call', _33 => _33(match[1], "name"), 'optionalAccess', _34 => _34.toLowerCase, 'call', _35 => _35()]) === name) {
634
798
  return readHtmlAttribute(match[1], "content");
635
799
  }
636
800
  }
@@ -639,8 +803,8 @@ function readHtmlMetaContent(html, name) {
639
803
  _chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlMetaContent, "readHtmlMetaContent");
640
804
  function readHtmlCanonicalHref(html) {
641
805
  for (const match of html.matchAll(/<link\b([^>]*)>/gi)) {
642
- const rel = _optionalChain([readHtmlAttribute, 'call', _30 => _30(match[1], "rel"), 'optionalAccess', _31 => _31.toLowerCase, 'call', _32 => _32(), 'access', _33 => _33.split, 'call', _34 => _34(/\s+/)]);
643
- if (_optionalChain([rel, 'optionalAccess', _35 => _35.includes, 'call', _36 => _36("canonical")])) return readHtmlAttribute(match[1], "href");
806
+ const rel = _optionalChain([readHtmlAttribute, 'call', _36 => _36(match[1], "rel"), 'optionalAccess', _37 => _37.toLowerCase, 'call', _38 => _38(), 'access', _39 => _39.split, 'call', _40 => _40(/\s+/)]);
807
+ if (_optionalChain([rel, 'optionalAccess', _41 => _41.includes, 'call', _42 => _42("canonical")])) return readHtmlAttribute(match[1], "href");
644
808
  }
645
809
  return void 0;
646
810
  }
@@ -667,7 +831,7 @@ function extractFarmPageActions(html, pageUrl) {
667
831
  }
668
832
  _chunkS3JO3N4Hcjs.__name.call(void 0, extractFarmPageActions, "extractFarmPageActions");
669
833
  function readPageForm(attributes, content, pageUrl, labelsFor) {
670
- const method = _optionalChain([readDecodedAttribute, 'call', _37 => _37(attributes, "method"), 'optionalAccess', _38 => _38.trim, 'call', _39 => _39(), 'access', _40 => _40.toLowerCase, 'call', _41 => _41()]);
834
+ const method = _optionalChain([readDecodedAttribute, 'call', _43 => _43(attributes, "method"), 'optionalAccess', _44 => _44.trim, 'call', _45 => _45(), 'access', _46 => _46.toLowerCase, 'call', _47 => _47()]);
671
835
  if (method === "dialog") return void 0;
672
836
  const target = resolveFormTarget(readDecodedAttribute(attributes, "action"), pageUrl);
673
837
  const form = {
@@ -677,11 +841,11 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
677
841
  submit: []
678
842
  };
679
843
  const name = _nullishCoalesce(_nullishCoalesce(readDecodedAttribute(attributes, "aria-label"), () => ( readDecodedAttribute(attributes, "name"))), () => ( readDecodedAttribute(attributes, "id")));
680
- if (_optionalChain([name, 'optionalAccess', _42 => _42.trim, 'call', _43 => _43()])) form.name = name.trim();
844
+ if (_optionalChain([name, 'optionalAccess', _48 => _48.trim, 'call', _49 => _49()])) form.name = name.trim();
681
845
  if (target) form.action = target;
682
846
  else form.requiresJavaScript = true;
683
847
  if (form.method === "POST") {
684
- const enctype = _optionalChain([readDecodedAttribute, 'call', _44 => _44(attributes, "enctype"), 'optionalAccess', _45 => _45.trim, 'call', _46 => _46(), 'access', _47 => _47.toLowerCase, 'call', _48 => _48()]);
848
+ const enctype = _optionalChain([readDecodedAttribute, 'call', _50 => _50(attributes, "enctype"), 'optionalAccess', _51 => _51.trim, 'call', _52 => _52(), 'access', _53 => _53.toLowerCase, 'call', _54 => _54()]);
685
849
  form.enctype = enctype && FORM_ENCTYPES.has(enctype) ? enctype : "application/x-www-form-urlencoded";
686
850
  }
687
851
  const wrappingLabels = [...content.matchAll(/<label\b[^>]*>([\s\S]*?)<\/label>/gi)].map(
@@ -692,13 +856,13 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
692
856
  })
693
857
  );
694
858
  const labelOf = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (controlAttributes, index) => {
695
- const aria = _optionalChain([readDecodedAttribute, 'call', _49 => _49(controlAttributes, "aria-label"), 'optionalAccess', _50 => _50.trim, 'call', _51 => _51()]);
859
+ const aria = _optionalChain([readDecodedAttribute, 'call', _55 => _55(controlAttributes, "aria-label"), 'optionalAccess', _56 => _56.trim, 'call', _57 => _57()]);
696
860
  if (aria) return aria;
697
861
  const id = readDecodedAttribute(controlAttributes, "id");
698
862
  const forLabel = id ? labelsFor.get(id) : void 0;
699
863
  if (forLabel) return forLabel;
700
864
  const wrapping = wrappingLabels.find((label) => label.start < index && index < label.end);
701
- return _optionalChain([wrapping, 'optionalAccess', _52 => _52.text]) || void 0;
865
+ return _optionalChain([wrapping, 'optionalAccess', _58 => _58.text]) || void 0;
702
866
  }, "labelOf");
703
867
  const groups = /* @__PURE__ */ new Map();
704
868
  const controls = /<(input)\b([^>]*)>|<(select|textarea|button)\b([^>]*)>([\s\S]*?)<\/\3>/gi;
@@ -709,7 +873,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
709
873
  if (hasHtmlAttribute(controlAttributes, "disabled")) continue;
710
874
  const label = labelOf(controlAttributes, match.index);
711
875
  const fieldName = readDecodedAttribute(controlAttributes, "name");
712
- const typeAttribute = _optionalChain([readDecodedAttribute, 'call', _53 => _53(controlAttributes, "type"), 'optionalAccess', _54 => _54.trim, 'call', _55 => _55(), 'access', _56 => _56.toLowerCase, 'call', _57 => _57()]);
876
+ const typeAttribute = _optionalChain([readDecodedAttribute, 'call', _59 => _59(controlAttributes, "type"), 'optionalAccess', _60 => _60.trim, 'call', _61 => _61(), 'access', _62 => _62.toLowerCase, 'call', _63 => _63()]);
713
877
  const type = tag === "input" ? _nullishCoalesce(typeAttribute, () => ( "text")) : tag === "button" ? _nullishCoalesce(typeAttribute, () => ( "submit")) : tag;
714
878
  if (tag === "button" && !["button", "reset"].includes(type) || tag === "input" && (type === "submit" || type === "image")) {
715
879
  const submit = {
@@ -723,7 +887,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
723
887
  const resolved = resolveFormTarget(formAction, pageUrl);
724
888
  if (resolved) submit.action = resolved;
725
889
  }
726
- const formMethod = _optionalChain([readDecodedAttribute, 'call', _58 => _58(controlAttributes, "formmethod"), 'optionalAccess', _59 => _59.toLowerCase, 'call', _60 => _60()]);
890
+ const formMethod = _optionalChain([readDecodedAttribute, 'call', _64 => _64(controlAttributes, "formmethod"), 'optionalAccess', _65 => _65.toLowerCase, 'call', _66 => _66()]);
727
891
  if (formMethod === "get" || formMethod === "post") submit.method = formMethod.toUpperCase();
728
892
  form.submit.push(submit);
729
893
  continue;
@@ -802,7 +966,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, readPageForm, "readPageForm");
802
966
  function resolveFormTarget(action, pageUrl) {
803
967
  let target;
804
968
  try {
805
- target = new URL(_optionalChain([action, 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()]) || pageUrl.href, pageUrl);
969
+ target = new URL(_optionalChain([action, 'optionalAccess', _67 => _67.trim, 'call', _68 => _68()]) || pageUrl.href, pageUrl);
806
970
  } catch (e4) {
807
971
  return void 0;
808
972
  }
@@ -834,7 +998,7 @@ function readHtmlAttribute(attributes, name) {
834
998
  _chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlAttribute, "readHtmlAttribute");
835
999
  function readCodeLanguage(attributesList) {
836
1000
  for (const attributes of attributesList) {
837
- const language = _nullishCoalesce(_nullishCoalesce(readHtmlAttribute(attributes, "data-language"), () => ( readHtmlAttribute(attributes, "data-lang"))), () => ( _optionalChain([readHtmlAttribute, 'call', _63 => _63(attributes, "class"), 'optionalAccess', _64 => _64.match, 'call', _65 => _65(/(?:^|\s)lang(?:uage)?-(\S+)/), 'optionalAccess', _66 => _66[1]])));
1001
+ const language = _nullishCoalesce(_nullishCoalesce(readHtmlAttribute(attributes, "data-language"), () => ( readHtmlAttribute(attributes, "data-lang"))), () => ( _optionalChain([readHtmlAttribute, 'call', _69 => _69(attributes, "class"), 'optionalAccess', _70 => _70.match, 'call', _71 => _71(/(?:^|\s)lang(?:uage)?-(\S+)/), 'optionalAccess', _72 => _72[1]])));
838
1002
  if (language && /^[\w#+.-]+$/.test(language)) return language;
839
1003
  }
840
1004
  return void 0;
@@ -947,7 +1111,7 @@ function matchClosingTags(html) {
947
1111
  while (match = tags.exec(html)) {
948
1112
  const name = match[2].toLowerCase();
949
1113
  if (match[1]) {
950
- const start = _optionalChain([open, 'access', _67 => _67.get, 'call', _68 => _68(name), 'optionalAccess', _69 => _69.pop, 'call', _70 => _70()]);
1114
+ const start = _optionalChain([open, 'access', _73 => _73.get, 'call', _74 => _74(name), 'optionalAccess', _75 => _75.pop, 'call', _76 => _76()]);
951
1115
  if (start !== void 0) closes.set(start, match.index + match[0].length);
952
1116
  } else if (!VOID_TAGS.has(name) && !isSelfClosingTag(match[0])) {
953
1117
  let starts = open.get(name);
@@ -982,7 +1146,7 @@ function resolveStreamedBoundaries(html, { boundaries, placeholders }) {
982
1146
  let cursor = 0;
983
1147
  let match;
984
1148
  while (match = openingTag.exec(html)) {
985
- const id = _optionalChain([/\sid="([^"]*)"/, 'access', _71 => _71.exec, 'call', _72 => _72(match[2]), 'optionalAccess', _73 => _73[1]]);
1149
+ const id = _optionalChain([/\sid="([^"]*)"/, 'access', _77 => _77.exec, 'call', _78 => _78(match[2]), 'optionalAccess', _79 => _79[1]]);
986
1150
  if (!id || !wanted.has(id) || segments.has(id)) continue;
987
1151
  const close = closingTags.get(match.index);
988
1152
  if (close === void 0) continue;