import { findReservationRow } from "./reservationCards.js";
import { FLOOR_MAP_IMAGE_ELEMENT_KIND, FLOOR_MAP_STAGE_ELEMENT_KIND } from "@pisell/materials";
//#region src/plus/pisellReservation/floorMap/reservationHudTableRows.ts
/**
* 场控 HUD 抽屉：按当前画布图元已绑定行，从 tables 中筛出对应表格行。
*/
function isSeatLikeElement(item) {
	const k = item.elementKind;
	if (!k || k === FLOOR_MAP_IMAGE_ELEMENT_KIND || k === FLOOR_MAP_STAGE_ELEMENT_KIND) return false;
	return true;
}
function filterReservationRowsBoundOnCanvas(items, dataSources, gridDataSourceKey) {
	var _ds$gridDataSourceKey;
	const ds = dataSources !== null && dataSources !== void 0 ? dataSources : {};
	const tables = (_ds$gridDataSourceKey = ds[gridDataSourceKey]) !== null && _ds$gridDataSourceKey !== void 0 ? _ds$gridDataSourceKey : [];
	const idSet = /* @__PURE__ */ new Set();
	for (const item of items) {
		if (!isSeatLikeElement(item)) continue;
		const row = findReservationRow(item, ds);
		if ((row === null || row === void 0 ? void 0 : row.id) != null) idSet.add(String(row.id));
	}
	return tables.filter((r) => idSet.has(String(r.id)));
}
//#endregion
export { filterReservationRowsBoundOnCanvas };
