var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/virtual-keyboard/index.tsx
var virtual_keyboard_exports = {};
__export(virtual_keyboard_exports, {
  default: () => virtual_keyboard_default
});
module.exports = __toCommonJS(virtual_keyboard_exports);
var import_react = __toESM(require("react"));
var import_Keyboard = __toESM(require("./Keyboard"));
var import_VirtualKeyInput = __toESM(require("./VirtualKeyInput"));
var import_index = require("./index.less");
var import_classnames = __toESM(require("classnames"));
var import_utils = require("@pisell/utils");
var import_usePisellConfig = __toESM(require("../pisell-config-provider/hooks/usePisellConfig"));
var items = [
  {
    value: 1,
    label: "1",
    disabled: false,
    type: "text"
  },
  {
    value: 2,
    label: "2",
    disabled: false,
    type: "text"
  },
  {
    value: 3,
    label: "3",
    disabled: false,
    type: "text"
  },
  {
    value: 4,
    label: "4",
    disabled: false,
    type: "text"
  },
  {
    value: 5,
    label: "5",
    disabled: false,
    type: "text"
  },
  {
    value: 6,
    label: "6",
    disabled: false,
    type: "text"
  },
  {
    value: 7,
    label: "7",
    disabled: false,
    type: "text"
  },
  {
    value: 8,
    label: "8",
    disabled: false,
    type: "text"
  },
  {
    value: 9,
    label: "9",
    disabled: false,
    type: "text"
  },
  {
    value: "0",
    label: "0",
    disabled: false,
    type: "text"
  },
  {
    value: "ok",
    label: "OK",
    disabled: false,
    type: "primary"
  }
];
var virtualKeyboardThemeConfig = {
  dark: {
    backgroundColor: "rgba(0, 0, 0, 0.70)",
    containerBackgroundColor: "rgba(0, 0, 0, 0.40)",
    buttonBackgroundColor: "#ffffff",
    textColor: "#000000",
    keyboardBackgroundColor: "rgba(0, 0, 0, 0.40)",
    keyboardButtonBackgroundColor: "#ffffff",
    keyboardButtonTextColor: "#000000",
    keyboardButtonHoverColor: "#f5f5f5",
    primaryButtonBackgroundColor: "#4ca30d",
    primaryButtonTextColor: "#ffffff"
  },
  light: {
    backgroundColor: "#ffffff",
    containerBackgroundColor: "#d0d5dd",
    buttonBackgroundColor: "#ffffff",
    textColor: "#000000",
    keyboardBackgroundColor: "#f9f9f9",
    keyboardButtonBackgroundColor: "#ffffff",
    keyboardButtonTextColor: "#000000",
    keyboardButtonHoverColor: "#f5f5f5",
    primaryButtonBackgroundColor: "#4ca30d",
    primaryButtonTextColor: "#ffffff"
  }
};
var VirtualKeyboard = (props) => {
  const {
    virtualKeyInputProps,
    style,
    className,
    keyboardProps,
    onChange,
    value,
    rightPanel,
    selectType = "light",
    ...others
  } = props;
  const config = (0, import_usePisellConfig.default)();
  (0, import_react.useEffect)(() => {
    document.body.id = "body";
  }, []);
  const configColor = (0, import_react.useMemo)(() => {
    const currentConfig = virtualKeyboardThemeConfig[selectType];
    const validProps = Object.entries(props).reduce((acc, [key, value2]) => {
      if (value2 !== void 0 && key in currentConfig) {
        acc[key] = value2;
      }
      return acc;
    }, {});
    return { ...currentConfig, ...validProps };
  }, [selectType, props]);
  (0, import_react.useEffect)(() => {
    (0, import_utils.setTheme)({
      "--virtual-keyboard-background-color": configColor.backgroundColor,
      "--virtual-keyboard-container-background-color": configColor.containerBackgroundColor,
      "--virtual-keyboard-button-background-color": configColor.buttonBackgroundColor,
      "--virtual-keyboard-text-color": configColor.textColor,
      "--virtual-keyboard-keyboard-background-color": configColor.keyboardBackgroundColor,
      "--virtual-keyboard-keyboard-button-background-color": configColor.keyboardButtonBackgroundColor,
      "--virtual-keyboard-keyboard-button-text-color": configColor.keyboardButtonTextColor,
      "--virtual-keyboard-keyboard-button-hover-color": configColor.keyboardButtonHoverColor,
      "--virtual-keyboard-primary-button-background-color": configColor.primaryButtonBackgroundColor,
      "--virtual-keyboard-primary-button-text-color": configColor.primaryButtonTextColor
    });
  }, [configColor]);
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)("virtual-keyboard-component", className, {
        "virtual-keyboard-component-dark": selectType === "dark",
        "virtual-keyboard-component-light": selectType === "light"
      }),
      style
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("virtual-keyboard-component-left") }, /* @__PURE__ */ import_react.default.createElement(import_VirtualKeyInput.default, { ...virtualKeyInputProps }), /* @__PURE__ */ import_react.default.createElement(import_Keyboard.default, { items, ...keyboardProps })),
    rightPanel ? /* @__PURE__ */ import_react.default.createElement("div", { className: "virtual-keyboard-component-right" }, rightPanel) : null
  );
};
var virtual_keyboard_default = VirtualKeyboard;
