import { hasRenderableNode } from "../_utils/vue.js";
import { STATUS_ICON_MAP } from "./Status.js";
import style_default from "./style/index.js";
import { computed, createVNode, defineComponent, ref } from "vue";
import { useConfig } from "antdv-next/config-provider/context";
//#region components/thought-chain/Item.tsx
var XThoughtChainItem = /* @__PURE__ */ defineComponent({
	name: "AxThoughtChainItem",
	props: {
		prefixCls: {
			type: String,
			default: "antd-thought-chain"
		},
		rootClass: {
			type: String,
			default: ""
		},
		icon: {
			type: [
				String,
				Object,
				Array
			],
			default: void 0
		},
		title: {
			type: [
				String,
				Object,
				Array
			],
			default: void 0
		},
		description: {
			type: [
				String,
				Object,
				Array
			],
			default: void 0
		},
		status: {
			type: String,
			default: void 0
		},
		variant: {
			type: String,
			default: "solid"
		},
		blink: {
			type: Boolean,
			default: false
		},
		disabled: {
			type: Boolean,
			default: false
		},
		onClick: {
			type: Function,
			default: void 0
		},
		classes: {
			type: Object,
			default: () => ({})
		},
		styles: {
			type: Object,
			default: () => ({})
		}
	},
	setup(props, { expose, slots }) {
		const configCtx = useConfig();
		const rootRef = ref();
		const [hashId, cssVarCls] = style_default(computed(() => props.prefixCls));
		const itemPrefixCls = computed(() => `${props.prefixCls}-item`);
		function handleClick(e) {
			if (props.disabled || !props.onClick) return;
			props.onClick(e);
		}
		expose({ get nativeElement() {
			return rootRef.value;
		} });
		return () => {
			const cls = itemPrefixCls.value;
			const statusCls = `${props.prefixCls}-status`;
			const iconSlot = slots.icon;
			const originIconNode = props.status ? STATUS_ICON_MAP[props.status] : props.icon;
			const iconNode = iconSlot ? iconSlot({
				originNode: originIconNode,
				status: props.status
			}) : originIconNode;
			const titleNode = slots.title ? slots.title({ originNode: props.title }) : props.title;
			const descriptionNode = slots.description ? slots.description({ originNode: props.description }) : props.description;
			const hasTitle = hasRenderableNode(titleNode);
			const hasDescription = hasRenderableNode(descriptionNode);
			return createVNode("div", {
				"ref": rootRef,
				"class": [
					props.prefixCls,
					cls,
					`${cls}-${props.variant}`,
					props.rootClass,
					props.classes?.root,
					hashId.value,
					cssVarCls.value,
					{
						[`${cls}-click`]: !!props.onClick && !props.disabled,
						[`${cls}-error`]: props.status === "error",
						[`${cls}-disabled`]: props.disabled,
						[`${cls}-rtl`]: configCtx.value.direction === "rtl"
					}
				],
				"style": props.styles?.root,
				"onClick": handleClick
			}, [hasRenderableNode(iconNode) && createVNode("div", {
				"style": props.styles?.icon,
				"class": [
					statusCls,
					props.classes?.icon,
					{ [`${statusCls}-${props.status}`]: props.status }
				]
			}, [iconNode]), (hasTitle || hasDescription) && createVNode("div", { "class": [`${cls}-content`, { [`${props.prefixCls}-motion-blink`]: props.blink }] }, [hasTitle && createVNode("div", {
				"class": [
					`${cls}-title`,
					props.classes?.title,
					{ [`${cls}-title-with-description`]: hasDescription }
				],
				"style": props.styles?.title
			}, [titleNode]), hasDescription && createVNode("div", {
				"class": [`${cls}-description`, props.classes?.description],
				"style": props.styles?.description
			}, [descriptionNode])])]);
		};
	}
});
//#endregion
export { XThoughtChainItem, XThoughtChainItem as default };
