globalThis.__nitro_main__ = import.meta.url;
import { N as NodeResponse, s as serve } from "./_libs/srvx.mjs";
import { d as defineHandler, H as HTTPError, t as toEventHandler, a as defineLazyEventHandler, b as H3Core } from "./_libs/h3.mjs";
import { d as decodePath, w as withLeadingSlash, a as withoutTrailingSlash, j as joinURL } from "./_libs/ufo.mjs";
import { promises } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
import "node:http";
import "node:stream";
import "node:stream/promises";
import "node:https";
import "node:http2";
import "./_libs/rou3.mjs";
function lazyService(loader) {
  let promise, mod;
  return {
    fetch(req) {
      if (mod) {
        return mod.fetch(req);
      }
      if (!promise) {
        promise = loader().then((_mod) => mod = _mod.default || _mod);
      }
      return promise.then((mod2) => mod2.fetch(req));
    }
  };
}
const services = {
  ["ssr"]: lazyService(() => import("./_ssr/index.mjs"))
};
globalThis.__nitro_vite_envs__ = services;
const headers = ((m) => function headersRouteRule(event) {
  for (const [key2, value] of Object.entries(m.options || {})) {
    event.res.headers.set(key2, value);
  }
});
const assets = {
  "/assets/alibaba-TTwafVwX.svg": {
    "type": "image/svg+xml",
    "etag": '"171b-6dyV5K8QjiaY35sN9qNprh9zDIs"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 5915,
    "path": "../public/assets/alibaba-TTwafVwX.svg"
  },
  "/assets/index-Btw8ec7-.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"74-Si+LSldyx0r6eyhCKLBrfEnEPe8"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 116,
    "path": "../public/assets/index-Btw8ec7-.js"
  },
  "/assets/index-BRvz6-L6.css": {
    "type": "text/css; charset=utf-8",
    "etag": '"17492-JL6LQ7LktE+Z13FtWdf220LM1h4"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 95378,
    "path": "../public/assets/index-BRvz6-L6.css"
  },
  "/assets/CompareDrawer-C-4ypEWs.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"4a1f-MtCtIuSEWViO+k9O7NiG+WdWW/s"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 18975,
    "path": "../public/assets/CompareDrawer-C-4ypEWs.js"
  },
  "/assets/minimax-BPMzvuL-.jpeg": {
    "type": "image/jpeg",
    "etag": '"1b06-IwivU89ko5UTMUM1/t7hn4sQK9A"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 6918,
    "path": "../public/assets/minimax-BPMzvuL-.jpeg"
  },
  "/assets/json-viewer-BicGakI5.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"1e61b-F0iLQvxKPSiAcJXtFh3kbxWdyCs"',
    "mtime": "2026-06-17T09:08:04.359Z",
    "size": 124443,
    "path": "../public/assets/json-viewer-BicGakI5.js"
  },
  "/assets/ReplayDialog-CyBKOgba.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"11c0-aqeGa8euE3ZZm68Zocdr8a5lyog"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 4544,
    "path": "../public/assets/ReplayDialog-CyBKOgba.js"
  },
  "/assets/ResponseView-MogToC4i.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"6e91-aH2PTafY1YSqsEz1haJsISbe08w"',
    "mtime": "2026-06-17T09:08:04.359Z",
    "size": 28305,
    "path": "../public/assets/ResponseView-MogToC4i.js"
  },
  "/assets/RequestAnatomy-C0IrVQ3q.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"142a-4J4inWZKnQA9eVxJUqhgY7bNixY"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 5162,
    "path": "../public/assets/RequestAnatomy-C0IrVQ3q.js"
  },
  "/assets/StreamingChunkSequence-ClhUhT-s.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"d81-H1su5BwFCKxXCFEbJtAP8Dh2syA"',
    "mtime": "2026-06-17T09:08:04.359Z",
    "size": 3457,
    "path": "../public/assets/StreamingChunkSequence-ClhUhT-s.js"
  },
  "/assets/zhipuai-BPNAnxo-.svg": {
    "type": "image/svg+xml",
    "etag": '"2bf8-hNaLCTi89nOFCsIIfWpP/jrfo0s"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 11256,
    "path": "../public/assets/zhipuai-BPNAnxo-.svg"
  },
  "/assets/_sessionId-BO47oA3Z.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"d2-LQ4ORv9iRuNjtfE30EnrZcfuGdI"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 210,
    "path": "../public/assets/_sessionId-BO47oA3Z.js"
  },
  "/assets/main-Be2qqUUW.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"50a37-B3xzwOmQqzg0FvrYhReSzxCAqgg"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 330295,
    "path": "../public/assets/main-Be2qqUUW.js"
  },
  "/assets/qwen-CONDcHqt.png": {
    "type": "image/png",
    "etag": '"572c3-cdJAPaHdOvFCGzuaQjagdgOu6XE"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 357059,
    "path": "../public/assets/qwen-CONDcHqt.png"
  },
  "/assets/ProxyViewerContainer-WRenRpeh.js": {
    "type": "text/javascript; charset=utf-8",
    "etag": '"769e0-3XxRCK3xMutpa2X2uOf3cazcy88"',
    "mtime": "2026-06-17T09:08:04.357Z",
    "size": 485856,
    "path": "../public/assets/ProxyViewerContainer-WRenRpeh.js"
  }
};
function readAsset(id) {
  const serverDir = dirname(fileURLToPath(globalThis.__nitro_main__));
  return promises.readFile(resolve(serverDir, assets[id].path));
}
const publicAssetBases = {};
function isPublicAssetURL(id = "") {
  if (assets[id]) {
    return true;
  }
  for (const base in publicAssetBases) {
    if (id.startsWith(base)) {
      return true;
    }
  }
  return false;
}
function getAsset(id) {
  return assets[id];
}
const METHODS = /* @__PURE__ */ new Set(["HEAD", "GET"]);
const EncodingMap = {
  gzip: ".gz",
  br: ".br",
  zstd: ".zst"
};
const _zAOcG1 = defineHandler((event) => {
  if (event.req.method && !METHODS.has(event.req.method)) {
    return;
  }
  let id = decodePath(withLeadingSlash(withoutTrailingSlash(event.url.pathname)));
  let asset;
  const encodingHeader = event.req.headers.get("accept-encoding") || "";
  const encodings = [...encodingHeader.split(",").map((e) => EncodingMap[e.trim()]).filter(Boolean).sort(), ""];
  for (const encoding of encodings) {
    for (const _id of [id + encoding, joinURL(id, "index.html" + encoding)]) {
      const _asset = getAsset(_id);
      if (_asset) {
        asset = _asset;
        id = _id;
        break;
      }
    }
  }
  if (!asset) {
    if (isPublicAssetURL(id)) {
      event.res.headers.delete("Cache-Control");
      throw new HTTPError({ status: 404 });
    }
    return;
  }
  if (encodings.length > 1) {
    event.res.headers.append("Vary", "Accept-Encoding");
  }
  const ifNotMatch = event.req.headers.get("if-none-match") === asset.etag;
  if (ifNotMatch) {
    event.res.status = 304;
    event.res.statusText = "Not Modified";
    return "";
  }
  const ifModifiedSinceH = event.req.headers.get("if-modified-since");
  const mtimeDate = new Date(asset.mtime);
  if (ifModifiedSinceH && asset.mtime && new Date(ifModifiedSinceH) >= mtimeDate) {
    event.res.status = 304;
    event.res.statusText = "Not Modified";
    return "";
  }
  if (asset.type) {
    event.res.headers.set("Content-Type", asset.type);
  }
  if (asset.etag && !event.res.headers.has("ETag")) {
    event.res.headers.set("ETag", asset.etag);
  }
  if (asset.mtime && !event.res.headers.has("Last-Modified")) {
    event.res.headers.set("Last-Modified", mtimeDate.toUTCString());
  }
  if (asset.encoding && !event.res.headers.has("Content-Encoding")) {
    event.res.headers.set("Content-Encoding", asset.encoding);
  }
  if (asset.size > 0 && !event.res.headers.has("Content-Length")) {
    event.res.headers.set("Content-Length", asset.size.toString());
  }
  return readAsset(id);
});
const findRouteRules = /* @__PURE__ */ (() => {
  const $0 = [{ name: "headers", route: "/assets/**", handler: headers, options: { "cache-control": "public, max-age=31536000, immutable" } }];
  return (m, p) => {
    let r = [];
    if (p.charCodeAt(p.length - 1) === 47) p = p.slice(0, -1) || "/";
    let s = p.split("/"), l = s.length;
    if (l > 1) {
      if (s[1] === "assets") {
        r.unshift({ data: $0, params: { "_": s.slice(2).join("/") } });
      }
    }
    return r;
  };
})();
const _lazy_oesjP1 = defineLazyEventHandler(() => import("./_chunks/ssr-renderer.mjs"));
const findRoute = /* @__PURE__ */ (() => {
  const data = { route: "/**", handler: _lazy_oesjP1 };
  return ((_m, p) => {
    return { data, params: { "_": p.slice(1) } };
  });
})();
const globalMiddleware = [
  toEventHandler(_zAOcG1)
].filter(Boolean);
const errorHandler$1 = (error, event) => {
  const res = defaultHandler(error, event);
  return new NodeResponse(typeof res.body === "string" ? res.body : JSON.stringify(res.body, null, 2), res);
};
function defaultHandler(error, event) {
  const unhandled = error.unhandled ?? !HTTPError.isError(error);
  const { status = 500, statusText = "" } = unhandled ? {} : error;
  if (status === 404) {
    const url = event.url || new URL(event.req.url);
    const baseURL = "/";
    if (/^\/[^/]/.test(baseURL) && !url.pathname.startsWith(baseURL)) {
      return {
        status: 302,
        headers: new Headers({ location: `${baseURL}${url.pathname.slice(1)}${url.search}` })
      };
    }
  }
  const headers2 = new Headers(unhandled ? {} : error.headers);
  headers2.set("content-type", "application/json; charset=utf-8");
  const jsonBody = unhandled ? {
    status,
    unhandled: true
  } : typeof error.toJSON === "function" ? error.toJSON() : {
    status,
    statusText,
    message: error.message
  };
  return {
    status,
    statusText,
    headers: headers2,
    body: {
      error: true,
      ...jsonBody
    }
  };
}
const errorHandlers = [errorHandler$1];
async function errorHandler(error, event) {
  for (const handler of errorHandlers) {
    try {
      const response = await handler(error, event, { defaultHandler });
      if (response) {
        return response;
      }
    } catch (error2) {
      console.error(error2);
    }
  }
}
function createNitroApp() {
  const captureError = (error, errorCtx) => {
    if (errorCtx?.event) {
      const errors = errorCtx.event.req.context?.nitro?.errors;
      if (errors) {
        errors.push({ error, context: errorCtx });
      }
    }
  };
  const h3App = createH3App({
    onError(error, event) {
      return errorHandler(error, event);
    }
  });
  let appHandler = (req) => {
    req.context ||= {};
    req.context.nitro = req.context.nitro || { errors: [] };
    return h3App.fetch(req);
  };
  return {
    fetch: appHandler,
    h3: h3App,
    hooks: void 0,
    captureError
  };
}
function createH3App(config) {
  const h3App = new H3Core(config);
  h3App["~findRoute"] = (event) => findRoute(event.req.method, event.url.pathname);
  h3App["~middleware"].push(...globalMiddleware);
  h3App["~getMiddleware"] = (event, route) => {
    const pathname = event.url.pathname;
    const method = event.req.method;
    const middleware = [];
    const routeRules = getRouteRules(method, pathname);
    event.context.routeRules = routeRules?.routeRules;
    if (routeRules?.routeRuleMiddleware.length) {
      middleware.push(...routeRules.routeRuleMiddleware);
    }
    middleware.push(...h3App["~middleware"]);
    if (route?.data?.middleware?.length) {
      middleware.push(...route.data.middleware);
    }
    return middleware;
  };
  return h3App;
}
const APP_ID = "default";
function useNitroApp() {
  let instance = useNitroApp._instance;
  if (instance) {
    return instance;
  }
  instance = useNitroApp._instance = createNitroApp();
  globalThis.__nitro__ = globalThis.__nitro__ || {};
  globalThis.__nitro__[APP_ID] = instance;
  return instance;
}
function getRouteRules(method, pathname) {
  const m = findRouteRules(method, pathname);
  if (!m?.length) {
    return { routeRuleMiddleware: [] };
  }
  const routeRules = {};
  for (const layer of m) {
    for (const rule of layer.data) {
      const currentRule = routeRules[rule.name];
      if (currentRule) {
        if (rule.options === false) {
          delete routeRules[rule.name];
          continue;
        }
        if (typeof currentRule.options === "object" && typeof rule.options === "object") {
          currentRule.options = {
            ...currentRule.options,
            ...rule.options
          };
        } else {
          currentRule.options = rule.options;
        }
        currentRule.route = rule.route;
        currentRule.params = {
          ...currentRule.params,
          ...layer.params
        };
      } else if (rule.options !== false) {
        routeRules[rule.name] = {
          ...rule,
          params: layer.params
        };
      }
    }
  }
  const middleware = [];
  const orderedRules = Object.values(routeRules).sort((a, b) => (a.handler?.order || 0) - (b.handler?.order || 0));
  for (const rule of orderedRules) {
    if (rule.options === false || !rule.handler) {
      continue;
    }
    middleware.push(rule.handler(rule));
  }
  return {
    routeRules,
    routeRuleMiddleware: middleware
  };
}
function _captureError(error, type) {
  console.error(`[${type}]`, error);
  useNitroApp().captureError?.(error, { tags: [type] });
}
function trapUnhandledErrors() {
  process.on("unhandledRejection", (error) => _captureError(error, "unhandledRejection"));
  process.on("uncaughtException", (error) => _captureError(error, "uncaughtException"));
}
const tracingSrvxPlugins = [];
const _parsedPort = Number.parseInt(process.env.NITRO_PORT ?? process.env.PORT ?? "");
const port = Number.isNaN(_parsedPort) ? 3e3 : _parsedPort;
const host = process.env.NITRO_HOST || process.env.HOST;
const cert = process.env.NITRO_SSL_CERT;
const key = process.env.NITRO_SSL_KEY;
const nitroApp = useNitroApp();
serve({
  port,
  hostname: host,
  tls: cert && key ? {
    cert,
    key
  } : void 0,
  fetch: nitroApp.fetch,
  plugins: [...tracingSrvxPlugins]
});
trapUnhandledErrors();
const nodeServer = {};
export {
  nodeServer as default
};
