const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_RoomCardIcons = require("./RoomCardIcons.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
//#region src/plus/pisellReservation/floorRoomCard/views/RoomCardBodyView.tsx
/**
* RoomCard 主体纯展示：依赖 {@link buildRoomCardBodyViewModel} 输出，内部不调用 locales。
*/
function ScrollMiddle(props) {
	const outerRef = (0, react.useRef)(null);
	const innerRef = (0, react.useRef)(null);
	const [scrollDist, setScrollDist] = (0, react.useState)(0);
	(0, react.useLayoutEffect)(() => {
		const outer = outerRef.current;
		const inner = innerRef.current;
		if (outer && inner) {
			const diff = inner.scrollWidth - outer.clientWidth;
			setScrollDist(diff > 0 ? diff + 20 : 0);
		}
	}, [props.children]);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: "rc-compact__middle",
		ref: outerRef
	}, /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)("rc-compact__scroll", scrollDist > 0 && "rc-compact__scroll--animate"),
		ref: innerRef,
		style: scrollDist > 0 ? { "--scroll-dist": `-${scrollDist}px` } : void 0
	}, props.children));
}
function ProgressBarView(props) {
	const { isTimeout } = props;
	const clamped = Math.min(100, Math.max(0, props.percent));
	return /* @__PURE__ */ react.default.createElement("div", { className: "rc-progress" }, /* @__PURE__ */ react.default.createElement("div", { className: "rc-progress__bar" }, /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)("rc-progress__fill", isTimeout && "rc-progress__fill--warn"),
		style: { width: `${clamped}%` }
	})));
}
function PaymentStampView(props) {
	const stampCls = props.variant === "paid" ? "rc-stamp--paid" : "rc-stamp--unpaid";
	return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("rc-stamp", stampCls) }, /* @__PURE__ */ react.default.createElement("span", null, props.label));
}
/** 与标准卡底部 Next 区一致，供多预约卡等复用 */
function RoomCardNextBookingStrip(props) {
	const { nextLabel, guestLine, timeRange } = props;
	return /* @__PURE__ */ react.default.createElement("div", { className: "rc-next" }, /* @__PURE__ */ react.default.createElement("span", { className: "rc-next__label" }, nextLabel), guestLine ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-next__sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", null, guestLine)) : null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-next__sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", null, timeRange));
}
function RoomCardBodyView(props) {
	const { model, scrollSurfaceHandlers, nextBookingPrefix } = props;
	const { checkoutDomKey, contactName, contactPhoneMasked, showContactPhone, guestNameCompact, timeLabel, partySize, countdown, reservedLateOverrun, occupiedTimeoutOverrun, paymentAmountClass, paymentBadgeClass, paymentBadgeText, paymentStampText, paymentStampVariant, amountDisplay, showLargeAmountRow, showProgress, showPaymentStamp, showAmountInlineBadge, showCompactCommerceRow, itemsCountLabel, itemsCountInsideScroll, progressPercent, progressIsTimeout, nextGuestLine, nextTimeRange } = model;
	const showContact = contactName || showContactPhone && contactPhoneMasked;
	if (model.layout === "compact") return /* @__PURE__ */ react.default.createElement("div", {
		className: "rc-compact",
		"data-pisell-floor-checkout-booking": checkoutDomKey
	}, /* @__PURE__ */ react.default.createElement("div", { className: "rc-compact__row" }, /* @__PURE__ */ react.default.createElement("div", { className: "rc-compact__left" }, guestNameCompact ? /* @__PURE__ */ react.default.createElement("span", { className: "rc-compact__name" }, guestNameCompact) : null), /* @__PURE__ */ react.default.createElement(ScrollMiddle, null, /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconClock, null), timeLabel), /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconUsers, null), partySize), countdown ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", { className: "rc-highlight--info" }, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconClock, null), countdown)) : null, reservedLateOverrun ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", { className: "rc-highlight--danger" }, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconWarn, null), reservedLateOverrun)) : null, occupiedTimeoutOverrun ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", { className: "rc-highlight--overtime" }, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconWarn, null), occupiedTimeoutOverrun)) : null, itemsCountInsideScroll ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", { className: (0, classnames.default)("rc-compact__items-count", "rc-compact__items-count--in-scroll") }, itemsCountLabel)) : null), showCompactCommerceRow ? /* @__PURE__ */ react.default.createElement("div", { className: "rc-compact__right" }, /* @__PURE__ */ react.default.createElement("div", { className: "rc-compact__right-stack" }, /* @__PURE__ */ react.default.createElement("div", { className: "rc-compact__pay-row" }, /* @__PURE__ */ react.default.createElement("span", { className: (0, classnames.default)("rc-compact__amount", "rc-amount__main", paymentAmountClass) }, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconMoney, null), amountDisplay), /* @__PURE__ */ react.default.createElement("span", { className: (0, classnames.default)("rc-compact__badge", paymentBadgeClass) }, paymentBadgeText)), itemsCountInsideScroll ? null : /* @__PURE__ */ react.default.createElement("div", { className: "rc-compact__items-count" }, itemsCountLabel))) : null), /* @__PURE__ */ react.default.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ react.default.createElement(ProgressBarView, {
		percent: progressPercent,
		isTimeout: progressIsTimeout
	}));
	return /* @__PURE__ */ react.default.createElement("div", require_objectSpread2._objectSpread2({
		className: "rc-body",
		"data-pisell-floor-checkout-booking": checkoutDomKey,
		"data-pisell-floor-room-scroll-surface": ""
	}, scrollSurfaceHandlers), showContact ? /* @__PURE__ */ react.default.createElement("div", { className: "rc-contact" }, contactName ? /* @__PURE__ */ react.default.createElement("span", { className: "rc-contact__name" }, contactName) : null, showContactPhone && contactPhoneMasked ? /* @__PURE__ */ react.default.createElement("span", { className: "rc-contact__phone" }, contactPhoneMasked) : null) : null, /* @__PURE__ */ react.default.createElement("div", { className: "rc-time-row" }, /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconClock, null), timeLabel), /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconUsers, null), partySize), countdown ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", { className: "rc-highlight--info" }, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconClock, null), countdown)) : null, reservedLateOverrun ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", { className: "rc-highlight--danger" }, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconWarn, null), reservedLateOverrun)) : null, occupiedTimeoutOverrun ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("span", { className: "rc-sep" }, "·"), /* @__PURE__ */ react.default.createElement("span", { className: "rc-highlight--overtime" }, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconWarn, null), occupiedTimeoutOverrun)) : null), showLargeAmountRow ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("rc-amount", showAmountInlineBadge && "rc-amount--with-badge", paymentAmountClass) }, /* @__PURE__ */ react.default.createElement("span", { className: "rc-amount__main" }, /* @__PURE__ */ react.default.createElement(require_RoomCardIcons.IconMoney, null), amountDisplay), showAmountInlineBadge ? /* @__PURE__ */ react.default.createElement("span", { className: (0, classnames.default)("rc-compact__badge", paymentBadgeClass) }, paymentBadgeText) : null), /* @__PURE__ */ react.default.createElement("div", { className: "rc-items-count" }, itemsCountLabel)) : null, /* @__PURE__ */ react.default.createElement("div", { style: { flex: 1 } }), showProgress ? /* @__PURE__ */ react.default.createElement(ProgressBarView, {
		percent: progressPercent,
		isTimeout: progressIsTimeout
	}) : null, showPaymentStamp ? /* @__PURE__ */ react.default.createElement(PaymentStampView, {
		variant: paymentStampVariant,
		label: paymentStampText
	}) : null, nextTimeRange != null ? /* @__PURE__ */ react.default.createElement(RoomCardNextBookingStrip, {
		nextLabel: nextBookingPrefix,
		guestLine: nextGuestLine,
		timeRange: nextTimeRange
	}) : null);
}
//#endregion
exports.RoomCardBodyView = RoomCardBodyView;
exports.RoomCardNextBookingStrip = RoomCardNextBookingStrip;
