import { y as defineEventHandler, aa as getRouterParam, R as Resource } from '../../../../nitro/nitro.mjs';
import { g as getUser } from '../../../../_/getUser.mjs';
import 'luxon';
import '@sequelize/core';
import 'html-to-text';
import 'zod';
import 'crypto';
import 'node:fs';
import 'sharp';
import 'path';
import 'node:stream';
import 'jsdom';
import 'dompurify';
import 'mime-types';
import 'fs';
import 'fs/promises';
import 'linkify-html';
import '@peertube/http-signature';
import 'jsonld';
import 'lodash.intersection';
import 'email-templates';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'node:events';
import 'node:buffer';
import 'node:path';
import 'vue';
import 'vue-router';
import 'dotenv';
import 'url';
import 'bcryptjs';
import 'slugify';
import 'umzug';
import 'consola';
import '@sequelize/core/decorators-legacy';
import 'util';
import 'mitt';
import 'ical.js';
import 'node:url';
import 'fast-xml-parser';
import '../../../../_/jwt.mjs';
import 'jose';

const _id__get = defineEventHandler(async (evt) => {
  const eventId = getRouterParam(evt, "id");
  const user = await getUser(evt);
  const isAdminOrEditor = ["admin", "editor"].includes(user?.role ?? "");
  const resources = await Resource.findAll({
    where: {
      eventId,
      ...!isAdminOrEditor && { "hidden": false, "$APUser.blocked$": false }
    },
    attributes: ["activitypub_id", "data", "createdAt", "updatedAt", "hidden"],
    include: [
      { association: "APUser", required: false, attributes: ["ap_id", "object", "blocked"] }
    ],
    order: [["createdAt", "ASC"]]
  });
  return resources;
});

export { _id__get as default };
