@pablopunk/webr 0.1.1

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 (126) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +17 -0
  3. package/bin/webr.mjs +11 -0
  4. package/dist/client/_astro/App.BxlQhLhN.css +1 -0
  5. package/dist/client/_astro/App.CzxEZ_Dw.js +2 -0
  6. package/dist/client/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CTgtIFyY.js +1 -0
  7. package/dist/client/_astro/addon-fit.jgKqzwky.js +1 -0
  8. package/dist/client/_astro/addon-web-links.C9lyQRxI.js +1 -0
  9. package/dist/client/_astro/client.BDkzSRUN.js +1 -0
  10. package/dist/client/_astro/client.Bbg9OBwT.js +1 -0
  11. package/dist/client/_astro/client.CLSsMr2g.js +9 -0
  12. package/dist/client/_astro/jetbrains-mono.CFJaiWaY.woff2 +0 -0
  13. package/dist/client/_astro/symbols-nerd.CEdkKAK8.woff2 +0 -0
  14. package/dist/client/_astro/xterm.B-l5AIf6.js +7 -0
  15. package/dist/client/apple-touch-icon.png +0 -0
  16. package/dist/client/brand-mark.png +0 -0
  17. package/dist/client/favicon-16.png +0 -0
  18. package/dist/client/favicon-32.png +0 -0
  19. package/dist/client/favicon.ico +0 -0
  20. package/dist/client/icon-192.png +0 -0
  21. package/dist/client/icon-512.png +0 -0
  22. package/dist/client/icon-maskable-512.png +0 -0
  23. package/dist/client/manifest.webmanifest +30 -0
  24. package/dist/server/chunks/App_BmsGAwGf.mjs +4314 -0
  25. package/dist/server/chunks/_id__u0ueX6GO.mjs +34 -0
  26. package/dist/server/chunks/_tab__DL6wyr-j.mjs +35 -0
  27. package/dist/server/chunks/_virtual_astro_server-island-manifest_C1Q2srgE.mjs +5 -0
  28. package/dist/server/chunks/_virtual_astro_session-driver_DS5V7T-N.mjs +6 -0
  29. package/dist/server/chunks/compiler_CpXox_xS.mjs +35 -0
  30. package/dist/server/chunks/console_CucE1SwS.mjs +170 -0
  31. package/dist/server/chunks/errors_BgIp4W2B.mjs +383 -0
  32. package/dist/server/chunks/index_DyyPce_k.mjs +22 -0
  33. package/dist/server/chunks/new_G7XChx5p.mjs +33 -0
  34. package/dist/server/chunks/node_BlixNyYV.mjs +1816 -0
  35. package/dist/server/chunks/noop-entrypoint_Z3zFhrGC.mjs +4 -0
  36. package/dist/server/chunks/remote_BxuVLM0r.mjs +169 -0
  37. package/dist/server/chunks/server_DS45LC4q.mjs +2496 -0
  38. package/dist/server/chunks/settings_DLV2Js3e.mjs +31 -0
  39. package/dist/server/chunks/sharp_CgNvPCpY.mjs +152 -0
  40. package/dist/server/chunks/vnode-children_CRmaSs5G.mjs +24 -0
  41. package/dist/server/entry.mjs +5837 -0
  42. package/dist/server/virtual_astro_middleware.mjs +4 -0
  43. package/drizzle/0000_gateway.sql +13 -0
  44. package/drizzle/0001_device_sessions.sql +9 -0
  45. package/drizzle/0002_audit_events.sql +7 -0
  46. package/drizzle/meta/_journal.json +1 -0
  47. package/package.json +88 -0
  48. package/server/cli.ts +93 -0
  49. package/server/command.ts +9 -0
  50. package/server/entry.ts +3 -0
  51. package/server/herdr-check.ts +37 -0
  52. package/server/home.ts +4 -0
  53. package/server/log-file.ts +52 -0
  54. package/server/package-info.ts +6 -0
  55. package/server/plugin/config.ts +14 -0
  56. package/server/plugin/dev.ts +27 -0
  57. package/server/plugin/files.ts +10 -0
  58. package/server/plugin/herdr.ts +33 -0
  59. package/server/plugin/index.ts +68 -0
  60. package/server/plugin/probe.ts +17 -0
  61. package/server/plugin/stop.ts +39 -0
  62. package/server/port.ts +8 -0
  63. package/server/run.ts +35 -0
  64. package/server/ssr.ts +23 -0
  65. package/server/start.ts +5 -0
  66. package/server/update/hint.ts +26 -0
  67. package/server/update/index.ts +33 -0
  68. package/server/update/latest.ts +33 -0
  69. package/server/update/package-manager.ts +24 -0
  70. package/server/update/versions.ts +15 -0
  71. package/src/lib/avatars.ts +15 -0
  72. package/src/lib/launch.ts +16 -0
  73. package/src/lib/machines.ts +41 -0
  74. package/src/lib/mock-store.ts +82 -0
  75. package/src/lib/models.ts +139 -0
  76. package/src/lib/project-icons.ts +120 -0
  77. package/src/lib/terminal-split.ts +23 -0
  78. package/src/lib/uuid.ts +10 -0
  79. package/src/server/auth/access.ts +22 -0
  80. package/src/server/auth/audit.ts +15 -0
  81. package/src/server/auth/auth.ts +134 -0
  82. package/src/server/auth/pair-page.ts +85 -0
  83. package/src/server/auth/pairing.ts +91 -0
  84. package/src/server/auth/presence.ts +8 -0
  85. package/src/server/auth/sessions.ts +48 -0
  86. package/src/server/directories.ts +21 -0
  87. package/src/server/dist.ts +3 -0
  88. package/src/server/host.ts +166 -0
  89. package/src/server/perf-log.ts +23 -0
  90. package/src/server/protocol/deadlines.ts +24 -0
  91. package/src/server/protocol/native.ts +10 -0
  92. package/src/server/protocol/ndjson.ts +22 -0
  93. package/src/server/protocol/socket.ts +81 -0
  94. package/src/server/protocol/validate.ts +17 -0
  95. package/src/server/public-urls.ts +17 -0
  96. package/src/server/runtime/herdr-actions.ts +122 -0
  97. package/src/server/runtime/launch.ts +55 -0
  98. package/src/server/runtime/manager.ts +187 -0
  99. package/src/server/runtime/reconcile.ts +51 -0
  100. package/src/server/runtime/supervisor.ts +92 -0
  101. package/src/server/runtime/target.ts +37 -0
  102. package/src/server/runtime/workspace.ts +24 -0
  103. package/src/server/storage/database.ts +88 -0
  104. package/src/server/storage/drizzle-node-sqlite.ts +18 -0
  105. package/src/server/storage/node-sqlite-client.ts +44 -0
  106. package/src/server/storage/schema.ts +25 -0
  107. package/src/server/tailscale-host.ts +17 -0
  108. package/src/server/terminal/cli.ts +44 -0
  109. package/src/server/terminal/hub.ts +140 -0
  110. package/src/server/terminal/writer.ts +38 -0
  111. package/src/server/transport/herdr-target.ts +148 -0
  112. package/src/server/transport/icons.ts +65 -0
  113. package/src/server/transport/identity.ts +5 -0
  114. package/src/server/transport/local-session.ts +65 -0
  115. package/src/server/transport/model-discovery.ts +18 -0
  116. package/src/server/transport/native-locations.ts +17 -0
  117. package/src/server/transport/process.ts +21 -0
  118. package/src/server/transport/registry.ts +27 -0
  119. package/src/server/transport/ssh.ts +47 -0
  120. package/src/server/uploads.ts +40 -0
  121. package/src/server/websockets.ts +62 -0
  122. package/src/shared/agent-kinds.ts +4 -0
  123. package/src/shared/frame.ts +38 -0
  124. package/src/shared/projects.ts +1 -0
  125. package/src/shared/retry.ts +1 -0
  126. package/src/shared/runtime.ts +33 -0
@@ -0,0 +1,2496 @@
1
+ import { B as OnlyResponseCanBeReturned, K as ResponseSentError, L as NoMatchingImport, M as MissingMediaQueryDirective, P as NoClientOnlyHint, R as NoMatchingRenderer, Z as UnavailableAstroGlobal, c as EndpointDidNotReturnAResponse, t as AstroError } from "./errors_BgIp4W2B.mjs";
2
+ import { decodeBase64, decodeHex, encodeBase64, encodeHexUpperCase } from "@oslojs/encoding";
3
+ import * as z from "zod/v4";
4
+ import colors from "piccolore";
5
+ import { clsx } from "clsx";
6
+ //#region \0rolldown/runtime.js
7
+ var __defProp = Object.defineProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
+ return target;
16
+ };
17
+ //#endregion
18
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/core/csp/config.js
19
+ var ALGORITHMS = {
20
+ "SHA-256": "sha256-",
21
+ "SHA-384": "sha384-",
22
+ "SHA-512": "sha512-"
23
+ };
24
+ var ALGORITHM_VALUES = Object.values(ALGORITHMS);
25
+ z.enum(Object.keys(ALGORITHMS)).optional().default("SHA-256");
26
+ var cspHashSchema = z.custom((value) => {
27
+ if (typeof value !== "string") return false;
28
+ return ALGORITHM_VALUES.some((allowedValue) => {
29
+ return value.startsWith(allowedValue);
30
+ });
31
+ });
32
+ var cspKindSchema = z.enum([
33
+ "element",
34
+ "attribute",
35
+ "default"
36
+ ]);
37
+ var ATTRIBUTE_ALLOWED_RESOURCES = [
38
+ "'none'",
39
+ "'unsafe-hashes'",
40
+ "'unsafe-inline'",
41
+ "'report-sample'"
42
+ ];
43
+ z.union([z.string(), z.object({
44
+ resource: z.string(),
45
+ kind: cspKindSchema
46
+ })]).superRefine((value, ctx) => {
47
+ const resource = typeof value === "string" ? value : value.resource;
48
+ const kind = typeof value === "string" ? "default" : value.kind;
49
+ if (kind === "element" && resource === "'unsafe-hashes'") ctx.addIssue({
50
+ code: z.ZodIssueCode.custom,
51
+ message: `The source \`'unsafe-hashes'\` is not valid for \`element\` resources (it is rejected by \`script-src-elem\`/\`style-src-elem\`).`,
52
+ fatal: true
53
+ });
54
+ else if (kind === "attribute" && !ATTRIBUTE_ALLOWED_RESOURCES.includes(resource)) ctx.addIssue({
55
+ code: z.ZodIssueCode.custom,
56
+ message: `The source \`${resource}\` is not valid for \`attribute\` resources. \`script-src-attr\`/\`style-src-attr\` only accept: ${ATTRIBUTE_ALLOWED_RESOURCES.join(", ")}.`,
57
+ fatal: true
58
+ });
59
+ });
60
+ z.union([cspHashSchema, z.object({
61
+ hash: cspHashSchema,
62
+ kind: cspKindSchema
63
+ })]);
64
+ var ALLOWED_DIRECTIVES = [
65
+ "base-uri",
66
+ "child-src",
67
+ "connect-src",
68
+ "default-src",
69
+ "fenced-frame-src",
70
+ "font-src",
71
+ "form-action",
72
+ "frame-ancestors",
73
+ "frame-src",
74
+ "img-src",
75
+ "manifest-src",
76
+ "media-src",
77
+ "object-src",
78
+ "referrer",
79
+ "report-to",
80
+ "report-uri",
81
+ "require-trusted-types-for",
82
+ "sandbox",
83
+ "trusted-types",
84
+ "upgrade-insecure-requests",
85
+ "worker-src"
86
+ ];
87
+ z.custom((v) => typeof v === "string").superRefine((value, ctx) => {
88
+ if (!ALLOWED_DIRECTIVES.some((allowedValue) => {
89
+ return value.startsWith(allowedValue);
90
+ })) {
91
+ if (value.startsWith("script-src") || value.startsWith("style-src")) ctx.addIssue({
92
+ code: z.ZodIssueCode.custom,
93
+ message: `Directives \`script-src\` and \`style-src\` (including their \`-elem\`/\`-attr\` variants) are not allowed in \`security.csp.directives\`. Please use \`security.csp.scriptDirective\` and \`security.csp.styleDirective\` instead, scoping resources/hashes to the more specific directives with the \`kind\` option (\`"element"\` or \`"attribute"\`).`,
94
+ fatal: true
95
+ });
96
+ else ctx.addIssue({
97
+ code: z.ZodIssueCode.custom,
98
+ message: `Invalid directive: "${value}". Allowed directives are: ${ALLOWED_DIRECTIVES.join(", ")}`,
99
+ fatal: true
100
+ });
101
+ }
102
+ });
103
+ //#endregion
104
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/core/encryption.js
105
+ var ALGORITHM = "AES-GCM";
106
+ async function decodeKey(encoded) {
107
+ const bytes = decodeBase64(encoded);
108
+ return crypto.subtle.importKey("raw", bytes.buffer, ALGORITHM, true, ["encrypt", "decrypt"]);
109
+ }
110
+ var encoder$1 = new TextEncoder();
111
+ var decoder$1 = new TextDecoder();
112
+ var IV_LENGTH = 24;
113
+ async function encryptString(key, raw, additionalData) {
114
+ const iv = crypto.getRandomValues(new Uint8Array(IV_LENGTH / 2));
115
+ const data = encoder$1.encode(raw);
116
+ const params = {
117
+ name: ALGORITHM,
118
+ iv
119
+ };
120
+ if (additionalData) params.additionalData = encoder$1.encode(additionalData);
121
+ const buffer = await crypto.subtle.encrypt(params, key, data);
122
+ return encodeHexUpperCase(iv) + encodeBase64(new Uint8Array(buffer));
123
+ }
124
+ async function decryptString(key, encoded, additionalData) {
125
+ const iv = decodeHex(encoded.slice(0, IV_LENGTH));
126
+ const dataArray = decodeBase64(encoded.slice(IV_LENGTH));
127
+ const params = {
128
+ name: ALGORITHM,
129
+ iv
130
+ };
131
+ if (additionalData) params.additionalData = encoder$1.encode(additionalData);
132
+ const decryptedBuffer = await crypto.subtle.decrypt(params, key, dataArray);
133
+ return decoder$1.decode(decryptedBuffer);
134
+ }
135
+ async function generateCspDigest(data, algorithm) {
136
+ const hashBuffer = await crypto.subtle.digest(algorithm, encoder$1.encode(data));
137
+ const hash = encodeBase64(new Uint8Array(hashBuffer));
138
+ return `${ALGORITHMS[algorithm]}${hash}`;
139
+ }
140
+ var ASTRO_GENERATOR = `Astro v7.3.5`;
141
+ var ASTRO_ERROR_HEADER = "X-Astro-Error";
142
+ var DEFAULT_404_COMPONENT = "astro-default-404.astro";
143
+ var REDIRECT_STATUS_CODES = [
144
+ 301,
145
+ 302,
146
+ 303,
147
+ 307,
148
+ 308,
149
+ 300,
150
+ 304
151
+ ];
152
+ var REROUTABLE_STATUS_CODES = [404, 500];
153
+ var clientAddressSymbol = /* @__PURE__ */ Symbol.for("astro.clientAddress");
154
+ var originPathnameSymbol = /* @__PURE__ */ Symbol.for("astro.originPathname");
155
+ var fetchStateSymbol = /* @__PURE__ */ Symbol.for("astro.fetchState");
156
+ var nodeRequestAbortControllerCleanupSymbol = /* @__PURE__ */ Symbol.for("astro.nodeRequestAbortControllerCleanup");
157
+ var responseSentSymbol = /* @__PURE__ */ Symbol.for("astro.responseSent");
158
+ //#endregion
159
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/core/routing/internal/route-errors.js
160
+ var ROUTE404_RE = /^\/404\/?$/;
161
+ var ROUTE500_RE = /^\/500\/?$/;
162
+ function isRoute404(route) {
163
+ return ROUTE404_RE.test(route);
164
+ }
165
+ function isRoute500(route) {
166
+ return ROUTE500_RE.test(route);
167
+ }
168
+ //#endregion
169
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/astro-global.js
170
+ function createError(name) {
171
+ return new AstroError({
172
+ ...UnavailableAstroGlobal,
173
+ message: UnavailableAstroGlobal.message(name)
174
+ });
175
+ }
176
+ function createAstro(site) {
177
+ return {
178
+ get site() {
179
+ console.warn(`Astro.site inside getStaticPaths is deprecated and will be removed in a future major version of Astro. Use import.meta.env.SITE instead`);
180
+ return site ? new URL(site) : void 0;
181
+ },
182
+ get generator() {
183
+ console.warn(`Astro.generator inside getStaticPaths is deprecated and will be removed in a future major version of Astro.`);
184
+ return ASTRO_GENERATOR;
185
+ },
186
+ get callAction() {
187
+ throw createError("callAction");
188
+ },
189
+ get clientAddress() {
190
+ throw createError("clientAddress");
191
+ },
192
+ get cookies() {
193
+ throw createError("cookies");
194
+ },
195
+ get csp() {
196
+ throw createError("csp");
197
+ },
198
+ get currentLocale() {
199
+ throw createError("currentLocale");
200
+ },
201
+ get getActionResult() {
202
+ throw createError("getActionResult");
203
+ },
204
+ get isPrerendered() {
205
+ throw createError("isPrerendered");
206
+ },
207
+ get locals() {
208
+ throw createError("locals");
209
+ },
210
+ get originPathname() {
211
+ throw createError("originPathname");
212
+ },
213
+ get params() {
214
+ throw createError("params");
215
+ },
216
+ get preferredLocale() {
217
+ throw createError("preferredLocale");
218
+ },
219
+ get preferredLocaleList() {
220
+ throw createError("preferredLocaleList");
221
+ },
222
+ get props() {
223
+ throw createError("props");
224
+ },
225
+ get redirect() {
226
+ throw createError("redirect");
227
+ },
228
+ get request() {
229
+ throw createError("request");
230
+ },
231
+ get response() {
232
+ throw createError("response");
233
+ },
234
+ get rewrite() {
235
+ throw createError("rewrite");
236
+ },
237
+ get routePattern() {
238
+ throw createError("routePattern");
239
+ },
240
+ get self() {
241
+ throw createError("self");
242
+ },
243
+ get slots() {
244
+ throw createError("slots");
245
+ },
246
+ get url() {
247
+ throw createError("url");
248
+ },
249
+ get session() {
250
+ throw createError("session");
251
+ },
252
+ get cache() {
253
+ throw createError("cache");
254
+ },
255
+ get logger() {
256
+ throw createError("logger");
257
+ }
258
+ };
259
+ }
260
+ //#endregion
261
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/endpoint.js
262
+ async function renderEndpoint(mod, context, isPrerendered, logger, state) {
263
+ const { request, url } = context;
264
+ const method = request.method.toUpperCase();
265
+ let handler = mod[method] ?? mod["ALL"];
266
+ if (!handler && method === "HEAD" && mod["GET"]) handler = mod["GET"];
267
+ if (isPrerendered && !["GET", "HEAD"].includes(method)) logger.warn("router", `${url.pathname} ${colors.bold(method)} requests are not available in static endpoints. Mark this page as server-rendered (\`export const prerender = false;\`) or update your config to \`output: 'server'\` to make all your pages server-rendered by default.`);
268
+ if (handler === void 0) {
269
+ logger.warn("router", `No API Route handler exists for the method "${method}" for the route "${url.pathname}".
270
+ Found handlers: ${Object.keys(mod).map((exp) => JSON.stringify(exp)).join(", ")}
271
+ ` + ("all" in mod ? `One of the exported handlers is "all" (lowercase), did you mean to export 'ALL'?
272
+ ` : ""));
273
+ return new Response(null, { status: 404 });
274
+ }
275
+ if (typeof handler !== "function") {
276
+ logger.error("router", `The route "${url.pathname}" exports a value for the method "${method}", but it is of the type ${typeof handler} instead of a function.`);
277
+ return new Response(null, { status: 500 });
278
+ }
279
+ let response = await handler.call(mod, context);
280
+ if (!response || response instanceof Response === false) throw new AstroError(EndpointDidNotReturnAResponse);
281
+ if (state && REROUTABLE_STATUS_CODES.includes(response.status)) state.skipErrorReroute = true;
282
+ if (method === "HEAD") return new Response(null, response);
283
+ return response;
284
+ }
285
+ //#endregion
286
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/util.js
287
+ function isPromise(value) {
288
+ return typeof value === "object" && value !== null && typeof value.then === "function";
289
+ }
290
+ async function* streamAsyncIterator(stream) {
291
+ const reader = stream.getReader();
292
+ try {
293
+ while (true) {
294
+ const { done, value } = await reader.read();
295
+ if (done) return;
296
+ yield value;
297
+ }
298
+ } finally {
299
+ reader.releaseLock();
300
+ }
301
+ }
302
+ //#endregion
303
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/escape.js
304
+ var ESCAPABLE = /[&<>'"]/g;
305
+ function entityFor(code) {
306
+ switch (code) {
307
+ case 38: return "&amp;";
308
+ case 60: return "&lt;";
309
+ case 62: return "&gt;";
310
+ case 39: return "&#39;";
311
+ default: return "&quot;";
312
+ }
313
+ }
314
+ function escapeHTML(value) {
315
+ ESCAPABLE.lastIndex = 0;
316
+ if (!ESCAPABLE.test(value)) return value;
317
+ let output = "";
318
+ let last = 0;
319
+ do {
320
+ const index = ESCAPABLE.lastIndex - 1;
321
+ if (last !== index) output += value.slice(last, index);
322
+ output += entityFor(value.charCodeAt(index));
323
+ last = index + 1;
324
+ } while (ESCAPABLE.test(value));
325
+ return last === value.length ? output : output + value.slice(last);
326
+ }
327
+ function stringifyForScript(value) {
328
+ return JSON.stringify(value)?.replace(/</g, "\\u003c");
329
+ }
330
+ function escapeStyleText(value) {
331
+ return value.replaceAll("<", "\\3C ");
332
+ }
333
+ var HTMLBytes = class extends Uint8Array {};
334
+ Object.defineProperty(HTMLBytes.prototype, Symbol.toStringTag, { get() {
335
+ return "HTMLBytes";
336
+ } });
337
+ var htmlStringSymbol = /* @__PURE__ */ Symbol.for("astro:html-string");
338
+ var HTMLString = class extends String {};
339
+ Object.defineProperty(HTMLString.prototype, htmlStringSymbol, { value: true });
340
+ var markHTMLString = (value) => {
341
+ if (isHTMLString(value)) return value;
342
+ if (typeof value === "string") return new HTMLString(value);
343
+ return value;
344
+ };
345
+ function isHTMLString(value) {
346
+ return typeof value === "object" && value !== null && value[htmlStringSymbol] === true;
347
+ }
348
+ function markHTMLBytes(bytes) {
349
+ return new HTMLBytes(bytes);
350
+ }
351
+ function hasGetReader(obj) {
352
+ return typeof obj.getReader === "function";
353
+ }
354
+ async function* unescapeChunksAsync(iterable) {
355
+ if (hasGetReader(iterable)) for await (const chunk of streamAsyncIterator(iterable)) yield unescapeHTML(chunk);
356
+ else for await (const chunk of iterable) yield unescapeHTML(chunk);
357
+ }
358
+ function* unescapeChunks(iterable) {
359
+ for (const chunk of iterable) yield unescapeHTML(chunk);
360
+ }
361
+ function unescapeHTML(str) {
362
+ if (!!str && typeof str === "object") {
363
+ if (str instanceof Uint8Array) return markHTMLBytes(str);
364
+ else if (str instanceof Response && str.body) {
365
+ const body = str.body;
366
+ return unescapeChunksAsync(body);
367
+ } else if (typeof str.then === "function") return Promise.resolve(str).then((value) => {
368
+ return unescapeHTML(value);
369
+ });
370
+ else if (str[/* @__PURE__ */ Symbol.for("astro:slot-string")]) return str;
371
+ else if (Symbol.iterator in str) return unescapeChunks(str);
372
+ else if (Symbol.asyncIterator in str || hasGetReader(str)) return unescapeChunksAsync(str);
373
+ }
374
+ return markHTMLString(str);
375
+ }
376
+ function isVNode(vnode) {
377
+ return vnode && typeof vnode === "object" && vnode["astro:jsx"];
378
+ }
379
+ //#endregion
380
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/core/head-propagation/resolver.js
381
+ function isPropagatingHint(hint) {
382
+ return hint === "self" || hint === "in-tree";
383
+ }
384
+ //#endregion
385
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/astro/factory.js
386
+ function isAstroComponentFactory(obj) {
387
+ return obj == null ? false : obj.isAstroComponentFactory === true;
388
+ }
389
+ //#endregion
390
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/serialize.js
391
+ var PROP_TYPE = {
392
+ Value: 0,
393
+ JSON: 1,
394
+ RegExp: 2,
395
+ Date: 3,
396
+ Map: 4,
397
+ Set: 5,
398
+ BigInt: 6,
399
+ URL: 7,
400
+ Uint8Array: 8,
401
+ Uint16Array: 9,
402
+ Uint32Array: 10,
403
+ Infinity: 11
404
+ };
405
+ function serializeArray(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
406
+ if (parents.has(value)) throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
407
+
408
+ Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);
409
+ parents.add(value);
410
+ const serialized = value.map((v) => {
411
+ return convertToSerializedForm(v, metadata, parents);
412
+ });
413
+ parents.delete(value);
414
+ return serialized;
415
+ }
416
+ function serializeObject(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
417
+ if (parents.has(value)) throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
418
+
419
+ Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);
420
+ parents.add(value);
421
+ const serialized = Object.fromEntries(Object.entries(value).map(([k, v]) => {
422
+ return [k, convertToSerializedForm(v, metadata, parents)];
423
+ }));
424
+ parents.delete(value);
425
+ return serialized;
426
+ }
427
+ function convertToSerializedForm(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
428
+ switch (Object.prototype.toString.call(value)) {
429
+ case "[object Date]": return [PROP_TYPE.Date, value.toISOString()];
430
+ case "[object RegExp]": return [PROP_TYPE.RegExp, value.source];
431
+ case "[object Map]": return [PROP_TYPE.Map, serializeArray(Array.from(value), metadata, parents)];
432
+ case "[object Set]": return [PROP_TYPE.Set, serializeArray(Array.from(value), metadata, parents)];
433
+ case "[object BigInt]": return [PROP_TYPE.BigInt, value.toString()];
434
+ case "[object URL]": return [PROP_TYPE.URL, value.toString()];
435
+ case "[object Array]": return [PROP_TYPE.JSON, serializeArray(value, metadata, parents)];
436
+ case "[object Uint8Array]": return [PROP_TYPE.Uint8Array, Array.from(value)];
437
+ case "[object Uint16Array]": return [PROP_TYPE.Uint16Array, Array.from(value)];
438
+ case "[object Uint32Array]": return [PROP_TYPE.Uint32Array, Array.from(value)];
439
+ default:
440
+ if (value !== null && typeof value === "object") return [PROP_TYPE.Value, serializeObject(value, metadata, parents)];
441
+ if (value === Number.POSITIVE_INFINITY) return [PROP_TYPE.Infinity, 1];
442
+ if (value === Number.NEGATIVE_INFINITY) return [PROP_TYPE.Infinity, -1];
443
+ if (value === void 0) return [PROP_TYPE.Value];
444
+ return [PROP_TYPE.Value, value];
445
+ }
446
+ }
447
+ function serializeProps(props, metadata) {
448
+ return JSON.stringify(serializeObject(props, metadata));
449
+ }
450
+ //#endregion
451
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/hydration.js
452
+ var transitionDirectivesToCopyOnIsland = /* @__PURE__ */ new Set([
453
+ "data-astro-transition-scope",
454
+ "data-astro-transition-persist",
455
+ "data-astro-transition-persist-props"
456
+ ]);
457
+ function extractDirectives(inputProps, clientDirectives) {
458
+ let extracted = {
459
+ isPage: false,
460
+ hydration: null,
461
+ props: {},
462
+ propsWithoutTransitionAttributes: {}
463
+ };
464
+ for (const key of Object.keys(inputProps)) {
465
+ const value = inputProps[key];
466
+ if (key.startsWith("server:")) {
467
+ if (key === "server:root") extracted.isPage = true;
468
+ }
469
+ if (key.startsWith("client:")) {
470
+ if (!extracted.hydration) extracted.hydration = {
471
+ directive: "",
472
+ value: "",
473
+ componentUrl: "",
474
+ componentExport: { value: "" }
475
+ };
476
+ switch (key) {
477
+ case "client:component-path":
478
+ extracted.hydration.componentUrl = value;
479
+ break;
480
+ case "client:component-export":
481
+ extracted.hydration.componentExport.value = value;
482
+ break;
483
+ case "client:component-hydration": break;
484
+ case "client:display-name": break;
485
+ default:
486
+ extracted.hydration.directive = key.split(":")[1];
487
+ extracted.hydration.value = value;
488
+ if (!clientDirectives.has(extracted.hydration.directive)) {
489
+ const hydrationMethods = Array.from(clientDirectives.keys()).map((d) => `client:${d}`).join(", ");
490
+ throw new Error(`Error: invalid hydration directive "${key}". Supported hydration methods: ${hydrationMethods}`);
491
+ }
492
+ if (extracted.hydration.directive === "media" && typeof extracted.hydration.value !== "string") throw new AstroError(MissingMediaQueryDirective);
493
+ }
494
+ } else {
495
+ extracted.props[key] = value;
496
+ if (!transitionDirectivesToCopyOnIsland.has(key)) extracted.propsWithoutTransitionAttributes[key] = value;
497
+ }
498
+ }
499
+ for (const sym of Object.getOwnPropertySymbols(inputProps)) {
500
+ extracted.props[sym] = inputProps[sym];
501
+ extracted.propsWithoutTransitionAttributes[sym] = inputProps[sym];
502
+ }
503
+ return extracted;
504
+ }
505
+ async function generateHydrateScript(scriptOptions, metadata) {
506
+ const { renderer, result, astroId, props, attrs } = scriptOptions;
507
+ const { hydrate, componentUrl, componentExport } = metadata;
508
+ if (!componentExport.value) throw new AstroError({
509
+ ...NoMatchingImport,
510
+ message: NoMatchingImport.message(metadata.displayName)
511
+ });
512
+ const island = {
513
+ children: "",
514
+ props: { uid: astroId }
515
+ };
516
+ if (attrs) for (const [key, value] of Object.entries(attrs)) island.props[key] = escapeHTML(String(value));
517
+ island.props["component-url"] = await result.resolve(decodeURI(componentUrl));
518
+ if (renderer.clientEntrypoint) {
519
+ island.props["component-export"] = componentExport.value;
520
+ island.props["renderer-url"] = await result.resolve(decodeURI(renderer.clientEntrypoint.toString()));
521
+ island.props["props"] = escapeHTML(serializeProps(props, metadata));
522
+ }
523
+ island.props["ssr"] = "";
524
+ island.props["client"] = hydrate;
525
+ let beforeHydrationUrl = await result.resolve("astro:scripts/before-hydration.js");
526
+ if (beforeHydrationUrl.length) island.props["before-hydration-url"] = beforeHydrationUrl;
527
+ island.props["opts"] = escapeHTML(JSON.stringify({
528
+ name: metadata.displayName,
529
+ value: metadata.hydrateArgs || ""
530
+ }));
531
+ transitionDirectivesToCopyOnIsland.forEach((name) => {
532
+ if (typeof props[name] !== "undefined") island.props[name] = escapeHTML(String(props[name]));
533
+ });
534
+ return island;
535
+ }
536
+ //#endregion
537
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/shorthash.js
538
+ /**
539
+ * shortdash - https://github.com/bibig/node-shorthash
540
+ *
541
+ * @license
542
+ *
543
+ * (The MIT License)
544
+ *
545
+ * Copyright (c) 2013 Bibig <bibig@me.com>
546
+ *
547
+ * Permission is hereby granted, free of charge, to any person
548
+ * obtaining a copy of this software and associated documentation
549
+ * files (the "Software"), to deal in the Software without
550
+ * restriction, including without limitation the rights to use,
551
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
552
+ * copies of the Software, and to permit persons to whom the
553
+ * Software is furnished to do so, subject to the following
554
+ * conditions:
555
+ *
556
+ * The above copyright notice and this permission notice shall be
557
+ * included in all copies or substantial portions of the Software.
558
+ *
559
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
560
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
561
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
562
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
563
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
564
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
565
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
566
+ * OTHER DEALINGS IN THE SOFTWARE.
567
+ */
568
+ var dictionary = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY";
569
+ var binary = 61;
570
+ function bitwise(str) {
571
+ let hash = 0;
572
+ if (str.length === 0) return hash;
573
+ for (let i = 0; i < str.length; i++) {
574
+ const ch = str.charCodeAt(i);
575
+ hash = (hash << 5) - hash + ch;
576
+ hash = hash & hash;
577
+ }
578
+ return hash;
579
+ }
580
+ function shorthash(text) {
581
+ let num;
582
+ let result = "";
583
+ let integer = bitwise(text);
584
+ const sign = integer < 0 ? "Z" : "";
585
+ integer = Math.abs(integer);
586
+ while (integer >= binary) {
587
+ num = integer % binary;
588
+ integer = Math.floor(integer / binary);
589
+ result = dictionary[num] + result;
590
+ }
591
+ if (integer > 0) result = dictionary[integer] + result;
592
+ return sign + result;
593
+ }
594
+ //#endregion
595
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/astro/head-and-content.js
596
+ var headAndContentSym = /* @__PURE__ */ Symbol.for("astro.headAndContent");
597
+ function isHeadAndContent(obj) {
598
+ return typeof obj === "object" && obj !== null && !!obj[headAndContentSym];
599
+ }
600
+ function createThinHead() {
601
+ return { [headAndContentSym]: true };
602
+ }
603
+ //#endregion
604
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/astro-island.prebuilt.js
605
+ var astro_island_prebuilt_default = `(()=>{var g=Object.defineProperty;var w=(a,s,c)=>s in a?g(a,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[s]=c;var l=(a,s,c)=>w(a,typeof s!="symbol"?s+"":s,c);var E=new Set(["__proto__","constructor","prototype"]);{let a={0:t=>y(t),1:t=>c(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(c(t)),5:t=>new Set(c(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>Number.POSITIVE_INFINITY*t},s=t=>{let[p,e]=t;return p in a?a[p](e):void 0},c=t=>t.map(s),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,s(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let r=this.querySelectorAll("astro-slot"),n={},d=this.querySelectorAll("template[data-astro-template]");for(let o of d){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute("data-astro-template")||"default"]=o.innerHTML,o.remove())}for(let o of r){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute("name")||"default"]=o.innerHTML)}let u;try{u=this.hasAttribute("props")?y(JSON.parse(this.getAttribute("props"))):{}}catch(o){let i=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(i+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${i}\`,this.getAttribute("props"),o),o}let h;await this.hydrator(this)(this.Component,u,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}getRetryImportUrl(e){let r=new URL(e,document.baseURI);return r.searchParams.set("astro-retry",Date.now().toString()),r.toString()}async importWithRetry(e){try{return await import(e)}catch(r){return await new Promise(n=>setTimeout(n,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let r=this.getAttribute("component-url"),n=new CustomEvent("astro:hydration-error",{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:r}});this.dispatchEvent(n)&&console.error(\`[astro-island] Error hydrating \${r}\`,e)}async start(){let e=JSON.parse(this.getAttribute("opts")),r=this.getAttribute("client");if(Astro[r]===void 0){window.addEventListener(\`astro:\${r}\`,()=>this.start(),{once:!0});return}try{await Astro[r](async()=>{let n=this.getAttribute("renderer-url");try{let[d,{default:u}]=await Promise.all([this.importWithRetry(this.getAttribute("component-url")),n?this.importWithRetry(n):Promise.resolve({default:()=>()=>{}})]),h=this.getAttribute("component-export")||"default";if(h.includes(".")){this.Component=d;for(let m of h.split(".")){if(E.has(m)||!this.Component||typeof this.Component!="object"&&typeof this.Component!="function"||!Object.hasOwn(this.Component,m))throw new Error(\`Invalid component export path: \${h}\`);this.Component=this.Component[m]}}else{if(E.has(h))throw new Error(\`Invalid component export path: \${h}\`);this.Component=d[h]}return this.hydrator=u,this.hydrate}catch(d){return this.handleHydrationError(d),()=>{}}},e,this)}catch(n){this.handleHydrationError(n)}}attributeChangedCallback(){this.hydrate()}}l(f,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",f)}})();`;
606
+ //#endregion
607
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/astro-island.prebuilt-dev.js
608
+ var astro_island_prebuilt_dev_default = `(()=>{var g=Object.defineProperty;var w=(c,s,d)=>s in c?g(c,s,{enumerable:!0,configurable:!0,writable:!0,value:d}):c[s]=d;var l=(c,s,d)=>w(c,typeof s!="symbol"?s+"":s,d);var E=new Set(["__proto__","constructor","prototype"]);{let c={0:t=>y(t),1:t=>d(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(d(t)),5:t=>new Set(d(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>Number.POSITIVE_INFINITY*t},s=t=>{let[p,e]=t;return p in c?c[p](e):void 0},d=t=>t.map(s),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,s(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let r=this.querySelectorAll("astro-slot"),n={},h=this.querySelectorAll("template[data-astro-template]");for(let o of h){let a=o.closest(this.tagName);a!=null&&a.isSameNode(this)&&(n[o.getAttribute("data-astro-template")||"default"]=o.innerHTML,o.remove())}for(let o of r){let a=o.closest(this.tagName);a!=null&&a.isSameNode(this)&&(n[o.getAttribute("name")||"default"]=o.innerHTML)}let m;try{m=this.hasAttribute("props")?y(JSON.parse(this.getAttribute("props"))):{}}catch(o){let a=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(a+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${a}\`,this.getAttribute("props"),o),o}let i,u=this.hydrator(this);i=performance.now(),await u(this.Component,m,n,{client:this.getAttribute("client")}),i&&this.setAttribute("client-render-time",(performance.now()-i).toString()),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}getRetryImportUrl(e){let r=new URL(e,document.baseURI);return r.searchParams.set("astro-retry",Date.now().toString()),r.toString()}async importWithRetry(e){try{return await import(e)}catch(r){return await new Promise(n=>setTimeout(n,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let r=this.getAttribute("component-url"),n=new CustomEvent("astro:hydration-error",{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:r}});this.dispatchEvent(n)&&console.error(\`[astro-island] Error hydrating \${r}\`,e)}async start(){let e=JSON.parse(this.getAttribute("opts")),r=this.getAttribute("client");if(Astro[r]===void 0){window.addEventListener(\`astro:\${r}\`,()=>this.start(),{once:!0});return}try{await Astro[r](async()=>{let n=this.getAttribute("renderer-url");try{let[h,{default:m}]=await Promise.all([this.importWithRetry(this.getAttribute("component-url")),n?this.importWithRetry(n):Promise.resolve({default:()=>()=>{}})]),i=this.getAttribute("component-export")||"default";if(i.includes(".")){this.Component=h;for(let u of i.split(".")){if(E.has(u)||!this.Component||typeof this.Component!="object"&&typeof this.Component!="function"||!Object.hasOwn(this.Component,u))throw new Error(\`Invalid component export path: \${i}\`);this.Component=this.Component[u]}}else{if(E.has(i))throw new Error(\`Invalid component export path: \${i}\`);this.Component=h[i]}return this.hydrator=m,this.hydrate}catch(h){return this.handleHydrationError(h),()=>{}}},e,this)}catch(n){this.handleHydrationError(n)}}attributeChangedCallback(){this.hydrate()}}l(f,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",f)}})();`;
609
+ //#endregion
610
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/astro-island-styles.js
611
+ var ISLAND_STYLES = "astro-island,astro-slot,astro-static-slot{display:contents}";
612
+ //#endregion
613
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/scripts.js
614
+ function determineIfNeedsHydrationScript(result) {
615
+ if (result._metadata.templateDepth > 0) return !result._metadata.hasHydrationScript;
616
+ if (result._metadata.hasHydrationScript) return false;
617
+ return result._metadata.hasHydrationScript = true;
618
+ }
619
+ function determinesIfNeedsDirectiveScript(result, directive) {
620
+ if (result._metadata.templateDepth > 0) return !result._metadata.hasDirectives.has(directive);
621
+ if (result._metadata.hasDirectives.has(directive)) return false;
622
+ result._metadata.hasDirectives.add(directive);
623
+ return true;
624
+ }
625
+ function getDirectiveScriptText(result, directive) {
626
+ const clientDirective = result.clientDirectives.get(directive);
627
+ if (!clientDirective) throw new Error(`Unknown directive: ${directive}`);
628
+ return clientDirective;
629
+ }
630
+ function getPrescripts(result, type, directive) {
631
+ switch (type) {
632
+ case "both": return `<style>${ISLAND_STYLES}</style><script>${getDirectiveScriptText(result, directive)}<\/script><script>${process.env.NODE_ENV === "development" ? astro_island_prebuilt_dev_default : astro_island_prebuilt_default}<\/script>`;
633
+ case "directive": return `<script>${getDirectiveScriptText(result, directive)}<\/script>`;
634
+ }
635
+ }
636
+ //#endregion
637
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/core/head-propagation/buffer.js
638
+ async function collectPropagatedHeadParts(input) {
639
+ const collectedHeadParts = [];
640
+ const pendingSlotEvaluations = input.result._metadata?.pendingSlotEvaluations ?? [];
641
+ const drainPendingSlots = async () => {
642
+ while (pendingSlotEvaluations.length > 0) {
643
+ const batch = pendingSlotEvaluations.splice(0, pendingSlotEvaluations.length);
644
+ await Promise.all(batch);
645
+ }
646
+ };
647
+ await drainPendingSlots();
648
+ for (const propagator of input.propagators) {
649
+ const returnValue = await propagator.init(input.result);
650
+ if (input.isHeadAndContent(returnValue) && returnValue.head) collectedHeadParts.push(returnValue.head);
651
+ await drainPendingSlots();
652
+ }
653
+ return collectedHeadParts;
654
+ }
655
+ //#endregion
656
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/core/head-propagation/policy.js
657
+ function shouldRenderHeadInstruction(state) {
658
+ return !state.hasRenderedHead && !state.partial;
659
+ }
660
+ function shouldRenderMaybeHeadInstruction(state) {
661
+ return !state.hasRenderedHead && !state.headInTree && !state.partial;
662
+ }
663
+ function shouldRenderInstruction$1(type, state) {
664
+ return type === "head" ? shouldRenderHeadInstruction(state) : shouldRenderMaybeHeadInstruction(state);
665
+ }
666
+ //#endregion
667
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/head-propagation/runtime.js
668
+ function registerIfPropagating(result, factory, instance) {
669
+ if (factory.propagation === "self" || factory.propagation === "in-tree") {
670
+ result._metadata.propagators.add(instance);
671
+ return;
672
+ }
673
+ if (factory.moduleId) {
674
+ const hint = result.componentMetadata.get(factory.moduleId)?.propagation;
675
+ if (isPropagatingHint(hint ?? "none")) result._metadata.propagators.add(instance);
676
+ }
677
+ }
678
+ async function bufferPropagatedHead(result) {
679
+ const collected = await collectPropagatedHeadParts({
680
+ propagators: result._metadata.propagators,
681
+ result,
682
+ isHeadAndContent
683
+ });
684
+ result._metadata.extraHead.push(...collected);
685
+ }
686
+ function shouldRenderInstruction(type, state) {
687
+ return shouldRenderInstruction$1(type, state);
688
+ }
689
+ function getInstructionRenderState(result) {
690
+ return {
691
+ hasRenderedHead: result._metadata.hasRenderedHead,
692
+ headInTree: result._metadata.headInTree,
693
+ partial: result.partial
694
+ };
695
+ }
696
+ //#endregion
697
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/core/csp/runtime.js
698
+ function normalizeCspResourceEntry(entry) {
699
+ if (typeof entry === "string") return {
700
+ resource: entry,
701
+ kind: "default"
702
+ };
703
+ return {
704
+ resource: entry.resource,
705
+ kind: entry.kind ?? "default"
706
+ };
707
+ }
708
+ function normalizeCspHashEntry(entry) {
709
+ if (typeof entry === "string") return {
710
+ hash: entry,
711
+ kind: "default"
712
+ };
713
+ return {
714
+ hash: entry.hash,
715
+ kind: entry.kind ?? "default"
716
+ };
717
+ }
718
+ function partitionByKind(directive) {
719
+ const groups = {
720
+ default: {
721
+ resources: [],
722
+ hashes: []
723
+ },
724
+ element: {
725
+ resources: [],
726
+ hashes: []
727
+ },
728
+ attribute: {
729
+ resources: [],
730
+ hashes: []
731
+ }
732
+ };
733
+ for (const entry of directive.resources) {
734
+ const { resource, kind } = normalizeCspResourceEntry(entry);
735
+ groups[kind].resources.push(resource);
736
+ }
737
+ for (const entry of directive.hashes) {
738
+ const { hash, kind } = normalizeCspHashEntry(entry);
739
+ groups[kind].hashes.push(hash);
740
+ }
741
+ return groups;
742
+ }
743
+ function deduplicateDirectiveValues(existingDirective, newDirective) {
744
+ const [directiveName, ...existingValues] = existingDirective.split(/\s+/).filter(Boolean);
745
+ const [newDirectiveName, ...newValues] = newDirective.split(/\s+/).filter(Boolean);
746
+ if (directiveName !== newDirectiveName) return;
747
+ return `${directiveName} ${Array.from(/* @__PURE__ */ new Set([...existingValues, ...newValues])).join(" ")}`;
748
+ }
749
+ function pushDirective(directives, newDirective) {
750
+ if (directives.length === 0) return [newDirective];
751
+ const finalDirectives = [];
752
+ let matched = false;
753
+ for (const directive of directives) {
754
+ if (matched) {
755
+ finalDirectives.push(directive);
756
+ continue;
757
+ }
758
+ const result = deduplicateDirectiveValues(directive, newDirective);
759
+ if (result) {
760
+ finalDirectives.push(result);
761
+ matched = true;
762
+ } else finalDirectives.push(directive);
763
+ }
764
+ if (!matched) finalDirectives.push(newDirective);
765
+ return finalDirectives;
766
+ }
767
+ //#endregion
768
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/csp.js
769
+ function renderCspContent(result) {
770
+ const { scriptDirective, styleDirective, directives } = result;
771
+ const script = partitionByKind(scriptDirective);
772
+ const style = partitionByKind(styleDirective);
773
+ const finalScriptHashes = /* @__PURE__ */ new Set();
774
+ for (const scriptHash of script.default.hashes) finalScriptHashes.add(`'${scriptHash}'`);
775
+ for (const scriptHash of result._metadata.extraScriptHashes) finalScriptHashes.add(`'${scriptHash}'`);
776
+ const finalStyleHashes = /* @__PURE__ */ new Set();
777
+ for (const styleHash of style.default.hashes) finalStyleHashes.add(`'${styleHash}'`);
778
+ for (const styleHash of result._metadata.extraStyleHashes) finalStyleHashes.add(`'${styleHash}'`);
779
+ let directivesContent;
780
+ if (directives.length > 0) directivesContent = directives.join(";") + ";";
781
+ const scriptResources = script.default.resources.length > 0 ? script.default.resources.join(" ") : "'self'";
782
+ const styleResources = style.default.resources.length > 0 ? style.default.resources.join(" ") : "'self'";
783
+ const scriptElementDefaultResource = script.default.resources.length > 0 ? "" : "'self'";
784
+ const styleElementDefaultResource = style.default.resources.length > 0 ? "" : "'self'";
785
+ const scriptElemActive = isEnabled(script.element);
786
+ const styleElemActive = isEnabled(style.element);
787
+ const strictDynamicSuffix = scriptDirective.strictDynamic ? ` 'strict-dynamic'` : "";
788
+ const scriptDefaultHasUnsafeInline = hasUnsafeInline(script.default.resources);
789
+ const styleDefaultHasUnsafeInline = hasUnsafeInline(style.default.resources);
790
+ const scriptSrc = `script-src ${scriptResources} ${[...scriptElemActive || scriptDefaultHasUnsafeInline ? [] : [...finalScriptHashes], ...scriptDirective.strictDynamic ? [`'strict-dynamic'`] : []].join(" ")};`;
791
+ const styleSrc = `style-src ${styleResources} ${(styleElemActive || styleDefaultHasUnsafeInline ? [] : [...finalStyleHashes]).join(" ")};`;
792
+ const scriptSrcElem = scriptElemActive ? renderSpecificDirective("script-src-elem", script.element.resources, scriptElementDefaultResource, finalScriptHashes, script.element.hashes, strictDynamicSuffix) : void 0;
793
+ const scriptSrcAttr = isEnabled(script.attribute) ? renderSpecificDirective("script-src-attr", script.attribute.resources, "'none'", void 0, script.attribute.hashes) : void 0;
794
+ const styleSrcElem = styleElemActive ? renderSpecificDirective("style-src-elem", style.element.resources, styleElementDefaultResource, finalStyleHashes, style.element.hashes) : void 0;
795
+ const styleSrcAttr = isEnabled(style.attribute) ? renderSpecificDirective("style-src-attr", style.attribute.resources, "'none'", void 0, style.attribute.hashes) : void 0;
796
+ return [
797
+ directivesContent,
798
+ scriptSrc,
799
+ scriptSrcElem,
800
+ scriptSrcAttr,
801
+ styleSrc,
802
+ styleSrcElem,
803
+ styleSrcAttr
804
+ ].filter(Boolean).join(" ");
805
+ }
806
+ function hasUnsafeInline(resources) {
807
+ return resources.includes("'unsafe-inline'");
808
+ }
809
+ function isEnabled(sources) {
810
+ return sources.resources.length > 0 || sources.hashes.length > 0;
811
+ }
812
+ function renderSpecificDirective(name, resources, defaultResource, sharedHashes, ownHashes, suffix = "") {
813
+ const unsafeInline = hasUnsafeInline(resources);
814
+ const hashes = new Set(unsafeInline ? void 0 : sharedHashes);
815
+ if (!unsafeInline) for (const hash of ownHashes) hashes.add(`'${hash}'`);
816
+ let finalResources;
817
+ if (resources.length > 0) finalResources = resources.map((r) => `${r}`).join(" ");
818
+ else if (defaultResource === "'none'" && hashes.size > 0) finalResources = "";
819
+ else finalResources = defaultResource;
820
+ return `${name} ${[finalResources, ...hashes].filter(Boolean).join(" ")}${suffix};`;
821
+ }
822
+ //#endregion
823
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/instruction.js
824
+ var RenderInstructionSymbol = /* @__PURE__ */ Symbol.for("astro:render");
825
+ function createRenderInstruction(instruction) {
826
+ instruction[RenderInstructionSymbol] = true;
827
+ return instruction;
828
+ }
829
+ function isRenderInstruction(chunk) {
830
+ return chunk && typeof chunk === "object" && chunk[RenderInstructionSymbol];
831
+ }
832
+ function isScriptInstruction(chunk) {
833
+ return chunk && typeof chunk === "object" && "type" in chunk && chunk.type === "script";
834
+ }
835
+ //#endregion
836
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/util.js
837
+ var voidElementNames = /^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;
838
+ var htmlBooleanAttributes = /^(?:allowfullscreen|async|autofocus|autoplay|checked|controls|default|defer|disabled|disablepictureinpicture|disableremoteplayback|formnovalidate|inert|loop|muted|nomodule|novalidate|open|playsinline|readonly|required|reversed|scoped|seamless|selected|itemscope)$/i;
839
+ var AMPERSAND_REGEX = /&/g;
840
+ var DOUBLE_QUOTE_REGEX = /"/g;
841
+ var STATIC_DIRECTIVES = /* @__PURE__ */ new Set(["set:html", "set:text"]);
842
+ var INVALID_ATTR_NAME_CHAR = /[\s"'>/=]/;
843
+ var toIdent = (k) => k.trim().replace(/(?!^)\b\w|\s+|\W+/g, (match, index) => {
844
+ if (/\W/.test(match)) return "";
845
+ return index === 0 ? match : match.toUpperCase();
846
+ });
847
+ var toAttributeString = (value, shouldEscape = true) => {
848
+ if (!shouldEscape) return value;
849
+ const str = String(value);
850
+ if (!str.includes("&") && !str.includes("\"")) return str;
851
+ return str.replace(AMPERSAND_REGEX, "&amp;").replace(DOUBLE_QUOTE_REGEX, "&quot;");
852
+ };
853
+ var kebab = (k) => k.toLowerCase() === k ? k : k.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
854
+ var toStyleString = (obj) => {
855
+ let output = "";
856
+ for (const key of Object.keys(obj)) {
857
+ const value = obj[key];
858
+ if (!(typeof value === "string" && value.trim() || typeof value === "number")) continue;
859
+ if (output) output += ";";
860
+ output += key[0] !== "-" && key[1] !== "-" ? `${kebab(key)}:${value}` : `${key}:${value}`;
861
+ }
862
+ return output;
863
+ };
864
+ function defineScriptVars(vars) {
865
+ let output = "";
866
+ for (const [key, value] of Object.entries(vars)) output += `const ${toIdent(key)} = ${stringifyForScript(value)};
867
+ `;
868
+ return markHTMLString(output);
869
+ }
870
+ function formatList(values) {
871
+ if (values.length === 1) return values[0];
872
+ return `${values.slice(0, -1).join(", ")} or ${values[values.length - 1]}`;
873
+ }
874
+ function isCustomElement(tagName) {
875
+ return tagName.includes("-");
876
+ }
877
+ function handleBooleanAttribute(key, value, shouldEscape, tagName) {
878
+ if (key === "popover") return markHTMLString(value ? ` ${key}` : "");
879
+ if (tagName && isCustomElement(tagName)) return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`);
880
+ return markHTMLString(value ? ` ${key}` : "");
881
+ }
882
+ var ATTRIBUTE_KIND = {
883
+ ORDINARY: 0,
884
+ INVALID_NAME: 1,
885
+ STATIC_DIRECTIVE: 2,
886
+ CLASS_LIST: 3,
887
+ STYLE: 4,
888
+ CLASS_NAME: 5,
889
+ BOOLEAN: 6,
890
+ BOOLEAN_IF_BOOLEAN: 7
891
+ };
892
+ function classifyAttribute(key) {
893
+ if (INVALID_ATTR_NAME_CHAR.test(key)) return ATTRIBUTE_KIND.INVALID_NAME;
894
+ if (STATIC_DIRECTIVES.has(key)) return ATTRIBUTE_KIND.STATIC_DIRECTIVE;
895
+ if (key === "class:list") return ATTRIBUTE_KIND.CLASS_LIST;
896
+ if (key === "style") return ATTRIBUTE_KIND.STYLE;
897
+ if (key === "className") return ATTRIBUTE_KIND.CLASS_NAME;
898
+ if (htmlBooleanAttributes.test(key)) return ATTRIBUTE_KIND.BOOLEAN;
899
+ if (key === "popover" || key === "download" || key === "hidden") return ATTRIBUTE_KIND.BOOLEAN_IF_BOOLEAN;
900
+ return ATTRIBUTE_KIND.ORDINARY;
901
+ }
902
+ function addAttribute(value, key, shouldEscape = true, tagName = "") {
903
+ if (value == null) return "";
904
+ switch (classifyAttribute(key)) {
905
+ case ATTRIBUTE_KIND.INVALID_NAME: return "";
906
+ case ATTRIBUTE_KIND.STATIC_DIRECTIVE:
907
+ console.warn(`[astro] The "${key}" directive cannot be applied dynamically at runtime. It will not be rendered as an attribute.
908
+
909
+ Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the dynamic spread syntax (\`{...{ "${key}": value }}\`).`);
910
+ return "";
911
+ case ATTRIBUTE_KIND.CLASS_LIST: {
912
+ const listValue = toAttributeString(clsx(value), shouldEscape);
913
+ if (listValue === "") return "";
914
+ return markHTMLString(` class="${listValue}"`);
915
+ }
916
+ case ATTRIBUTE_KIND.STYLE:
917
+ if (!(value instanceof HTMLString)) {
918
+ if (Array.isArray(value) && value.length === 2) return markHTMLString(` style="${toAttributeString(`${toStyleString(value[0])};${value[1]}`, shouldEscape)}"`);
919
+ if (typeof value === "object") return markHTMLString(` style="${toAttributeString(toStyleString(value), shouldEscape)}"`);
920
+ }
921
+ break;
922
+ case ATTRIBUTE_KIND.CLASS_NAME: return markHTMLString(` class="${toAttributeString(value, shouldEscape)}"`);
923
+ case ATTRIBUTE_KIND.BOOLEAN: return handleBooleanAttribute(key, value, shouldEscape, tagName);
924
+ case ATTRIBUTE_KIND.BOOLEAN_IF_BOOLEAN:
925
+ if (typeof value === "boolean") return handleBooleanAttribute(key, value, shouldEscape, tagName);
926
+ break;
927
+ case ATTRIBUTE_KIND.ORDINARY:
928
+ }
929
+ if (value === "") return markHTMLString(` ${key}`);
930
+ return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`);
931
+ }
932
+ function spreadElementAttributes(values) {
933
+ let output = "";
934
+ for (const key of Object.keys(values)) {
935
+ if (key === "children") continue;
936
+ output += addAttribute(values[key], key, true);
937
+ }
938
+ return output;
939
+ }
940
+ function internalSpreadAttributes(values, shouldEscape = true, tagName) {
941
+ let output = "";
942
+ for (const key of Object.keys(values)) output += addAttribute(values[key], key, shouldEscape, tagName);
943
+ return markHTMLString(output);
944
+ }
945
+ function renderElement$1(name, { props: _props, children = "" }, shouldEscape = true) {
946
+ const { lang: _, "data-astro-id": astroId, "define:vars": defineVars, ...props } = _props;
947
+ if (defineVars) {
948
+ if (name === "style") {
949
+ delete props["is:global"];
950
+ delete props["is:scoped"];
951
+ }
952
+ if (name === "script") {
953
+ delete props.hoist;
954
+ children = defineScriptVars(defineVars) + "\n" + children;
955
+ }
956
+ }
957
+ if ((children == null || children === "") && voidElementNames.test(name)) return `<${name}${internalSpreadAttributes(props, shouldEscape, name)}>`;
958
+ return `<${name}${internalSpreadAttributes(props, shouldEscape, name)}>${children}</${name}>`;
959
+ }
960
+ var noop = () => {};
961
+ var BufferedRenderer = class {
962
+ chunks = [];
963
+ renderPromise;
964
+ destination;
965
+ /**
966
+ * Determines whether buffer has been flushed
967
+ * to the final destination.
968
+ */
969
+ flushed = false;
970
+ constructor(destination, renderFunction) {
971
+ this.destination = destination;
972
+ this.renderPromise = renderFunction(this);
973
+ if (isPromise(this.renderPromise)) Promise.resolve(this.renderPromise).catch(noop);
974
+ }
975
+ write(chunk) {
976
+ if (this.flushed) this.destination.write(chunk);
977
+ else this.chunks.push(chunk);
978
+ }
979
+ flush() {
980
+ if (this.flushed) throw new Error("The render buffer has already been flushed.");
981
+ this.flushed = true;
982
+ for (const chunk of this.chunks) this.destination.write(chunk);
983
+ return this.renderPromise;
984
+ }
985
+ };
986
+ function createBufferedRenderer(destination, renderFunction) {
987
+ return new BufferedRenderer(destination, renderFunction);
988
+ }
989
+ var isNode = typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]";
990
+ var isDeno = typeof Deno !== "undefined";
991
+ var isWorkerd = typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers";
992
+ function promiseWithResolvers() {
993
+ let resolve, reject;
994
+ return {
995
+ promise: new Promise((_resolve, _reject) => {
996
+ resolve = _resolve;
997
+ reject = _reject;
998
+ }),
999
+ resolve,
1000
+ reject
1001
+ };
1002
+ }
1003
+ //#endregion
1004
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/head.js
1005
+ function stablePropsKey(props) {
1006
+ const keys = Object.keys(props).sort();
1007
+ let result = "{";
1008
+ for (let i = 0; i < keys.length; i++) {
1009
+ if (i > 0) result += ",";
1010
+ result += JSON.stringify(keys[i]) + ":" + JSON.stringify(props[keys[i]]);
1011
+ }
1012
+ result += "}";
1013
+ return result;
1014
+ }
1015
+ function deduplicateElements(elements) {
1016
+ if (elements.length <= 1) return elements;
1017
+ const seen = /* @__PURE__ */ new Set();
1018
+ return elements.filter((item) => {
1019
+ const key = stablePropsKey(item.props) + item.children;
1020
+ if (seen.has(key)) return false;
1021
+ seen.add(key);
1022
+ return true;
1023
+ });
1024
+ }
1025
+ function renderAllHeadContent(result) {
1026
+ result._metadata.hasRenderedHead = true;
1027
+ let content = "";
1028
+ if (result.shouldInjectCspMetaTags && result.cspDestination === "meta") content += renderElement$1("meta", {
1029
+ props: {
1030
+ "http-equiv": "content-security-policy",
1031
+ content: renderCspContent(result)
1032
+ },
1033
+ children: ""
1034
+ }, false);
1035
+ const styles = deduplicateElements(Array.from(result.styles)).map((style) => style.props.rel === "stylesheet" ? renderElement$1("link", style) : renderElement$1("style", style));
1036
+ result.styles.clear();
1037
+ const scripts = deduplicateElements(Array.from(result.scripts)).map((script) => {
1038
+ if (result.userAssetsBase) script.props.src = (result.base === "/" ? "" : result.base) + result.userAssetsBase + script.props.src;
1039
+ return renderElement$1("script", script, false);
1040
+ });
1041
+ const links = deduplicateElements(Array.from(result.links)).map((link) => renderElement$1("link", link, false));
1042
+ const sep = result.compressHTML === true || result.compressHTML === "jsx" ? "" : "\n";
1043
+ content += styles.join(sep) + links.join(sep) + scripts.join(sep);
1044
+ if (result.speculationRulesContent) content += renderElement$1("script", {
1045
+ props: { type: "speculationrules" },
1046
+ children: result.speculationRulesContent
1047
+ }, false);
1048
+ content += result._metadata.extraHead.join("");
1049
+ return markHTMLString(content);
1050
+ }
1051
+ var HEAD_INSTRUCTION = Object.freeze(createRenderInstruction({ type: "head" }));
1052
+ var MAYBE_HEAD_INSTRUCTION = Object.freeze(createRenderInstruction({ type: "maybe-head" }));
1053
+ function renderHead() {
1054
+ return HEAD_INSTRUCTION;
1055
+ }
1056
+ function maybeRenderHead() {
1057
+ return MAYBE_HEAD_INSTRUCTION;
1058
+ }
1059
+ //#endregion
1060
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/server-islands-shared.js
1061
+ var SERVER_ISLAND_START = "[if astro]>server-island-start<![endif]";
1062
+ //#endregion
1063
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/astro/render-template.js
1064
+ var renderTemplateResultSym = /* @__PURE__ */ Symbol.for("astro.renderTemplateResult");
1065
+ var markedHtmlParts = /* @__PURE__ */ new WeakMap();
1066
+ function markHtmlParts(htmlParts) {
1067
+ let marked = markedHtmlParts.get(htmlParts);
1068
+ if (marked === void 0) {
1069
+ marked = new Array(htmlParts.length);
1070
+ for (let i = 0; i < htmlParts.length; i++) marked[i] = htmlParts[i] ? markHTMLString(htmlParts[i]) : htmlParts[i];
1071
+ markedHtmlParts.set(htmlParts, marked);
1072
+ }
1073
+ return marked;
1074
+ }
1075
+ var RenderTemplateResult = class {
1076
+ [renderTemplateResultSym] = true;
1077
+ htmlParts;
1078
+ expressions;
1079
+ error;
1080
+ wrapped;
1081
+ constructor(htmlParts, expressions) {
1082
+ this.htmlParts = htmlParts;
1083
+ this.error = void 0;
1084
+ this.expressions = expressions;
1085
+ }
1086
+ catchExpressionError(index, expression) {
1087
+ if (this.wrapped?.has(index)) return expression;
1088
+ const wrapped = Promise.resolve(expression).catch((err) => {
1089
+ if (!this.error) {
1090
+ this.error = err;
1091
+ throw err;
1092
+ }
1093
+ });
1094
+ (this.wrapped ??= /* @__PURE__ */ new Set()).add(index);
1095
+ this.expressions[index] = wrapped;
1096
+ return wrapped;
1097
+ }
1098
+ render(destination) {
1099
+ const { expressions } = this;
1100
+ const htmlParts = markHtmlParts(this.htmlParts);
1101
+ for (let i = 0; i < htmlParts.length; i++) {
1102
+ const html = htmlParts[i];
1103
+ if (html) destination.write(html);
1104
+ if (i >= expressions.length) break;
1105
+ let exp = expressions[i];
1106
+ if (!(exp || exp === 0)) continue;
1107
+ if (isPromise(exp)) exp = this.catchExpressionError(i, exp);
1108
+ const result = renderChild(destination, exp);
1109
+ if (isPromise(result)) {
1110
+ const startIdx = i + 1;
1111
+ const remaining = expressions.length - startIdx;
1112
+ const flushers = new Array(remaining);
1113
+ for (let j = 0; j < remaining; j++) {
1114
+ let rExp = expressions[startIdx + j];
1115
+ if (isPromise(rExp)) rExp = this.catchExpressionError(startIdx + j, rExp);
1116
+ flushers[j] = createBufferedRenderer(destination, (bufferDestination) => {
1117
+ if (rExp || rExp === 0) return renderChild(bufferDestination, rExp);
1118
+ });
1119
+ }
1120
+ return result.then(() => {
1121
+ let k = 0;
1122
+ const iterate = () => {
1123
+ while (k < flushers.length) {
1124
+ const rHtml = htmlParts[startIdx + k];
1125
+ if (rHtml) destination.write(rHtml);
1126
+ const flushResult = flushers[k++].flush();
1127
+ if (isPromise(flushResult)) return flushResult.then(iterate);
1128
+ }
1129
+ const lastHtml = htmlParts[htmlParts.length - 1];
1130
+ if (lastHtml) destination.write(lastHtml);
1131
+ };
1132
+ return iterate();
1133
+ });
1134
+ }
1135
+ }
1136
+ }
1137
+ };
1138
+ function isRenderTemplateResult(obj) {
1139
+ return typeof obj === "object" && obj !== null && !!obj[renderTemplateResultSym];
1140
+ }
1141
+ function renderTemplate(htmlParts, ...expressions) {
1142
+ return new RenderTemplateResult(htmlParts, expressions);
1143
+ }
1144
+ //#endregion
1145
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/slot.js
1146
+ var slotString = /* @__PURE__ */ Symbol.for("astro:slot-string");
1147
+ var SlotString = class extends HTMLString {
1148
+ instructions;
1149
+ /**
1150
+ * The slot's content as an ordered stream. Unlike `instructions` (which holds
1151
+ * position-independent instructions like head/hydration content), scripts are
1152
+ * kept inline here so they render at their original position instead of being
1153
+ * hoisted to the start of the slot output.
1154
+ */
1155
+ chunks;
1156
+ [slotString];
1157
+ constructor(content, instructions, chunks = []) {
1158
+ super(content);
1159
+ this.instructions = instructions;
1160
+ this.chunks = chunks;
1161
+ this[slotString] = true;
1162
+ }
1163
+ };
1164
+ function isSlotString(str) {
1165
+ return !!str[slotString];
1166
+ }
1167
+ function mergeSlotInstructions(target, source) {
1168
+ if (source.instructions?.length) {
1169
+ target ??= [];
1170
+ target.push(...source.instructions);
1171
+ }
1172
+ return target;
1173
+ }
1174
+ var SlotRenderInstance = class {
1175
+ result;
1176
+ slotted;
1177
+ constructor(result, slotted) {
1178
+ this.result = result;
1179
+ this.slotted = slotted;
1180
+ }
1181
+ /** Must be called at most once per instance. */
1182
+ evaluate() {
1183
+ const { slotted } = this;
1184
+ return typeof slotted === "function" ? slotted(this.result) : slotted;
1185
+ }
1186
+ render(destination) {
1187
+ return renderChild(destination, this.evaluate());
1188
+ }
1189
+ };
1190
+ function renderSlot(result, slotted, fallback) {
1191
+ if (!slotted && fallback) return renderSlot(result, fallback);
1192
+ return new SlotRenderInstance(result, slotted);
1193
+ }
1194
+ async function renderSlotToString(result, slotted, fallback) {
1195
+ let content = "";
1196
+ let instructions = null;
1197
+ const chunks = [];
1198
+ await renderSlot(result, slotted, fallback).render({ write(chunk) {
1199
+ if (chunk instanceof SlotString) {
1200
+ content += chunk;
1201
+ if (chunk.chunks.length) chunks.push(...chunk.chunks);
1202
+ instructions = mergeSlotInstructions(instructions, chunk);
1203
+ } else if (chunk instanceof Response) return;
1204
+ else if (typeof chunk === "object" && "type" in chunk && typeof chunk.type === "string") {
1205
+ if (isScriptInstruction(chunk)) chunks.push(chunk);
1206
+ else {
1207
+ if (instructions === null) instructions = [];
1208
+ instructions.push(chunk);
1209
+ }
1210
+ } else {
1211
+ const str = chunkToString(result, chunk);
1212
+ content += str;
1213
+ chunks.push(str);
1214
+ }
1215
+ } });
1216
+ return markHTMLString(new SlotString(content, instructions, chunks));
1217
+ }
1218
+ async function renderSlots(result, slots = {}) {
1219
+ let slotInstructions = null;
1220
+ let children = {};
1221
+ if (slots) await Promise.all(Object.entries(slots).map(([key, value]) => renderSlotToString(result, value).then((output) => {
1222
+ if (output.instructions) {
1223
+ if (slotInstructions === null) slotInstructions = [];
1224
+ slotInstructions.push(...output.instructions);
1225
+ }
1226
+ if (output.chunks) {
1227
+ for (const part of output.chunks) if (typeof part !== "string") {
1228
+ if (slotInstructions === null) slotInstructions = [];
1229
+ slotInstructions.push(part);
1230
+ }
1231
+ }
1232
+ children[key] = output;
1233
+ })));
1234
+ return {
1235
+ slotInstructions,
1236
+ children
1237
+ };
1238
+ }
1239
+ function createSlotValueFromString(content) {
1240
+ return function() {
1241
+ return renderTemplate`${unescapeHTML(content)}`;
1242
+ };
1243
+ }
1244
+ //#endregion
1245
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/server-islands.js
1246
+ var internalProps = /* @__PURE__ */ new Set([
1247
+ "server:component-path",
1248
+ "server:component-export",
1249
+ "server:component-directive",
1250
+ "server:defer"
1251
+ ]);
1252
+ function containsServerDirective(props) {
1253
+ return "server:component-directive" in props;
1254
+ }
1255
+ function createSearchParams(encryptedComponentExport, encryptedProps, slots) {
1256
+ const params = new URLSearchParams();
1257
+ params.set("e", encryptedComponentExport);
1258
+ params.set("p", encryptedProps);
1259
+ params.set("s", slots);
1260
+ return params;
1261
+ }
1262
+ function isWithinURLLimit(pathname, params) {
1263
+ return (pathname + "?" + params.toString()).length < 2048;
1264
+ }
1265
+ var ServerIslandComponent = class {
1266
+ result;
1267
+ props;
1268
+ slots;
1269
+ displayName;
1270
+ hostId;
1271
+ islandContent;
1272
+ componentPath;
1273
+ componentExport;
1274
+ componentId;
1275
+ constructor(result, props, slots, displayName) {
1276
+ this.result = result;
1277
+ this.props = props;
1278
+ this.slots = slots;
1279
+ this.displayName = displayName;
1280
+ }
1281
+ async init() {
1282
+ const content = await this.getIslandContent();
1283
+ if (this.result.cspDestination) {
1284
+ this.result._metadata.extraScriptHashes.push(await generateCspDigest(SERVER_ISLAND_REPLACER, this.result.cspAlgorithm));
1285
+ const contentDigest = await generateCspDigest(content, this.result.cspAlgorithm);
1286
+ this.result._metadata.extraScriptHashes.push(contentDigest);
1287
+ }
1288
+ return createThinHead();
1289
+ }
1290
+ async render(destination) {
1291
+ const hostId = await this.getHostId();
1292
+ const islandContent = await this.getIslandContent();
1293
+ destination.write(createRenderInstruction({ type: "server-island-runtime" }));
1294
+ destination.write(`<!--${SERVER_ISLAND_START}-->`);
1295
+ for (const name in this.slots) if (name === "fallback") await renderChild(destination, this.slots.fallback(this.result));
1296
+ destination.write(`<script type="module" data-astro-rerun data-island-id="${hostId}">${islandContent}<\/script>`);
1297
+ }
1298
+ getComponentPath() {
1299
+ if (this.componentPath) return this.componentPath;
1300
+ const componentPath = this.props["server:component-path"];
1301
+ if (!componentPath) throw new Error(`Could not find server component path`);
1302
+ this.componentPath = componentPath;
1303
+ return componentPath;
1304
+ }
1305
+ getComponentExport() {
1306
+ if (this.componentExport) return this.componentExport;
1307
+ const componentExport = this.props["server:component-export"];
1308
+ if (!componentExport) throw new Error(`Could not find server component export`);
1309
+ this.componentExport = componentExport;
1310
+ return componentExport;
1311
+ }
1312
+ async getHostId() {
1313
+ if (!this.hostId) this.hostId = await crypto.randomUUID();
1314
+ return this.hostId;
1315
+ }
1316
+ async getIslandContent() {
1317
+ if (this.islandContent) return this.islandContent;
1318
+ const componentPath = this.getComponentPath();
1319
+ const componentExport = this.getComponentExport();
1320
+ let componentId = (await this.result.getServerIslandNameMap()).get(componentPath);
1321
+ if (!componentId) throw new Error(`Could not find server component name ${componentPath}`);
1322
+ for (const key2 of Object.keys(this.props)) if (internalProps.has(key2)) delete this.props[key2];
1323
+ const renderedSlots = {};
1324
+ for (const name in this.slots) if (name !== "fallback") {
1325
+ const content = await renderSlotToString(this.result, this.slots[name]);
1326
+ const slotContent = content;
1327
+ let slotHtml = "";
1328
+ if (slotContent.chunks?.length) for (const part of slotContent.chunks) slotHtml += typeof part === "string" ? part : part.content;
1329
+ else slotHtml = content.toString();
1330
+ renderedSlots[name] = slotHtml;
1331
+ }
1332
+ const key = await this.result.key;
1333
+ const componentExportEncrypted = await encryptString(key, componentExport, `export:${componentId}`);
1334
+ const propsEncrypted = Object.keys(this.props).length === 0 ? "" : await encryptString(key, JSON.stringify(this.props), `props:${componentId}`);
1335
+ const slotsEncrypted = Object.keys(renderedSlots).length === 0 ? "" : await encryptString(key, JSON.stringify(renderedSlots), `slots:${componentId}`);
1336
+ const hostId = await this.getHostId();
1337
+ const slash = this.result.base.endsWith("/") ? "" : "/";
1338
+ let serverIslandUrl = `${this.result.base}${slash}_server-islands/${componentId}${this.result.trailingSlash === "always" ? "/" : ""}`;
1339
+ const potentialSearchParams = createSearchParams(componentExportEncrypted, propsEncrypted, slotsEncrypted);
1340
+ const useGETRequest = isWithinURLLimit(serverIslandUrl, potentialSearchParams);
1341
+ if (useGETRequest) {
1342
+ serverIslandUrl += "?" + potentialSearchParams.toString();
1343
+ this.result._metadata.extraHead.push(markHTMLString(`<link rel="preload" as="fetch" href="${toAttributeString(serverIslandUrl)}" crossorigin="anonymous">`));
1344
+ }
1345
+ const headersJson = stringifyForScript(this.result.internalFetchHeaders || {});
1346
+ const serverIslandUrlJson = stringifyForScript(serverIslandUrl);
1347
+ const method = useGETRequest ? `const headers = new Headers(${headersJson});
1348
+ let response = await fetch(${serverIslandUrlJson}, { headers });` : `let data = {
1349
+ encryptedComponentExport: ${stringifyForScript(componentExportEncrypted)},
1350
+ encryptedProps: ${stringifyForScript(propsEncrypted)},
1351
+ encryptedSlots: ${stringifyForScript(slotsEncrypted)},
1352
+ };
1353
+ const headers = new Headers({ 'Content-Type': 'application/json', ...${headersJson} });
1354
+ let response = await fetch(${serverIslandUrlJson}, {
1355
+ method: 'POST',
1356
+ body: JSON.stringify(data),
1357
+ headers,
1358
+ });`;
1359
+ this.islandContent = `${method}replaceServerIsland(${stringifyForScript(hostId)}, response);`;
1360
+ return this.islandContent;
1361
+ }
1362
+ };
1363
+ var renderServerIslandRuntime = () => {
1364
+ return `<script>${SERVER_ISLAND_REPLACER}<\/script>`;
1365
+ };
1366
+ var SERVER_ISLAND_REPLACER = markHTMLString(`async function replaceServerIsland(id, r) {
1367
+ let s = document.querySelector(\`script[data-island-id="\${id}"]\`);
1368
+ // If there's no matching script, or the request fails then return
1369
+ if (!s || r.status !== 200 || r.headers.get('content-type')?.split(';')[0].trim() !== 'text/html') return;
1370
+ // Load the HTML before modifying the DOM in case of errors
1371
+ let html = await r.text();
1372
+ // Remove any placeholder content before the island script
1373
+ while (s.previousSibling && s.previousSibling.nodeType !== 8 && s.previousSibling.data !== '${SERVER_ISLAND_START}')
1374
+ s.previousSibling.remove();
1375
+ s.previousSibling?.remove();
1376
+ // Insert the new HTML
1377
+ s.before(document.createRange().createContextualFragment(html));
1378
+ // Remove the script. Prior to v5.4.2, this was the trick to force rerun of scripts. Keeping it to minimize change to the existing behavior.
1379
+ s.remove();
1380
+ }`.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("//")).join(" "));
1381
+ //#endregion
1382
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/common.js
1383
+ var Fragment = /* @__PURE__ */ Symbol.for("astro:fragment");
1384
+ var Renderer = /* @__PURE__ */ Symbol.for("astro:renderer");
1385
+ var encoder = new TextEncoder();
1386
+ var decoder = new TextDecoder();
1387
+ function stringifyChunk(result, chunk) {
1388
+ if (typeof chunk === "string") return chunk;
1389
+ if (isRenderInstruction(chunk)) {
1390
+ const instruction = chunk;
1391
+ switch (instruction.type) {
1392
+ case "directive": {
1393
+ const { hydration } = instruction;
1394
+ const needsHydrationScript = hydration && determineIfNeedsHydrationScript(result);
1395
+ const needsDirectiveScript = hydration && determinesIfNeedsDirectiveScript(result, hydration.directive);
1396
+ if (needsHydrationScript) return markHTMLString(getPrescripts(result, "both", hydration.directive));
1397
+ else if (needsDirectiveScript) return markHTMLString(getPrescripts(result, "directive", hydration.directive));
1398
+ else return "";
1399
+ }
1400
+ case "head":
1401
+ if (!shouldRenderInstruction("head", getInstructionRenderState(result))) return "";
1402
+ return renderAllHeadContent(result);
1403
+ case "maybe-head":
1404
+ if (!shouldRenderInstruction("maybe-head", getInstructionRenderState(result))) return "";
1405
+ return renderAllHeadContent(result);
1406
+ case "renderer-hydration-script": {
1407
+ const { rendererSpecificHydrationScripts } = result._metadata;
1408
+ const { rendererName } = instruction;
1409
+ if (result._metadata.templateDepth > 0) return instruction.render();
1410
+ if (!rendererSpecificHydrationScripts.has(rendererName)) {
1411
+ rendererSpecificHydrationScripts.add(rendererName);
1412
+ return instruction.render();
1413
+ }
1414
+ return "";
1415
+ }
1416
+ case "server-island-runtime":
1417
+ if (result._metadata.templateDepth > 0) return renderServerIslandRuntime();
1418
+ if (result._metadata.hasRenderedServerIslandRuntime) return "";
1419
+ result._metadata.hasRenderedServerIslandRuntime = true;
1420
+ return renderServerIslandRuntime();
1421
+ case "script": {
1422
+ const { id, content } = instruction;
1423
+ if (result._metadata.templateDepth > 0) return content;
1424
+ if (result._metadata.renderedScripts.has(id)) return "";
1425
+ result._metadata.renderedScripts.add(id);
1426
+ return content;
1427
+ }
1428
+ case "template-enter":
1429
+ result._metadata.templateDepth++;
1430
+ return "";
1431
+ case "template-exit":
1432
+ if (result._metadata.templateDepth <= 0) throw new Error("Unexpected template-exit instruction without a matching template-enter. This may indicate that the compiler emitted unbalanced template boundaries, or that a component manually injected a template-exit render instruction.");
1433
+ result._metadata.templateDepth--;
1434
+ return "";
1435
+ default: throw new Error(`Unknown chunk type: ${chunk.type}`);
1436
+ }
1437
+ } else if (chunk instanceof Response) return "";
1438
+ else if (isSlotString(chunk)) {
1439
+ let out = "";
1440
+ const c = chunk;
1441
+ if (c.instructions) for (const instr of c.instructions) out += stringifyChunk(result, instr);
1442
+ if (c.chunks.length) for (const part of c.chunks) out += typeof part === "string" ? part : stringifyChunk(result, part);
1443
+ else out += chunk.toString();
1444
+ return out;
1445
+ }
1446
+ return chunk.toString();
1447
+ }
1448
+ function chunkToString(result, chunk) {
1449
+ if (ArrayBuffer.isView(chunk)) return decoder.decode(chunk);
1450
+ else return stringifyChunk(result, chunk);
1451
+ }
1452
+ function chunkToByteArray(result, chunk) {
1453
+ if (ArrayBuffer.isView(chunk)) return chunk;
1454
+ else {
1455
+ const stringified = stringifyChunk(result, chunk);
1456
+ return encoder.encode(stringified.toString());
1457
+ }
1458
+ }
1459
+ function chunkToByteArrayOrString(result, chunk) {
1460
+ if (ArrayBuffer.isView(chunk)) return chunk;
1461
+ else return stringifyChunk(result, chunk).toString();
1462
+ }
1463
+ function isRenderInstance(obj) {
1464
+ return typeof obj === "object" && obj !== null && typeof obj.render === "function";
1465
+ }
1466
+ //#endregion
1467
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/any.js
1468
+ function renderChild(destination, child) {
1469
+ if (typeof child === "string") {
1470
+ destination.write(markHTMLString(escapeHTML(child)));
1471
+ return;
1472
+ }
1473
+ if (isRenderInstruction(child)) {
1474
+ destination.write(child);
1475
+ return;
1476
+ }
1477
+ if (isPromise(child)) return child.then((x) => renderChild(destination, x));
1478
+ if (isRenderInstance(child)) return child.render(destination);
1479
+ if (child instanceof SlotString) {
1480
+ destination.write(child);
1481
+ return;
1482
+ }
1483
+ if (isHTMLString(child)) {
1484
+ destination.write(child);
1485
+ return;
1486
+ }
1487
+ if (!child && child !== 0) return;
1488
+ if (Array.isArray(child)) return renderArray(destination, child);
1489
+ if (typeof child === "function") return renderChild(destination, child());
1490
+ if (ArrayBuffer.isView(child)) {
1491
+ destination.write(child);
1492
+ return;
1493
+ }
1494
+ if (typeof child === "object" && (Symbol.asyncIterator in child || Symbol.iterator in child)) {
1495
+ if (Symbol.asyncIterator in child) return renderAsyncIterable(destination, child);
1496
+ return renderIterable(destination, child);
1497
+ }
1498
+ destination.write(child);
1499
+ }
1500
+ function renderArray(destination, children) {
1501
+ for (let i = 0; i < children.length; i++) {
1502
+ const result = renderChild(destination, children[i]);
1503
+ if (isPromise(result)) {
1504
+ if (i + 1 >= children.length) return result;
1505
+ const remaining = children.length - i - 1;
1506
+ const flushers = new Array(remaining);
1507
+ for (let j = 0; j < remaining; j++) flushers[j] = createBufferedRenderer(destination, (bufferDestination) => {
1508
+ return renderChild(bufferDestination, children[i + 1 + j]);
1509
+ });
1510
+ return result.then(() => {
1511
+ let k = 0;
1512
+ const iterate = () => {
1513
+ while (k < flushers.length) {
1514
+ const flushResult = flushers[k++].flush();
1515
+ if (isPromise(flushResult)) return flushResult.then(iterate);
1516
+ }
1517
+ };
1518
+ return iterate();
1519
+ });
1520
+ }
1521
+ }
1522
+ }
1523
+ function renderIterable(destination, children) {
1524
+ const iterator = children[Symbol.iterator]();
1525
+ const iterate = () => {
1526
+ for (;;) {
1527
+ const { value, done } = iterator.next();
1528
+ if (done) break;
1529
+ const result = renderChild(destination, value);
1530
+ if (isPromise(result)) return result.then(iterate);
1531
+ }
1532
+ };
1533
+ return iterate();
1534
+ }
1535
+ async function renderAsyncIterable(destination, children) {
1536
+ for await (const value of children) await renderChild(destination, value);
1537
+ }
1538
+ //#endregion
1539
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/astro/instance.js
1540
+ var astroComponentInstanceSym = /* @__PURE__ */ Symbol.for("astro.componentInstance");
1541
+ var CLIENT_DIRECTIVE_PREFIX = "client:";
1542
+ var AstroComponentInstance = class {
1543
+ [astroComponentInstanceSym] = true;
1544
+ result;
1545
+ props;
1546
+ slotValues;
1547
+ factory;
1548
+ returnValue;
1549
+ constructor(result, props, slots, factory) {
1550
+ this.result = result;
1551
+ this.props = props;
1552
+ this.factory = factory;
1553
+ this.slotValues = slots;
1554
+ for (const name in slots) {
1555
+ if (this.slotValues === slots) this.slotValues = {};
1556
+ let didRender = false;
1557
+ let value = slots[name](result);
1558
+ if (result._metadata.routeHasPropagation && isPromise(value)) result._metadata.pendingSlotEvaluations.push(value);
1559
+ this.slotValues[name] = () => {
1560
+ if (!didRender) {
1561
+ didRender = true;
1562
+ return value;
1563
+ }
1564
+ return slots[name](result);
1565
+ };
1566
+ }
1567
+ }
1568
+ init(result) {
1569
+ if (this.returnValue !== void 0) return this.returnValue;
1570
+ this.returnValue = this.factory(result, this.props, this.slotValues);
1571
+ if (isPromise(this.returnValue)) this.returnValue.then((resolved) => {
1572
+ this.returnValue = resolved;
1573
+ }).catch(() => {});
1574
+ return this.returnValue;
1575
+ }
1576
+ render(destination) {
1577
+ const returnValue = this.init(this.result);
1578
+ if (isPromise(returnValue)) return returnValue.then((x) => this.renderImpl(destination, x));
1579
+ return this.renderImpl(destination, returnValue);
1580
+ }
1581
+ renderImpl(destination, returnValue) {
1582
+ if (isHeadAndContent(returnValue)) return returnValue.content.render(destination);
1583
+ else return renderChild(destination, returnValue);
1584
+ }
1585
+ };
1586
+ function validateComponentProps(props, clientDirectives, displayName) {
1587
+ if (props != null) {
1588
+ for (const prop in props) if (prop.startsWith(CLIENT_DIRECTIVE_PREFIX) && clientDirectives.has(prop.slice(7))) console.warn(`You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`);
1589
+ }
1590
+ }
1591
+ function createAstroComponentInstance(result, displayName, factory, props, slots = {}) {
1592
+ validateComponentProps(props, result.clientDirectives, displayName);
1593
+ const instance = new AstroComponentInstance(result, props, slots, factory);
1594
+ registerIfPropagating(result, factory, instance);
1595
+ return instance;
1596
+ }
1597
+ function isAstroComponentInstance(obj) {
1598
+ return typeof obj === "object" && obj !== null && !!obj[astroComponentInstanceSym];
1599
+ }
1600
+ //#endregion
1601
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/streaming.js
1602
+ var ClientOnlyPlaceholder$1 = "astro-client-only";
1603
+ var TemplateFrame = class {
1604
+ /** The RenderTemplateResult this frame walks. */
1605
+ templateResult;
1606
+ /** Resume position: the next `htmlParts`/`expressions` index to process. */
1607
+ cursor;
1608
+ constructor(templateResult) {
1609
+ this.templateResult = templateResult;
1610
+ this.cursor = 0;
1611
+ }
1612
+ storeCursor(index) {
1613
+ this.cursor = index;
1614
+ }
1615
+ };
1616
+ var StreamingRenderState = class {
1617
+ pendingStaticOutput = "";
1618
+ isBuffering = false;
1619
+ bufferedStaticOutput = "";
1620
+ appendStatic(output) {
1621
+ if (!output) return;
1622
+ if (this.isBuffering) this.bufferedStaticOutput += output;
1623
+ else this.pendingStaticOutput += output;
1624
+ }
1625
+ };
1626
+ async function renderStreaming(root, result, destination) {
1627
+ const stack = [root];
1628
+ const openTagCache = /* @__PURE__ */ new Map();
1629
+ const closeTagCache = /* @__PURE__ */ new Map();
1630
+ const closeTagFor = (type) => {
1631
+ let tag = closeTagCache.get(type);
1632
+ if (tag === void 0) {
1633
+ tag = new HTMLString(`</${type}>`);
1634
+ closeTagCache.set(type, tag);
1635
+ }
1636
+ return tag;
1637
+ };
1638
+ const streamingState = new StreamingRenderState();
1639
+ let firstAsyncRender = null;
1640
+ const bufferedTail = [];
1641
+ const flushBufferedStaticOutput = () => {
1642
+ if (streamingState.bufferedStaticOutput) {
1643
+ bufferedTail.push(streamingState.bufferedStaticOutput);
1644
+ streamingState.bufferedStaticOutput = "";
1645
+ }
1646
+ };
1647
+ const renderDynamic = (node) => (d) => {
1648
+ if (isVNode(node)) return renderJSX(result, node).then((out) => renderChild(d, out));
1649
+ return renderChild(d, node);
1650
+ };
1651
+ const handleVNode = (vnode) => {
1652
+ const type = vnode.type;
1653
+ if (!type) throw new Error(`Unable to render ${result.pathname} because it contains an undefined Component!
1654
+ Did you forget to import the component or is it possible there is a typo?`);
1655
+ if (type === Fragment) {
1656
+ stack.push(vnode.props?.children);
1657
+ return;
1658
+ }
1659
+ if (isAstroComponentFactory(type)) {
1660
+ const props = {};
1661
+ const slots = {};
1662
+ for (const [key, value] of Object.entries(vnode.props ?? {})) if (key === "children" || value && typeof value === "object" && value["$$slot"]) slots[key === "children" ? "default" : key] = () => renderJSX(result, value);
1663
+ else props[key] = value;
1664
+ const displayName = type.name || "Anonymous";
1665
+ if (containsServerDirective(props)) {
1666
+ const island = new ServerIslandComponent(result, props, slots, displayName);
1667
+ result._metadata.propagators.add(island);
1668
+ stack.push(island);
1669
+ return;
1670
+ }
1671
+ stack.push(createAstroComponentInstance(result, displayName, type, props, slots));
1672
+ return;
1673
+ }
1674
+ if (typeof type === "string" && type !== ClientOnlyPlaceholder$1) {
1675
+ const props = vnode.props;
1676
+ let hasAttrs = false;
1677
+ if (props) {
1678
+ for (const key in props) if (key !== "children") {
1679
+ hasAttrs = true;
1680
+ break;
1681
+ }
1682
+ }
1683
+ const children = props?.children;
1684
+ const isVoid = (children == null || children === "") && voidElementNames.test(type);
1685
+ if (!hasAttrs) {
1686
+ const key = isVoid ? `${type}/` : type;
1687
+ let openTag = openTagCache.get(key);
1688
+ if (openTag === void 0) {
1689
+ openTag = isVoid ? `<${type}/>` : `<${type}>`;
1690
+ openTagCache.set(key, openTag);
1691
+ }
1692
+ streamingState.appendStatic(openTag);
1693
+ if (!isVoid) stack.push(closeTagFor(type));
1694
+ } else {
1695
+ const attrs = spreadElementAttributes(props);
1696
+ if (isVoid) {
1697
+ streamingState.appendStatic(`<${type}${attrs}/>`);
1698
+ return;
1699
+ }
1700
+ streamingState.appendStatic(`<${type}${attrs}>`);
1701
+ stack.push(closeTagFor(type));
1702
+ }
1703
+ if (!isVoid && children != null && children !== "") {
1704
+ if (typeof children === "string" && type === "style") stack.push(markHTMLString(escapeStyleText(children)));
1705
+ else stack.push(children);
1706
+ }
1707
+ return;
1708
+ }
1709
+ if (typeof type === "function" && vnode.props?.["server:root"]) {
1710
+ stack.push(type(vnode.props ?? {}));
1711
+ return;
1712
+ }
1713
+ stack.push(renderJSX(result, vnode));
1714
+ };
1715
+ while (stack.length > 0) {
1716
+ const node = stack.pop();
1717
+ if (node == null || node === false) continue;
1718
+ if (node instanceof TemplateFrame) {
1719
+ const htmlParts = node.templateResult.htmlParts;
1720
+ const expressions = node.templateResult.expressions;
1721
+ let i = node.cursor;
1722
+ while (i < htmlParts.length) {
1723
+ if (htmlParts[i]) streamingState.appendStatic(htmlParts[i]);
1724
+ if (i >= expressions.length) break;
1725
+ const expression = expressions[i];
1726
+ i++;
1727
+ if (expression == null || expression === false) continue;
1728
+ const expressionType = typeof expression;
1729
+ if (expressionType === "string") {
1730
+ streamingState.appendStatic(escapeHTML(expression));
1731
+ continue;
1732
+ }
1733
+ if (expressionType === "number" || expressionType === "bigint" || expressionType === "boolean") {
1734
+ streamingState.appendStatic(String(expression));
1735
+ continue;
1736
+ }
1737
+ if (expression instanceof HTMLString || isHTMLString(expression)) {
1738
+ if (!(expression instanceof SlotString)) {
1739
+ streamingState.appendStatic(expression.toString());
1740
+ continue;
1741
+ }
1742
+ }
1743
+ node.storeCursor(i);
1744
+ stack.push(node);
1745
+ stack.push(isPromise(expression) ? node.templateResult.catchExpressionError(i - 1, expression) : expression);
1746
+ break;
1747
+ }
1748
+ continue;
1749
+ }
1750
+ const nodeType = typeof node;
1751
+ if (nodeType === "string") {
1752
+ streamingState.appendStatic(escapeHTML(node));
1753
+ continue;
1754
+ }
1755
+ if (nodeType === "number" || nodeType === "bigint" || nodeType === "boolean") {
1756
+ streamingState.appendStatic(String(node));
1757
+ continue;
1758
+ }
1759
+ if (node instanceof HTMLString || isHTMLString(node)) {
1760
+ if (!(node instanceof SlotString)) {
1761
+ streamingState.appendStatic(node.toString());
1762
+ continue;
1763
+ }
1764
+ }
1765
+ if (Array.isArray(node)) {
1766
+ for (let i = node.length - 1; i >= 0; i--) stack.push(node[i]);
1767
+ continue;
1768
+ }
1769
+ if (isRenderTemplateResult(node)) {
1770
+ stack.push(new TemplateFrame(node));
1771
+ continue;
1772
+ }
1773
+ if (isVNode(node)) {
1774
+ handleVNode(node);
1775
+ continue;
1776
+ }
1777
+ if (node instanceof SlotRenderInstance) {
1778
+ stack.push(node.evaluate());
1779
+ continue;
1780
+ }
1781
+ if (isAstroComponentInstance(node)) {
1782
+ const returnValue = node.init(result);
1783
+ if (!isPromise(returnValue)) {
1784
+ stack.push(isHeadAndContent(returnValue) ? returnValue.content : returnValue);
1785
+ continue;
1786
+ }
1787
+ }
1788
+ if (!streamingState.isBuffering) {
1789
+ if (streamingState.pendingStaticOutput) {
1790
+ destination.write(streamingState.pendingStaticOutput);
1791
+ streamingState.pendingStaticOutput = "";
1792
+ }
1793
+ const rendered = renderDynamic(node)(destination);
1794
+ if (isPromise(rendered)) {
1795
+ streamingState.isBuffering = true;
1796
+ firstAsyncRender = rendered;
1797
+ }
1798
+ } else {
1799
+ flushBufferedStaticOutput();
1800
+ bufferedTail.push(createBufferedRenderer(destination, renderDynamic(node)));
1801
+ }
1802
+ }
1803
+ if (!streamingState.isBuffering) {
1804
+ if (streamingState.pendingStaticOutput) destination.write(streamingState.pendingStaticOutput);
1805
+ return;
1806
+ }
1807
+ await firstAsyncRender;
1808
+ flushBufferedStaticOutput();
1809
+ for (const segment of bufferedTail) if (typeof segment === "string") destination.write(segment);
1810
+ else {
1811
+ const flushResult = segment.flush();
1812
+ if (isPromise(flushResult)) await flushResult;
1813
+ }
1814
+ }
1815
+ //#endregion
1816
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/astro/render.js
1817
+ var DOCTYPE_EXP = /<!doctype html/i;
1818
+ async function renderStreamToString(result, templateResult, isPage) {
1819
+ let str = "";
1820
+ let renderedFirstPageChunk = false;
1821
+ if (isPage) await bufferHeadContent(result);
1822
+ await renderStreaming(templateResult, result, { write(chunk) {
1823
+ if (isPage && !renderedFirstPageChunk) {
1824
+ renderedFirstPageChunk = true;
1825
+ if (!result.partial && !DOCTYPE_EXP.test(String(chunk))) {
1826
+ const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
1827
+ str += doctype;
1828
+ }
1829
+ }
1830
+ if (chunk instanceof Response) return;
1831
+ str += chunkToString(result, chunk);
1832
+ } });
1833
+ return str;
1834
+ }
1835
+ async function renderStreamToStream(result, templateResult, isPage, route) {
1836
+ let renderedFirstPageChunk = false;
1837
+ if (isPage) await bufferHeadContent(result);
1838
+ return new ReadableStream({
1839
+ start(controller) {
1840
+ const destination = { write(chunk) {
1841
+ if (isPage && !renderedFirstPageChunk) {
1842
+ renderedFirstPageChunk = true;
1843
+ if (!result.partial && !DOCTYPE_EXP.test(String(chunk))) {
1844
+ const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
1845
+ controller.enqueue(encoder.encode(doctype));
1846
+ }
1847
+ }
1848
+ if (chunk instanceof Response) throw new AstroError({ ...ResponseSentError });
1849
+ const bytes = chunkToByteArray(result, chunk);
1850
+ controller.enqueue(bytes);
1851
+ } };
1852
+ (async () => {
1853
+ try {
1854
+ await renderStreaming(templateResult, result, destination);
1855
+ controller.close();
1856
+ } catch (e) {
1857
+ if (AstroError.is(e) && !e.loc) e.setLocation({ file: route?.component });
1858
+ setTimeout(() => controller.error(e), 0);
1859
+ }
1860
+ })();
1861
+ },
1862
+ cancel() {
1863
+ result.cancelled = true;
1864
+ }
1865
+ });
1866
+ }
1867
+ async function renderStreamToAsyncIterable(result, templateResult, isPage, _route) {
1868
+ let renderedFirstPageChunk = false;
1869
+ let error = null;
1870
+ let next = null;
1871
+ const buffer = [];
1872
+ let hasBytes = false;
1873
+ let lastIsString = false;
1874
+ let renderingComplete = false;
1875
+ if (isPage) await bufferHeadContent(result);
1876
+ const iterator = {
1877
+ async next() {
1878
+ if (result.cancelled) return {
1879
+ done: true,
1880
+ value: void 0
1881
+ };
1882
+ if (next !== null) await next.promise;
1883
+ else if (!renderingComplete && !buffer.length) {
1884
+ next = promiseWithResolvers();
1885
+ await next.promise;
1886
+ }
1887
+ if (!renderingComplete) next = promiseWithResolvers();
1888
+ if (error) throw error;
1889
+ let mergedArray;
1890
+ if (!hasBytes) {
1891
+ let text = "";
1892
+ for (let i = 0, len = buffer.length; i < len; i++) text += buffer[i];
1893
+ mergedArray = encoder.encode(text);
1894
+ } else {
1895
+ let length = 0;
1896
+ let stringToEncode = "";
1897
+ for (let i = 0, len = buffer.length; i < len; i++) {
1898
+ const bufferEntry = buffer[i];
1899
+ if (typeof bufferEntry === "string") {
1900
+ const nextIsString = i + 1 < len && typeof buffer[i + 1] === "string";
1901
+ stringToEncode += bufferEntry;
1902
+ if (!nextIsString) {
1903
+ const encoded = encoder.encode(stringToEncode);
1904
+ length += encoded.length;
1905
+ stringToEncode = "";
1906
+ buffer[i] = encoded;
1907
+ } else buffer[i] = "";
1908
+ } else length += bufferEntry.length;
1909
+ }
1910
+ mergedArray = new Uint8Array(length);
1911
+ let offset = 0;
1912
+ for (let i = 0, len = buffer.length; i < len; i++) {
1913
+ const item = buffer[i];
1914
+ if (item === "") continue;
1915
+ mergedArray.set(item, offset);
1916
+ offset += item.length;
1917
+ }
1918
+ }
1919
+ buffer.length = 0;
1920
+ hasBytes = false;
1921
+ lastIsString = false;
1922
+ return {
1923
+ done: mergedArray.length === 0 && renderingComplete,
1924
+ value: mergedArray
1925
+ };
1926
+ },
1927
+ async return() {
1928
+ result.cancelled = true;
1929
+ return {
1930
+ done: true,
1931
+ value: void 0
1932
+ };
1933
+ }
1934
+ };
1935
+ const destination = { write(chunk) {
1936
+ if (isPage && !renderedFirstPageChunk) {
1937
+ renderedFirstPageChunk = true;
1938
+ if (!result.partial && !DOCTYPE_EXP.test(String(chunk))) {
1939
+ const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
1940
+ buffer.push(doctype);
1941
+ lastIsString = true;
1942
+ }
1943
+ }
1944
+ if (chunk instanceof Response) throw new AstroError(ResponseSentError);
1945
+ const bytes = chunkToByteArrayOrString(result, chunk);
1946
+ if (bytes.length > 0) {
1947
+ if (typeof bytes === "string") {
1948
+ if (lastIsString) buffer[buffer.length - 1] = buffer[buffer.length - 1] + bytes;
1949
+ else {
1950
+ buffer.push(bytes);
1951
+ lastIsString = true;
1952
+ }
1953
+ } else {
1954
+ buffer.push(bytes);
1955
+ hasBytes = true;
1956
+ lastIsString = false;
1957
+ }
1958
+ next?.resolve();
1959
+ } else if (buffer.length > 0) next?.resolve();
1960
+ } };
1961
+ toPromise(() => renderStreaming(templateResult, result, destination)).catch((err) => {
1962
+ error = err;
1963
+ }).finally(() => {
1964
+ renderingComplete = true;
1965
+ next?.resolve();
1966
+ });
1967
+ return { [Symbol.asyncIterator]() {
1968
+ return iterator;
1969
+ } };
1970
+ }
1971
+ async function renderToString(result, componentFactory, props, children, isPage = false, route) {
1972
+ const templateResult = await callComponentAsTemplateResultOrResponse(result, componentFactory, props, children, route);
1973
+ if (templateResult instanceof Response) return templateResult;
1974
+ return await renderStreamToString(result, templateResult, isPage);
1975
+ }
1976
+ async function renderToReadableStream(result, componentFactory, props, children, isPage = false, route) {
1977
+ const templateResult = await callComponentAsTemplateResultOrResponse(result, componentFactory, props, children, route);
1978
+ if (templateResult instanceof Response) return templateResult;
1979
+ return await renderStreamToStream(result, templateResult, isPage, route);
1980
+ }
1981
+ async function callComponentAsTemplateResultOrResponse(result, componentFactory, props, children, route) {
1982
+ const factoryResult = await componentFactory(result, props, children);
1983
+ if (factoryResult instanceof Response) return factoryResult;
1984
+ else if (isHeadAndContent(factoryResult)) {
1985
+ if (!isRenderTemplateResult(factoryResult.content)) throw new AstroError({
1986
+ ...OnlyResponseCanBeReturned,
1987
+ message: OnlyResponseCanBeReturned.message(route?.route, typeof factoryResult),
1988
+ location: { file: route?.component }
1989
+ });
1990
+ return factoryResult.content;
1991
+ } else if (!isRenderTemplateResult(factoryResult)) throw new AstroError({
1992
+ ...OnlyResponseCanBeReturned,
1993
+ message: OnlyResponseCanBeReturned.message(route?.route, typeof factoryResult),
1994
+ location: { file: route?.component }
1995
+ });
1996
+ return factoryResult;
1997
+ }
1998
+ async function bufferHeadContent(result) {
1999
+ await bufferPropagatedHead(result);
2000
+ }
2001
+ async function renderToAsyncIterable(result, componentFactory, props, children, isPage = false, route) {
2002
+ const templateResult = await callComponentAsTemplateResultOrResponse(result, componentFactory, props, children, route);
2003
+ if (templateResult instanceof Response) return templateResult;
2004
+ return await renderStreamToAsyncIterable(result, templateResult, isPage, route);
2005
+ }
2006
+ function toPromise(fn) {
2007
+ try {
2008
+ const result = fn();
2009
+ return isPromise(result) ? result : Promise.resolve(result);
2010
+ } catch (err) {
2011
+ return Promise.reject(err);
2012
+ }
2013
+ }
2014
+ //#endregion
2015
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/dom.js
2016
+ function componentIsHTMLElement(Component) {
2017
+ return typeof HTMLElement !== "undefined" && HTMLElement.isPrototypeOf(Component);
2018
+ }
2019
+ async function renderHTMLElement(result, constructor, props, slots) {
2020
+ const name = getHTMLElementName(constructor);
2021
+ let attrHTML = "";
2022
+ for (const attr in props) {
2023
+ if (INVALID_ATTR_NAME_CHAR.test(attr)) continue;
2024
+ attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
2025
+ }
2026
+ return markHTMLString(`<${name}${attrHTML}>${await renderSlotToString(result, slots?.default)}</${name}>`);
2027
+ }
2028
+ function getHTMLElementName(constructor) {
2029
+ const definedName = customElements.getName(constructor);
2030
+ if (definedName) return definedName;
2031
+ return constructor.name.replace(/^HTML|Element$/g, "").replace(/[A-Z]/g, "-$&").toLowerCase().replace(/^-/, "html-");
2032
+ }
2033
+ //#endregion
2034
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/component.js
2035
+ var needsHeadRenderingSymbol = /* @__PURE__ */ Symbol.for("astro.needsHeadRendering");
2036
+ var rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
2037
+ var clientOnlyValues = /* @__PURE__ */ new Set([
2038
+ "solid-js",
2039
+ "react",
2040
+ "preact",
2041
+ "vue",
2042
+ "svelte"
2043
+ ]);
2044
+ function guessRenderers(componentUrl) {
2045
+ switch (componentUrl?.split(".").pop()) {
2046
+ case "svelte": return ["@astrojs/svelte"];
2047
+ case "vue": return ["@astrojs/vue"];
2048
+ case "jsx":
2049
+ case "tsx": return [
2050
+ "@astrojs/react",
2051
+ "@astrojs/preact",
2052
+ "@astrojs/solid-js",
2053
+ "@astrojs/vue (jsx)"
2054
+ ];
2055
+ case void 0:
2056
+ default: return [
2057
+ "@astrojs/react",
2058
+ "@astrojs/preact",
2059
+ "@astrojs/solid-js",
2060
+ "@astrojs/vue",
2061
+ "@astrojs/svelte"
2062
+ ];
2063
+ }
2064
+ }
2065
+ function isFragmentComponent(Component) {
2066
+ return Component === Fragment;
2067
+ }
2068
+ function isHTMLComponent(Component) {
2069
+ return Component && Component["astro:html"] === true;
2070
+ }
2071
+ var ASTRO_SLOT_EXP = /<\/?astro-slot\b[^>]*>/g;
2072
+ var ASTRO_STATIC_SLOT_EXP = /<\/?astro-static-slot\b[^>]*>/g;
2073
+ function removeStaticAstroSlot(html, supportsAstroStaticSlot = true) {
2074
+ const exp = supportsAstroStaticSlot ? ASTRO_STATIC_SLOT_EXP : ASTRO_SLOT_EXP;
2075
+ return html.replace(exp, "");
2076
+ }
2077
+ async function renderFrameworkComponent(result, displayName, Component, _props, slots = {}) {
2078
+ if (!Component && "client:only" in _props === false) throw new Error(`Unable to render ${displayName} because it is ${Component}!
2079
+ Did you forget to import the component or is it possible there is a typo?`);
2080
+ const { renderers, clientDirectives } = result;
2081
+ const metadata = {
2082
+ astroStaticSlot: true,
2083
+ displayName
2084
+ };
2085
+ const { hydration, isPage, props, propsWithoutTransitionAttributes } = extractDirectives(_props, clientDirectives);
2086
+ let html = "";
2087
+ let attrs = void 0;
2088
+ if (hydration) {
2089
+ metadata.hydrate = hydration.directive;
2090
+ metadata.hydrateArgs = hydration.value;
2091
+ metadata.componentExport = hydration.componentExport;
2092
+ metadata.componentUrl = hydration.componentUrl;
2093
+ }
2094
+ const probableRendererNames = guessRenderers(metadata.componentUrl);
2095
+ const validRenderers = renderers.filter((r) => r.name !== "astro:jsx");
2096
+ const { children, slotInstructions } = await renderSlots(result, slots);
2097
+ let renderer;
2098
+ if (metadata.hydrate !== "only") {
2099
+ let isTagged = false;
2100
+ try {
2101
+ isTagged = Component && Component[Renderer];
2102
+ } catch {}
2103
+ if (isTagged) {
2104
+ const rendererName = Component[Renderer];
2105
+ renderer = renderers.find(({ name }) => name === rendererName);
2106
+ }
2107
+ if (!renderer) {
2108
+ let error;
2109
+ for (const r of renderers) try {
2110
+ if (await r.ssr.check.call({ result }, Component, props, children, metadata)) {
2111
+ renderer = r;
2112
+ break;
2113
+ }
2114
+ } catch (e) {
2115
+ error ??= e;
2116
+ }
2117
+ if (!renderer && error) throw error;
2118
+ }
2119
+ if (!renderer && typeof HTMLElement === "function" && componentIsHTMLElement(Component)) {
2120
+ const output = await renderHTMLElement(result, Component, _props, slots);
2121
+ return { render(destination) {
2122
+ destination.write(output);
2123
+ } };
2124
+ }
2125
+ } else {
2126
+ if (metadata.hydrateArgs) {
2127
+ const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs;
2128
+ if (clientOnlyValues.has(rendererName)) renderer = renderers.find(({ name }) => name === `@astrojs/${rendererName}` || name === rendererName);
2129
+ }
2130
+ if (!renderer && validRenderers.length === 1) renderer = validRenderers[0];
2131
+ if (!renderer) {
2132
+ const extname = metadata.componentUrl?.split(".").pop();
2133
+ renderer = renderers.find(({ name }) => name === `@astrojs/${extname}` || name === extname);
2134
+ }
2135
+ if (!renderer && metadata.hydrateArgs) {
2136
+ const rendererName = metadata.hydrateArgs;
2137
+ if (typeof rendererName === "string") renderer = renderers.find(({ name }) => name === rendererName);
2138
+ }
2139
+ }
2140
+ let componentServerRenderEndTime;
2141
+ if (!renderer) {
2142
+ if (metadata.hydrate === "only") {
2143
+ const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs;
2144
+ if (clientOnlyValues.has(rendererName)) {
2145
+ const plural = validRenderers.length > 1;
2146
+ throw new AstroError({
2147
+ ...NoMatchingRenderer,
2148
+ message: NoMatchingRenderer.message(metadata.displayName, metadata?.componentUrl?.split(".").pop(), plural, validRenderers.length),
2149
+ hint: NoMatchingRenderer.hint(formatList(probableRendererNames.map((r) => "`" + r + "`")))
2150
+ });
2151
+ } else throw new AstroError({
2152
+ ...NoClientOnlyHint,
2153
+ message: NoClientOnlyHint.message(metadata.displayName),
2154
+ hint: NoClientOnlyHint.hint(probableRendererNames.map((r) => r.replace("@astrojs/", "")).join("|"))
2155
+ });
2156
+ } else if (typeof Component !== "string") {
2157
+ const matchingRenderers = validRenderers.filter((r) => probableRendererNames.includes(r.name));
2158
+ const plural = validRenderers.length > 1;
2159
+ if (matchingRenderers.length === 0) throw new AstroError({
2160
+ ...NoMatchingRenderer,
2161
+ message: NoMatchingRenderer.message(metadata.displayName, metadata?.componentUrl?.split(".").pop(), plural, validRenderers.length),
2162
+ hint: NoMatchingRenderer.hint(formatList(probableRendererNames.map((r) => "`" + r + "`")))
2163
+ });
2164
+ else if (matchingRenderers.length === 1) {
2165
+ renderer = matchingRenderers[0];
2166
+ ({html, attrs} = await renderer.ssr.renderToStaticMarkup.call({ result }, Component, propsWithoutTransitionAttributes, children, metadata));
2167
+ } else throw new Error(`Unable to render ${metadata.displayName}!
2168
+
2169
+ This component likely uses ${formatList(probableRendererNames)},
2170
+ but Astro encountered an error during server-side rendering.
2171
+
2172
+ Please ensure that ${metadata.displayName}:
2173
+ 1. Does not unconditionally access browser-specific globals like \`window\` or \`document\`.
2174
+ If this is unavoidable, use the \`client:only\` hydration directive.
2175
+ 2. Does not conditionally return \`null\` or \`undefined\` when rendered on the server.
2176
+ 3. If using multiple JSX frameworks at the same time (e.g. React + Preact), pass the correct \`include\`/\`exclude\` options to integrations.
2177
+
2178
+ If you're still stuck, please open an issue on GitHub or join us at https://astro.build/chat.`);
2179
+ }
2180
+ } else if (metadata.hydrate === "only") html = await renderSlotToString(result, slots?.fallback);
2181
+ else {
2182
+ const componentRenderStartTime = performance.now();
2183
+ ({html, attrs} = await renderer.ssr.renderToStaticMarkup.call({ result }, Component, propsWithoutTransitionAttributes, children, metadata));
2184
+ if (process.env.NODE_ENV === "development") componentServerRenderEndTime = performance.now() - componentRenderStartTime;
2185
+ }
2186
+ if (!html && typeof Component === "string") {
2187
+ const Tag = sanitizeElementName(Component);
2188
+ const childSlots = Object.values(children).join("");
2189
+ const renderTemplateResult = renderTemplate`<${Tag}${internalSpreadAttributes(props, true, Tag)}${markHTMLString(childSlots === "" && voidElementNames.test(Tag) ? `/>` : `>${childSlots}</${Tag}>`)}`;
2190
+ html = "";
2191
+ await renderTemplateResult.render({ write(chunk) {
2192
+ if (chunk instanceof Response) return;
2193
+ html += chunkToString(result, chunk);
2194
+ } });
2195
+ }
2196
+ if (!hydration) return { render(destination) {
2197
+ if (slotInstructions) for (const instruction of slotInstructions) destination.write(instruction);
2198
+ if (isPage || renderer?.name === "astro:jsx") destination.write(html);
2199
+ else if (html && html.length > 0) {
2200
+ const output = renderer ? removeStaticAstroSlot(html, renderer.ssr?.supportsAstroStaticSlot) : html;
2201
+ destination.write(markHTMLString(output));
2202
+ }
2203
+ } };
2204
+ const astroId = shorthash(`<!--${metadata.componentExport.value}:${metadata.componentUrl}-->
2205
+ ${html}
2206
+ ${serializeProps(props, metadata)}`);
2207
+ const island = await generateHydrateScript({
2208
+ renderer,
2209
+ result,
2210
+ astroId,
2211
+ props,
2212
+ attrs
2213
+ }, metadata);
2214
+ if (componentServerRenderEndTime && process.env.NODE_ENV === "development") island.props["server-render-time"] = componentServerRenderEndTime;
2215
+ let unrenderedSlots = [];
2216
+ if (html) {
2217
+ if (Object.keys(children).length > 0) for (const key of Object.keys(children)) {
2218
+ let tagName = renderer?.ssr?.supportsAstroStaticSlot ? !!metadata.hydrate ? "astro-slot" : "astro-static-slot" : "astro-slot";
2219
+ let expectedHTML = key === "default" ? `<${tagName}>` : `<${tagName} name="${escapeHTML(key)}">`;
2220
+ if (!html.includes(expectedHTML)) unrenderedSlots.push(key);
2221
+ }
2222
+ } else unrenderedSlots = Object.keys(children);
2223
+ const template = unrenderedSlots.length > 0 ? unrenderedSlots.map((key) => `<template data-astro-template${key !== "default" ? `="${escapeHTML(key)}"` : ""}>${children[key]}</template>`).join("") : "";
2224
+ island.children = `${html ?? ""}${template}`;
2225
+ if (island.children) {
2226
+ island.props["await-children"] = "";
2227
+ island.children += `<!--astro:end-->`;
2228
+ }
2229
+ return { render(destination) {
2230
+ if (slotInstructions) for (const instruction of slotInstructions) destination.write(instruction);
2231
+ destination.write(createRenderInstruction({
2232
+ type: "directive",
2233
+ hydration
2234
+ }));
2235
+ if (hydration.directive !== "only" && renderer?.ssr.renderHydrationScript) destination.write(createRenderInstruction({
2236
+ type: "renderer-hydration-script",
2237
+ rendererName: renderer.name,
2238
+ render: renderer.ssr.renderHydrationScript
2239
+ }));
2240
+ const renderedElement = renderElement$1("astro-island", island, false);
2241
+ destination.write(markHTMLString(renderedElement));
2242
+ } };
2243
+ }
2244
+ function sanitizeElementName(tag) {
2245
+ const unsafe = /[&<>'"\s]+/;
2246
+ if (!unsafe.test(tag)) return tag;
2247
+ return tag.trim().split(unsafe)[0].trim();
2248
+ }
2249
+ function renderFragmentComponent(result, slots = {}) {
2250
+ const slot = slots?.default;
2251
+ const preRendered = slot?.(result);
2252
+ return { render(destination) {
2253
+ if (preRendered == null) return;
2254
+ return renderChild(destination, preRendered);
2255
+ } };
2256
+ }
2257
+ async function renderHTMLComponent(result, Component, _props, slots = {}) {
2258
+ const { slotInstructions, children } = await renderSlots(result, slots);
2259
+ const html = Component({ slots: children });
2260
+ const hydrationHtml = slotInstructions ? slotInstructions.map((instr) => chunkToString(result, instr)).join("") : "";
2261
+ return { render(destination) {
2262
+ destination.write(markHTMLString(hydrationHtml + html));
2263
+ } };
2264
+ }
2265
+ function renderAstroComponent(result, displayName, Component, props, slots = {}) {
2266
+ if (containsServerDirective(props)) {
2267
+ const serverIslandComponent = new ServerIslandComponent(result, props, slots, displayName);
2268
+ result._metadata.propagators.add(serverIslandComponent);
2269
+ return serverIslandComponent;
2270
+ }
2271
+ return createAstroComponentInstance(result, displayName, Component, props, slots);
2272
+ }
2273
+ function renderComponent(result, displayName, Component, props, slots = {}) {
2274
+ if (isAstroComponentFactory(Component)) return renderAstroComponent(result, displayName, Component, normalizeProps(props), slots);
2275
+ if (isPromise(Component)) return Component.catch(handleCancellation).then((x) => {
2276
+ return renderComponent(result, displayName, x, props, slots);
2277
+ });
2278
+ if (isFragmentComponent(Component)) return renderFragmentComponent(result, slots);
2279
+ props = normalizeProps(props);
2280
+ if (isHTMLComponent(Component)) return renderHTMLComponent(result, Component, props, slots).catch(handleCancellation);
2281
+ return renderFrameworkComponent(result, displayName, Component, props, slots).catch(handleCancellation);
2282
+ function handleCancellation(e) {
2283
+ if (result.cancelled) return { render() {} };
2284
+ throw e;
2285
+ }
2286
+ }
2287
+ function normalizeProps(props) {
2288
+ if (props["class:list"] !== void 0) {
2289
+ const value = props["class:list"];
2290
+ delete props["class:list"];
2291
+ props["class"] = clsx(props["class"], value);
2292
+ if (props["class"] === "") delete props["class"];
2293
+ }
2294
+ return props;
2295
+ }
2296
+ async function renderComponentToString(result, displayName, Component, props, slots = {}, isPage = false, route) {
2297
+ let str = "";
2298
+ let renderedFirstPageChunk = false;
2299
+ let head = "";
2300
+ if (isPage && !result.partial && nonAstroPageNeedsHeadInjection(Component)) head += chunkToString(result, maybeRenderHead());
2301
+ try {
2302
+ const destination = { write(chunk) {
2303
+ if (isPage && !result.partial && !renderedFirstPageChunk) {
2304
+ renderedFirstPageChunk = true;
2305
+ if (!/<!doctype html/i.test(String(chunk))) {
2306
+ const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
2307
+ str += doctype + head;
2308
+ }
2309
+ }
2310
+ if (chunk instanceof Response) return;
2311
+ str += chunkToString(result, chunk);
2312
+ } };
2313
+ const renderInstance = await renderComponent(result, displayName, Component, props, slots);
2314
+ if (containsServerDirective(props)) await bufferHeadContent(result);
2315
+ await renderInstance.render(destination);
2316
+ } catch (e) {
2317
+ if (AstroError.is(e) && !e.loc) e.setLocation({ file: route?.component });
2318
+ throw e;
2319
+ }
2320
+ return str;
2321
+ }
2322
+ function nonAstroPageNeedsHeadInjection(pageComponent) {
2323
+ return !!pageComponent?.[needsHeadRenderingSymbol];
2324
+ }
2325
+ //#endregion
2326
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/jsx.js
2327
+ var ClientOnlyPlaceholder = "astro-client-only";
2328
+ var hasTriedRenderComponentSymbol = /* @__PURE__ */ Symbol("hasTriedRenderComponent");
2329
+ async function renderJSX(result, vnode) {
2330
+ switch (true) {
2331
+ case vnode instanceof HTMLString:
2332
+ if (vnode.toString().trim() === "") return "";
2333
+ return vnode;
2334
+ case typeof vnode === "string": return markHTMLString(escapeHTML(vnode));
2335
+ case typeof vnode === "function": return vnode;
2336
+ case !vnode && vnode !== 0: return "";
2337
+ case Array.isArray(vnode): {
2338
+ const renderedItems = await Promise.all(vnode.map((v) => renderJSX(result, v)));
2339
+ let instructions = null;
2340
+ let content = "";
2341
+ for (const item of renderedItems) if (item instanceof SlotString) {
2342
+ content += item;
2343
+ instructions = mergeSlotInstructions(instructions, item);
2344
+ } else content += item;
2345
+ if (instructions) return markHTMLString(new SlotString(content, instructions));
2346
+ return markHTMLString(content);
2347
+ }
2348
+ }
2349
+ return renderJSXVNode(result, vnode);
2350
+ }
2351
+ async function renderJSXVNode(result, vnode) {
2352
+ if (isVNode(vnode)) {
2353
+ switch (true) {
2354
+ case !vnode.type: throw new Error(`Unable to render ${result.pathname} because it contains an undefined Component!
2355
+ Did you forget to import the component or is it possible there is a typo?`);
2356
+ case vnode.type === /* @__PURE__ */ Symbol.for("astro:fragment"): return renderJSX(result, vnode.props.children);
2357
+ case isAstroComponentFactory(vnode.type): {
2358
+ let props = {};
2359
+ let slots = {};
2360
+ for (const [key, value] of Object.entries(vnode.props ?? {})) if (key === "children" || value && typeof value === "object" && value["$$slot"]) slots[key === "children" ? "default" : key] = () => renderJSX(result, value);
2361
+ else props[key] = value;
2362
+ return markHTMLString(await renderComponentToString(result, vnode.type.name, vnode.type, props, slots));
2363
+ }
2364
+ case !vnode.type && vnode.type !== 0: return "";
2365
+ case typeof vnode.type === "string" && vnode.type !== ClientOnlyPlaceholder && !vnode.type.includes("-"): return markHTMLString(await renderElement(result, vnode.type, vnode.props ?? {}));
2366
+ }
2367
+ if (vnode.type) {
2368
+ let extractSlots2 = function(child) {
2369
+ if (Array.isArray(child)) return child.map((c) => extractSlots2(c));
2370
+ if (!isVNode(child)) {
2371
+ _slots.default.push(child);
2372
+ return;
2373
+ }
2374
+ if ("slot" in child.props && !isCustomElement) {
2375
+ _slots[child.props.slot] = [..._slots[child.props.slot] ?? [], child];
2376
+ delete child.props.slot;
2377
+ return;
2378
+ }
2379
+ _slots.default.push(child);
2380
+ };
2381
+ if (typeof vnode.type === "function" && vnode.props["server:root"]) return await renderJSX(result, await vnode.type(vnode.props ?? {}));
2382
+ if (typeof vnode.type === "function") {
2383
+ if (vnode.props[hasTriedRenderComponentSymbol]) {
2384
+ delete vnode.props[hasTriedRenderComponentSymbol];
2385
+ const output2 = await vnode.type(vnode.props ?? {});
2386
+ if (output2?.["astro:jsx"] || !output2) return await renderJSXVNode(result, output2);
2387
+ else return;
2388
+ } else vnode.props[hasTriedRenderComponentSymbol] = true;
2389
+ }
2390
+ const { children = null, ...props } = vnode.props ?? {};
2391
+ const _slots = { default: [] };
2392
+ const isCustomElement = typeof vnode.type === "string" && vnode.type.includes("-");
2393
+ extractSlots2(children);
2394
+ for (const [key, value] of Object.entries(props)) if (value?.["$$slot"]) {
2395
+ _slots[key] = value;
2396
+ delete props[key];
2397
+ }
2398
+ const slotPromises = [];
2399
+ const slots = {};
2400
+ for (const [key, value] of Object.entries(_slots)) slotPromises.push(renderJSX(result, value).then((output2) => {
2401
+ if (output2.toString().trim().length === 0) return;
2402
+ slots[key] = () => output2;
2403
+ }));
2404
+ await Promise.all(slotPromises);
2405
+ let output;
2406
+ if (vnode.type === ClientOnlyPlaceholder && vnode.props["client:only"]) output = await renderComponentToString(result, vnode.props["client:display-name"] ?? "", null, props, slots);
2407
+ else output = await renderComponentToString(result, typeof vnode.type === "function" ? vnode.type.name : vnode.type, vnode.type, props, slots);
2408
+ return markHTMLString(output);
2409
+ }
2410
+ }
2411
+ return markHTMLString(`${vnode}`);
2412
+ }
2413
+ async function renderElement(result, tag, { children, ...props }) {
2414
+ return markHTMLString(`<${tag}${spreadAttributes(props)}${markHTMLString((children == null || children === "") && voidElementNames.test(tag) ? `/>` : `>${children == null ? "" : await renderJSX(result, prerenderElementChildren(tag, children))}</${tag}>`)}`);
2415
+ }
2416
+ function prerenderElementChildren(tag, children) {
2417
+ if (typeof children === "string" && tag === "style") return markHTMLString(escapeStyleText(children));
2418
+ return children;
2419
+ }
2420
+ //#endregion
2421
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/render/page.js
2422
+ async function renderPage(result, componentFactory, props, children, streaming, route) {
2423
+ if (!isAstroComponentFactory(componentFactory)) {
2424
+ const nonAstroMeta = result.componentMetadata.get(componentFactory.moduleId);
2425
+ result._metadata.headInTree = nonAstroMeta?.containsHead ?? false;
2426
+ result._metadata.routeHasPropagation = isPropagatingHint(nonAstroMeta?.propagation ?? "none");
2427
+ const pageProps = {
2428
+ ...props ?? {},
2429
+ "server:root": true
2430
+ };
2431
+ const str = await renderComponentToString(result, componentFactory.name, componentFactory, pageProps, {}, true, route);
2432
+ const bytes = encoder.encode(str);
2433
+ const headers2 = new Headers([["Content-Type", "text/html"], ["Content-Length", bytes.byteLength.toString()]]);
2434
+ if (result.shouldInjectCspMetaTags && (result.cspDestination === "header" || result.cspDestination === "adapter")) headers2.set("content-security-policy", renderCspContent(result));
2435
+ return new Response(bytes, {
2436
+ headers: headers2,
2437
+ status: result.response.status
2438
+ });
2439
+ }
2440
+ const pageMeta = result.componentMetadata.get(componentFactory.moduleId);
2441
+ result._metadata.headInTree = pageMeta?.containsHead ?? false;
2442
+ result._metadata.routeHasPropagation = isPropagatingHint(pageMeta?.propagation ?? "none");
2443
+ let body;
2444
+ if (streaming) {
2445
+ if (isNode && !isDeno) {
2446
+ const nodeBody = await renderToAsyncIterable(result, componentFactory, props, children, true, route);
2447
+ if (isWorkerd && !(nodeBody instanceof Response)) body = ReadableStream.from(nodeBody);
2448
+ else body = nodeBody;
2449
+ } else body = await renderToReadableStream(result, componentFactory, props, children, true, route);
2450
+ } else body = await renderToString(result, componentFactory, props, children, true, route);
2451
+ if (body instanceof Response) return body;
2452
+ const init = result.response;
2453
+ const headers = new Headers(init.headers);
2454
+ if (result.shouldInjectCspMetaTags && result.cspDestination === "header" || result.cspDestination === "adapter") headers.set("content-security-policy", renderCspContent(result));
2455
+ if (!streaming && typeof body === "string") {
2456
+ body = encoder.encode(body);
2457
+ headers.set("Content-Length", body.byteLength.toString());
2458
+ }
2459
+ let status = init.status;
2460
+ let statusText = init.statusText;
2461
+ if (route?.route && isRoute404(route.route)) {
2462
+ status = 404;
2463
+ if (statusText === "OK") statusText = "Not Found";
2464
+ } else if (route?.route && isRoute500(route.route)) {
2465
+ status = 500;
2466
+ if (statusText === "OK") statusText = "Internal Server Error";
2467
+ }
2468
+ if (status) return new Response(body, {
2469
+ ...init,
2470
+ headers,
2471
+ status,
2472
+ statusText
2473
+ });
2474
+ else return new Response(body, {
2475
+ ...init,
2476
+ headers
2477
+ });
2478
+ }
2479
+ Object.freeze(createRenderInstruction({ type: "template-enter" }));
2480
+ Object.freeze(createRenderInstruction({ type: "template-exit" }));
2481
+ "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".split("").reduce((v, c) => (v[c.charCodeAt(0)] = c, v), []);
2482
+ "-0123456789_".split("").reduce((v, c) => (v[c.charCodeAt(0)] = c, v), []);
2483
+ //#endregion
2484
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/runtime/server/index.js
2485
+ function spreadAttributes(values = {}, _name, { class: scopedClassName } = {}) {
2486
+ let output = "";
2487
+ if (scopedClassName) {
2488
+ if (typeof values.class !== "undefined") values.class += ` ${scopedClassName}`;
2489
+ else if (typeof values["class:list"] !== "undefined") values["class:list"] = [values["class:list"], scopedClassName];
2490
+ else values.class = scopedClassName;
2491
+ }
2492
+ for (const key of Object.keys(values)) output += addAttribute(values[key], key, true, _name);
2493
+ return markHTMLString(output);
2494
+ }
2495
+ //#endregion
2496
+ export { clientAddressSymbol as A, isRoute404 as C, DEFAULT_404_COMPONENT as D, ASTRO_GENERATOR as E, decodeKey as F, decryptString as I, generateCspDigest as L, nodeRequestAbortControllerCleanupSymbol as M, originPathnameSymbol as N, REDIRECT_STATUS_CODES as O, responseSentSymbol as P, __exportAll as R, createAstro as S, ASTRO_ERROR_HEADER as T, pushDirective as _, chunkToString as a, unescapeHTML as b, renderSlotToString as c, maybeRenderHead as d, renderHead as f, normalizeCspResourceEntry as g, isRenderInstruction as h, renderComponent as i, fetchStateSymbol as j, REROUTABLE_STATUS_CODES as k, isRenderTemplateResult as l, createRenderInstruction as m, renderPage as n, createSlotValueFromString as o, addAttribute as p, renderJSX as r, renderSlot as s, spreadAttributes as t, renderTemplate as u, isAstroComponentFactory as v, isRoute500 as w, renderEndpoint as x, markHTMLString as y };