import 'file:///home/runner/work/docus/docus/node_modules/.pnpm/unenv@0.5.1/node_modules/unenv/runtime/polyfill/fetch.node.mjs';
import { toEventHandler, defineEventHandler, handleCacheHeaders, createEvent, createApp, createRouter, lazyEventHandler } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/h3@0.7.8/node_modules/h3/dist/index.mjs';
import { createFetch as createFetch$1, Headers } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/ohmyfetch@0.4.16/node_modules/ohmyfetch/dist/node.mjs';
import destr from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/destr@1.1.1/node_modules/destr/dist/index.mjs';
import { createRouter as createRouter$1 } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/radix3@0.1.2/node_modules/radix3/dist/index.mjs';
import { createCall, createFetch } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/unenv@0.5.1/node_modules/unenv/runtime/fetch/index.mjs';
import { createHooks } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/hookable@5.1.1/node_modules/hookable/dist/index.mjs';
import { snakeCase } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/scule@0.2.1/node_modules/scule/dist/index.mjs';
import { hash } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/ohash@0.1.0/node_modules/ohash/dist/index.mjs';
import { createStorage } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/unstorage@0.4.1/node_modules/unstorage/dist/index.mjs';
import _unstorage_drivers_fs from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/unstorage@0.4.1/node_modules/unstorage/dist/drivers/fs.mjs';
import { withQuery } from 'file:///home/runner/work/docus/docus/node_modules/.pnpm/ufo@0.8.4/node_modules/ufo/dist/index.mjs';

const _runtimeConfig = (function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P){return {app:{baseURL:"\u002F",buildAssetsDir:"\u002F_nuxt\u002F",cdnURL:a},nitro:{routes:{},envPrefix:"NUXT_"},public:{content:{base:d,tags:{p:e,a:f,blockquote:g,"code-inline":h,code:i,em:j,h1:k,h2:l,h3:m,h4:n,h5:o,h6:p,hr:q,img:r,ul:s,ol:t,li:u,strong:v,table:w,thead:x,tbody:y,td:z,th:A,tr:B},highlight:{theme:C,preload:[D,E,F,G,H,I,J,K,L,M,N]},wsUrl:a},docus:{defaultThemeConfig:{title:"Docus",url:"https:\u002F\u002Fdocus.dev",description:"Write pages in markdown, use Vue components and enjoy the power of Nuxt with a blazing fast developer experience.",debug:O,layout:"docs",socials:{twitter:"@docus_"},github:{repository:"nuxtlabs\u002Fdocus",branch:"dev",dir:a,releases:b},aside:{level:0,filter:[]},header:{title:O,logo:b},cover:{src:"https:\u002F\u002Fuser-images.githubusercontent.com\u002F904724\u002F105075054-872fac80-5a89-11eb-8aab-46dd254ad986.png",alt:"A screenshot of a website built with Docus with the Docus logo on top of it."},footer:{credits:{icon:P,text:"Made by NuxtLabs"},icons:[{label:"NuxtJS",href:"https:\u002F\u002Fnuxtjs.org",component:P},{label:"Vue Telescope",href:"https:\u002F\u002Fvuetelescope.com",component:"IconVueTelescope"}]}}}},github:{repo:a,releases:{api:"https:\u002F\u002Fapi.github.com\u002Frepos",repo:c,token:c,parse:b}},content:{transformers:["\u002Fhome\u002Frunner\u002Fwork\u002Fdocus\u002Fdocus\u002Fnode_modules\u002F.pnpm\u002F@nuxt+content-edge@2.0.0-27530884.c34f7bd\u002Fnode_modules\u002F@nuxt\u002Fcontent-edge\u002Fdist\u002Fruntime\u002Fserver\u002Ftransformers\u002Fmarkdown.mjs","\u002Fhome\u002Frunner\u002Fwork\u002Fdocus\u002Fdocus\u002Fnode_modules\u002F.pnpm\u002F@nuxt+content-edge@2.0.0-27530884.c34f7bd\u002Fnode_modules\u002F@nuxt\u002Fcontent-edge\u002Fdist\u002Fruntime\u002Fserver\u002Ftransformers\u002Fyaml.mjs","\u002Fhome\u002Frunner\u002Fwork\u002Fdocus\u002Fdocus\u002Fnode_modules\u002F.pnpm\u002F@nuxt+content-edge@2.0.0-27530884.c34f7bd\u002Fnode_modules\u002F@nuxt\u002Fcontent-edge\u002Fdist\u002Fruntime\u002Fserver\u002Ftransformers\u002Fjson.mjs","\u002Fhome\u002Frunner\u002Fwork\u002Fdocus\u002Fdocus\u002Fnode_modules\u002F.pnpm\u002F@nuxt+content-edge@2.0.0-27530884.c34f7bd\u002Fnode_modules\u002F@nuxt\u002Fcontent-edge\u002Fdist\u002Fruntime\u002Fserver\u002Ftransformers\u002Fcsv.mjs","\u002Fhome\u002Frunner\u002Fwork\u002Fdocus\u002Fdocus\u002Fnode_modules\u002F.pnpm\u002F@nuxt+content-edge@2.0.0-27530884.c34f7bd\u002Fnode_modules\u002F@nuxt\u002Fcontent-edge\u002Fdist\u002Fruntime\u002Fserver\u002Ftransformers\u002Fpath-meta.mjs","\u002Fhome\u002Frunner\u002Fwork\u002Fdocus\u002Fdocus\u002Fnode_modules\u002F.pnpm\u002F@nuxt+content-edge@2.0.0-27530884.c34f7bd\u002Fnode_modules\u002F@nuxt\u002Fcontent-edge\u002Fdist\u002Fruntime\u002Fserver\u002Ftransformers\u002Fshiki.mjs"],base:d,watch:b,sources:["content"],ignores:["\\.","-"],locales:[],defaultLocale:c,highlight:{theme:C,preload:[D,E,F,G,H,I,J,K,L,M,N]},markdown:{tags:{p:e,a:f,blockquote:g,"code-inline":h,code:i,em:j,h1:k,h2:l,h3:m,h4:n,h5:o,h6:p,hr:q,img:r,ul:s,ol:t,li:u,strong:v,table:w,thead:x,tbody:y,td:z,th:A,tr:B},remarkPlugins:[["remark-github",{repository:a}]],rehypePlugins:[]},yaml:{},csv:{},navigation:{fields:["layout"]}}}}("",true,void 0,"_content","prose-p","prose-a","prose-blockquote","prose-code-inline","prose-code","prose-em","prose-h1","prose-h2","prose-h3","prose-h4","prose-h5","prose-h6","prose-hr","prose-img","prose-ul","prose-ol","prose-li","prose-strong","prose-table","prose-thead","prose-tbody","prose-td","prose-th","prose-tr","one-dark-pro","json","js","ts","html","css","vue","diff","shell","markdown","yaml","bash",false,"IconNuxtLabs"));
const ENV_PREFIX = "NITRO_";
const ENV_PREFIX_ALT = _runtimeConfig.nitro.envPrefix ?? process.env.NITRO_ENV_PREFIX ?? "_";
const getEnv = (key) => {
  const envKey = snakeCase(key).toUpperCase();
  return destr(process.env[ENV_PREFIX + envKey] ?? process.env[ENV_PREFIX_ALT + envKey]);
};
function isObject(input) {
  return typeof input === "object" && !Array.isArray(input);
}
function overrideConfig(obj, parentKey = "") {
  for (const key in obj) {
    const subKey = parentKey ? `${parentKey}_${key}` : key;
    const envValue = getEnv(subKey);
    if (isObject(obj[key])) {
      if (isObject(envValue)) {
        obj[key] = { ...obj[key], ...envValue };
      }
      overrideConfig(obj[key], subKey);
    } else {
      obj[key] = envValue ?? obj[key];
    }
  }
}
overrideConfig(_runtimeConfig);
const config = deepFreeze(_runtimeConfig);
const useRuntimeConfig = () => config;
function deepFreeze(object) {
  const propNames = Object.getOwnPropertyNames(object);
  for (const name of propNames) {
    const value = object[name];
    if (value && typeof value === "object") {
      deepFreeze(value);
    }
  }
  return Object.freeze(object);
}

const globalTiming = globalThis.__timing__ || {
  start: () => 0,
  end: () => 0,
  metrics: []
};
function timingMiddleware(_req, res, next) {
  const start = globalTiming.start();
  const _end = res.end;
  res.end = (data, encoding, callback) => {
    const metrics = [["Generate", globalTiming.end(start)], ...globalTiming.metrics];
    const serverTiming = metrics.map((m) => `-;dur=${m[1]};desc="${encodeURIComponent(m[0])}"`).join(", ");
    if (!res.headersSent) {
      res.setHeader("Server-Timing", serverTiming);
    }
    _end.call(res, data, encoding, callback);
  };
  next();
}

const serverAssets = [{"baseName":"server","dir":"/home/runner/work/docus/docus/packages/docs-theme/server/assets"}];

const assets = createStorage();

for (const asset of serverAssets) {
  assets.mount(asset.baseName, _unstorage_drivers_fs({ base: asset.dir }));
}

const storage = createStorage({});

const useStorage = () => storage;

storage.mount('/assets', assets);

storage.mount('content:source:content', _unstorage_drivers_fs({"name":"content","driver":"fs","prefix":"","base":"/home/runner/work/docus/docus/packages/docs-theme/content"}));
storage.mount('root', _unstorage_drivers_fs({"driver":"fs","base":"/home/runner/work/docus/docus/packages/docs-theme"}));
storage.mount('src', _unstorage_drivers_fs({"driver":"fs","base":"/home/runner/work/docus/docus/packages/docs-theme/server"}));
storage.mount('build', _unstorage_drivers_fs({"driver":"fs","base":"/home/runner/work/docus/docus/packages/docs-theme/.nuxt"}));
storage.mount('cache', _unstorage_drivers_fs({"driver":"fs","base":"/home/runner/work/docus/docus/packages/docs-theme/.nuxt/cache"}));

const defaultCacheOptions = {
  name: "_",
  base: "/cache",
  swr: true,
  maxAge: 1
};
function defineCachedFunction(fn, opts) {
  opts = { ...defaultCacheOptions, ...opts };
  const pending = {};
  const group = opts.group || "nitro";
  const name = opts.name || fn.name || "_";
  const integrity = hash([opts.integrity, fn, opts]);
  async function get(key, resolver) {
    const cacheKey = [opts.base, group, name, key].filter(Boolean).join(":").replace(/:\/$/, ":index");
    const entry = await useStorage().getItem(cacheKey) || {};
    const ttl = (opts.maxAge ?? opts.maxAge ?? 0) * 1e3;
    if (ttl) {
      entry.expires = Date.now() + ttl;
    }
    const expired = entry.integrity !== integrity || ttl && Date.now() - (entry.mtime || 0) > ttl;
    const _resolve = async () => {
      if (!pending[key]) {
        pending[key] = Promise.resolve(resolver());
      }
      entry.value = await pending[key];
      entry.mtime = Date.now();
      entry.integrity = integrity;
      delete pending[key];
      useStorage().setItem(cacheKey, entry).catch((error) => console.error("[nitro] [cache]", error));
    };
    const _resolvePromise = expired ? _resolve() : Promise.resolve();
    if (opts.swr && entry.value) {
      _resolvePromise.catch(console.error);
      return Promise.resolve(entry);
    }
    return _resolvePromise.then(() => entry);
  }
  return async (...args) => {
    const key = (opts.getKey || getKey)(...args);
    const entry = await get(key, () => fn(...args));
    let value = entry.value;
    if (opts.transform) {
      value = await opts.transform(entry, ...args) || value;
    }
    return value;
  };
}
const cachedFunction = defineCachedFunction;
function getKey(...args) {
  return args.length ? hash(args, {}) : "";
}
function defineCachedEventHandler(handler, opts = defaultCacheOptions) {
  const _opts = {
    ...opts,
    getKey: (event) => {
      return event.req.originalUrl || event.req.url;
    },
    group: opts.group || "nitro/handlers",
    integrity: [
      opts.integrity,
      handler
    ]
  };
  const _handler = toEventHandler(handler);
  const _cachedHandler = cachedFunction(async (incomingEvent) => {
    const reqProxy = cloneWithProxy(incomingEvent.req, { headers: {} });
    const resHeaders = {};
    const resProxy = cloneWithProxy(incomingEvent.res, {
      statusCode: 200,
      getHeader(name) {
        return resHeaders[name];
      },
      setHeader(name, value) {
        resHeaders[name] = value;
        return this;
      },
      getHeaderNames() {
        return Object.keys(resHeaders);
      },
      hasHeader(name) {
        return name in resHeaders;
      },
      removeHeader(name) {
        delete resHeaders[name];
      },
      getHeaders() {
        return resHeaders;
      }
    });
    const event = createEvent(reqProxy, resProxy);
    const body = await _handler(event);
    const headers = event.res.getHeaders();
    headers.Etag = `W/"${hash(body)}"`;
    headers["Last-Modified"] = new Date().toUTCString();
    const cacheControl = [];
    if (opts.swr) {
      if (opts.maxAge) {
        cacheControl.push(`s-maxage=${opts.maxAge}`);
      }
      if (opts.staleMaxAge) {
        cacheControl.push(`stale-while-revalidate=${opts.staleMaxAge}`);
      } else {
        cacheControl.push("stale-while-revalidate");
      }
    } else if (opts.maxAge) {
      cacheControl.push(`max-age=${opts.maxAge}`);
    }
    if (cacheControl.length) {
      headers["Cache-Control"] = cacheControl.join(", ");
    }
    const cacheEntry = {
      code: event.res.statusCode,
      headers,
      body
    };
    return cacheEntry;
  }, _opts);
  return defineEventHandler(async (event) => {
    const response = await _cachedHandler(event);
    if (event.res.headersSent || event.res.writableEnded) {
      return response.body;
    }
    if (handleCacheHeaders(event, {
      modifiedTime: new Date(response.headers["Last-Modified"]),
      etag: response.headers.etag,
      maxAge: opts.maxAge
    })) {
      return;
    }
    event.res.statusCode = response.code;
    for (const name in response.headers) {
      event.res.setHeader(name, response.headers[name]);
    }
    return response.body;
  });
}
function cloneWithProxy(obj, overrides) {
  return new Proxy(obj, {
    get(target, property, receiver) {
      if (property in overrides) {
        return overrides[property];
      }
      return Reflect.get(target, property, receiver);
    },
    set(target, property, value, receiver) {
      if (property in overrides) {
        overrides[property] = value;
        return true;
      }
      return Reflect.set(target, property, value, receiver);
    }
  });
}
const cachedEventHandler = defineCachedEventHandler;

const plugins = [
  
];

function hasReqHeader(req, header, includes) {
  const value = req.headers[header];
  return value && typeof value === "string" && value.toLowerCase().includes(includes);
}
function isJsonRequest(event) {
  return hasReqHeader(event.req, "accept", "application/json") || hasReqHeader(event.req, "user-agent", "curl/") || hasReqHeader(event.req, "user-agent", "httpie/") || event.req.url?.endsWith(".json") || event.req.url?.includes("/api/");
}
function normalizeError(error) {
  const cwd = process.cwd();
  const stack = (error.stack || "").split("\n").splice(1).filter((line) => line.includes("at ")).map((line) => {
    const text = line.replace(cwd + "/", "./").replace("webpack:/", "").replace("file://", "").trim();
    return {
      text,
      internal: line.includes("node_modules") && !line.includes(".cache") || line.includes("internal") || line.includes("new Promise")
    };
  });
  const statusCode = error.statusCode || 500;
  const statusMessage = error.statusMessage ?? (statusCode === 404 ? "Route Not Found" : "Internal Server Error");
  const message = error.message || error.toString();
  return {
    stack,
    statusCode,
    statusMessage,
    message
  };
}

const errorHandler = (async function errorhandler(_error, event) {
  const { stack, statusCode, statusMessage, message } = normalizeError(_error);
  const errorObject = {
    url: event.req.url,
    statusCode,
    statusMessage,
    message,
    description: "",
    data: _error.data
  };
  event.res.statusCode = errorObject.statusCode;
  event.res.statusMessage = errorObject.statusMessage;
  if (errorObject.statusCode !== 404) {
    console.error("[nuxt] [request error]", errorObject.message + "\n" + stack.map((l) => "  " + l.text).join("  \n"));
  }
  if (isJsonRequest(event)) {
    event.res.setHeader("Content-Type", "application/json");
    event.res.end(JSON.stringify(errorObject));
    return;
  }
  const url = withQuery("/__nuxt_error", errorObject);
  const html = await $fetch(url).catch((error) => {
    console.error("[nitro] Error while generating error response", error);
    return errorObject.statusMessage;
  });
  event.res.setHeader("Content-Type", "text/html;charset=UTF-8");
  event.res.end(html);
});

const _49363e = () => import('../handlers/releases.mjs');
const _e3df52 = () => import('../handlers/query.mjs');
const _2ce588 = () => import('../handlers/cache.mjs');
const _25c608 = () => import('../handlers/navigation.mjs');
const _dde9f3 = () => import('../handlers/highlight.mjs');
const _268d40 = () => import('../handlers/component-meta.get.mjs');
const _3e4a3c = () => import('../renderer.mjs');

const handlers = [
  { route: '/api/_github/releases', handler: _49363e, lazy: true, method: undefined },
  { route: '/api/_content/query/:query', handler: _e3df52, lazy: true, method: "get" },
  { route: '/api/_content/cache', handler: _2ce588, lazy: true, method: "get" },
  { route: '/api/_content/navigation/:query', handler: _25c608, lazy: true, method: "get" },
  { route: '/api/_content/highlight', handler: _dde9f3, lazy: true, method: "post" },
  { route: '/api/component-meta', handler: _268d40, lazy: true, method: undefined },
  { route: '/api/component-meta/:component?', handler: _268d40, lazy: true, method: undefined },
  { route: '/**', handler: _3e4a3c, lazy: true, method: undefined }
];

function createNitroApp() {
  const config = useRuntimeConfig();
  const hooks = createHooks();
  const h3App = createApp({
    debug: destr(false),
    onError: errorHandler
  });
  h3App.use(config.app.baseURL, timingMiddleware);
  const router = createRouter();
  const routerOptions = createRouter$1({ routes: config.nitro.routes });
  for (const h of handlers) {
    let handler = h.lazy ? lazyEventHandler(h.handler) : h.handler;
    const referenceRoute = h.route.replace(/:\w+|\*\*/g, "_");
    const routeOptions = routerOptions.lookup(referenceRoute) || {};
    if (routeOptions.swr) {
      handler = cachedEventHandler(handler, {
        group: "nitro/routes"
      });
    }
    if (h.route === "") {
      h3App.use(config.app.baseURL, handler);
    } else {
      router.use(h.route, handler, h.method);
    }
  }
  h3App.use(config.app.baseURL, router);
  const localCall = createCall(h3App.nodeHandler);
  const localFetch = createFetch(localCall, globalThis.fetch);
  const $fetch = createFetch$1({ fetch: localFetch, Headers, defaults: { baseURL: config.app.baseURL } });
  globalThis.$fetch = $fetch;
  const app = {
    hooks,
    h3App,
    localCall,
    localFetch
  };
  for (const plugin of plugins) {
    plugin(app);
  }
  return app;
}
const nitroApp = createNitroApp();

const localFetch = nitroApp.localFetch;

export { useStorage as a, defineCachedEventHandler as d, localFetch as l, useRuntimeConfig as u };
//# sourceMappingURL=nitro-prerenderer.mjs.map
