import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import useEngineContext from "../../../../hooks/useEngineContext.js";
import { formatMultiDayDate } from "../../utils.js";
import Divider from "../Divider/index.js";
import Footer from "../AmountFooter/index.js";
import { formatDateRanges } from "./utils.js";
import React, { useMemo } from "react";
import classNames from "classnames";
import "./index.less";
//#region src/components/productCard/components/MultiDay/index.tsx
const prefix = "pisell-lowcode-";
const MultiDay = ({ dataSource, hideDivider }) => {
	var _context$appHelper;
	const { items, symbol, locale } = dataSource;
	const context = useEngineContext();
	const utils = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils;
	!(utils === null || utils === void 0) && utils.translationOriginal || utils === null || utils === void 0 || utils.translation;
	/**
	* @title: 商品单价 + 套餐价格
	* @description:
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2024-12-28 23:00
	*/
	const lists = useMemo(() => {
		if (!(items === null || items === void 0 ? void 0 : items.length)) return [];
		return formatDateRanges(items);
	}, [items]);
	return /* @__PURE__ */ React.createElement("div", { className: classNames(`${prefix}multi-day-wrap`) }, lists === null || lists === void 0 ? void 0 : lists.map((m, index) => {
		return /* @__PURE__ */ React.createElement("div", { key: index }, /* @__PURE__ */ React.createElement(Divider, { type: "inside" }), /* @__PURE__ */ React.createElement("div", { className: classNames(`${prefix}multi-day`) }, /* @__PURE__ */ React.createElement("div", null, formatMultiDayDate(_objectSpread2(_objectSpread2({}, m), {}, { locale }))), /* @__PURE__ */ React.createElement(Footer, {
			item: _objectSpread2(_objectSpread2({}, m), {}, { symbol }),
			hideDivider: true
		})));
	}), /* @__PURE__ */ React.createElement("div", { className: classNames(`${prefix}multi-day-total-wrap`) }, /* @__PURE__ */ React.createElement(Footer, {
		item: _objectSpread2(_objectSpread2({}, dataSource), {}, { num: 1 }),
		type: "total",
		isOnlyTotal: true
	})));
};
//#endregion
export { MultiDay as default };
