require("../../../_virtual/_rolldown/runtime.js");
const require_reservationConstants = require("../reservationConstants.js");
let react = require("react");
//#region src/plus/pisellReservation/hooks/useNewReservationRoutesFromEngine.ts
/**
* 从引擎 app.router 筛出「新建预约」可选路由（booking_ticket / sales2 等）。
*/
function useNewReservationRoutesFromEngine(router) {
	return (0, react.useMemo)(() => {
		if (!router || typeof router !== "object") return [];
		return Object.entries(router).reduce((acc, [routeKey, routeConfig]) => {
			if (!routeConfig || typeof routeConfig !== "object") return acc;
			const routeItem = routeConfig;
			const pageType = routeItem.page_type;
			const proCodeId = routeItem.proCodeId;
			if (pageType !== "proCode" || typeof proCodeId !== "string" || !require_reservationConstants.RESERVATION_NEW_MODAL_PRO_CODE_IDS.has(proCodeId)) return acc;
			const pageName = typeof routeItem.page_name === "string" && routeItem.page_name.trim() ? routeItem.page_name.trim() : routeKey;
			const routePath = typeof routeItem.router === "string" && routeItem.router.trim() ? routeItem.router.trim() : routeKey;
			if (!routePath) return acc;
			/** 排除餐饮等业务线，避免与预约新建混淆 */
			if (routePath.toLowerCase().includes("food")) return acc;
			/** 排除带动态段的路由，避免 push 缺参 */
			if (/\/:[^/]+/.test(routePath)) return acc;
			acc.push({
				pageName,
				router: routePath
			});
			return acc;
		}, []);
	}, [router]);
}
//#endregion
exports.useNewReservationRoutesFromEngine = useNewReservationRoutesFromEngine;
