import { E as compilerRuntimeExports, r as reactExports, j as jsxRuntimeExports } from "./vendor-react-DYNCg6N5.js";
import { E as EditUserInfoContext } from "./index-TL41xEJi.js";
import { S as SectionTemplate } from "./index-CbTPqI7c.js";
import { cC as useLazyResetPasswordQuery, bP as RoleTypesEnum, m as universalNotification, bI as CircleCloseIcon, c as useAppSelector } from "./index-DfebxkL9.js";
import { l as lG, p as iO } from "./vendor-icons-xWhXK_Ui.js";
import { M as Modal } from "./index-DqcA8P_y.js";
import { m as modalTheme } from "./styles-3NoIlzov.js";
import { c as createStyles, W as useMediaQuery, E as TextInput, B as Button, a0 as SimpleGrid, T as Text, U as UnstyledButton, b as Box, V as LoadingOverlay, h as ActionIcon, s as showNotification, z as useForm } from "./vendor-mantine-h0WlM2Mj.js";
import { c as copyToClipboard } from "./utils-D5kCyTRM.js";
import { u as useTranslation } from "./vendor-i18n-wisIXUFi.js";
import { V as ValidateTextInput } from "./validateTextInput-2E2Z5K9Z.js";
import { f as formatDate } from "./date-bOIw2uwV.js";
import { a as useTerminateSessions } from "./useTerminateSessions-Cb3ukMTY.js";
import "./index-B7nmdYVM.js";
import "./types-B9VC9FeZ.js";
import "./styles-C9HVNQJ0.js";
import "./useDebounce-DTubzIUC.js";
import "./index-DMTgSMwy.js";
const useStyles$3 = createStyles((theme) => ({
  modalRoot: modalTheme(theme).root,
  modalContainer: modalTheme(theme).container,
  modalFooter: modalTheme(theme).footer,
  modalCancelBtn: modalTheme(theme).cancelBtn,
  container: {
    alignItems: "flex-end",
    marginTop: `${theme.spacing.md}`,
    width: "100%"
  },
  linkInput: {
    "& .mantine-TextInput-label, .mantine-InputWrapper-label": {
      color: theme.colors.brandGray[0],
      fontSize: "12px",
      fontWeight: 400
    },
    "& .mantine-TextInput-input": {
      borderRadius: "8px",
      border: "1px solid #D0D5DD"
    },
    "& .mantine-TextInput-rightSection": {
      color: "#175CD3",
      cursor: "pointer"
    },
    "& .mantine-Text-root": {
      padding: "0"
    }
  },
  resetPasswordButton: {
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    height: "36px",
    borderRadius: "8px",
    padding: `8px ${theme.spacing.sm}`,
    backgroundColor: theme.colors.brandGray[1],
    fontSize: "14px",
    color: "#101828",
    fontWeight: 600,
    lineHeight: "17px",
    "&:hover": {
      backgroundColor: "#eff0f4",
      color: "#101828"
    },
    "&:disabled": {
      color: theme.colors.brandGray[7],
      backgroundColor: theme.colors.brandGray[2]
    }
  },
  modalControls: {
    background: theme.white,
    width: "100%"
  }
}));
const ResetPasswordSection = (t0) => {
  var _a;
  const $ = compilerRuntimeExports.c(82);
  const {
    defaultLink,
    currentId,
    userInfoCommon,
    userId
  } = t0;
  const {
    t
  } = useTranslation();
  const {
    classes
  } = useStyles$3();
  const [resetLink, setResetLink] = reactExports.useState(defaultLink);
  const [openResetPasswordModal, setOpenResetPasswordModal] = reactExports.useState(false);
  const [linkCopied, setLinkCopied] = reactExports.useState(false);
  const [handleResetPassword, t1] = useLazyResetPasswordQuery();
  const {
    data,
    isLoading,
    isSuccess
  } = t1;
  const isMobile = useMediaQuery("(max-width: 576px)");
  let t2;
  if ($[0] !== currentId || $[1] !== userId || $[2] !== userInfoCommon.Roles) {
    t2 = (_a = userInfoCommon.Roles) == null ? void 0 : _a.some((role) => (role == null ? void 0 : role.Type) === RoleTypesEnum.SuperUser && userId !== currentId);
    $[0] = currentId;
    $[1] = userId;
    $[2] = userInfoCommon.Roles;
    $[3] = t2;
  } else {
    t2 = $[3];
  }
  const notAllowedResetPassword = t2;
  let t3;
  if ($[4] !== resetLink || $[5] !== t) {
    t3 = async () => {
      try {
        copyToClipboard(resetLink);
        setLinkCopied(true);
        universalNotification({
          isError: false,
          error: null,
          isSuccess: true,
          successTitle: t("copied")
        });
      } catch (t42) {
        setLinkCopied(false);
      }
    };
    $[4] = resetLink;
    $[5] = t;
    $[6] = t3;
  } else {
    t3 = $[6];
  }
  const copyText = t3;
  let t4;
  if ($[7] !== currentId || $[8] !== handleResetPassword || $[9] !== t) {
    t4 = async () => {
      try {
        const res = await handleResetPassword({
          UserId: currentId
        });
        universalNotification({
          error: res.error,
          isError: res.isError,
          isSuccess: res.isSuccess,
          successTitle: t("profile.resetPasswordSuccess")
        });
        if (res.isSuccess) {
          setLinkCopied(false);
        }
        setOpenResetPasswordModal(false);
      } catch (t52) {
        const error = t52;
        console.error(error);
      }
    };
    $[7] = currentId;
    $[8] = handleResetPassword;
    $[9] = t;
    $[10] = t4;
  } else {
    t4 = $[10];
  }
  const handleReset = t4;
  let t5;
  if ($[11] !== data) {
    t5 = () => {
      if (data) {
        setResetLink(data == null ? void 0 : data.Url);
      }
    };
    $[11] = data;
    $[12] = t5;
  } else {
    t5 = $[12];
  }
  let t6;
  if ($[13] !== data || $[14] !== isSuccess) {
    t6 = [data, isSuccess];
    $[13] = data;
    $[14] = isSuccess;
    $[15] = t6;
  } else {
    t6 = $[15];
  }
  reactExports.useEffect(t5, t6);
  let t7;
  let t8;
  if ($[16] !== defaultLink) {
    t7 = () => {
      if (defaultLink) {
        setResetLink(defaultLink);
      }
    };
    t8 = [defaultLink];
    $[16] = defaultLink;
    $[17] = t7;
    $[18] = t8;
  } else {
    t7 = $[17];
    t8 = $[18];
  }
  reactExports.useEffect(t7, t8);
  let t9;
  if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
    t9 = (e_0) => {
      e_0 == null ? void 0 : e_0.preventDefault();
      e_0 == null ? void 0 : e_0.stopPropagation();
      setOpenResetPasswordModal(false);
    };
    $[19] = t9;
  } else {
    t9 = $[19];
  }
  const closeModal = t9;
  const t10 = isMobile ? 1 : 2;
  const t11 = classes.container;
  const t12 = classes.linkInput;
  let t13;
  if ($[20] !== t) {
    t13 = t("profile.passwordRecoveryLink");
    $[20] = t;
    $[21] = t13;
  } else {
    t13 = $[21];
  }
  let t14;
  if ($[22] !== t) {
    t14 = t("profile.noActiveLink");
    $[22] = t;
    $[23] = t14;
  } else {
    t14 = $[23];
  }
  let t15;
  if ($[24] !== copyText || $[25] !== linkCopied || $[26] !== resetLink) {
    t15 = resetLink && /* @__PURE__ */ jsxRuntimeExports.jsx(lG, { cursor: "pointer", color: linkCopied ? "teal" : "blue", onClick: copyText });
    $[24] = copyText;
    $[25] = linkCopied;
    $[26] = resetLink;
    $[27] = t15;
  } else {
    t15 = $[27];
  }
  let t16;
  if ($[28] !== classes.linkInput || $[29] !== resetLink || $[30] !== t13 || $[31] !== t14 || $[32] !== t15) {
    t16 = /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: t12, label: t13, placeholder: t14, rightSection: t15, value: resetLink, readOnly: true, "data-cy": "resetPasswordLink" });
    $[28] = classes.linkInput;
    $[29] = resetLink;
    $[30] = t13;
    $[31] = t14;
    $[32] = t15;
    $[33] = t16;
  } else {
    t16 = $[33];
  }
  let t17;
  if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
    t17 = () => setOpenResetPasswordModal(true);
    $[34] = t17;
  } else {
    t17 = $[34];
  }
  const t18 = classes.resetPasswordButton;
  let t19;
  if ($[35] !== t) {
    t19 = t("profile.resetPassword");
    $[35] = t;
    $[36] = t19;
  } else {
    t19 = $[36];
  }
  let t20;
  if ($[37] !== classes.resetPasswordButton || $[38] !== notAllowedResetPassword || $[39] !== t19) {
    t20 = /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: t17, className: t18, disabled: notAllowedResetPassword, "data-cy": "resetPasswordBtn", children: t19 });
    $[37] = classes.resetPasswordButton;
    $[38] = notAllowedResetPassword;
    $[39] = t19;
    $[40] = t20;
  } else {
    t20 = $[40];
  }
  let t21;
  if ($[41] !== classes.container || $[42] !== t10 || $[43] !== t16 || $[44] !== t20) {
    t21 = /* @__PURE__ */ jsxRuntimeExports.jsxs(SimpleGrid, { cols: t10, w: "100%", className: t11, children: [
      t16,
      t20
    ] });
    $[41] = classes.container;
    $[42] = t10;
    $[43] = t16;
    $[44] = t20;
    $[45] = t21;
  } else {
    t21 = $[45];
  }
  let t22;
  if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
    t22 = () => setOpenResetPasswordModal(false);
    $[46] = t22;
  } else {
    t22 = $[46];
  }
  let t23;
  if ($[47] !== t) {
    t23 = t("profile.passwordReset");
    $[47] = t;
    $[48] = t23;
  } else {
    t23 = $[48];
  }
  const t24 = classes.modalRoot;
  const t25 = classes.modalContainer;
  let t26;
  if ($[49] !== t) {
    t26 = t("profile.resetPasswordAndGenerateLink");
    $[49] = t;
    $[50] = t26;
  } else {
    t26 = $[50];
  }
  let t27;
  if ($[51] !== classes.modalContainer || $[52] !== t26) {
    t27 = /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: t25, py: "md", children: t26 });
    $[51] = classes.modalContainer;
    $[52] = t26;
    $[53] = t27;
  } else {
    t27 = $[53];
  }
  const t28 = classes.modalFooter;
  let t29;
  if ($[54] !== t) {
    t29 = t("profile.reset");
    $[54] = t;
    $[55] = t29;
  } else {
    t29 = $[55];
  }
  let t30;
  if ($[56] !== handleReset || $[57] !== t29) {
    t30 = /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", radius: 8, w: "49%", onClick: handleReset, "data-cy": "resetPasswordConfirm", children: t29 });
    $[56] = handleReset;
    $[57] = t29;
    $[58] = t30;
  } else {
    t30 = $[58];
  }
  const t31 = classes.modalCancelBtn;
  let t32;
  if ($[59] !== t) {
    t32 = t("profile.cancel");
    $[59] = t;
    $[60] = t32;
  } else {
    t32 = $[60];
  }
  let t33;
  if ($[61] !== classes.modalCancelBtn || $[62] !== t32) {
    t33 = /* @__PURE__ */ jsxRuntimeExports.jsx(UnstyledButton, { className: t31, w: "49%", onClick: closeModal, "data-cy": "resetPasswordCancel", children: t32 });
    $[61] = classes.modalCancelBtn;
    $[62] = t32;
    $[63] = t33;
  } else {
    t33 = $[63];
  }
  let t34;
  if ($[64] !== classes.modalFooter || $[65] !== t30 || $[66] !== t33) {
    t34 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: t28, children: [
      t30,
      t33
    ] });
    $[64] = classes.modalFooter;
    $[65] = t30;
    $[66] = t33;
    $[67] = t34;
  } else {
    t34 = $[67];
  }
  let t35;
  if ($[68] !== classes.modalRoot || $[69] !== t27 || $[70] !== t34) {
    t35 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: t24, children: [
      t27,
      t34
    ] });
    $[68] = classes.modalRoot;
    $[69] = t27;
    $[70] = t34;
    $[71] = t35;
  } else {
    t35 = $[71];
  }
  let t36;
  if ($[72] !== isLoading) {
    t36 = /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingOverlay, { visible: isLoading });
    $[72] = isLoading;
    $[73] = t36;
  } else {
    t36 = $[73];
  }
  let t37;
  if ($[74] !== openResetPasswordModal || $[75] !== t23 || $[76] !== t35 || $[77] !== t36) {
    t37 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { zIndex: 1400, size: "400px", opened: openResetPasswordModal, onClose: t22, title: t23, children: [
      t35,
      t36
    ] });
    $[74] = openResetPasswordModal;
    $[75] = t23;
    $[76] = t35;
    $[77] = t36;
    $[78] = t37;
  } else {
    t37 = $[78];
  }
  let t38;
  if ($[79] !== t21 || $[80] !== t37) {
    t38 = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      t21,
      t37
    ] });
    $[79] = t21;
    $[80] = t37;
    $[81] = t38;
  } else {
    t38 = $[81];
  }
  return t38;
};
const useStyles$2 = createStyles(() => ({
  ldapLabel: {
    marginTop: "0!important"
  }
}));
const Ldap = (t0) => {
  const $ = compilerRuntimeExports.c(6);
  const {
    LdapIdentifier,
    isLimitedAccess
  } = t0;
  const {
    classes
  } = useStyles$2();
  let t1;
  if ($[0] !== LdapIdentifier || $[1] !== isLimitedAccess) {
    t1 = /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { label: "Login", required: false, disabled: isLimitedAccess, value: LdapIdentifier, "data-cy": "ldapLogin" });
    $[0] = LdapIdentifier;
    $[1] = isLimitedAccess;
    $[2] = t1;
  } else {
    t1 = $[2];
  }
  let t2;
  if ($[3] !== classes.ldapLabel || $[4] !== t1) {
    t2 = /* @__PURE__ */ jsxRuntimeExports.jsx(SimpleGrid, { className: classes.ldapLabel, cols: 3, mt: 16, w: "100%", children: t1 });
    $[3] = classes.ldapLabel;
    $[4] = t1;
    $[5] = t2;
  } else {
    t2 = $[5];
  }
  return t2;
};
const useStyles$1 = createStyles((theme) => ({
  root: {
    height: "100%",
    width: "100%"
  },
  container: {
    display: "flex",
    flexDirection: "column",
    alignItems: "flex-start",
    justifyContent: "center",
    width: "100%"
  },
  title: {
    fontSize: "16px",
    marginBottom: theme.spacing.md
  },
  groupButton: {
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    height: "36px",
    borderRadius: "8px",
    padding: `8px ${theme.spacing.sm}`,
    backgroundColor: theme.colors.brandGray[1],
    fontSize: "14px",
    color: "#101828",
    fontWeight: 600,
    lineHeight: "17px",
    "&:hover": {
      backgroundColor: "#eff0f4"
    },
    "&:active": {
      transform: `translateY(1px)`
    }
  },
  control: {
    display: "flex",
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "flex-start",
    marginTop: theme.spacing.md
  },
  addBtn: {
    borderRadius: "8px",
    border: `1px solid ${theme.colors.brandGray[0]}`,
    "&:hover": {
      backgroundColor: "#f6f7f8"
    },
    "& .mantine-Button-inner": {
      display: "flex",
      flexDirection: "row",
      alignItems: "center",
      justifyContent: "space-between"
    },
    "& .mantine-Button-label": {
      color: theme.black
    }
  },
  header: {
    fontSize: "14px",
    marginBottom: theme.spacing.md,
    display: "flex",
    alignItems: "center",
    flexDirection: "row"
  },
  description: {
    fontSize: "14px",
    color: "#C01048",
    marginRight: theme.spacing.xs,
    cursor: "pointer"
  },
  emptyData: {
    fontSize: "14px",
    color: theme.colors.brandGray[0]
  }
}));
const useStyles = createStyles((theme, _, utils) => ({
  root: {
    marginBottom: theme.spacing.sm,
    display: "flex",
    alignItems: "center",
    justifyContent: "space-between",
    flexDirection: "row",
    width: "100%"
  },
  leftSection: {
    display: "flex",
    alignItems: "center",
    justifyContent: "flex-start",
    flexDirection: "row",
    width: "80%",
    [utils.largerThan("xs")]: {
      justifyContent: "space-between"
    }
  },
  group: {
    display: "flex",
    alignItems: "flex-start",
    flexDirection: "column",
    width: "40%",
    [utils.largerThan("xs")]: {
      width: "20%"
    }
  },
  title: {
    fontSize: "14px"
  },
  description: {
    fontSize: "12px",
    color: theme.colors.brandGray[0]
  },
  activeConnection: {
    backgroundColor: "transparent"
  }
}));
const ConnectionItem = (t0) => {
  const $ = compilerRuntimeExports.c(34);
  const {
    Id,
    SystemName,
    Ip,
    Date,
    terminateConnection,
    isCurrent
  } = t0;
  const {
    classes
  } = useStyles();
  const {
    t
  } = useTranslation();
  let t1;
  if ($[0] !== SystemName || $[1] !== classes.description || $[2] !== classes.title || $[3] !== t) {
    t1 = SystemName ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.title, children: SystemName }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.description, children: t("profile.noInformation") });
    $[0] = SystemName;
    $[1] = classes.description;
    $[2] = classes.title;
    $[3] = t;
    $[4] = t1;
  } else {
    t1 = $[4];
  }
  let t2;
  if ($[5] !== classes.group || $[6] !== t1) {
    t2 = /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: classes.group, children: t1 });
    $[5] = classes.group;
    $[6] = t1;
    $[7] = t2;
  } else {
    t2 = $[7];
  }
  let t3;
  if ($[8] !== Ip || $[9] !== classes.title) {
    t3 = /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.title, children: Ip });
    $[8] = Ip;
    $[9] = classes.title;
    $[10] = t3;
  } else {
    t3 = $[10];
  }
  let t4;
  if ($[11] !== Date || $[12] !== t) {
    t4 = formatDate(Date) ?? t("profile.noInformation");
    $[11] = Date;
    $[12] = t;
    $[13] = t4;
  } else {
    t4 = $[13];
  }
  let t5;
  if ($[14] !== classes.description || $[15] !== t4) {
    t5 = /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.description, children: t4 });
    $[14] = classes.description;
    $[15] = t4;
    $[16] = t5;
  } else {
    t5 = $[16];
  }
  let t6;
  if ($[17] !== classes.group || $[18] !== t3 || $[19] !== t5) {
    t6 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: classes.group, children: [
      t3,
      t5
    ] });
    $[17] = classes.group;
    $[18] = t3;
    $[19] = t5;
    $[20] = t6;
  } else {
    t6 = $[20];
  }
  let t7;
  if ($[21] !== classes.leftSection || $[22] !== t2 || $[23] !== t6) {
    t7 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: classes.leftSection, children: [
      t2,
      t6
    ] });
    $[21] = classes.leftSection;
    $[22] = t2;
    $[23] = t6;
    $[24] = t7;
  } else {
    t7 = $[24];
  }
  let t8;
  if ($[25] !== Id || $[26] !== classes.activeConnection || $[27] !== isCurrent || $[28] !== terminateConnection) {
    t8 = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isCurrent ? /* @__PURE__ */ jsxRuntimeExports.jsx(ActionIcon, { classNames: {
      root: classes.activeConnection
    }, variant: "transparent", disabled: true, "data-cy": "currentConnectionIcon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(iO, { color: "green", width: "18px", height: "18px" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ActionIcon, { onClick: terminateConnection, size: "md", "data-id": Id, variant: "transparent", "data-cy": "terminateConnectionIcon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CircleCloseIcon, {}) }) });
    $[25] = Id;
    $[26] = classes.activeConnection;
    $[27] = isCurrent;
    $[28] = terminateConnection;
    $[29] = t8;
  } else {
    t8 = $[29];
  }
  let t9;
  if ($[30] !== classes.root || $[31] !== t7 || $[32] !== t8) {
    t9 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: classes.root, children: [
      t7,
      t8
    ] });
    $[30] = classes.root;
    $[31] = t7;
    $[32] = t8;
    $[33] = t9;
  } else {
    t9 = $[33];
  }
  return t9;
};
const ActiveConnections = () => {
  const {
    t
  } = useTranslation();
  const {
    classes
  } = useStyles$1();
  const {
    userInfoCommon,
    currentId
  } = reactExports.useContext(EditUserInfoContext);
  const {
    Connections
  } = userInfoCommon;
  const [list, setList] = reactExports.useState((Connections == null ? void 0 : Connections.length) ? Connections : []);
  const allConnectionIds = reactExports.useMemo(() => list == null ? void 0 : list.map((item) => item.Id), [list]);
  const currentConnectionItem = list.find((item_0) => item_0.IsOwner);
  const currentUser = useAppSelector((state) => state.userInfo.User);
  const {
    closeSessions,
    isLoading
  } = useTerminateSessions();
  const isMyProfilePage = (pathname, userId) => {
    const profilePathRegex = /^\/profile\/(\d+)\/safety$/;
    const match = pathname.match(profilePathRegex);
    return match && match[1] === (userId == null ? void 0 : userId.toString());
  };
  const terminateConnection = reactExports.useCallback(async (event) => {
    const id = Number(event.currentTarget.dataset.id) ?? null;
    if (currentConnectionItem && currentConnectionItem.Id === id) {
      showNotification({
        title: t("profile.cantDisconnectCurrentConnection"),
        message: "",
        autoClose: true,
        color: "red"
      });
    } else {
      const updateList = () => {
        setList((prevState) => prevState.filter((item_1) => item_1.Id !== id));
      };
      await closeSessions({
        ids: [id]
      }, updateList);
    }
  }, []);
  const terminateAllConnections = reactExports.useCallback(async () => {
    const filterConnectionsIds = allConnectionIds == null ? void 0 : allConnectionIds.filter((id_0) => id_0 !== (currentConnectionItem == null ? void 0 : currentConnectionItem.Id));
    if (filterConnectionsIds.length > 0) {
      const updateList_0 = () => {
        setList((prevState_0) => prevState_0.filter((item_2) => item_2.Id === (currentConnectionItem == null ? void 0 : currentConnectionItem.Id)));
      };
      await closeSessions({
        userId: currentId || null
      }, updateList_0);
    }
  }, [allConnectionIds]);
  reactExports.useEffect(() => {
    if (Connections.length) {
      setList(Connections);
    }
  }, [Connections]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SectionTemplate, { title: t("profile.activeConnections"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: classes.container, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (list == null ? void 0 : list.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: classes.header, children: [
        isMyProfilePage(location.pathname, currentUser == null ? void 0 : currentUser.Id) && list.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "light", color: "red", onClick: terminateAllConnections, "data-cy": "terminateAllConnections", children: t("profile.terminateMyConnections") }),
        !isMyProfilePage(location.pathname, currentUser == null ? void 0 : currentUser.Id) && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "light", color: "red", onClick: terminateAllConnections, "data-cy": "terminateAllConnections", children: t("profile.terminateAllConnections") })
      ] }),
      list == null ? void 0 : list.map((item_3) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(ConnectionItem, { ...item_3, isCurrent: item_3.IsOwner, terminateConnection }, item_3.Id);
      })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: classes.emptyData, children: t("profile.noActiveConnections") }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingOverlay, { visible: isLoading })
  ] }) });
};
const Safety = () => {
  const $ = compilerRuntimeExports.c(47);
  const {
    t
  } = useTranslation();
  const {
    currentId,
    userInfoCommon
  } = reactExports.useContext(EditUserInfoContext);
  const isMobile = useMediaQuery("(max-width: 576px)");
  const User = useAppSelector(_temp);
  const {
    LdapIdentifier,
    Credentials
  } = userInfoCommon;
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t0 = {
      initialValues: {
        Login: "",
        Email: "",
        PasswordResetUrl: "",
        AdditionalEmail: ""
      }
    };
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  const credentialsForm = useForm(t0);
  const t1 = (Credentials == null ? void 0 : Credentials.Login) || "";
  const t2 = (Credentials == null ? void 0 : Credentials.Email) || "";
  const t3 = (Credentials == null ? void 0 : Credentials.PasswordResetUrl) || "";
  const t4 = (Credentials == null ? void 0 : Credentials.AdditionalEmail) || "";
  let t5;
  if ($[1] !== t1 || $[2] !== t2 || $[3] !== t3 || $[4] !== t4) {
    t5 = {
      Login: t1,
      Email: t2,
      PasswordResetUrl: t3,
      AdditionalEmail: t4
    };
    $[1] = t1;
    $[2] = t2;
    $[3] = t3;
    $[4] = t4;
    $[5] = t5;
  } else {
    t5 = $[5];
  }
  const formData = t5;
  let t6;
  if ($[6] !== credentialsForm || $[7] !== formData) {
    t6 = () => {
      credentialsForm.setValues(formData);
      credentialsForm.resetDirty(formData);
    };
    $[6] = credentialsForm;
    $[7] = formData;
    $[8] = t6;
  } else {
    t6 = $[8];
  }
  let t7;
  if ($[9] !== Credentials) {
    t7 = [Credentials];
    $[9] = Credentials;
    $[10] = t7;
  } else {
    t7 = $[10];
  }
  reactExports.useEffect(t6, t7);
  let t8;
  if ($[11] !== t) {
    t8 = t("profile.localAuthorization");
    $[11] = t;
    $[12] = t8;
  } else {
    t8 = $[12];
  }
  const t9 = isMobile ? 1 : 2;
  let t10;
  if ($[13] !== t) {
    t10 = t("profile.login");
    $[13] = t;
    $[14] = t10;
  } else {
    t10 = $[14];
  }
  let t11;
  if ($[15] !== credentialsForm || $[16] !== t10) {
    t11 = /* @__PURE__ */ jsxRuntimeExports.jsx(ValidateTextInput, { fieldName: "Login", label: t10, form: credentialsForm, disabled: true, dataAttribute: "safetyLogin" });
    $[15] = credentialsForm;
    $[16] = t10;
    $[17] = t11;
  } else {
    t11 = $[17];
  }
  let t12;
  if ($[18] !== t) {
    t12 = t("profile.noEmail");
    $[18] = t;
    $[19] = t12;
  } else {
    t12 = $[19];
  }
  let t13;
  if ($[20] !== t) {
    t13 = t("profile.email");
    $[20] = t;
    $[21] = t13;
  } else {
    t13 = $[21];
  }
  let t14;
  if ($[22] !== Credentials.IsConfirmed || $[23] !== credentialsForm || $[24] !== currentId || $[25] !== t12 || $[26] !== t13) {
    t14 = /* @__PURE__ */ jsxRuntimeExports.jsx(ValidateTextInput, { placeholder: t12, fieldName: "Email", label: t13, form: credentialsForm, isConfirmed: Credentials.IsConfirmed, userId: currentId, disabled: true, dataAttribute: "safetyEmail" });
    $[22] = Credentials.IsConfirmed;
    $[23] = credentialsForm;
    $[24] = currentId;
    $[25] = t12;
    $[26] = t13;
    $[27] = t14;
  } else {
    t14 = $[27];
  }
  let t15;
  if ($[28] !== t11 || $[29] !== t14 || $[30] !== t9) {
    t15 = /* @__PURE__ */ jsxRuntimeExports.jsxs(SimpleGrid, { cols: t9, w: "100%", children: [
      t11,
      t14
    ] });
    $[28] = t11;
    $[29] = t14;
    $[30] = t9;
    $[31] = t15;
  } else {
    t15 = $[31];
  }
  const t16 = Credentials == null ? void 0 : Credentials.PasswordResetUrl;
  const t17 = User == null ? void 0 : User.Id;
  let t18;
  if ($[32] !== currentId || $[33] !== t16 || $[34] !== t17 || $[35] !== userInfoCommon) {
    t18 = /* @__PURE__ */ jsxRuntimeExports.jsx(ResetPasswordSection, { currentId, defaultLink: t16, userInfoCommon, userId: t17 });
    $[32] = currentId;
    $[33] = t16;
    $[34] = t17;
    $[35] = userInfoCommon;
    $[36] = t18;
  } else {
    t18 = $[36];
  }
  let t19;
  if ($[37] !== t15 || $[38] !== t18 || $[39] !== t8) {
    t19 = /* @__PURE__ */ jsxRuntimeExports.jsxs(SectionTemplate, { title: t8, children: [
      t15,
      t18
    ] });
    $[37] = t15;
    $[38] = t18;
    $[39] = t8;
    $[40] = t19;
  } else {
    t19 = $[40];
  }
  let t20;
  if ($[41] !== LdapIdentifier) {
    t20 = LdapIdentifier && /* @__PURE__ */ jsxRuntimeExports.jsx(SectionTemplate, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Ldap, { LdapIdentifier, isLimitedAccess: true }) });
    $[41] = LdapIdentifier;
    $[42] = t20;
  } else {
    t20 = $[42];
  }
  let t21;
  if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
    t21 = /* @__PURE__ */ jsxRuntimeExports.jsx(ActiveConnections, {});
    $[43] = t21;
  } else {
    t21 = $[43];
  }
  let t22;
  if ($[44] !== t19 || $[45] !== t20) {
    t22 = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      t19,
      t20,
      t21
    ] });
    $[44] = t19;
    $[45] = t20;
    $[46] = t22;
  } else {
    t22 = $[46];
  }
  return t22;
};
function _temp(state) {
  var _a;
  return (_a = state == null ? void 0 : state.userInfo) == null ? void 0 : _a.User;
}
export {
  Safety as default
};
//# sourceMappingURL=index-BrPxVWEo.js.map
