import { theme } from "../theme.js";
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
//#region src/tui/components/tui-header.ts
const COMPACT_HINTS = "Esc abort · Ctrl+C×2 exit · /settings · /help · /hotkeys · Ctrl+Shift+P sessions";
const EXPANDED_HINTS = ["Enter steer while busy · Alt+Enter follow-up · Ctrl+P models · Ctrl+L picker", "! / !! local shell · Ctrl+V paste image · /compact compact history"];
/** Collapsible startup header (pi-style hints subset). */
var TuiHeader = class {
	extensionLines = [];
	constructor(getModel) {
		this.getModel = getModel;
	}
	setExtensionLines(lines) {
		this.extensionLines = lines;
	}
	invalidate() {}
	render(width) {
		const { version, connectionLabel, sessionKey, showHints } = this.getModel();
		const lines = [truncateToWidth(theme.header(`xopc tui v${version} — ${connectionLabel} — ${sessionKey}`), width, theme.dim("…"))];
		if (showHints) {
			lines.push(truncateToWidth(theme.dim(COMPACT_HINTS), width, theme.dim("…")));
			for (const hint of EXPANDED_HINTS) if (visibleWidth(hint) <= width) lines.push(theme.dim(hint));
			else lines.push(truncateToWidth(theme.dim(hint), width, theme.dim("…")));
		}
		for (const extLine of this.extensionLines) lines.push(truncateToWidth(theme.dim(extLine), width, theme.dim("…")));
		return lines;
	}
};
//#endregion
export { TuiHeader };

//# sourceMappingURL=tui-header.js.map