// Will be replaced in post-build with the paths generated by SSG
// TODO calculate this at build time from the SSG configuration
const staticPaths = new Set(['__QWIK_ROUTER_STATIC_PATHS_ARRAY__']);

/**
 * Decide whether a given request path is a static path, for optimizing file access.
 *
 * @internal
 */
export function isStaticPath(method: string, url: URL) {
  if (method.toUpperCase() !== 'GET') {
    return false;
  }
  const p = url.pathname;
  if (p.startsWith('/' + (globalThis.__QWIK_BUILD_DIR__ || 'build') + '/')) {
    return true;
  }
  if (p.startsWith('/' + (globalThis.__QWIK_ASSETS_DIR__ || 'assets') + '/')) {
    return true;
  }
  // Loader sidecars are listed by post-build only when SSG wrote them, so a missing one falls to SSR.
  return staticPaths.has(p);
}
