"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CheckTitle = CheckTitle;

var _react = _interopRequireDefault(require("react"));

var _hooks = require("../../../utils/hooks");

var _Badge = require("../../Badge");

var _Icon = require("../../Icon");

var _jsxRuntime = require("react/jsx-runtime");

var _excluded = ["check", "className"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function CheckTitle(_ref) {
  var check = _ref.check,
      className = _ref.className,
      rest = _objectWithoutProperties(_ref, _excluded);

  var prevCheck = (0, _hooks.usePrevious)(check);
  var validCheck = check || prevCheck;
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({
    className: "flex flex-row ".concat(className)
  }, rest), {}, {
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      className: "w-14 flex-shrink-0 pr-1",
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
        name: (validCheck === null || validCheck === void 0 ? void 0 : validCheck.icon) || (validCheck === null || validCheck === void 0 ? void 0 : validCheck.type),
        size: "2xl"
      })
    }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
      className: "overflow-hidden mr-10",
      children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
        className: "flex flex-row items-center",
        children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
          title: validCheck === null || validCheck === void 0 ? void 0 : validCheck.name,
          className: "text-gray-800 text-2xl font-semibold whitespace-nowrap overflow-ellipsis overflow-hidden pr-4",
          children: validCheck === null || validCheck === void 0 ? void 0 : validCheck.name
        }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
          className: "hidden sm:block ",
          title: "Namespace for ".concat(validCheck === null || validCheck === void 0 ? void 0 : validCheck.name),
          style: {
            paddingTop: "1px"
          },
          children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Badge.Badge, {
            text: validCheck === null || validCheck === void 0 ? void 0 : validCheck.namespace
          })
        })]
      }), true && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        title: "Endpoint for ".concat(validCheck === null || validCheck === void 0 ? void 0 : validCheck.name),
        className: "text-sm text-gray-400 mt-0.5 overflow-x-hidden overflow-ellipsis break-all",
        children: validCheck === null || validCheck === void 0 ? void 0 : validCheck.endpoint
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
        className: "block sm:hidden mt-2",
        title: "Namespace for ".concat(validCheck === null || validCheck === void 0 ? void 0 : validCheck.name),
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Badge.Badge, {
          text: validCheck === null || validCheck === void 0 ? void 0 : validCheck.namespace
        })
      })]
    })]
  }));
}