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