Liferay.Loader.define("dynamic-data-mapping-form-report-web@1.0.29/js/components/card/Card.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/card', '@frontend-taglib-clay$clayui/icon', '@frontend-taglib-clay$clayui/layout', '@frontend-taglib-clay$clayui/tooltip', 'frontend-js-react-web$react', '../empty-state/EmptyState.es', '../sidebar/SidebarContext.es', '../summary/Summary.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

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

    var _card = _interopRequireDefault(require("@frontend-taglib-clay$clayui/card"));

    var _icon = _interopRequireDefault(require("@frontend-taglib-clay$clayui/icon"));

    var _layout = _interopRequireDefault(require("@frontend-taglib-clay$clayui/layout"));

    var _tooltip = require("@frontend-taglib-clay$clayui/tooltip");

    var _react = _interopRequireWildcard(require("frontend-js-react-web$react"));

    var _EmptyState = _interopRequireDefault(require("../empty-state/EmptyState.es"));

    var _SidebarContext = require("../sidebar/SidebarContext.es");

    var _Summary = _interopRequireDefault(require("../summary/Summary.es"));

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

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

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * This library is free software; you can redistribute it and/or modify it under
     * the terms of the GNU Lesser General Public License as published by the Free
     * Software Foundation; either version 2.1 of the License, or (at your option)
     * any later version.
     *
     * This library is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
     * details.
     */
    var TotalEntriesLabel = function TotalEntriesLabel(_ref) {
      var totalEntries = _ref.totalEntries;
      var label = Liferay.Language.get('there-are-no-entries');

      if (totalEntries == 1) {
        label = "1 ".concat(Liferay.Language.get('entry').toLowerCase());
      }

      if (totalEntries > 1) {
        label = "".concat(totalEntries, " ").concat(Liferay.Language.get('entries').toLowerCase());
      }

      return (/*#__PURE__*/_react.default.createElement(_card.default.Description, {
          displayType: "text",
          truncate: false
        }, label)
      );
    };

    var _default = function _default(_ref2) {
      var children = _ref2.children,
          _ref2$field = _ref2.field,
          icon = _ref2$field.icon,
          label = _ref2$field.label,
          title = _ref2$field.title,
          index = _ref2.index,
          summary = _ref2.summary,
          totalEntries = _ref2.totalEntries;

      var _useContext = (0, _react.useContext)(_SidebarContext.SidebarContext),
          portletNamespace = _useContext.portletNamespace;

      return (/*#__PURE__*/_react.default.createElement("div", {
          className: "card-item",
          id: "".concat(portletNamespace, "card_").concat(index)
        }, /*#__PURE__*/_react.default.createElement(_layout.default.Sheet, null, /*#__PURE__*/_react.default.createElement(_layout.default.Col, null, /*#__PURE__*/_react.default.createElement(_card.default, {
          displayType: "image"
        }, /*#__PURE__*/_react.default.createElement(_card.default.AspectRatio, {
          className: "card-header card-item-first"
        }, /*#__PURE__*/_react.default.createElement(_tooltip.ClayTooltipProvider, null, /*#__PURE__*/_react.default.createElement("div", {
          className: "aspect-ratio-item aspect-ratio-item-center-left aspect-ratio-item-fluid card-symbol card-type-asset-icon",
          "data-tooltip-align": "bottom",
          "data-tooltip-delay": 300,
          title: title
        }, /*#__PURE__*/_react.default.createElement(_icon.default, {
          symbol: icon
        }))), /*#__PURE__*/_react.default.createElement("div", {
          className: "field-info"
        }, /*#__PURE__*/_react.default.createElement(_card.default.Description, {
          displayType: "title"
        }, label), /*#__PURE__*/_react.default.createElement(TotalEntriesLabel, {
          totalEntries: totalEntries
        })), !!Object.entries(summary).length && /*#__PURE__*/_react.default.createElement(_Summary.default, {
          summary: summary
        })), /*#__PURE__*/_react.default.createElement(_card.default.Body, null, totalEntries > 0 ? children : /*#__PURE__*/_react.default.createElement(_EmptyState.default, {
          description: Liferay.Language.get('entries-submitted-with-this-field-filled-will-show-up-here')
        }))))))
      );
    };

    exports.default = _default;
    //# sourceMappingURL=Card.es.js.map
  }
});
//# sourceMappingURL=Card.es.js.map