import { jsx as e, Fragment as g } from "react/jsx-runtime";
import { p, o as f, q as b, r as S, W as v } from "./index-C62tPk5p.js";
import { useMemo as C, useState as E } from "react";
import { A as w } from "./AppCard-CQEg94Y3.js";
import T from "./EventTypeAppSettingsInterface-2hel1BrL.js";
const $ = function({
  app: a,
  eventType: i,
  eventTypeFormMetadata: c,
  onAppInstallSuccess: m
}) {
  const t = p.useSearchParams(), { t: h } = f(), s = p.usePathname(), d = C(
    () => `${s}${t ? `?${t.toString()}` : ""}`,
    [s, t]
  ), { getAppData: n, setAppData: l, disabled: u } = b(), [o, A] = E(n("enabled")), y = S(c), r = !o && y;
  return /* @__PURE__ */ e(
    w,
    {
      onAppInstallSuccess: m,
      returnTo: v + d,
      app: a,
      switchChecked: o,
      switchOnClick: (P) => {
        A(P);
      },
      description: /* @__PURE__ */ e(g, { children: "Add bitcoin lightning payments to your events" }),
      disableSwitch: r,
      switchTooltip: r ? h("other_payment_app_enabled") : void 0,
      children: /* @__PURE__ */ e(
        T,
        {
          eventType: i,
          slug: a.slug,
          disabled: u,
          getAppData: n,
          setAppData: l
        }
      )
    }
  );
};
export {
  $ as default
};
