import { v as validateAuth } from './auth-DuunT7Cg.js';
import { s as sosCoordinator } from './coordinator-DMU_ADXf.js';
import { j as json } from './index-CoD1IJuy.js';
import './shared-server-DaWdgxVh.js';
import 'crypto';
import 'better-sqlite3';
import 'fs';
import 'os';
import 'path';

const GET = ({ request }) => {
  const authError = validateAuth(request);
  if (authError) {
    return authError;
  }
  return json({ superSessions: sosCoordinator.listSuperSessions() });
};
const POST = async ({ request }) => {
  const authError = validateAuth(request);
  if (authError) {
    return authError;
  }
  let body;
  try {
    body = await request.json();
  } catch {
    return json({ error: "Invalid JSON in request body" }, { status: 400 });
  }
  if (typeof body !== "object" || body === null) {
    return json({ error: "Invalid JSON in request body" }, { status: 400 });
  }
  const payload = body;
  const label = typeof payload.label === "string" && payload.label.trim() ? payload.label.trim() : "Untitled";
  const session = sosCoordinator.createSuperSession(label);
  return json(session, { status: 201 });
};

export { GET, POST };
//# sourceMappingURL=_server.ts-DkZX_O9a.js.map
