import { jsxs as f, Fragment as l, jsx as m } from "react/jsx-runtime";
import { useState as p } from "react";
import { u as d, af as E, W as g } from "./index-ZQlxzdt5.js";
var s = /* @__PURE__ */ ((n) => (n.ACCOUNTS_STEP = "accounts", n.EVENT_TYPES_STEP = "event-types", n.CONFIGURE_STEP = "configure", n))(s || {}), i = function(n) {
  switch (typeof n) {
    case "string":
      return n;
    case "boolean":
      return n ? "true" : "false";
    case "number":
      return isFinite(n) ? n : "";
    default:
      return "";
  }
}, y = function(n, t, e, o) {
  return t = t || "&", e = e || "=", n === null && (n = void 0), typeof n == "object" ? Object.keys(n).map(function(r) {
    var a = encodeURIComponent(i(r)) + e;
    return Array.isArray(n[r]) ? n[r].map(function(c) {
      return a + encodeURIComponent(i(c));
    }).join(t) : a + encodeURIComponent(i(n[r]));
  }).filter(Boolean).join(t) : o ? encodeURIComponent(i(o)) + e + encodeURIComponent(i(n)) : "";
}, u;
u = y;
const C = ({
  slug: n,
  step: t,
  teamId: e
}) => {
  const o = { slug: n };
  e && (o.teamId = e);
  const r = u(o);
  return `/apps/installation/${t}?${r}`;
};
function I(n) {
  const [t, e] = p(!1), o = d(null), r = () => {
    o.mutate({
      type: "office365_video",
      variant: "conferencing",
      slug: "msteams",
      returnTo: g + C({
        slug: "msteams",
        step: s.EVENT_TYPES_STEP
      })
    });
  };
  return /* @__PURE__ */ f(l, { children: [
    n.render({
      onClick() {
        e(!0);
      },
      disabled: t
    }),
    /* @__PURE__ */ m(E, { open: t, onOpenChange: e, handleSubmit: r })
  ] });
}
export {
  I as default
};
