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/pisellInput/components/Copy/index.tsx
var Copy_exports = {};
__export(Copy_exports, {
  default: () => Copy_default
});
module.exports = __toCommonJS(Copy_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_utils = require("@pisell/utils");
var import_input = __toESM(require("../../../input"));
var import_icon = __toESM(require("../../../icon"));
var import_locales = require("../../../../locales");
var Copy = (props) => {
  const { buttonProps } = props;
  const inputRef = (0, import_react.useRef)(null);
  const handleCopyClick = async (e) => {
    var _a, _b, _c;
    (_a = buttonProps == null ? void 0 : buttonProps.onClick) == null ? void 0 : _a.call(buttonProps, e);
    await (0, import_utils.copyToClipboard)(((_c = (_b = inputRef.current) == null ? void 0 : _b.input) == null ? void 0 : _c.value) || "");
    import_antd.message.success((0, import_locales.getText)("pisell-input-copy-success"));
  };
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { block: true }, /* @__PURE__ */ import_react.default.createElement(import_input.default, { ...props, ref: inputRef, disabled: props.disabled ?? true, size: "large" }), /* @__PURE__ */ import_react.default.createElement(
    import_antd.Button,
    {
      size: "large",
      icon: /* @__PURE__ */ import_react.default.createElement(import_icon.default, { type: "pisell2-copy-03" }),
      ...buttonProps,
      onClick: handleCopyClick,
      children: (buttonProps == null ? void 0 : buttonProps.children) || (0, import_locales.getText)("pisell-input-copy")
    }
  ));
};
var Copy_default = Copy;
