import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Text } from "ink";
import { MessageResponse } from "./MessageResponse.js";
export function RateLimitMessage(props) {
    const model = rateLimitMessageModel(props.text);
    return (_jsx(MessageResponse, { tone: "error", children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "red", children: model.title }), _jsx(Text, { color: "gray", children: model.text }), _jsx(Text, { color: "gray", children: model.recommendation })] }) }));
}
export function rateLimitMessageModel(text) {
    return {
        title: "DeepSeek rate limit",
        text: text.trim() || "The provider refused this request because a rate limit was reached.",
        recommendation: "wait, use deepseek-v4-flash for tests, and run /cache plan before retrying large context",
    };
}
export function isRateLimitText(text) {
    return /\b(429|rate limit|too many requests|quota|insufficient balance)\b/i.test(text);
}
