import style_default from "./style/index.js";
import { computed, createVNode, defineComponent, mergeProps, useAttrs, useSlots } from "vue";
import { Typography } from "antdv-next";
//#region components/actions/ActionsCopy.tsx
var normalizeCopyIcons = (icon) => {
	if (Array.isArray(icon)) return [icon[0], icon[1] ?? icon[0]];
	return [icon, icon];
};
var XActionsCopy = /* @__PURE__ */ defineComponent({
	name: "AxActionsCopy",
	inheritAttrs: false,
	props: {
		text: {
			type: String,
			default: ""
		},
		icon: {
			type: [
				String,
				Number,
				Object,
				Array,
				Function
			],
			default: void 0
		},
		prefixCls: {
			type: String,
			default: "antd-actions"
		},
		rootClass: {
			type: String,
			default: ""
		},
		class: {
			type: [
				String,
				Array,
				Object
			],
			default: void 0
		},
		style: {
			type: [
				String,
				Object,
				Array
			],
			default: void 0
		},
		classes: {
			type: Object,
			default: () => ({})
		},
		styles: {
			type: Object,
			default: () => ({})
		}
	},
	setup(props) {
		const attrs = useAttrs();
		const slots = useSlots();
		const [hashId, cssVarCls] = style_default(computed(() => props.prefixCls));
		const copyCls = `${props.prefixCls}-copy`;
		const domAttrs = computed(() => {
			const { class: _class, style: _style, ...rest } = attrs;
			return rest;
		});
		const iconSlot = computed(() => slots.icon);
		const mergedCopyIcons = computed(() => {
			const [defaultOriginNode, copiedOriginNode] = normalizeCopyIcons(props.icon);
			if (!iconSlot.value) return props.icon;
			return [iconSlot.value({
				originNode: defaultOriginNode,
				status: "default"
			}), iconSlot.value({
				originNode: copiedOriginNode,
				status: "copied"
			})];
		});
		return () => createVNode(Typography.Text, mergeProps(domAttrs.value, {
			"class": [
				props.prefixCls,
				copyCls,
				`${props.prefixCls}-item`,
				hashId.value,
				cssVarCls.value,
				props.rootClass,
				props.classes?.root,
				attrs.class,
				props.class
			],
			"style": [
				props.styles?.root,
				attrs.style,
				props.style
			],
			"prefixCls": copyCls,
			"copyable": {
				text: props.text,
				icon: mergedCopyIcons.value
			}
		}), null);
	}
});
//#endregion
export { XActionsCopy, XActionsCopy as default };
