"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WinnerSource = void 0;
var react_1 = __importDefault(require("react"));
var ListItemText_1 = __importDefault(require("@mui/material/ListItemText"));
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var MdmModuleContext_1 = require("../../../../../contexts/MdmModuleContext");
var CrosswalksDisplayContext_1 = require("../../../../../contexts/CrosswalksDisplayContext");
var SourceIcon_1 = require("../../../../../SourceIcon");
var ColoredBlock_1 = require("../../../ColoredBlock");
var styles_1 = require("./styles");
var WinnerSource = function (_a) {
    var crosswalk = _a.crosswalk;
    var styles = (0, styles_1.useStyles)();
    var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
    var _b = (0, CrosswalksDisplayContext_1.useCrosswalkHighlight)(crosswalk), isDimmed = _b.isDimmed, highlightCrosswalk = _b.highlightCrosswalk, removeHighlight = _b.removeHighlight;
    return (react_1.default.createElement(ColoredBlock_1.ColoredBlock, { className: styles.root, color: isDimmed ? 'rgba(0, 0, 0, 0.12)' : (0, mdm_sdk_1.getCrosswalkColor)((0, mdm_sdk_1.getCrosswalkId)(crosswalk)), opacity: isDimmed ? 0.38 : 1, onMouseEnter: function () { return highlightCrosswalk(); }, onMouseLeave: function () { return removeHighlight(); } },
        react_1.default.createElement(SourceIcon_1.SourceIcon, { className: styles.icon, sourceType: crosswalk.type }),
        react_1.default.createElement(ListItemText_1.default, { primary: (0, mdm_sdk_1.getSourceSystemLabel)(metadata, crosswalk.type), primaryTypographyProps: { variant: 'body2' }, classes: { primary: styles.label } })));
};
exports.WinnerSource = WinnerSource;
