require("../../../_virtual/_rolldown/runtime.js");
const require_index = require("../utils/index.js");
let react = require("react");
//#region src/components/PisellSteps/hooks/useStepClick.ts
/**
* 处理步骤点击逻辑的 Hook
* 
* @param currentStep - 当前步骤索引
* @param clickable - 是否允许点击步骤切换
* @param allowClickFinished - 是否允许点击已完成的步骤
* @param onStepChange - 步骤变更回调函数
* @returns 步骤点击处理函数
*/
function useStepClick(currentStep, clickable, allowClickFinished, onStepChange) {
	return (0, react.useCallback)((index, item) => {
		if (item.disabled) return;
		if (!clickable) return;
		if (!require_index.isStepClickable(index, currentStep, item.status || "wait", clickable, allowClickFinished)) return;
		onStepChange(index);
	}, [
		currentStep,
		clickable,
		allowClickFinished,
		onStepChange
	]);
}
//#endregion
exports.useStepClick = useStepClick;
