import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import React, { useMemo } from "react";
import { getUniqueId } from "@pisell/utils";
import { Modal, QRCode } from "antd";
//#region src/components/qrcode/index.tsx
const QRCode$1 = (props) => {
	const { preview } = props;
	const [visible, setVisible] = React.useState(false);
	const id = useMemo(() => {
		return getUniqueId();
	}, []);
	const handleClick = (e) => {
		e.stopPropagation();
		setVisible(true);
	};
	return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
		onClick: handleClick,
		id,
		className: "pisell-lowcode-qrcode-wrap"
	}, /* @__PURE__ */ React.createElement(QRCode, props)), preview && /* @__PURE__ */ React.createElement("span", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React.createElement(Modal, {
		open: visible,
		onCancel: () => setVisible(false),
		footer: null,
		width: 248,
		closeIcon: /* @__PURE__ */ React.createElement("span", null)
	}, /* @__PURE__ */ React.createElement(QRCode, _objectSpread2(_objectSpread2({}, props), {}, { size: 200 })))));
};
//#endregion
export { QRCode$1 as default };
