import { formatDate } from "../../pisellDateTimeDisplay/utils/formatDate.js";
import { getRelativeDay, getRelativeDayLabel } from "../../pisellDateTimeDisplay/utils/relativeDay.js";
import React from "react";
import dayjs from "dayjs";
//#region src/components/pisellTimeRangeDisplay/components/DateBlock.tsx
/**
* 日期展示块（复用 PisellDateTimeDisplay 的 formatDate 与相对日逻辑）
*/
const DateBlock = ({ date, format, referenceDate = dayjs(), style, className }) => {
	var _labels$relativeDay;
	const labels = format === null || format === void 0 ? void 0 : format.relativeDayLabels;
	const relativeDay = (format === null || format === void 0 ? void 0 : format.showRelativeDay) ? getRelativeDay(date, referenceDate) : null;
	const formattedDate = relativeDay ? (_labels$relativeDay = labels === null || labels === void 0 ? void 0 : labels[relativeDay]) !== null && _labels$relativeDay !== void 0 ? _labels$relativeDay : getRelativeDayLabel(relativeDay, date.locale()) : formatDate(date, format);
	if (!formattedDate) return null;
	const inlineStyle = {
		fontSize: style === null || style === void 0 ? void 0 : style.fontSize,
		fontWeight: style === null || style === void 0 ? void 0 : style.fontWeight,
		color: style === null || style === void 0 ? void 0 : style.color,
		lineHeight: style === null || style === void 0 ? void 0 : style.lineHeight
	};
	return /* @__PURE__ */ React.createElement("span", {
		className: `pisell-time-range-display-date ${className || ""}`.trim(),
		style: inlineStyle
	}, formattedDate);
};
//#endregion
export { DateBlock as default };
