import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from "react";
import { cn } from "../../lib/utils";
export function FeedbackContextHeader({ segments, selected = false, className, action, }) {
    const visibleSegments = segments.filter(Boolean);
    if (visibleSegments.length === 0 && !action)
        return null;
    return (_jsxs("div", { className: cn("border-border-default flex min-h-11 items-center border-b px-4 py-1.5 text-[13px] leading-5", selected ? "text-neutral-grey-100" : "text-neutral-grey-50", className), "data-testid": "feedback-context-header", children: [_jsx("div", { className: "min-w-0 flex-1 truncate", children: visibleSegments.map((segment, index) => (_jsxs(React.Fragment, { children: [index > 0 && (_jsx("span", { className: cn("mx-1", selected ? "text-neutral-grey-100" : "text-neutral-grey-50"), children: ">" })), _jsx("span", { children: segment })] }, `${segment}-${index}`))) }), action && _jsx("div", { className: "ml-3 shrink-0", children: action })] }));
}
export function FeedbackCardFrame({ children, contextSegments, selected = false, className, bodyClassName, headerAction, onClick, testId, }) {
    return (_jsxs("div", { "data-testid": testId, className: cn("mb-3 overflow-hidden rounded-2xl border bg-white transition-colors", selected
            ? "border-border-default bg-neutral-grey-5"
            : "group border-border-default hover:border-border-default hover:bg-neutral-grey-5", className), onClick: onClick, children: [_jsx(FeedbackContextHeader, { segments: contextSegments, action: headerAction, selected: selected, className: selected ? "border-border-default bg-neutral-grey-5" : undefined }), _jsx("div", { className: cn("p-3 transition-colors", selected
                    ? "bg-neutral-grey-5"
                    : "group-hover:bg-neutral-grey-5 bg-white", bodyClassName), children: children })] }));
}
export function getCommentContextSegments(comment, basePageName) {
    const isComponentDifferent = !!comment.itemId && comment.mainItemId !== comment.itemId;
    return [
        basePageName || comment.mainItemName || "",
        isComponentDifferent ? comment.itemName || "" : "",
        comment.fieldName || "",
    ].filter(Boolean);
}
export function getSuggestionContextSegments(suggestion, pageName, itemName, fieldName) {
    return [
        pageName || suggestion.mainItemName || "",
        itemName || suggestion.itemName || "",
        fieldName || "",
    ].filter(Boolean);
}
//# sourceMappingURL=FeedbackCard.js.map