import { i as defineEventHandler, y as getRouterParam, e as createError, t as getProvider, p as fetchTaskDetail } from '../../../nitro/nitro.mjs';
import 'node:path';
import 'node:module';
import 'node:fs';
import 'node:os';
import 'dotenv';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:crypto';
import 'node:async_hooks';
import 'node:url';
import 'node:net';
import '@iconify/utils';
import 'consola';

const _id__get = defineEventHandler(async (event) => {
  const id = getRouterParam(event, "id");
  if (!id) {
    throw createError({ statusCode: 400, statusMessage: "Missing task id" });
  }
  const { config, provider } = getProvider(event);
  const task = await fetchTaskDetail(config, provider, id);
  if (!task) {
    throw createError({
      statusCode: 404,
      statusMessage: `Task ${id} not found within the configured provider tag scope`
    });
  }
  const comments = await provider.getComments(id);
  return { task, comments };
});

export { _id__get as default };
//# sourceMappingURL=_id_.get.mjs.map
