//#region src/components/ticketBooking/utils/menuListIds.ts
/**
* 将 board `menu_list_tab.menu_list` 或覆盖列表规范为 number[]。
*/
function normalizeMenuListIds(raw) {
	if (!Array.isArray(raw)) return [];
	const out = [];
	for (const x of raw) {
		const n = Number(x);
		if (Number.isFinite(n) && n > 0) out.push(Math.floor(n));
	}
	return [...new Set(out)];
}
/**
* 优先使用新建入口传入的餐牌 ID；否则使用 board 配置中的 menu_list。
*/
function getEffectiveMenuListIds(state) {
	var _state$bookingConfig;
	const override = state === null || state === void 0 ? void 0 : state.associated_menu_list_ids;
	if (Array.isArray(override) && override.length > 0) return normalizeMenuListIds(override);
	return normalizeMenuListIds(state === null || state === void 0 || (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.config) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.menu_list_tab) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.menu_list);
}
//#endregion
export { getEffectiveMenuListIds, normalizeMenuListIds };
