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/serve/productQuery.ts
var productQuery_exports = {};
__export(productQuery_exports, {
  queryProductsByIds: () => queryProductsByIds
});
module.exports = __toCommonJS(productQuery_exports);
var import_utils = require("../../../utils");
async function queryProductsByIds(params) {
  const { product_ids, schedule_date, schedule_datetime } = params;
  if (!Array.isArray(product_ids) || product_ids.length === 0) return [];
  try {
    const res = await import_utils.request.getRequest().post(
      `/shop/product/query`,
      {
        open_quotation: 1,
        open_bundle: 0,
        exclude_extension_type: [
          "product_party",
          "product_event",
          "product_series_event",
          "product_package_ticket",
          "ticket",
          "event_item"
        ],
        with: ["category", "collection", "resourceRelation"],
        status: "published",
        num: 500,
        skip: 1,
        ids: product_ids,
        schedule_date,
        schedule_datetime,
        application_code: "online-store",
        is_eject: 1,
        open_deposit: 1
      },
      {
        fullResult: true,
        isShopApi: true,
        customToast: () => {
        }
      }
    );
    const body = (res == null ? void 0 : res.data) ?? res;
    const payload = body && typeof body === "object" && "data" in body ? body.data : body;
    const rawList = payload == null ? void 0 : payload.list;
    const list = Array.isArray(rawList) ? rawList : [];
    return list.slice().sort((a, b) => Number(b == null ? void 0 : b.sort) - Number(a == null ? void 0 : a.sort));
  } catch (error) {
    console.error("[PisellReservation] queryProductsByIds failed", error);
    return [];
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  queryProductsByIds
});
