import{c as e,D as t,F as s,i as a,G as i,H as n,I as o,J as m,K as p}from"../../_/nitro.mjs";import"node:http";import"node:https";import"nitropack/dist/runtime/plugin";import"packrup";import"vue";import"node:fs";import"node:url";import"consola/core";import"node:path";const r=e((async e=>{const r=t(e),{sitemaps:u}=r;let c=s(e,"sitemap");if(!c){const t=e.path.match(/(?:\/__sitemap__\/)?([^/]+)\.xml$/);t&&(c=t[1])}if(!c)return a({statusCode:400,message:"Invalid sitemap request"});c=i(n(c.replace(".xml","").replace("__sitemap__/","").replace(r.sitemapsPathPrefix||"","")));const d=o(c,u,r.defaultSitemapsChunkSize),h=void 0!==u.chunks&&!Number.isNaN(Number(c));if(!(c in u||d.baseSitemapName in u||h))return a({statusCode:404,message:`Sitemap "${c}" not found.`});if(d.isChunked&&void 0!==d.chunkIndex){const e=u[d.baseSitemapName];if(e&&!e.chunks&&!e._isChunking)return a({statusCode:404,message:`Sitemap "${d.baseSitemapName}" does not support chunking.`});if(void 0!==e?._chunkCount&&d.chunkIndex>=e._chunkCount)return a({statusCode:404,message:`Chunk ${d.chunkIndex} does not exist for sitemap "${d.baseSitemapName}".`})}const k=m(c,u,r.defaultSitemapsChunkSize);return p(e,k,r)}));export{r as default};
