import React from 'react';
import classnames from 'classnames';
import { pick } from 'ramda';
import { withTableContext } from '../HOCs/withTableContext';
import { TableVariant } from '../types/basicTable';
import { useMaskedAttribute } from '../hooks/useMaskedAttribute';
import { MaskingSwitcher } from '../MaskingSwitcher';
import styles from './styles.module.css';
var stopPropagation = function (event) {
    event.stopPropagation();
};
var BlobRenderer = function (_a) {
    var value = _a.value, _b = _a.columnData, dataTypeDefinition = _b.dataTypeDefinition, className = _b.className, entity = _a.rowValue.label, _c = _a.variant, variant = _c === void 0 ? TableVariant.Wide : _c;
    var _d = useMaskedAttribute({
        attributeType: dataTypeDefinition,
        attributeValue: value,
        entity: entity
    }), isUnmaskingNeeded = _d.isUnmaskingNeeded, isMasked = _d.isMasked, toggleMasking = _d.toggleMasking, attributeValue = _d.attributeValue, isUnmasking = _d.isUnmasking;
    return (React.createElement("div", { className: classnames(styles.blobWrapper, styles[variant], className), onScroll: stopPropagation },
        attributeValue.value,
        isUnmaskingNeeded && (React.createElement(MaskingSwitcher, { isMasked: isMasked, onToggleMasking: toggleMasking, isUnmasking: isUnmasking }))));
};
export default withTableContext(pick(['variant']))(BlobRenderer);
