export declare const ssrRenderer = "\nimport { eventHandler, getResponseHeader } from 'h3';\n// @ts-ignore\nimport renderer from '#analog/ssr';\n// @ts-ignore\nimport template from '#analog/index';\n\nexport default eventHandler(async (event) => {\n const noSSR = getResponseHeader(event, 'x-analog-no-ssr');\n\n if (noSSR === 'true') {\n return template;\n }\n\n const html = await renderer(event.node.req.url, template, {\n req: event.node.req,\n res: event.node.res,\n });\n\n return html;\n});"; export declare const ssrStreamRenderer = "\nimport { eventHandler, getResponseHeader, setResponseHeader } from 'h3';\n// @ts-ignore\nimport renderer from '#analog/ssr';\n// @ts-ignore\nimport template from '#analog/index';\n\nexport default eventHandler(async (event) => {\n const noSSR = getResponseHeader(event, 'x-analog-no-ssr');\n\n if (noSSR === 'true') {\n return template;\n }\n\n // renderer (main.server.ts default export via renderStream) returns a\n // ReadableStream that flushes the head first, then each @defer block as it\n // resolves. Returning the stream from the handler streams it to the client.\n const stream = await renderer(event.node.req.url, template, {\n req: event.node.req,\n res: event.node.res,\n });\n\n setResponseHeader(event, 'content-type', 'text/html;charset=utf-8');\n\n // A `streaming: false` route rule sets this header; renderStream then emits\n // the buffered render() output as a single chunk. Collect it into a string so\n // the response is a normal buffered document (content-length), not chunked.\n const noStreaming = getResponseHeader(event, 'x-analog-no-streaming');\n if (noStreaming === 'true') {\n const reader = stream.getReader();\n const decoder = new TextDecoder();\n let html = '';\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n html += decoder.decode(value, { stream: true });\n }\n html += decoder.decode();\n return html;\n }\n\n // Let the runtime frame the response (h3 sets chunked TE for the Node preset;\n // HTTP/2 and edge runtimes forbid an explicit Transfer-Encoding header).\n return stream;\n});"; export declare const clientRenderer = "\nimport { eventHandler } from 'h3';\n\n// @ts-ignore\nimport template from '#analog/index';\n\nexport default eventHandler(async () => {\n return template;\n});\n"; export declare const apiMiddleware = "\nimport { createError, eventHandler, proxyRequest } from 'h3';\nimport { useRuntimeConfig } from '#imports';\n\nexport default eventHandler(async (event) => {\n const prefix = useRuntimeConfig().prefix;\n const apiPrefix = `${prefix}/${useRuntimeConfig().apiPrefix}`;\n\n const url = event.node.req.url || '';\n\n // only match the prefix on a path boundary, otherwise a URL such as\n // '/apihttp://internal-host' would pass startsWith() and be forwarded verbatim\n if (\n url === apiPrefix ||\n url.startsWith(`${apiPrefix}/`) ||\n url.startsWith(`${apiPrefix}?`)\n ) {\n let reqUrl = url.slice(apiPrefix.length);\n if (reqUrl === '' || reqUrl.startsWith('?')) {\n reqUrl = `/${reqUrl}`;\n }\n\n // reject absolute and protocol-relative targets to prevent SSRF\n if (!reqUrl.startsWith('/') || reqUrl.startsWith('//')) {\n throw createError({ statusCode: 400, statusMessage: 'Invalid API route' });\n }\n\n if (\n event.node.req.method === 'GET' &&\n // in the case of XML routes, we want to proxy the request so that nitro gets the correct headers\n // and can render the XML correctly as a static asset\n !event.node.req.url?.endsWith('.xml')\n ) {\n return $fetch(reqUrl, { headers: event.node.req.headers });\n }\n\n return proxyRequest(event, reqUrl, {\n // @ts-ignore\n fetch: $fetch.native,\n });\n }\n});";