/**
 * @wrnexus/core — shared types and primitives used by every other package.
 */
export type {
  Context,
  Next,
  Middleware,
  PageMeta,
  PageComponent,
  SeoConfig,
  TFunction,
} from "./context.ts";
export { createContext, withContextHeaders } from "./context.ts";

export { escapeHtml, isSafeIslandName, isSafeRequestPath } from "./security.ts";
export { csrfToken, verifyCsrf, csrfProtection, CSRF_COOKIE, CSRF_HEADER } from "./csrf.ts";

export {
  hashPassword,
  verifyPassword,
  logIn,
  logOut,
  getUser,
  sessionAuth,
  requireAuth,
  SESSION_USER_KEY,
} from "./auth.ts";
export type { RequireAuthOptions } from "./auth.ts";

export { rateLimit, peerKey, proxyKey, defaultKey } from "./ratelimit.ts";
export type { RateLimitOptions, RateLimitStore, Bucket } from "./ratelimit.ts";

export { requestLogger } from "./logging.ts";
export type { RequestLoggerOptions, RequestRecord } from "./logging.ts";

export { TTLCache, cacheControl, withCacheControl, etag, notModified } from "./cache.ts";
export type { CacheControlOptions } from "./cache.ts";

export { saveUpload, collectUploads, sanitizeFilename, UploadError } from "./uploads.ts";
export type { SaveUploadOptions, SavedUpload } from "./uploads.ts";

export { streamResponse, sse } from "./stream.ts";
export type { StreamResponseInit, ServerSentEvent } from "./stream.ts";

export {
  defineRoom,
  isRoomDefinition,
  createRealtimeRegistry,
  bridgeRealtime,
} from "./realtime.ts";
export type {
  RealtimeBus,
  RealtimeSocket,
  RealtimeHandler,
  RawSocket,
  Room,
  RoomClient,
  RoomHandlers,
  RoomAuthInfo,
  RoomDefinition,
  Target,
  RealtimeRegistry,
  RealtimeConnectMeta,
  RealtimeBridge,
  RealtimeEnvelope,
} from "./realtime.ts";

export type { Mode } from "./errors.ts";
export {
  renderDevError,
  renderProdError,
  renderError,
  renderNotFound,
  renderStatusPage,
} from "./errors.ts";

export type {
  ContentSecurityPolicyConfig,
  CorsConfig,
  CorsOrigin,
  CspDirectiveValue,
  HstsConfig,
  PermissionsPolicyConfig,
  SecurityConfig,
  TrustedTypesConfig,
} from "./headers.ts";
export {
  createCorsPreflightResponse,
  withSecurityHeaders,
  isWebSocketOriginAllowed,
  resolveRequestUrl,
} from "./headers.ts";

export type {
  CookieOptions,
  CookieStore,
  LocalStorageSnapshot,
  SessionStore,
  SessionBackend,
  SessionEntry,
  AsyncSessionBackend,
} from "./storage.ts";
export { setSessionBackend, loadSession } from "./storage.ts";

export { Fragment, Html, jsx, jsxs, mustache } from "./jsx-runtime.ts";
export type { Component as JSXComponent, Props as JSXProps, Renderable } from "./jsx-runtime.ts";
