import { jsx as a, jsxs as h } from "react/jsx-runtime";
import { q as I, d as n } from "./index-C62tPk5p.js";
import { A as C } from "./AppCard-CQEg94Y3.js";
import { u as f } from "./useIsAppEnabled-DnQeiNdg.js";
const T = function({
  app: s,
  eventType: d,
  onAppInstallSuccess: o
}) {
  var i;
  const { getAppData: r, setAppData: p, disabled: t } = I(), c = r("SITE_ID"), l = r("SCRIPT_URL"), { enabled: u, updateEnabled: m } = f(s);
  return /* @__PURE__ */ a(
    C,
    {
      onAppInstallSuccess: o,
      app: s,
      switchOnClick: (e) => {
        m(e);
      },
      switchChecked: u,
      teamId: ((i = d.team) == null ? void 0 : i.id) || void 0,
      children: /* @__PURE__ */ h("fieldset", { className: "stack-y-2", disabled: t, children: [
        /* @__PURE__ */ a(
          n,
          {
            disabled: t,
            name: "Script URL",
            value: l,
            defaultValue: "https://cloud.umami.is/script.js",
            placeholder: "Enter the script source URL",
            onChange: (e) => {
              p("SCRIPT_URL", e.target.value);
            }
          }
        ),
        /* @__PURE__ */ a(
          n,
          {
            disabled: t,
            name: "Site ID",
            value: c,
            placeholder: "Enter your Site ID",
            onChange: (e) => {
              p("SITE_ID", e.target.value);
            }
          }
        )
      ] })
    }
  );
};
export {
  T as default
};
