"use strict";

require("core-js/modules/es.object.define-property.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Chat = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _i18n = require("../../../i18n");
var _avatar = require("../../avatar");
var _icon = require("../../icon");
var _type = require("../../icon/type");
var _tooltip = require("../../tooltip");
var _item = require("../item");
require("./index.css");
var _react = require("react");
var _jsxRuntime = require("react/jsx-runtime");
var Chat = exports.Chat = function Chat(_ref) {
  var id = _ref.id,
    order = _ref.order;
  var t = (0, _i18n.useI18n)();
  var title = t('fmt_chat_window_title');
  var tooltip = t('fmt_chat_window_title');
  var _useState = (0, _react.useState)(false),
    _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
    tooltipVisible = _useState2[0],
    setTooltipVisible = _useState2[1];
  var _useState3 = (0, _react.useState)(false),
    _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
    chatTooltipVisible = _useState4[0],
    setChatTooltipVisible = _useState4[1];
  var handleTooltipVisibleChange = function handleTooltipVisibleChange(visible) {
    if (visible && chatTooltipVisible) {
      setTooltipVisible(false);
    } else {
      setTooltipVisible(visible);
    }
  };
  var handleChatTooltipVisibleChange = function handleChatTooltipVisibleChange(visible) {
    if (visible && tooltipVisible) {
      setTooltipVisible(false);
    }
    setChatTooltipVisible(visible);
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
    className: "fcr-action-bar-chat-wrapper",
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      className: "fcr-action-bar-chat-unread-count",
      children: "99"
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.FcrToolTip, {
      onVisibleChange: handleChatTooltipVisibleChange,
      overlayClassName: "fcr-chatroom-tooltip",
      overlayInnerStyle: {
        padding: '15px 12px',
        background: 'var(--fcr_mobile_ui_scene_color_popup_fill1)',
        border: "1px solid var(--fcr_ui_scene_line2)",
        boxShadow: 'none'
      },
      arrowContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icon.FcrIcon, {
        colors: {
          iconPrimary: 'var(--fcr_mobile_ui_scene_color_popup_fill1)',
          iconSecondary: 'var(--fcr_ui_scene_line2)'
        },
        type: _type.FcrIconType.FCR_TOOLTIP_ARROW,
        size: 16
      }),
      visible: chatTooltipVisible,
      content: /*#__PURE__*/(0, _jsxRuntime.jsx)(FcrChatroomTooltipContent, {
        onClick: function onClick() {},
        message: null
      }),
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.FcrToolTip, {
        onVisibleChange: handleTooltipVisibleChange,
        visible: tooltipVisible,
        content: tooltip,
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_item.ActionBarItem, {
          id: id,
          order: order,
          className: "fcr-action-bar-chat",
          icon: _type.FcrIconType.FCR_CHAT2,
          title: title,
          iconColors: {
            iconPrimary: 'var(--fcr_web_ui_scene_mainicon1)'
          }
        })
      })
    })]
  });
};
var FcrChatroomTooltipContent = function FcrChatroomTooltipContent(_ref2) {
  var message = _ref2.message,
    onClick = _ref2.onClick;
  var transI18n = (0, _i18n.useI18n)();
  var isPrivateMessage = false;
  var msg = '这是什么意思？这是什么意思？是好ajskajsajslkajslajsajshakjs是这是什么意思？这是什么意思？是好ajskajsajslkajslajsajshakjs...';
  var nickName = 'aaa';
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
    className: "fcr-chatroom-tooltip-content",
    onClick: onClick,
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      className: "fcr-chatroom-tooltip-content-close",
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icon.FcrIcon, {
        type: _type.FcrIconType.FCR_CLOSE,
        size: 10,
        colors: {
          iconPrimary: 'var(--fcr_ui_scene_icontext1)'
        }
      })
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_avatar.FcrAvatar, {
      size: 32,
      textSize: 15,
      nickName: nickName
    }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
      className: "fcr-chatroom-tooltip-content-text",
      children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
        className: "fcr-chatroom-tooltip-content-from",
        children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
          children: [transI18n('fmt_chats_label_from'), " \xA0", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
            children: nickName
          })]
        }), isPrivateMessage && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
          className: "fcr-chatroom-tooltip-content-from-private",
          children: ["\xA0(", transI18n('fcr_chat_label_private'), ")"]
        })]
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        className: "fcr-chatroom-tooltip-content-msg",
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
          children: msg
        })
      })]
    })]
  });
};