const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../locales/index.js");
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _ant_design_icons = require("@ant-design/icons");
//#region src/components/pisellLookup/components/LookupResultHost.tsx
/**
* LookupResultHost 组件
* 结果承载层：根据展示类型渲染不同的容器
*/
const 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;
	/**
	* 渲染 Inline 模式
	*/
	const renderInline = () => {
		if (!visible) return null;
		if (!children) return null;
		return /* @__PURE__ */ react.default.createElement("div", {
			className: `pisell-lookup-result-inline ${containerClassName || ""}`,
			style: containerStyle
		}, children);
	};
	/**
	* 渲染 Popup 模式
	*/
	const renderPopup = () => {
		if (!visible || !children) return null;
		return /* @__PURE__ */ react.default.createElement(antd.Dropdown, {
			open: visible,
			onOpenChange: (open) => {
				if (!open) onClose();
			},
			dropdownRender: () => /* @__PURE__ */ react.default.createElement("div", {
				className: `pisell-lookup-result-popup ${containerClassName || ""}`,
				style: require_objectSpread2._objectSpread2({
					width: popupWidth,
					background: "#fff",
					borderRadius: 8,
					boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)"
				}, containerStyle)
			}, children),
			trigger: ["click"]
		}, /* @__PURE__ */ react.default.createElement("div", null));
	};
	/**
	* 渲染 Modal 模式
	*/
	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__ */ react.default.createElement(antd.Modal, {
			open: visible,
			onCancel: onClose,
			footer: null,
			width: modalWidth,
			style: require_objectSpread2._objectSpread2({ top: 8 }, modalStyle),
			getContainer,
			mask,
			maskClosable: effectiveMaskClosable,
			zIndex,
			className: modalClassName,
			wrapClassName,
			closeIcon: null,
			destroyOnClose: true,
			title: null,
			afterOpenChange: (open) => {
				if (open && onAfterOpen) onAfterOpen();
			}
		}, /* @__PURE__ */ react.default.createElement("div", {
			className: "pisell-lookup-modal-wrapper",
			style: containerStyle
		}, children));
	};
	/**
	* 渲染 Drawer 模式
	*/
	const renderDrawer = () => {
		const effectiveMaskClosable = mask ? maskClosable : false;
		const drawerClassName = `pisell-lookup-drawer-container ${!mask ? "pisell-lookup-drawer-no-mask" : ""} ${containerClassName || ""}`;
		return /* @__PURE__ */ react.default.createElement(antd.Drawer, {
			open: visible,
			onClose,
			width: drawerWidth,
			placement: drawerPlacement,
			mask,
			maskClosable: effectiveMaskClosable,
			zIndex,
			className: drawerClassName,
			closeIcon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.CloseOutlined, null),
			destroyOnClose: true,
			title: require_index.getText("pisell-lookup-confirm-button-text"),
			afterOpenChange: (open) => {
				if (open && onAfterOpen) onAfterOpen();
			}
		}, /* @__PURE__ */ react.default.createElement("div", {
			className: "pisell-lookup-drawer-content",
			style: containerStyle
		}, children));
	};
	/**
	* 渲染 Detached 模式
	*/
	const renderDetached = () => {
		if (!visible) return null;
		if (!children) return null;
		return /* @__PURE__ */ 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";
//#endregion
exports.LookupResultHost = LookupResultHost;
