import { jsx as r, jsxs as l, Fragment as M } from "react/jsx-runtime";
import { execute as ve } from "@/common/services/GlobalApis";
import { showToast as S } from "@/common/toaster/toaster";
import { Modal as Ue, Backdrop as X, Fade as Ie, Typography as j, IconButton as K, CircularProgress as Oe, Tabs as Q, Tab as W, Divider as P, Chip as I, FormControl as O, FormLabel as N, Autocomplete as Z, TextField as E, Tooltip as Ne, OutlinedInput as ze, InputAdornment as Le, FormHelperText as Ae, Alert as Te, Checkbox as Ee, Accordion as Fe, AccordionSummary as Re, AccordionDetails as qe, Button as ee } from "@mui/material";
import d from "@mui/material/Grid2";
import { Box as h } from "@mui/system";
import { t as x } from "./i18next-CTOWN_jH.js";
import z from "prop-types";
import ke, { useState as C, useEffect as Me } from "react";
import { useForm as je, useFieldArray as We, Controller as L } from "react-hook-form";
import { api as re } from "@/common/interceptors/AxiosInterceptor";
import { syncMenuConfigFormsWithServer as Pe, downloadFeature as Be } from "@/common/services/SyncWithServer";
import { FormConfiguratorService as Ye } from "@/common/services/FormConfiguratorService";
import { FontAwesomeIcon as D } from "@fortawesome/react-fontawesome";
import { faXmark as $e, faCircleInfo as _e, faEyeSlash as Ve, faEye as Ge, faChevronDown as He, faArrowsRotate as Je, faDownload as Xe } from "@fortawesome/free-solid-svg-icons";
import Ke from "@/common/services/util/GeneralUtil";
import Qe from "@/views/custom-components/InfoBadge";
import te from "@/views/custom-components/AlertPlaceholder";
import Ze from "@/views/custom-components/PostgresEditor";
function er({
  id: B,
  navigationState: Y,
  selectedFeature: F,
  openServerSyncModal: R,
  openModalFunc: $
}) {
  const [u, oe] = C(), [se, ne] = C([]), [A, ie] = C(), [q, ae] = C(!1), [w, k] = C(-1), [le, g] = C(!1), [T, _] = C({}), [m, V] = C([]), [f, ce] = C("SYNC"), y = je({
    defaultValues: {
      serverName: "",
      formCode: [],
      formDetails: [],
      userName: "",
      password: "",
      requestMessage: ""
    },
    mode: "onChange"
  }), { fields: b, remove: de, append: me, replace: G } = We({
    control: y.control,
    name: "formDetails"
  }), ue = (t, o) => {
    _({});
    const e = [...b];
    e.forEach((s) => {
      const i = u.find(
        (n) => n.formCode === s.formCode
      );
      s.migrationList = i.migrationListAll, s.migrationListAll = i.migrationListAll;
    }), G(e), ce(o);
  };
  Me(() => {
    (async () => {
      try {
        await fe(), await he();
      } catch (t) {
        S({
          message: t,
          type: "error"
        });
      }
    })();
  }, [R]);
  const fe = async () => {
    try {
      const t = (await Ye.getAllLinkedFormsByMenuConfigId(B)).data;
      t && (ne(t), oe(() => {
        const o = t, e = /* @__PURE__ */ new Map();
        return o.forEach((s) => {
          e.has(s.formCode) || e.set(s.formCode, {
            sourceFormCode: s.sourceFormCode,
            formName: s.formName,
            formCode: s.formCode,
            versions: JSON.parse(s.versions).filter(
              (i) => i.version !== "DRAFT"
            ),
            formUUID: s.uuid,
            builderType: s.builderType,
            migrationList: s.migrationList,
            migrationListAll: s.migrationList
          });
        }), Array.from(e.values());
      }));
    } catch (t) {
      S({
        message: t,
        type: "error"
      });
    }
  }, pe = async (t) => {
    if (t && u) {
      const o = u.map((e) => e.formUUID);
      try {
        const e = await re.get(
          "sync/migrationUUIDsByListOfFormMasterUUIDSource",
          {
            params: {
              formMasterUUIDs: o,
              serverCode: t.code
            },
            paramsSerializer: {
              serialize: (s) => Object.entries(s).map(
                ([i, n]) => Array.isArray(n) ? n.map((c) => `${i}=${encodeURIComponent(c)}`).join("&") : `${i}=${encodeURIComponent(n)}`
              ).join("&")
            }
          }
        );
        V([...e.data]);
      } catch (e) {
        console.error("Error fetching UUIDs:", e);
      }
    } else
      V([]);
  }, he = async () => {
    try {
      const t = (await ve({
        code: "fetch_server_details"
      })).data;
      t.result && ie(t.result);
    } catch (t) {
      S({
        message: t,
        type: "error"
      });
    }
  }, ge = () => {
    let t = y.getValues("formCode") || [];
    if (t.length > 0) {
      k(t[0]);
      let o = t.map((n) => {
        var a;
        let c = u == null ? void 0 : u.find((p) => p.formCode === n);
        return c ? {
          formName: c.formName,
          formCode: c.formCode,
          formUUID: c.formUUID,
          migrationList: (a = c.migrationList) == null ? void 0 : a.filter(
            (p) => !m.includes(p.uuid)
          ),
          migrationListAll: c.migrationList
        } : null;
      }).filter(Boolean), e = b.map((n) => n.formCode), s = o.filter(
        (n) => !e.includes(n.formCode)
      ), i = e.filter(
        (n) => !t.includes(n)
      );
      s.forEach((n) => {
        const a = (u == null ? void 0 : u.find(
          (p) => p.formCode === n.formCode
        )).versions.reduce(
          (p, v) => parseInt(v.version) > parseInt(p.version) ? v : p
        );
        me({
          formName: n.formName,
          formCode: n.formCode,
          migrationList: n.migrationList,
          migrationListAll: n.migrationList,
          version: a.version,
          formUUID: n.formUUID,
          builderType: n.builderType
        });
      }), i.forEach((n) => {
        let c = b.findIndex((a) => a.formCode === n);
        c !== -1 && de(c);
      });
    } else
      k(-1), G([]);
  }, ye = () => ae((t) => !t), Ce = () => {
    $(!1);
  }, H = async (t, o, e) => {
    try {
      return await Ke.getEncodedData(t, o, e);
    } catch (s) {
      return console.error(s), null;
    }
  }, be = (t, o) => Object.entries(t).filter(([e]) => !o.includes(e)).sort(([, e], [, s]) => e.createdOn - s.createdOn).map(([e]) => e), Se = async (t) => {
    try {
      g(!0);
      const o = await re.get("/login/get-key-and-iv", {
        withCredentials: !0
      }), e = await H(
        o.data.key,
        o.data.initVector,
        t.userName
      ), s = await H(
        o.data.key,
        o.data.initVector,
        t.password
      ), i = t.formDetails.map((a) => {
        let p = be(
          T[a.formCode] || {},
          m || []
        );
        return {
          formMasterUUID: a.formUUID,
          version: a.version,
          migrationUUIDList: p,
          builderType: a.builderType
        };
      }), n = [];
      se.forEach((a) => {
        a.sourceFormCode != a.formCode && n.push({ [a.sourceFormCode]: a.formCode });
      });
      const c = {
        menuConfigId: B,
        navigationState: Y,
        formConfigsData: i,
        routeGraphMap: n,
        transactionRequestData: {
          serverCode: t.serverName,
          requestMessage: t.requestMessage,
          featureType: "FORM_CONFIGURATOR",
          featureReferenceType: "FEATURE",
          featureReferenceId: Y
        },
        authRequestData: {
          userName: e,
          password: s,
          grantType: "password",
          clientId: "imtecho-ui"
        }
      };
      if (f === "SYNC")
        try {
          g(!0);
          const a = await Pe(c);
          g(!1), a.data.isSuccess ? (S({
            type: "success",
            message: "Synced to server successfully."
          }), $(!1)) : (S({
            type: "error",
            message: "Issue in syncing with server."
          }), console.error("error", a.data.error));
        } catch (a) {
          g(!1), S({
            type: "error",
            message: "Sync failed: Unauthorized access"
          }), console.error("error", a);
        }
      if (f === "DOWNLOAD")
        try {
          g(!0);
          const a = await Be(c), v = `V${Date.now()}__${c.navigationState}__feature.json`, we = new Blob([a.data], { type: "application/json" }), J = window.URL.createObjectURL(we), U = document.createElement("a");
          U.href = J, U.setAttribute("download", v), document.body.appendChild(U), U.click(), U.remove(), window.URL.revokeObjectURL(J), g(!1);
        } catch (a) {
          g(!1), S({
            type: "error",
            message: "Download failed"
          }), console.error("error", a);
        }
      g(!1);
    } catch (o) {
      g(!1), console.error("error", o);
    }
  }, xe = (t, o, e) => {
    let s = { ...T };
    t.target.checked ? (Object.prototype.hasOwnProperty.call(
      s,
      o
    ) || (s[o] = {}), s[o][e.uuid] = e) : delete s[o][e.uuid], _({ ...s });
  }, De = (t) => {
    const o = new Date(t), e = String(o.getDate()).padStart(2, "0"), s = String(o.getMonth() + 1).padStart(2, "0"), i = o.getFullYear();
    let n = o.getHours();
    const c = String(o.getMinutes()).padStart(2, "0");
    return n = String(n).padStart(2, "0"), `${e}/${s}/${i} ${n}:${c}`;
  };
  return /* @__PURE__ */ r(
    Ue,
    {
      open: R,
      slots: { backdrop: X },
      slotProps: {
        backdrop: {
          timeout: 500
        }
      },
      PaperProps: {
        style: {
          borderRadius: "8px"
        }
      },
      children: /* @__PURE__ */ r(Ie, { in: R, children: /* @__PURE__ */ l(
        h,
        {
          sx: {
            position: "absolute",
            top: "50%",
            left: "50%",
            padding: "10px 25px",
            transform: "translate(-50%, -50%)",
            width: "80%",
            maxHeight: "90%",
            scrollbarWidth: "none",
            overflowY: "scroll",
            bgcolor: "background.paper",
            borderRadius: "12px",
            boxShadow: 12,
            transition: "all 0.5s ease !important"
          },
          children: [
            /* @__PURE__ */ l(
              h,
              {
                sx: {
                  display: "flex",
                  justifyContent: "space-between",
                  alignItems: "center"
                },
                children: [
                  /* @__PURE__ */ l(j, { variant: "h6", className: "text-customBlue", children: [
                    x("Sync"),
                    " ",
                    F == null ? void 0 : F.name
                  ] }),
                  /* @__PURE__ */ r(K, { onClick: Ce, children: /* @__PURE__ */ r(D, { icon: $e }) })
                ]
              }
            ),
            /* @__PURE__ */ l("form", { noValidate: !0, onSubmit: y.handleSubmit(Se), children: [
              /* @__PURE__ */ l(h, { sx: { my: 2 }, children: [
                /* @__PURE__ */ r(
                  X,
                  {
                    sx: (t) => ({
                      color: "#fff",
                      zIndex: t.zIndex.drawer + 1
                    }),
                    open: le,
                    children: /* @__PURE__ */ l(
                      h,
                      {
                        sx: {
                          backgroundColor: "white",
                          p: 3,
                          color: "black",
                          display: "flex",
                          justifyContent: "space-between",
                          alignItems: "center",
                          borderRadius: "10px"
                        },
                        children: [
                          /* @__PURE__ */ r(Oe, { color: "inherit" }),
                          /* @__PURE__ */ r(j, { sx: { ml: 2 }, children: "Syncing feature, it may take some time, please wait..." })
                        ]
                      }
                    )
                  }
                ),
                /* @__PURE__ */ l(d, { container: !0, spacing: 2, children: [
                  /* @__PURE__ */ l(d, { size: 5, container: !0, children: [
                    /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ l(
                      Q,
                      {
                        value: f,
                        onChange: ue,
                        variant: "fullWidth",
                        children: [
                          /* @__PURE__ */ r(W, { label: "SYNC", value: "SYNC" }),
                          /* @__PURE__ */ r(W, { label: "DOWNLOAD", value: "DOWNLOAD" })
                        ]
                      }
                    ) }),
                    ["SYNC"].includes(f) && /* @__PURE__ */ l(M, { children: [
                      /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(I, { label: "Server and form details", size: "small" }) }) }),
                      /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ l(O, { fullWidth: !0, children: [
                        /* @__PURE__ */ r(N, { required: !0, children: "Select server" }),
                        /* @__PURE__ */ r(
                          L,
                          {
                            name: "serverName",
                            control: y.control,
                            rules: {
                              required: {
                                value: !0,
                                message: "Select server"
                              }
                            },
                            render: ({
                              field: { onChange: t, value: o },
                              fieldState: { error: e }
                            }) => {
                              const s = A == null ? void 0 : A.filter(
                                (i) => o == null ? void 0 : o.includes(i.code)
                              );
                              return /* @__PURE__ */ r(
                                Z,
                                {
                                  fullWidth: !0,
                                  size: "small",
                                  options: A || [],
                                  getOptionLabel: (i) => i.serverDetails || "",
                                  value: s,
                                  getOptionDisabled: (i) => o == null ? void 0 : o.includes(i.code),
                                  onChange: (i, n) => {
                                    const c = n == null ? void 0 : n.code;
                                    t(c), pe(n);
                                  },
                                  renderInput: (i) => /* @__PURE__ */ r(
                                    E,
                                    {
                                      ...i,
                                      placeholder: "Select server",
                                      variant: "outlined",
                                      error: e,
                                      helperText: e == null ? void 0 : e.message
                                    }
                                  )
                                }
                              );
                            }
                          }
                        )
                      ] }) })
                    ] }),
                    ["DOWNLOAD", "SYNC"].includes(f) && /* @__PURE__ */ r(M, { children: /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ l(O, { fullWidth: !0, children: [
                      /* @__PURE__ */ l(N, { required: !0, children: [
                        x("Select"),
                        " ",
                        x("forms")
                      ] }),
                      /* @__PURE__ */ r(
                        L,
                        {
                          name: "formCode",
                          rules: {
                            required: {
                              value: !0,
                              message: "Select server"
                            }
                          },
                          control: y.control,
                          render: ({
                            field: { onChange: t, value: o },
                            fieldState: { error: e }
                          }) => {
                            const s = u == null ? void 0 : u.filter(
                              (i) => o == null ? void 0 : o.includes(i.formCode)
                            );
                            return /* @__PURE__ */ r(
                              Z,
                              {
                                multiple: !0,
                                size: "small",
                                options: u || [],
                                disableCloseOnSelect: !0,
                                getOptionLabel: (i) => i.formName || "",
                                value: s,
                                getOptionDisabled: (i) => o == null ? void 0 : o.includes(i.formCode),
                                onChange: (i, n) => {
                                  const c = n.map(
                                    (a) => a.formCode
                                  );
                                  t(c), ge();
                                },
                                renderInput: (i) => /* @__PURE__ */ r(
                                  E,
                                  {
                                    ...i,
                                    placeholder: "Select all forms to sync",
                                    variant: "outlined",
                                    error: e,
                                    helperText: e == null ? void 0 : e.message
                                  }
                                )
                              }
                            );
                          }
                        }
                      )
                    ] }) }) }),
                    ["SYNC"].includes(f) && /* @__PURE__ */ l(M, { children: [
                      /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(
                        I,
                        {
                          label: /* @__PURE__ */ l(h, { children: [
                            /* @__PURE__ */ r(h, { component: "span", sx: { mr: 0.5 }, children: "User authentication details" }),
                            /* @__PURE__ */ r(Ne, { title: "Users with admin role can perform the sync operation", children: /* @__PURE__ */ r(D, { icon: _e }) })
                          ] }),
                          size: "small"
                        }
                      ) }) }),
                      /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ l(O, { variant: "outlined", fullWidth: !0, children: [
                        /* @__PURE__ */ r(N, { required: !0, children: x("Username") }),
                        /* @__PURE__ */ r(
                          L,
                          {
                            name: "userName",
                            rules: {
                              required: {
                                value: !0,
                                message: "Enter username"
                              }
                            },
                            control: y.control,
                            render: ({
                              field: t,
                              fieldState: { error: o }
                            }) => /* @__PURE__ */ r(
                              E,
                              {
                                ...t,
                                size: "small",
                                placeholder: "Enter username",
                                variant: "outlined",
                                autoComplete: "off",
                                error: !!o,
                                helperText: o == null ? void 0 : o.message
                              }
                            )
                          }
                        )
                      ] }) }),
                      /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ l(O, { fullWidth: !0, children: [
                        /* @__PURE__ */ r(
                          N,
                          {
                            required: !0,
                            color: "text.primary",
                            sx: { mb: 0.5 },
                            children: x("Password")
                          }
                        ),
                        /* @__PURE__ */ r(
                          L,
                          {
                            name: "password",
                            rules: {
                              required: {
                                value: !0,
                                message: "Enter password"
                              }
                            },
                            control: y.control,
                            errors: y.formState.errors,
                            defaultValue: "",
                            render: ({
                              field: { onChange: t, value: o },
                              fieldState: { error: e }
                            }) => /* @__PURE__ */ l(h, { sx: { mb: 1 }, children: [
                              /* @__PURE__ */ r(
                                ze,
                                {
                                  fullWidth: !0,
                                  type: q ? "text" : "password",
                                  value: o,
                                  size: "small",
                                  placeholder: "Enter password",
                                  onChange: t,
                                  error: e,
                                  autoComplete: "off",
                                  endAdornment: /* @__PURE__ */ r(Le, { position: "end", children: /* @__PURE__ */ r(
                                    K,
                                    {
                                      "aria-label": q ? "hide the password" : "display the password",
                                      onClick: ye,
                                      onMouseDown: (s) => s.preventDefault(),
                                      onMouseUp: (s) => s.preventDefault(),
                                      edge: "end",
                                      children: q ? /* @__PURE__ */ r(
                                        D,
                                        {
                                          icon: Ve,
                                          size: "xs"
                                        }
                                      ) : /* @__PURE__ */ r(
                                        D,
                                        {
                                          icon: Ge,
                                          size: "xs"
                                        }
                                      )
                                    }
                                  ) })
                                }
                              ),
                              e && /* @__PURE__ */ r(Ae, { error: e, children: e == null ? void 0 : e.message })
                            ] })
                          }
                        )
                      ] }) }),
                      /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ l(O, { fullWidth: !0, children: [
                        /* @__PURE__ */ l(N, { required: !0, children: [
                          x("Request"),
                          " ",
                          x("message")
                        ] }),
                        /* @__PURE__ */ r(
                          L,
                          {
                            name: "requestMessage",
                            rules: {
                              required: {
                                value: !0,
                                message: "Enter request message"
                              }
                            },
                            control: y.control,
                            render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ r(
                              E,
                              {
                                multiline: !0,
                                rows: 4,
                                size: "small",
                                placeholder: "Enter request message",
                                ...t,
                                error: o,
                                helperText: o == null ? void 0 : o.message
                              }
                            )
                          }
                        )
                      ] }) })
                    ] })
                  ] }),
                  /* @__PURE__ */ r(d, { size: 7, children: /* @__PURE__ */ r(h, { children: b.length > 0 ? /* @__PURE__ */ l(ke.Fragment, { children: [
                    /* @__PURE__ */ r(Te, { sx: { mt: 1 }, severity: "info", children: "Please select the migration corresponding to the respective form for synchronization" }),
                    /* @__PURE__ */ r(
                      Q,
                      {
                        value: w,
                        onChange: (t, o) => {
                          k(o);
                        },
                        children: b == null ? void 0 : b.map((t) => /* @__PURE__ */ r(
                          W,
                          {
                            value: t.formCode,
                            label: /* @__PURE__ */ r(
                              Qe,
                              {
                                label: t.formCode,
                                value: `V${t.version}`,
                                color: "info.main",
                                tooltipValue: `Version ${t.version} of ${t.formName} will be synced`,
                                showTooltip: !0,
                                valueSize: 30,
                                fontSize: "0.8rem"
                              }
                            )
                          },
                          t.formUUID
                        ))
                      }
                    ),
                    /* @__PURE__ */ r(P, { sx: { mb: 1 } }),
                    w != -1 && (() => {
                      var o;
                      const t = b.find(
                        (e) => e.formCode === w
                      );
                      return /* @__PURE__ */ l(
                        d,
                        {
                          spacing: 2,
                          container: !0,
                          sx: { maxHeight: "50vh", overflowY: "scroll" },
                          children: [
                            (t == null ? void 0 : t.migrationList.length) === 0 && /* @__PURE__ */ r(d, { size: 12, children: /* @__PURE__ */ l(te, { height: "250px", children: [
                              "No migration queries present for (",
                              t.formName,
                              ")"
                            ] }) }),
                            (o = t == null ? void 0 : t.migrationList) == null ? void 0 : o.map(
                              (e) => {
                                var s, i;
                                return /* @__PURE__ */ l(
                                  d,
                                  {
                                    size: 12,
                                    container: !0,
                                    children: [
                                      /* @__PURE__ */ r(d, { size: 1, children: /* @__PURE__ */ r(
                                        Ee,
                                        {
                                          value: ((s = Object.keys(
                                            T[w] || {}
                                          )) == null ? void 0 : s.includes(e.uuid)) && (!(m != null && m.includes(
                                            e.uuid
                                          )) || f == "DOWNLOAD"),
                                          checked: ((i = Object.keys(
                                            T[w] || {}
                                          )) == null ? void 0 : i.includes(e.uuid)) && (!(m != null && m.includes(
                                            e.uuid
                                          )) || f == "DOWNLOAD"),
                                          disabled: (m == null ? void 0 : m.includes(
                                            e.uuid
                                          )) && f === "SYNC",
                                          sx: {
                                            "& .MuiSvgIcon-root": {
                                              fontSize: 32
                                            },
                                            mr: 1
                                          },
                                          onChange: (n) => {
                                            xe(
                                              n,
                                              w,
                                              e
                                            );
                                          }
                                        }
                                      ) }),
                                      /* @__PURE__ */ r(d, { size: 11, children: /* @__PURE__ */ l(
                                        Fe,
                                        {
                                          slotProps: {
                                            transition: { unmountOnExit: !0 }
                                          },
                                          children: [
                                            /* @__PURE__ */ r(
                                              Re,
                                              {
                                                expandIcon: /* @__PURE__ */ r(
                                                  D,
                                                  {
                                                    icon: He
                                                  }
                                                ),
                                                "aria-controls": "panel1-content",
                                                id: "panel1-header",
                                                sx: {
                                                  backgroundColor: "background.default"
                                                },
                                                children: /* @__PURE__ */ l(j, { component: "span", children: [
                                                  "Created on :",
                                                  " ",
                                                  De(e.createdOn),
                                                  /* @__PURE__ */ r(
                                                    I,
                                                    {
                                                      sx: { ml: 2 },
                                                      size: "small",
                                                      color: e.isExecuted ? "success" : "warning",
                                                      label: e.isExecuted ? "Executed" : "Not Executed"
                                                    }
                                                  ),
                                                  e.isExecuted && e.isError && /* @__PURE__ */ r(
                                                    I,
                                                    {
                                                      sx: { ml: 2 },
                                                      size: "small",
                                                      color: "error",
                                                      label: "Error"
                                                    }
                                                  ),
                                                  (m == null ? void 0 : m.includes(
                                                    e.uuid
                                                  )) && f === "SYNC" && /* @__PURE__ */ r(
                                                    I,
                                                    {
                                                      sx: { ml: 2 },
                                                      size: "small",
                                                      color: "info",
                                                      label: "Synced"
                                                    }
                                                  )
                                                ] })
                                              }
                                            ),
                                            /* @__PURE__ */ r(qe, { children: /* @__PURE__ */ r(
                                              Ze,
                                              {
                                                mode: "READ_ONLY",
                                                defaultValue: e == null ? void 0 : e.query
                                              }
                                            ) })
                                          ]
                                        }
                                      ) })
                                    ]
                                  },
                                  e.uuid
                                );
                              }
                            )
                          ]
                        },
                        t.formCode
                      );
                    })()
                  ] }) : /* @__PURE__ */ r(h, { sx: { mt: 1 }, children: /* @__PURE__ */ r(te, { height: "250px", children: "Please select forms to sync" }) }) }) })
                ] })
              ] }),
              /* @__PURE__ */ l(
                h,
                {
                  sx: {
                    my: 1,
                    display: "flex",
                    justifyContent: "end",
                    alignItems: "center"
                  },
                  children: [
                    ["SYNC"].includes(f) && /* @__PURE__ */ r(
                      ee,
                      {
                        type: "submit",
                        startIcon: /* @__PURE__ */ r(D, { size: "lg", icon: Je }),
                        color: "success",
                        size: "small",
                        variant: "contained",
                        sx: { mr: 1 },
                        children: "Start Syncing"
                      }
                    ),
                    ["DOWNLOAD"].includes(f) && /* @__PURE__ */ r(
                      ee,
                      {
                        type: "submit",
                        startIcon: /* @__PURE__ */ r(D, { size: "lg", icon: Xe }),
                        color: "success",
                        size: "small",
                        variant: "contained",
                        sx: { mr: 1 },
                        children: "Download Config"
                      }
                    )
                  ]
                }
              )
            ] })
          ]
        }
      ) })
    }
  );
}
er.propTypes = {
  id: z.any,
  selectedFeature: z.any,
  navigationState: z.any,
  openServerSyncModal: z.any,
  openModalFunc: z.any
};
export {
  er as default
};
//# sourceMappingURL=ServerSyncModal-D_oFpv3C.js.map
