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/pisellLookup/components/LookupResultHost.tsx
var LookupResultHost_exports = {};
__export(LookupResultHost_exports, {
  LookupResultHost: () => LookupResultHost
});
module.exports = __toCommonJS(LookupResultHost_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_icons = require("@ant-design/icons");
var import_locales = require("../../../locales");
var LookupResultHost = (props) => {
  const {
    displayType,
    visible,
    onClose,
    children,
    modalWidth = 834,
    modalStyle,
    getContainer,
    drawerWidth = 378,
    drawerPlacement = "right",
    popupWidth,
    containerStyle,
    containerClassName,
    mask = false,
    maskClosable = true,
    zIndex,
    onAfterOpen
  } = props;
  const renderInline = () => {
    if (!visible) return null;
    if (!children) return null;
    return /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `pisell-lookup-result-inline ${containerClassName || ""}`,
        style: containerStyle
      },
      children
    );
  };
  const renderPopup = () => {
    if (!visible || !children) return null;
    return /* @__PURE__ */ import_react.default.createElement(
      import_antd.Dropdown,
      {
        open: visible,
        onOpenChange: (open) => {
          if (!open) onClose();
        },
        dropdownRender: () => /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `pisell-lookup-result-popup ${containerClassName || ""}`,
            style: {
              width: popupWidth,
              background: "#fff",
              borderRadius: 8,
              boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
              ...containerStyle
            }
          },
          children
        ),
        trigger: ["click"]
      },
      /* @__PURE__ */ import_react.default.createElement("div", null)
    );
  };
  const renderModal = () => {
    const effectiveMaskClosable = mask ? maskClosable : false;
    const hasCustomContainer = getContainer !== void 0;
    const modalClassName = [
      "pisell-lookup-modal-container",
      !mask ? "pisell-lookup-modal-no-mask" : "",
      containerClassName || ""
    ].filter(Boolean).join(" ");
    const wrapClassName = hasCustomContainer ? "pisell-lookup-modal-custom-container" : "";
    return /* @__PURE__ */ import_react.default.createElement(
      import_antd.Modal,
      {
        open: visible,
        onCancel: onClose,
        footer: null,
        width: modalWidth,
        style: { top: 8, ...modalStyle },
        getContainer,
        mask,
        maskClosable: effectiveMaskClosable,
        zIndex,
        className: modalClassName,
        wrapClassName,
        closeIcon: null,
        destroyOnClose: true,
        title: null,
        afterOpenChange: (open) => {
          if (open && onAfterOpen) {
            onAfterOpen();
          }
        }
      },
      /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lookup-modal-wrapper", style: containerStyle }, children)
    );
  };
  const renderDrawer = () => {
    const effectiveMaskClosable = mask ? maskClosable : false;
    const drawerClassName = `pisell-lookup-drawer-container ${!mask ? "pisell-lookup-drawer-no-mask" : ""} ${containerClassName || ""}`;
    return /* @__PURE__ */ import_react.default.createElement(
      import_antd.Drawer,
      {
        open: visible,
        onClose,
        width: drawerWidth,
        placement: drawerPlacement,
        mask,
        maskClosable: effectiveMaskClosable,
        zIndex,
        className: drawerClassName,
        closeIcon: /* @__PURE__ */ import_react.default.createElement(import_icons.CloseOutlined, null),
        destroyOnClose: true,
        title: (0, import_locales.getText)("pisell-lookup-confirm-button-text"),
        afterOpenChange: (open) => {
          if (open && onAfterOpen) {
            onAfterOpen();
          }
        }
      },
      /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lookup-drawer-content", style: containerStyle }, children)
    );
  };
  const renderDetached = () => {
    if (!visible) return null;
    if (!children) return null;
    return /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `pisell-lookup-result-detached ${containerClassName || ""}`,
        style: containerStyle
      },
      children
    );
  };
  switch (displayType) {
    case "inline":
      return renderInline();
    case "popup":
      return renderPopup();
    case "modal":
      return renderModal();
    case "drawer":
      return renderDrawer();
    case "detached":
      return renderDetached();
    default:
      return renderInline();
  }
};
LookupResultHost.displayName = "LookupResultHost";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  LookupResultHost
});
