"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const z = require("zod");
const sendEmailPayloadSchema = z.z.object({
  /**  */
  to: z.z.string(),
  /** The email template to send */
  template: z.z.string(),
  payload: z.z.string()
});
async function sendEmail(payload) {
  try {
    const parsedPayload = sendEmailPayloadSchema.parse(JSON.parse(payload));
    console.log(parsedPayload);
    const emails = await Promise.resolve().then(() => require("./index-2rjvIgDO.cjs"));
    const email = emails[parsedPayload.template];
    if (!email)
      throw new Error("Invalid email template");
    await email(parsedPayload.to);
  } catch (error) {
    console.error(error);
    throw error;
  }
}
exports.sendEmail = sendEmail;
