/**
 * @jsxRuntime classic
 * @jsx jsx
 */
import React, { useCallback, useRef } from 'react';

// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
import { css, jsx } from '@emotion/react';
import { injectIntl } from 'react-intl';
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
import QuestionsIcon from '@atlaskit/icon/core/question-circle';
import Tooltip from '@atlaskit/tooltip';
import { ACTION_SUBJECT_ID } from '../../analytics';
import { unsupportedContentMessages } from '../../messages/unsupportedContent';
import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
import { getUnsupportedContent } from '../unsupported-content-helper';
var blockNodeStyle = css({
  background: "var(--ds-background-disabled, #17171708)",
  border: "var(--ds-border-width, 1px)".concat(" dashed ", "var(--ds-border-disabled, #0515240F)"),
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
  borderRadius: "var(--ds-radius-small, 3px)",
  boxSizing: 'border-box',
  cursor: 'default',
  display: 'flex',
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
  fontSize: relativeFontSizeToBase16(14),
  margin: "var(--ds-space-100, 8px)".concat(" 0"),
  minHeight: '24px',
  padding: "var(--ds-space-150, 12px)",
  textAlign: 'center',
  verticalAlign: 'text-bottom',
  minWidth: '120px',
  alignItems: 'center',
  justifyContent: 'center'
});
var UnsupportedBlockNode = function UnsupportedBlockNode(_ref) {
  var node = _ref.node,
    intl = _ref.intl,
    dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
  var message = getUnsupportedContent(unsupportedContentMessages.unsupportedBlockContent, unsupportedContentMessages.unsupportedBlockContent.defaultMessage + ':', node, intl);
  var tooltipContent = intl.formatMessage(unsupportedContentMessages.unsupportedContentTooltip);
  var _useRef = useRef({
      padding: '4px'
    }),
    style = _useRef.current;
  var originalNodeType = node === null || node === void 0 ? void 0 : node.attrs.originalValue.type;
  var tooltipOnShowHandler = useCallback(function () {
    return dispatchAnalyticsEvent && trackUnsupportedContentTooltipDisplayedFor(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.ON_UNSUPPORTED_BLOCK, originalNodeType);
  }, [dispatchAnalyticsEvent, originalNodeType]);
  return (
    // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
    jsx("div", {
      css: blockNodeStyle,
      className: "unsupported"
    }, message, jsx(Tooltip, {
      content: tooltipContent,
      hideTooltipOnClick: false,
      position: "bottom",
      onShow: tooltipOnShowHandler,
      strategy: "absolute"
    }, jsx("span", {
      style: style
    }, jsx(QuestionsIcon, {
      label: "?"
    }))))
  );
};

// eslint-disable-next-line @typescript-eslint/ban-types
var _default_1 = injectIntl(UnsupportedBlockNode);
export default _default_1;