import { E as compilerRuntimeExports, r as reactExports, j as jsxRuntimeExports, a as r$4 } from "./vendor-react-DYNCg6N5.js";
import { c as createStyles, b as Box, T as Text, aw as Dropzone, ax as Slider, V as LoadingOverlay, a4 as Select, E as TextInput, ae as Input, g as Loader } from "./vendor-mantine-h0WlM2Mj.js";
import { R as ReactAvatarEditor, u as userStatusesOptions } from "./options-CRIRDAK6.js";
import { t as IQe, a5 as IP, a6 as iS, b as gq, p as iO, a7 as Fh } from "./vendor-icons-xWhXK_Ui.js";
import { O as themeColors, m as universalNotification, U as UserStatusEnum, cb as GenderEnum, ca as useLazyCheckUserExistFieldQuery } from "./index-DfebxkL9.js";
import { u as useTranslation } from "./vendor-i18n-wisIXUFi.js";
import { E as EditUserInfoContext } from "./index-TL41xEJi.js";
import { u as useUpdateInfo, a as ProfileUpdateTypeEnum, P as ProfileSectionEnum } from "./useUpdateUser-innD962A.js";
import { a as getNameFromDottedString } from "./utils-D5kCyTRM.js";
import "./index-leRPH4yM.js";
import "./index.es-BTZFX8B-.js";
import "./index-C-CFogWu.js";
import "./index-3c9En-DB.js";
import "./date-bOIw2uwV.js";
import "./papaparse.min-Ds9XhCoe.js";
import "./passwordUtils-B3CN2t6O.js";
import "./ru-Bush41s2.js";
import "./index-CfN7Ll0p.js";
import "./errorIcon-PZO0f1IY.js";
import "./index-CUcivY9l.js";
import "./index-DnphFLKH.js";
import "./index-C2HWmCvh.js";
const useStyles$4 = createStyles((theme) => ({
  editor: {
    position: "relative"
  },
  dropZone: {
    padding: "0px",
    height: "300px",
    width: "300px",
    "& .mantine-Dropzone-inner": {
      dispay: "flex",
      flexDirection: "column",
      alignItems: "center",
      display: "flex",
      justifyContent: "center",
      height: "100%",
      "& svg": {
        display: "flex",
        alignItems: "center",
        margin: "0 auto",
        marginBottom: "10px"
      }
    }
  },
  text: {
    color: theme.colors.gray[6]
  },
  range: {
    width: "250px"
  },
  slider: {
    display: "flex",
    justifyContent: "space-between",
    alignItems: "center",
    width: "300px",
    paddingTop: "20px"
  },
  hint: {
    display: "flex",
    position: "absolute",
    top: "220px",
    textAlign: "center",
    zIndex: 1,
    backgroundColor: "rgba(200, 200, 200, 0.5)",
    padding: theme.spacing.xs,
    borderRadius: "8px",
    width: "70%",
    color: "white",
    fontSize: "14px"
  }
}));
const AvatarEditor = (t0) => {
  const $ = compilerRuntimeExports.c(45);
  const {
    setAvatar,
    avatar,
    openRef,
    avatarRef,
    isLoading
  } = t0;
  const {
    classes
  } = useStyles$4();
  const {
    t: t2
  } = useTranslation();
  const [scale, setScale] = reactExports.useState(1);
  const [hint, setHint] = reactExports.useState(true);
  let t1;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t1 = () => {
      setScale(1);
    };
    $[0] = t1;
  } else {
    t1 = $[0];
  }
  let t22;
  if ($[1] !== avatar) {
    t22 = [avatar];
    $[1] = avatar;
    $[2] = t22;
  } else {
    t22 = $[2];
  }
  reactExports.useEffect(t1, t22);
  let t3;
  if ($[3] !== t2) {
    t3 = (files) => {
      if (files[0].errors[0].code) {
        const errorCode = files[0].errors[0].code;
        let errorTitle = "";
        if (errorCode === "file-too-large") {
          errorTitle = t2("avatar.warning");
        } else {
          if (errorCode === "file-invalid-type") {
            errorTitle = t2("avatar.wrongFormat");
          }
        }
        universalNotification({
          error: files[0].errors[0],
          errorTitle,
          isError: true,
          isSuccess: false
        });
      }
    };
    $[3] = t2;
    $[4] = t3;
  } else {
    t3 = $[4];
  }
  const onBeforeFileLoad = t3;
  let t4;
  if ($[5] !== setAvatar) {
    t4 = async (files_0) => {
      if (files_0.length > 0) {
        const file = files_0[0];
        const reader = new FileReader();
        reader.onload = (e3) => {
          var _a;
          if ((_a = e3 == null ? void 0 : e3.target) == null ? void 0 : _a.result) {
            setAvatar(e3.target.result);
          }
        };
        reader.readAsDataURL(file);
      }
    };
    $[5] = setAvatar;
    $[6] = t4;
  } else {
    t4 = $[6];
  }
  const onDrop = t4;
  let t5;
  if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
    t5 = (newScale) => {
      setScale(newScale);
    };
    $[7] = t5;
  } else {
    t5 = $[7];
  }
  const handleScaleChange = t5;
  let t6;
  if ($[8] !== scale) {
    t6 = () => {
      if (scale < 5) {
        setScale(scale + 0.1);
      }
    };
    $[8] = scale;
    $[9] = t6;
  } else {
    t6 = $[9];
  }
  const increaseScale = t6;
  let t7;
  if ($[10] !== scale) {
    t7 = () => {
      if (scale > 1) {
        setScale(scale - 0.1);
      }
    };
    $[10] = scale;
    $[11] = t7;
  } else {
    t7 = $[11];
  }
  const decreaseScale = t7;
  let t8;
  if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
    t8 = () => {
      setHint(false);
    };
    $[12] = t8;
  } else {
    t8 = $[12];
  }
  const handleDropzoneTouchStart = t8;
  const t9 = !avatar;
  let t10;
  if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
    t10 = {
      inner: {
        pointerEvents: "all"
      }
    };
    $[13] = t10;
  } else {
    t10 = $[13];
  }
  let t11;
  if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
    t11 = ["image/png", "image/jpeg", "image/jpg", "image/bmp"];
    $[14] = t11;
  } else {
    t11 = $[14];
  }
  let t12;
  if ($[15] !== avatar || $[16] !== avatarRef || $[17] !== classes.editor || $[18] !== classes.hint || $[19] !== classes.text || $[20] !== hint || $[21] !== scale || $[22] !== t2) {
    t12 = avatar ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(ReactAvatarEditor, { ref: avatarRef, image: avatar, scale, color: [0, 0, 0, 0.45], style: {
        width: "100%",
        height: "100%"
      }, borderRadius: avatar ? 125 : 0, border: 0, className: classes.editor, onMouseMove: handleDropzoneTouchStart }),
      hint && /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: classes.hint, children: t2("avatar.hint") })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(IQe, { size: 34, color: themeColors.brandGray[0], stroke: 2 }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.text, children: t2("avatar.choosePhoto") })
    ] });
    $[15] = avatar;
    $[16] = avatarRef;
    $[17] = classes.editor;
    $[18] = classes.hint;
    $[19] = classes.text;
    $[20] = hint;
    $[21] = scale;
    $[22] = t2;
    $[23] = t12;
  } else {
    t12 = $[23];
  }
  let t13;
  if ($[24] !== classes.dropZone || $[25] !== onBeforeFileLoad || $[26] !== onDrop || $[27] !== openRef || $[28] !== t12 || $[29] !== t9) {
    t13 = /* @__PURE__ */ jsxRuntimeExports.jsx(Dropzone, { activateOnClick: t9, styles: t10, onDrop, multiple: false, className: classes.dropZone, openRef, onReject: onBeforeFileLoad, maxSize: 5242880, accept: t11, children: t12 });
    $[24] = classes.dropZone;
    $[25] = onBeforeFileLoad;
    $[26] = onDrop;
    $[27] = openRef;
    $[28] = t12;
    $[29] = t9;
    $[30] = t13;
  } else {
    t13 = $[30];
  }
  let t14;
  if ($[31] !== avatar || $[32] !== classes.range || $[33] !== classes.slider || $[34] !== decreaseScale || $[35] !== increaseScale || $[36] !== scale) {
    t14 = avatar && /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: classes.slider, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(IP, { size: 20, color: themeColors.brandGray[0], stroke: 1.6, onClick: decreaseScale, cursor: "pointer" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Slider, { className: classes.range, value: scale, onChange: handleScaleChange, max: 5, min: 1, step: 0.1, label: null }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(iS, { size: 20, color: themeColors.brandGray[0], stroke: 1.6, onClick: increaseScale, cursor: "pointer" })
    ] });
    $[31] = avatar;
    $[32] = classes.range;
    $[33] = classes.slider;
    $[34] = decreaseScale;
    $[35] = increaseScale;
    $[36] = scale;
    $[37] = t14;
  } else {
    t14 = $[37];
  }
  let t15;
  if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
    t15 = {
      blur: 4
    };
    $[38] = t15;
  } else {
    t15 = $[38];
  }
  let t16;
  if ($[39] !== isLoading) {
    t16 = /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingOverlay, { visible: isLoading, overlayProps: t15 });
    $[39] = isLoading;
    $[40] = t16;
  } else {
    t16 = $[40];
  }
  let t17;
  if ($[41] !== t13 || $[42] !== t14 || $[43] !== t16) {
    t17 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { children: [
      t13,
      t14,
      t16
    ] });
    $[41] = t13;
    $[42] = t14;
    $[43] = t16;
    $[44] = t17;
  } else {
    t17 = $[44];
  }
  return t17;
};
const useStyles$3 = createStyles((theme, {
  blocked
}, utils) => ({
  selector: {
    "& .mantine-Select-root, & .mantine-Select-input": {
      borderRadius: "20px",
      width: "170px",
      border: "1px solid #D0D5DD",
      backgroundColor: blocked ? "rgba(194, 57, 57, 0.2)" : "rgba(23, 92, 211, 0.2)",
      [utils.largerThan("xs")]: {
        width: "200px"
      }
    }
  },
  blue: {
    "& .mantine-Select-root, & .mantine-Select-input": {
      color: "#175CD3"
    }
  },
  red: {
    "& .mantine-Select-root, & .mantine-Select-input": {
      color: "#DE3639"
    }
  }
}));
const StatusSelect = (t0) => {
  const $ = compilerRuntimeExports.c(41);
  const {
    label,
    placeholder,
    value,
    form,
    fieldName,
    disabled,
    editUser,
    className,
    description
  } = t0;
  const {
    t: t2
  } = useTranslation();
  const active = value === UserStatusEnum.Active;
  const blocked = value === UserStatusEnum.Ban;
  let t1;
  if ($[0] !== blocked) {
    t1 = {
      blocked
    };
    $[0] = blocked;
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  const {
    classes,
    cx
  } = useStyles$3(t1);
  const {
    saveUpdate
  } = useUpdateInfo();
  const {
    currentId
  } = reactExports.useContext(EditUserInfoContext);
  let t22;
  if ($[2] !== currentId || $[3] !== editUser || $[4] !== fieldName || $[5] !== form || $[6] !== saveUpdate) {
    t22 = async (query) => {
      if (editUser) {
        const userStatus = query ? Number(query) : null;
        if (userStatus !== null) {
          await saveUpdate({
            Type: ProfileUpdateTypeEnum.Status,
            Data: {
              [ProfileSectionEnum.Status]: Number(query),
              Id: currentId
            }
          });
        }
      } else {
        form == null ? void 0 : form.setFieldValue(fieldName, query ? Number(query) : null);
      }
    };
    $[2] = currentId;
    $[3] = editUser;
    $[4] = fieldName;
    $[5] = form;
    $[6] = saveUpdate;
    $[7] = t22;
  } else {
    t22 = $[7];
  }
  const handleChangeStatus = t22;
  let t3;
  if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
    t3 = {
      zIndex: 1400
    };
    $[8] = t3;
  } else {
    t3 = $[8];
  }
  let t4;
  if ($[9] !== t2) {
    t4 = userStatusesOptions(t2);
    $[9] = t2;
    $[10] = t4;
  } else {
    t4 = $[10];
  }
  let t5;
  let t6;
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
    t5 = /* @__PURE__ */ jsxRuntimeExports.jsx(gq, { size: "1rem" });
    t6 = {
      rightSection: {
        pointerEvents: "none"
      }
    };
    $[11] = t5;
    $[12] = t6;
  } else {
    t5 = $[11];
    t6 = $[12];
  }
  let t7;
  if ($[13] !== value) {
    t7 = (value == null ? void 0 : value.toString()) || "";
    $[13] = value;
    $[14] = t7;
  } else {
    t7 = $[14];
  }
  let t8;
  if ($[15] !== fieldName || $[16] !== form) {
    t8 = form == null ? void 0 : form.getInputProps(fieldName).error;
    $[15] = fieldName;
    $[16] = form;
    $[17] = t8;
  } else {
    t8 = $[17];
  }
  let t9;
  if ($[18] !== active || $[19] !== blocked || $[20] !== className || $[21] !== classes.blue || $[22] !== classes.red || $[23] !== classes.selector || $[24] !== cx || $[25] !== editUser) {
    t9 = cx(className, {
      [classes.blue]: active,
      [classes.red]: blocked,
      [classes.selector]: editUser
    });
    $[18] = active;
    $[19] = blocked;
    $[20] = className;
    $[21] = classes.blue;
    $[22] = classes.red;
    $[23] = classes.selector;
    $[24] = cx;
    $[25] = editUser;
    $[26] = t9;
  } else {
    t9 = $[26];
  }
  let t10;
  if ($[27] !== active || $[28] !== editUser) {
    t10 = editUser ? active ? /* @__PURE__ */ jsxRuntimeExports.jsx(iO, { size: "1rem" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Fh, { size: "1rem", color: "#C23939" }) : "";
    $[27] = active;
    $[28] = editUser;
    $[29] = t10;
  } else {
    t10 = $[29];
  }
  let t11;
  if ($[30] !== description || $[31] !== disabled || $[32] !== handleChangeStatus || $[33] !== label || $[34] !== placeholder || $[35] !== t10 || $[36] !== t4 || $[37] !== t7 || $[38] !== t8 || $[39] !== t9) {
    t11 = /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { "data-cy": "statusSelect", comboboxProps: t3, data: t4, required: true, disabled, rightSectionWidth: 30, rightSection: t5, styles: t6, label, value: t7, placeholder, onChange: handleChangeStatus, error: t8, className: t9, description, leftSection: t10 });
    $[30] = description;
    $[31] = disabled;
    $[32] = handleChangeStatus;
    $[33] = label;
    $[34] = placeholder;
    $[35] = t10;
    $[36] = t4;
    $[37] = t7;
    $[38] = t8;
    $[39] = t9;
    $[40] = t11;
  } else {
    t11 = $[40];
  }
  return t11;
};
const useStyles$2 = createStyles((theme) => ({
  gender: {
    "& .mantine-Select-input": {
      borderRadius: "8px",
      border: "1px solid #D0D5DD"
    },
    "& .mantine-Select-label": {
      color: theme.colors.brandGray[0],
      fontSize: "12px",
      fontWeight: 400
    }
  }
}));
const Gender = (t0) => {
  const $ = compilerRuntimeExports.c(36);
  const {
    form,
    fieldName: t1,
    clearable: t2,
    disabled
  } = t0;
  const fieldName = t1 === void 0 ? "Gender" : t1;
  const clearable = t2 === void 0 ? false : t2;
  const {
    t: t3
  } = useTranslation();
  const {
    classes
  } = useStyles$2();
  let t32;
  if ($[0] !== t3) {
    t32 = t3("male");
    $[0] = t3;
    $[1] = t32;
  } else {
    t32 = $[1];
  }
  let t4;
  if ($[2] !== t32) {
    t4 = {
      label: t32,
      value: String(GenderEnum.male)
    };
    $[2] = t32;
    $[3] = t4;
  } else {
    t4 = $[3];
  }
  let t5;
  if ($[4] !== t3) {
    t5 = t3("female");
    $[4] = t3;
    $[5] = t5;
  } else {
    t5 = $[5];
  }
  let t6;
  if ($[6] !== t5) {
    t6 = {
      label: t5,
      value: String(GenderEnum.female)
    };
    $[6] = t5;
    $[7] = t6;
  } else {
    t6 = $[7];
  }
  let t7;
  if ($[8] !== t4 || $[9] !== t6) {
    t7 = [t4, t6];
    $[8] = t4;
    $[9] = t6;
    $[10] = t7;
  } else {
    t7 = $[10];
  }
  const list = t7;
  const [key, setKey] = reactExports.useState(0);
  let t8;
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
    t8 = () => {
      setKey(Math.random());
    };
    $[11] = t8;
  } else {
    t8 = $[11];
  }
  const t9 = form.values[fieldName];
  let t10;
  if ($[12] !== t9) {
    t10 = [t9];
    $[12] = t9;
    $[13] = t10;
  } else {
    t10 = $[13];
  }
  reactExports.useEffect(t8, t10);
  let t11;
  if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
    t11 = {
      withinPortal: true,
      zIndex: 1400
    };
    $[14] = t11;
  } else {
    t11 = $[14];
  }
  const t12 = classes.gender;
  let t13;
  if ($[15] !== t3) {
    t13 = t3("profile.gender");
    $[15] = t3;
    $[16] = t13;
  } else {
    t13 = $[16];
  }
  let t14;
  if ($[17] !== t3) {
    t14 = t3("profile.choose");
    $[17] = t3;
    $[18] = t14;
  } else {
    t14 = $[18];
  }
  let t15;
  if ($[19] !== fieldName || $[20] !== form) {
    t15 = form.getInputProps(fieldName).value === 0 ? null : String(form.getInputProps(fieldName).value);
    $[19] = fieldName;
    $[20] = form;
    $[21] = t15;
  } else {
    t15 = $[21];
  }
  let t16;
  if ($[22] !== fieldName || $[23] !== form) {
    t16 = (query) => {
      form == null ? void 0 : form.setFieldValue(fieldName, Number(query));
    };
    $[22] = fieldName;
    $[23] = form;
    $[24] = t16;
  } else {
    t16 = $[24];
  }
  const t17 = form.errors[fieldName];
  let t18;
  if ($[25] !== classes.gender || $[26] !== clearable || $[27] !== disabled || $[28] !== key || $[29] !== list || $[30] !== t13 || $[31] !== t14 || $[32] !== t15 || $[33] !== t16 || $[34] !== t17) {
    t18 = /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { comboboxProps: t11, "data-cy": "genderSelector", className: t12, clearable, data: list, label: t13, placeholder: t14, disabled, value: t15, onChange: t16, error: t17 }, key);
    $[25] = classes.gender;
    $[26] = clearable;
    $[27] = disabled;
    $[28] = key;
    $[29] = list;
    $[30] = t13;
    $[31] = t14;
    $[32] = t15;
    $[33] = t16;
    $[34] = t17;
    $[35] = t18;
  } else {
    t18 = $[35];
  }
  return t18;
};
const useStyles$1 = createStyles((theme) => ({
  address: {
    "& .mantine-TextInput-input": {
      borderRadius: "8px",
      border: "1px solid #D0D5DD"
    },
    "& .mantine-TextInput-label": {
      color: theme.colors.brandGray[0],
      fontSize: "12px",
      fontWeight: 400
    }
  }
}));
const Address = (t0) => {
  const $ = compilerRuntimeExports.c(17);
  const {
    form,
    fieldName,
    label,
    disabled,
    placeholder
  } = t0;
  const {
    classes
  } = useStyles$1();
  let t1;
  if ($[0] !== fieldName || $[1] !== form) {
    t1 = (form == null ? void 0 : form.getInputProps(fieldName).value) || "";
    $[0] = fieldName;
    $[1] = form;
    $[2] = t1;
  } else {
    t1 = $[2];
  }
  let t2;
  if ($[3] !== fieldName || $[4] !== form) {
    t2 = (event) => form == null ? void 0 : form.setFieldValue(fieldName, event.target.value);
    $[3] = fieldName;
    $[4] = form;
    $[5] = t2;
  } else {
    t2 = $[5];
  }
  let t3;
  if ($[6] !== fieldName || $[7] !== form) {
    t3 = form == null ? void 0 : form.getInputProps(fieldName).error;
    $[6] = fieldName;
    $[7] = form;
    $[8] = t3;
  } else {
    t3 = $[8];
  }
  let t4;
  if ($[9] !== classes.address || $[10] !== disabled || $[11] !== label || $[12] !== placeholder || $[13] !== t1 || $[14] !== t2 || $[15] !== t3) {
    t4 = /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { "data-cy": "addressInput", className: classes.address, label, placeholder, value: t1, onChange: t2, disabled, error: t3 });
    $[9] = classes.address;
    $[10] = disabled;
    $[11] = label;
    $[12] = placeholder;
    $[13] = t1;
    $[14] = t2;
    $[15] = t3;
    $[16] = t4;
  } else {
    t4 = $[16];
  }
  return t4;
};
const useStyles = createStyles((theme) => ({
  wrapper: {
    "& .mantine-TextInput-label, .mantine-InputWrapper-label": {
      color: theme.colors.brandGray[0],
      fontSize: "12px",
      fontWeight: 400
    },
    "& .mantine-Input-input": {
      borderRadius: "8px",
      border: "1px solid #D0D5DD"
    }
  }
}));
function e$2(e3, t2) {
  (null == t2 || t2 > e3.length) && (t2 = e3.length);
  for (var r2 = 0, n2 = Array(t2); r2 < t2; r2++) n2[r2] = e3[r2];
  return n2;
}
function t$1(e3, t2, r2) {
  return t2 = i$1(t2), function(e4, t3) {
    if (t3 && ("object" == typeof t3 || "function" == typeof t3)) return t3;
    if (void 0 !== t3) throw new TypeError("Derived constructors may only return object or undefined");
    return function(e5) {
      if (void 0 === e5) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      return e5;
    }(e4);
  }(e3, l$2() ? Reflect.construct(t2, r2 || [], i$1(e3).constructor) : t2.apply(e3, r2));
}
function r$3(e3, t2) {
  if (!(e3 instanceof t2)) throw new TypeError("Cannot call a class as a function");
}
function n$3(e3, t2, r2) {
  return Object.defineProperty(e3, "prototype", { writable: false }), e3;
}
function o$1(t2, r2) {
  var n2 = "undefined" != typeof Symbol && t2[Symbol.iterator] || t2["@@iterator"];
  if (!n2) {
    if (Array.isArray(t2) || (n2 = function(t3, r3) {
      if (t3) {
        if ("string" == typeof t3) return e$2(t3, r3);
        var n3 = {}.toString.call(t3).slice(8, -1);
        return "Object" === n3 && t3.constructor && (n3 = t3.constructor.name), "Map" === n3 || "Set" === n3 ? Array.from(t3) : "Arguments" === n3 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3) ? e$2(t3, r3) : void 0;
      }
    }(t2)) || r2) {
      n2 && (t2 = n2);
      var o2 = 0, a2 = function() {
      };
      return { s: a2, n: function() {
        return o2 >= t2.length ? { done: true } : { done: false, value: t2[o2++] };
      }, e: function(e3) {
        throw e3;
      }, f: a2 };
    }
    throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }
  var c2, i2 = true, u2 = false;
  return { s: function() {
    n2 = n2.call(t2);
  }, n: function() {
    var e3 = n2.next();
    return i2 = e3.done, e3;
  }, e: function(e3) {
    u2 = true, c2 = e3;
  }, f: function() {
    try {
      i2 || null == n2.return || n2.return();
    } finally {
      if (u2) throw c2;
    }
  } };
}
function a$2(e3, t2, r2) {
  return (t2 = function(e4) {
    var t3 = function(e5, t4) {
      if ("object" != typeof e5 || !e5) return e5;
      var r3 = e5[Symbol.toPrimitive];
      if (void 0 !== r3) {
        var n2 = r3.call(e5, t4);
        if ("object" != typeof n2) return n2;
        throw new TypeError("@@toPrimitive must return a primitive value.");
      }
      return ("string" === t4 ? String : Number)(e5);
    }(e4, "string");
    return "symbol" == typeof t3 ? t3 : t3 + "";
  }(t2)) in e3 ? Object.defineProperty(e3, t2, { value: r2, enumerable: true, configurable: true, writable: true }) : e3[t2] = r2, e3;
}
function c$2() {
  return c$2 = Object.assign ? Object.assign.bind() : function(e3) {
    for (var t2 = 1; t2 < arguments.length; t2++) {
      var r2 = arguments[t2];
      for (var n2 in r2) ({}).hasOwnProperty.call(r2, n2) && (e3[n2] = r2[n2]);
    }
    return e3;
  }, c$2.apply(null, arguments);
}
function i$1(e3) {
  return i$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e4) {
    return e4.__proto__ || Object.getPrototypeOf(e4);
  }, i$1(e3);
}
function u$1(e3, t2) {
  if ("function" != typeof t2 && null !== t2) throw new TypeError("Super expression must either be null or a function");
  e3.prototype = Object.create(t2 && t2.prototype, { constructor: { value: e3, writable: true, configurable: true } }), Object.defineProperty(e3, "prototype", { writable: false }), t2 && y$2(e3, t2);
}
function l$2() {
  try {
    var e3 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (e4) {
  }
  return (l$2 = function() {
    return !!e3;
  })();
}
function f$1(e3, t2) {
  var r2 = Object.keys(e3);
  if (Object.getOwnPropertySymbols) {
    var n2 = Object.getOwnPropertySymbols(e3);
    t2 && (n2 = n2.filter(function(t3) {
      return Object.getOwnPropertyDescriptor(e3, t3).enumerable;
    })), r2.push.apply(r2, n2);
  }
  return r2;
}
function s$2(e3) {
  for (var t2 = 1; t2 < arguments.length; t2++) {
    var r2 = null != arguments[t2] ? arguments[t2] : {};
    t2 % 2 ? f$1(Object(r2), true).forEach(function(t3) {
      a$2(e3, t3, r2[t3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e3, Object.getOwnPropertyDescriptors(r2)) : f$1(Object(r2)).forEach(function(t3) {
      Object.defineProperty(e3, t3, Object.getOwnPropertyDescriptor(r2, t3));
    });
  }
  return e3;
}
function p$2(e3, t2) {
  if (null == e3) return {};
  var r2, n2, o2 = function(e4, t3) {
    if (null == e4) return {};
    var r3 = {};
    for (var n3 in e4) if ({}.hasOwnProperty.call(e4, n3)) {
      if (t3.includes(n3)) continue;
      r3[n3] = e4[n3];
    }
    return r3;
  }(e3, t2);
  if (Object.getOwnPropertySymbols) {
    var a2 = Object.getOwnPropertySymbols(e3);
    for (n2 = 0; n2 < a2.length; n2++) r2 = a2[n2], t2.includes(r2) || {}.propertyIsEnumerable.call(e3, r2) && (o2[r2] = e3[r2]);
  }
  return o2;
}
function y$2(e3, t2) {
  return y$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e4, t3) {
    return e4.__proto__ = t3, e4;
  }, y$2(e3, t2);
}
function b$1(e3, t2) {
  var r2, n2 = t2.replacementChars, a2 = t2.replacement, c2 = t2.separate, i2 = n2, u2 = "", l2 = o$1(e3);
  try {
    for (l2.s(); !(r2 = l2.n()).done; ) {
      var f2, s2 = r2.value, p2 = !Object.prototype.hasOwnProperty.call(a2, s2) && (null === (f2 = a2[i2[0]]) || void 0 === f2 ? void 0 : f2.test(s2));
      (c2 && s2 === i2[0] || p2) && (i2 = i2.slice(1), u2 += s2);
    }
  } catch (e4) {
    l2.e(e4);
  } finally {
    l2.f();
  }
  return u2;
}
function v(e3, t2) {
  var r2, n2 = t2.mask, a2 = t2.replacement, c2 = t2.separate, i2 = t2.showMask, u2 = 0, l2 = "", f2 = o$1(n2);
  try {
    for (f2.s(); !(r2 = f2.n()).done; ) {
      var s2 = r2.value;
      if (!i2 && void 0 === e3[u2]) break;
      Object.prototype.hasOwnProperty.call(a2, s2) && void 0 !== e3[u2] ? l2 += e3[u2++] : l2 += s2;
    }
  } catch (e4) {
    f2.e(e4);
  } finally {
    f2.f();
  }
  if (c2 && !i2) {
    for (var p2 = n2.length - 1; p2 >= 0 && l2[p2] === n2[p2]; p2--) ;
    l2 = l2.slice(0, p2 + 1);
  }
  return l2;
}
function m(e3, t2) {
  for (var r2 = t2.mask, n2 = t2.replacement, o2 = [], a2 = 0; a2 < r2.length; a2++) {
    var c2, i2 = null !== (c2 = e3[a2]) && void 0 !== c2 ? c2 : r2[a2], u2 = Object.prototype.hasOwnProperty.call(n2, i2) ? "replacement" : void 0 !== e3[a2] && e3[a2] !== r2[a2] ? "input" : "mask";
    o2.push({ type: u2, value: i2, index: a2 });
  }
  return o2;
}
function O(e3) {
  return e3.length > 0 ? a$2({}, e3, /./) : {};
}
function h(e3, t2) {
  for (var r2 = t2.start, n2 = void 0 === r2 ? 0 : r2, o2 = t2.end, a2 = t2.mask, c2 = t2.replacement, i2 = t2.separate, u2 = e3.slice(n2, o2), l2 = a2.slice(n2, o2), f2 = "", s2 = 0; s2 < l2.length; s2++) {
    var p2 = Object.prototype.hasOwnProperty.call(c2, l2[s2]);
    p2 && void 0 !== u2[s2] && u2[s2] !== l2[s2] ? f2 += u2[s2] : p2 && i2 && (f2 += l2[s2]);
  }
  return f2;
}
function d(e3, t2) {
  var r2 = t2.mask, n2 = t2.replacement, o2 = "string" == typeof n2 ? O(n2) : n2, a2 = RegExp("[^".concat(Object.keys(o2).join(""), "]"), "g");
  return v(b$1(e3, { replacementChars: r2.replace(a2, ""), replacement: o2, separate: false }), { mask: r2, replacement: o2, separate: false, showMask: false });
}
function g$1(e3, t2) {
  var r2 = t2.mask, n2 = t2.replacement, o2 = "string" == typeof n2 ? O(n2) : n2, a2 = h(e3, { mask: r2, replacement: o2, separate: false }), c2 = RegExp("[^".concat(Object.keys(o2).join(""), "]"), "g");
  return b$1(a2, { replacementChars: r2.replace(c2, ""), replacement: o2, separate: false });
}
function j(e3, t2) {
  var r2 = t2.mask, n2 = t2.replacement, o2 = "string" == typeof n2 ? O(n2) : n2;
  return m(d(e3, { mask: r2, replacement: o2 }), { mask: r2, replacement: o2 });
}
var w$1 = ["[", "]", "\\", "/", "^", "$", ".", "|", "?", "*", "+", "(", ")", "{", "}"];
function P(e3) {
  return w$1.includes(e3) ? "\\".concat(e3) : e3;
}
function k(e3, t2) {
  for (var r2 = t2.mask, n2 = t2.replacement, o2 = "string" == typeof n2 ? O(n2) : n2, a2 = "partial" === e3 || "partial-inexact" === e3, c2 = "full" === e3 || "partial" === e3, i2 = "", u2 = 0; u2 < r2.length; u2++) {
    var l2 = r2[u2];
    0 === u2 && (i2 = "^"), a2 && (i2 += "("), i2 += Object.prototype.hasOwnProperty.call(o2, l2) ? "".concat(c2 ? "(?!".concat(P(l2), ")") : "", "(").concat(o2[l2].source, ")") : P(l2), u2 === r2.length - 1 && (a2 && (i2 += ")?".repeat(r2.length)), i2 += "$");
  }
  return i2;
}
function r$2(r2, e3) {
  return new Proxy(r2, { set: function(n2, t2, u2) {
    return "current" === t2 && (u2 !== r2.current && (null !== r2.current && e3.unregister(r2.current), null !== u2 && e3.register(u2)), n2[t2] = u2, true);
  } });
}
function t(t2, e3, r2) {
  return e3 = o(e3), function(t3, e4) {
    if (e4 && ("object" == typeof e4 || "function" == typeof e4)) return e4;
    if (void 0 !== e4) throw new TypeError("Derived constructors may only return object or undefined");
    return function(t4) {
      if (void 0 === t4) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      return t4;
    }(t3);
  }(t2, i() ? Reflect.construct(e3, r2 || [], o(t2).constructor) : e3.apply(t2, r2));
}
function e$1(t2, e3) {
  if (!(t2 instanceof e3)) throw new TypeError("Cannot call a class as a function");
}
function r$1(t2, e3, r2) {
  return Object.defineProperty(t2, "prototype", { writable: false }), t2;
}
function n$2(t2, e3, r2) {
  return (e3 = function(t3) {
    var e4 = function(t4, e5) {
      if ("object" != typeof t4 || !t4) return t4;
      var r3 = t4[Symbol.toPrimitive];
      if (void 0 !== r3) {
        var n2 = r3.call(t4, e5);
        if ("object" != typeof n2) return n2;
        throw new TypeError("@@toPrimitive must return a primitive value.");
      }
      return ("string" === e5 ? String : Number)(t4);
    }(t3, "string");
    return "symbol" == typeof e4 ? e4 : e4 + "";
  }(e3)) in t2 ? Object.defineProperty(t2, e3, { value: r2, enumerable: true, configurable: true, writable: true }) : t2[e3] = r2, t2;
}
function o(t2) {
  return o = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
    return t3.__proto__ || Object.getPrototypeOf(t3);
  }, o(t2);
}
function u(t2, e3) {
  if ("function" != typeof e3 && null !== e3) throw new TypeError("Super expression must either be null or a function");
  t2.prototype = Object.create(e3 && e3.prototype, { constructor: { value: t2, writable: true, configurable: true } }), Object.defineProperty(t2, "prototype", { writable: false }), e3 && a$1(t2, e3);
}
function i() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (i = function() {
    return !!t2;
  })();
}
function c$1(t2, e3) {
  var r2 = Object.keys(t2);
  if (Object.getOwnPropertySymbols) {
    var n2 = Object.getOwnPropertySymbols(t2);
    e3 && (n2 = n2.filter(function(e4) {
      return Object.getOwnPropertyDescriptor(t2, e4).enumerable;
    })), r2.push.apply(r2, n2);
  }
  return r2;
}
function f(t2) {
  for (var e3 = 1; e3 < arguments.length; e3++) {
    var r2 = null != arguments[e3] ? arguments[e3] : {};
    e3 % 2 ? c$1(Object(r2), true).forEach(function(e4) {
      n$2(t2, e4, r2[e4]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t2, Object.getOwnPropertyDescriptors(r2)) : c$1(Object(r2)).forEach(function(e4) {
      Object.defineProperty(t2, e4, Object.getOwnPropertyDescriptor(r2, e4));
    });
  }
  return t2;
}
function p$1(t2, e3) {
  if (null == t2) return {};
  var r2, n2, o2 = function(t3, e4) {
    if (null == t3) return {};
    var r3 = {};
    for (var n3 in t3) if ({}.hasOwnProperty.call(t3, n3)) {
      if (e4.includes(n3)) continue;
      r3[n3] = t3[n3];
    }
    return r3;
  }(t2, e3);
  if (Object.getOwnPropertySymbols) {
    var u2 = Object.getOwnPropertySymbols(t2);
    for (n2 = 0; n2 < u2.length; n2++) r2 = u2[n2], e3.includes(r2) || {}.propertyIsEnumerable.call(t2, r2) && (o2[r2] = t2[r2]);
  }
  return o2;
}
function a$1(t2, e3) {
  return a$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e4) {
    return t3.__proto__ = e4, t3;
  }, a$1(t2, e3);
}
function l$1(t2) {
  return l$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t3) {
    return typeof t3;
  } : function(t3) {
    return t3 && "function" == typeof Symbol && t3.constructor === Symbol && t3 !== Symbol.prototype ? "symbol" : typeof t3;
  }, l$1(t2);
}
function y$1(t2) {
  var e3 = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
  return y$1 = function(t3) {
    if (null === t3 || !function(t4) {
      try {
        return -1 !== Function.toString.call(t4).indexOf("[native code]");
      } catch (e4) {
        return "function" == typeof t4;
      }
    }(t3)) return t3;
    if ("function" != typeof t3) throw new TypeError("Super expression must either be null or a function");
    if (void 0 !== e3) {
      if (e3.has(t3)) return e3.get(t3);
      e3.set(t3, r2);
    }
    function r2() {
      return function(t4, e4, r3) {
        if (i()) return Reflect.construct.apply(null, arguments);
        var n2 = [null];
        n2.push.apply(n2, e4);
        var o2 = new (t4.bind.apply(t4, n2))();
        return r3 && a$1(o2, r3.prototype), o2;
      }(t3, arguments, o(this).constructor);
    }
    return r2.prototype = Object.create(t3.prototype, { constructor: { value: r2, enumerable: false, writable: true, configurable: true } }), a$1(r2, t3);
  }, y$1(t2);
}
var n$1 = function(t$12) {
  function n2(r2) {
    var a2;
    return e$1(this, n2), (a2 = t(this, n2, [r2])).name = "SyntheticChangeError", a2;
  }
  return u(n2, t$12), r$1(n2);
}(y$1(Error));
var l, a = ["options"], r = ["text", "email", "tel", "search", "url"], s$1 = r$1(function e2(l2) {
  var s2 = l2.init, c2 = l2.tracking;
  e$1(this, e2);
  var u2 = /* @__PURE__ */ new WeakMap();
  this.register = function(e3) {
    var t2;
    if (r.includes(e3.type)) {
      var l3 = null !== (t2 = e3._wrapperState) && void 0 !== t2 ? t2 : {}, d2 = l3.initialValue, v2 = void 0 === d2 ? "" : d2, p2 = l3.controlled, h2 = void 0 !== p2 && p2, f$12 = s2({ initialValue: e3.value || v2, controlled: h2 }), E = f$12.value, g2 = f$12.options, w2 = { value: E, options: g2, fallbackOptions: g2 }, S = { id: -1, cachedId: -1 }, m2 = { value: "", selectionStart: 0, selectionEnd: 0 }, b2 = Object.getOwnPropertyDescriptor("_valueTracker" in e3 ? e3 : HTMLInputElement.prototype, "value");
      Object.defineProperty(e3, "value", f(f({}, b2), {}, { set: function(t3) {
        var n2;
        m2.value = t3, null == b2 || null === (n2 = b2.set) || void 0 === n2 || n2.call(e3, t3);
      } })), e3.value = E;
      var y2 = function() {
        var t3 = function() {
          var n2, o2;
          m2.selectionStart = null !== (n2 = e3.selectionStart) && void 0 !== n2 ? n2 : 0, m2.selectionEnd = null !== (o2 = e3.selectionEnd) && void 0 !== o2 ? o2 : 0, S.id = window.setTimeout(t3);
        };
        S.id = window.setTimeout(t3);
      }, T = function() {
        window.clearTimeout(S.id), S.id = -1, S.cachedId = -1;
      }, k2 = function(t3) {
        try {
          var n2, l4;
          if (S.cachedId === S.id) throw new n$1("The input selection has not been updated.");
          S.cachedId = S.id;
          var r2 = e3.value, s3 = e3.selectionStart, u22 = e3.selectionEnd;
          if (null === s3 || null === u22) throw new n$1("The selection attributes have not been initialized.");
          var d22, v22 = m2.value;
          if (void 0 === t3.inputType && (m2.selectionStart = 0, m2.selectionEnd = v22.length), s3 > m2.selectionStart ? d22 = "insert" : s3 <= m2.selectionStart && s3 < m2.selectionEnd ? d22 = "deleteBackward" : s3 === m2.selectionEnd && r2.length < v22.length && (d22 = "deleteForward"), void 0 === d22 || ("deleteBackward" === d22 || "deleteForward" === d22) && r2.length > v22.length) throw new n$1("Input type detection error.");
          var p22 = "", h22 = m2.selectionStart, f2 = m2.selectionEnd;
          if ("insert" === d22) p22 = r2.slice(m2.selectionStart, s3);
          else {
            var E2 = v22.length - r2.length;
            h22 = s3, f2 = s3 + E2;
          }
          w2.value !== v22 ? w2.options = w2.fallbackOptions : w2.fallbackOptions = w2.options;
          var g22 = w2.options, b22 = c2({ inputType: d22, previousValue: v22, previousOptions: g22, value: r2, addedValue: p22, changeStart: h22, changeEnd: f2, selectionStart: s3, selectionEnd: u22 }), y22 = b22.options, T2 = p$1(b22, a);
          e3.value = T2.value, e3.setSelectionRange(T2.selectionStart, T2.selectionEnd), w2.value = T2.value, w2.options = y22, m2.selectionStart = T2.selectionStart, m2.selectionEnd = T2.selectionEnd, null === (n2 = e3._valueTracker) || void 0 === n2 || null === (l4 = n2.setValue) || void 0 === l4 || l4.call(n2, v22);
        } catch (n3) {
          if (e3.value = m2.value, e3.setSelectionRange(m2.selectionStart, m2.selectionEnd), t3.preventDefault(), t3.stopPropagation(), "SyntheticChangeError" !== n3.name) throw n3;
        }
      };
      document.activeElement === e3 && y2(), e3.addEventListener("focus", y2), e3.addEventListener("blur", T), e3.addEventListener("input", k2), u2.set(e3, { onFocus: y2, onBlur: T, onInput: k2 });
    }
  }, this.unregister = function(e3) {
    var t2 = u2.get(e3);
    void 0 !== t2 && (e3.removeEventListener("focus", t2.onFocus), e3.removeEventListener("blur", t2.onBlur), e3.removeEventListener("input", t2.onInput), u2.delete(e3));
  };
});
l = s$1, Object.defineProperty(l.prototype, Symbol.toStringTag, { writable: false, enumerable: false, configurable: true, value: "Input" });
function e(e3, n2) {
  return reactExports.useCallback(function(t2) {
    e3.current = t2, "function" == typeof n2 ? n2(t2) : "object" === l$1(n2) && null !== n2 && (n2.current = t2);
  }, [e3, n2]);
}
var g, y = ["track", "modify"];
function w(e22) {
  var t2, a2, n2, r2;
  return { mask: null !== (t2 = e22.mask) && void 0 !== t2 ? t2 : "", replacement: "string" == typeof e22.replacement ? O(e22.replacement) : null !== (a2 = e22.replacement) && void 0 !== a2 ? a2 : {}, showMask: null !== (n2 = e22.showMask) && void 0 !== n2 && n2, separate: null !== (r2 = e22.separate) && void 0 !== r2 && r2, track: e22.track, modify: e22.modify };
}
var b = function(g2) {
  function b2() {
    var t2, a2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
    return r$3(this, b2), (t2 = t$1(this, b2, [{ init: function(e22) {
      var t3 = e22.initialValue, n2 = e22.controlled, r2 = w(a2), i2 = r2.mask, l2 = r2.replacement, o2 = r2.separate, s2 = r2.showMask;
      return t3 = n2 || t3 ? t3 : s2 ? i2 : "", { value: t3, options: { mask: i2, replacement: l2, separate: o2 } };
    }, tracking: function(t3) {
      var n2 = t3.inputType, r2 = t3.previousValue, i2 = t3.previousOptions, l2 = t3.addedValue, o2 = t3.changeStart, s2 = t3.changeEnd, m2 = w(a2), k2 = m2.track, g3 = m2.modify, b3 = p$2(m2, y), O$1 = b3.mask, j2 = b3.replacement, T = b3.showMask, V = b3.separate, M = s$2(s$2({}, "insert" === n2 ? { inputType: n2, data: l2 } : { inputType: n2, data: null }), {}, { value: r2, selectionStart: o2, selectionEnd: s2 }), z = null == k2 ? void 0 : k2(M);
      if (false === z) throw new n$1("Custom tracking stop.");
      null === z ? l2 = "" : true !== z && void 0 !== z && (l2 = z);
      var C = null == g3 ? void 0 : g3(M);
      void 0 !== (null == C ? void 0 : C.mask) && (O$1 = C.mask), void 0 !== (null == C ? void 0 : C.replacement) && (j2 = "string" == typeof (null == C ? void 0 : C.replacement) ? O(null == C ? void 0 : C.replacement) : C.replacement), void 0 !== (null == C ? void 0 : C.showMask) && (T = C.showMask), void 0 !== (null == C ? void 0 : C.separate) && (V = C.separate);
      var E = h(r2, s$2({ end: o2 }, i2)), x = h(r2, s$2({ start: s2 }, i2)), P2 = RegExp("[^".concat(Object.keys(j2).join(""), "]"), "g"), S = O$1.replace(P2, "");
      if (E && (E = b$1(E, { replacementChars: S, replacement: j2, separate: V }), S = S.slice(E.length)), l2 && (l2 = b$1(l2, { replacementChars: S, replacement: j2, separate: false }), S = S.slice(l2.length)), "insert" === n2 && "" === l2) throw new n$1("The character does not match the key value of the `replacement` object.");
      if (V) {
        var I = O$1.slice(o2, s2).replace(P2, ""), G = I.length - l2.length;
        G < 0 ? x = x.slice(-G) : G > 0 && (x = I.slice(-G) + x);
      }
      x && (x = b$1(x, { replacementChars: S, replacement: j2, separate: V }));
      var A = v(E + l2 + x, { mask: O$1, replacement: j2, separate: V, showMask: T }), N = function(t4) {
        var a3, n3, r3, i3 = t4.inputType, l3 = t4.value, o3 = t4.addedValue, s3 = t4.beforeChangeValue, c2 = t4.mask, u2 = t4.replacement, p2 = t4.separate, d2 = m(l3, { mask: c2, replacement: u2 }).filter(function(e22) {
          var t5 = e22.type;
          return "input" === t5 || p2 && "replacement" === t5;
        }), h2 = null === (a3 = d2[s3.length + o3.length - 1]) || void 0 === a3 ? void 0 : a3.index, v2 = null === (n3 = d2[s3.length - 1]) || void 0 === n3 ? void 0 : n3.index, m3 = null === (r3 = d2[s3.length + o3.length]) || void 0 === r3 ? void 0 : r3.index;
        if ("insert" === i3) {
          if (void 0 !== h2) return h2 + 1;
          if (void 0 !== m3) return m3;
          if (void 0 !== v2) return v2 + 1;
        }
        if ("deleteForward" === i3) {
          if (void 0 !== m3) return m3;
          if (void 0 !== v2) return v2 + 1;
        }
        if ("deleteBackward" === i3) {
          if (void 0 !== v2) return v2 + 1;
          if (void 0 !== m3) return m3;
        }
        var f2 = l3.split("").findIndex(function(e22) {
          return Object.prototype.hasOwnProperty.call(u2, e22);
        });
        return -1 !== f2 ? f2 : l3.length;
      }({ inputType: n2, value: A, addedValue: l2, beforeChangeValue: E, mask: O$1, replacement: j2, separate: V });
      return { value: A, selectionStart: N, selectionEnd: N, options: { mask: O$1, replacement: j2, separate: V } };
    } }])).format = function(e22) {
      return d(e22, w(a2));
    }, t2.formatToParts = function(e22) {
      return j(e22, w(a2));
    }, t2.unformat = function(e22) {
      return g$1(e22, w(a2));
    }, t2.generatePattern = function(e22) {
      return k(e22, w(a2));
    }, t2;
  }
  return u$1(b2, s$1), n$3(b2);
}();
g = b, Object.defineProperty(g.prototype, Symbol.toStringTag, { writable: false, enumerable: false, configurable: true, value: "Mask" });
function n() {
  var n2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, c2 = n2.mask, o2 = n2.replacement, m2 = n2.showMask, s2 = n2.separate, u2 = n2.track, p2 = n2.modify, i2 = reactExports.useRef(null), k2 = reactExports.useRef({ mask: c2, replacement: o2, showMask: m2, separate: s2, track: u2, modify: p2 });
  return k2.current.mask = c2, k2.current.replacement = o2, k2.current.showMask = m2, k2.current.separate = s2, k2.current.track = u2, k2.current.modify = p2, reactExports.useMemo(function() {
    return r$2(i2, new b(k2.current));
  }, []);
}
var s = ["component", "mask", "replacement", "showMask", "separate", "track", "modify"];
function p(t2, p2) {
  var c2 = t2.component, n$12 = t2.mask, f2 = t2.replacement, i2 = t2.showMask, k2 = t2.separate, l2 = t2.track, u2 = t2.modify, d2 = p$2(t2, s), h2 = n({ mask: n$12, replacement: f2, showMask: i2, separate: k2, track: l2, modify: u2 }), M = e(h2, p2);
  return c2 ? r$4.createElement(c2, c$2({ ref: M }, d2)) : r$4.createElement("input", c$2({ ref: M }, d2));
}
var c = reactExports.forwardRef(p);
const ValidatePhoneInput = (t0) => {
  const $ = compilerRuntimeExports.c(58);
  const {
    label,
    mask,
    className,
    form,
    fieldName,
    disabled
  } = t0;
  const {
    t: t2
  } = useTranslation();
  const {
    classes,
    cx
  } = useStyles();
  const fieldPhoneId = reactExports.useId() || "";
  const {
    userInfoCommon
  } = reactExports.useContext(EditUserInfoContext);
  const [checkFieldExist, t1] = useLazyCheckUserExistFieldQuery();
  const {
    isFetching: isFetchingValidate
  } = t1;
  let t22;
  if ($[0] !== fieldName || $[1] !== form) {
    let t32;
    if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
      t32 = /\D/g;
      $[3] = t32;
    } else {
      t32 = $[3];
    }
    t22 = form.getInputProps(fieldName).value.replace(t32, "");
    $[0] = fieldName;
    $[1] = form;
    $[2] = t22;
  } else {
    t22 = $[2];
  }
  const checkPhoneValues = (userInfoCommon == null ? void 0 : userInfoCommon.Common.Phone) == t22;
  let t3;
  if ($[4] !== checkFieldExist || $[5] !== checkPhoneValues || $[6] !== fieldName || $[7] !== form || $[8] !== t2) {
    t3 = async (field) => {
      var _a;
      if ((field == null ? void 0 : field.length) && !form.getInputProps(fieldName).error && form.isDirty(fieldName) && !checkPhoneValues) {
        const fieldNameEnum = getNameFromDottedString(fieldName);
        const response = await checkFieldExist({
          existField: fieldNameEnum,
          field
        });
        if ((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.ExistsUser) {
          form.setFieldError(fieldName, t2("requestsErrors.userExistsByPhone"));
        }
      }
    };
    $[4] = checkFieldExist;
    $[5] = checkPhoneValues;
    $[6] = fieldName;
    $[7] = form;
    $[8] = t2;
    $[9] = t3;
  } else {
    t3 = $[9];
  }
  const handleValidateField = t3;
  let t4;
  if ($[10] !== isFetchingValidate) {
    t4 = () => {
      if (isFetchingValidate) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { size: "xs" });
      }
    };
    $[10] = isFetchingValidate;
    $[11] = t4;
  } else {
    t4 = $[11];
  }
  const rightSectionRender = t4;
  let t5;
  if ($[12] !== fieldName || $[13] !== form || $[14] !== handleValidateField) {
    t5 = () => {
      if (form.isValid(fieldName)) {
        handleValidateField(form.getInputProps(fieldName).value);
      }
    };
    $[12] = fieldName;
    $[13] = form;
    $[14] = handleValidateField;
    $[15] = t5;
  } else {
    t5 = $[15];
  }
  let t6;
  if ($[16] !== fieldName || $[17] !== form) {
    t6 = form.getInputProps(fieldName);
    $[16] = fieldName;
    $[17] = form;
    $[18] = t6;
  } else {
    t6 = $[18];
  }
  let t7;
  if ($[19] !== t6.error) {
    t7 = [t6.error];
    $[19] = t6.error;
    $[20] = t7;
  } else {
    t7 = $[20];
  }
  reactExports.useEffect(t5, t7);
  let t8;
  if ($[21] !== fieldName || $[22] !== form) {
    t8 = form.getInputProps(fieldName);
    $[21] = fieldName;
    $[22] = form;
    $[23] = t8;
  } else {
    t8 = $[23];
  }
  const t9 = t8.error;
  let t10;
  if ($[24] !== className || $[25] !== classes.wrapper || $[26] !== cx) {
    t10 = cx(classes.wrapper, className);
    $[24] = className;
    $[25] = classes.wrapper;
    $[26] = cx;
    $[27] = t10;
  } else {
    t10 = $[27];
  }
  let t11;
  if ($[28] !== fieldName || $[29] !== form) {
    t11 = form.getInputProps(fieldName);
    $[28] = fieldName;
    $[29] = form;
    $[30] = t11;
  } else {
    t11 = $[30];
  }
  let t12;
  if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
    t12 = {
      _: /\d/
    };
    $[31] = t12;
  } else {
    t12 = $[31];
  }
  let t13;
  if ($[32] !== rightSectionRender) {
    t13 = rightSectionRender();
    $[32] = rightSectionRender;
    $[33] = t13;
  } else {
    t13 = $[33];
  }
  let t14;
  if ($[34] !== fieldName || $[35] !== form) {
    t14 = form.getInputProps(fieldName);
    $[34] = fieldName;
    $[35] = form;
    $[36] = t14;
  } else {
    t14 = $[36];
  }
  const t15 = t14.error;
  let t16;
  if ($[37] !== fieldName || $[38] !== form) {
    t16 = form.getInputProps(fieldName).value || "";
    $[37] = fieldName;
    $[38] = form;
    $[39] = t16;
  } else {
    t16 = $[39];
  }
  let t17;
  if ($[40] !== fieldName || $[41] !== form) {
    t17 = form.getInputProps(fieldName);
    $[40] = fieldName;
    $[41] = form;
    $[42] = t17;
  } else {
    t17 = $[42];
  }
  let t18;
  if ($[43] !== disabled || $[44] !== fieldPhoneId || $[45] !== mask || $[46] !== t11 || $[47] !== t13 || $[48] !== t14.error || $[49] !== t16 || $[50] !== t17.onChange) {
    t18 = /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { ...t11, "data-cy": "phoneInput", id: fieldPhoneId, component: c, mask, replacement: t12, rightSection: t13, error: t15, value: t16, onChange: t17.onChange, disabled });
    $[43] = disabled;
    $[44] = fieldPhoneId;
    $[45] = mask;
    $[46] = t11;
    $[47] = t13;
    $[48] = t14.error;
    $[49] = t16;
    $[50] = t17.onChange;
    $[51] = t18;
  } else {
    t18 = $[51];
  }
  let t19;
  if ($[52] !== fieldPhoneId || $[53] !== label || $[54] !== t10 || $[55] !== t18 || $[56] !== t8.error) {
    t19 = /* @__PURE__ */ jsxRuntimeExports.jsx(Input.Wrapper, { id: fieldPhoneId, error: t9, className: t10, label, children: t18 });
    $[52] = fieldPhoneId;
    $[53] = label;
    $[54] = t10;
    $[55] = t18;
    $[56] = t8.error;
    $[57] = t19;
  } else {
    t19 = $[57];
  }
  return t19;
};
const Phone = (t0) => {
  const $ = compilerRuntimeExports.c(20);
  const {
    form,
    fieldName,
    label,
    mask,
    className,
    inputProps,
    disabled
  } = t0;
  const {
    classes,
    cx
  } = useStyles();
  const fieldPhoneId = reactExports.useId();
  let t1;
  if ($[0] !== fieldName || $[1] !== form) {
    t1 = form.getInputProps(fieldName);
    $[0] = fieldName;
    $[1] = form;
    $[2] = t1;
  } else {
    t1 = $[2];
  }
  const t2 = t1.error;
  let t3;
  if ($[3] !== className || $[4] !== classes.wrapper || $[5] !== cx) {
    t3 = cx(classes.wrapper, className);
    $[3] = className;
    $[4] = classes.wrapper;
    $[5] = cx;
    $[6] = t3;
  } else {
    t3 = $[6];
  }
  let t4;
  if ($[7] !== disabled || $[8] !== fieldName || $[9] !== fieldPhoneId || $[10] !== form || $[11] !== inputProps || $[12] !== mask) {
    t4 = mask ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { id: fieldPhoneId, component: c, mask, ...inputProps, value: form.getInputProps(fieldName).value || "", error: form.getInputProps(fieldName).error, "data-name": fieldName }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { "data-cy": "additionalPhone", id: fieldPhoneId, ...inputProps, value: form.getInputProps(fieldName).value || "", error: form.getInputProps(fieldName).error, "data-name": fieldName, disabled });
    $[7] = disabled;
    $[8] = fieldName;
    $[9] = fieldPhoneId;
    $[10] = form;
    $[11] = inputProps;
    $[12] = mask;
    $[13] = t4;
  } else {
    t4 = $[13];
  }
  let t5;
  if ($[14] !== fieldPhoneId || $[15] !== label || $[16] !== t1.error || $[17] !== t3 || $[18] !== t4) {
    t5 = /* @__PURE__ */ jsxRuntimeExports.jsx(Input.Wrapper, { id: fieldPhoneId, error: t2, className: t3, label, children: t4 });
    $[14] = fieldPhoneId;
    $[15] = label;
    $[16] = t1.error;
    $[17] = t3;
    $[18] = t4;
    $[19] = t5;
  } else {
    t5 = $[19];
  }
  return t5;
};
export {
  AvatarEditor as A,
  Gender as G,
  Phone as P,
  StatusSelect as S,
  ValidatePhoneInput as V,
  Address as a
};
//# sourceMappingURL=index-B9yUPW9X.js.map
