"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const ReactPhoneInput2 = require("react-phone-input-2");
;/* empty css                                                                                                                                                                                        */
;/* empty css                                                                                                                                                                                         */
;/* empty css                                                                                                                                                                                                 */
;/* empty css                                                                                                                                                                                            */
;/* empty css                                                                                                                                                                                            */
require("clsx");
const styles$1 = require("../../utils/styles.cjs");
const styles = require("./styles.cjs");
const useInputProps = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Input/use-input-props.cjs");
const MantineThemeProvider = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/MantineProvider/MantineThemeProvider/MantineThemeProvider.cjs");
const Box = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.cjs");
const Input = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Input/Input.cjs");
const ReactPhoneInput = ReactPhoneInput2.default ? ReactPhoneInput2.default : ReactPhoneInput2;
const PhoneInput = (props) => {
  const { wrapperProps } = useInputProps.useInputProps("TextInput", {}, props);
  const { classes, cx } = styles.useStyles({ hasError: !!wrapperProps.error });
  const {
    value,
    placeholder = "",
    inputClass,
    buttonClass,
    containerClass,
    dropdownClass,
    searchClass,
    showContryCodeAfterFocus,
    country = "",
    onFocus,
    // Box props,
    rootProps: boxProps,
    ...rest
  } = props;
  const [isPhoneInputFocus, setIsPhoneInputFocus] = React.useState(false);
  const theme = MantineThemeProvider.useMantineTheme();
  return /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { ...boxProps, children: /* @__PURE__ */ jsxRuntime.jsx(
    Input.Input.Wrapper,
    {
      ...wrapperProps,
      styles: styles$1.mergeStylesList([
        wrapperProps.styles,
        {
          label: { color: theme.colors.carbon[8], marginBottom: 6, fontSize: 14, lineHeight: "20px" },
          description: { color: theme.colors.carbon[6] }
        }
      ]),
      children: /* @__PURE__ */ jsxRuntime.jsx(
        ReactPhoneInput,
        {
          value,
          inputClass: cx(inputClass),
          buttonClass: cx(classes.dropdownButton, buttonClass),
          containerClass: cx(classes.container, containerClass),
          disableDropdown: true,
          dropdownClass: cx(dropdownClass),
          searchClass: cx(searchClass),
          placeholder,
          specialLabel: "",
          country: showContryCodeAfterFocus && isPhoneInputFocus ? country.toLowerCase() : void 0,
          onFocus: (e, data) => {
            setIsPhoneInputFocus(true);
            onFocus == null ? void 0 : onFocus(e, data);
          },
          masks: { cn: "..........." },
          ...rest
        }
      )
    }
  ) });
};
exports.PhoneInput = PhoneInput;
