import { jsx as l, Fragment as x, jsxs as o } from "react/jsx-runtime";
import { useState as N, useEffect as w } from "react";
import { y as _, a9 as t, N as g, k as C, a5 as P, S as p } from "./index-_1f6rhg6.js";
const d = [{ label: "BTC", value: "BTC", unit: "sats" }], T = ({
  eventType: b,
  getAppData: s,
  setAppData: a
}) => {
  var v, h;
  const { t: n } = _(), i = s("price"), c = s("currency"), [r, S] = N(
    d.find((e) => e.value === c) || d[0]
  ), f = s("paymentOption"), u = ((v = t) == null ? void 0 : v.find((e) => f === e.value)) || {
    label: t[0].label,
    value: t[0].value
  }, y = !!b.seatsPerTimeSlot, [m] = N(s("enabled")), O = ((h = b.recurringEvent) == null ? void 0 : h.count) !== void 0;
  return w(() => {
    !c && m && a("currency", r.value);
  }, [c, r, a, m]), /* @__PURE__ */ l(x, { children: O ? /* @__PURE__ */ l(g, { className: "mt-2", severity: "warning", title: n("warning_recurring_event_payment") }) : m && /* @__PURE__ */ o(x, { children: [
    /* @__PURE__ */ l("div", { className: "mt-2 block items-center sm:flex", children: /* @__PURE__ */ l(
      C,
      {
        label: "Price",
        labelSrOnly: !0,
        addOnLeading: /* @__PURE__ */ l(P, { className: "h-4 w-4" }),
        addOnSuffix: r.unit || r.value,
        type: "number",
        required: !0,
        className: "block w-full rounded-sm border-gray-300 pl-2 pr-12 text-sm",
        placeholder: "Price",
        onChange: (e) => {
          a("price", Number(e.target.value)), c && a("currency", c);
        },
        value: i && i > 0 ? i : void 0
      }
    ) }),
    /* @__PURE__ */ o("div", { className: "mt-5 w-60", children: [
      /* @__PURE__ */ l("label", { className: "text-default block text-sm font-medium", htmlFor: "currency", children: n("currency") }),
      /* @__PURE__ */ l(
        p,
        {
          variant: "default",
          options: d,
          value: r,
          className: "text-black",
          defaultValue: r,
          onChange: (e) => {
            e && (S(e), a("currency", e.value));
          }
        }
      )
    ] }),
    /* @__PURE__ */ o("div", { className: "mt-2 w-60", children: [
      /* @__PURE__ */ l("label", { className: "text-default block text-sm font-medium", htmlFor: "currency", children: "Payment option" }),
      /* @__PURE__ */ l(
        p,
        {
          defaultValue: u ? { ...u, label: n(u.label) } : { ...t[0], label: n(t[0].label) },
          options: t.map((e) => ({ ...e, label: n(e.label) || e.label })),
          onChange: (e) => {
            e && a("paymentOption", e.value);
          },
          className: "mb-1 h-[38px] w-full",
          isDisabled: y
        }
      )
    ] }),
    y && f === "HOLD" && /* @__PURE__ */ l(g, { className: "mt-2", severity: "warning", title: n("seats_and_no_show_fee_error") })
  ] }) });
};
export {
  T as default
};
