import {
  MAKESWIFT_SITE_VERSION_COOKIE,
  PRERENDER_BYPASS_COOKIE,
  SearchParams
} from "../api-handler/preview";
function getPreviewTokenParam(request) {
  return request.nextUrl.searchParams.get(SearchParams.PreviewToken) ?? null;
}
function hasDraftModeCookies(request) {
  return request.cookies.has(PRERENDER_BYPASS_COOKIE) && request.cookies.has(MAKESWIFT_SITE_VERSION_COOKIE);
}
function isDraftModeRequest(request) {
  const hasToken = getPreviewTokenParam(request) != null;
  if (hasToken)
    return true;
  return hasDraftModeCookies(request);
}
export {
  hasDraftModeCookies,
  isDraftModeRequest
};
//# sourceMappingURL=request-utils.js.map