var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/pisellReservation/floorMap/floorMapBoundRecordIds.ts
var floorMapBoundRecordIds_exports = {};
__export(floorMapBoundRecordIds_exports, {
  sceneElementsToBoundFormRecordIds: () => sceneElementsToBoundFormRecordIds,
  sceneElementsToBoundRecordIdStrings: () => sceneElementsToBoundRecordIdStrings
});
module.exports = __toCommonJS(floorMapBoundRecordIds_exports);
var EMPTY_BOUND_FORM_RECORD_IDS = [];
var EMPTY_BOUND_RECORD_ID_STRINGS = [];
function parseRecordIdToPositiveInt(recordId) {
  const t = recordId.trim();
  if (!t || t === "0") return null;
  const n = Number(t);
  if (Number.isFinite(n) && n > 0) return Math.trunc(n);
  if (/^\d+$/.test(t)) return Math.trunc(Number(t));
  return null;
}
function bindingDataSourceMatchesGrid(dataSourceKey, gridDataSourceKey) {
  const k = String(dataSourceKey ?? "").trim();
  if (!k) return true;
  return k === gridDataSourceKey;
}
function sceneElementsToBoundFormRecordIds(sceneElements, gridDataSourceKey) {
  if (!Array.isArray(sceneElements) || sceneElements.length === 0) {
    return EMPTY_BOUND_FORM_RECORD_IDS;
  }
  const seen = /* @__PURE__ */ new Set();
  const out = [];
  for (const el of sceneElements) {
    const db = el == null ? void 0 : el.dataBinding;
    if (!db || !bindingDataSourceMatchesGrid(db.dataSourceKey, gridDataSourceKey))
      continue;
    const n = parseRecordIdToPositiveInt(String(db.recordId ?? ""));
    if (n != null && !seen.has(n)) {
      seen.add(n);
      out.push(n);
    }
  }
  return out;
}
function sceneElementsToBoundRecordIdStrings(sceneElements, gridDataSourceKey) {
  if (!Array.isArray(sceneElements) || sceneElements.length === 0) {
    return EMPTY_BOUND_RECORD_ID_STRINGS;
  }
  const seen = /* @__PURE__ */ new Set();
  const out = [];
  for (const el of sceneElements) {
    const db = el == null ? void 0 : el.dataBinding;
    if (!db || !bindingDataSourceMatchesGrid(db.dataSourceKey, gridDataSourceKey))
      continue;
    const raw = String(db.recordId ?? "").trim();
    if (!raw || raw === "0") continue;
    if (!seen.has(raw)) {
      seen.add(raw);
      out.push(raw);
    }
  }
  return out;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  sceneElementsToBoundFormRecordIds,
  sceneElementsToBoundRecordIdStrings
});
